1 /**
2  * Copyright (c) 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 package android.media.tv.tuner;
18 
19 import android.hardware.tv.tuner.DemuxCapabilities;
20 import android.hardware.tv.tuner.DemuxInfo;
21 import android.hardware.tv.tuner.FrontendInfo;
22 import android.hardware.tv.tuner.FrontendType;
23 import android.media.tv.tuner.ITunerDemux;
24 import android.media.tv.tuner.ITunerDescrambler;
25 import android.media.tv.tuner.ITunerFilter;
26 import android.media.tv.tuner.ITunerFilterCallback;
27 import android.media.tv.tuner.ITunerFrontend;
28 import android.media.tv.tuner.ITunerLnb;
29 
30 /**
31  * TunerService interface handles tuner related operations.
32  *
33  * {@hide}
34  */
35 //@VintfStability
36 @SuppressWarnings(value={"out-array"})
37 interface ITunerService {
38     /**
39      * Gets frontend IDs.
40      */
getFrontendIds(out int[] ids)41     void getFrontendIds(out int[] ids);
42 
43     /**
44      * Retrieve the frontend's information.
45      *
46      * @param frontendId the ID of the frontend.
47      * @return the information of the frontend.
48      */
getFrontendInfo(in int frontendId)49     FrontendInfo getFrontendInfo(in int frontendId);
50 
51     /**
52      * Open a Tuner Frontend interface.
53      *
54      * @param frontendHandle the handle of the frontend granted by TRM.
55      * @return the aidl interface of the frontend.
56      */
openFrontend(in int frontendHandle)57     ITunerFrontend openFrontend(in int frontendHandle);
58 
59     /**
60      * Open a new interface of ITunerLnb given a lnbHandle.
61      *
62      * @param lnbHandle the handle of the LNB granted by TRM.
63      * @return a newly created ITunerLnb interface.
64      */
openLnb(in int lnbHandle)65     ITunerLnb openLnb(in int lnbHandle);
66 
67     /**
68      * Open a new interface of ITunerLnb given a LNB name.
69      *
70      * @param lnbName the name for an external LNB to be opened.
71      * @return a newly created ITunerLnb interface.
72      */
openLnbByName(in String lnbName)73     ITunerLnb openLnbByName(in String lnbName);
74 
75     /**
76      * Create a new instance of Demux.
77      */
openDemux(in int demuxHandle)78     ITunerDemux openDemux(in int demuxHandle);
79 
80     /**
81      * Retrieve the supported filter main types
82      *
83      * @param demuxHandle the handle of the demux to query demux info for
84      * @return the demux info
85      */
getDemuxInfo(in int demuxHandle)86     DemuxInfo getDemuxInfo(in int demuxHandle);
87 
88     /**
89      * Retrieve the list of demux info for all the demuxes on the system
90      *
91      * @return the list of DemuxInfo
92      */
getDemuxInfoList()93     DemuxInfo[] getDemuxInfoList();
94 
95     /**
96      * Retrieve the Tuner Demux capabilities.
97      *
98      * @return the demux’s capabilities.
99      */
getDemuxCaps()100     DemuxCapabilities getDemuxCaps();
101 
102     /* Open a new interface of ITunerDescrambler given a descramblerHandle.
103      *
104      * @param descramblerHandle the handle of the descrambler granted by TRM.
105      * @return a newly created ITunerDescrambler interface.
106      */
openDescrambler(in int descramblerHandle)107     ITunerDescrambler openDescrambler(in int descramblerHandle);
108 
109     /**
110      * Get an integer that carries the Tuner HIDL version. The high 16 bits are the
111      * major version number while the low 16 bits are the minor version. Default
112      * value is unknown version 0.
113      */
getTunerHalVersion()114     int getTunerHalVersion();
115 
116     /**
117      * Open a new SharedFilter instance of ITunerFilter.
118      *
119      * @param filterToken the SharedFilter token created by ITunerFilter.
120      * @param cb the ITunerFilterCallback used to receive callback events
121      * @return a newly created ITunerFilter interface.
122      */
openSharedFilter(in String filterToken, in ITunerFilterCallback cb)123     ITunerFilter openSharedFilter(in String filterToken, in ITunerFilterCallback cb);
124 
125     /**
126      * Is Low Noise Amplifier (LNA) supported by the Tuner.
127      *
128      * @return {@code true} if supported, otherwise {@code false}.
129      */
isLnaSupported()130     boolean isLnaSupported();
131 
132     /**
133      * Enable or Disable Low Noise Amplifier (LNA).
134      *
135      * @param bEnable enable Lna or not.
136      */
setLna(in boolean bEnable)137     void setLna(in boolean bEnable);
138 
139     /**
140      * Set the maximum usable frontends number of a given frontend type. It's used by client
141      * to enable or disable frontends when cable connection status is changed by user.
142      *
143      * @param frontendType the frontend type which the maximum usable number will be set.
144      * @param maxNumber the new maximum usable number.
145      */
setMaxNumberOfFrontends(in FrontendType frontendType, in int maxNumber)146     void setMaxNumberOfFrontends(in FrontendType frontendType, in int maxNumber);
147 
148     /**
149      * Get the maximum usable frontends number of a given frontend type.
150      *
151      * @param frontendType the frontend type which the maximum usable number will be queried.
152      *
153      * @return the maximum usable number of the queried frontend type.
154      */
getMaxNumberOfFrontends(in FrontendType frontendType)155     int getMaxNumberOfFrontends(in FrontendType frontendType);
156 }
157