Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d4207d9 authored by Weilin Xu's avatar Weilin Xu
Browse files

Improve DAB support in broadcast radio AIDL HAL

SID in DAB_SID_EXT was extended to 32-bit to support DMB radio.
The documatation for DAB program selector and program info was
updated to make a DAB station is uniquely specified. AIDL HAL
definition requirement for identifier, program selector and info
was enforced in the AIDL utils class. The default implementation
and VTS were also updated correspondingly.

Bug: 261912181
Test: atest VtsHalBroadcastradioAidlTargetTest
Change-Id: Ic420955340f0c77370106e736410d7125536e62d
parent 2b251bba
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -110,10 +110,11 @@ enum IdentifierType {
    HD_STATION_NAME,

    /**
     * 28bit compound primary identifier for Digital Audio Broadcasting.
     * 44bit compound primary identifier for Digital Audio Broadcasting and
     * Digital Multimeida Broadcasting.
     *
     * Consists of (from the LSB):
     * - 16bit: SId;
     * - 32bit: SId;
     * - 8bit: ECC code;
     * - 4bit: SCIdS.
     *
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ parcelable ProgramInfo {
     *
     * Only physical identifiers are valid:
     *  - AMFM_FREQUENCY_KHZ;
     *  - DAB_ENSEMBLE;
     *  - DAB_FREQUENCY_KHZ;
     *  - DRMO_FREQUENCY_KHZ;
     *  - SXM_CHANNEL;
     *  - VENDOR_*;
+2 −1
Original line number Diff line number Diff line
@@ -51,7 +51,8 @@ parcelable ProgramSelector {
     *  - analogue AM/FM: AMFM_FREQUENCY_KHZ;
     *  - FM RDS: RDS_PI;
     *  - HD Radio: HD_STATION_ID_EXT;
     *  - DAB: DAB_SID_EXT;
     *  - DAB/DMB: DAB_SID_EXT (when used, DAB_ENSEMBLE and DAB_FREQUENCY_KHZ
     *    must present in secondaryIds);
     *  - Digital Radio Mondiale: DRMO_SERVICE_ID;
     *  - SiriusXM: SXM_SERVICE_ID;
     *  - vendor-specific: VENDOR_START..VENDOR_END.
+12 −6
Original line number Diff line number Diff line
@@ -589,22 +589,28 @@ binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numA
    }
    ProgramSelector sel = {};
    if (isDab) {
        if (numArgs != 4) {
        if (numArgs != 5) {
            dprintf(fd,
                    "Invalid number of arguments: please provide --tune dab <SID> <ENSEMBLE>\n");
                    "Invalid number of arguments: please provide "
                    "--tune dab <SID> <ENSEMBLE> <FREQUENCY>\n");
            return STATUS_BAD_VALUE;
        }
        int sid;
        if (!utils::parseArgInt(string(args[2]), &sid)) {
            dprintf(fd, "Non-integer sid provided with tune: %s\n", string(args[2]).c_str());
            dprintf(fd, "Non-integer sid provided with tune: %s\n", args[2]);
            return STATUS_BAD_VALUE;
        }
        int ensemble;
        if (!utils::parseArgInt(string(args[3]), &ensemble)) {
            dprintf(fd, "Non-integer ensemble provided with tune: %s\n", string(args[3]).c_str());
            dprintf(fd, "Non-integer ensemble provided with tune: %s\n", args[3]);
            return STATUS_BAD_VALUE;
        }
        int freq;
        if (!utils::parseArgInt(string(args[4]), &freq)) {
            dprintf(fd, "Non-integer frequency provided with tune: %s\n", args[4]);
            return STATUS_BAD_VALUE;
        }
        sel = utils::makeSelectorDab(sid, ensemble);
        sel = utils::makeSelectorDab(sid, ensemble, freq);
    } else {
        if (numArgs != 3) {
            dprintf(fd, "Invalid number of arguments: please provide --tune amfm <FREQUENCY>\n");
@@ -612,7 +618,7 @@ binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numA
        }
        int freq;
        if (!utils::parseArgInt(string(args[2]), &freq)) {
            dprintf(fd, "Non-integer frequency provided with tune: %s\n", string(args[2]).c_str());
            dprintf(fd, "Non-integer frequency provided with tune: %s\n", args[2]);
            return STATUS_BAD_VALUE;
        }
        sel = utils::makeSelectorAmfm(freq);
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ VirtualProgram::operator ProgramInfo() const {
            break;
        case IdentifierType::DAB_SID_EXT:
            info.logicallyTunedTo = selectId(IdentifierType::DAB_SID_EXT);
            info.physicallyTunedTo = selectId(IdentifierType::DAB_ENSEMBLE);
            info.physicallyTunedTo = selectId(IdentifierType::DAB_FREQUENCY_KHZ);
            break;
        case IdentifierType::DRMO_SERVICE_ID:
            info.logicallyTunedTo = selectId(IdentifierType::DRMO_SERVICE_ID);
Loading