1 /*
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-Lnb"
18
19 #include "Lnb.h"
20 #include <utils/Log.h>
21
22 namespace android {
23 namespace hardware {
24 namespace tv {
25 namespace tuner {
26 namespace V1_0 {
27 namespace implementation {
28
Lnb()29 Lnb::Lnb() {}
Lnb(int id)30 Lnb::Lnb(int id) {
31 mId = id;
32 }
33
~Lnb()34 Lnb::~Lnb() {}
35
setCallback(const sp<ILnbCallback> & callback)36 Return<Result> Lnb::setCallback(const sp<ILnbCallback>& callback) {
37 ALOGV("%s", __FUNCTION__);
38
39 mCallback = callback;
40 return Result::SUCCESS;
41 }
42
setVoltage(LnbVoltage)43 Return<Result> Lnb::setVoltage(LnbVoltage /* voltage */) {
44 ALOGV("%s", __FUNCTION__);
45
46 return Result::SUCCESS;
47 }
48
setTone(LnbTone)49 Return<Result> Lnb::setTone(LnbTone /* tone */) {
50 ALOGV("%s", __FUNCTION__);
51
52 return Result::SUCCESS;
53 }
54
setSatellitePosition(LnbPosition)55 Return<Result> Lnb::setSatellitePosition(LnbPosition /* position */) {
56 ALOGV("%s", __FUNCTION__);
57
58 return Result::SUCCESS;
59 }
60
sendDiseqcMessage(const hidl_vec<uint8_t> & diseqcMessage)61 Return<Result> Lnb::sendDiseqcMessage(const hidl_vec<uint8_t>& diseqcMessage) {
62 ALOGV("%s", __FUNCTION__);
63
64 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 }
71 return Result::SUCCESS;
72 }
73
close()74 Return<Result> Lnb::close() {
75 ALOGV("%s", __FUNCTION__);
76
77 return Result::SUCCESS;
78 }
79
getId()80 int 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
90