![]() |
AlexaClientSDK
3.0.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::NONE, FocusTransitionState::INTERNAL, FocusTransitionState::PENDING_INTERNAL, FocusTransitionState::EXTERNAL } |
enum | ScanningTransitionState { ScanningTransitionState::ACTIVE, ScanningTransitionState::PENDING_INACTIVE, ScanningTransitionState::INACTIVE } |
using | ObserverInterface = acsdkBluetoothInterfaces::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::acsdkBluetooth::Bluetooth::ObserverInterface = acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface |
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. |
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.
|
override |
|
overridevirtual |
Reset any internal state that may be associated with a particular user.
Implements alexaClientSDK::registrationManager::CustomerDataHandlerInterface.
|
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.
mac | The MAC address associated with the device. |
Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.
Creates an instance of the Bluetooth
.
contextManager | Responsible for managing the context. |
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. |
customerDataManager | Object that will track the CustomerDataHandler. |
audioPipelineFactory | Object to create a Bluetooth media player and related interfaces. |
audioFocusManager | Responsible for managing the focus. |
shutdownNotifier | Object that will notify this CA when it is time to shut down. |
endpointCapabilitiesRegistrar | The default endpoint registrar with which this CA will register its capabilities. |
enabledConnectionRules | The set of devices connection rules enabled by the Bluetooth stack from customers. |
mediaInputTransformer | Transforms incoming Media commands if supported. |
bluetoothNotifier | The object with which to notify observers of Bluetooth device connections or disconnects. |
|
overridevirtual |
Disconnect from the device matching the given MAC address.
mac | The MAC address associated with the device. |
Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.
|
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.
|
override |
|
overridevirtual |
Handle the action specified AVSDirective
. Once this has been called the DirectiveHandler
should not expect to receive further calls regarding this directive.
AVSDirectives
. ExceptionEncountered
message should be sent to AVS.directive | The directive to handle. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.
|
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 |
Implements alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventListenerInterface.
|
override |
|
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.
|
override |
|
override |
|
override |
|
override |
|
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.
mac | The MAC address associated with the device. |
Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.
|
override |
|
overridevirtual |
Puts the device into the desired discoverable mode.
discoverable | A bool indicating whether it should be discoverable. |
Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.
|
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()
addr | The MAC address associated with the device |
pin | BT pairing pin |
Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.
|
overridevirtual |
Puts the device into the desired scan mode.
scanning | A bool indicating whether it should be scanning. |
Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.
|
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.
mac | The MAC address associated with the device. |
Implements alexaClientSDK::acsdkBluetoothInterfaces::BluetoothLocalInterface.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0