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 IBluetoothAudioProvider; |
| 20 | |
| 21 | /** |
| 22 | * This factory allows a HAL implementation to be split into multiple |
| 23 | * independent providers. |
| 24 | * |
| 25 | * When the Bluetooth stack is ready to create an audio session, it must first |
| 26 | * obtain the IBluetoothAudioProvider for that session type by calling |
| 27 | * openProvider(). |
Ajay Panicker | 5f0e90e | 2019-01-21 22:36:32 -0800 | [diff] [blame^] | 28 | * |
| 29 | * Note: For HIDL APIs with a "generates" statement, the callback parameter used |
| 30 | * for return value must be invoked synchronously before the API call returns. |
Pavlin Radoslavov | 1ea96a3 | 2018-10-11 17:39:09 -0700 | [diff] [blame] | 31 | */ |
| 32 | interface IBluetoothAudioProvidersFactory { |
| 33 | |
| 34 | /** |
| 35 | * Opens an audio provider for a session type. To close the provider, it is |
| 36 | * necessary to release references to the returned provider object. |
| 37 | * |
| 38 | * @param sessionType The session type (e.g. |
| 39 | * A2DP_SOFTWARE_ENCODING_DATAPATH). |
| 40 | * |
| 41 | * @return status One of the following |
| 42 | * SUCCESS if the Audio HAL successfully opens the provider with the |
| 43 | * given session type |
| 44 | * FAILURE if the Audio HAL cannot open the provider |
| 45 | * @return provider The provider of the specified session type |
| 46 | */ |
| 47 | openProvider(SessionType sessionType) |
| 48 | generates (Status status, IBluetoothAudioProvider provider); |
Ajay Panicker | 5f0e90e | 2019-01-21 22:36:32 -0800 | [diff] [blame^] | 49 | |
| 50 | /** |
| 51 | * Gets a list of audio capabilities for a session type. |
| 52 | * |
| 53 | * For software encoding, the PCM capabilities are returned. |
| 54 | * For hardware encoding, the supported codecs and their capabilities are |
| 55 | * returned. |
| 56 | * |
| 57 | * @param sessionType The session type (e.g. |
| 58 | * A2DP_SOFTWARE_ENCODING_DATAPATH). |
| 59 | * @return audioCapabilities A list containing all the capabilities |
| 60 | * supported by the sesson type. The capabilities is a list of |
| 61 | * available options when configuring the codec for the session. |
| 62 | * For software encoding it is the PCM data rate. |
| 63 | * For hardware encoding it is the list of supported codecs and their |
| 64 | * capabilities. |
| 65 | * If a provider isn't supported, an empty list should be returned. |
| 66 | * Note: Only one entry should exist per codec when using hardware |
| 67 | * encoding. |
| 68 | */ |
| 69 | getProviderCapabilities(SessionType sessionType) |
| 70 | generates (vec<AudioCapabilities> audioCapabilities); |
Pavlin Radoslavov | 1ea96a3 | 2018-10-11 17:39:09 -0700 | [diff] [blame] | 71 | }; |