Amy Zhang | a046eee | 2021-01-12 14:44:58 -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 | #ifndef ANDROID_MEDIA_TUNERFLNB_H |
| 18 | #define ANDROID_MEDIA_TUNERFLNB_H |
| 19 | |
Hongguang | eae6839 | 2021-07-27 20:56:23 -0700 | [diff] [blame] | 20 | #include <aidl/android/hardware/tv/tuner/BnLnbCallback.h> |
| 21 | #include <aidl/android/hardware/tv/tuner/ILnb.h> |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 22 | #include <aidl/android/media/tv/tuner/BnTunerLnb.h> |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 23 | #include <utils/Log.h> |
| 24 | |
Hongguang | eae6839 | 2021-07-27 20:56:23 -0700 | [diff] [blame] | 25 | using ::aidl::android::hardware::tv::tuner::BnLnbCallback; |
| 26 | using ::aidl::android::hardware::tv::tuner::ILnb; |
| 27 | using ::aidl::android::hardware::tv::tuner::LnbEventType; |
| 28 | using ::aidl::android::hardware::tv::tuner::LnbPosition; |
| 29 | using ::aidl::android::hardware::tv::tuner::LnbTone; |
| 30 | using ::aidl::android::hardware::tv::tuner::LnbVoltage; |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 31 | |
| 32 | using namespace std; |
| 33 | |
Hongguang | eae6839 | 2021-07-27 20:56:23 -0700 | [diff] [blame] | 34 | namespace aidl { |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 35 | namespace android { |
Hongguang | eae6839 | 2021-07-27 20:56:23 -0700 | [diff] [blame] | 36 | namespace media { |
| 37 | namespace tv { |
| 38 | namespace tuner { |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 39 | |
| 40 | class TunerLnb : public BnTunerLnb { |
| 41 | |
| 42 | public: |
Hongguang | eae6839 | 2021-07-27 20:56:23 -0700 | [diff] [blame] | 43 | TunerLnb(shared_ptr<ILnb> lnb, int id); |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 44 | virtual ~TunerLnb(); |
Hongguang | eae6839 | 2021-07-27 20:56:23 -0700 | [diff] [blame] | 45 | |
| 46 | ::ndk::ScopedAStatus setCallback( |
| 47 | const shared_ptr<ITunerLnbCallback>& in_tunerLnbCallback) override; |
| 48 | ::ndk::ScopedAStatus setVoltage(LnbVoltage in_voltage) override; |
| 49 | ::ndk::ScopedAStatus setTone(LnbTone in_tone) override; |
| 50 | ::ndk::ScopedAStatus setSatellitePosition(LnbPosition in_position) override; |
| 51 | ::ndk::ScopedAStatus sendDiseqcMessage(const vector<uint8_t>& in_diseqcMessage) override; |
| 52 | ::ndk::ScopedAStatus close() override; |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 53 | |
Amy Zhang | 5af8414 | 2021-02-04 18:36:54 -0800 | [diff] [blame] | 54 | int getId() { return mId; } |
| 55 | |
Hongguang | eae6839 | 2021-07-27 20:56:23 -0700 | [diff] [blame] | 56 | struct LnbCallback : public BnLnbCallback { |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 57 | LnbCallback(const shared_ptr<ITunerLnbCallback> tunerLnbCallback) |
Hongguang | eae6839 | 2021-07-27 20:56:23 -0700 | [diff] [blame] | 58 | : mTunerLnbCallback(tunerLnbCallback){}; |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 59 | |
Hongguang | eae6839 | 2021-07-27 20:56:23 -0700 | [diff] [blame] | 60 | ::ndk::ScopedAStatus onEvent(const LnbEventType lnbEventType) override; |
| 61 | ::ndk::ScopedAStatus onDiseqcMessage(const vector<uint8_t>& diseqcMessage) override; |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 62 | |
| 63 | shared_ptr<ITunerLnbCallback> mTunerLnbCallback; |
| 64 | }; |
| 65 | |
| 66 | private: |
| 67 | int mId; |
Hongguang | eae6839 | 2021-07-27 20:56:23 -0700 | [diff] [blame] | 68 | shared_ptr<ILnb> mLnb; |
Ray Chin | 420c030 | 2024-03-12 15:46:26 +0800 | [diff] [blame] | 69 | bool isClosed = false; |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 70 | }; |
| 71 | |
Hongguang | eae6839 | 2021-07-27 20:56:23 -0700 | [diff] [blame] | 72 | } // namespace tuner |
| 73 | } // namespace tv |
| 74 | } // namespace media |
| 75 | } // namespace android |
| 76 | } // namespace aidl |
Amy Zhang | a046eee | 2021-01-12 14:44:58 -0800 | [diff] [blame] | 77 | |
| 78 | #endif // ANDROID_MEDIA_TUNERFLNB_H |