AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Protected Attributes | List of all members
alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice Class Reference

#include <MockBluetoothDevice.h>

Inheritance diagram for alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice:
Collaboration graph
[legend]

Public Member Functions

std::string getMac () const override
 
std::string getFriendlyName () const override
 
DeviceState getDeviceState () override
 
MockBluetoothDevice::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
 
bool setPairingPin (const std::string &pin) override
 
std::vector< std::shared_ptr< services::SDPRecordInterface > > getSupportedServices () override
 
std::shared_ptr< services::BluetoothServiceInterfacegetService (std::string uuid) override
 
utils::bluetooth::MediaStreamingState getStreamingState () override
 
bool toggleServiceConnection (bool enabled, std::shared_ptr< services::BluetoothServiceInterface > service) override
 
 MockBluetoothDevice (const std::string &mac, const std::string friendlyName, MetaData metaData, std::vector< std::shared_ptr< services::BluetoothServiceInterface >> supportedServices)
 Constructor. More...
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface
virtual ~BluetoothDeviceInterface ()=default
 Destructor. More...
 

Protected Attributes

bool m_isPaired
 Represent the pair status. More...
 
bool m_isConnected
 Represent the connection status. More...
 
const std::string m_mac
 Represent the Bluetooth device mac address. More...
 
const std::string m_friendlyName
 Represent the Bluetooth device friendly name. More...
 
MockBluetoothDevice::MetaData m_metaData
 Represent the Bluetooth device meta data. More...
 
std::unordered_map< std::string, std::shared_ptr< services::BluetoothServiceInterface > > m_supportedServices
 Represent the Bluetooth device supported Services. More...
 
DeviceState m_deviceState
 Represent the Bluetooth device state. More...
 

Detailed Description

Mock class that implements BluetoothDeviceInterface. Please note that MockBluetoothDevice doesn't support sending any BluetoothEvent to BluetoothEventBus, any BluetoothEvent based logic will need to be tested separately.

Constructor & Destructor Documentation

◆ MockBluetoothDevice()

alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::MockBluetoothDevice ( const std::string &  mac,
const std::string  friendlyName,
MetaData  metaData,
std::vector< std::shared_ptr< services::BluetoothServiceInterface >>  supportedServices 
)

Constructor.

Member Function Documentation

◆ connect()

std::future< bool > alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::connect ( )
inlineoverridevirtual

Initiate a connect with this device.

Returns
Indicates whether connecting was successful.

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

◆ disconnect()

std::future< bool > alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::disconnect ( )
inlineoverridevirtual

Initiate a disconnect with this device.

Returns
Indicates whether disconnect was successful.

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

◆ getDeviceMetaData()

MockBluetoothDevice::MetaData alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::getDeviceMetaData ( )
inlineoverridevirtual

Getter for the Bluetooth device metadata.

Returns
the meta data of the Bluetooth device.

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

◆ getDeviceState()

DeviceState alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::getDeviceState ( )
inlineoverridevirtual

Getter for the DeviceState.

Returns
The DeviceState of the current device.

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

◆ getFriendlyName()

std::string alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::getFriendlyName ( ) const
inlineoverridevirtual

Getter for the friendly name.

Returns
The friendly name of the Bluetooth Device.

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

◆ getMac()

std::string alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::getMac ( ) const
inlineoverridevirtual

Getter for the MAC address.

Returns
The MAC address of the Bluetooth Device.

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

◆ getService()

std::shared_ptr< services::BluetoothServiceInterface > alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::getService ( std::string  uuid)
inlineoverridevirtual

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

utils::bluetooth::MediaStreamingState alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::getStreamingState ( )
inlineoverridevirtual
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< services::SDPRecordInterface > > alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::getSupportedServices ( )
inlineoverridevirtual
Returns
The Bluetooth Services that this device supports.

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

◆ isConnected()

bool alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::isConnected ( )
inlineoverridevirtual

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::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::isPaired ( )
inlineoverridevirtual

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.

◆ pair()

std::future< bool > alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::pair ( )
inlineoverridevirtual

Initiate a pair with this device.

Returns
Indicates whether pairing was successful.

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

◆ setPairingPin()

bool alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::setPairingPin ( const std::string &  pin)
inlineoverridevirtual

Sets the pairing pin for the current pairing attempt. PIN length can range from 4 to 16 alphanumeric characters, though most devices will only accept numeric characters in the PIN. Expected call flow is: pair() -> PIN request callback -> setPairingPin()

Parameters
pinBT pairing pin
Returns
Indicates whether pairing pin was set.

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

◆ toggleServiceConnection()

bool alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::toggleServiceConnection ( bool  enabled,
std::shared_ptr< services::BluetoothServiceInterface service 
)
inlineoverridevirtual

Toggle the profile of a device, which restricts the future connection/disconnection.

Parameters
enabledTrue if need to connect the certain profile, false to disconnect.
serviceThe target profile to toggle.
Returns
A bool indicating success.

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

◆ unpair()

std::future< bool > alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::unpair ( )
inlineoverridevirtual

Initiate an unpair with this device.

Returns
Indicates whether the unpairing was successful.

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

Member Data Documentation

◆ m_deviceState

DeviceState alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::m_deviceState
protected

Represent the Bluetooth device state.

◆ m_friendlyName

const std::string alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::m_friendlyName
protected

Represent the Bluetooth device friendly name.

◆ m_isConnected

bool alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::m_isConnected
protected

Represent the connection status.

◆ m_isPaired

bool alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::m_isPaired
protected

Represent the pair status.

◆ m_mac

const std::string alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::m_mac
protected

Represent the Bluetooth device mac address.

◆ m_metaData

MockBluetoothDevice::MetaData alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::m_metaData
protected

Represent the Bluetooth device meta data.

◆ m_supportedServices

std::unordered_map<std::string, std::shared_ptr<services::BluetoothServiceInterface> > alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::test::MockBluetoothDevice::m_supportedServices
protected

Represent the Bluetooth device supported Services.


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

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