Tomasz Wasilczyk | 213170b | 2017-02-07 17:38:21 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.hardware.broadcastradio@1.1; |
| 18 | |
| 19 | import @1.0::ITuner; |
| 20 | |
| 21 | interface ITuner extends @1.0::ITuner { |
Tomasz Wasilczyk | 2dd1d8d | 2017-03-01 14:21:07 -0800 | [diff] [blame] | 22 | |
| 23 | /** |
Tomasz Wasilczyk | a02b6ef | 2017-07-05 11:23:30 -0700 | [diff] [blame] | 24 | * 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 Wasilczyk | b8a2afe | 2017-08-01 10:52:18 -0700 | [diff] [blame] | 42 | tuneByProgramSelector(ProgramSelector program) generates (Result result); |
Tomasz Wasilczyk | a02b6ef | 2017-07-05 11:23:30 -0700 | [diff] [blame] | 43 | |
| 44 | /** |
Tomasz Wasilczyk | 2418009 | 2017-07-14 10:44:52 -0700 | [diff] [blame] | 45 | * 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 Wasilczyk | 213170b | 2017-02-07 17:38:21 -0800 | [diff] [blame] | 63 | * 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 Wasilczyk | 803301a | 2017-03-13 14:30:15 -0700 | [diff] [blame] | 68 | 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 Wasilczyk | 614ffc1 | 2017-07-27 10:30:23 -0700 | [diff] [blame] | 87 | * 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 Wasilczyk | 803301a | 2017-03-13 14:30:15 -0700 | [diff] [blame] | 94 | * @return result OK if the scan was properly scheduled (this does not mean |
| 95 | * it successfully finished). |
Tomasz Wasilczyk | 22e5f17 | 2017-03-27 15:18:58 -0700 | [diff] [blame] | 96 | * UNAVAILABLE if the background scan is unavailable, |
| 97 | * ie. temporarily due to ongoing foreground |
Tomasz Wasilczyk | 803301a | 2017-03-13 14:30:15 -0700 | [diff] [blame] | 98 | * playback in single-tuner device. |
| 99 | * NOT_INITIALIZED other error, ie. HW failure. |
| 100 | */ |
| 101 | startBackgroundScan() generates (ProgramListResult result); |
Tomasz Wasilczyk | 2dd1d8d | 2017-03-01 14:21:07 -0800 | [diff] [blame] | 102 | |
| 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 Wasilczyk | 6ca90ed | 2017-05-15 12:57:20 -0700 | [diff] [blame] | 114 | * INVALID_ARGUMENTS if invalid arguments are passed |
Tomasz Wasilczyk | 2dd1d8d | 2017-03-01 14:21:07 -0800 | [diff] [blame] | 115 | * NOT_READY if the scan is in progress. |
Tomasz Wasilczyk | 803301a | 2017-03-13 14:30:15 -0700 | [diff] [blame] | 116 | * NOT_STARTED if the scan has not been started, client may |
| 117 | * call startBackgroundScan to fix this. |
Tomasz Wasilczyk | 2dd1d8d | 2017-03-01 14:21:07 -0800 | [diff] [blame] | 118 | * NOT_INITIALIZED if any other error occurs. |
| 119 | * @return programList List of stations available for user. |
| 120 | */ |
| 121 | getProgramList(string filter) |
Tomasz Wasilczyk | 803301a | 2017-03-13 14:30:15 -0700 | [diff] [blame] | 122 | generates (ProgramListResult result, vec<ProgramInfo> programList); |
Tomasz Wasilczyk | 2dd1d8d | 2017-03-01 14:21:07 -0800 | [diff] [blame] | 123 | |
Tomasz Wasilczyk | c700282 | 2017-03-27 14:29:16 -0700 | [diff] [blame] | 124 | /** |
Tomasz Wasilczyk | c700282 | 2017-03-27 14:29:16 -0700 | [diff] [blame] | 125 | * 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 Wasilczyk | b8a2afe | 2017-08-01 10:52:18 -0700 | [diff] [blame] | 140 | |
| 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 Wasilczyk | 213170b | 2017-02-07 17:38:21 -0800 | [diff] [blame] | 153 | }; |