blob: 3c602cff8fcf617a053ab3183a61a5e84f821447 [file] [log] [blame]
Hongguang4092f2f2021-07-08 18:49:12 -07001/*
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
24using namespace std;
25
26namespace aidl {
27namespace android {
28namespace hardware {
29namespace tv {
30namespace tuner {
31
32class Tuner;
33
34class Frontend : public BnFrontend {
35 public:
Hongguang Chenff2c6b02021-08-07 00:12:26 +000036 Frontend(FrontendType type, int32_t id, std::shared_ptr<Tuner> tuner);
Hongguang4092f2f2021-07-08 18:49:12 -070037
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 Chenff2c6b02021-08-07 00:12:26 +000062 std::shared_ptr<Tuner> mTuner;
Hongguang4092f2f2021-07-08 18:49:12 -070063 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