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_TUNERHIDLLNB_H 18 #define ANDROID_MEDIA_TUNERHIDLLNB_H 19 20 #include <aidl/android/hardware/tv/tuner/ILnb.h> 21 #include <aidl/android/media/tv/tuner/BnTunerLnb.h> 22 #include <android/hardware/tv/tuner/1.0/ILnb.h> 23 #include <android/hardware/tv/tuner/1.0/ILnbCallback.h> 24 #include <utils/Log.h> 25 26 using ::aidl::android::hardware::tv::tuner::LnbEventType; 27 using ::aidl::android::hardware::tv::tuner::LnbPosition; 28 using ::aidl::android::hardware::tv::tuner::LnbTone; 29 using ::aidl::android::hardware::tv::tuner::LnbVoltage; 30 using ::android::sp; 31 using ::android::hardware::hidl_vec; 32 using ::android::hardware::Return; 33 using ::android::hardware::Void; 34 using ::std::shared_ptr; 35 using ::std::vector; 36 37 using HidlILnb = ::android::hardware::tv::tuner::V1_0::ILnb; 38 using HidlILnbCallback = ::android::hardware::tv::tuner::V1_0::ILnbCallback; 39 using HidlLnbEventType = ::android::hardware::tv::tuner::V1_0::LnbEventType; 40 41 namespace aidl { 42 namespace android { 43 namespace media { 44 namespace tv { 45 namespace tuner { 46 47 class TunerHidlLnb : public BnTunerLnb { 48 public: 49 TunerHidlLnb(sp<HidlILnb> lnb, int id); 50 virtual ~TunerHidlLnb(); 51 52 ::ndk::ScopedAStatus setCallback( 53 const shared_ptr<ITunerLnbCallback>& in_tunerLnbCallback) override; 54 ::ndk::ScopedAStatus setVoltage(LnbVoltage in_voltage) override; 55 ::ndk::ScopedAStatus setTone(LnbTone in_tone) override; 56 ::ndk::ScopedAStatus setSatellitePosition(LnbPosition in_position) override; 57 ::ndk::ScopedAStatus sendDiseqcMessage(const vector<uint8_t>& in_diseqcMessage) override; 58 ::ndk::ScopedAStatus close() override; 59 getId()60 int getId() { return mId; } 61 62 struct LnbCallback : public HidlILnbCallback { LnbCallbackLnbCallback63 LnbCallback(const shared_ptr<ITunerLnbCallback> tunerLnbCallback) 64 : mTunerLnbCallback(tunerLnbCallback){}; 65 66 virtual Return<void> onEvent(const HidlLnbEventType lnbEventType); 67 virtual Return<void> onDiseqcMessage(const hidl_vec<uint8_t>& diseqcMessage); 68 69 shared_ptr<ITunerLnbCallback> mTunerLnbCallback; 70 }; 71 72 private: 73 int mId; 74 sp<HidlILnb> mLnb; 75 }; 76 77 } // namespace tuner 78 } // namespace tv 79 } // namespace media 80 } // namespace android 81 } // namespace aidl 82 83 #endif // ANDROID_MEDIA_TUNERHIDLLNB_H 84