blob: 19ba3c20f4337464421d7557c2596bf2eac57f5d [file] [log] [blame]
Amy Zhanga046eee2021-01-12 14:44:58 -08001/**
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
26using Status = ::ndk::ScopedAStatus;
27using ::aidl::android::media::tv::tuner::BnTunerLnb;
28using ::aidl::android::media::tv::tuner::ITunerLnbCallback;
29using ::android::hardware::Return;
30using ::android::hardware::Void;
31using ::android::hardware::hidl_vec;
32using ::android::hardware::tv::tuner::V1_0::ILnb;
33using ::android::hardware::tv::tuner::V1_0::ILnbCallback;
34using ::android::hardware::tv::tuner::V1_0::LnbEventType;
35
36using namespace std;
37
38namespace android {
39
40class TunerLnb : public BnTunerLnb {
41
42public:
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 voltage) override;
48 Status setSatellitePosition(int position) override;
49 Status sendDiseqcMessage(const vector<uint8_t>& diseqcMessage) override;
50 Status close() override;
51
52 struct LnbCallback : public ILnbCallback {
53 LnbCallback(const shared_ptr<ITunerLnbCallback> tunerLnbCallback)
54 : mTunerLnbCallback(tunerLnbCallback) {};
55
56 virtual Return<void> onEvent(const LnbEventType lnbEventType);
57 virtual Return<void> onDiseqcMessage(const hidl_vec<uint8_t>& diseqcMessage);
58
59 shared_ptr<ITunerLnbCallback> mTunerLnbCallback;
60 };
61
62private:
63 int mId;
64 sp<ILnb> mLnb;
65};
66
67} // namespace android
68
69#endif // ANDROID_MEDIA_TUNERFLNB_H