blob: f9343ae6c83cacf020cafdcc12976dd3352063b6 [file] [log] [blame]
Hongguang4092f2f2021-07-08 18:49:12 -07001/*
2 * Copyright 2021 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_NDEBUG 0
18#define LOG_TAG "android.hardware.tv.tuner-service.example-Lnb"
19
20#include "Lnb.h"
21#include <utils/Log.h>
22
23namespace aidl {
24namespace android {
25namespace hardware {
26namespace tv {
27namespace tuner {
28
29Lnb::Lnb() {}
30
31Lnb::Lnb(int id) {
32 mId = id;
33}
34
35Lnb::~Lnb() {}
36
Kensuke Miyagiafe17c52021-12-16 01:06:15 -080037::ndk::ScopedAStatus Lnb::setCallback(const std::shared_ptr<ILnbCallback>& in_callback) {
Hongguang4092f2f2021-07-08 18:49:12 -070038 ALOGV("%s", __FUNCTION__);
39
Kensuke Miyagiafe17c52021-12-16 01:06:15 -080040 mCallback = in_callback;
41
Hongguang4092f2f2021-07-08 18:49:12 -070042 return ::ndk::ScopedAStatus::ok();
43}
44
45::ndk::ScopedAStatus Lnb::setVoltage(LnbVoltage /* in_voltage */) {
46 ALOGV("%s", __FUNCTION__);
47
48 return ::ndk::ScopedAStatus::ok();
49}
50
51::ndk::ScopedAStatus Lnb::setTone(LnbTone /* in_tone */) {
52 ALOGV("%s", __FUNCTION__);
53
54 return ::ndk::ScopedAStatus::ok();
55}
56
57::ndk::ScopedAStatus Lnb::setSatellitePosition(LnbPosition /* in_position */) {
58 ALOGV("%s", __FUNCTION__);
59
60 return ::ndk::ScopedAStatus::ok();
61}
62
Kensuke Miyagiafe17c52021-12-16 01:06:15 -080063::ndk::ScopedAStatus Lnb::sendDiseqcMessage(const std::vector<uint8_t>& in_diseqcMessage) {
Hongguang4092f2f2021-07-08 18:49:12 -070064 ALOGV("%s", __FUNCTION__);
65
Kensuke Miyagiafe17c52021-12-16 01:06:15 -080066 if (mCallback != nullptr) {
67 // The correct implementation should be to return the response from the
68 // device via onDiseqcMessage(). The below implementation is only to enable
69 // testing for LnbCallbacks.
70 ALOGV("[aidl] %s - this is for test purpose only, and must be replaced!", __FUNCTION__);
71 mCallback->onDiseqcMessage(in_diseqcMessage);
72 }
73
Hongguang4092f2f2021-07-08 18:49:12 -070074 return ::ndk::ScopedAStatus::ok();
75}
76
77::ndk::ScopedAStatus Lnb::close() {
78 ALOGV("%s", __FUNCTION__);
79
80 return ::ndk::ScopedAStatus::ok();
81}
82
83int Lnb::getId() {
84 return mId;
85}
86
87} // namespace tuner
88} // namespace tv
89} // namespace hardware
90} // namespace android
91} // namespace aidl