AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Types | Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::bluetoothImplementations::blueZ::PulseAudioBluetoothInitializer Class Reference

#include <PulseAudioBluetoothInitializer.h>

Inheritance diagram for alexaClientSDK::bluetoothImplementations::blueZ::PulseAudioBluetoothInitializer:
Inheritance graph
Collaboration diagram for alexaClientSDK::bluetoothImplementations::blueZ::PulseAudioBluetoothInitializer:
Collaboration graph

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< PulseAudioBluetoothInitializercreate (std::shared_ptr< avsCommon::utils::bluetooth::BluetoothEventBus > eventBus)

Protected Member Functions

BluetoothEventBusListenerInterface Functions
void onEventFired (const avsCommon::utils::bluetooth::BluetoothEvent &event) override

Detailed Description

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).

Member Enumeration Documentation

◆ ModuleState

The state of each module.


Before we have queried the state of the module.


The module was initially loaded.


The module is unloaded.


The module has been loaded by the SDK.

Constructor & Destructor Documentation

◆ ~PulseAudioBluetoothInitializer()

alexaClientSDK::bluetoothImplementations::blueZ::PulseAudioBluetoothInitializer::~PulseAudioBluetoothInitializer ( )


Member Function Documentation

◆ create()

static std::shared_ptr<PulseAudioBluetoothInitializer> alexaClientSDK::bluetoothImplementations::blueZ::PulseAudioBluetoothInitializer::create ( std::shared_ptr< avsCommon::utils::bluetooth::BluetoothEventBus eventBus)


eventBusThe eventBus which we will receive events upon BluetoothDeviceManager initialization.
An instance if successful, else a nullptr.

◆ onEventFired()

void alexaClientSDK::bluetoothImplementations::blueZ::PulseAudioBluetoothInitializer::onEventFired ( const avsCommon::utils::bluetooth::BluetoothEvent event)

Method called to process an event of the specific type.

eventEvent to be processed

Implements alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventListenerInterface.

The documentation for this class was generated from the following file:

AlexaClientSDK 3.0.0 - Copyright 2016-2022, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0