/* * Copyright 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.hardware.bluetooth.audio@2.0; import android.hardware.audio.common@5.0::SourceMetadata; /** * HAL interface from the Audio HAL to the Bluetooth stack * * The Audio HAL calls methods in this interface to start, suspend, and stop * an audio stream. These calls return immediately and the results, if any, * are sent over the IBluetoothAudioProvider interface. * * Moreover, the Audio HAL can also get the presentation position of the stream * and provide stream metadata. * * Note: For HIDL APIs with a "generates" statement, the callback parameter used * for return value must be invoked synchronously before the API call returns. */ interface IBluetoothAudioPort { /** * This indicates that the caller of this method has opened the data path * and wants to start an audio stream. The caller must wait for a * IBluetoothAudioProvider.streamStarted(Status) call. */ startStream(); /** * This indicates that the caller of this method wants to suspend the audio * stream. The caller must wait for the Bluetooth process to call * IBluetoothAudioProvider.streamSuspended(Status). The caller still keeps * the data path open. */ suspendStream(); /** * This indicates that the caller of this method wants to stop the audio * stream. The data path will be closed after this call. There is no * callback from the IBluetoothAudioProvider interface even though the * teardown is asynchronous. */ stopStream(); /** * Get the audio presentation position. * * @return status the command status * @return remoteDeviceAudioDelayNanos the audio delay from when the remote * device (e.g. headset) receives audio data to when the device plays the * sound. If the delay is unknown, the value is set to zero. * @return transmittedOctets the number of audio data octets that were sent * to a remote device. This excludes octets that have been written to the * data path but have not been sent to the remote device. The count is * not reset until stopStream() is called. If the software data path is * unused (e.g. A2DP Hardware Offload), the value is set to 0. * @return transmittedOctetsTimeStamp the value of CLOCK_MONOTONIC * corresponding to transmittedOctets. If the software data path is * unused (e.g., for A2DP Hardware Offload), the value is set to zero. */ getPresentationPosition() generates (Status status, uint64_t remoteDeviceAudioDelayNanos, uint64_t transmittedOctets, TimeSpec transmittedOctetsTimeStamp); /** * Called when the metadata of the stream's source has been changed. * * @param sourceMetadata Description of the audio that is played by the * clients. */ updateMetadata(SourceMetadata sourceMetadata); };