Loading tv/tuner/1.1/ITuner.hal +8 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.hardware.tv.tuner@1.1; import @1.0::FrontendId; import @1.0::ITuner; import @1.0::Result; Loading @@ -23,4 +24,10 @@ import @1.0::Result; * Top level interface to manage Frontend, Demux and Decrambler hardware * resources which are needed for Android TV. */ interface ITuner extends @1.0::ITuner {}; interface ITuner extends @1.0::ITuner { /** * Get Dtmb Frontend Capabilities. If no dtmb exists, Result::UNAVAILABLE would be returned. */ getFrontendDtmbCapabilities(FrontendId frontendId) generates (Result result, FrontendDtmbCapabilities caps); }; tv/tuner/1.1/default/Tuner.cpp +17 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ namespace implementation { Tuner::Tuner() { // Static Frontends array to maintain local frontends information // Array index matches their FrontendId in the default impl mFrontendSize = 8; mFrontendSize = 9; mFrontends[0] = new Frontend(FrontendType::DVBT, 0, this); mFrontends[1] = new Frontend(FrontendType::ATSC, 1, this); mFrontends[2] = new Frontend(FrontendType::DVBC, 2, this); Loading @@ -42,6 +42,8 @@ Tuner::Tuner() { mFrontends[5] = new Frontend(FrontendType::ISDBT, 5, this); mFrontends[6] = new Frontend(FrontendType::ANALOG, 6, this); mFrontends[7] = new Frontend(FrontendType::ATSC, 7, this); mFrontends[8] = new Frontend(static_cast<V1_0::FrontendType>(V1_1::FrontendType::DTMB), 8, this); FrontendInfo::FrontendCapabilities caps; caps = FrontendInfo::FrontendCapabilities(); Loading Loading @@ -224,6 +226,20 @@ Return<void> Tuner::openLnbByName(const hidl_string& /*lnbName*/, openLnbByName_ return Void(); } Return<void> Tuner::getFrontendDtmbCapabilities(uint32_t frontendId, getFrontendDtmbCapabilities_cb _hidl_cb) { ALOGV("%s", __FUNCTION__); if (mFrontends[frontendId] != nullptr && (mFrontends[frontendId]->getFrontendType() == static_cast<V1_0::FrontendType>(V1_1::FrontendType::DTMB))) { _hidl_cb(Result::SUCCESS, mDtmbCaps); } else { _hidl_cb(Result::UNAVAILABLE, mDtmbCaps); } return Void(); } void Tuner::setFrontendAsDemuxSource(uint32_t frontendId, uint32_t demuxId) { mFrontendToDemux[frontendId] = demuxId; if (mFrontends[frontendId] != nullptr && mFrontends[frontendId]->isLocked()) { Loading tv/tuner/1.1/default/Tuner.h +4 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,9 @@ class Tuner : public ITuner { virtual Return<void> openLnbByName(const hidl_string& lnbName, openLnbByName_cb _hidl_cb) override; virtual Return<void> getFrontendDtmbCapabilities( uint32_t frontendId, getFrontendDtmbCapabilities_cb _hidl_cb) override; sp<Frontend> getFrontendById(uint32_t frontendId); void setFrontendAsDemuxSource(uint32_t frontendId, uint32_t demuxId); Loading @@ -76,6 +79,7 @@ class Tuner : public ITuner { // Static mFrontends array to maintain local frontends information map<uint32_t, sp<Frontend>> mFrontends; map<uint32_t, FrontendInfo::FrontendCapabilities> mFrontendCaps; V1_1::FrontendDtmbCapabilities mDtmbCaps; map<uint32_t, uint32_t> mFrontendToDemux; map<uint32_t, sp<Demux>> mDemuxes; // To maintain how many Frontends we have Loading tv/tuner/1.1/types.hal +142 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import @1.0::DemuxFilterTsRecordEvent; import @1.0::FrontendDvbcSpectralInversion; import @1.0::FrontendDvbtConstellation; import @1.0::FrontendDvbtTransmissionMode; import @1.0::FrontendType; import android.hidl.safe_union@1.0; import android.hidl.safe_union@1.0::Monostate; Loading Loading @@ -181,5 +182,146 @@ struct FrontendSettingsExt1_1 { FrontendDvbsSettingsExt1_1 dvbs; FrontendDvbtSettingsExt1_1 dvbt; FrontendDtmbSettings dtmb; } settingExt; }; /** * Extended Frontend Type. */ @export enum FrontendType : @1.0::FrontendType { /** * DTMB (Digital Terrestrial Multimedia Broadcast) standard. */ DTMB, }; /** * Bandwidth Type for DTMB. */ @export enum FrontendDtmbBandwidth : uint32_t { UNDEFINED = 0, /** * hardware is able to detect and set Bandwidth automatically */ AUTO = 1 << 0, BANDWIDTH_8MHZ = 1 << 1, BANDWIDTH_6MHZ = 1 << 2, }; /** * TimeInterleaveMode Type for DTMB. */ @export enum FrontendDtmbTimeInterleaveMode : uint32_t { UNDEFINED = 0, /** * hardware is able to detect and set time interleave mode automatically */ AUTO = 1 << 0, TIMER_INT_240 = 1 << 1, TIMER_INT_720 = 1 << 2, }; /** * FrontendDtmbModulation Type for DTMB. */ @export enum FrontendDtmbModulation : uint32_t { UNDEFINED = 0, /** * hardware is able to detect and set Constellation automatically */ AUTO = 1 << 0, CONSTELLATION_4QAM = 1 << 1, CONSTELLATION_4QAM_NR = 1 << 2, CONSTELLATION_16QAM = 1 << 3, CONSTELLATION_32QAM = 1 << 4, CONSTELLATION_64QAM = 1 << 5, }; /** * CODERATE Type for DTMB. */ @export enum FrontendDtmbCodeRate : uint32_t { UNDEFINED = 0, /** * hardware is able to detect and set code rate automatically */ AUTO = 1 << 0, CODERATE_2_5 = 1 << 1, CODERATE_3_5 = 1 << 2, CODERATE_4_5 = 1 << 3, }; /** * Guard Interval Type for DTMB. */ @export enum FrontendDtmbGuardInterval : uint32_t { UNDEFINED = 0, /** * hardware is able to detect and set Guard Interval automatically */ AUTO = 1 << 0, PN_420_VARIOUS = 1 << 1, PN_595_CONST = 1 << 2, PN_945_VARIOUS = 1 << 3, PN_420_CONST = 1 << 4, PN_945_CONST = 1 << 5, PN_RESERVED = 1 << 6, }; /** * Transmission Mode for DTMB. */ @export enum FrontendDtmbTransmissionMode : uint32_t { UNDEFINED = 0, /** * hardware is able to detect and set Transmission Mode automatically */ AUTO = 1 << 0, C1 = 1 << 1, C3780 = 1 << 2, }; /** * Signal Setting for DTMB Frontend. */ struct FrontendDtmbSettings { uint32_t frequency; FrontendDtmbTransmissionMode transmissionMode; FrontendDtmbBandwidth bandwidth; FrontendDtmbModulation modulation; FrontendDtmbCodeRate codeRate; FrontendDtmbGuardInterval guardInterval; FrontendDtmbTimeInterleaveMode interleaveMode; }; /** * Capabilities for DTMB Frontend. */ struct FrontendDtmbCapabilities { bitfield<FrontendDtmbTransmissionMode> transmissionModeCap; bitfield<FrontendDtmbBandwidth> bandwidthCap; bitfield<FrontendDtmbModulation> modulationCap; bitfield<FrontendDtmbCodeRate> codeRateCap; bitfield<FrontendDtmbGuardInterval> guardIntervalCap; bitfield<FrontendDtmbTimeInterleaveMode> interleaveModeCap; }; tv/tuner/1.1/vts/functional/FrontendTests.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -243,6 +243,14 @@ AssertionResult FrontendTests::stopScanFrontend() { EXPECT_TRUE(mFrontend) << "Test with openFrontendById first."; Result status; status = mFrontend->stopScan(); return AssertionResult(status == Result::SUCCESS); } AssertionResult FrontendTests::getFrontendDtmbCaps(uint32_t id) { Result status; mService->getFrontendDtmbCapabilities( id, [&](Result result, const FrontendDtmbCapabilities& /*caps*/) { status = result; }); return AssertionResult(status == Result::SUCCESS); } Loading Loading @@ -440,3 +448,14 @@ void FrontendTests::scanTest(FrontendConfig frontendConf, FrontendScanType scanT ASSERT_TRUE(stopScanFrontend()); ASSERT_TRUE(closeFrontend()); } void FrontendTests::getFrontendDtmbCapsTest() { uint32_t feId; getFrontendIdByType( static_cast<FrontendType>(android::hardware::tv::tuner::V1_1::FrontendType::DTMB), feId); if (feId != INVALID_ID) { ALOGD("[vts] Found DTMB Frontend"); ASSERT_TRUE(getFrontendDtmbCaps(feId)); } } Loading
tv/tuner/1.1/ITuner.hal +8 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.hardware.tv.tuner@1.1; import @1.0::FrontendId; import @1.0::ITuner; import @1.0::Result; Loading @@ -23,4 +24,10 @@ import @1.0::Result; * Top level interface to manage Frontend, Demux and Decrambler hardware * resources which are needed for Android TV. */ interface ITuner extends @1.0::ITuner {}; interface ITuner extends @1.0::ITuner { /** * Get Dtmb Frontend Capabilities. If no dtmb exists, Result::UNAVAILABLE would be returned. */ getFrontendDtmbCapabilities(FrontendId frontendId) generates (Result result, FrontendDtmbCapabilities caps); };
tv/tuner/1.1/default/Tuner.cpp +17 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ namespace implementation { Tuner::Tuner() { // Static Frontends array to maintain local frontends information // Array index matches their FrontendId in the default impl mFrontendSize = 8; mFrontendSize = 9; mFrontends[0] = new Frontend(FrontendType::DVBT, 0, this); mFrontends[1] = new Frontend(FrontendType::ATSC, 1, this); mFrontends[2] = new Frontend(FrontendType::DVBC, 2, this); Loading @@ -42,6 +42,8 @@ Tuner::Tuner() { mFrontends[5] = new Frontend(FrontendType::ISDBT, 5, this); mFrontends[6] = new Frontend(FrontendType::ANALOG, 6, this); mFrontends[7] = new Frontend(FrontendType::ATSC, 7, this); mFrontends[8] = new Frontend(static_cast<V1_0::FrontendType>(V1_1::FrontendType::DTMB), 8, this); FrontendInfo::FrontendCapabilities caps; caps = FrontendInfo::FrontendCapabilities(); Loading Loading @@ -224,6 +226,20 @@ Return<void> Tuner::openLnbByName(const hidl_string& /*lnbName*/, openLnbByName_ return Void(); } Return<void> Tuner::getFrontendDtmbCapabilities(uint32_t frontendId, getFrontendDtmbCapabilities_cb _hidl_cb) { ALOGV("%s", __FUNCTION__); if (mFrontends[frontendId] != nullptr && (mFrontends[frontendId]->getFrontendType() == static_cast<V1_0::FrontendType>(V1_1::FrontendType::DTMB))) { _hidl_cb(Result::SUCCESS, mDtmbCaps); } else { _hidl_cb(Result::UNAVAILABLE, mDtmbCaps); } return Void(); } void Tuner::setFrontendAsDemuxSource(uint32_t frontendId, uint32_t demuxId) { mFrontendToDemux[frontendId] = demuxId; if (mFrontends[frontendId] != nullptr && mFrontends[frontendId]->isLocked()) { Loading
tv/tuner/1.1/default/Tuner.h +4 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,9 @@ class Tuner : public ITuner { virtual Return<void> openLnbByName(const hidl_string& lnbName, openLnbByName_cb _hidl_cb) override; virtual Return<void> getFrontendDtmbCapabilities( uint32_t frontendId, getFrontendDtmbCapabilities_cb _hidl_cb) override; sp<Frontend> getFrontendById(uint32_t frontendId); void setFrontendAsDemuxSource(uint32_t frontendId, uint32_t demuxId); Loading @@ -76,6 +79,7 @@ class Tuner : public ITuner { // Static mFrontends array to maintain local frontends information map<uint32_t, sp<Frontend>> mFrontends; map<uint32_t, FrontendInfo::FrontendCapabilities> mFrontendCaps; V1_1::FrontendDtmbCapabilities mDtmbCaps; map<uint32_t, uint32_t> mFrontendToDemux; map<uint32_t, sp<Demux>> mDemuxes; // To maintain how many Frontends we have Loading
tv/tuner/1.1/types.hal +142 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import @1.0::DemuxFilterTsRecordEvent; import @1.0::FrontendDvbcSpectralInversion; import @1.0::FrontendDvbtConstellation; import @1.0::FrontendDvbtTransmissionMode; import @1.0::FrontendType; import android.hidl.safe_union@1.0; import android.hidl.safe_union@1.0::Monostate; Loading Loading @@ -181,5 +182,146 @@ struct FrontendSettingsExt1_1 { FrontendDvbsSettingsExt1_1 dvbs; FrontendDvbtSettingsExt1_1 dvbt; FrontendDtmbSettings dtmb; } settingExt; }; /** * Extended Frontend Type. */ @export enum FrontendType : @1.0::FrontendType { /** * DTMB (Digital Terrestrial Multimedia Broadcast) standard. */ DTMB, }; /** * Bandwidth Type for DTMB. */ @export enum FrontendDtmbBandwidth : uint32_t { UNDEFINED = 0, /** * hardware is able to detect and set Bandwidth automatically */ AUTO = 1 << 0, BANDWIDTH_8MHZ = 1 << 1, BANDWIDTH_6MHZ = 1 << 2, }; /** * TimeInterleaveMode Type for DTMB. */ @export enum FrontendDtmbTimeInterleaveMode : uint32_t { UNDEFINED = 0, /** * hardware is able to detect and set time interleave mode automatically */ AUTO = 1 << 0, TIMER_INT_240 = 1 << 1, TIMER_INT_720 = 1 << 2, }; /** * FrontendDtmbModulation Type for DTMB. */ @export enum FrontendDtmbModulation : uint32_t { UNDEFINED = 0, /** * hardware is able to detect and set Constellation automatically */ AUTO = 1 << 0, CONSTELLATION_4QAM = 1 << 1, CONSTELLATION_4QAM_NR = 1 << 2, CONSTELLATION_16QAM = 1 << 3, CONSTELLATION_32QAM = 1 << 4, CONSTELLATION_64QAM = 1 << 5, }; /** * CODERATE Type for DTMB. */ @export enum FrontendDtmbCodeRate : uint32_t { UNDEFINED = 0, /** * hardware is able to detect and set code rate automatically */ AUTO = 1 << 0, CODERATE_2_5 = 1 << 1, CODERATE_3_5 = 1 << 2, CODERATE_4_5 = 1 << 3, }; /** * Guard Interval Type for DTMB. */ @export enum FrontendDtmbGuardInterval : uint32_t { UNDEFINED = 0, /** * hardware is able to detect and set Guard Interval automatically */ AUTO = 1 << 0, PN_420_VARIOUS = 1 << 1, PN_595_CONST = 1 << 2, PN_945_VARIOUS = 1 << 3, PN_420_CONST = 1 << 4, PN_945_CONST = 1 << 5, PN_RESERVED = 1 << 6, }; /** * Transmission Mode for DTMB. */ @export enum FrontendDtmbTransmissionMode : uint32_t { UNDEFINED = 0, /** * hardware is able to detect and set Transmission Mode automatically */ AUTO = 1 << 0, C1 = 1 << 1, C3780 = 1 << 2, }; /** * Signal Setting for DTMB Frontend. */ struct FrontendDtmbSettings { uint32_t frequency; FrontendDtmbTransmissionMode transmissionMode; FrontendDtmbBandwidth bandwidth; FrontendDtmbModulation modulation; FrontendDtmbCodeRate codeRate; FrontendDtmbGuardInterval guardInterval; FrontendDtmbTimeInterleaveMode interleaveMode; }; /** * Capabilities for DTMB Frontend. */ struct FrontendDtmbCapabilities { bitfield<FrontendDtmbTransmissionMode> transmissionModeCap; bitfield<FrontendDtmbBandwidth> bandwidthCap; bitfield<FrontendDtmbModulation> modulationCap; bitfield<FrontendDtmbCodeRate> codeRateCap; bitfield<FrontendDtmbGuardInterval> guardIntervalCap; bitfield<FrontendDtmbTimeInterleaveMode> interleaveModeCap; };
tv/tuner/1.1/vts/functional/FrontendTests.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -243,6 +243,14 @@ AssertionResult FrontendTests::stopScanFrontend() { EXPECT_TRUE(mFrontend) << "Test with openFrontendById first."; Result status; status = mFrontend->stopScan(); return AssertionResult(status == Result::SUCCESS); } AssertionResult FrontendTests::getFrontendDtmbCaps(uint32_t id) { Result status; mService->getFrontendDtmbCapabilities( id, [&](Result result, const FrontendDtmbCapabilities& /*caps*/) { status = result; }); return AssertionResult(status == Result::SUCCESS); } Loading Loading @@ -440,3 +448,14 @@ void FrontendTests::scanTest(FrontendConfig frontendConf, FrontendScanType scanT ASSERT_TRUE(stopScanFrontend()); ASSERT_TRUE(closeFrontend()); } void FrontendTests::getFrontendDtmbCapsTest() { uint32_t feId; getFrontendIdByType( static_cast<FrontendType>(android::hardware::tv::tuner::V1_1::FrontendType::DTMB), feId); if (feId != INVALID_ID) { ALOGD("[vts] Found DTMB Frontend"); ASSERT_TRUE(getFrontendDtmbCaps(feId)); } }