• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 android.hardware.audio.common@5.0::SourceMetadata;
20
21/**
22 * HAL interface from the Audio HAL to the Bluetooth stack
23 *
24 * The Audio HAL calls methods in this interface to start, suspend, and stop
25 * an audio stream. These calls return immediately and the results, if any,
26 * are sent over the IBluetoothAudioProvider interface.
27 *
28 * Moreover, the Audio HAL can also get the presentation position of the stream
29 * and provide stream metadata.
30 *
31 * Note: For HIDL APIs with a "generates" statement, the callback parameter used
32 * for return value must be invoked synchronously before the API call returns.
33 */
34interface IBluetoothAudioPort {
35    /**
36     * This indicates that the caller of this method has opened the data path
37     * and wants to start an audio stream. The caller must wait for a
38     * IBluetoothAudioProvider.streamStarted(Status) call.
39     */
40    startStream();
41
42    /**
43     * This indicates that the caller of this method wants to suspend the audio
44     * stream. The caller must wait for the Bluetooth process to call
45     * IBluetoothAudioProvider.streamSuspended(Status). The caller still keeps
46     * the data path open.
47     */
48    suspendStream();
49
50    /**
51     * This indicates that the caller of this method wants to stop the audio
52     * stream. The data path will be closed after this call. There is no
53     * callback from the IBluetoothAudioProvider interface even though the
54     * teardown is asynchronous.
55     */
56    stopStream();
57
58    /**
59     * Get the audio presentation position.
60     *
61     * @return status the command status
62     * @return remoteDeviceAudioDelayNanos the audio delay from when the remote
63     *    device (e.g. headset) receives audio data to when the device plays the
64     *    sound. If the delay is unknown, the value is set to zero.
65     * @return transmittedOctets the number of audio data octets that were sent
66     *    to a remote device. This excludes octets that have been written to the
67     *    data path but have not been sent to the remote device. The count is
68     *    not reset until stopStream() is called. If the software data path is
69     *    unused (e.g. A2DP Hardware Offload), the value is set to 0.
70     * @return transmittedOctetsTimeStamp the value of CLOCK_MONOTONIC
71     *    corresponding to transmittedOctets. If the software data path is
72     *    unused (e.g., for A2DP Hardware Offload), the value is set to zero.
73     */
74    getPresentationPosition() generates (Status status,
75        uint64_t remoteDeviceAudioDelayNanos, uint64_t transmittedOctets,
76        TimeSpec transmittedOctetsTimeStamp);
77
78    /**
79     * Called when the metadata of the stream's source has been changed.
80     *
81     * @param sourceMetadata Description of the audio that is played by the
82     *    clients.
83     */
84    updateMetadata(SourceMetadata sourceMetadata);
85};
86