• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
20 #include <aidl/android/media/tv/tuner/BnTunerLnb.h>
21 #include <android/hardware/tv/tuner/1.0/ILnb.h>
22 #include <android/hardware/tv/tuner/1.0/ILnbCallback.h>
23 #include <media/stagefright/foundation/ADebug.h>
24 #include <utils/Log.h>
25 
26 using Status = ::ndk::ScopedAStatus;
27 using ::aidl::android::media::tv::tuner::BnTunerLnb;
28 using ::aidl::android::media::tv::tuner::ITunerLnbCallback;
29 using ::android::hardware::Return;
30 using ::android::hardware::Void;
31 using ::android::hardware::hidl_vec;
32 using ::android::hardware::tv::tuner::V1_0::ILnb;
33 using ::android::hardware::tv::tuner::V1_0::ILnbCallback;
34 using ::android::hardware::tv::tuner::V1_0::LnbEventType;
35 
36 using namespace std;
37 
38 namespace android {
39 
40 class TunerLnb : public BnTunerLnb {
41 
42 public:
43     TunerLnb(sp<ILnb> lnb, int id);
44     virtual ~TunerLnb();
45     Status setCallback(const shared_ptr<ITunerLnbCallback>& tunerLnbCallback) override;
46     Status setVoltage(int voltage) override;
47     Status setTone(int tone) override;
48     Status setSatellitePosition(int position) override;
49     Status sendDiseqcMessage(const vector<uint8_t>& diseqcMessage) override;
50     Status close() override;
51 
getId()52     int getId() { return mId; }
53 
54     struct LnbCallback : public ILnbCallback {
LnbCallbackLnbCallback55         LnbCallback(const shared_ptr<ITunerLnbCallback> tunerLnbCallback)
56                 : mTunerLnbCallback(tunerLnbCallback) {};
57 
58         virtual Return<void> onEvent(const LnbEventType lnbEventType);
59         virtual Return<void> onDiseqcMessage(const hidl_vec<uint8_t>& diseqcMessage);
60 
61         shared_ptr<ITunerLnbCallback> mTunerLnbCallback;
62     };
63 
64 private:
65     int mId;
66     sp<ILnb> mLnb;
67 };
68 
69 } // namespace android
70 
71 #endif // ANDROID_MEDIA_TUNERFLNB_H
72