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 <android/hardware/tv/tuner/1.1/IFrontend.h> 21 #include <fstream> 22 #include <iostream> 23 #include "Tuner.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 34 class Tuner; 35 36 class Frontend : public V1_1::IFrontend { 37 public: 38 Frontend(FrontendType type, FrontendId id, sp<Tuner> tuner); 39 40 virtual Return<Result> close() override; 41 42 virtual Return<Result> setCallback(const sp<IFrontendCallback>& callback) override; 43 44 virtual Return<Result> tune(const FrontendSettings& settings) override; 45 46 virtual Return<Result> tune_1_1(const FrontendSettings& settings, 47 const V1_1::FrontendSettingsExt1_1& settingsExt1_1) override; 48 49 virtual Return<Result> stopTune() override; 50 51 virtual Return<Result> scan(const FrontendSettings& settings, FrontendScanType type) override; 52 53 virtual Return<Result> scan_1_1(const FrontendSettings& settings, FrontendScanType type, 54 const V1_1::FrontendSettingsExt1_1& settingsExt1_1) override; 55 56 virtual Return<Result> stopScan() override; 57 58 virtual Return<void> getStatus(const hidl_vec<FrontendStatusType>& statusTypes, 59 getStatus_cb _hidl_cb) override; 60 61 virtual Return<void> getStatusExt1_1( 62 const hidl_vec<V1_1::FrontendStatusTypeExt1_1>& statusTypes, 63 V1_1::IFrontend::getStatusExt1_1_cb _hidl_cb) override; 64 65 virtual Return<Result> setLna(bool bEnable) override; 66 67 virtual Return<Result> setLnb(uint32_t lnb) override; 68 69 virtual Return<void> linkCiCam(uint32_t ciCamId, linkCiCam_cb _hidl_cb) override; 70 71 virtual Return<Result> unlinkCiCam(uint32_t ciCamId) override; 72 73 FrontendType getFrontendType(); 74 75 FrontendId getFrontendId(); 76 77 string getSourceFile(); 78 79 bool isLocked(); 80 81 private: 82 virtual ~Frontend(); 83 bool supportsSatellite(); 84 sp<IFrontendCallback> mCallback; 85 sp<Tuner> mTunerService; 86 FrontendType mType = FrontendType::UNDEFINED; 87 FrontendId mId = 0; 88 bool mIsLocked = false; 89 uint32_t mCiCamId; 90 91 std::ifstream mFrontendData; 92 }; 93 94 } // namespace implementation 95 } // namespace V1_0 96 } // namespace tuner 97 } // namespace tv 98 } // namespace hardware 99 } // namespace android 100 101 #endif // ANDROID_HARDWARE_TV_TUNER_V1_1_FRONTEND_H_ 102