1/* 2 * Copyright (C) 2018 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.bluetooth.a2dp@1.0; 18 19import IBluetoothAudioHost; 20 21/** 22 * HAL interface for Bluetooth A2DP Offload functionality where 23 * the encoding of the A2DP data packets is offloaded to platform 24 * specific encoders. The A2DP control path is maintained in the 25 * Bluetooth stack. 26 * 27 * This interface is from HAL client to HAL server. 28 * 29 * The HAL client must provide the handle of IBluetoothAudioHost as well 30 * as codec configuration to the HAL server, when its connected to an 31 * active A2DP Sink device. HAL Server, based on the feedback from the Audio 32 * framework must call into the commands provided by the IBluetoothAudioHost. 33 * HAL client must call into IBluetoothAudioOffload to provide the status of 34 * these commands. Once the device becomes inactive, the HAL client must 35 * call the endSession to terminate the session with the HAL server. 36 */ 37interface IBluetoothAudioOffload { 38 39 /** 40 * Indicates that the HAL client is connected to an A2DP Sink device 41 * and is ready to stream audio. This function is also used to register 42 * the BluetoothAudioHost interface and the provide the current negotiated 43 * codec. 44 * 45 * |endSession| must be called to unregister the interface. 46 * 47 * @param hostIf interface used to request stream control 48 * @param codecConfig Codec configuration as negotiated with the A2DP Sink 49 * device 50 * @return status one of the following 51 * SUCCESS if HAL server successfully initializes the platform with the 52 * given codec configuration 53 * UNSUPPORTED_CODEC_CONFIGURATION if HAL server cannot initialize the 54 * platform with the given codec configuration 55 * FAILURE if HAL server cannot initialize the platform for any other 56 * reason 57 */ 58 startSession(IBluetoothAudioHost hostIf, CodecConfiguration codecConfig) generates (Status status); 59 60 /** 61 * Updates status for start stream request. The HAL client may need 62 * to communicate to Bluetooth Controller and remote Sink device, in which 63 * case it must update with PENDING status. Once the operation is 64 * completed, it must return with either SUCCESS or FAILURE. 65 * 66 * @param status SUCCESS, FAILURE or PENDING 67 */ 68 oneway streamStarted(Status status); 69 70 /** 71 * Updates status for suspend stream request. The HAL client may need 72 * to communicate to Bluetooth Controller and remote device, in which case 73 * it must update with PENDING status. Once the operation is completed, it 74 * must return with either SUCCESS or FAILURE. 75 * 76 * @param status SUCCESS, FAILURE or PENDING 77 */ 78 oneway streamSuspended(Status status); 79 80 /** 81 * Ends the current A2DP offload session and unregisters the 82 * BluetoothAudioHost interface. 83 */ 84 oneway endSession(); 85}; 86