Hongguang | 4092f2f | 2021-07-08 18:49:12 -0700 | [diff] [blame] | 1 | /* |
| 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 | #pragma once |
| 18 | |
| 19 | #include <aidl/android/hardware/tv/tuner/BnFrontend.h> |
| 20 | #include <fstream> |
| 21 | #include <iostream> |
| 22 | #include "Tuner.h" |
| 23 | |
| 24 | using namespace std; |
| 25 | |
| 26 | namespace aidl { |
| 27 | namespace android { |
| 28 | namespace hardware { |
| 29 | namespace tv { |
| 30 | namespace tuner { |
| 31 | |
| 32 | class Tuner; |
| 33 | |
| 34 | class Frontend : public BnFrontend { |
| 35 | public: |
Hongguang Chen | ff2c6b0 | 2021-08-07 00:12:26 +0000 | [diff] [blame^] | 36 | Frontend(FrontendType type, int32_t id, std::shared_ptr<Tuner> tuner); |
Hongguang | 4092f2f | 2021-07-08 18:49:12 -0700 | [diff] [blame] | 37 | |
| 38 | ::ndk::ScopedAStatus setCallback( |
| 39 | const std::shared_ptr<IFrontendCallback>& in_callback) override; |
| 40 | ::ndk::ScopedAStatus tune(const FrontendSettings& in_settings) override; |
| 41 | ::ndk::ScopedAStatus stopTune() override; |
| 42 | ::ndk::ScopedAStatus close() override; |
| 43 | ::ndk::ScopedAStatus scan(const FrontendSettings& in_settings, |
| 44 | FrontendScanType in_type) override; |
| 45 | ::ndk::ScopedAStatus stopScan() override; |
| 46 | ::ndk::ScopedAStatus getStatus(const std::vector<FrontendStatusType>& in_statusTypes, |
| 47 | std::vector<FrontendStatus>* _aidl_return) override; |
| 48 | ::ndk::ScopedAStatus setLnb(int32_t in_lnbId) override; |
| 49 | ::ndk::ScopedAStatus setLna(bool in_bEnable) override; |
| 50 | ::ndk::ScopedAStatus linkCiCam(int32_t in_ciCamId, int32_t* _aidl_return) override; |
| 51 | ::ndk::ScopedAStatus unlinkCiCam(int32_t in_ciCamId) override; |
| 52 | |
| 53 | FrontendType getFrontendType(); |
| 54 | int32_t getFrontendId(); |
| 55 | string getSourceFile(); |
| 56 | bool isLocked(); |
| 57 | |
| 58 | private: |
| 59 | virtual ~Frontend(); |
| 60 | bool supportsSatellite(); |
| 61 | std::shared_ptr<IFrontendCallback> mCallback; |
Hongguang Chen | ff2c6b0 | 2021-08-07 00:12:26 +0000 | [diff] [blame^] | 62 | std::shared_ptr<Tuner> mTuner; |
Hongguang | 4092f2f | 2021-07-08 18:49:12 -0700 | [diff] [blame] | 63 | FrontendType mType = FrontendType::UNDEFINED; |
| 64 | int32_t mId = 0; |
| 65 | bool mIsLocked = false; |
| 66 | int32_t mCiCamId; |
| 67 | |
| 68 | std::ifstream mFrontendData; |
| 69 | }; |
| 70 | |
| 71 | } // namespace tuner |
| 72 | } // namespace tv |
| 73 | } // namespace hardware |
| 74 | } // namespace android |
| 75 | } // namespace aidl |