1/* 2 * Copyright 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.audio@2.0; 18 19import IBluetoothAudioPort; 20 21/** 22 * HAL interface from the Bluetooth stack to the Audio HAL 23 * 24 * The Bluetooth stack calls methods in this interface to start and end audio 25 * sessions and sends callback events to the Audio HAL. 26 * 27 * Note: For HIDL APIs with a "generates" statement, the callback parameter used 28 * for return value must be invoked synchronously before the API call returns. 29 */ 30interface IBluetoothAudioProvider { 31 32 /** 33 * This method indicates that the Bluetooth stack is ready to stream audio. 34 * It registers an instance of IBluetoothAudioPort with and provides the 35 * current negotiated codec to the Audio HAL. After this method is called, 36 * the Audio HAL can invoke IBluetoothAudioPort.startStream(). 37 * 38 * Note: endSession() must be called to unregister this IBluetoothAudioPort 39 * 40 * @param hostIf An instance of IBluetoothAudioPort for stream control 41 * @param audioConfig The audio configuration negotiated with the remote 42 * device. The PCM parameters are set if software based encoding, 43 * otherwise the correct codec configuration is used for hardware 44 * encoding. 45 * 46 * @return status One of the following 47 * SUCCESS if this IBluetoothAudioPort was successfully registered with 48 * the Audio HAL 49 * UNSUPPORTED_CODEC_CONFIGURATION if the Audio HAL cannot register this 50 * IBluetoothAudioPort with the given codec configuration 51 * FAILURE if the Audio HAL cannot register this IBluetoothAudioPort for 52 * any other reason 53 * @return dataMQ The fast message queue for audio data from this provider. 54 * Audio data will be in PCM format as specified by the 55 * audioConfig.pcmConfig parameter. 56 * Invalid if streaming is offloaded to hardware or on failure. 57 */ 58 startSession(IBluetoothAudioPort hostIf, AudioConfiguration audioConfig) 59 generates (Status status, fmq_sync<uint8_t> dataMQ); 60 61 /** 62 * Callback for IBluetoothAudioPort.startStream() 63 * 64 * @param status SUCCESS or FAILURE 65 */ 66 streamStarted(Status status); 67 68 /** 69 * Callback for IBluetoothAudioPort.suspendStream() 70 * 71 * @param status SUCCESS or FAILURE 72 */ 73 streamSuspended(Status status); 74 75 /** 76 * Ends the current session and unregisters the IBluetoothAudioPort 77 * interface. 78 */ 79 endSession(); 80}; 81