blob: eab43a39fb352632a8a0b1fe9272111a5252ee1a [file] [log] [blame]
Amy7fb75d82019-08-09 16:25:12 -07001/*
2 * Copyright (C) 2019 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_0_FRONTEND_H_
18#define ANDROID_HARDWARE_TV_TUNER_V1_0_FRONTEND_H_
19
20#include <android/hardware/tv/tuner/1.0/IFrontend.h>
Amye2583762019-10-04 18:43:21 -070021#include <fstream>
22#include <iostream>
23#include "Tuner.h"
Amy7fb75d82019-08-09 16:25:12 -070024
25using namespace std;
26
27namespace android {
28namespace hardware {
29namespace tv {
30namespace tuner {
31namespace V1_0 {
32namespace implementation {
33
34using ::android::hardware::tv::tuner::V1_0::FrontendId;
35using ::android::hardware::tv::tuner::V1_0::FrontendType;
36using ::android::hardware::tv::tuner::V1_0::IFrontend;
37using ::android::hardware::tv::tuner::V1_0::IFrontendCallback;
38using ::android::hardware::tv::tuner::V1_0::Result;
39
Amye2583762019-10-04 18:43:21 -070040class Tuner;
41
Amy7fb75d82019-08-09 16:25:12 -070042class Frontend : public IFrontend {
43 public:
Amye2583762019-10-04 18:43:21 -070044 Frontend(FrontendType type, FrontendId id, sp<Tuner> tuner);
Amy7fb75d82019-08-09 16:25:12 -070045
46 virtual Return<Result> close() override;
47
48 virtual Return<Result> setCallback(const sp<IFrontendCallback>& callback) override;
49
50 virtual Return<Result> tune(const FrontendSettings& settings) override;
51
52 virtual Return<Result> stopTune() override;
53
Amyb9d0c8b2019-09-16 15:51:28 -070054 virtual Return<Result> scan(const FrontendSettings& settings, FrontendScanType type) 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
Amyb9d0c8b2019-09-16 15:51:28 -070061 virtual Return<Result> setLna(bool bEnable) override;
62
Amyc13371c2019-10-03 16:49:48 -070063 virtual Return<Result> setLnb(uint32_t lnb) override;
Amyb9d0c8b2019-09-16 15:51:28 -070064
Amy7fb75d82019-08-09 16:25:12 -070065 FrontendType getFrontendType();
66
67 FrontendId getFrontendId();
68
Amye2583762019-10-04 18:43:21 -070069 string getSourceFile();
70
Amy7fb75d82019-08-09 16:25:12 -070071 private:
72 virtual ~Frontend();
73 sp<IFrontendCallback> mCallback;
Amye2583762019-10-04 18:43:21 -070074 sp<Tuner> mTunerService;
Amy7fb75d82019-08-09 16:25:12 -070075 FrontendType mType = FrontendType::UNDEFINED;
76 FrontendId mId = 0;
Amye2583762019-10-04 18:43:21 -070077
Amy33963aa2019-10-15 17:38:19 -070078 const string FRONTEND_STREAM_FILE = "/vendor/etc/dumpTs3.ts";
Amye2583762019-10-04 18:43:21 -070079 string mSourceStreamFile;
80 std::ifstream mFrontendData;
Amy7fb75d82019-08-09 16:25:12 -070081};
82
83} // namespace implementation
84} // namespace V1_0
85} // namespace tuner
86} // namespace tv
87} // namespace hardware
88} // namespace android
89
90#endif // ANDROID_HARDWARE_TV_TUNER_V1_0_FRONTEND_H_