blob: f3928a35ae5dcc1ae0c760f8f1a79866b024e1ba [file] [log] [blame]
Hongguang600a6ae2021-07-08 18:51:51 -07001/*
2 * Copyright 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <binder/MemoryDealer.h>
18
19#include "../../../config/TunerTestingConfigAidlReaderV1_0.h"
20
21#include <aidl/android/hardware/tv/tuner/DataFormat.h>
22#include <aidl/android/hardware/tv/tuner/DemuxAlpFilterType.h>
23#include <aidl/android/hardware/tv/tuner/DemuxFilterMainType.h>
24#include <aidl/android/hardware/tv/tuner/DemuxFilterMonitorEventType.h>
25#include <aidl/android/hardware/tv/tuner/DemuxFilterSettings.h>
26#include <aidl/android/hardware/tv/tuner/DemuxFilterType.h>
27#include <aidl/android/hardware/tv/tuner/DemuxIpAddress.h>
28#include <aidl/android/hardware/tv/tuner/DemuxIpFilterSettings.h>
29#include <aidl/android/hardware/tv/tuner/DemuxIpFilterType.h>
30#include <aidl/android/hardware/tv/tuner/DemuxMmtpFilterType.h>
31#include <aidl/android/hardware/tv/tuner/DemuxRecordScIndexType.h>
32#include <aidl/android/hardware/tv/tuner/DemuxTsFilterType.h>
33#include <aidl/android/hardware/tv/tuner/DvrSettings.h>
34#include <aidl/android/hardware/tv/tuner/DvrType.h>
35#include <aidl/android/hardware/tv/tuner/FrontendDvbtBandwidth.h>
36#include <aidl/android/hardware/tv/tuner/FrontendDvbtCoderate.h>
37#include <aidl/android/hardware/tv/tuner/FrontendDvbtConstellation.h>
38#include <aidl/android/hardware/tv/tuner/FrontendDvbtGuardInterval.h>
39#include <aidl/android/hardware/tv/tuner/FrontendDvbtHierarchy.h>
40#include <aidl/android/hardware/tv/tuner/FrontendDvbtSettings.h>
41#include <aidl/android/hardware/tv/tuner/FrontendDvbtStandard.h>
42#include <aidl/android/hardware/tv/tuner/FrontendDvbtTransmissionMode.h>
43#include <aidl/android/hardware/tv/tuner/FrontendSettings.h>
44#include <aidl/android/hardware/tv/tuner/FrontendType.h>
45#include <aidl/android/hardware/tv/tuner/PlaybackSettings.h>
46#include <aidl/android/hardware/tv/tuner/RecordSettings.h>
47
48using namespace std;
49using namespace aidl::android::hardware::tv::tuner;
50using namespace android::media::tuner::testing::configuration::V1_0;
51
52const int32_t FMQ_SIZE_4M = 0x400000;
53const int32_t FMQ_SIZE_16M = 0x1000000;
54
Hongguang16dacc12021-11-01 15:51:52 -070055const string configFilePath = "/vendor/etc/tuner_vts_config_aidl_V1.xml";
Hongguang600a6ae2021-07-08 18:51:51 -070056
57#define FILTER_MAIN_TYPE_BIT_COUNT 5
58
59// Hardware configs
60static map<string, FrontendConfig> frontendMap;
61static map<string, FilterConfig> filterMap;
62static map<string, DvrConfig> dvrMap;
63static map<string, LnbConfig> lnbMap;
64static map<string, TimeFilterConfig> timeFilterMap;
65static map<string, vector<uint8_t>> diseqcMsgMap;
66static map<string, DescramblerConfig> descramblerMap;
67
68// Hardware and test cases connections
69static LiveBroadcastHardwareConnections live;
70static ScanHardwareConnections scan;
71static DvrPlaybackHardwareConnections playback;
72static DvrRecordHardwareConnections record;
73static DescramblingHardwareConnections descrambling;
74static LnbLiveHardwareConnections lnbLive;
75static LnbRecordHardwareConnections lnbRecord;
76static TimeFilterHardwareConnections timeFilter;
77
Frankie Lizcanoa53f5542022-07-07 17:32:06 +000078/*
79 * This function takes in a 2d vector of device Id's
80 * The n vectors correlate to the ids for n different devices (eg frontends, filters)
81 * The resultant 2d vector is every combination of id's with 1 id from each vector
82 */
83inline vector<vector<string>> generateIdCombinations(vector<vector<string>>& ids) {
84 vector<vector<string>> combinations;
85
86 // The index of each vector in ids that will be used in the next combination
87 // EG {0, 2} means combo {ids[0][0] ids[1][2]} will be next
88 const int size = static_cast<int>(ids.size());
89 vector<int> indexes_used_in_combination(size, 0);
90
91 // The vector number from ids whose elements we will cycle through to make combinations.
92 // First, start at the right most vector
93 int cycled_vector = size - 1;
94
95 while (cycled_vector >= 0) {
96 // Make a combination (one at a time)
97 vector<string> combo;
98 for (size_t i = 0; i < indexes_used_in_combination.size(); ++i) {
99 const int combo_index = indexes_used_in_combination[i];
100 combo.push_back(ids[i][combo_index]);
101 }
102 combinations.push_back(combo);
103
104 // Find the right most vector that still has space [elements left] to cycle through and
105 // create a combination
106 while (cycled_vector >= 0 &&
107 indexes_used_in_combination[cycled_vector] == ids[cycled_vector].size() - 1) {
108 cycled_vector--;
109 }
110
111 // Use this check to avoid segmentation faults
112 if (cycled_vector >= 0) {
113 // Once found, we have a vector we can cycle through, so increase to its next element
114 indexes_used_in_combination[cycled_vector]++;
115
116 // Reset the other vectors to the right to their first element so we can cycle through
117 // them again with the new element from cycled vector
118 for (size_t i = cycled_vector + 1; i < indexes_used_in_combination.size(); ++i) {
119 indexes_used_in_combination[i] = 0;
120 }
121
122 // all the vectors to the right were reset, so we can cycle through them again
123 // Start at the furthest right vector
124 cycled_vector = size - 1;
125 }
126 }
127
128 return combinations;
129}
130
131/*
132 * index 0 - playback dvr
133 * index 1 - audio filters
134 * index 2 - video filters
135 * index 3 - optional section filters
136 */
137static inline vector<DvrPlaybackHardwareConnections> generatePlaybackCombinations() {
138 vector<DvrPlaybackHardwareConnections> combinations;
139 vector<string> sectionFilterIds_optional = sectionFilterIds;
140 sectionFilterIds_optional.push_back(emptyHardwareId);
141 vector<vector<string>> deviceIds{playbackDvrIds, audioFilterIds, videoFilterIds,
142 sectionFilterIds_optional};
143
144 const int dvrIndex = 0;
145 const int audioFilterIndex = 1;
146 const int videoFilterIndex = 2;
147 const int sectionFilterIndex = 3;
148
149 auto idCombinations = generateIdCombinations(deviceIds);
150 for (auto& combo : idCombinations) {
151 DvrPlaybackHardwareConnections mPlayback;
152 mPlayback.dvrId = combo[dvrIndex];
153 mPlayback.audioFilterId = combo[audioFilterIndex];
154 mPlayback.videoFilterId = combo[videoFilterIndex];
155 mPlayback.sectionFilterId = combo[sectionFilterIndex];
156 combinations.push_back(mPlayback);
157 }
158
159 return combinations;
160}
161
162static inline vector<DvrPlaybackHardwareConnections> generatePlaybackConfigs() {
163 vector<DvrPlaybackHardwareConnections> playback_configs;
164 if (configuredPlayback) {
165 ALOGD("Using DVR playback configuration provided.");
166 playback_configs = {playback};
167 } else {
168 ALOGD("Dvr playback not provided. Generating possible combinations. Consider adding it to "
169 "the configuration file.");
170 playback_configs = generatePlaybackCombinations();
171 }
172
173 return playback_configs;
174}
175
Hongguang600a6ae2021-07-08 18:51:51 -0700176/** Config all the frontends that would be used in the tests */
177inline void initFrontendConfig() {
178 // The test will use the internal default fe when default fe is connected to any data flow
179 // without overriding in the xml config.
180 string defaultFeId = "FE_DEFAULT";
181 FrontendDvbtSettings dvbtSettings{
Gareth Fenn282fb372021-09-27 15:14:11 +0100182 .frequency = 578000000,
Hongguang600a6ae2021-07-08 18:51:51 -0700183 .transmissionMode = FrontendDvbtTransmissionMode::AUTO,
184 .bandwidth = FrontendDvbtBandwidth::BANDWIDTH_8MHZ,
185 .isHighPriority = true,
186 };
187 frontendMap[defaultFeId].type = FrontendType::DVBT;
188 frontendMap[defaultFeId].settings.set<FrontendSettings::Tag::dvbt>(dvbtSettings);
189
190 vector<FrontendStatusType> types;
191 types.push_back(FrontendStatusType::UEC);
192 types.push_back(FrontendStatusType::IS_MISO);
193
194 vector<FrontendStatus> statuses;
195 FrontendStatus status;
196 status.set<FrontendStatus::Tag::uec>(4);
197 statuses.push_back(status);
198 status.set<FrontendStatus::Tag::isMiso>(true);
199 statuses.push_back(status);
200
201 frontendMap[defaultFeId].tuneStatusTypes = types;
202 frontendMap[defaultFeId].expectTuneStatuses = statuses;
203 frontendMap[defaultFeId].isSoftwareFe = true;
204 frontendMap[defaultFeId].canConnectToCiCam = true;
205 frontendMap[defaultFeId].ciCamId = 0;
206 FrontendDvbtSettings dvbt;
207 dvbt.transmissionMode = FrontendDvbtTransmissionMode::MODE_8K_E;
208 frontendMap[defaultFeId].settings.set<FrontendSettings::Tag::dvbt>(dvbt);
209 // Read customized config
210 TunerTestingConfigAidlReader1_0::readFrontendConfig1_0(frontendMap);
211};
212
213inline void initFilterConfig() {
214 // The test will use the internal default filter when default filter is connected to any
215 // data flow without overriding in the xml config.
216 string defaultAudioFilterId = "FILTER_AUDIO_DEFAULT";
217 string defaultVideoFilterId = "FILTER_VIDEO_DEFAULT";
218
219 filterMap[defaultVideoFilterId].type.mainType = DemuxFilterMainType::TS;
Hongguangce1e30d2021-08-02 21:55:44 -0700220 filterMap[defaultVideoFilterId].type.subType.set<DemuxFilterSubType::Tag::tsFilterType>(
221 DemuxTsFilterType::VIDEO);
Hongguang600a6ae2021-07-08 18:51:51 -0700222 filterMap[defaultVideoFilterId].bufferSize = FMQ_SIZE_16M;
223 filterMap[defaultVideoFilterId].settings =
224 DemuxFilterSettings::make<DemuxFilterSettings::Tag::ts>();
225 filterMap[defaultVideoFilterId].settings.get<DemuxFilterSettings::Tag::ts>().tpid = 256;
226 DemuxFilterAvSettings video;
227 video.isPassthrough = false;
228 filterMap[defaultVideoFilterId]
229 .settings.get<DemuxFilterSettings::Tag::ts>()
230 .filterSettings.set<DemuxTsFilterSettingsFilterSettings::Tag::av>(video);
231 filterMap[defaultVideoFilterId].monitorEventTypes =
232 static_cast<int32_t>(DemuxFilterMonitorEventType::SCRAMBLING_STATUS) |
233 static_cast<int32_t>(DemuxFilterMonitorEventType::IP_CID_CHANGE);
234 filterMap[defaultVideoFilterId].streamType.set<AvStreamType::Tag::video>(
235 VideoStreamType::MPEG1);
236
237 filterMap[defaultAudioFilterId].type.mainType = DemuxFilterMainType::TS;
Hongguangce1e30d2021-08-02 21:55:44 -0700238 filterMap[defaultAudioFilterId].type.subType.set<DemuxFilterSubType::Tag::tsFilterType>(
239 DemuxTsFilterType::AUDIO);
Hongguang600a6ae2021-07-08 18:51:51 -0700240 filterMap[defaultAudioFilterId].bufferSize = FMQ_SIZE_16M;
241 filterMap[defaultAudioFilterId].settings =
242 DemuxFilterSettings::make<DemuxFilterSettings::Tag::ts>();
243 filterMap[defaultAudioFilterId].settings.get<DemuxFilterSettings::Tag::ts>().tpid = 256;
244 DemuxFilterAvSettings audio;
245 audio.isPassthrough = false;
246 filterMap[defaultAudioFilterId]
247 .settings.get<DemuxFilterSettings::Tag::ts>()
248 .filterSettings.set<DemuxTsFilterSettingsFilterSettings::Tag::av>(audio);
249 filterMap[defaultAudioFilterId].monitorEventTypes =
250 static_cast<int32_t>(DemuxFilterMonitorEventType::SCRAMBLING_STATUS) |
251 static_cast<int32_t>(DemuxFilterMonitorEventType::IP_CID_CHANGE);
252 filterMap[defaultAudioFilterId].streamType.set<AvStreamType::Tag::audio>(AudioStreamType::MP3);
253 // Read customized config
254 TunerTestingConfigAidlReader1_0::readFilterConfig1_0(filterMap);
255};
256
257/** Config all the dvrs that would be used in the tests */
258inline void initDvrConfig() {
259 // Read customized config
260 TunerTestingConfigAidlReader1_0::readDvrConfig1_0(dvrMap);
261};
262
Frankie Lizcano1fd52972022-06-30 16:50:21 +0000263inline void initTimeFilterConfig() {
264 // Read customized config
265 TunerTestingConfigAidlReader1_0::readTimeFilterConfig1_0(timeFilterMap);
266};
267
Frankie Lizcanof5352122022-06-29 22:10:16 +0000268inline void initDescramblerConfig() {
269 // Read customized config
270 TunerTestingConfigAidlReader1_0::readDescramblerConfig1_0(descramblerMap);
271}
272
Frankie Lizcano647d5aa2022-06-30 20:49:31 +0000273inline void initLnbConfig() {
274 // Read customized config
275 TunerTestingConfigAidlReader1_0::readLnbConfig1_0(lnbMap);
276};
277
278inline void initDiseqcMsgsConfig() {
279 // Read customized config
280 TunerTestingConfigAidlReader1_0::readDiseqcMessages(diseqcMsgMap);
281};
282
Frankie Lizcano5b29f502022-07-06 22:09:42 +0000283inline void determineScan() {
284 if (!frontendMap.empty()) {
285 scan.hasFrontendConnection = true;
286 ALOGD("Can support scan");
287 }
288}
289
290inline void determineTimeFilter() {
291 if (!timeFilterMap.empty()) {
292 timeFilter.support = true;
293 ALOGD("Can support time filter");
294 }
295}
296
297inline void determineDvrPlayback() {
298 if (!playbackDvrIds.empty() && !audioFilterIds.empty() && !videoFilterIds.empty()) {
299 playback.support = true;
300 ALOGD("Can support dvr playback");
301 }
302}
303
304inline void determineLnbLive() {
305 if (!audioFilterIds.empty() && !videoFilterIds.empty() && !frontendMap.empty() &&
306 !lnbMap.empty()) {
307 lnbLive.support = true;
308 ALOGD("Can support lnb live");
309 }
310}
311
312inline void determineLnbRecord() {
313 if (!frontendMap.empty() && !recordFilterIds.empty() && !recordDvrIds.empty() &&
314 !lnbMap.empty()) {
315 lnbRecord.support = true;
316 ALOGD("Can support lnb record");
317 }
318}
319
320inline void determineLive() {
321 if (videoFilterIds.empty() || audioFilterIds.empty() || frontendMap.empty()) {
322 return;
323 }
324 if (hasSwFe && !hasHwFe && dvrMap.empty()) {
325 ALOGD("Cannot configure Live. Only software frontends and no dvr connections");
326 return;
327 }
328 ALOGD("Can support live");
329 live.hasFrontendConnection = true;
330}
331
332inline void determineDescrambling() {
333 if (descramblerMap.empty() || audioFilterIds.empty() || videoFilterIds.empty()) {
334 return;
335 }
336 if (frontendMap.empty() && playbackDvrIds.empty()) {
337 ALOGD("Cannot configure descrambling. No frontends or playback dvr's");
338 return;
339 }
340 if (hasSwFe && !hasHwFe && playbackDvrIds.empty()) {
341 ALOGD("cannot configure descrambling. Only SW frontends and no playback dvr's");
342 return;
343 }
344 ALOGD("Can support descrambling");
345 descrambling.support = true;
346}
347
348inline void determineDvrRecord() {
349 if (recordDvrIds.empty() || recordFilterIds.empty()) {
350 return;
351 }
352 if (frontendMap.empty() && playbackDvrIds.empty()) {
353 ALOGD("Cannot support dvr record. No frontends and no playback dvr's");
354 return;
355 }
356 if (hasSwFe && !hasHwFe && playbackDvrIds.empty()) {
357 ALOGD("Cannot support dvr record. Only SW frontends and no playback dvr's");
358 return;
359 }
360 ALOGD("Can support dvr record.");
361 record.support = true;
362}
363
Hongguang600a6ae2021-07-08 18:51:51 -0700364/** Read the vendor configurations of which hardware to use for each test cases/data flows */
365inline void connectHardwaresToTestCases() {
366 TunerTestingConfigAidlReader1_0::connectLiveBroadcast(live);
367 TunerTestingConfigAidlReader1_0::connectScan(scan);
368 TunerTestingConfigAidlReader1_0::connectDvrRecord(record);
Frankie Lizcano1fd52972022-06-30 16:50:21 +0000369 TunerTestingConfigAidlReader1_0::connectTimeFilter(timeFilter);
Frankie Lizcanof5352122022-06-29 22:10:16 +0000370 TunerTestingConfigAidlReader1_0::connectDescrambling(descrambling);
Frankie Lizcano647d5aa2022-06-30 20:49:31 +0000371 TunerTestingConfigAidlReader1_0::connectLnbLive(lnbLive);
372 TunerTestingConfigAidlReader1_0::connectLnbRecord(lnbRecord);
Frankie Lizcano50461932022-06-28 21:36:26 +0000373 TunerTestingConfigAidlReader1_0::connectDvrPlayback(playback);
Hongguang600a6ae2021-07-08 18:51:51 -0700374};
375
Frankie Lizcano5b29f502022-07-06 22:09:42 +0000376inline void determineDataFlows() {
377 determineScan();
378 determineTimeFilter();
379 determineDvrPlayback();
380 determineLnbLive();
381 determineLnbRecord();
382 determineLive();
383 determineDescrambling();
384 determineDvrRecord();
385}
386
Hongguang600a6ae2021-07-08 18:51:51 -0700387inline bool validateConnections() {
388 if (record.support && !record.hasFrontendConnection &&
389 record.dvrSourceId.compare(emptyHardwareId) == 0) {
390 ALOGW("[vts config] Record must support either a DVR source or a Frontend source.");
391 return false;
392 }
Gareth Fenn9a808452022-03-31 08:40:00 +0100393 bool feIsValid = live.hasFrontendConnection
394 ? frontendMap.find(live.frontendId) != frontendMap.end()
395 : true;
396 feIsValid &= scan.hasFrontendConnection ? frontendMap.find(scan.frontendId) != frontendMap.end()
397 : true;
398 feIsValid &= record.support && record.hasFrontendConnection
399 ? frontendMap.find(record.frontendId) != frontendMap.end()
400 : true;
Frankie Lizcanof5352122022-06-29 22:10:16 +0000401 feIsValid &= descrambling.support && descrambling.hasFrontendConnection
402 ? frontendMap.find(descrambling.frontendId) != frontendMap.end()
403 : true;
Hongguang600a6ae2021-07-08 18:51:51 -0700404
Frankie Lizcano647d5aa2022-06-30 20:49:31 +0000405 feIsValid &= lnbLive.support ? frontendMap.find(lnbLive.frontendId) != frontendMap.end() : true;
406
407 feIsValid &=
408 lnbRecord.support ? frontendMap.find(lnbRecord.frontendId) != frontendMap.end() : true;
409
Hongguang600a6ae2021-07-08 18:51:51 -0700410 if (!feIsValid) {
411 ALOGW("[vts config] dynamic config fe connection is invalid.");
412 return false;
413 }
414
415 bool dvrIsValid = frontendMap[live.frontendId].isSoftwareFe
416 ? dvrMap.find(live.dvrSoftwareFeId) != dvrMap.end()
417 : true;
418
419 if (record.support) {
420 if (record.hasFrontendConnection) {
421 if (frontendMap[record.frontendId].isSoftwareFe) {
422 dvrIsValid &= dvrMap.find(record.dvrSoftwareFeId) != dvrMap.end();
423 }
424 } else {
425 dvrIsValid &= dvrMap.find(record.dvrSourceId) != dvrMap.end();
426 }
427 dvrIsValid &= dvrMap.find(record.dvrRecordId) != dvrMap.end();
428 }
429
Frankie Lizcanof5352122022-06-29 22:10:16 +0000430 if (descrambling.support) {
431 if (descrambling.hasFrontendConnection) {
432 if (frontendMap[descrambling.frontendId].isSoftwareFe) {
433 dvrIsValid &= dvrMap.find(descrambling.dvrSoftwareFeId) != dvrMap.end();
434 }
435 } else {
436 dvrIsValid &= dvrMap.find(descrambling.dvrSourceId) != dvrMap.end();
437 }
438 }
439
Frankie Lizcano647d5aa2022-06-30 20:49:31 +0000440 dvrIsValid &= lnbRecord.support ? dvrMap.find(lnbRecord.dvrRecordId) != dvrMap.end() : true;
441
Frankie Lizcano50461932022-06-28 21:36:26 +0000442 dvrIsValid &= playback.support ? dvrMap.find(playback.dvrId) != dvrMap.end() : true;
443
Hongguang600a6ae2021-07-08 18:51:51 -0700444 if (!dvrIsValid) {
445 ALOGW("[vts config] dynamic config dvr connection is invalid.");
446 return false;
447 }
448
Gareth Fenn9a808452022-03-31 08:40:00 +0100449 bool filterIsValid = (live.hasFrontendConnection)
450 ? filterMap.find(live.audioFilterId) != filterMap.end() &&
451 filterMap.find(live.videoFilterId) != filterMap.end()
452 : true;
Hongguang600a6ae2021-07-08 18:51:51 -0700453 filterIsValid &=
454 record.support ? filterMap.find(record.recordFilterId) != filterMap.end() : true;
455
Frankie Lizcanof5352122022-06-29 22:10:16 +0000456 filterIsValid &= descrambling.support
457 ? filterMap.find(descrambling.videoFilterId) != filterMap.end() &&
458 filterMap.find(descrambling.audioFilterId) != filterMap.end()
459 : true;
460
461 for (auto& filterId : descrambling.extraFilters) {
462 filterIsValid &= filterMap.find(filterId) != filterMap.end();
463 }
464
Frankie Lizcano647d5aa2022-06-30 20:49:31 +0000465 filterIsValid &= lnbLive.support
466 ? filterMap.find(lnbLive.audioFilterId) != filterMap.end() &&
467 filterMap.find(lnbLive.videoFilterId) != filterMap.end()
468 : true;
469
470 filterIsValid &=
471 lnbRecord.support ? filterMap.find(lnbRecord.recordFilterId) != filterMap.end() : true;
472
473 for (auto& filterId : lnbRecord.extraFilters) {
474 filterIsValid &= filterMap.find(filterId) != filterMap.end();
475 }
476
477 for (auto& filterId : lnbLive.extraFilters) {
478 filterIsValid &= filterMap.find(filterId) != filterMap.end();
479 }
480
Frankie Lizcano50461932022-06-28 21:36:26 +0000481 filterIsValid &= playback.support
482 ? filterMap.find(playback.audioFilterId) != filterMap.end() &&
483 filterMap.find(playback.videoFilterId) != filterMap.end()
484 : true;
485 filterIsValid &= playback.sectionFilterId.compare(emptyHardwareId) == 0
486 ? true
487 : filterMap.find(playback.sectionFilterId) != filterMap.end();
488
489 for (auto& filterId : playback.extraFilters) {
490 filterIsValid &=
491 playback.hasExtraFilters ? filterMap.find(filterId) != filterMap.end() : true;
492 }
493
Hongguang600a6ae2021-07-08 18:51:51 -0700494 if (!filterIsValid) {
495 ALOGW("[vts config] dynamic config filter connection is invalid.");
496 return false;
497 }
498
Frankie Lizcano1fd52972022-06-30 16:50:21 +0000499 bool timeFilterIsValid =
500 timeFilter.support ? timeFilterMap.find(timeFilter.timeFilterId) != timeFilterMap.end()
501 : true;
502
503 if (!timeFilterIsValid) {
504 ALOGW("[vts config] dynamic config time filter connection is invalid.");
Frankie Lizcanof5352122022-06-29 22:10:16 +0000505 }
506
507 bool descramblerIsValid =
508 descrambling.support
509 ? descramblerMap.find(descrambling.descramblerId) != descramblerMap.end()
510 : true;
511
512 if (!descramblerIsValid) {
513 ALOGW("[vts config] dynamic config descrambler connection is invalid.");
Frankie Lizcano1fd52972022-06-30 16:50:21 +0000514 return false;
515 }
516
Frankie Lizcano647d5aa2022-06-30 20:49:31 +0000517 bool lnbIsValid = lnbLive.support ? lnbMap.find(lnbLive.lnbId) != lnbMap.end() : true;
518
519 lnbIsValid &= lnbRecord.support ? lnbMap.find(lnbRecord.lnbId) != lnbMap.end() : true;
520
521 if (!lnbIsValid) {
522 ALOGW("[vts config] dynamic config lnb connection is invalid.");
523 return false;
524 }
525
526 bool diseqcMsgsIsValid = true;
527
528 for (auto& msg : lnbRecord.diseqcMsgs) {
529 diseqcMsgsIsValid &= diseqcMsgMap.find(msg) != diseqcMsgMap.end();
530 }
531
532 for (auto& msg : lnbLive.diseqcMsgs) {
533 diseqcMsgsIsValid &= diseqcMsgMap.find(msg) != diseqcMsgMap.end();
534 }
535
536 if (!diseqcMsgsIsValid) {
537 ALOGW("[vts config] dynamic config diseqcMsg is invalid.");
538 return false;
539 }
540
Hongguang600a6ae2021-07-08 18:51:51 -0700541 return true;
542}