blob: f9f78efaeb0179fb321c040fa3b26bd161613ea9 [file] [log] [blame]
Henry Fangec766142019-08-01 16:28:33 -07001/*
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 */
16package android.hardware.tv.tuner@1.0;
17
18import IFrontendCallback;
Henry Fangeca50332019-09-16 13:19:53 -070019import ILnb;
Henry Fangec766142019-08-01 16:28:33 -070020
21/**
22 * A Tuner Frontend is used to tune to a frequency and lock signal. It provide
23 * live data feed to Tuner Demux interface.
24 */
25interface IFrontend {
26 /**
27 * Set the callback
28 *
29 * It is used by the client to receive events from the Frontend.
30 * Only one callback for one Frontend instance is supported. The callback
31 * will be replaced if it's set again.
32 *
33 * @param callback Callback object to pass Frontend events to the system.
34 * The previously registered callback must be replaced with this one.
35 * It can be null.
36 * @return result Result status of the operation.
37 * SUCCESS if successful,
38 * INVALID_STATE if callback can't be set at current stage,
39 * UNKNOWN_ERROR if callback setting failed for other reasons.
40 */
41 setCallback(IFrontendCallback callback) generates (Result result);
42
43 /**
44 * Tuning Frontend
45 *
46 * It is used by the client to lock a frequency by providing signal
47 * delivery information. If previous tuning isn't completed, this call must
48 * stop previous tuning, and start a new tuning. Tune is a async call.
49 * LOCKED or NO_SIGNAL eventi is sent back to caller through callback.
50 *
51 * @param settings Signal delivery information which frontend can use to
52 * search and lock the signal.
53 *
54 * @return result Result status of the operation.
55 * SUCCESS if successful,
56 * INVALID_STATE if tuning can't be applied at current stage,
57 * UNKNOWN_ERROR if tuning failed for other reasons.
58 */
59 tune(FrontendSettings settings) generates (Result result);
60
61 /**
62 * Stop the tuning
63 *
64 * It is used by the client to stop a previous tuning.
65 *
66 * @return result Result status of the operation.
67 * SUCCESS if successfully stop tuning.
68 * UNKNOWN_ERROR if failed for other reasons.
69 */
70 stopTune() generates (Result result);
71
72 /**
73 * Release the Frontend instance
74 *
75 * It is used by the client to release the frontend instance. HAL clear
76 * underneath resource. client mustn't access the instance any more.
77 *
78 * @return result Result status of the operation.
79 * SUCCESS if successful,
80 * UNKNOWN_ERROR if failed for other reasons.
81 */
82 close() generates (Result result);
Henry Fangeca50332019-09-16 13:19:53 -070083
84 /**
85 * Scan the frontend to use the settings given.
86 *
87 * This uses the frontend to start a scan from signal delivery information.
88 * If previous scan isn't completed, this call MUST stop previous scan,
89 * and start a new scan.
90 * Scan is an async call, with FrontendScanMessage sent via callback.
91 *
92 * @param settings Signal delivery information which the frontend uses to
93 * scan the signal.
94 * @param type the type which the frontend uses to scan the signal.
95 *
96 * @return result Result status of the operation.
97 * SUCCESS if successful,
98 * INVALID_STATE if tuning can't be applied at current stage,
99 * UNKNOWN_ERROR if tuning failed for other reasons.
100 */
101 scan(FrontendSettings settings, FrontendScanType type) generates (Result result);
102
103 /**
104 * Stops a previous scanning.
105 *
106 * If the method completes successfully, the frontend stop previous
107 * scanning.
108 *
109 * @return result Result status of the operation.
110 * SUCCESS if successfully stop tuning.
111 * UNKNOWN_ERROR if failed for other reasons.
112 */
113 stopScan() generates (Result result);
114
115 /**
116 * Gets the statuses of the frontend.
117 *
118 * This retrieve the statuses of the frontend for given status types.
119 *
120 * @param statusTypes an array of status type which the caller request.
121 *
122 * @return result Result status of the operation.
123 * SUCCESS if successful,
124 * INVALID_STATE if tuning can't be applied at current stage,
125 * UNKNOWN_ERROR if tuning failed for other reasons.
126 * @return statuses an array of statuses which response the caller's
127 * request.
128 */
129 getStatus(vec<FrontendStatusType> statusTypes) generates (Result result, vec<FrontendStatus> statuses);
130
131 /**
132 * Sets Low-Noise Block downconverter (LNB) for satellite frontend.
133 *
134 * This assigns a hardware LNB resource to the satellite frontend. It can be
135 * called multiple times to update LNB assignment. The LNB resource must be
136 * released when the frontend is closed.
137 *
138 * @param lnbId the Id of assigned LNB resource.
139 *
140 * @return result Result status of the operation.
141 * SUCCESS if successful,
142 * INVALID_STATE if the frontend can't be set with a LNB, such as
143 * cable frontend.
144 * UNKNOWN_ERROR if failed for other reasons.
145 */
146 setLnb(ILnb lnb) generates (Result result);
147
148 /**
149 * Enble or Disable Low Noise Amplifier (LNA).
150 *
151 * @param bEnable true if activate LNA module; false if deactivate LNA
152 *
153 * @return result Result status of the operation.
154 * SUCCESS if successful,
155 * INVALID_STATE if the frontend doesn't support LNA.
156 * UNKNOWN_ERROR if failed for other reasons.
157 */
158 setLna(bool bEnable) generates (Result result);
159
160 /**
161 * Sends DiSEqC (Digital Satellite Equipment Control) message.
162 *
163 * Client sends DiSeqc message to DiSEqc compatible device through the
164 * frontend. The response message from the device comes back to the client
165 * through frontend's callback onDiseqcMessage.
166 *
167 * @param diseqcMessage a byte array of data for DiSEqC message which is
168 * specified by EUTELSAT Bus Functional Specification Version 4.2.
169 *
170 * @return result Result status of the operation.
171 * SUCCESS if successful,
172 * INVALID_STATE if the frontend can't send DiSEqc Message, such as
173 * cable frontend.
174 * UNKNOWN_ERROR if failed for other reasons.
175 */
176 sendDiseqcMessage(vec<uint8_t> diseqcMessage) generates (Result result);
Henry Fangec766142019-08-01 16:28:33 -0700177};