blob: 500d072d3642071990d008ccbfd51aded067a147 [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;
Amy Zhang077cc1f2021-01-14 18:54:07 -080047 Status setTone(int tone) override;
Amy Zhanga046eee2021-01-12 14:44:58 -080048 Status setSatellitePosition(int position) override;
49 Status sendDiseqcMessage(const vector<uint8_t>& diseqcMessage) override;
50 Status close() override;
51
Amy Zhang5af84142021-02-04 18:36:54 -080052 int getId() { return mId; }
53
Amy Zhanga046eee2021-01-12 14:44:58 -080054 struct LnbCallback : public ILnbCallback {
55 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
64private:
65 int mId;
66 sp<ILnb> mLnb;
67};
68
69} // namespace android
70
71#endif // ANDROID_MEDIA_TUNERFLNB_H