Amy | 126ee92 | 2019-08-09 16:25:12 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 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 | #ifndef ANDROID_HARDWARE_TV_TUNER_V1_0_TUNER_H_ |
| 18 | #define ANDROID_HARDWARE_TV_TUNER_V1_0_TUNER_H_ |
| 19 | |
| 20 | #include <android/hardware/tv/tuner/1.0/ITuner.h> |
Amy | 5094ae1 | 2019-10-04 18:43:21 -0700 | [diff] [blame] | 21 | #include <map> |
| 22 | #include "Demux.h" |
Amy | 126ee92 | 2019-08-09 16:25:12 -0700 | [diff] [blame] | 23 | #include "Frontend.h" |
| 24 | |
| 25 | using namespace std; |
| 26 | |
| 27 | namespace android { |
| 28 | namespace hardware { |
| 29 | namespace tv { |
| 30 | namespace tuner { |
| 31 | namespace V1_0 { |
| 32 | namespace implementation { |
| 33 | |
Amy | 5094ae1 | 2019-10-04 18:43:21 -0700 | [diff] [blame] | 34 | class Frontend; |
| 35 | class Demux; |
| 36 | |
Amy | 126ee92 | 2019-08-09 16:25:12 -0700 | [diff] [blame] | 37 | class Tuner : public ITuner { |
| 38 | public: |
| 39 | Tuner(); |
| 40 | virtual Return<void> getFrontendIds(getFrontendIds_cb _hidl_cb) override; |
| 41 | |
| 42 | virtual Return<void> openFrontendById(uint32_t frontendId, |
| 43 | openFrontendById_cb _hidl_cb) override; |
| 44 | |
Henry Fang | f3eec03 | 2019-08-15 18:57:08 -0700 | [diff] [blame] | 45 | virtual Return<void> openDemux(openDemux_cb _hidl_cb) override; |
| 46 | |
Amy | 42a5b4b | 2019-10-03 16:49:48 -0700 | [diff] [blame] | 47 | virtual Return<void> getDemuxCaps(getDemuxCaps_cb _hidl_cb) override; |
| 48 | |
Henry Fang | f3eec03 | 2019-08-15 18:57:08 -0700 | [diff] [blame] | 49 | virtual Return<void> openDescrambler(openDescrambler_cb _hidl_cb) override; |
| 50 | |
Amy | 016b731 | 2019-09-16 15:51:28 -0700 | [diff] [blame] | 51 | virtual Return<void> getFrontendInfo(FrontendId frontendId, |
| 52 | getFrontendInfo_cb _hidl_cb) override; |
| 53 | |
| 54 | virtual Return<void> getLnbIds(getLnbIds_cb _hidl_cb) override; |
| 55 | |
| 56 | virtual Return<void> openLnbById(LnbId lnbId, openLnbById_cb _hidl_cb) override; |
| 57 | |
Henry Fang | fe019ac | 2019-12-23 18:13:43 -0800 | [diff] [blame^] | 58 | virtual Return<void> openLnbByName(const hidl_string& lnbName, |
| 59 | openLnbByName_cb _hidl_cb) override; |
| 60 | |
Amy | 5094ae1 | 2019-10-04 18:43:21 -0700 | [diff] [blame] | 61 | sp<Frontend> getFrontendById(uint32_t frontendId); |
| 62 | |
| 63 | void setFrontendAsDemuxSource(uint32_t frontendId, uint32_t demuxId); |
| 64 | |
| 65 | void frontendStopTune(uint32_t frontendId); |
| 66 | |
Amy | 126ee92 | 2019-08-09 16:25:12 -0700 | [diff] [blame] | 67 | private: |
| 68 | virtual ~Tuner(); |
| 69 | // Static mFrontends array to maintain local frontends information |
| 70 | vector<sp<Frontend>> mFrontends; |
Amy | 5094ae1 | 2019-10-04 18:43:21 -0700 | [diff] [blame] | 71 | std::map<uint32_t, uint32_t> mFrontendToDemux; |
| 72 | std::map<uint32_t, sp<Demux>> mDemuxes; |
Amy | 126ee92 | 2019-08-09 16:25:12 -0700 | [diff] [blame] | 73 | // To maintain how many Frontends we have |
| 74 | int mFrontendSize; |
Amy | fd4243a | 2019-08-16 16:01:27 -0700 | [diff] [blame] | 75 | // The last used demux id. Initial value is -1. |
| 76 | // First used id will be 0. |
| 77 | int mLastUsedId = -1; |
Amy | 126ee92 | 2019-08-09 16:25:12 -0700 | [diff] [blame] | 78 | }; |
| 79 | |
| 80 | } // namespace implementation |
| 81 | } // namespace V1_0 |
| 82 | } // namespace tuner |
| 83 | } // namespace tv |
| 84 | } // namespace hardware |
| 85 | } // namespace android |
| 86 | |
| 87 | #endif // ANDROID_HARDWARE_TV_TUNER_V1_0_TUNER_H_ |