blob: 034f9c6d6c011dfab0e3259a2f785c4d30a8abba [file] [log] [blame]
Tomasz Wasilczyk213170b2017-02-07 17:38:21 -08001/*
2 * Copyright (C) 2017 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.broadcastradio@1.1;
18
19import @1.0::ITuner;
20
21interface ITuner extends @1.0::ITuner {
Tomasz Wasilczyk2dd1d8d2017-03-01 14:21:07 -080022
23 /**
Tomasz Wasilczyka02b6ef2017-07-05 11:23:30 -070024 * Tune to a specified program.
25 *
26 * For AM/FM, it must be called when a valid configuration has been applied.
27 * Automatically cancels pending scan, step or tune.
28 *
29 * If method returns OK, ITunerCallback.tuneComplete_1_1() MUST be called:
30 * - once successfully tuned;
31 * - after a time out;
32 * - after a full band scan, if no station found.
33 *
34 * The tuned field of ProgramInfo should indicate if tuned to a valid
35 * station or not.
36 *
37 * @param program Program to tune to.
38 * @return result OK if successfully started tunning.
39 * INVALID_ARGUMENTS if invalid arguments are passed.
40 * NOT_INITIALIZED if another error occurs.
41 */
Tomasz Wasilczykb8a2afe2017-08-01 10:52:18 -070042 tuneByProgramSelector(ProgramSelector program) generates (Result result);
Tomasz Wasilczyka02b6ef2017-07-05 11:23:30 -070043
44 /**
Tomasz Wasilczyk24180092017-07-14 10:44:52 -070045 * Cancels announcement.
46 *
47 * If it was traffic announcement, trafficAnnouncement(false) callback
48 * should be called (just like it was ended in a normal way). Similarly for
49 * emergency announcement. If there was no announcement, then no action
50 * should be taken.
51 *
52 * There is a race condition between calling cancelAnnouncement and the
53 * actual announcement being finished, so trafficAnnouncement /
54 * emergencyAnnouncement callback should be tracked with proper locking.
55 *
56 * @return result OK if successfully cancelled announcement or there was
57 * no announcement.
58 * NOT_INITIALIZED if another error occurs.
59 */
60 cancelAnnouncement() generates (Result result);
61
62 /**
Tomasz Wasilczyk213170b2017-02-07 17:38:21 -080063 * Retrieve current station information.
64 * @return result OK if scan successfully started
65 * NOT_INITIALIZED if another error occurs
66 * @return info Current program information.
67 */
Tomasz Wasilczyk803301a2017-03-13 14:30:15 -070068 getProgramInformation_1_1() generates (Result result, ProgramInfo info);
69
70 /**
71 * Initiates a background scan to update internally cached program list.
72 *
73 * HAL client may not need to initiate the scan explicitly with this call,
74 * ie. HAL implementation MAY perform the scan on boot. It's a common
75 * practice in devices with two physical tuners with background scanning.
76 *
77 * Device must call backgroundScanComplete if the result is OK, even if the
78 * scan fails later (it must pass proper result through the callback).
79 * Otherwise, backgroundScanComplete must not be called as a result of this
80 * certain attempt. It may still be called as a response to another call to
81 * startBackgroundScan, former or latter.
82 *
83 * Device may utilize an already running (but not finished) scan for
84 * subsequent calls to startBackgroundScan, issuing a single
85 * backgroundScanComplete callback.
86 *
Tomasz Wasilczyk614ffc12017-07-27 10:30:23 -070087 * If a device supports continuous background scanning, it may succeed
88 * (return OK and call backgroundScanComplete) without any additional
89 * operation performed.
90 *
91 * Foreground scanning may be implemented in the front end app with
92 * @1.0::ITuner scan operation.
93 *
Tomasz Wasilczyk803301a2017-03-13 14:30:15 -070094 * @return result OK if the scan was properly scheduled (this does not mean
95 * it successfully finished).
Tomasz Wasilczyk22e5f172017-03-27 15:18:58 -070096 * UNAVAILABLE if the background scan is unavailable,
97 * ie. temporarily due to ongoing foreground
Tomasz Wasilczyk803301a2017-03-13 14:30:15 -070098 * playback in single-tuner device.
99 * NOT_INITIALIZED other error, ie. HW failure.
100 */
101 startBackgroundScan() generates (ProgramListResult result);
Tomasz Wasilczyk2dd1d8d2017-03-01 14:21:07 -0800102
103 /**
104 * Retrieve station list.
105 *
106 * This call does not trigger actual scan, but operates on the list cached
107 * internally at the driver level.
108 *
109 * @param filter vendor-specific filter for the stations to be retrieved.
110 * An empty string MUST result in full list.
111 * Client application MUST verify vendor/product name
112 * before setting this parameter to anything else.
113 * @return result OK if the list was successfully retrieved.
Tomasz Wasilczyk6ca90ed2017-05-15 12:57:20 -0700114 * INVALID_ARGUMENTS if invalid arguments are passed
Tomasz Wasilczyk2dd1d8d2017-03-01 14:21:07 -0800115 * NOT_READY if the scan is in progress.
Tomasz Wasilczyk803301a2017-03-13 14:30:15 -0700116 * NOT_STARTED if the scan has not been started, client may
117 * call startBackgroundScan to fix this.
Tomasz Wasilczyk2dd1d8d2017-03-01 14:21:07 -0800118 * NOT_INITIALIZED if any other error occurs.
119 * @return programList List of stations available for user.
120 */
121 getProgramList(string filter)
Tomasz Wasilczyk803301a2017-03-13 14:30:15 -0700122 generates (ProgramListResult result, vec<ProgramInfo> programList);
Tomasz Wasilczyk2dd1d8d2017-03-01 14:21:07 -0800123
Tomasz Wasilczykc7002822017-03-27 14:29:16 -0700124 /**
Tomasz Wasilczykc7002822017-03-27 14:29:16 -0700125 * Forces the analog playback for the supporting radio technology.
126 *
127 * User may disable digital playback for FM HD Radio or hybrid FM/DAB with
128 * this option. This is purely user choice, ie. does not reflect digital-
129 * analog handover managed from the HAL implementation side.
130 *
131 * Some radio technologies may not support this, ie. DAB.
132 *
133 * @param isForced true to force analog, false for a default behaviour.
134 * @return result OK if the setting was successfully done.
135 * INVALID_STATE if the switch is not supported at current
136 * configuration.
137 * NOT_INITIALIZED if any other error occurs.
138 */
139 setAnalogForced(bool isForced) generates (Result result);
Tomasz Wasilczykb8a2afe2017-08-01 10:52:18 -0700140
141 /**
142 * Checks, if the analog playback is forced, see setAnalogForced.
143 *
144 * The isForced value is only valid if result was OK.
145 *
146 * @return result OK if the call succeeded and isForced is valid.
147 * INVALID_STATE if the switch is not supported at current
148 * configuration.
149 * NOT_INITIALIZED if any other error occurs.
150 * @return isForced true if analog is forced, false otherwise.
151 */
152 isAnalogForced() generates (Result result, bool isForced);
Tomasz Wasilczyk213170b2017-02-07 17:38:21 -0800153};