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_TUNERDVRHELPER_H 18 #define ANDROID_MEDIA_TUNERDVRHELPER_H 19 20 #include <aidl/android/media/tv/tunerresourcemanager/TunerFrontendInfo.h> 21 #include <utils/String16.h> 22 23 using ::aidl::android::media::tv::tunerresourcemanager::TunerFrontendInfo; 24 using ::android::String16; 25 26 using namespace std; 27 28 namespace aidl { 29 namespace android { 30 namespace media { 31 namespace tv { 32 namespace tuner { 33 34 const static int TUNER_HAL_VERSION_UNKNOWN = 0; 35 const static int TUNER_HAL_VERSION_1_0 = 1 << 16; 36 const static int TUNER_HAL_VERSION_1_1 = (1 << 16) | 1; 37 const static int TUNER_HAL_VERSION_2_0 = 2 << 16; 38 39 // Keep syncing with ShareFilter.java 40 const static int STATUS_INACCESSIBLE = 1 << 7; 41 42 const static String16 sSharedFilterPermission("android.permission.ACCESS_TV_SHARED_FILTER"); 43 44 typedef enum { 45 FRONTEND, 46 DEMUX, 47 DESCRAMBLER, 48 LNB 49 } TunerResourceType; 50 51 class TunerHelper { 52 public: 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 62 private: 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 73