blob: 0609d051210414ae99d09f343f0a786bf0500d2c [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#define LOG_TAG "android.hardware.tv.tuner@1.0-Frontend"
18
19#include "Frontend.h"
20#include <android/hardware/tv/tuner/1.0/IFrontendCallback.h>
21#include <utils/Log.h>
22
23namespace android {
24namespace hardware {
25namespace tv {
26namespace tuner {
27namespace V1_0 {
28namespace implementation {
29
30Frontend::Frontend() {
31 // Init callback to nullptr
32 mCallback = nullptr;
33}
34
35Frontend::Frontend(FrontendType type, FrontendId id) {
36 mType = type;
37 mId = id;
38 // Init callback to nullptr
39 mCallback = nullptr;
40}
41
42Frontend::~Frontend() {}
43
44Return<Result> Frontend::close() {
45 ALOGV("%s", __FUNCTION__);
46 // Reset callback
47 mCallback = nullptr;
48
49 return Result::SUCCESS;
50}
51
52Return<Result> Frontend::setCallback(const sp<IFrontendCallback>& callback) {
53 ALOGV("%s", __FUNCTION__);
54 if (callback == nullptr) {
55 ALOGW("[ WARN ] Set Frontend callback with nullptr");
56 return Result::INVALID_ARGUMENT;
57 }
58
59 mCallback = callback;
60 return Result::SUCCESS;
61}
62
63Return<Result> Frontend::tune(const FrontendSettings& /* settings */) {
64 ALOGV("%s", __FUNCTION__);
65 if (mCallback == nullptr) {
66 ALOGW("[ WARN ] Frontend callback is not set when tune");
67 return Result::INVALID_STATE;
68 }
69
70 mCallback->onEvent(FrontendEventType::NO_SIGNAL);
71 return Result::SUCCESS;
72}
73
74Return<Result> Frontend::stopTune() {
75 ALOGV("%s", __FUNCTION__);
76
77 return Result::SUCCESS;
78}
79
Amy016b7312019-09-16 15:51:28 -070080Return<Result> Frontend::scan(const FrontendSettings& /* settings */, FrontendScanType /* type */) {
81 ALOGV("%s", __FUNCTION__);
82
83 return Result::SUCCESS;
84}
85
86Return<Result> Frontend::stopScan() {
87 ALOGV("%s", __FUNCTION__);
88
89 return Result::SUCCESS;
90}
91
92Return<void> Frontend::getStatus(const hidl_vec<FrontendStatusType>& /* statusTypes */,
93 getStatus_cb _hidl_cb) {
94 ALOGV("%s", __FUNCTION__);
95
96 vector<FrontendStatus> statuses;
97 _hidl_cb(Result::SUCCESS, statuses);
98
99 return Void();
100}
101
102Return<Result> Frontend::setLna(bool /* bEnable */) {
103 ALOGV("%s", __FUNCTION__);
104
105 return Result::SUCCESS;
106}
107
108Return<Result> Frontend::setLnb(const sp<ILnb>& /* lnb */) {
109 ALOGV("%s", __FUNCTION__);
110
111 return Result::SUCCESS;
112}
113
114Return<Result> Frontend::sendDiseqcMessage(const hidl_vec<uint8_t>& /* diseqcMessage */) {
115 ALOGV("%s", __FUNCTION__);
116
117 return Result::SUCCESS;
118}
119
Amy126ee922019-08-09 16:25:12 -0700120FrontendType Frontend::getFrontendType() {
121 return mType;
122}
123
124FrontendId Frontend::getFrontendId() {
125 return mId;
126}
127
128} // namespace implementation
129} // namespace V1_0
130} // namespace tuner
131} // namespace tv
132} // namespace hardware
133} // namespace android