blob: 17d13b86636299798a8cc2fe6df4884955f9dc76 [file] [log] [blame]
Pavlin Radoslavov1ea96a32018-10-11 17:39:09 -07001/*
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 */
31interface IBluetoothAudioPort {
32 /**
33 * This indicates that the caller of this method has opened the data path
34 * and wants to start an audio stream. The caller must wait for a
35 * IBluetoothAudioProvider.streamStarted(Status) call.
36 */
37 startStream();
38
39 /**
40 * This indicates that the caller of this method wants to suspend the audio
41 * stream. The caller must wait for the Bluetooth process to call
42 * IBluetoothAudioProvider.streamSuspended(Status). The caller still keeps
43 * the data path open.
44 */
45 suspendStream();
46
47 /**
48 * This indicates that the caller of this method wants to stop the audio
49 * stream. The data path will be closed after this call. There is no
50 * callback from the IBluetoothAudioProvider interface even though the
51 * teardown is asynchronous.
52 */
53 stopStream();
54
55 /**
56 * Get the audio presentation position.
57 *
58 * @return status the command status
59 * @return remoteDeviceAudioDelayNanos the audio delay from when the remote
60 * device (e.g. headset) receives audio data to when the device plays the
61 * sound. If the delay is unknown, the value is set to zero.
62 * @return transmittedOctets the number of audio data octets that were sent
63 * to a remote device. This excludes octets that have been written to the
64 * data path but have not been sent to the remote device. The count is
65 * not reset until stopStream() is called. If the software data path is
66 * unused (e.g. A2DP Hardware Offload), the value is set to 0.
67 * @return transmittedOctetsTimeStamp the value of CLOCK_MONOTONIC
68 * corresponding to transmittedOctets. If the software data path is
69 * unused (e.g., for A2DP Hardware Offload), the value is set to zero.
70 */
71 getPresentationPosition() generates (Status status,
72 uint64_t remoteDeviceAudioDelayNanos, uint64_t transmittedOctets,
73 TimeSpec transmittedOctetsTimeStamp);
74
75 /**
76 * Called when the metadata of the stream's source has been changed.
77 *
78 * @param sourceMetadata Description of the audio that is played by the
79 * clients.
80 */
81 updateMetadata(SourceMetadata sourceMetadata);
82};