Hongguang | 4092f2f | 2021-07-08 18:49:12 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 23 | namespace aidl { |
| 24 | namespace android { |
| 25 | namespace hardware { |
| 26 | namespace tv { |
| 27 | namespace tuner { |
| 28 | |
| 29 | Lnb::Lnb() {} |
| 30 | |
| 31 | Lnb::Lnb(int id) { |
| 32 | mId = id; |
| 33 | } |
| 34 | |
| 35 | Lnb::~Lnb() {} |
| 36 | |
Kensuke Miyagi | afe17c5 | 2021-12-16 01:06:15 -0800 | [diff] [blame^] | 37 | ::ndk::ScopedAStatus Lnb::setCallback(const std::shared_ptr<ILnbCallback>& in_callback) { |
Hongguang | 4092f2f | 2021-07-08 18:49:12 -0700 | [diff] [blame] | 38 | ALOGV("%s", __FUNCTION__); |
| 39 | |
Kensuke Miyagi | afe17c5 | 2021-12-16 01:06:15 -0800 | [diff] [blame^] | 40 | mCallback = in_callback; |
| 41 | |
Hongguang | 4092f2f | 2021-07-08 18:49:12 -0700 | [diff] [blame] | 42 | 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 Miyagi | afe17c5 | 2021-12-16 01:06:15 -0800 | [diff] [blame^] | 63 | ::ndk::ScopedAStatus Lnb::sendDiseqcMessage(const std::vector<uint8_t>& in_diseqcMessage) { |
Hongguang | 4092f2f | 2021-07-08 18:49:12 -0700 | [diff] [blame] | 64 | ALOGV("%s", __FUNCTION__); |
| 65 | |
Kensuke Miyagi | afe17c5 | 2021-12-16 01:06:15 -0800 | [diff] [blame^] | 66 | 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 | |
Hongguang | 4092f2f | 2021-07-08 18:49:12 -0700 | [diff] [blame] | 74 | return ::ndk::ScopedAStatus::ok(); |
| 75 | } |
| 76 | |
| 77 | ::ndk::ScopedAStatus Lnb::close() { |
| 78 | ALOGV("%s", __FUNCTION__); |
| 79 | |
| 80 | return ::ndk::ScopedAStatus::ok(); |
| 81 | } |
| 82 | |
| 83 | int Lnb::getId() { |
| 84 | return mId; |
| 85 | } |
| 86 | |
| 87 | } // namespace tuner |
| 88 | } // namespace tv |
| 89 | } // namespace hardware |
| 90 | } // namespace android |
| 91 | } // namespace aidl |