Amy Zhang | bb94eeb | 2020-07-09 22:48:04 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2020 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_1_FRONTEND_H_ |
| 18 | #define ANDROID_HARDWARE_TV_TUNER_V1_1_FRONTEND_H_ |
| 19 | |
| 20 | #include <fstream> |
| 21 | #include <iostream> |
| 22 | #include "Tuner.h" |
| 23 | |
| 24 | using namespace std; |
| 25 | |
| 26 | namespace android { |
| 27 | namespace hardware { |
| 28 | namespace tv { |
| 29 | namespace tuner { |
| 30 | namespace V1_0 { |
| 31 | namespace implementation { |
| 32 | |
| 33 | class Tuner; |
| 34 | |
| 35 | class Frontend : public IFrontend { |
| 36 | public: |
| 37 | Frontend(FrontendType type, FrontendId id, sp<Tuner> tuner); |
| 38 | |
| 39 | virtual Return<Result> close() override; |
| 40 | |
| 41 | virtual Return<Result> setCallback(const sp<IFrontendCallback>& callback) override; |
| 42 | |
| 43 | virtual Return<Result> tune(const FrontendSettings& settings) override; |
| 44 | |
| 45 | virtual Return<Result> stopTune() override; |
| 46 | |
| 47 | virtual Return<Result> scan(const FrontendSettings& settings, FrontendScanType type) override; |
| 48 | |
| 49 | virtual Return<Result> stopScan() override; |
| 50 | |
| 51 | virtual Return<void> getStatus(const hidl_vec<FrontendStatusType>& statusTypes, |
| 52 | getStatus_cb _hidl_cb) override; |
| 53 | |
| 54 | virtual Return<Result> setLna(bool bEnable) override; |
| 55 | |
| 56 | virtual Return<Result> setLnb(uint32_t lnb) override; |
| 57 | |
| 58 | FrontendType getFrontendType(); |
| 59 | |
| 60 | FrontendId getFrontendId(); |
| 61 | |
| 62 | string getSourceFile(); |
| 63 | |
| 64 | bool isLocked(); |
| 65 | |
| 66 | private: |
| 67 | virtual ~Frontend(); |
| 68 | bool supportsSatellite(); |
| 69 | sp<IFrontendCallback> mCallback; |
| 70 | sp<Tuner> mTunerService; |
| 71 | FrontendType mType = FrontendType::UNDEFINED; |
| 72 | FrontendId mId = 0; |
| 73 | bool mIsLocked = false; |
| 74 | |
| 75 | std::ifstream mFrontendData; |
| 76 | }; |
| 77 | |
| 78 | } // namespace implementation |
| 79 | } // namespace V1_0 |
| 80 | } // namespace tuner |
| 81 | } // namespace tv |
| 82 | } // namespace hardware |
| 83 | } // namespace android |
| 84 | |
| 85 | #endif // ANDROID_HARDWARE_TV_TUNER_V1_1_FRONTEND_H_ |