AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <PulseAudioBluetoothInitializer.h>
Public Types | |
enum | ModuleState { ModuleState::UNKNOWN, ModuleState::INITIALLY_LOADED, ModuleState::UNLOADED, ModuleState::LOADED_BY_SDK } |
The state of each module. More... | |
Public Member Functions | |
~PulseAudioBluetoothInitializer () | |
Public Member Functions inherited from alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventListenerInterface | |
virtual | ~BluetoothEventListenerInterface ()=default |
Static Public Member Functions | |
static std::shared_ptr< PulseAudioBluetoothInitializer > | create (std::shared_ptr< avsCommon::utils::bluetooth::BluetoothEventBus > eventBus) |
Protected Member Functions | |
BluetoothEventBusListenerInterface Functions | |
void | onEventFired (const avsCommon::utils::bluetooth::BluetoothEvent &event) override |
Applications can receive/send A2DP audio data from/to BlueZ by registering local endpoints. BlueZ only supports sending audio to a single endpoint, and will choose the one that was registered first with the supported capabilities (essentially, a FIFO queue).
By default, when PulseAudio starts, it registers two local endpoints for itself: one for A2DP Source and another for A2DP Sink. These will be prioritized by BlueZ and will be sent audio stream data when it is available. By the time the SDK creates its endpoints, they will be of a lower priority.
For A2DP Sink, the SDK needs to obtain the audio stream and control playback. This is so the SDK can correctly manage audio focus. For A2DP Source, we continue to let PulseAudio handle the audio routing via their own endpoint.
This class unregisters both PulseAudio endpoints so that the SDK's endpoint has priority for Sink, and then immediately re-registers them so that PulseAudio can handle the Source case with its own endpoint.
This is behavior is optional and can be enabled at compile time with the appropriate CMake flag (refer to Bluetooth.cmake).
alexaClientSDK::bluetoothImplementations::blueZ::PulseAudioBluetoothInitializer::~PulseAudioBluetoothInitializer | ( | ) |
Destructor.
|
static |
Constructor.
eventBus | The eventBus which we will receive events upon BluetoothDeviceManager initialization. |
|
overrideprotectedvirtual |
Method called to process an event of the specific type.
event | Event to be processed |
Implements alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventListenerInterface.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0