blob: 5dd01472d5ada0aa2483614b899d8fda684337e3 [file] [log] [blame]
Amy Zhangbb94eeb2020-07-09 22:48:04 -07001/*
2 * Copyright 2020 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.1-Lnb"
18
19#include "Lnb.h"
20#include <utils/Log.h>
21
22namespace android {
23namespace hardware {
24namespace tv {
25namespace tuner {
26namespace V1_0 {
27namespace implementation {
28
29Lnb::Lnb() {}
30Lnb::Lnb(int id) {
31 mId = id;
32}
33
34Lnb::~Lnb() {}
35
Kensuke Miyagiafe17c52021-12-16 01:06:15 -080036Return<Result> Lnb::setCallback(const sp<ILnbCallback>& callback) {
Amy Zhangbb94eeb2020-07-09 22:48:04 -070037 ALOGV("%s", __FUNCTION__);
38
Kensuke Miyagiafe17c52021-12-16 01:06:15 -080039 mCallback = callback;
Amy Zhangbb94eeb2020-07-09 22:48:04 -070040 return Result::SUCCESS;
41}
42
43Return<Result> Lnb::setVoltage(LnbVoltage /* voltage */) {
44 ALOGV("%s", __FUNCTION__);
45
46 return Result::SUCCESS;
47}
48
49Return<Result> Lnb::setTone(LnbTone /* tone */) {
50 ALOGV("%s", __FUNCTION__);
51
52 return Result::SUCCESS;
53}
54
55Return<Result> Lnb::setSatellitePosition(LnbPosition /* position */) {
56 ALOGV("%s", __FUNCTION__);
57
58 return Result::SUCCESS;
59}
60
Kensuke Miyagiafe17c52021-12-16 01:06:15 -080061Return<Result> Lnb::sendDiseqcMessage(const hidl_vec<uint8_t>& diseqcMessage) {
Amy Zhangbb94eeb2020-07-09 22:48:04 -070062 ALOGV("%s", __FUNCTION__);
63
Kensuke Miyagiafe17c52021-12-16 01:06:15 -080064 if (mCallback != nullptr) {
65 // The correct implementation should be to return the response from the
66 // device via onDiseqcMessage(). The below implementation is only to enable
67 // testing for LnbCallbacks.
68 ALOGV("[hidl] %s - this is for test purpose only, and must be replaced!", __FUNCTION__);
69 mCallback->onDiseqcMessage(diseqcMessage);
70 }
Amy Zhangbb94eeb2020-07-09 22:48:04 -070071 return Result::SUCCESS;
72}
73
74Return<Result> Lnb::close() {
75 ALOGV("%s", __FUNCTION__);
76
77 return Result::SUCCESS;
78}
79
80int Lnb::getId() {
81 return mId;
82}
83
84} // namespace implementation
85} // namespace V1_0
86} // namespace tuner
87} // namespace tv
88} // namespace hardware
89} // namespace android