• 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/hardware/tv/tuner/BnLnbCallback.h>
21 #include <aidl/android/hardware/tv/tuner/ILnb.h>
22 #include <aidl/android/media/tv/tuner/BnTunerLnb.h>
23 #include <utils/Log.h>
24 
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;
31 
32 using namespace std;
33 
34 namespace aidl {
35 namespace android {
36 namespace media {
37 namespace tv {
38 namespace tuner {
39 
40 class TunerLnb : public BnTunerLnb {
41 
42 public:
43     TunerLnb(shared_ptr<ILnb> lnb, int id);
44     virtual ~TunerLnb();
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;
53 
getId()54     int getId() { return mId; }
55 
56     struct LnbCallback : public BnLnbCallback {
LnbCallbackLnbCallback57         LnbCallback(const shared_ptr<ITunerLnbCallback> tunerLnbCallback)
58               : mTunerLnbCallback(tunerLnbCallback){};
59 
60         ::ndk::ScopedAStatus onEvent(const LnbEventType lnbEventType) override;
61         ::ndk::ScopedAStatus onDiseqcMessage(const vector<uint8_t>& diseqcMessage) override;
62 
63         shared_ptr<ITunerLnbCallback> mTunerLnbCallback;
64     };
65 
66 private:
67     int mId;
68     shared_ptr<ILnb> mLnb;
69 };
70 
71 }  // namespace tuner
72 }  // namespace tv
73 }  // namespace media
74 }  // namespace android
75 }  // namespace aidl
76 
77 #endif // ANDROID_MEDIA_TUNERFLNB_H
78