Loading broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl +3 −2 Original line number Original line Diff line number Diff line Loading @@ -73,14 +73,15 @@ parcelable AmFmRegionConfig { /** /** * De-emphasis filter supported/configured. * De-emphasis filter supported/configured. * * * It is a bitset of de-emphasis values (DEEMPHASIS_D50 and DEEMPHASIS_D75). * It can be a combination of de-emphasis values ({@link #DEEMPHASIS_D50} and * {@link #DEEMPHASIS_D75}). */ */ int fmDeemphasis; int fmDeemphasis; /** /** * RDS/RBDS variant supported/configured. * RDS/RBDS variant supported/configured. * * * It is a bitset of RDS values (RDS and RBDS). * It can be a combination of RDS values ({@link #RDS} and {@link #RBDS}). */ */ int fmRds; int fmRds; } } broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl +4 −0 Original line number Original line Diff line number Diff line Loading @@ -150,6 +150,10 @@ parcelable ProgramInfo { /** /** * Program flags. * Program flags. * * It can be a combination of {@link #FLAG_LIVE}, {@link #FLAG_MUTED}, * {@link #FLAG_TRAFFIC_PROGRAM}, {@link #FLAG_TRAFFIC_ANNOUNCEMENT}, * {@link #FLAG_TUNABLE}, and {@link #FLAG_STEREO}. */ */ int infoFlags; int infoFlags; Loading broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl +5 −3 Original line number Original line Diff line number Diff line Loading @@ -51,8 +51,7 @@ parcelable ProgramSelector { * - analogue AM/FM: AMFM_FREQUENCY_KHZ; * - analogue AM/FM: AMFM_FREQUENCY_KHZ; * - FM RDS: RDS_PI; * - FM RDS: RDS_PI; * - HD Radio: HD_STATION_ID_EXT; * - HD Radio: HD_STATION_ID_EXT; * - DAB/DMB: DAB_SID_EXT (when used, DAB_ENSEMBLE and DAB_FREQUENCY_KHZ * - DAB/DMB: DAB_SID_EXT; * must present in secondaryIds); * - Digital Radio Mondiale: DRMO_SERVICE_ID; * - Digital Radio Mondiale: DRMO_SERVICE_ID; * - SiriusXM: SXM_SERVICE_ID; * - SiriusXM: SXM_SERVICE_ID; * - vendor-specific: VENDOR_START..VENDOR_END. * - vendor-specific: VENDOR_START..VENDOR_END. Loading @@ -63,13 +62,16 @@ parcelable ProgramSelector { * Secondary program identifiers. * Secondary program identifiers. * * * These identifiers are supplementary and can speed up tuning process, * These identifiers are supplementary and can speed up tuning process, * but the primary ID must be sufficient (i.e. RDS PI is enough to select * but the primary ID should be sufficient (i.e. RDS PI is enough to select * a station from the list after a full band scan). * a station from the list after a full band scan). * * * Two selectors with different secondary IDs, but the same primary ID are * Two selectors with different secondary IDs, but the same primary ID are * considered equal. In particular, secondary IDs array may get updated for * considered equal. In particular, secondary IDs array may get updated for * an entry on the program list (ie. when a better frequency for a given * an entry on the program list (ie. when a better frequency for a given * station is found). * station is found). * * If DAB_SID_EXT is used as primaryId, using DAB_ENSEMBLE or DAB_FREQUENCY_KHZ * as secondray identifiers can uniquely identify the DAB station. */ */ ProgramIdentifier[] secondaryIds; ProgramIdentifier[] secondaryIds; } } broadcastradio/aidl/default/BroadcastRadio.cpp +17 −12 Original line number Original line Diff line number Diff line Loading @@ -589,10 +589,11 @@ binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numA } } ProgramSelector sel = {}; ProgramSelector sel = {}; if (isDab) { if (isDab) { if (numArgs != 5) { if (numArgs != 5 && numArgs != 3) { dprintf(fd, dprintf(fd, "Invalid number of arguments: please provide " "Invalid number of arguments: please provide " "--tune dab <SID> <ENSEMBLE> <FREQUENCY>\n"); "--tune dab <SID> <ENSEMBLE> <FREQUENCY> or " "--tune dab <SID>\n"); return STATUS_BAD_VALUE; return STATUS_BAD_VALUE; } } int sid; int sid; Loading @@ -600,6 +601,9 @@ binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numA dprintf(fd, "Non-integer sid provided with tune: %s\n", args[2]); dprintf(fd, "Non-integer sid provided with tune: %s\n", args[2]); return STATUS_BAD_VALUE; return STATUS_BAD_VALUE; } } if (numArgs == 3) { sel = utils::makeSelectorDab(sid); } else { int ensemble; int ensemble; if (!utils::parseArgInt(string(args[3]), &ensemble)) { if (!utils::parseArgInt(string(args[3]), &ensemble)) { dprintf(fd, "Non-integer ensemble provided with tune: %s\n", args[3]); dprintf(fd, "Non-integer ensemble provided with tune: %s\n", args[3]); Loading @@ -611,6 +615,7 @@ binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numA return STATUS_BAD_VALUE; return STATUS_BAD_VALUE; } } sel = utils::makeSelectorDab(sid, ensemble, freq); sel = utils::makeSelectorDab(sid, ensemble, freq); } } else { } else { if (numArgs != 3) { if (numArgs != 3) { dprintf(fd, "Invalid number of arguments: please provide --tune amfm <FREQUENCY>\n"); dprintf(fd, "Invalid number of arguments: please provide --tune amfm <FREQUENCY>\n"); Loading broadcastradio/common/utilsaidl/Utils.cpp +19 −22 Original line number Original line Diff line number Diff line Loading @@ -136,9 +136,18 @@ bool tunesTo(const ProgramSelector& a, const ProgramSelector& b) { return getHdSubchannel(b) == 0 && return getHdSubchannel(b) == 0 && haveEqualIds(a, b, IdentifierType::AMFM_FREQUENCY_KHZ); haveEqualIds(a, b, IdentifierType::AMFM_FREQUENCY_KHZ); case IdentifierType::DAB_SID_EXT: case IdentifierType::DAB_SID_EXT: return haveEqualIds(a, b, IdentifierType::DAB_SID_EXT) && if (!haveEqualIds(a, b, IdentifierType::DAB_SID_EXT)) { haveEqualIds(a, b, IdentifierType::DAB_ENSEMBLE) && return false; haveEqualIds(a, b, IdentifierType::DAB_FREQUENCY_KHZ); } if (hasId(a, IdentifierType::DAB_ENSEMBLE) && !haveEqualIds(a, b, IdentifierType::DAB_ENSEMBLE)) { return false; } if (hasId(a, IdentifierType::DAB_FREQUENCY_KHZ) && !haveEqualIds(a, b, IdentifierType::DAB_FREQUENCY_KHZ)) { return false; } return true; case IdentifierType::DRMO_SERVICE_ID: case IdentifierType::DRMO_SERVICE_ID: return haveEqualIds(a, b, IdentifierType::DRMO_SERVICE_ID); return haveEqualIds(a, b, IdentifierType::DRMO_SERVICE_ID); case IdentifierType::SXM_SERVICE_ID: case IdentifierType::SXM_SERVICE_ID: Loading Loading @@ -289,25 +298,7 @@ bool isValid(const ProgramSelector& sel) { sel.primaryId.type > IdentifierType::VENDOR_END)) { sel.primaryId.type > IdentifierType::VENDOR_END)) { return false; return false; } } if (!isValid(sel.primaryId)) { return isValid(sel.primaryId); return false; } bool isDab = sel.primaryId.type == IdentifierType::DAB_SID_EXT; bool hasDabEnsemble = false; bool hasDabFrequency = false; for (auto it = sel.secondaryIds.begin(); it != sel.secondaryIds.end(); it++) { if (!isValid(*it)) { return false; } if (isDab && it->type == IdentifierType::DAB_ENSEMBLE) { hasDabEnsemble = true; } if (isDab && it->type == IdentifierType::DAB_FREQUENCY_KHZ) { hasDabFrequency = true; } } return !isDab || (hasDabEnsemble && hasDabFrequency); } } ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value) { ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value) { Loading @@ -320,6 +311,12 @@ ProgramSelector makeSelectorAmfm(int32_t frequency) { return sel; return sel; } } ProgramSelector makeSelectorDab(int64_t sidExt) { ProgramSelector sel = {}; sel.primaryId = makeIdentifier(IdentifierType::DAB_SID_EXT, sidExt); return sel; } ProgramSelector makeSelectorDab(int64_t sidExt, int32_t ensemble, int64_t freq) { ProgramSelector makeSelectorDab(int64_t sidExt, int32_t ensemble, int64_t freq) { ProgramSelector sel = {}; ProgramSelector sel = {}; sel.primaryId = makeIdentifier(IdentifierType::DAB_SID_EXT, sidExt); sel.primaryId = makeIdentifier(IdentifierType::DAB_SID_EXT, sidExt); Loading Loading
broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl +3 −2 Original line number Original line Diff line number Diff line Loading @@ -73,14 +73,15 @@ parcelable AmFmRegionConfig { /** /** * De-emphasis filter supported/configured. * De-emphasis filter supported/configured. * * * It is a bitset of de-emphasis values (DEEMPHASIS_D50 and DEEMPHASIS_D75). * It can be a combination of de-emphasis values ({@link #DEEMPHASIS_D50} and * {@link #DEEMPHASIS_D75}). */ */ int fmDeemphasis; int fmDeemphasis; /** /** * RDS/RBDS variant supported/configured. * RDS/RBDS variant supported/configured. * * * It is a bitset of RDS values (RDS and RBDS). * It can be a combination of RDS values ({@link #RDS} and {@link #RBDS}). */ */ int fmRds; int fmRds; } }
broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl +4 −0 Original line number Original line Diff line number Diff line Loading @@ -150,6 +150,10 @@ parcelable ProgramInfo { /** /** * Program flags. * Program flags. * * It can be a combination of {@link #FLAG_LIVE}, {@link #FLAG_MUTED}, * {@link #FLAG_TRAFFIC_PROGRAM}, {@link #FLAG_TRAFFIC_ANNOUNCEMENT}, * {@link #FLAG_TUNABLE}, and {@link #FLAG_STEREO}. */ */ int infoFlags; int infoFlags; Loading
broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl +5 −3 Original line number Original line Diff line number Diff line Loading @@ -51,8 +51,7 @@ parcelable ProgramSelector { * - analogue AM/FM: AMFM_FREQUENCY_KHZ; * - analogue AM/FM: AMFM_FREQUENCY_KHZ; * - FM RDS: RDS_PI; * - FM RDS: RDS_PI; * - HD Radio: HD_STATION_ID_EXT; * - HD Radio: HD_STATION_ID_EXT; * - DAB/DMB: DAB_SID_EXT (when used, DAB_ENSEMBLE and DAB_FREQUENCY_KHZ * - DAB/DMB: DAB_SID_EXT; * must present in secondaryIds); * - Digital Radio Mondiale: DRMO_SERVICE_ID; * - Digital Radio Mondiale: DRMO_SERVICE_ID; * - SiriusXM: SXM_SERVICE_ID; * - SiriusXM: SXM_SERVICE_ID; * - vendor-specific: VENDOR_START..VENDOR_END. * - vendor-specific: VENDOR_START..VENDOR_END. Loading @@ -63,13 +62,16 @@ parcelable ProgramSelector { * Secondary program identifiers. * Secondary program identifiers. * * * These identifiers are supplementary and can speed up tuning process, * These identifiers are supplementary and can speed up tuning process, * but the primary ID must be sufficient (i.e. RDS PI is enough to select * but the primary ID should be sufficient (i.e. RDS PI is enough to select * a station from the list after a full band scan). * a station from the list after a full band scan). * * * Two selectors with different secondary IDs, but the same primary ID are * Two selectors with different secondary IDs, but the same primary ID are * considered equal. In particular, secondary IDs array may get updated for * considered equal. In particular, secondary IDs array may get updated for * an entry on the program list (ie. when a better frequency for a given * an entry on the program list (ie. when a better frequency for a given * station is found). * station is found). * * If DAB_SID_EXT is used as primaryId, using DAB_ENSEMBLE or DAB_FREQUENCY_KHZ * as secondray identifiers can uniquely identify the DAB station. */ */ ProgramIdentifier[] secondaryIds; ProgramIdentifier[] secondaryIds; } }
broadcastradio/aidl/default/BroadcastRadio.cpp +17 −12 Original line number Original line Diff line number Diff line Loading @@ -589,10 +589,11 @@ binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numA } } ProgramSelector sel = {}; ProgramSelector sel = {}; if (isDab) { if (isDab) { if (numArgs != 5) { if (numArgs != 5 && numArgs != 3) { dprintf(fd, dprintf(fd, "Invalid number of arguments: please provide " "Invalid number of arguments: please provide " "--tune dab <SID> <ENSEMBLE> <FREQUENCY>\n"); "--tune dab <SID> <ENSEMBLE> <FREQUENCY> or " "--tune dab <SID>\n"); return STATUS_BAD_VALUE; return STATUS_BAD_VALUE; } } int sid; int sid; Loading @@ -600,6 +601,9 @@ binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numA dprintf(fd, "Non-integer sid provided with tune: %s\n", args[2]); dprintf(fd, "Non-integer sid provided with tune: %s\n", args[2]); return STATUS_BAD_VALUE; return STATUS_BAD_VALUE; } } if (numArgs == 3) { sel = utils::makeSelectorDab(sid); } else { int ensemble; int ensemble; if (!utils::parseArgInt(string(args[3]), &ensemble)) { if (!utils::parseArgInt(string(args[3]), &ensemble)) { dprintf(fd, "Non-integer ensemble provided with tune: %s\n", args[3]); dprintf(fd, "Non-integer ensemble provided with tune: %s\n", args[3]); Loading @@ -611,6 +615,7 @@ binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numA return STATUS_BAD_VALUE; return STATUS_BAD_VALUE; } } sel = utils::makeSelectorDab(sid, ensemble, freq); sel = utils::makeSelectorDab(sid, ensemble, freq); } } else { } else { if (numArgs != 3) { if (numArgs != 3) { dprintf(fd, "Invalid number of arguments: please provide --tune amfm <FREQUENCY>\n"); dprintf(fd, "Invalid number of arguments: please provide --tune amfm <FREQUENCY>\n"); Loading
broadcastradio/common/utilsaidl/Utils.cpp +19 −22 Original line number Original line Diff line number Diff line Loading @@ -136,9 +136,18 @@ bool tunesTo(const ProgramSelector& a, const ProgramSelector& b) { return getHdSubchannel(b) == 0 && return getHdSubchannel(b) == 0 && haveEqualIds(a, b, IdentifierType::AMFM_FREQUENCY_KHZ); haveEqualIds(a, b, IdentifierType::AMFM_FREQUENCY_KHZ); case IdentifierType::DAB_SID_EXT: case IdentifierType::DAB_SID_EXT: return haveEqualIds(a, b, IdentifierType::DAB_SID_EXT) && if (!haveEqualIds(a, b, IdentifierType::DAB_SID_EXT)) { haveEqualIds(a, b, IdentifierType::DAB_ENSEMBLE) && return false; haveEqualIds(a, b, IdentifierType::DAB_FREQUENCY_KHZ); } if (hasId(a, IdentifierType::DAB_ENSEMBLE) && !haveEqualIds(a, b, IdentifierType::DAB_ENSEMBLE)) { return false; } if (hasId(a, IdentifierType::DAB_FREQUENCY_KHZ) && !haveEqualIds(a, b, IdentifierType::DAB_FREQUENCY_KHZ)) { return false; } return true; case IdentifierType::DRMO_SERVICE_ID: case IdentifierType::DRMO_SERVICE_ID: return haveEqualIds(a, b, IdentifierType::DRMO_SERVICE_ID); return haveEqualIds(a, b, IdentifierType::DRMO_SERVICE_ID); case IdentifierType::SXM_SERVICE_ID: case IdentifierType::SXM_SERVICE_ID: Loading Loading @@ -289,25 +298,7 @@ bool isValid(const ProgramSelector& sel) { sel.primaryId.type > IdentifierType::VENDOR_END)) { sel.primaryId.type > IdentifierType::VENDOR_END)) { return false; return false; } } if (!isValid(sel.primaryId)) { return isValid(sel.primaryId); return false; } bool isDab = sel.primaryId.type == IdentifierType::DAB_SID_EXT; bool hasDabEnsemble = false; bool hasDabFrequency = false; for (auto it = sel.secondaryIds.begin(); it != sel.secondaryIds.end(); it++) { if (!isValid(*it)) { return false; } if (isDab && it->type == IdentifierType::DAB_ENSEMBLE) { hasDabEnsemble = true; } if (isDab && it->type == IdentifierType::DAB_FREQUENCY_KHZ) { hasDabFrequency = true; } } return !isDab || (hasDabEnsemble && hasDabFrequency); } } ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value) { ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value) { Loading @@ -320,6 +311,12 @@ ProgramSelector makeSelectorAmfm(int32_t frequency) { return sel; return sel; } } ProgramSelector makeSelectorDab(int64_t sidExt) { ProgramSelector sel = {}; sel.primaryId = makeIdentifier(IdentifierType::DAB_SID_EXT, sidExt); return sel; } ProgramSelector makeSelectorDab(int64_t sidExt, int32_t ensemble, int64_t freq) { ProgramSelector makeSelectorDab(int64_t sidExt, int32_t ensemble, int64_t freq) { ProgramSelector sel = {}; ProgramSelector sel = {}; sel.primaryId = makeIdentifier(IdentifierType::DAB_SID_EXT, sidExt); sel.primaryId = makeIdentifier(IdentifierType::DAB_SID_EXT, sidExt); Loading