1/*
2 * Copyright (C) 2019 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
17package android.hardware.tv.tuner@1.0;
18
19import IDemux;
20import IDescrambler;
21import IFrontend;
22import ILnb;
23
24/**
25 * Top level interface to manage Frontend, Demux and Decrambler hardware
26 * resouces which are needed for Android TV.
27 */
28interface ITuner {
29    /**
30     * Get Frontend IDs
31     *
32     * It is used by the client to get all available frontends' IDs.
33     *
34     * @return result Result status of the operation.
35     *         SUCCESS if successful,
36     *         UNKNOWN_ERROR if tuning failed for other reasons.
37     * @return frontendIds an array of FrontendId for the available frontends.
38     */
39    getFrontendIds() generates (Result result, vec<FrontendId> frontendIds);
40
41    /**
42     * Create a new instance of Frontend given a frontendId.
43     *
44     * It is used by the client to create a frontend instance.
45     *
46     * @param frontendId the id of the frontend to be opened.
47     * @return result Result status of the operation.
48     *         SUCCESS if successful,
49     *         UNAVAILABLE if no resource.
50     *         UNKNOWN_ERROR if creation failed for other reasons.
51     * @return frontend the newly created frontend interface.
52     */
53    openFrontendById(FrontendId frontendId) generates (Result result, IFrontend frontend);
54
55    /**
56     * Create a new instance of Demux.
57     *
58     * It is used by the client to create a Demux instance.
59     *
60     * @return result Result status of the operation.
61     *         SUCCESS if successful,
62     *         UNKNOWN_ERROR if creation failed for other reasons.
63     * @return demuxId newly created demux id.
64     * @return demux the newly created demux interface.
65     */
66    openDemux() generates (Result result, DemuxId demuxId, IDemux demux);
67
68    /**
69     * Retrieve the Demux's Capabilities.
70     *
71     * @return result Result status of the operation.
72     *         SUCCESS if successful,
73     *         UNKNOWN_ERROR if the inquiry failed for other reasons.
74     * @return caps the Demux's Capabilities.
75     */
76    getDemuxCaps() generates (Result result, DemuxCapabilities caps);
77
78    /**
79     * Create a new instance of Descrambler.
80     *
81     * It is used by the client to create a Descrambler instance.
82     *
83     * @return result Result status of the operation.
84     *         SUCCESS if successful,
85     *         UNKNOWN_ERROR if creation failed for other reasons.
86     * @return descrambler the newly created descrambler interface.
87     */
88    openDescrambler() generates (Result result, IDescrambler descrambler);
89
90    /**
91     * Retrieve the frontend's information.
92     *
93     * @param frontendId the id of the frontend to be inquiried.
94     * @return result Result status of the operation.
95     *         SUCCESS if successful,
96     *         UNKNOWN_ERROR if the inquiry failed for other reasons.
97     * @return info the frontend's information.
98     */
99    getFrontendInfo(FrontendId frontendId) generates (Result result, FrontendInfo info);
100
101    /**
102     * Get low-noise block downconverter (LNB) IDs.
103     *
104     * It is used by the client to get all available LNBs' IDs.
105     *
106     * @return result Result status of the operation.
107     *         SUCCESS if successful,
108     *         UNKNOWN_ERROR if tuning failed for other reasons.
109     * @return frontendIds an array of LnbId for the available LNBs.
110     */
111    getLnbIds() generates (Result result, vec<LnbId> lnbIds);
112
113    /**
114     * Create a new instance of Lnb given a lnbId.
115     *
116     * It is used by the client to create a Lnb instance for satellite Frontend.
117     *
118     * @param lnbId the id of the LNB to be opened.
119     * @return result Result status of the operation.
120     *         SUCCESS if successful,
121     *         UNAVAILABLE if no resource.
122     *         UNKNOWN_ERROR if creation failed for other reasons.
123     * @return lnb the newly created Lnb interface.
124     */
125    openLnbById(LnbId lnbId) generates (Result result, ILnb lnb);
126
127    /**
128     * Create a new instance of Lnb given a LNB name.
129     *
130     * It is used by the client to create a LNB instance for external device.
131     *
132     * @param lnbName the name for an external LNB to be opened. The app
133     *        provides the name. Frammework doesn't depend on the name, instead
134     *        use lnbId return from this call.
135     * @return result Result status of the operation.
136     *         SUCCESS if successful,
137     *         UNAVAILABLE if no resource.
138     *         UNKNOWN_ERROR if creation failed for other reasons.
139     * @return lnbId the id of the LNB to be opened.
140     * @return lnb the newly created Lnb interface.
141     */
142    openLnbByName(string lnbName) generates (Result result, LnbId lnbId, ILnb lnb);
143};
144