1*4d7e907cSAndroid Build Coastguard Worker/* 2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2017 The Android Open Source Project 3*4d7e907cSAndroid Build Coastguard Worker * 4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*4d7e907cSAndroid Build Coastguard Worker * 8*4d7e907cSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*4d7e907cSAndroid Build Coastguard Worker * 10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License. 15*4d7e907cSAndroid Build Coastguard Worker */ 16*4d7e907cSAndroid Build Coastguard Worker 17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected]; 18*4d7e907cSAndroid Build Coastguard Worker 19*4d7e907cSAndroid Build Coastguard Workerimport @1.0::ITuner; 20*4d7e907cSAndroid Build Coastguard Worker 21*4d7e907cSAndroid Build Coastguard Workerinterface ITuner extends @1.0::ITuner { 22*4d7e907cSAndroid Build Coastguard Worker 23*4d7e907cSAndroid Build Coastguard Worker /** 24*4d7e907cSAndroid Build Coastguard Worker * Tune to a specified program. 25*4d7e907cSAndroid Build Coastguard Worker * 26*4d7e907cSAndroid Build Coastguard Worker * For AM/FM, it must be called when a valid configuration has been applied. 27*4d7e907cSAndroid Build Coastguard Worker * Automatically cancels pending scan, step or tune. 28*4d7e907cSAndroid Build Coastguard Worker * 29*4d7e907cSAndroid Build Coastguard Worker * If method returns OK, ITunerCallback.tuneComplete_1_1() MUST be called: 30*4d7e907cSAndroid Build Coastguard Worker * - once successfully tuned; 31*4d7e907cSAndroid Build Coastguard Worker * - after a time out; 32*4d7e907cSAndroid Build Coastguard Worker * - after a full band scan, if no station found. 33*4d7e907cSAndroid Build Coastguard Worker * 34*4d7e907cSAndroid Build Coastguard Worker * The tuned field of ProgramInfo should indicate if tuned to a valid 35*4d7e907cSAndroid Build Coastguard Worker * station or not. 36*4d7e907cSAndroid Build Coastguard Worker * 37*4d7e907cSAndroid Build Coastguard Worker * @param program Program to tune to. 38*4d7e907cSAndroid Build Coastguard Worker * @return result OK if successfully started tunning. 39*4d7e907cSAndroid Build Coastguard Worker * INVALID_ARGUMENTS if invalid arguments are passed. 40*4d7e907cSAndroid Build Coastguard Worker * NOT_INITIALIZED if another error occurs. 41*4d7e907cSAndroid Build Coastguard Worker */ 42*4d7e907cSAndroid Build Coastguard Worker tuneByProgramSelector(ProgramSelector program) generates (Result result); 43*4d7e907cSAndroid Build Coastguard Worker 44*4d7e907cSAndroid Build Coastguard Worker /** 45*4d7e907cSAndroid Build Coastguard Worker * Cancels announcement. 46*4d7e907cSAndroid Build Coastguard Worker * 47*4d7e907cSAndroid Build Coastguard Worker * If it was traffic announcement, trafficAnnouncement(false) callback 48*4d7e907cSAndroid Build Coastguard Worker * should be called (just like it was ended in a normal way). Similarly for 49*4d7e907cSAndroid Build Coastguard Worker * emergency announcement. If there was no announcement, then no action 50*4d7e907cSAndroid Build Coastguard Worker * should be taken. 51*4d7e907cSAndroid Build Coastguard Worker * 52*4d7e907cSAndroid Build Coastguard Worker * There is a race condition between calling cancelAnnouncement and the 53*4d7e907cSAndroid Build Coastguard Worker * actual announcement being finished, so trafficAnnouncement / 54*4d7e907cSAndroid Build Coastguard Worker * emergencyAnnouncement callback should be tracked with proper locking. 55*4d7e907cSAndroid Build Coastguard Worker * 56*4d7e907cSAndroid Build Coastguard Worker * @return result OK if successfully cancelled announcement or there was 57*4d7e907cSAndroid Build Coastguard Worker * no announcement. 58*4d7e907cSAndroid Build Coastguard Worker * NOT_INITIALIZED if another error occurs. 59*4d7e907cSAndroid Build Coastguard Worker */ 60*4d7e907cSAndroid Build Coastguard Worker cancelAnnouncement() generates (Result result); 61*4d7e907cSAndroid Build Coastguard Worker 62*4d7e907cSAndroid Build Coastguard Worker /** 63*4d7e907cSAndroid Build Coastguard Worker * Retrieve current station information. 64*4d7e907cSAndroid Build Coastguard Worker * @return result OK if scan successfully started 65*4d7e907cSAndroid Build Coastguard Worker * NOT_INITIALIZED if another error occurs 66*4d7e907cSAndroid Build Coastguard Worker * @return info Current program information. 67*4d7e907cSAndroid Build Coastguard Worker */ 68*4d7e907cSAndroid Build Coastguard Worker getProgramInformation_1_1() generates (Result result, ProgramInfo info); 69*4d7e907cSAndroid Build Coastguard Worker 70*4d7e907cSAndroid Build Coastguard Worker /** 71*4d7e907cSAndroid Build Coastguard Worker * Initiates a background scan to update internally cached program list. 72*4d7e907cSAndroid Build Coastguard Worker * 73*4d7e907cSAndroid Build Coastguard Worker * HAL client may not need to initiate the scan explicitly with this call, 74*4d7e907cSAndroid Build Coastguard Worker * ie. HAL implementation MAY perform the scan on boot. It's a common 75*4d7e907cSAndroid Build Coastguard Worker * practice in devices with two physical tuners with background scanning. 76*4d7e907cSAndroid Build Coastguard Worker * 77*4d7e907cSAndroid Build Coastguard Worker * Device must call backgroundScanComplete if the result is OK, even if the 78*4d7e907cSAndroid Build Coastguard Worker * scan fails later (it must pass proper result through the callback). 79*4d7e907cSAndroid Build Coastguard Worker * Otherwise, backgroundScanComplete must not be called as a result of this 80*4d7e907cSAndroid Build Coastguard Worker * certain attempt. It may still be called as a response to another call to 81*4d7e907cSAndroid Build Coastguard Worker * startBackgroundScan, former or latter. 82*4d7e907cSAndroid Build Coastguard Worker * 83*4d7e907cSAndroid Build Coastguard Worker * Device may utilize an already running (but not finished) scan for 84*4d7e907cSAndroid Build Coastguard Worker * subsequent calls to startBackgroundScan, issuing a single 85*4d7e907cSAndroid Build Coastguard Worker * backgroundScanComplete callback. 86*4d7e907cSAndroid Build Coastguard Worker * 87*4d7e907cSAndroid Build Coastguard Worker * If a device supports continuous background scanning, it may succeed 88*4d7e907cSAndroid Build Coastguard Worker * (return OK and call backgroundScanComplete) without any additional 89*4d7e907cSAndroid Build Coastguard Worker * operation performed. 90*4d7e907cSAndroid Build Coastguard Worker * 91*4d7e907cSAndroid Build Coastguard Worker * Foreground scanning may be implemented in the front end app with 92*4d7e907cSAndroid Build Coastguard Worker * @1.0::ITuner scan operation. 93*4d7e907cSAndroid Build Coastguard Worker * 94*4d7e907cSAndroid Build Coastguard Worker * @return result OK if the scan was properly scheduled (this does not mean 95*4d7e907cSAndroid Build Coastguard Worker * it successfully finished). 96*4d7e907cSAndroid Build Coastguard Worker * UNAVAILABLE if the background scan is unavailable, 97*4d7e907cSAndroid Build Coastguard Worker * ie. temporarily due to ongoing foreground 98*4d7e907cSAndroid Build Coastguard Worker * playback in single-tuner device. 99*4d7e907cSAndroid Build Coastguard Worker * NOT_INITIALIZED other error, ie. HW failure. 100*4d7e907cSAndroid Build Coastguard Worker */ 101*4d7e907cSAndroid Build Coastguard Worker startBackgroundScan() generates (ProgramListResult result); 102*4d7e907cSAndroid Build Coastguard Worker 103*4d7e907cSAndroid Build Coastguard Worker /** 104*4d7e907cSAndroid Build Coastguard Worker * Retrieve station list. 105*4d7e907cSAndroid Build Coastguard Worker * 106*4d7e907cSAndroid Build Coastguard Worker * This call does not trigger actual scan, but operates on the list cached 107*4d7e907cSAndroid Build Coastguard Worker * internally at the driver level. 108*4d7e907cSAndroid Build Coastguard Worker * 109*4d7e907cSAndroid Build Coastguard Worker * @param vendorFilter vendor-specific filter for the stations to be retrieved. 110*4d7e907cSAndroid Build Coastguard Worker * An empty vector MUST result in full list for a given tuner. 111*4d7e907cSAndroid Build Coastguard Worker * @return result OK if the list was successfully retrieved. 112*4d7e907cSAndroid Build Coastguard Worker * INVALID_ARGUMENTS if invalid arguments are passed 113*4d7e907cSAndroid Build Coastguard Worker * NOT_READY if the scan is in progress. 114*4d7e907cSAndroid Build Coastguard Worker * NOT_STARTED if the scan has not been started, client may 115*4d7e907cSAndroid Build Coastguard Worker * call startBackgroundScan to fix this. 116*4d7e907cSAndroid Build Coastguard Worker * NOT_INITIALIZED if any other error occurs. 117*4d7e907cSAndroid Build Coastguard Worker * @return programList List of stations available for user. 118*4d7e907cSAndroid Build Coastguard Worker */ 119*4d7e907cSAndroid Build Coastguard Worker getProgramList(vec<VendorKeyValue> vendorFilter) 120*4d7e907cSAndroid Build Coastguard Worker generates (ProgramListResult result, vec<ProgramInfo> programList); 121*4d7e907cSAndroid Build Coastguard Worker 122*4d7e907cSAndroid Build Coastguard Worker /** 123*4d7e907cSAndroid Build Coastguard Worker * Forces the analog playback for the supporting radio technology. 124*4d7e907cSAndroid Build Coastguard Worker * 125*4d7e907cSAndroid Build Coastguard Worker * User may disable digital playback for FM HD Radio or hybrid FM/DAB with 126*4d7e907cSAndroid Build Coastguard Worker * this option. This is purely user choice, ie. does not reflect digital- 127*4d7e907cSAndroid Build Coastguard Worker * analog handover managed from the HAL implementation side. 128*4d7e907cSAndroid Build Coastguard Worker * 129*4d7e907cSAndroid Build Coastguard Worker * Some radio technologies may not support this, ie. DAB. 130*4d7e907cSAndroid Build Coastguard Worker * 131*4d7e907cSAndroid Build Coastguard Worker * @param isForced true to force analog, false for a default behaviour. 132*4d7e907cSAndroid Build Coastguard Worker * @return result OK if the setting was successfully done. 133*4d7e907cSAndroid Build Coastguard Worker * INVALID_STATE if the switch is not supported at current 134*4d7e907cSAndroid Build Coastguard Worker * configuration. 135*4d7e907cSAndroid Build Coastguard Worker * NOT_INITIALIZED if any other error occurs. 136*4d7e907cSAndroid Build Coastguard Worker */ 137*4d7e907cSAndroid Build Coastguard Worker setAnalogForced(bool isForced) generates (Result result); 138*4d7e907cSAndroid Build Coastguard Worker 139*4d7e907cSAndroid Build Coastguard Worker /** 140*4d7e907cSAndroid Build Coastguard Worker * Checks, if the analog playback is forced, see setAnalogForced. 141*4d7e907cSAndroid Build Coastguard Worker * 142*4d7e907cSAndroid Build Coastguard Worker * The isForced value is only valid if result was OK. 143*4d7e907cSAndroid Build Coastguard Worker * 144*4d7e907cSAndroid Build Coastguard Worker * @return result OK if the call succeeded and isForced is valid. 145*4d7e907cSAndroid Build Coastguard Worker * INVALID_STATE if the switch is not supported at current 146*4d7e907cSAndroid Build Coastguard Worker * configuration. 147*4d7e907cSAndroid Build Coastguard Worker * NOT_INITIALIZED if any other error occurs. 148*4d7e907cSAndroid Build Coastguard Worker * @return isForced true if analog is forced, false otherwise. 149*4d7e907cSAndroid Build Coastguard Worker */ 150*4d7e907cSAndroid Build Coastguard Worker isAnalogForced() generates (Result result, bool isForced); 151*4d7e907cSAndroid Build Coastguard Worker}; 152