blob: a5c569a93097a62c46e281d6bd94e8c69a2b6b5c [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 */
42 tune_1_1(ProgramSelector program) generates (Result result);
43
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 *
87 * @return result OK if the scan was properly scheduled (this does not mean
88 * it successfully finished).
Tomasz Wasilczyk22e5f172017-03-27 15:18:58 -070089 * UNAVAILABLE if the background scan is unavailable,
90 * ie. temporarily due to ongoing foreground
Tomasz Wasilczyk803301a2017-03-13 14:30:15 -070091 * playback in single-tuner device.
92 * NOT_INITIALIZED other error, ie. HW failure.
93 */
94 startBackgroundScan() generates (ProgramListResult result);
Tomasz Wasilczyk2dd1d8d2017-03-01 14:21:07 -080095
96 /**
97 * Retrieve station list.
98 *
99 * This call does not trigger actual scan, but operates on the list cached
100 * internally at the driver level.
101 *
102 * @param filter vendor-specific filter for the stations to be retrieved.
103 * An empty string MUST result in full list.
104 * Client application MUST verify vendor/product name
105 * before setting this parameter to anything else.
106 * @return result OK if the list was successfully retrieved.
Tomasz Wasilczyk6ca90ed2017-05-15 12:57:20 -0700107 * INVALID_ARGUMENTS if invalid arguments are passed
Tomasz Wasilczyk2dd1d8d2017-03-01 14:21:07 -0800108 * NOT_READY if the scan is in progress.
Tomasz Wasilczyk803301a2017-03-13 14:30:15 -0700109 * NOT_STARTED if the scan has not been started, client may
110 * call startBackgroundScan to fix this.
Tomasz Wasilczyk2dd1d8d2017-03-01 14:21:07 -0800111 * NOT_INITIALIZED if any other error occurs.
112 * @return programList List of stations available for user.
113 */
114 getProgramList(string filter)
Tomasz Wasilczyk803301a2017-03-13 14:30:15 -0700115 generates (ProgramListResult result, vec<ProgramInfo> programList);
Tomasz Wasilczyk2dd1d8d2017-03-01 14:21:07 -0800116
Tomasz Wasilczykc7002822017-03-27 14:29:16 -0700117 /**
118 * Checks, if the analog playback is forced, see setAnalogForced.
119 *
120 * The isForced value is only valid if result was OK.
121 *
122 * @return result OK if the call succeeded and isForced is valid.
123 * INVALID_STATE if the switch is not supported at current
124 * configuration.
125 * NOT_INITIALIZED if any other error occurs.
126 * @return isForced true if analog is forced, false otherwise.
127 */
128 isAnalogForced() generates (Result result, bool isForced);
129
130 /**
131 * Forces the analog playback for the supporting radio technology.
132 *
133 * User may disable digital playback for FM HD Radio or hybrid FM/DAB with
134 * this option. This is purely user choice, ie. does not reflect digital-
135 * analog handover managed from the HAL implementation side.
136 *
137 * Some radio technologies may not support this, ie. DAB.
138 *
139 * @param isForced true to force analog, false for a default behaviour.
140 * @return result OK if the setting was successfully done.
141 * INVALID_STATE if the switch is not supported at current
142 * configuration.
143 * NOT_INITIALIZED if any other error occurs.
144 */
145 setAnalogForced(bool isForced) generates (Result result);
Tomasz Wasilczyk213170b2017-02-07 17:38:21 -0800146};