diff options
-rw-r--r-- | tv/tuner/1.0/default/Frontend.cpp | 8 | ||||
-rw-r--r-- | tv/tuner/1.0/default/Frontend.h | 1 | ||||
-rw-r--r-- | tv/tuner/1.0/vts/functional/FrontendTests.cpp | 8 | ||||
-rw-r--r-- | tv/tuner/1.0/vts/functional/FrontendTests.h | 4 | ||||
-rw-r--r-- | tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp | 65 | ||||
-rw-r--r-- | tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h | 14 | ||||
-rw-r--r-- | tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h | 2 |
7 files changed, 97 insertions, 5 deletions
diff --git a/tv/tuner/1.0/default/Frontend.cpp b/tv/tuner/1.0/default/Frontend.cpp index 996b6ef552..61bbbf8193 100644 --- a/tv/tuner/1.0/default/Frontend.cpp +++ b/tv/tuner/1.0/default/Frontend.cpp @@ -254,7 +254,9 @@ Return<Result> Frontend::setLna(bool /* bEnable */) { Return<Result> Frontend::setLnb(uint32_t /* lnb */) { ALOGV("%s", __FUNCTION__); - + if (!supportsSatellite()) { + return Result::INVALID_STATE; + } return Result::SUCCESS; } @@ -270,6 +272,10 @@ string Frontend::getSourceFile() { return FRONTEND_STREAM_FILE; } +bool Frontend::supportsSatellite() { + return mType == FrontendType::DVBS || mType == FrontendType::ISDBS || + mType == FrontendType::ISDBS3; +} } // namespace implementation } // namespace V1_0 } // namespace tuner diff --git a/tv/tuner/1.0/default/Frontend.h b/tv/tuner/1.0/default/Frontend.h index 65537d7a23..c0d1613cfa 100644 --- a/tv/tuner/1.0/default/Frontend.h +++ b/tv/tuner/1.0/default/Frontend.h @@ -70,6 +70,7 @@ class Frontend : public IFrontend { private: virtual ~Frontend(); + bool supportsSatellite(); sp<IFrontendCallback> mCallback; sp<Tuner> mTunerService; FrontendType mType = FrontendType::UNDEFINED; diff --git a/tv/tuner/1.0/vts/functional/FrontendTests.cpp b/tv/tuner/1.0/vts/functional/FrontendTests.cpp index d54a9591c6..d094510bbc 100644 --- a/tv/tuner/1.0/vts/functional/FrontendTests.cpp +++ b/tv/tuner/1.0/vts/functional/FrontendTests.cpp @@ -371,6 +371,14 @@ AssertionResult FrontendTests::tuneFrontend(FrontendConfig config) { return AssertionResult(true); } +AssertionResult FrontendTests::setLnb(uint32_t lnbId) { + if (!mFrontendCallback) { + ALOGW("[vts] open and set frontend callback first."); + return failure(); + } + return AssertionResult(mFrontend->setLnb(lnbId) == Result::SUCCESS); +} + AssertionResult FrontendTests::stopTuneFrontend() { EXPECT_TRUE(mFrontend) << "Test with openFrontendById first."; Result status; diff --git a/tv/tuner/1.0/vts/functional/FrontendTests.h b/tv/tuner/1.0/vts/functional/FrontendTests.h index 2bdc8fd3d9..b8b9f476ca 100644 --- a/tv/tuner/1.0/vts/functional/FrontendTests.h +++ b/tv/tuner/1.0/vts/functional/FrontendTests.h @@ -109,6 +109,7 @@ class FrontendTests { AssertionResult scanFrontend(FrontendConfig config, FrontendScanType type); AssertionResult stopScanFrontend(); AssertionResult tuneFrontend(FrontendConfig config); + AssertionResult setLnb(uint32_t lnbId); void verifyFrontendStatus(vector<FrontendStatusType> statusTypes, vector<FrontendStatus> expectStatuses); AssertionResult stopTuneFrontend(); @@ -119,6 +120,9 @@ class FrontendTests { void scanTest(FrontendConfig frontend, FrontendScanType type); protected: + static AssertionResult failure() { return ::testing::AssertionFailure(); } + static AssertionResult success() { return ::testing::AssertionSuccess(); } + sp<IFrontend> mFrontend; FrontendInfo mFrontendInfo; sp<FrontendCallback> mFrontendCallback; diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp index 583fce9ed3..e1284b47b9 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp @@ -72,6 +72,9 @@ void TunerBroadcastHidlTest::broadcastSingleFilterTest(FilterConfig filterConf, } ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); ASSERT_TRUE(mFrontendTests.setFrontendCallback()); + if (mLnbId) { + ASSERT_TRUE(mFrontendTests.setLnb(*mLnbId)); + } ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFilterTests.setDemux(demux); @@ -90,6 +93,26 @@ void TunerBroadcastHidlTest::broadcastSingleFilterTest(FilterConfig filterConf, ASSERT_TRUE(mFrontendTests.closeFrontend()); } +void TunerBroadcastHidlTest::broadcastSingleFilterTestWithLnb(FilterConfig filterConf, + FrontendConfig frontendConf, + LnbConfig lnbConf) { + vector<uint32_t> ids; + ASSERT_TRUE(mLnbTests.getLnbIds(ids)); + if (!lnbConf.usingLnb) { + return; + } + ASSERT_TRUE(ids.size() > 0); + ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); + *mLnbId = ids[0]; + ASSERT_TRUE(mLnbTests.setLnbCallback()); + ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage)); + ASSERT_TRUE(mLnbTests.setTone(lnbConf.tone)); + ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbConf.position)); + broadcastSingleFilterTest(filterConf, frontendConf); + ASSERT_TRUE(mLnbTests.closeLnb()); + mLnbId = nullptr; +} + void TunerPlaybackHidlTest::playbackSingleFilterTest(FilterConfig filterConf, DvrConfig dvrConf) { uint32_t demuxId; sp<IDemux> demux; @@ -129,6 +152,9 @@ void TunerRecordHidlTest::recordSingleFilterTest(FilterConfig filterConf, ASSERT_TRUE(feId != INVALID_ID); ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); ASSERT_TRUE(mFrontendTests.setFrontendCallback()); + if (mLnbId) { + ASSERT_TRUE(mFrontendTests.setLnb(*mLnbId)); + } ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFilterTests.setDemux(demux); @@ -159,6 +185,26 @@ void TunerRecordHidlTest::recordSingleFilterTest(FilterConfig filterConf, ASSERT_TRUE(mFrontendTests.closeFrontend()); } +void TunerRecordHidlTest::recordSingleFilterTestWithLnb(FilterConfig filterConf, + FrontendConfig frontendConf, + DvrConfig dvrConf, LnbConfig lnbConf) { + vector<uint32_t> ids; + ASSERT_TRUE(mLnbTests.getLnbIds(ids)); + if (!lnbConf.usingLnb) { + return; + } + ASSERT_TRUE(ids.size() > 0); + ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); + *mLnbId = ids[0]; + ASSERT_TRUE(mLnbTests.setLnbCallback()); + ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage)); + ASSERT_TRUE(mLnbTests.setTone(lnbConf.tone)); + ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbConf.position)); + recordSingleFilterTest(filterConf, frontendConf, dvrConf); + ASSERT_TRUE(mLnbTests.closeLnb()); + mLnbId = nullptr; +} + void TunerRecordHidlTest::attachSingleFilterToRecordDvrTest(FilterConfig filterConf, FrontendConfig frontendConf, DvrConfig dvrConf) { @@ -279,9 +325,10 @@ TEST_P(TunerLnbHidlTest, SendDiseqcMessageToLnb) { description("Open and configure an Lnb with specific settings then send a diseqc msg to it."); vector<uint32_t> ids; ASSERT_TRUE(mLnbTests.getLnbIds(ids)); - if (ids.size() == 0) { + if (!lnbArray[LNB0].usingLnb) { return; } + ASSERT_TRUE(ids.size() > 0); ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); ASSERT_TRUE(mLnbTests.setLnbCallback()); ASSERT_TRUE(mLnbTests.setVoltage(lnbArray[LNB0].voltage)); @@ -379,21 +426,26 @@ TEST_P(TunerFilterHidlTest, SetFilterLinkage) { TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowVideoFilterTest) { description("Test Video Filter functionality in Broadcast use case."); - broadcastSingleFilterTest(filterArray[TS_VIDEO1], frontendArray[DVBS]); + broadcastSingleFilterTest(filterArray[TS_VIDEO1], frontendArray[DVBT]); } TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowAudioFilterTest) { description("Test Audio Filter functionality in Broadcast use case."); - broadcastSingleFilterTest(filterArray[TS_AUDIO0], frontendArray[DVBS]); + broadcastSingleFilterTest(filterArray[TS_AUDIO0], frontendArray[DVBT]); } TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowSectionFilterTest) { description("Test Section Filter functionality in Broadcast use case."); - broadcastSingleFilterTest(filterArray[TS_SECTION0], frontendArray[DVBS]); + broadcastSingleFilterTest(filterArray[TS_SECTION0], frontendArray[DVBT]); } TEST_P(TunerBroadcastHidlTest, IonBufferTest) { description("Test the av filter data bufferring."); + broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendArray[DVBT]); +} + +TEST_P(TunerBroadcastHidlTest, LnbBroadcastDataFlowVideoFilterTest) { + description("Test Video Filter functionality in Broadcast with Lnb use case."); broadcastSingleFilterTest(filterArray[TS_VIDEO0], frontendArray[DVBS]); } @@ -414,6 +466,11 @@ TEST_P(TunerRecordHidlTest, RecordDataFlowWithTsRecordFilterTest) { recordSingleFilterTest(filterArray[TS_RECORD0], frontendArray[DVBT], dvrArray[DVR_RECORD0]); } +TEST_P(TunerRecordHidlTest, LnbRecordDataFlowWithTsRecordFilterTest) { + description("Feed ts data from Fe with Lnb to recording and test with ts record filter"); + recordSingleFilterTest(filterArray[TS_RECORD0], frontendArray[DVBS], dvrArray[DVR_RECORD0]); +} + TEST_P(TunerDescramblerHidlTest, CreateDescrambler) { description("Create Descrambler"); uint32_t feId; diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h index c8a23aada6..d71222bb3d 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.h @@ -144,6 +144,7 @@ class TunerBroadcastHidlTest : public testing::TestWithParam<std::string> { mFrontendTests.setService(mService); mDemuxTests.setService(mService); mFilterTests.setService(mService); + mLnbTests.setService(mService); } protected: @@ -155,10 +156,16 @@ class TunerBroadcastHidlTest : public testing::TestWithParam<std::string> { FrontendTests mFrontendTests; DemuxTests mDemuxTests; FilterTests mFilterTests; + LnbTests mLnbTests; AssertionResult filterDataOutputTest(vector<string> goldenOutputFiles); void broadcastSingleFilterTest(FilterConfig filterConf, FrontendConfig frontendConf); + void broadcastSingleFilterTestWithLnb(FilterConfig filterConf, FrontendConfig frontendConf, + LnbConfig lnbConf); + + private: + uint32_t* mLnbId = nullptr; }; class TunerPlaybackHidlTest : public testing::TestWithParam<std::string> { @@ -201,6 +208,7 @@ class TunerRecordHidlTest : public testing::TestWithParam<std::string> { mDemuxTests.setService(mService); mFilterTests.setService(mService); mDvrTests.setService(mService); + mLnbTests.setService(mService); } protected: @@ -212,12 +220,18 @@ class TunerRecordHidlTest : public testing::TestWithParam<std::string> { DvrConfig dvrConf); void recordSingleFilterTest(FilterConfig filterConf, FrontendConfig frontendConf, DvrConfig dvrConf); + void recordSingleFilterTestWithLnb(FilterConfig filterConf, FrontendConfig frontendConf, + DvrConfig dvrConf, LnbConfig lnbConf); sp<ITuner> mService; FrontendTests mFrontendTests; DemuxTests mDemuxTests; FilterTests mFilterTests; DvrTests mDvrTests; + LnbTests mLnbTests; + + private: + uint32_t* mLnbId = nullptr; }; class TunerDescramblerHidlTest : public testing::TestWithParam<std::string> { diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h index 1941773e6a..d0f2b9c701 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TestConfigurations.h @@ -139,6 +139,7 @@ struct FrontendConfig { }; struct LnbConfig { + bool usingLnb; LnbVoltage voltage; LnbTone tone; LnbPosition position; @@ -221,6 +222,7 @@ inline void initFrontendScanConfig() { /** Configuration array for the Lnb test */ inline void initLnbConfig() { + lnbArray[LNB0].usingLnb = true; lnbArray[LNB0].voltage = LnbVoltage::VOLTAGE_12V; lnbArray[LNB0].tone = LnbTone::NONE; lnbArray[LNB0].position = LnbPosition::UNDEFINED; |