blob: c1252b9091cabf4b9e10efbd3d83c4a375e76f6f [file] [log] [blame]
Hongguang093c5f32021-08-09 19:46:34 -07001/*
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_TUNERDVRHELPER_H
18#define ANDROID_MEDIA_TUNERDVRHELPER_H
19
20#include <aidl/android/media/tv/tunerresourcemanager/TunerFrontendInfo.h>
21#include <utils/String16.h>
22
23using ::aidl::android::media::tv::tunerresourcemanager::TunerFrontendInfo;
24using ::android::String16;
25
26using namespace std;
27
28namespace aidl {
29namespace android {
30namespace media {
31namespace tv {
32namespace tuner {
33
34const static int TUNER_HAL_VERSION_UNKNOWN = 0;
35const static int TUNER_HAL_VERSION_1_0 = 1 << 16;
36const static int TUNER_HAL_VERSION_1_1 = (1 << 16) | 1;
37const static int TUNER_HAL_VERSION_2_0 = 2 << 16;
38
Hongguang34a479e2021-10-04 16:14:47 -070039// Keep syncing with ShareFilter.java
40const static int STATUS_INACCESSIBLE = 1 << 7;
41
42const static String16 sSharedFilterPermission("android.permission.ACCESS_TV_SHARED_FILTER");
43
Hongguang093c5f32021-08-09 19:46:34 -070044typedef enum {
45 FRONTEND,
46 LNB,
47 DEMUX,
48 DESCRAMBLER,
49} TunerResourceType;
50
51class TunerHelper {
52public:
53 static bool checkTunerFeature();
54
55 // TODO: update Demux, Descrambler.
56 static void updateTunerResources(const vector<TunerFrontendInfo>& feInfos,
57 const vector<int32_t>& lnbHandles);
58 // TODO: create a map between resource id and handles.
59 static int getResourceIdFromHandle(int resourceHandle, int type);
60 static int getResourceHandleFromId(int id, int resourceType);
61
62private:
63 static int32_t sResourceRequestCount;
64};
65
66} // namespace tuner
67} // namespace tv
68} // namespace media
69} // namespace android
70} // namespace aidl
71
72#endif // ANDROID_MEDIA_TUNERDVRHELPER_H