AlexaClientSDK  1.26.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::BlueZBluetoothDevice Class Reference

A BlueZ implementation of the BluetoothDeviceInterface. More...

#include <BlueZBluetoothDevice.h>

Inheritance diagram for alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice:
Collaboration graph
[legend]

Public Types

enum  BlueZDeviceState {
  BlueZDeviceState::FOUND, BlueZDeviceState::UNPAIRED, BlueZDeviceState::PAIRED, BlueZDeviceState::IDLE,
  BlueZDeviceState::DISCONNECTED, BlueZDeviceState::CONNECTED, BlueZDeviceState::CONNECTION_FAILED
}
 

Public Member Functions

std::string getObjectPath () const
 
void onPropertyChanged (const GVariantMapReader &changesMap)
 
BluetoothDeviceInterface Functions
 ~BlueZBluetoothDevice () override
 
std::string getMac () const override
 
std::string getFriendlyName () const override
 
avsCommon::sdkInterfaces::bluetooth::DeviceState getDeviceState () override
 
MetaData getDeviceMetaData () override
 
bool isPaired () override
 
std::future< bool > pair () override
 
std::future< bool > unpair () override
 
bool isConnected () override
 
std::future< bool > connect () override
 
std::future< bool > disconnect () override
 
std::vector< std::shared_ptr< avsCommon::sdkInterfaces::bluetooth::services::SDPRecordInterface > > getSupportedServices () override
 
std::shared_ptr< avsCommon::sdkInterfaces::bluetooth::services::BluetoothServiceInterfacegetService (std::string uuid) override
 
avsCommon::utils::bluetooth::MediaStreamingState getStreamingState () override
 
bool toggleServiceConnection (bool enabled, std::shared_ptr< avsCommon::sdkInterfaces::bluetooth::services::BluetoothServiceInterface > service) override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface
virtual ~BluetoothDeviceInterface ()=default
 Destructor. More...
 
virtual bool toggleServiceConnection (bool enabled, std::shared_ptr< services::BluetoothServiceInterface > service)=0
 

Static Public Member Functions

static std::shared_ptr< BlueZBluetoothDevicecreate (const std::string &mac, const std::string &objectPath, std::shared_ptr< BlueZDeviceManager > deviceManager)
 

Detailed Description

A BlueZ implementation of the BluetoothDeviceInterface.

Member Enumeration Documentation

◆ BlueZDeviceState

Enumerator
FOUND 

A device has been discovered.

UNPAIRED 

[Transitional] The device has been unpaired.

PAIRED 

[Transitional] The device has successfully paired.

IDLE 

A paired device.

DISCONNECTED 

[Transitional] A device has successfully disconnected.

CONNECTED 

A device that has successfully connected.

CONNECTION_FAILED 

When we fail a connect call as a result of the device not being correctly authenticated. BlueZ will contiously attempt to connect, and toggle the connect property on and off. This represents that state.

Constructor & Destructor Documentation

◆ ~BlueZBluetoothDevice()

alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::~BlueZBluetoothDevice ( )
override

Member Function Documentation

◆ connect()

std::future< bool > alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::connect ( )
overridevirtual

Initiate a connect with this device.

Returns
Indicates whether connecting was successful.

Implements alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface.

◆ create()

std::shared_ptr< BlueZBluetoothDevice > alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::create ( const std::string &  mac,
const std::string &  objectPath,
std::shared_ptr< BlueZDeviceManager deviceManager 
)
static

Creates an instance of the BlueZBluetoothDevice.

Parameters
macThe MAC address.
objectPathThe DBus object path.
deviceManagerThe associated deviceManager.
Returns
A pointer to a BlueZBluetoothDevice if successful, else a nullptr.

◆ disconnect()

std::future< bool > alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::disconnect ( )
overridevirtual

Initiate a disconnect with this device.

Returns
Indicates whether disconnect was successful.

Implements alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface.

◆ getDeviceMetaData()

BlueZBluetoothDevice::MetaData alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::getDeviceMetaData ( )
overridevirtual

Getter for the Bluetooth device metadata.

Returns
the meta data of the Bluetooth device.

Implements alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface.

◆ getDeviceState()

DeviceState alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::getDeviceState ( )
overridevirtual

Getter for the DeviceState.

Returns
The DeviceState of the current device.

Implements alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface.

◆ getFriendlyName()

std::string alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::getFriendlyName ( ) const
overridevirtual

Getter for the friendly name.

Returns
The friendly name of the Bluetooth Device.

Implements alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface.

◆ getMac()

std::string alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::getMac ( ) const
overridevirtual

Getter for the MAC address.

Returns
The MAC address of the Bluetooth Device.

Implements alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface.

◆ getObjectPath()

std::string alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::getObjectPath ( ) const

Gets the DBus object path of the device.

Returns
The DBus objectpath of the device.

◆ getService()

std::shared_ptr< avsCommon::sdkInterfaces::bluetooth::services::BluetoothServiceInterface > alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::getService ( std::string  uuid)
overridevirtual

Get the Bluetooth service that this device supports.

Parameters
uuidthe uuid of the Bluetooth Service.
Returns
A pointer to an instance of the BluetoothServiceInterface if supported, else a nullptr.

Implements alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface.

◆ getStreamingState()

MediaStreamingState alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::getStreamingState ( )
overridevirtual
Returns
The current media streaming state of the BluetoothDevice if the device supports A2DP streaming.

Implements alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface.

◆ getSupportedServices()

std::vector< std::shared_ptr< SDPRecordInterface > > alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::getSupportedServices ( )
overridevirtual
Returns
The Bluetooth Services that this device supports.

Implements alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface.

◆ isConnected()

bool alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::isConnected ( )
overridevirtual

Getter for the paired state of the device. This should return the state after any pending state changes have been resolved.

Returns
A bool representing whether the device is connected.

Implements alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface.

◆ isPaired()

bool alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::isPaired ( )
overridevirtual

Getter for the paired state of the device. This should return the state after any pending state changes have been resolved.

Returns
A bool representing whether the device is paired.

Implements alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface.

◆ onPropertyChanged()

void alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::onPropertyChanged ( const GVariantMapReader changesMap)

A function for BlueZDeviceManager to alert the BlueZ device when its property has changed. This is to avoid having multiple objects subscribing to DBus events.

Parameters
changesMapA map containing the property changes of the device.

◆ pair()

std::future< bool > alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::pair ( )
overridevirtual

Initiate a pair with this device.

Returns
Indicates whether pairing was successful.

Implements alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface.

◆ toggleServiceConnection()

bool alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::toggleServiceConnection ( bool  enabled,
std::shared_ptr< avsCommon::sdkInterfaces::bluetooth::services::BluetoothServiceInterface service 
)
override

◆ unpair()

std::future< bool > alexaClientSDK::bluetoothImplementations::blueZ::BlueZBluetoothDevice::unpair ( )
overridevirtual

Initiate an unpair with this device.

Returns
Indicates whether the unpairing was successful.

Implements alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface.


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

AlexaClientSDK 1.26.0 - Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0