blob: a843f6587c2fbeada68d929fde51ccc0853cf5d6 [file] [log] [blame]
Amy Zhangbb94eeb2020-07-09 22:48:04 -07001/*
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
Amy Zhang3ea25a62020-08-04 10:23:52 -070020#include <android/hardware/tv/tuner/1.1/IFrontend.h>
Amy Zhangbb94eeb2020-07-09 22:48:04 -070021#include <fstream>
22#include <iostream>
23#include "Tuner.h"
24
25using namespace std;
26
27namespace android {
28namespace hardware {
29namespace tv {
30namespace tuner {
31namespace V1_0 {
32namespace implementation {
33
34class Tuner;
35
Amy Zhang3ea25a62020-08-04 10:23:52 -070036class Frontend : public V1_1::IFrontend {
Amy Zhangbb94eeb2020-07-09 22:48:04 -070037 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
Amy Zhang3ea25a62020-08-04 10:23:52 -070046 virtual Return<Result> tune_1_1(const FrontendSettings& settings,
Amy Zhangbc15b592020-09-25 15:35:55 -070047 const V1_1::FrontendSettingsExt1_1& settingsExt1_1) override;
Amy Zhang3ea25a62020-08-04 10:23:52 -070048
Amy Zhangbb94eeb2020-07-09 22:48:04 -070049 virtual Return<Result> stopTune() override;
50
51 virtual Return<Result> scan(const FrontendSettings& settings, FrontendScanType type) override;
52
Amy Zhang3ea25a62020-08-04 10:23:52 -070053 virtual Return<Result> scan_1_1(const FrontendSettings& settings, FrontendScanType type,
Amy Zhangbc15b592020-09-25 15:35:55 -070054 const V1_1::FrontendSettingsExt1_1& settingsExt1_1) override;
Amy Zhang3ea25a62020-08-04 10:23:52 -070055
Amy Zhangbb94eeb2020-07-09 22:48:04 -070056 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<Result> setLna(bool bEnable) override;
62
63 virtual Return<Result> setLnb(uint32_t lnb) override;
64
Amy Zhang17f8eac2020-08-17 16:52:13 -070065 virtual Return<Result> linkCiCam(uint32_t ciCamId) override;
66
Amy Zhangbb94eeb2020-07-09 22:48:04 -070067 FrontendType getFrontendType();
68
69 FrontendId getFrontendId();
70
71 string getSourceFile();
72
73 bool isLocked();
74
75 private:
76 virtual ~Frontend();
77 bool supportsSatellite();
78 sp<IFrontendCallback> mCallback;
79 sp<Tuner> mTunerService;
80 FrontendType mType = FrontendType::UNDEFINED;
81 FrontendId mId = 0;
82 bool mIsLocked = false;
Amy Zhang17f8eac2020-08-17 16:52:13 -070083 uint32_t mCiCamId;
Amy Zhangbb94eeb2020-07-09 22:48:04 -070084
85 std::ifstream mFrontendData;
86};
87
88} // namespace implementation
89} // namespace V1_0
90} // namespace tuner
91} // namespace tv
92} // namespace hardware
93} // namespace android
94
95#endif // ANDROID_HARDWARE_TV_TUNER_V1_1_FRONTEND_H_