Pavlin Radoslavov | 1ea96a3 | 2018-10-11 17:39:09 -0700 | [diff] [blame] | 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 | |
| 17 | package android.hardware.bluetooth.audio@2.0; |
| 18 | |
| 19 | import 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 | interface IBluetoothAudioProvider { |
| 28 | |
| 29 | /** |
| 30 | * This method indicates that the Bluetooth stack is ready to stream audio. |
| 31 | * It registers an instance of IBluetoothAudioPort with and provides the |
| 32 | * current negotiated codec to the Audio HAL. After this method is called, |
| 33 | * the Audio HAL can invoke IBluetoothAudioPort.startStream(). |
| 34 | * |
| 35 | * Note: endSession() must be called to unregister this IBluetoothAudioPort |
| 36 | * |
| 37 | * @param hostIf An instance of IBluetoothAudioPort for stream control |
| 38 | * @param codecConfig The codec configuration negotiated with the remote |
| 39 | * device |
| 40 | * |
| 41 | * @return status One of the following |
| 42 | * SUCCESS if this IBluetoothAudioPort was successfully registered with |
| 43 | * the Audio HAL |
| 44 | * UNSUPPORTED_CODEC_CONFIGURATION if the Audio HAL cannot register this |
| 45 | * IBluetoothAudioPort with the given codec configuration |
| 46 | * FAILURE if the Audio HAL cannot register this IBluetoothAudioPort for |
| 47 | * any other reason |
| 48 | * @return dataMQ The fast message queue for audio data from this provider. |
| 49 | * Audio data will be in PCM format as specified by the |
| 50 | * codecConfig.pcmDataConfiguration parameter. |
| 51 | * nullptr if streaming is offloaded to hardware or on failure. |
| 52 | */ |
| 53 | startSession(IBluetoothAudioPort hostIf, CodecConfiguration codecConfig) |
| 54 | generates (Status status, fmq_sync<uint8_t> dataMQ); |
| 55 | |
| 56 | /** |
| 57 | * Callback for IBluetoothAudioPort.startStream() |
| 58 | * |
| 59 | * @param status SUCCESS or FAILURE |
| 60 | */ |
| 61 | streamStarted(Status status); |
| 62 | |
| 63 | /** |
| 64 | * Callback for IBluetoothAudioPort.suspendStream() |
| 65 | * |
| 66 | * @param status SUCCESS or FAILURE |
| 67 | */ |
| 68 | streamSuspended(Status status); |
| 69 | |
| 70 | /** |
| 71 | * Ends the current session and unregisters the IBluetoothAudioPort |
| 72 | * interface. |
| 73 | */ |
| 74 | endSession(); |
| 75 | }; |