platform_hardware_interfaces/bluetooth/audio/2.0/IBluetoothAudioPort.hal

86 lines
3.4 KiB
Text
Raw Normal View History

Bluetooth Audio HAL interface v2 Generalized Bluetooth Audio HAL interface. It is similar to the original android.hardware.bluetooth.a2dp@1.0 interface with the following modifications: * The session type can be one of the following: - A2DP Software Encoding Datapath - A2DP Hardware Encoding Datapath - Hearing Aid Software Encoding Datapath * For Hardware Offload Datapath (A2DP), the HAL interface is used only for the control path * For Software Encoding Datapath (A2DP or Hearing Aid), the HAL interface is used for both the control and data paths * Added Delay Report support: IBluetoothAudioHost.getPresentationPosition() that was missing in the original android.hardware.bluetooth.a2dp@1.0 HAL interface. * Removed "oneway" calls to avoid potential reordering of HAL calls: b/111244402 * Updated SBC-specific codec configuration * Added AAC-specific and LDAC-specific codec configuration * Reorganized the original CodecConfiguration into two sections: - PcmDataConfiguration: Audio PCM data configuration - EncodedDataConfiguration: Encoded audio data codec configuration. It is used only if the HAL is responsible for encoding the PCM audio data. * Added new HAL IBluetoothAudioProvidersFactory. It is used to open an audio provider for an audio session as specified by the session type and the codec configuration as negotiated with the remote device. Bug: 111519504 Test: manual Change-Id: I2ee4cf50b177baee077cf0b5143dbeadda57c8fb Merged-In: I2ee4cf50b177baee077cf0b5143dbeadda57c8fb (cherry picked from commit fcc0732db4af7586ee71310e5d4f6b9b0d94e6c4)
2018-10-12 02:39:09 +02:00
/*
* 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.
Bluetooth Audio HAL interface v2 Generalized Bluetooth Audio HAL interface. It is similar to the original android.hardware.bluetooth.a2dp@1.0 interface with the following modifications: * The session type can be one of the following: - A2DP Software Encoding Datapath - A2DP Hardware Encoding Datapath - Hearing Aid Software Encoding Datapath * For Hardware Offload Datapath (A2DP), the HAL interface is used only for the control path * For Software Encoding Datapath (A2DP or Hearing Aid), the HAL interface is used for both the control and data paths * Added Delay Report support: IBluetoothAudioHost.getPresentationPosition() that was missing in the original android.hardware.bluetooth.a2dp@1.0 HAL interface. * Removed "oneway" calls to avoid potential reordering of HAL calls: b/111244402 * Updated SBC-specific codec configuration * Added AAC-specific and LDAC-specific codec configuration * Reorganized the original CodecConfiguration into two sections: - PcmDataConfiguration: Audio PCM data configuration - EncodedDataConfiguration: Encoded audio data codec configuration. It is used only if the HAL is responsible for encoding the PCM audio data. * Added new HAL IBluetoothAudioProvidersFactory. It is used to open an audio provider for an audio session as specified by the session type and the codec configuration as negotiated with the remote device. Bug: 111519504 Test: manual Change-Id: I2ee4cf50b177baee077cf0b5143dbeadda57c8fb Merged-In: I2ee4cf50b177baee077cf0b5143dbeadda57c8fb (cherry picked from commit fcc0732db4af7586ee71310e5d4f6b9b0d94e6c4)
2018-10-12 02:39:09 +02:00
*/
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);
};