xref: /aosp_15_r20/hardware/interfaces/bluetooth/audio/2.1/IBluetoothAudioProvidersFactory.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright 2020 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 IBluetoothAudioProvider;
20*4d7e907cSAndroid Build Coastguard Workerimport @2.0::IBluetoothAudioProvidersFactory;
21*4d7e907cSAndroid Build Coastguard Workerimport @2.0::Status;
22*4d7e907cSAndroid Build Coastguard Worker
23*4d7e907cSAndroid Build Coastguard Worker/**
24*4d7e907cSAndroid Build Coastguard Worker * This factory allows a HAL implementation to be split into multiple
25*4d7e907cSAndroid Build Coastguard Worker * independent providers.
26*4d7e907cSAndroid Build Coastguard Worker *
27*4d7e907cSAndroid Build Coastguard Worker * When the Bluetooth stack is ready to create an audio session, it must first
28*4d7e907cSAndroid Build Coastguard Worker * obtain the IBluetoothAudioProvider for that session type by calling
29*4d7e907cSAndroid Build Coastguard Worker * openProvider().
30*4d7e907cSAndroid Build Coastguard Worker *
31*4d7e907cSAndroid Build Coastguard Worker * Note: For HIDL APIs with a "generates" statement, the callback parameter used
32*4d7e907cSAndroid Build Coastguard Worker * for return value must be invoked synchronously before the API call returns.
33*4d7e907cSAndroid Build Coastguard Worker */
34*4d7e907cSAndroid Build Coastguard Workerinterface IBluetoothAudioProvidersFactory extends @2.0::IBluetoothAudioProvidersFactory {
35*4d7e907cSAndroid Build Coastguard Worker
36*4d7e907cSAndroid Build Coastguard Worker    /**
37*4d7e907cSAndroid Build Coastguard Worker     * Opens an audio provider for a session type. To close the provider, it is
38*4d7e907cSAndroid Build Coastguard Worker     * necessary to release references to the returned provider object.
39*4d7e907cSAndroid Build Coastguard Worker     *
40*4d7e907cSAndroid Build Coastguard Worker     * @param sessionType The session type (e.g.
41*4d7e907cSAndroid Build Coastguard Worker     *    LE_AUDIO_SOFTWARE_ENCODING_DATAPATH).
42*4d7e907cSAndroid Build Coastguard Worker     *
43*4d7e907cSAndroid Build Coastguard Worker     * @return status One of the following
44*4d7e907cSAndroid Build Coastguard Worker     *    SUCCESS if the Audio HAL successfully opens the provider with the
45*4d7e907cSAndroid Build Coastguard Worker     *        given session type
46*4d7e907cSAndroid Build Coastguard Worker     *    FAILURE if the Audio HAL cannot open the provider
47*4d7e907cSAndroid Build Coastguard Worker     * @return provider The provider of the specified session type
48*4d7e907cSAndroid Build Coastguard Worker     */
49*4d7e907cSAndroid Build Coastguard Worker    openProvider_2_1(SessionType sessionType)
50*4d7e907cSAndroid Build Coastguard Worker        generates (Status status, IBluetoothAudioProvider provider);
51*4d7e907cSAndroid Build Coastguard Worker
52*4d7e907cSAndroid Build Coastguard Worker    /**
53*4d7e907cSAndroid Build Coastguard Worker     * Gets a list of audio capabilities for a session type.
54*4d7e907cSAndroid Build Coastguard Worker     *
55*4d7e907cSAndroid Build Coastguard Worker     * For software encoding, the PCM capabilities are returned.
56*4d7e907cSAndroid Build Coastguard Worker     * For hardware encoding, the supported codecs and their capabilities are
57*4d7e907cSAndroid Build Coastguard Worker     * returned.
58*4d7e907cSAndroid Build Coastguard Worker     *
59*4d7e907cSAndroid Build Coastguard Worker     * @param sessionType The session type (e.g.
60*4d7e907cSAndroid Build Coastguard Worker     *    A2DP_SOFTWARE_ENCODING_DATAPATH).
61*4d7e907cSAndroid Build Coastguard Worker     * @return audioCapabilities A list containing all the capabilities
62*4d7e907cSAndroid Build Coastguard Worker     *    supported by the sesson type. The capabilities is a list of
63*4d7e907cSAndroid Build Coastguard Worker     *    available options when configuring the codec for the session.
64*4d7e907cSAndroid Build Coastguard Worker     *    For software encoding it is the PCM data rate.
65*4d7e907cSAndroid Build Coastguard Worker     *    For hardware encoding it is the list of supported codecs and their
66*4d7e907cSAndroid Build Coastguard Worker     *    capabilities.
67*4d7e907cSAndroid Build Coastguard Worker     *    If a provider isn't supported, an empty list should be returned.
68*4d7e907cSAndroid Build Coastguard Worker     *    Note: Only one entry should exist per codec when using hardware
69*4d7e907cSAndroid Build Coastguard Worker     *    encoding.
70*4d7e907cSAndroid Build Coastguard Worker     */
71*4d7e907cSAndroid Build Coastguard Worker     getProviderCapabilities_2_1(SessionType sessionType)
72*4d7e907cSAndroid Build Coastguard Worker         generates (vec<AudioCapabilities> audioCapabilities);
73*4d7e907cSAndroid Build Coastguard Worker};
74