Widen dummy band range to cover all regions.

Bug: b/64115131
Test: VTS, instrumentation
Change-Id: I34e9aac440a003226200243c835e6116ba7eae90
This commit is contained in:
Tomasz Wasilczyk 2017-08-10 12:32:45 -07:00
parent cc1007af33
commit 701a5bdda5
5 changed files with 42 additions and 24 deletions

View file

@ -44,17 +44,29 @@ static const map<Class, ModuleConfig> gModuleConfigs{
{Class::AM_FM, ModuleConfig({
"Digital radio mock",
{ // amFmBands
AmFmBandConfig({
Band::AM,
153, // lowerLimit
26100, // upperLimit
{5, 9, 10}, // spacings
}),
AmFmBandConfig({
Band::FM,
65800, // lowerLimit
108000, // upperLimit
{10, 100, 200}, // spacings
}),
AmFmBandConfig({
Band::AM_HD,
540, // lowerLimit
1610, // upperLimit
10, // spacing
153, // lowerLimit
26100, // upperLimit
{5, 9, 10}, // spacings
}),
AmFmBandConfig({
Band::FM_HD,
87900, // lowerLimit
107900, // upperLimit
200, // spacing
{200}, // spacings
}),
},
})},
@ -114,14 +126,14 @@ Return<void> BroadcastRadio::getProperties_1_1(getProperties_1_1_cb _hidl_cb) {
dst.antennaConnected = true;
dst.lowerLimit = src.lowerLimit;
dst.upperLimit = src.upperLimit;
dst.spacings = vector<uint32_t>({src.spacing});
dst.spacings = src.spacings;
if (src.type == Band::AM) {
if (utils::isAm(src.type)) {
dst.ext.am.stereo = true;
} else if (src.type == Band::FM) {
dst.ext.fm.deemphasis = Deemphasis::D75;
} else if (utils::isFm(src.type)) {
dst.ext.fm.deemphasis = static_cast<Deemphasis>(Deemphasis::D50 | Deemphasis::D75);
dst.ext.fm.stereo = true;
dst.ext.fm.rds = Rds::US;
dst.ext.fm.rds = static_cast<Rds>(Rds::WORLD | Rds::US);
dst.ext.fm.ta = true;
dst.ext.fm.af = true;
dst.ext.fm.ea = true;

View file

@ -31,7 +31,7 @@ struct AmFmBandConfig {
V1_0::Band type;
uint32_t lowerLimit; // kHz
uint32_t upperLimit; // kHz
uint32_t spacing; // kHz
std::vector<uint32_t> spacings; // kHz
};
struct ModuleConfig {

View file

@ -83,7 +83,7 @@ Return<Result> Tuner::setConfiguration(const BandConfig& config) {
mAmfmConfig.antennaConnected = true;
mCurrentProgram = utils::make_selector(mAmfmConfig.type, mAmfmConfig.lowerLimit);
if (mAmfmConfig.type == Band::FM_HD || mAmfmConfig.type == Band::FM) {
if (utils::isFm(mAmfmConfig.type)) {
mVirtualRadio = std::ref(getFmRadio());
} else {
mVirtualRadio = std::ref(getAmRadio());

View file

@ -119,6 +119,14 @@ bool isAmFm(const ProgramType type) {
}
}
bool isAm(const Band band) {
return band == Band::AM || band == Band::AM_HD;
}
bool isFm(const Band band) {
return band == Band::FM || band == Band::FM_HD;
}
bool hasId(const ProgramSelector& sel, const IdentifierType type) {
auto itype = static_cast<uint32_t>(type);
if (sel.primaryId.type == itype) return true;
@ -153,17 +161,12 @@ ProgramSelector make_selector(Band band, uint32_t channel, uint32_t subChannel)
// we can't use ProgramType::AM_HD or FM_HD, because we don't know HD station ID
ProgramType type;
switch (band) {
case Band::AM:
case Band::AM_HD:
type = ProgramType::AM;
break;
case Band::FM:
case Band::FM_HD:
type = ProgramType::FM;
break;
default:
LOG_ALWAYS_FATAL("Unsupported band: %s", toString(band).c_str());
if (isAm(band)) {
type = ProgramType::AM;
} else if (isFm(band)) {
type = ProgramType::FM;
} else {
LOG_ALWAYS_FATAL("Unsupported band: %s", toString(band).c_str());
}
sel.programType = static_cast<uint32_t>(type);
@ -219,9 +222,9 @@ bool operator==(const BandConfig& l, const BandConfig& r) {
if (l.lowerLimit != r.lowerLimit) return false;
if (l.upperLimit != r.upperLimit) return false;
if (l.spacings != r.spacings) return false;
if (l.type == Band::AM || l.type == Band::AM_HD) {
if (V1_1::utils::isAm(l.type)) {
return l.ext.am == r.ext.am;
} else if (l.type == Band::FM || l.type == Band::FM_HD) {
} else if (V1_1::utils::isFm(l.type)) {
return l.ext.fm == r.ext.fm;
} else {
ALOGW("Unsupported band config type: %s", toString(l.type).c_str());

View file

@ -48,6 +48,9 @@ bool tunesTo(const ProgramSelector& pointer, const ProgramSelector& channel);
ProgramType getType(const ProgramSelector& sel);
bool isAmFm(const ProgramType type);
bool isAm(const V1_0::Band band);
bool isFm(const V1_0::Band band);
bool hasId(const ProgramSelector& sel, const IdentifierType type);
/**