Debian Codegraph @

media/jni/tuner/FrontendClient.h

raw symbols SCIP
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_TV_FRONTEND_CLIENT_H_
18 #define _ANDROID_MEDIA_TV_FRONTEND_CLIENT_H_
19
20 #include <aidl/android/hardware/tv/tuner/DemuxFilterSettings.h>
21 #include <aidl/android/hardware/tv/tuner/FrontendType.h>
22 #include <aidl/android/hardware/tv/tuner/Result.h>
23 #include <aidl/android/media/tv/tuner/BnTunerFrontendCallback.h>
24 #include <aidl/android/media/tv/tuner/ITunerFrontend.h>
25 #include <utils/RefBase.h>
26
27 #include "ClientHelper.h"
28 #include "FrontendClientCallback.h"
29 #include "LnbClient.h"
30
31 using Status = ::ndk::ScopedAStatus;
32 using ::aidl::android::hardware::tv::tuner::FrontendEventType;
33 using ::aidl::android::hardware::tv::tuner::FrontendScanMessage;
34 using ::aidl::android::hardware::tv::tuner::FrontendScanMessageType;
35 using ::aidl::android::hardware::tv::tuner::FrontendScanType;
36 using ::aidl::android::hardware::tv::tuner::FrontendSettings;
37 using ::aidl::android::hardware::tv::tuner::FrontendStatus;
38 using ::aidl::android::hardware::tv::tuner::FrontendStatusReadiness;
39 using ::aidl::android::hardware::tv::tuner::FrontendStatusType;
40 using ::aidl::android::hardware::tv::tuner::FrontendType;
41 using ::aidl::android::hardware::tv::tuner::Result;
42 using ::aidl::android::media::tv::tuner::BnTunerFrontendCallback;
43 using ::aidl::android::media::tv::tuner::ITunerFrontend;
44
45 using namespace std;
46
47 namespace android {
48
49 class TunerFrontendCallback : public BnTunerFrontendCallback {
50
51 public:
52 TunerFrontendCallback(sp<FrontendClientCallback> frontendClientCallback);
53
54 Status onEvent(FrontendEventType frontendEventType);
55 Status onScanMessage(FrontendScanMessageType messageType, const FrontendScanMessage& message);
56
57 private:
58 sp<FrontendClientCallback> mFrontendClientCallback;
59 };
60
61 struct FrontendClient : public RefBase {
62
63 public:
64 FrontendClient(shared_ptr<ITunerFrontend> tunerFrontend, FrontendType type);
65 ~FrontendClient();
66
67 /**
68 * Set a FrontendClientCallback to receive frontend events and scan messages.
69 */
70 Result setCallback(sp<FrontendClientCallback> frontendClientCallback);
71
72 /**
73 * Tuner Frontend with Frontend Settings.
74 */
75 Result tune(const FrontendSettings& settings);
76
77 /**
78 * Stop tune Frontend.
79 */
80 Result stopTune();
81
82 /**
83 * Scan the frontend to use the settings given.
84 */
85 Result scan(const FrontendSettings& settings, FrontendScanType frontendScanType);
86
87 /**
88 * Stop the previous scanning.
89 */
90 Result stopScan();
91
92 /**
93 * Gets the statuses of the frontend.
94 */
95 vector<FrontendStatus> getStatus(vector<FrontendStatusType> statusTypes);
96
97 /**
98 * Sets Low-Noise Block downconverter (LNB) for satellite frontend.
99 */
100 Result setLnb(sp<LnbClient> lnbClient);
101
102 /**
103 * Link Frontend to the cicam with given id.
104 *
105 * @return lts id
106 */
107 int32_t linkCiCamToFrontend(int32_t ciCamId);
108
109 /**
110 * Unink Frontend to the cicam with given id.
111 */
112 Result unlinkCiCamToFrontend(int32_t ciCamId);
113
114 /**
115 * Close Frontend.
116 */
117 Result close();
118
119 /**
120 * Get Frontend hardware info.
121 */
122 Result getHardwareInfo(string& info);
123
124 /**
125 * Filter out unnecessary PID from frontend output.
126 */
127 Result removeOutputPid(int32_t pid);
128
129 /**
130 * Gets Frontend Status Readiness statuses for given status types.
131 */
132 vector<FrontendStatusReadiness> getStatusReadiness(
133 const std::vector<FrontendStatusType>& types);
134
135 int32_t getId();
136
137 shared_ptr<ITunerFrontend> getAidlFrontend();
138 private:
139 /**
140 * An AIDL Tuner Frontend Singleton assigned at the first time when the Tuner Client
141 * opens a frontend cient. Default null when the service does not exist.
142 */
143 shared_ptr<ITunerFrontend> mTunerFrontend;
144
145 FrontendType mType;
146 };
147 } // namespace android
148
149 #endif // _ANDROID_MEDIA_TV_FRONTEND_CLIENT_H_