Improve DAB radio support in refrence bcRadio HAL
Improved DAB radio support in the reference implementation for AIDL
broadcast radio HAL. Used real DAB service ID, ECC code, freuqnecy
and ensemble values for virtual DAB stations and implemented sub-channel
support for DAB radio.
Bug: 309693129
Test: atest VtsHalBroadcastradioAidlTargetTest
Change-Id: I6a78794e16400f05c6d7c5ec99aa4978adca5b58
diff --git a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h
index a139e00..bb43903 100644
--- a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h
+++ b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h
@@ -163,6 +163,12 @@
int getHdSubchannel(const ProgramSelector& sel);
+uint32_t getDabSId(const ProgramSelector& sel);
+
+int getDabEccCode(const ProgramSelector& sel);
+
+int getDabSCIdS(const ProgramSelector& sel);
+
bool hasAmFmFrequency(const ProgramSelector& sel);
uint32_t getAmFmFrequency(const ProgramSelector& sel);
diff --git a/broadcastradio/common/utilsaidl/src/Utils.cpp b/broadcastradio/common/utilsaidl/src/Utils.cpp
index 4c99514..76c3c6a 100644
--- a/broadcastradio/common/utilsaidl/src/Utils.cpp
+++ b/broadcastradio/common/utilsaidl/src/Utils.cpp
@@ -489,6 +489,21 @@
return static_cast<IdentifierType>(typeAsInt);
}
+uint32_t getDabSId(const ProgramSelector& sel) {
+ int64_t dabSidExt = getId(sel, IdentifierType::DAB_SID_EXT, /* defaultValue */ 0);
+ return static_cast<uint32_t>(dabSidExt & 0xFFFFFFFF);
+}
+
+int getDabEccCode(const ProgramSelector& sel) {
+ int64_t dabSidExt = getId(sel, IdentifierType::DAB_SID_EXT, /* defaultValue */ 0);
+ return static_cast<uint32_t>((dabSidExt >> 32) & 0xFF);
+}
+
+int getDabSCIdS(const ProgramSelector& sel) {
+ int64_t dabSidExt = getId(sel, IdentifierType::DAB_SID_EXT, /* defaultValue */ 0);
+ return static_cast<uint32_t>((dabSidExt >> 40) & 0xF);
+}
+
int getHdSubchannel(const ProgramSelector& sel) {
int64_t hdSidExt = getId(sel, IdentifierType::HD_STATION_ID_EXT, kValueForNotFoundIdentifier);
hdSidExt >>= 32; // Station ID number