Amy Zhang | b0f63ab | 2021-01-06 17:19:27 -0800 | [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_TAG "LnbClient" |
| 18 | |
| 19 | #include <android-base/logging.h> |
| 20 | #include <utils/Log.h> |
| 21 | |
| 22 | #include "LnbClient.h" |
| 23 | |
| 24 | using ::android::hardware::tv::tuner::V1_0::Result; |
| 25 | |
| 26 | namespace android { |
| 27 | |
| 28 | /////////////// LnbClient /////////////////////// |
| 29 | |
| 30 | // TODO: pending aidl interface |
| 31 | LnbClient::LnbClient() { |
| 32 | //mTunerLnb = tunerLnb; |
| 33 | } |
| 34 | |
| 35 | LnbClient::~LnbClient() { |
| 36 | //mTunerLnb = NULL; |
| 37 | mLnb = NULL; |
| 38 | } |
| 39 | |
| 40 | // TODO: remove after migration to Tuner Service is done. |
| 41 | void LnbClient::setHidlLnb(sp<ILnb> lnb) { |
| 42 | mLnb = lnb; |
| 43 | } |
| 44 | |
| 45 | Result LnbClient::setCallback(sp<LnbClientCallback> /*cb*/) { |
| 46 | return Result::SUCCESS; |
| 47 | } |
| 48 | |
| 49 | Result LnbClient::setVoltage(int /*voltage*/) { |
| 50 | return Result::SUCCESS; |
| 51 | } |
| 52 | |
| 53 | Result LnbClient::setTone(int /*tone*/) { |
| 54 | return Result::SUCCESS; |
| 55 | } |
| 56 | |
| 57 | Result LnbClient::setSatellitePosition(int /*position*/) { |
| 58 | return Result::SUCCESS; |
| 59 | } |
| 60 | |
| 61 | Result LnbClient::sendDiseqcMessage(vector<uint8_t> /*diseqcMessage*/) { |
| 62 | return Result::SUCCESS; |
| 63 | } |
| 64 | |
| 65 | Result LnbClient::close() { |
| 66 | return Result::SUCCESS; |
| 67 | } |
| 68 | |
| 69 | /////////////// ILnbCallback /////////////////////// |
| 70 | |
| 71 | HidlLnbCallback::HidlLnbCallback(sp<LnbClientCallback> lnbClientCallback) |
| 72 | : mLnbClientCallback(lnbClientCallback) {} |
| 73 | |
| 74 | Return<void> HidlLnbCallback::onEvent(const LnbEventType lnbEventType) { |
| 75 | if (mLnbClientCallback != NULL) { |
| 76 | mLnbClientCallback->onEvent(lnbEventType); |
| 77 | } |
| 78 | return Void(); |
| 79 | } |
| 80 | |
| 81 | Return<void> HidlLnbCallback::onDiseqcMessage(const hidl_vec<uint8_t>& diseqcMessage) { |
| 82 | if (mLnbClientCallback != NULL) { |
| 83 | mLnbClientCallback->onDiseqcMessage(diseqcMessage); |
| 84 | } |
| 85 | return Void(); |
| 86 | } |
| 87 | |
| 88 | /////////////// LnbClient Helper Methods /////////////////////// |
| 89 | |
| 90 | } // namespace android |