Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f8f6933 authored by Amy Zhang's avatar Amy Zhang Committed by Automerger Merge Worker
Browse files

Add lnb/timeFilter dynamic configuration into Tuner 1.0 VTS am: 78e3dadf

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1674185

Change-Id: I50e9b0519312bcb49a87ad1c2bd30ba00031e792
parents e3073c56 78e3dadf
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -48,10 +48,11 @@ AssertionResult LnbTests::openLnbById(uint32_t lnbId) {
    return AssertionResult(status == Result::SUCCESS);
}

AssertionResult LnbTests::openLnbByName(string lnbName) {
AssertionResult LnbTests::openLnbByName(string lnbName, uint32_t& id) {
    Result status;
    mService->openLnbByName(lnbName, [&](Result result, uint32_t /*lnbId*/, const sp<ILnb>& lnb) {
    mService->openLnbByName(lnbName, [&](Result result, uint32_t lnbId, const sp<ILnb>& lnb) {
        mLnb = lnb;
        id = lnbId;
        status = result;
    });

+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ class LnbTests {

    AssertionResult getLnbIds(vector<uint32_t>& ids);
    AssertionResult openLnbById(uint32_t lnbId);
    AssertionResult openLnbByName(string lnbName);
    AssertionResult openLnbByName(string lnbName, uint32_t& lnbId);
    AssertionResult setLnbCallback();
    AssertionResult setVoltage(LnbVoltage voltage);
    AssertionResult setTone(LnbTone tone);
+40 −49
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ void TunerFilterHidlTest::configSingleFilterInDemuxTest(FilterConfig filterConf,
}

void TunerFilterHidlTest::testTimeFilter(TimeFilterConfig filterConf) {
    if (!filterConf.supportTimeFilter) {
    if (!timeFilter.support) {
        return;
    }
    uint32_t demuxId;
@@ -64,11 +64,8 @@ void TunerFilterHidlTest::testTimeFilter(TimeFilterConfig filterConf) {
    DemuxCapabilities caps;

    ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
    // TODO: add time filter hardware support checker
    ASSERT_TRUE(mDemuxTests.getDemuxCaps(caps));
    if (!caps.bTimeFilter) {
        return;
    }
    ASSERT_TRUE(caps.bTimeFilter);
    mFilterTests.setDemux(demux);
    ASSERT_TRUE(mFilterTests.openTimeFilterInDemux());
    ASSERT_TRUE(mFilterTests.setTimeStamp(filterConf.timeStamp));
@@ -116,14 +113,16 @@ void TunerBroadcastHidlTest::broadcastSingleFilterTest(FilterConfig filterConf,
void TunerBroadcastHidlTest::broadcastSingleFilterTestWithLnb(FilterConfig filterConf,
                                                              FrontendConfig frontendConf,
                                                              LnbConfig lnbConf) {
    if (lnbConf.name.compare(emptyHardwareId) == 0) {
        vector<uint32_t> ids;
        ASSERT_TRUE(mLnbTests.getLnbIds(ids));
    if (ids.size() == 0) {
        return;
    }
        ASSERT_TRUE(ids.size() > 0);
        ASSERT_TRUE(mLnbTests.openLnbById(ids[0]));
        mLnbId = &ids[0];
    } else {
        mLnbId = (uint32_t*)malloc(sizeof(uint32_t));
        ASSERT_TRUE(mLnbTests.openLnbByName(lnbConf.name, *mLnbId));
    }
    ASSERT_TRUE(mLnbTests.setLnbCallback());
    ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage));
    ASSERT_TRUE(mLnbTests.setTone(lnbConf.tone));
@@ -212,18 +211,23 @@ void TunerRecordHidlTest::recordSingleFilterTest(FilterConfig filterConf,
void TunerRecordHidlTest::recordSingleFilterTestWithLnb(FilterConfig filterConf,
                                                        FrontendConfig frontendConf,
                                                        DvrConfig dvrConf, LnbConfig lnbConf) {
    if (lnbConf.name.compare(emptyHardwareId) == 0) {
        vector<uint32_t> ids;
        ASSERT_TRUE(mLnbTests.getLnbIds(ids));
    if (ids.size() == 0) {
        return;
    }
        ASSERT_TRUE(ids.size() > 0);
        ASSERT_TRUE(mLnbTests.openLnbById(ids[0]));
        mLnbId = &ids[0];
    } else {
        mLnbId = (uint32_t*)malloc(sizeof(uint32_t));
        ASSERT_TRUE(mLnbTests.openLnbByName(lnbConf.name, *mLnbId));
    }
    ASSERT_TRUE(mLnbTests.setLnbCallback());
    ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage));
    ASSERT_TRUE(mLnbTests.setTone(lnbConf.tone));
    ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbConf.position));
    for (auto msgName : lnbRecord.diseqcMsgs) {
        ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgMap[msgName]));
    }
    recordSingleFilterTest(filterConf, frontendConf, dvrConf);
    ASSERT_TRUE(mLnbTests.closeLnb());
    mLnbId = nullptr;
@@ -343,37 +347,24 @@ TEST_P(TunerFrontendHidlTest, BlindScanFrontend) {
    mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_BLIND);
}

TEST_P(TunerLnbHidlTest, OpenLnbByName) {
    description("Open and configure an Lnb with name then send a diseqc msg to it.");
    // TODO: add lnb hardware support checker
    vector<uint32_t> ids;
    ASSERT_TRUE(mLnbTests.getLnbIds(ids));
    if (ids.size() == 0) {
        return;
    }
    ASSERT_TRUE(mLnbTests.openLnbByName(lnbArray[LNB_EXTERNAL].name));
    ASSERT_TRUE(mLnbTests.setLnbCallback());
    ASSERT_TRUE(mLnbTests.setVoltage(lnbArray[LNB_EXTERNAL].voltage));
    ASSERT_TRUE(mLnbTests.setTone(lnbArray[LNB_EXTERNAL].tone));
    ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbArray[LNB_EXTERNAL].position));
    ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgArray[DISEQC_POWER_ON]));
    ASSERT_TRUE(mLnbTests.closeLnb());
}

TEST_P(TunerLnbHidlTest, SendDiseqcMessageToLnb) {
    description("Open and configure an Lnb with specific settings then send a diseqc msg to it.");
    if (lnbMap[lnbLive.lnbId].name.compare(emptyHardwareId) == 0) {
        vector<uint32_t> ids;
        ASSERT_TRUE(mLnbTests.getLnbIds(ids));
    if (ids.size() == 0) {
        return;
    }
        ASSERT_TRUE(ids.size() > 0);
        ASSERT_TRUE(mLnbTests.openLnbById(ids[0]));
    } else {
        uint32_t id;
        ASSERT_TRUE(mLnbTests.openLnbByName(lnbMap[lnbLive.lnbId].name, id));
    }
    ASSERT_TRUE(mLnbTests.setLnbCallback());
    ASSERT_TRUE(mLnbTests.setVoltage(lnbArray[LNB0].voltage));
    ASSERT_TRUE(mLnbTests.setTone(lnbArray[LNB0].tone));
    ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbArray[LNB0].position));
    ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgArray[DISEQC_POWER_ON]));
    ASSERT_TRUE(mLnbTests.setVoltage(lnbMap[lnbLive.lnbId].voltage));
    ASSERT_TRUE(mLnbTests.setTone(lnbMap[lnbLive.lnbId].tone));
    ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbMap[lnbLive.lnbId].position));
    for (auto msgName : lnbLive.diseqcMsgs) {
        ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgMap[msgName]));
    }
    ASSERT_TRUE(mLnbTests.closeLnb());
}

@@ -469,7 +460,7 @@ TEST_P(TunerFilterHidlTest, SetFilterLinkage) {
TEST_P(TunerFilterHidlTest, testTimeFilter) {
    description("Open a timer filter in Demux and set time stamp.");
    // TODO use paramterized tests
    testTimeFilter(timeFilterArray[TIMER0]);
    testTimeFilter(timeFilterMap[timeFilter.timeFilterId]);
}

TEST_P(TunerBroadcastHidlTest, BroadcastDataFlowVideoFilterTest) {
@@ -501,7 +492,7 @@ TEST_P(TunerBroadcastHidlTest, LnbBroadcastDataFlowVideoFilterTest) {
        return;
    }
    broadcastSingleFilterTestWithLnb(filterMap[lnbLive.videoFilterId],
                                     frontendMap[lnbLive.frontendId], lnbArray[LNB0]);
                                     frontendMap[lnbLive.frontendId], lnbMap[lnbLive.lnbId]);
}

TEST_P(TunerPlaybackHidlTest, PlaybackDataFlowWithTsSectionFilterTest) {
@@ -538,7 +529,7 @@ TEST_P(TunerRecordHidlTest, LnbRecordDataFlowWithTsRecordFilterTest) {
    }
    recordSingleFilterTestWithLnb(filterMap[lnbRecord.recordFilterId],
                                  frontendMap[lnbRecord.frontendId], dvrMap[lnbRecord.dvrRecordId],
                                  lnbArray[LNB0]);
                                  lnbMap[lnbRecord.lnbId]);
}

TEST_P(TunerDescramblerHidlTest, CreateDescrambler) {
+2 −2
Original line number Diff line number Diff line
@@ -35,14 +35,14 @@ bool initConfiguration() {
    initFrontendConfig();
    initFilterConfig();
    initDvrConfig();
    initLnbConfig();
    initTimeFilterConfig();
    connectHardwaresToTestCases();
    if (!validateConnections()) {
        ALOGW("[vts] failed to validate connections.");
        return false;
    }

    initLnbConfig();
    initTimeFilterConfig();
    initDescramblerConfig();

    return true;
+42 −62
Original line number Diff line number Diff line
@@ -79,46 +79,17 @@ const uint32_t FMQ_SIZE_16M = 0x1000000;
    "  \"track_types\": [ ]                              " \
    "}                                                   "

typedef enum {
    TIMER0,
    TIMER_MAX,
} TimeFilter;

typedef enum {
    SOURCE,
    SINK,
    LINKAGE_DIR,
} Linkage;

typedef enum {
    LNB0,
    LNB_EXTERNAL,
    LNB_MAX,
} Lnb;

typedef enum {
    DISEQC_POWER_ON,
    DISEQC_MAX,
} Diseqc;

typedef enum {
    DESC_0,
    DESC_MAX,
} Descrambler;

struct TimeFilterConfig {
    bool supportTimeFilter;
    uint64_t timeStamp;
};

struct LnbConfig {
    bool usingLnb;
    string name;
    LnbVoltage voltage;
    LnbTone tone;
    LnbPosition position;
};

struct DescramblerConfig {
    uint32_t casSystemId;
    string provisionStr;
@@ -126,9 +97,6 @@ struct DescramblerConfig {
};

// TODO: remove all the manual config array after the dynamic config refactoring is done.
static LnbConfig lnbArray[LNB_MAX];
static vector<uint8_t> diseqcMsgArray[DISEQC_MAX];
static TimeFilterConfig timeFilterArray[TIMER_MAX];
static DemuxFilterType filterLinkageTypes[LINKAGE_DIR][FILTER_MAIN_TYPE_BIT_COUNT];
static DescramblerConfig descramblerArray[DESC_MAX];

@@ -136,6 +104,9 @@ static DescramblerConfig descramblerArray[DESC_MAX];
static map<string, FrontendConfig> frontendMap;
static map<string, FilterConfig> filterMap;
static map<string, DvrConfig> dvrMap;
static map<string, LnbConfig> lnbMap;
static map<string, TimeFilterConfig> timeFilterMap;
static map<string, vector<uint8_t>> diseqcMsgMap;

// Hardware and test cases connections
static LiveBroadcastHardwareConnections live;
@@ -145,6 +116,7 @@ static DvrRecordHardwareConnections record;
static DescramblingHardwareConnections descrambling;
static LnbLiveHardwareConnections lnbLive;
static LnbRecordHardwareConnections lnbRecord;
static TimeFilterHardwareConnections timeFilter;

/** Config all the frontends that would be used in the tests */
inline void initFrontendConfig() {
@@ -202,6 +174,19 @@ inline void initDvrConfig() {
    TunerTestingConfigReader::readDvrConfig1_0(dvrMap);
};

/** Config all the lnbs that would be used in the tests */
inline void initLnbConfig() {
    // Read customized config
    TunerTestingConfigReader::readLnbConfig1_0(lnbMap);
    TunerTestingConfigReader::readDiseqcMessages(diseqcMsgMap);
};

/** Config all the time filters that would be used in the tests */
inline void initTimeFilterConfig() {
    // Read customized config
    TunerTestingConfigReader::readTimeFilterConfig1_0(timeFilterMap);
};

/** Read the vendor configurations of which hardware to use for each test cases/data flows */
inline void connectHardwaresToTestCases() {
    TunerTestingConfigReader::connectLiveBroadcast(live);
@@ -211,6 +196,7 @@ inline void connectHardwaresToTestCases() {
    TunerTestingConfigReader::connectDescrambling(descrambling);
    TunerTestingConfigReader::connectLnbLive(lnbLive);
    TunerTestingConfigReader::connectLnbRecord(lnbRecord);
    TunerTestingConfigReader::connectTimeFilter(timeFilter);
};

inline bool validateConnections() {
@@ -233,14 +219,12 @@ inline bool validateConnections() {
                              ? dvrMap.find(live.dvrSoftwareFeId) != dvrMap.end()
                              : true;
    dvrIsValid &= playback.support ? dvrMap.find(playback.dvrId) != dvrMap.end() : true;

    if (record.support) {
        if (frontendMap[record.frontendId].isSoftwareFe) {
            dvrIsValid &= dvrMap.find(record.dvrSoftwareFeId) != dvrMap.end();
        }
        dvrIsValid &= dvrMap.find(record.dvrRecordId) != dvrMap.end();
    }

    if (descrambling.support && frontendMap[descrambling.frontendId].isSoftwareFe) {
        dvrIsValid &= dvrMap.find(descrambling.dvrSoftwareFeId) != dvrMap.end();
    }
@@ -252,24 +236,19 @@ inline bool validateConnections() {

    bool filterIsValid = filterMap.find(live.audioFilterId) != filterMap.end() &&
                         filterMap.find(live.videoFilterId) != filterMap.end();

    filterIsValid &= playback.support
                             ? (filterMap.find(playback.audioFilterId) != filterMap.end() &&
                                filterMap.find(playback.videoFilterId) != filterMap.end())
                             : true;

    filterIsValid &=
            record.support ? filterMap.find(record.recordFilterId) != filterMap.end() : true;

    filterIsValid &= descrambling.support
                             ? (filterMap.find(descrambling.audioFilterId) != filterMap.end() &&
                                filterMap.find(descrambling.videoFilterId) != filterMap.end())
                             : true;

    filterIsValid &= lnbLive.support ? (filterMap.find(lnbLive.audioFilterId) != filterMap.end() &&
                                        filterMap.find(lnbLive.videoFilterId) != filterMap.end())
                                     : true;

    filterIsValid &=
            lnbRecord.support ? filterMap.find(lnbRecord.recordFilterId) != filterMap.end() : true;

@@ -278,34 +257,35 @@ inline bool validateConnections() {
        return false;
    }

    return true;
    bool lnbIsValid = lnbLive.support ? lnbMap.find(lnbLive.lnbId) != lnbMap.end() : true;
    lnbIsValid &= lnbRecord.support ? lnbMap.find(lnbRecord.lnbId) != lnbMap.end() : true;

    if (!lnbIsValid) {
        ALOGW("[vts config] dynamic config lnb connection is invalid.");
        return false;
    }

// TODO: remove all the manual configs after the dynamic config refactoring is done.
/** 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;
    lnbArray[LNB_EXTERNAL].usingLnb = true;
    lnbArray[LNB_EXTERNAL].name = "default_lnb_external";
    lnbArray[LNB_EXTERNAL].voltage = LnbVoltage::VOLTAGE_5V;
    lnbArray[LNB_EXTERNAL].tone = LnbTone::NONE;
    lnbArray[LNB_EXTERNAL].position = LnbPosition::UNDEFINED;
};
    bool diseqcMsgIsValid = true;
    if (lnbLive.support) {
        for (auto msgName : lnbLive.diseqcMsgs) {
            diseqcMsgIsValid &= diseqcMsgMap.find(msgName) != diseqcMsgMap.end();
        }
    }
    if (lnbRecord.support) {
        for (auto msgName : lnbRecord.diseqcMsgs) {
            diseqcMsgIsValid &= diseqcMsgMap.find(msgName) != diseqcMsgMap.end();
        }
    }

/** Diseqc messages array for the Lnb test */
inline void initDiseqcMsg() {
    diseqcMsgArray[DISEQC_POWER_ON] = {0xE, 0x0, 0x0, 0x0, 0x0, 0x3};
};
    if (!diseqcMsgIsValid) {
        ALOGW("[vts config] dynamic config diseqcMsg sender is invalid.");
        return false;
    }

/** Configuration array for the timer filter test */
inline void initTimeFilterConfig() {
    timeFilterArray[TIMER0].supportTimeFilter = true;
    timeFilterArray[TIMER0].timeStamp = 1;
    return true;
}

// TODO: remove all the manual configs after the dynamic config refactoring is done.
/** Configuration array for the descrambler test */
inline void initDescramblerConfig() {
    descramblerArray[DESC_0].casSystemId = CLEAR_KEY_SYSTEM_ID;
Loading