1/*
2 * Copyright 2020 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.1;
18
19import @2.0::IBluetoothAudioProvider;
20import @2.0::IBluetoothAudioPort;
21import @2.0::Status;
22
23/**
24 * HAL interface from the Bluetooth stack to the Audio HAL
25 *
26 * The Bluetooth stack calls methods in this interface to start and end audio
27 * sessions and sends callback events to the Audio HAL.
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.
31 */
32interface IBluetoothAudioProvider extends @2.0::IBluetoothAudioProvider {
33
34    /**
35     * This method indicates that the Bluetooth stack is ready to stream audio.
36     * It registers an instance of IBluetoothAudioPort with and provides the
37     * current negotiated codec to the Audio HAL. After this method is called,
38     * the Audio HAL can invoke IBluetoothAudioPort.startStream().
39     *
40     * Note: endSession() must be called to unregister this IBluetoothAudioPort
41     *
42     * @param hostIf An instance of IBluetoothAudioPort for stream control
43     * @param audioConfig The audio configuration negotiated with the remote
44     *    device. The PCM parameters are set if software based encoding,
45     *    otherwise the correct codec configuration is used for hardware
46     *    encoding.
47     *
48     * @return status One of the following
49     *    SUCCESS if this IBluetoothAudioPort was successfully registered with
50     *        the Audio HAL
51     *    UNSUPPORTED_CODEC_CONFIGURATION if the Audio HAL cannot register this
52     *        IBluetoothAudioPort with the given codec configuration
53     *    FAILURE if the Audio HAL cannot register this IBluetoothAudioPort for
54     *        any other reason
55     * @return dataMQ The fast message queue for audio data from/to this
56     *    provider. Audio data will be in PCM format as specified by the
57     *    audioConfig.pcmConfig parameter. Invalid if streaming is offloaded
58     *    from/to hardware or on failure.
59     */
60    startSession_2_1(IBluetoothAudioPort hostIf, AudioConfiguration audioConfig)
61                generates (Status status, fmq_sync<uint8_t> dataMQ);
62};
63