blob: 1c09d6c68419ed5910e62834e608d7d4259b197a [file] [log] [blame]
Amy126ee922019-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_TUNER_H_
18#define ANDROID_HARDWARE_TV_TUNER_V1_0_TUNER_H_
19
20#include <android/hardware/tv/tuner/1.0/ITuner.h>
Amy5094ae12019-10-04 18:43:21 -070021#include <map>
22#include "Demux.h"
Amy126ee922019-08-09 16:25:12 -070023#include "Frontend.h"
shubangfd882512020-04-22 14:59:03 -070024#include "Lnb.h"
Amy126ee922019-08-09 16:25:12 -070025
26using namespace std;
27
28namespace android {
29namespace hardware {
30namespace tv {
31namespace tuner {
32namespace V1_0 {
33namespace implementation {
34
Amy5094ae12019-10-04 18:43:21 -070035class Frontend;
36class Demux;
37
Amy126ee922019-08-09 16:25:12 -070038class Tuner : public ITuner {
39 public:
40 Tuner();
41 virtual Return<void> getFrontendIds(getFrontendIds_cb _hidl_cb) override;
42
43 virtual Return<void> openFrontendById(uint32_t frontendId,
44 openFrontendById_cb _hidl_cb) override;
45
Henry Fangf3eec032019-08-15 18:57:08 -070046 virtual Return<void> openDemux(openDemux_cb _hidl_cb) override;
47
Amy42a5b4b2019-10-03 16:49:48 -070048 virtual Return<void> getDemuxCaps(getDemuxCaps_cb _hidl_cb) override;
49
Henry Fangf3eec032019-08-15 18:57:08 -070050 virtual Return<void> openDescrambler(openDescrambler_cb _hidl_cb) override;
51
Amy016b7312019-09-16 15:51:28 -070052 virtual Return<void> getFrontendInfo(FrontendId frontendId,
53 getFrontendInfo_cb _hidl_cb) override;
54
55 virtual Return<void> getLnbIds(getLnbIds_cb _hidl_cb) override;
56
57 virtual Return<void> openLnbById(LnbId lnbId, openLnbById_cb _hidl_cb) override;
58
Henry Fangfe019ac2019-12-23 18:13:43 -080059 virtual Return<void> openLnbByName(const hidl_string& lnbName,
60 openLnbByName_cb _hidl_cb) override;
61
Amy5094ae12019-10-04 18:43:21 -070062 sp<Frontend> getFrontendById(uint32_t frontendId);
63
64 void setFrontendAsDemuxSource(uint32_t frontendId, uint32_t demuxId);
65
Amy Zhang0fe25be2020-04-08 17:30:52 -070066 void frontendStartTune(uint32_t frontendId);
Amy5094ae12019-10-04 18:43:21 -070067 void frontendStopTune(uint32_t frontendId);
Amy Zhang45c12632020-07-16 14:06:25 -070068 void removeDemux(uint32_t demuxId);
69 void removeFrontend(uint32_t frontendId);
Amy5094ae12019-10-04 18:43:21 -070070
Amy126ee922019-08-09 16:25:12 -070071 private:
72 virtual ~Tuner();
73 // Static mFrontends array to maintain local frontends information
Amy Zhang45c12632020-07-16 14:06:25 -070074 map<uint32_t, sp<Frontend>> mFrontends;
75 map<uint32_t, FrontendInfo::FrontendCapabilities> mFrontendCaps;
76 map<uint32_t, uint32_t> mFrontendToDemux;
77 map<uint32_t, sp<Demux>> mDemuxes;
Amy126ee922019-08-09 16:25:12 -070078 // To maintain how many Frontends we have
79 int mFrontendSize;
Amyfd4243a2019-08-16 16:01:27 -070080 // The last used demux id. Initial value is -1.
81 // First used id will be 0.
82 int mLastUsedId = -1;
shubangfd882512020-04-22 14:59:03 -070083 vector<sp<Lnb>> mLnbs;
Amy126ee922019-08-09 16:25:12 -070084};
85
86} // namespace implementation
87} // namespace V1_0
88} // namespace tuner
89} // namespace tv
90} // namespace hardware
91} // namespace android
92
93#endif // ANDROID_HARDWARE_TV_TUNER_V1_0_TUNER_H_