blob: 5e7b10c3c2c391e48ebf8ac3ff80b7be7b7417c6 [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
Hongguang2ecfc392021-11-23 10:29:15 -080053 binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
54
Hongguang4092f2f2021-07-08 18:49:12 -070055 FrontendType getFrontendType();
56 int32_t getFrontendId();
57 string getSourceFile();
58 bool isLocked();
59
60 private:
61 virtual ~Frontend();
62 bool supportsSatellite();
63 std::shared_ptr<IFrontendCallback> mCallback;
Hongguang Chenff2c6b02021-08-07 00:12:26 +000064 std::shared_ptr<Tuner> mTuner;
Hongguang4092f2f2021-07-08 18:49:12 -070065 FrontendType mType = FrontendType::UNDEFINED;
66 int32_t mId = 0;
67 bool mIsLocked = false;
68 int32_t mCiCamId;
69
70 std::ifstream mFrontendData;
71};
72
73} // namespace tuner
74} // namespace tv
75} // namespace hardware
76} // namespace android
77} // namespace aidl