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

#include <Bluetooth.h>

Inheritance diagram for alexaClientSDK::acsdkBluetooth::Bluetooth:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acsdkBluetooth::Bluetooth:
Collaboration graph
[legend]

Public Types

enum  StreamingState {
  StreamingState::INACTIVE, StreamingState::PAUSED, StreamingState::PENDING_PAUSED, StreamingState::PENDING_ACTIVE,
  StreamingState::ACTIVE
}
 
enum  FocusTransitionState { FocusTransitionState::NONE, FocusTransitionState::INTERNAL, FocusTransitionState::PENDING_INTERNAL, FocusTransitionState::EXTERNAL }
 
enum  ScanningTransitionState { ScanningTransitionState::ACTIVE, ScanningTransitionState::PENDING_INACTIVE, ScanningTransitionState::INACTIVE }
 
using ObserverInterface = acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface
 
- Public Types inherited from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface
enum  TagType {
  TagType::STRING, TagType::UINT, TagType::INT, TagType::DOUBLE,
  TagType::BOOLEAN
}
 The different types of metadata "stream tags". More...
 
using SourceId = MediaPlayerInterface::SourceId
 A type that identifies which source is currently being operated on. More...
 
typedef std::vector< TagKeyValueTypeVectorOfTags
 

Public Member Functions

CapabilityAgent Functions
avsCommon::avs::DirectiveHandlerConfiguration getConfiguration () const override
 
void handleDirectiveImmediately (std::shared_ptr< avsCommon::avs::AVSDirective > directive) override
 
void preHandleDirective (std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
 
void handleDirective (std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
 
void cancelDirective (std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
 
void onFocusChanged (avsCommon::avs::FocusState newFocus, avsCommon::avs::MixingBehavior behavior) override
 
BluetoothLocalInterface Functions
void setDiscoverableMode (bool discoverable) override
 
void setScanMode (bool scanning) override
 
void pair (const std::string &addr) override
 
void unpair (const std::string &addr) override
 
void connect (const std::string &addr) override
 
void disconnect (const std::string &addr) override
 
void setPairingPin (const std::string &addr, const std::string &pin) override
 
CapabilityConfigurationInterface Functions
std::unordered_set< std::shared_ptr< avsCommon::avs::CapabilityConfiguration > > getCapabilityConfigurations () override
 
void onContextAvailable (const std::string &jsonContext) override
 
void onContextFailure (const avsCommon::sdkInterfaces::ContextRequestError error) override
 
void doShutdown () override
 
MediaPlayerObserverInterface Functions
void onFirstByteRead (avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackStarted (avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackStopped (avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackFinished (avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
void onPlaybackError (avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId id, const avsCommon::utils::mediaPlayer::ErrorType &type, std::string error, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
 
CustomerDataHandler Functions
void clearData () override
 
- Public Member Functions inherited from alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface
virtual ~BluetoothLocalInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
virtual ~CapabilityAgent ()=default
 
void preHandleDirective (std::shared_ptr< AVSDirective > directive, std::unique_ptr< sdkInterfaces::DirectiveHandlerResultInterface > result) override final
 
bool handleDirective (const std::string &messageId) override final
 
void cancelDirective (const std::string &messageId) override final
 
void onDeregistered () override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface
virtual ~DirectiveHandlerInterface ()=default
 
virtual void preHandleDirective (std::shared_ptr< avsCommon::avs::AVSDirective > directive, std::unique_ptr< DirectiveHandlerResultInterface > result)=0
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::ChannelObserverInterface
virtual ~ChannelObserverInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface
virtual ~StateProviderInterface ()=default
 
virtual void provideState (const avs::NamespaceAndName &stateProviderName, const ContextRequestToken stateRequestToken)
 
virtual void provideState (const avs::CapabilityTag &stateProviderName, const ContextRequestToken stateRequestToken)
 
virtual bool canStateBeRetrieved ()
 
virtual bool hasReportableStateProperties ()
 
virtual bool shouldQueryState ()
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface
virtual ~ContextRequesterInterface ()=default
 
virtual void onContextAvailable (const endpoints::EndpointIdentifier &endpointId, const avs::AVSContext &endpointContext, ContextRequestToken requestToken)
 
virtual void onContextFailure (const ContextRequestError error, ContextRequestToken token)
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventListenerInterface
virtual ~BluetoothEventListenerInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::bluetooth::FormattedAudioStreamAdapterListener
virtual ~FormattedAudioStreamAdapterListener ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::CapabilityConfigurationInterface
virtual ~CapabilityConfigurationInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface
virtual ~MediaPlayerObserverInterface ()=default
 
virtual void onFirstByteRead (SourceId id, const MediaPlayerState &state)=0
 
virtual void onPlaybackStarted (SourceId id, const MediaPlayerState &state)=0
 
virtual void onPlaybackFinished (SourceId id, const MediaPlayerState &state)=0
 
virtual void onPlaybackError (SourceId id, const ErrorType &type, std::string error, const MediaPlayerState &state)=0
 
virtual void onPlaybackPaused (SourceId, const MediaPlayerState &)
 
virtual void onPlaybackResumed (SourceId, const MediaPlayerState &)
 
virtual void onPlaybackStopped (SourceId, const MediaPlayerState &)
 
virtual void onBufferUnderrun (SourceId, const MediaPlayerState &)
 
virtual void onBufferRefilled (SourceId, const MediaPlayerState &)
 
virtual void onBufferingComplete (SourceId, const MediaPlayerState &)
 
virtual void onSeeked (SourceId, const MediaPlayerState &, const MediaPlayerState &)
 
virtual void onTags (SourceId, std::unique_ptr< const VectorOfTags >, const MediaPlayerState &)
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::RequiresShutdown
 RequiresShutdown (const std::string &name)
 
virtual ~RequiresShutdown ()
 Destructor. More...
 
const std::string & name () const
 
void shutdown ()
 
bool isShutdown () const
 
- Public Member Functions inherited from alexaClientSDK::registrationManager::CustomerDataHandler
 CustomerDataHandler (const std::shared_ptr< registrationManager::CustomerDataManagerInterface > &dataManager)
 
virtual ~CustomerDataHandler ()
 
- Public Member Functions inherited from alexaClientSDK::registrationManager::CustomerDataHandlerInterface
virtual ~CustomerDataHandlerInterface ()=default
 

Static Public Member Functions

static std::shared_ptr< BluetoothcreateBluetoothCapabilityAgent (std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender, std::shared_ptr< acsdkBluetoothInterfaces::BluetoothStorageInterface > bluetoothStorage, std::shared_ptr< avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceManagerInterface > deviceManager, std::shared_ptr< avsCommon::utils::bluetooth::BluetoothEventBus > eventBus, std::shared_ptr< registrationManager::CustomerDataManagerInterface > customerDataManager, std::shared_ptr< acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface > audioPipelineFactory, acsdkManufactory::Annotated< avsCommon::sdkInterfaces::AudioFocusAnnotation, avsCommon::sdkInterfaces::FocusManagerInterface > audioFocusManager, std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > shutdownNotifier, acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface > endpointCapabilitiesRegistrar, std::shared_ptr< acsdkBluetoothInterfaces::BluetoothDeviceConnectionRulesProviderInterface > connectionRulesProvider, std::shared_ptr< BluetoothMediaInputTransformer > mediaInputTransformer, std::shared_ptr< acsdkBluetoothInterfaces::BluetoothNotifierInterface > bluetoothNotifier)
 

Protected Member Functions

BluetoothEventBusListenerInterface Functions
void onEventFired (const avsCommon::utils::bluetooth::BluetoothEvent &event) override
 
- Protected Member Functions inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
 CapabilityAgent (const std::string &nameSpace, std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender)
 
virtual std::shared_ptr< DirectiveInfocreateDirectiveInfo (std::shared_ptr< AVSDirective > directive, std::unique_ptr< sdkInterfaces::DirectiveHandlerResultInterface > result)
 
virtual void preHandleDirective (std::shared_ptr< DirectiveInfo > info)=0
 
virtual void handleDirective (std::shared_ptr< DirectiveInfo > info)=0
 
virtual void cancelDirective (std::shared_ptr< DirectiveInfo > info)=0
 
void removeDirective (const std::string &messageId)
 
void sendExceptionEncounteredAndReportFailed (std::shared_ptr< DirectiveInfo > info, const std::string &message, avsCommon::avs::ExceptionErrorType type=avsCommon::avs::ExceptionErrorType::INTERNAL_ERROR)
 
const std::pair< std::string, std::string > buildJsonEventString (const std::string &eventName, const std::string &dialogRequestIdString="", const std::string &payload="{}", const std::string &context="") const
 

Additional Inherited Members

- Protected Attributes inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
const std::string m_namespace
 The namespace of the capability agent. More...
 
std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterfacem_exceptionEncounteredSender
 Object to use to send exceptionEncountered messages. More...
 

Detailed Description

The Bluetooth Capability Agent is responsible for implementing the Bluetooth AVS interface. This consists of two areas of responsibilities:

  1. The connectivity of devices. This includes scanning, pairing and connecting.
  2. The management of profiles. This includes: media control (AVRCP, Audio/Video Remote Control Profile) media playback (A2DP, Advanced Audio Distribution Profile) Human Interface Device Profile Serial Port Profile and Hands-Free Profile.

The Bluetooth agent will handle directives from AVS and requests from peer devices. Examples include pairing and connection requests, as well as media playback requests. Some examples of this are:

Connectivity is defined as when two devices have paired and established connections of all applicable services (A2DP, AVRCP, etc). Alexa supports multiple connected multimedia devices but doesn't support multiple A2DP connected devices. The agent enforces the connected devices to follow some Bluetooth device connection rules based on DeviceCategory. For example, If a A2DP device is currently connected, attempting to connect a second A2DP device should force a disconnect on the currently connected device. However, if a A2DP device is currently connected, attempting to connected a SPP/HID device should not cause a disconnect on the currently connected device.

Interfaces in AVSCommon/SDKInterfaces/Bluetooth can be implemented for customers who wish to use their own Bluetooth stack. The Bluetooth agent operates based on events. Please refer to the BluetoothEvents.h file for a list of events that must be sent.

Supported Profiles

Profiles listed under here refer to the Capability Agent's support of these profiles in relation to AVS. This does not speak about support for them at other layers (the stack, client applications, etc).

  1. AVRCP (Controller, Target)
  2. A2DP (Sink, Source)
  3. HFP
  4. HID
  5. SPP

Member Typedef Documentation

◆ ObserverInterface

Member Enumeration Documentation

◆ FocusTransitionState

An enum that represents how the Bluetooth class expects to lose focus.

Enumerator
NONE 

No focus transition in progress,.

INTERNAL 

Focus in Bluetooth class is lost because it explicitly released focus.

PENDING_INTERNAL 

Focus in Bluetooth class that will be lost because it explicitly released focus. This state prevents foreground or background focus changes from setting the state to EXTERNAL before the none focus change has had the chance to set the state to INTERNAL.

EXTERNAL 

Focus in Bluetooth class is lost because another class has taken focus.

◆ ScanningTransitionState

An enum that is used to represent the Bluetooth scanning state and if a state change should result in a scan report being sent to the Alexa service.

Enumerator
ACTIVE 

The device is currently scanning.

Any state change should result in sending a scan report.

This state is set when a SCAN_DEVICES directive is sent from the Alexa service.

PENDING_INACTIVE 

The device is not scanning.

A state change to inactive should not result in sending a scan report.

This state is set when a EXIT_DISCOVERABLE_MODE directive is sent or scan mode is disabled as part of the PAIR_DEVICES directive.

INACTIVE 

The device is not scanning.

A state change to inactive should not result in sending a scan report.

This state is set when a state change to inactive is recieved and the previous state was PENDING_INACTIVE.

◆ StreamingState

An enum representing the streaming states.

Enumerator
INACTIVE 

Initial state or after a disconnect.

PAUSED 

Media playback is no longer occurring.

PENDING_PAUSED 

AVRCP Pause is sent, waiting for local playback to stop.

PENDING_ACTIVE 

AVRCP Play is sent, waiting for local playback to start.

ACTIVE 

Media playback is currently ongoing.

Member Function Documentation

◆ cancelDirective()

void alexaClientSDK::acsdkBluetooth::Bluetooth::cancelDirective ( std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo info)
override

◆ clearData()

void alexaClientSDK::acsdkBluetooth::Bluetooth::clearData ( )
overridevirtual

Reset any internal state that may be associated with a particular user.

Warning
Object must succeed in deleting any customer data.
This method is called while CustomerDataManager is in a locked state. Do not call or wait for any CustomerDataManager operation.

Implements alexaClientSDK::registrationManager::CustomerDataHandlerInterface.

◆ connect()

void alexaClientSDK::acsdkBluetooth::Bluetooth::connect ( const std::string &  addr)
overridevirtual

Connect with the device matching the given MAC address.

Refer to an endpoint's corresponding connection rule to determine which device(s) to disconnect.

Parameters
macThe MAC address associated with the device.

Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.

◆ createBluetoothCapabilityAgent()

static std::shared_ptr<Bluetooth> alexaClientSDK::acsdkBluetooth::Bluetooth::createBluetoothCapabilityAgent ( std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface contextManager,
std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface messageSender,
std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface exceptionEncounteredSender,
std::shared_ptr< acsdkBluetoothInterfaces::BluetoothStorageInterface bluetoothStorage,
std::shared_ptr< avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceManagerInterface deviceManager,
std::shared_ptr< avsCommon::utils::bluetooth::BluetoothEventBus eventBus,
std::shared_ptr< registrationManager::CustomerDataManagerInterface customerDataManager,
std::shared_ptr< acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface audioPipelineFactory,
acsdkManufactory::Annotated< avsCommon::sdkInterfaces::AudioFocusAnnotation, avsCommon::sdkInterfaces::FocusManagerInterface audioFocusManager,
std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface shutdownNotifier,
acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface endpointCapabilitiesRegistrar,
std::shared_ptr< acsdkBluetoothInterfaces::BluetoothDeviceConnectionRulesProviderInterface connectionRulesProvider,
std::shared_ptr< BluetoothMediaInputTransformer mediaInputTransformer,
std::shared_ptr< acsdkBluetoothInterfaces::BluetoothNotifierInterface bluetoothNotifier 
)
static

Creates an instance of the Bluetooth.

Parameters
contextManagerResponsible for managing the context.
messageSenderResponsible for sending events to AVS.
exceptionEncounteredSenderResponsible for sending exceptions to AVS.
bluetoothStorageThe storage component for the Bluetooth CA.
deviceManagerResponsible for management of Bluetooth devices.
eventBusA bus to abstract Bluetooth stack specific messages.
customerDataManagerObject that will track the CustomerDataHandler.
audioPipelineFactoryObject to create a Bluetooth media player and related interfaces.
audioFocusManagerResponsible for managing the focus.
shutdownNotifierObject that will notify this CA when it is time to shut down.
endpointCapabilitiesRegistrarThe default endpoint registrar with which this CA will register its capabilities.
enabledConnectionRulesThe set of devices connection rules enabled by the Bluetooth stack from customers.
mediaInputTransformerTransforms incoming Media commands if supported.
bluetoothNotifierThe object with which to notify observers of Bluetooth device connections or disconnects.

◆ disconnect()

void alexaClientSDK::acsdkBluetooth::Bluetooth::disconnect ( const std::string &  addr)
overridevirtual

Disconnect from the device matching the given MAC address.

Parameters
macThe MAC address associated with the device.

Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.

◆ doShutdown()

void alexaClientSDK::acsdkBluetooth::Bluetooth::doShutdown ( )
overridevirtual

Prepares/enables this object to be deleted. This should be the last function called on this object prior to deleting (or resetting) its shared_ptr.

Warning
  • Attempting to call functions on this object after calling shutdown() can result in undefined behavior.
  • Neglecting to call shutdown() on this object can result in resource leaks or other undefined behavior.

Implements alexaClientSDK::avsCommon::utils::RequiresShutdown.

◆ getCapabilityConfigurations()

std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration> > alexaClientSDK::acsdkBluetooth::Bluetooth::getCapabilityConfigurations ( )
overridevirtual

Returns the configurations of the capability interfaces being implemented.

Returns
A set of CapabilityConfigurations

Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilityConfigurationInterface.

◆ getConfiguration()

avsCommon::avs::DirectiveHandlerConfiguration alexaClientSDK::acsdkBluetooth::Bluetooth::getConfiguration ( ) const
overridevirtual

Returns the configuration of the directive handler.

The configuration consists of multiple directive routing rules and their respective blocking policy. The directives will be matched from the most specific rule (with all fields defined) to the least specific rule (which only matches the directive endpointId).

Returns
The avs::DirectiveHandlerConfiguration of the handler.

Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.

◆ handleDirective()

void alexaClientSDK::acsdkBluetooth::Bluetooth::handleDirective ( std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo info)
override

◆ handleDirectiveImmediately()

void alexaClientSDK::acsdkBluetooth::Bluetooth::handleDirectiveImmediately ( std::shared_ptr< avsCommon::avs::AVSDirective directive)
overridevirtual

Handle the action specified AVSDirective. Once this has been called the DirectiveHandler should not expect to receive further calls regarding this directive.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
If this operation fails, an ExceptionEncountered message should be sent to AVS.
Parameters
directiveThe directive to handle.

Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.

◆ onContextAvailable()

void alexaClientSDK::acsdkBluetooth::Bluetooth::onContextAvailable ( const std::string &  jsonContext)
overridevirtual

This is called by the ContextManager once the context is ready and available.

Deprecated:
This method is being deprecated since it cannot specify the source endpoint.
Note
The ContextRequester should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders.
Parameters
jsonContextContext information.Context provided is of the format {"context"[{...}, {...}]}

Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.

◆ onContextFailure()

void alexaClientSDK::acsdkBluetooth::Bluetooth::onContextFailure ( const avsCommon::sdkInterfaces::ContextRequestError  error)
overridevirtual

The contextManager calls this if it is unable to process a getContext request successfully.

Deprecated:
This method is being deprecated since it cannot specify the optional token.
Note
The ContextRequester should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders.
Parameters
errorThe reason why the getContext request failed.

Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.

◆ onEventFired()

void alexaClientSDK::acsdkBluetooth::Bluetooth::onEventFired ( const avsCommon::utils::bluetooth::BluetoothEvent event)
overrideprotectedvirtual

Method called to process an event of the specific type.

Parameters
eventEvent to be processed

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

◆ onFirstByteRead()

void alexaClientSDK::acsdkBluetooth::Bluetooth::onFirstByteRead ( avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
override

◆ onFocusChanged()

void alexaClientSDK::acsdkBluetooth::Bluetooth::onFocusChanged ( avsCommon::avs::FocusState  newFocus,
avsCommon::avs::MixingBehavior  behavior 
)
overridevirtual

Used to notify the observer of the Channel of focus changes. Once called, the client should make a user observable change only and return immediately. Any additional work that needs to be done should be done on a separate thread or after returning. "User observable change" here refers to events that the end user of the product can visibly see or hear. For example, Alexa speech or music playing would be examples of user observable changes. Other work, such as database storing, logging, or communicating via network should be done on a different thread. Not doing so could result in delays for other clients trying to access the Channel.

Parameters
newFocusThe new Focus of the channel.
behaviorThe mixingBehavior for the ChannelObserver to take as per the interrupt model
Note
when newFocus is FocusState::FOREGROUND, the MixingBehavior shall be guaranteed to be PRIMARY when newFocus is FocusState::NONE, the MixingBehavior shall be guaranteed to be MUST_STOP

Reimplemented from alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ onPlaybackError()

void alexaClientSDK::acsdkBluetooth::Bluetooth::onPlaybackError ( avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId  id,
const avsCommon::utils::mediaPlayer::ErrorType type,
std::string  error,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
override

◆ onPlaybackFinished()

void alexaClientSDK::acsdkBluetooth::Bluetooth::onPlaybackFinished ( avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
override

◆ onPlaybackStarted()

void alexaClientSDK::acsdkBluetooth::Bluetooth::onPlaybackStarted ( avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
override

◆ onPlaybackStopped()

void alexaClientSDK::acsdkBluetooth::Bluetooth::onPlaybackStopped ( avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId  id,
const avsCommon::utils::mediaPlayer::MediaPlayerState state 
)
override

◆ pair()

void alexaClientSDK::acsdkBluetooth::Bluetooth::pair ( const std::string &  addr)
overridevirtual

Pair with the device matching the given MAC address.

Default behavior will remove the device from discoverable and scanning modes on a successful pairing attempt. Refer to an endpoint's corresponding connection rule to determine if an explicit connection attempt should be made afterwards.

Parameters
macThe MAC address associated with the device.

Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.

◆ preHandleDirective()

void alexaClientSDK::acsdkBluetooth::Bluetooth::preHandleDirective ( std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo info)
override

◆ setDiscoverableMode()

void alexaClientSDK::acsdkBluetooth::Bluetooth::setDiscoverableMode ( bool  discoverable)
overridevirtual

Puts the device into the desired discoverable mode.

Parameters
discoverableA bool indicating whether it should be discoverable.

Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.

◆ setPairingPin()

void alexaClientSDK::acsdkBluetooth::Bluetooth::setPairingPin ( const std::string &  addr,
const std::string &  pin 
)
overridevirtual

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
addrThe MAC address associated with the device
pinBT pairing pin

Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.

◆ setScanMode()

void alexaClientSDK::acsdkBluetooth::Bluetooth::setScanMode ( bool  scanning)
overridevirtual

Puts the device into the desired scan mode.

Parameters
scanningA bool indicating whether it should be scanning.

Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.

◆ unpair()

void alexaClientSDK::acsdkBluetooth::Bluetooth::unpair ( const std::string &  addr)
overridevirtual

Unpair with the device matching the given MAC address.

Refer to an endpoint's corresponding connection rule to determine if an explicit disconnect should be made prior.

Parameters
macThe MAC address associated with the device.

Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.


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