blob: e891a234fdf3bb9e696b6038315af66d62a46420 [file] [log] [blame]
Tomasz Wasilczyk6e0e1ae2017-11-30 09:03:43 -08001/* Copyright (C) 2017 The Android Open Source Project
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16package android.hardware.broadcastradio@2.0;
17
18interface ITunerSession {
19 /**
20 * Tune to a specified program.
21 *
22 * Automatically cancels pending scan, step or tune.
23 * If the method returns OK, tuneFailed or currentProgramInfoChanged
24 * callback must be called.
25 *
26 * @param program Program to tune to.
27 * @return result OK if successfully started tuning.
28 * NOT_SUPPORTED if the program selector doesn't contain any
29 * supported identifier.
30 * INVALID_ARGUMENTS if the program selector contains
31 * identifiers in invalid format (i.e. out of range).
32 */
33 tune(ProgramSelector program) generates (Result result);
34
35 /**
36 * Tune to the next valid program.
37 *
38 * Automatically cancels pending scan, step or tune.
39 * If the method returns OK, tuneFailed or currentProgramInfoChanged
40 * callback must be called.
41 *
42 * The skipSubChannel parameter is used to skip digital radio subchannels:
43 * - HD Radio SPS;
44 * - DAB secondary service.
45 *
46 * As an implementation detail, the HAL has the option to perform an actual
47 * scan or select the next program from the list retrieved in the
48 * background, if one is not stale.
49 *
50 * @param directionUp True to change towards higher numeric values
51 * (frequency, channel number), false towards lower.
52 * @param skipSubChannel Don't tune to subchannels.
53 * @return result OK if the scan has successfully started.
54 */
55 scan(bool directionUp, bool skipSubChannel) generates (Result result);
56
57 /**
58 * Tune to the adjacent channel, which may not be occupied by any program.
59 *
60 * Automatically cancels pending scan, step or tune.
61 * If the method returns OK, tuneFailed or currentProgramInfoChanged
62 * callback must be called.
63 *
64 * @param directionUp True to change towards higher numeric values
65 * (frequency, channel number), false towards lower.
66 * @return result OK successfully started tuning.
67 * NOT_SUPPORTED if tuning to an unoccupied channel is not
68 * supported (i.e. for satellite radio).
69 */
70 step(bool directionUp) generates (Result result);
71
72 /**
73 * Cancel a scan, step or tune operation.
74 *
75 * If there is no such operation running, the call must be ignored.
76 */
77 cancel();
78
79 /**
Tomasz Wasilczykbceb8852017-12-18 13:59:29 -080080 * Applies a filter to the program list and starts sending program list
81 * updates over onProgramListUpdated callback.
82 *
83 * There may be only one updates stream active at the moment. Calling this
84 * method again must result in cancelling the previous update request.
85 *
86 * This call clears the program list on the client side, the HAL must send
87 * the whole list again.
88 *
89 * If the program list scanning hardware (i.e. background tuner) is
90 * unavailable at the moment, the call must succeed and start updates
91 * when it becomes available.
92 *
93 * @param filter Filter to apply on the fetched program list.
94 * @return result OK successfully started fetching list updates.
95 * NOT_SUPPORTED program list scanning is not supported
96 * by the hardware.
97 */
98 startProgramListUpdates(ProgramFilter filter) generates (Result result);
99
100 /**
101 * Stops sending program list updates.
102 */
103 stopProgramListUpdates();
104
105 /**
Tomasz Wasilczyk43fe8942017-12-14 11:44:12 -0800106 * Fetches the current setting of a given config flag.
107 *
108 * The success/failure result must be consistent with setConfigFlag.
109 *
110 * @param flag Flag to fetch.
111 * @return result OK successfully fetched the flag.
112 * INVALID_STATE if the flag is not applicable right now.
113 * NOT_SUPPORTED if the flag is not supported at all.
114 * @return value The current value of the flag, if result is OK.
115 */
Tomasz Wasilczyk3dd452a2018-01-12 14:57:45 -0800116 isConfigFlagSet(ConfigFlag flag) generates (Result result, bool value);
Tomasz Wasilczyk43fe8942017-12-14 11:44:12 -0800117
118 /**
119 * Sets the config flag.
120 *
Tomasz Wasilczyk3dd452a2018-01-12 14:57:45 -0800121 * The success/failure result must be consistent with isConfigFlagSet.
Tomasz Wasilczyk43fe8942017-12-14 11:44:12 -0800122 *
123 * @param flag Flag to set.
124 * @param value The new value of a given flag.
125 * @return result OK successfully set the flag.
126 * INVALID_STATE if the flag is not applicable right now.
127 * NOT_SUPPORTED if the flag is not supported at all.
128 */
129 setConfigFlag(ConfigFlag flag, bool value) generates (Result result);
130
131 /**
Tomasz Wasilczyk6e0e1ae2017-11-30 09:03:43 -0800132 * Generic method for setting vendor-specific parameter values.
133 * The framework does not interpret the parameters, they are passed
134 * in an opaque manner between a vendor application and HAL.
135 *
136 * Framework does not make any assumptions on the keys or values, other than
137 * ones stated in VendorKeyValue documentation (a requirement of key
138 * prefixes).
139 *
140 * For each pair in the result vector, the key must be one of the keys
141 * contained in the input (possibly with wildcards expanded), and the value
142 * must be a vendor-specific result status (i.e. the string "OK" or an error
143 * code). The implementation may choose to return an empty vector, or only
144 * return a status for a subset of the provided inputs, at its discretion.
145 *
146 * Application and HAL must not use keys with unknown prefix. In particular,
147 * it must not place a key-value pair in results vector for unknown key from
148 * parameters vector - instead, an unknown key should simply be ignored.
149 * In other words, results vector may contain a subset of parameter keys
150 * (however, the framework doesn't enforce a strict subset - the only
151 * formal requirement is vendor domain prefix for keys).
152 *
153 * @param parameters Vendor-specific key-value pairs.
154 * @return results Operation completion status for parameters being set.
155 */
156 setParameters(vec<VendorKeyValue> parameters)
Tomasz Wasilczyk6a9f8562017-12-27 09:46:43 -0800157 generates (vec<VendorKeyValue> results);
Tomasz Wasilczyk6e0e1ae2017-11-30 09:03:43 -0800158
159 /**
160 * Generic method for retrieving vendor-specific parameter values.
161 * The framework does not interpret the parameters, they are passed
162 * in an opaque manner between a vendor application and HAL.
163 *
164 * Framework does not cache set/get requests, so it's allowed for
165 * getParameter to return a different value than previous setParameter call.
166 *
167 * The syntax and semantics of keys are up to the vendor (as long as prefix
168 * rules are obeyed). For instance, vendors may include some form of
169 * wildcard support. In such case, result vector may be of different size
170 * than requested keys vector. However, wildcards are not recognized by
171 * framework and they are passed as-is to the HAL implementation.
172 *
173 * Unknown keys must be ignored and not placed into results vector.
174 *
175 * @param keys Parameter keys to fetch.
176 * @return parameters Vendor-specific key-value pairs.
177 */
178 getParameters(vec<string> keys) generates (vec<VendorKeyValue> parameters);
179
180 /**
181 * Closes the session.
182 *
183 * The call must not fail and must only be issued once.
184 *
185 * After the close call is executed, no other calls to this interface
186 * are allowed.
187 */
188 close();
189};