![]() |
AlexaClientSDK
1.19.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <Bluetooth.h>
Public Types | |
enum | StreamingState { StreamingState::INACTIVE, StreamingState::PAUSED, StreamingState::PENDING_PAUSED, StreamingState::PENDING_ACTIVE, StreamingState::ACTIVE } |
enum | FocusTransitionState { FocusTransitionState::INTERNAL, FocusTransitionState::PENDING_INTERNAL, FocusTransitionState::EXTERNAL } |
enum | ScanningTransitionState { ScanningTransitionState::ACTIVE, ScanningTransitionState::PENDING_INACTIVE, ScanningTransitionState::INACTIVE } |
using | ObserverInterface = avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceObserverInterface |
![]() | |
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< TagKeyValueType > | VectorOfTags |
Protected Member Functions | |
BluetoothEventBusListenerInterface Functions | |
void | onEventFired (const avsCommon::utils::bluetooth::BluetoothEvent &event) override |
![]() | |
CapabilityAgent (const std::string &nameSpace, std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender) | |
virtual std::shared_ptr< DirectiveInfo > | createDirectiveInfo (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 | |
![]() | |
const std::string | m_namespace |
The namespace of the capability agent. More... | |
std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterface > | m_exceptionEncounteredSender |
Object to use to send exceptionEncountered messages. More... | |
The Bluetooth Capability Agent is responsible for implementing the Bluetooth AVS interface. This consists of two areas of responsibilities:
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).
using alexaClientSDK::capabilityAgents::bluetooth::Bluetooth::ObserverInterface = avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceObserverInterface |
An enum that represents how the Bluetooth class expects to lose focus.
Enumerator | |
---|---|
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. |
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.
An enum representing the streaming states.
void alexaClientSDK::capabilityAgents::bluetooth::Bluetooth::addObserver | ( | std::shared_ptr< ObserverInterface > | observer | ) |
Adds a bluetooth device observer.
observer | The BluetoothDeviceObserverInterface to add. |
|
override |
|
overridevirtual |
Reset any internal state that may be associated with a particular user.
Implements alexaClientSDK::registrationManager::CustomerDataHandler.
Creates an instance of the Bluetooth capability agent.
contextManager | Responsible for managing the context. |
focusManager | Responsible for managing the focus. |
messageSender | Responsible for sending events to AVS. |
exceptionEncounteredSender | Responsible for sending exceptions to AVS. |
bluetoothStorage | The storage component for the Bluetooth CA. |
deviceManager | Responsible for management of Bluetooth devices. |
eventBus | A bus to abstract Bluetooth stack specific messages. |
mediaPlayer | The Media Player which will handle playback. |
customerDataManager | Object that will track the CustomerDataHandler. |
enabledConnectionRules | The set of devices connection rules enabled by the Bluetooth stack from customers. |
bluetoothChannelVolumeInterface | The ChannelVolumeInterface used to control bluetooth channel volume |
mediaInputTransformer | Transforms incoming Media commands if supported. |
|
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.
Implements alexaClientSDK::avsCommon::utils::RequiresShutdown.
|
overridevirtual |
Returns the configurations of the capability interfaces being implemented.
Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilityConfigurationInterface.
|
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).
avs::DirectiveHandlerConfiguration
of the handler. Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.
std::shared_ptr<ServiceType> alexaClientSDK::capabilityAgents::bluetooth::Bluetooth::getService | ( | std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface > | device | ) |
|
override |
|
override |
|
overridevirtual |
This is called by the ContextManager once the context is ready and available.
ContextRequester
should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders
.jsonContext | Context information.Context provided is of the format {"context"[{...}, {...}]} |
Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.
|
overridevirtual |
The contextManager calls this if it is unable to process a getContext
request successfully.
ContextRequester
should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders
.error | The reason why the getContext request failed. |
Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.
|
overrideprotectedvirtual |
Method called to process an event of the specific type.
event | Event to be processed |
Cloud initiated disconnect.
Device initiated disconnect.
Cloud initiated connect.
Device initiated connect.
Implements alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventListenerInterface.
|
overridevirtual |
This is an indication to the observer that the MediaPlayer
has read its first byte of data.
id | The id of the source to which this callback corresponds to. |
state | Metadata about the media player state |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
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.
newFocus | The new Focus of the channel. |
behavior | The mixingBehavior for the ChannelObserver to take as per the interrupt model |
Reimplemented from alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
overridevirtual |
This is an indication to the observer that the MediaPlayer
encountered an error. Errors can occur during playback.
MediaPlayer
from further processing.id | The id of the source to which this callback corresponds to. |
type | The type of error encountered by the MediaPlayerInterface . |
error | The error encountered by the MediaPlayerInterface . |
state | Metadata about the media player state |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
overridevirtual |
This is an indication to the observer that the MediaPlayer
finished the source.
MediaPlayer
from further processing.id | The id of the source to which this callback corresponds to. |
state | Metadata about the media player state |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
overridevirtual |
This is an indication to the observer that the MediaPlayer
has started playing the source specified by the id.
MediaPlayer
from further processing.id | The id of the source to which this callback corresponds to. |
state | Metadata about the media player state |
Implements alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
overridevirtual |
This is an indication to the observer that the MediaPlayer
has stopped the source.
MediaPlayer
from further processing.id | The id of the source to which this callback corresponds to. |
state | Metadata about the media player state |
Reimplemented from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface.
|
override |
void alexaClientSDK::capabilityAgents::bluetooth::Bluetooth::removeObserver | ( | std::shared_ptr< ObserverInterface > | observer | ) |
Removes a bluetooth device observer.
observer | The BluetoothDeviceObserverInterface to remove. |
AlexaClientSDK 1.19.0 - Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0