AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Namespaces | Macros | Typedefs | Functions | Variables
Bluetooth.cpp File Reference
#include <chrono>
#include <AVSCommon/AVS/ContentType.h>
#include <AVSCommon/AVS/NamespaceAndName.h>
#include <AVSCommon/SDKInterfaces/Bluetooth/Services/A2DPSinkInterface.h>
#include <AVSCommon/SDKInterfaces/Bluetooth/Services/A2DPSourceInterface.h>
#include <AVSCommon/SDKInterfaces/Bluetooth/Services/AVRCPControllerInterface.h>
#include <AVSCommon/SDKInterfaces/Bluetooth/Services/AVRCPTargetInterface.h>
#include <AVSCommon/SDKInterfaces/Bluetooth/Services/HFPInterface.h>
#include <AVSCommon/SDKInterfaces/Bluetooth/Services/HIDInterface.h>
#include <AVSCommon/SDKInterfaces/Bluetooth/Services/SPPInterface.h>
#include <AVSCommon/Utils/Bluetooth/SDPRecords.h>
#include <AVSCommon/Utils/Configuration/ConfigurationNode.h>
#include <AVSCommon/Utils/JSON/JSONUtils.h>
#include <AVSCommon/Utils/Logger/Logger.h>
#include <AVSCommon/Utils/MacAddressString.h>
#include <AVSCommon/Utils/UUIDGeneration/UUIDGeneration.h>
#include <rapidjson/error/en.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>
#include "acsdkBluetooth/BasicDeviceConnectionRule.h"
#include "acsdkBluetooth/Bluetooth.h"
Include dependency graph for Bluetooth.cpp:

Namespaces

 alexaClientSDK
 Whether or not curl logs should be emitted.
 
 alexaClientSDK::acsdkBluetooth
 

Macros

#define LX(event)   alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)
 

Typedefs

using alexaClientSDK::acsdkBluetooth::MediaPlayerState = avsCommon::utils::mediaPlayer::MediaPlayerState
 

Functions

static std::shared_ptr< avsCommon::avs::CapabilityConfiguration > alexaClientSDK::acsdkBluetooth::getBluetoothCapabilityConfiguration ()
 
static std::string alexaClientSDK::acsdkBluetooth::truncateWithDefault (const std::string &mac, const std::string &defaultString="XX:XX:XX:XX:XX:XX")
 
static bool alexaClientSDK::acsdkBluetooth::supportsAvsProfile (std::shared_ptr< BluetoothDeviceInterface > device, const std::string &avsProfileName)
 
static bool alexaClientSDK::acsdkBluetooth::waitOnFuture (std::future< bool > future, std::string description="", std::chrono::milliseconds timeout=DEFAULT_FUTURE_TIMEOUT)
 
static std::string alexaClientSDK::acsdkBluetooth::convertToAVSStreamingState (const Bluetooth::StreamingState &state)
 
static bool alexaClientSDK::acsdkBluetooth::validateDeviceConnectionRules (std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceConnectionRuleInterface >> enabledConnectionRules)
 
static std::string alexaClientSDK::acsdkBluetooth::convertToAVSConnectedState (const DeviceState &state)
 
static bool alexaClientSDK::acsdkBluetooth::parseDirectivePayload (const std::string &payload, Document *document)
 

Variables

static const std::string alexaClientSDK::acsdkBluetooth::TAG {"Bluetooth"}
 String to identify log entries originating from this file. More...
 
static const std::string alexaClientSDK::acsdkBluetooth::NAMESPACE = "Bluetooth"
 The Bluetooth interface namespace. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::BLUETOOTH_STATE {NAMESPACE, "BluetoothState"}
 The Bluetooth state portion of the Context. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::SCAN_DEVICES {NAMESPACE, "ScanDevices"}
 The ScanDevices directive identifier. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::SCAN_DEVICES_REPORT {NAMESPACE, "ScanDevicesReport"}
 The ScanDevicesReport event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::SCAN_DEVICES_FAILED {NAMESPACE, "ScanDevicesFailed"}
 The ScanDevicesFailed event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::ENTER_DISCOVERABLE_MODE {NAMESPACE, "EnterDiscoverableMode"}
 The EnterDiscoverableMode directive identifier. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::ENTER_DISCOVERABLE_MODE_SUCCEEDED {NAMESPACE, "EnterDiscoverableModeSucceeded"}
 The EnterDiscoverableModeSucceeded event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::ENTER_DISCOVERABLE_MODE_FAILED {NAMESPACE, "EnterDiscoverableModeFailed"}
 The EnterDiscoverableModeFailed event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::EXIT_DISCOVERABLE_MODE {NAMESPACE, "ExitDiscoverableMode"}
 The ExitDiscoverableMode directive identifier. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::PAIR_DEVICES_SUCCEEDED {NAMESPACE, "PairDevicesSucceeded"}
 The PairDevicesSucceeded event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::PAIR_DEVICES_FAILED {NAMESPACE, "PairDevicesFailed"}
 The PairDevicesFailed event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::PAIR_DEVICES {NAMESPACE, "PairDevices"}
 The PairDevices directive identifier. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::UNPAIR_DEVICES {NAMESPACE, "UnpairDevices"}
 The UnpairDevices directive identifier. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::UNPAIR_DEVICES_SUCCEEDED {NAMESPACE, "UnpairDevicesSucceeded"}
 The UnpairDevicesSucceeded event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::UNPAIR_DEVICES_FAILED {NAMESPACE, "UnpairDevicesFailed"}
 The UnpairDevicesFailed event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::SET_DEVICE_CATEGORIES {NAMESPACE, "SetDeviceCategories"}
 The SetDeviceCategories directive identifier. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::SET_DEVICE_CATEGORIES_SUCCEEDED {NAMESPACE, "SetDeviceCategoriesSucceeded"}
 The SetDeviceCategoriesSucceeded event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::SET_DEVICE_CATEGORIES_FAILED {NAMESPACE, "SetDeviceCategoriesFailed"}
 The SetDeviceCategoriesFailed event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::CONNECT_BY_DEVICE_IDS {NAMESPACE, "ConnectByDeviceIds"}
 The ConnectByDeviceIds directive identifier. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::CONNECT_BY_DEVICE_IDS_SUCCEEDED {NAMESPACE, "ConnectByDeviceIdsSucceeded"}
 The ConnectByDeviceIdsSucceeded event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::CONNECT_BY_DEVICE_IDS_FAILED {NAMESPACE, "ConnectByDeviceIdsFailed"}
 The ConnectByDeviceIdsFailed event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::CONNECT_BY_PROFILE {NAMESPACE, "ConnectByProfile"}
 The ConnectByProfile directive identifier. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::CONNECT_BY_PROFILE_SUCCEEDED {NAMESPACE, "ConnectByProfileSucceeded"}
 The ConnectByProfileSucceeded event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::CONNECT_BY_PROFILE_FAILED {NAMESPACE, "ConnectByProfileFailed"}
 The ConnectByProfileFailed event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::DISCONNECT_DEVICES {NAMESPACE, "DisconnectDevices"}
 The DisconnectDevices directive identifier. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::DISCONNECT_DEVICES_SUCCEEDED {NAMESPACE, "DisconnectDevicesSucceeded"}
 The DisconnectDevicesSucceeded event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::DISCONNECT_DEVICES_FAILED {NAMESPACE, "DisconnectDevicesFailed"}
 The DisconnectDevicesFailed event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::PLAY {NAMESPACE, "Play"}
 The Play directive identifier. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::MEDIA_CONTROL_PLAY_SUCCEEDED {NAMESPACE, "MediaControlPlaySucceeded"}
 The MediaControlPlaySucceeded event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::MEDIA_CONTROL_PLAY_FAILED {NAMESPACE, "MediaControlPlayFailed"}
 The MediaControlPlayFailed event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::STOP {NAMESPACE, "Stop"}
 The Stop directive identifier. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::MEDIA_CONTROL_STOP_SUCCEEDED {NAMESPACE, "MediaControlStopSucceeded"}
 The MediaControlStopSucceeded event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::MEDIA_CONTROL_STOP_FAILED {NAMESPACE, "MediaControlStopFailed"}
 The MediaControlStopFailed event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::NEXT {NAMESPACE, "Next"}
 The Next directive identifier. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::MEDIA_CONTROL_NEXT_SUCCEEDED {NAMESPACE, "MediaControlNextSucceeded"}
 The MediaControlNextSucceeded event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::MEDIA_CONTROL_NEXT_FAILED {NAMESPACE, "MediaControlNextFailed"}
 The MediaControlNextFailed event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::PREVIOUS {NAMESPACE, "Previous"}
 The Previous directive identifier. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::MEDIA_CONTROL_PREVIOUS_SUCCEEDED {NAMESPACE, "MediaControlPreviousSucceeded"}
 The MediaControlPreviousSucceeded event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::MEDIA_CONTROL_PREVIOUS_FAILED {NAMESPACE, "MediaControlPreviousFailed"}
 The MediaControlPreviousFailed event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::STREAMING_STARTED {NAMESPACE, "StreamingStarted"}
 The StreamingStarted event. More...
 
static const NamespaceAndName alexaClientSDK::acsdkBluetooth::STREAMING_ENDED {NAMESPACE, "StreamingEnded"}
 The StreamingEnded event. More...
 
static const std::string alexaClientSDK::acsdkBluetooth::CHANNEL_NAME = FocusManagerInterface::CONTENT_CHANNEL_NAME
 The Channel name. More...
 
static const std::string alexaClientSDK::acsdkBluetooth::ACTIVITY_ID = "Bluetooth"
 Activity ID for use by FocusManager. More...
 
static const unsigned int alexaClientSDK::acsdkBluetooth::MAX_CONNECT_BY_PROFILE_COUNT = 2
 Max number of paired devices connect by profile should atempt connect to. More...
 
static const std::chrono::milliseconds alexaClientSDK::acsdkBluetooth::INITIALIZE_SOURCE_DELAY {1000}
 
static const std::chrono::seconds alexaClientSDK::acsdkBluetooth::DEFAULT_FUTURE_TIMEOUT {45}
 
static const std::chrono::minutes alexaClientSDK::acsdkBluetooth::TRANSIENT_FOCUS_DURATION {2}
 
static const char alexaClientSDK::acsdkBluetooth::ALEXA_DEVICE_NAME_KEY [] = "alexaDevice"
 A key for the alexa (host) device. More...
 
static const char alexaClientSDK::acsdkBluetooth::DEVICE_KEY [] = "device"
 A key for a device. More...
 
static const char alexaClientSDK::acsdkBluetooth::DEVICES_KEY [] = "devices"
 A key for a devices. More...
 
static const char alexaClientSDK::acsdkBluetooth::DISCOVERED_DEVICES_KEY [] = "discoveredDevices"
 A key for discovered devices. More...
 
static const char alexaClientSDK::acsdkBluetooth::HAS_MORE_KEY [] = "hasMore"
 A key to indicate if more devices are to be reported. More...
 
static const std::string alexaClientSDK::acsdkBluetooth::EMPTY_PAYLOAD = "{}"
 An empty payload. More...
 
static const char alexaClientSDK::acsdkBluetooth::FRIENDLY_NAME_KEY [] = "friendlyName"
 The friendly name. More...
 
static const char alexaClientSDK::acsdkBluetooth::NAME_KEY [] = "name"
 The name key for a profile. More...
 
static const char alexaClientSDK::acsdkBluetooth::VERSION_KEY [] = "version"
 The version key for a profile. More...
 
static const char alexaClientSDK::acsdkBluetooth::PAIRED_DEVICES_KEY [] = "pairedDevices"
 Identifying paired devices. More...
 
static const char alexaClientSDK::acsdkBluetooth::PROFILE_KEY [] = "profile"
 Identifying a profile. More...
 
static const char alexaClientSDK::acsdkBluetooth::PROFILES_KEY [] = "profiles"
 Identifying an array of profiles. More...
 
static const char alexaClientSDK::acsdkBluetooth::PROFILE_NAME_KEY [] = "profileName"
 Identifying a profile name. More...
 
static const char alexaClientSDK::acsdkBluetooth::REQUESTER_KEY [] = "requester"
 Identifying the requester of the operation. More...
 
static const char alexaClientSDK::acsdkBluetooth::STREAMING_KEY [] = "streaming"
 A key indicating streaming status. More...
 
static const char alexaClientSDK::acsdkBluetooth::STATE_KEY [] = "state"
 A key indicating state. More...
 
static const char alexaClientSDK::acsdkBluetooth::SUPPORTED_PROFILES_KEY [] = "supportedProfiles"
 Indicates the supported profiles. More...
 
static const char alexaClientSDK::acsdkBluetooth::TRUNCATED_MAC_ADDRESS_KEY [] = "truncatedMacAddress"
 The truncated mac address. More...
 
static const char alexaClientSDK::acsdkBluetooth::UNIQUE_DEVICE_ID_KEY [] = "uniqueDeviceId"
 The uuid generated to identify a device. More...
 
static const char alexaClientSDK::acsdkBluetooth::METADATA_KEY [] = "metadata"
 The metadata. More...
 
static const char alexaClientSDK::acsdkBluetooth::VENDOR_ID_KEY [] = "vendorId"
 The Vendor Id. More...
 
static const char alexaClientSDK::acsdkBluetooth::PRODUCT_ID_KEY [] = "productId"
 The Product Id. More...
 
static const char alexaClientSDK::acsdkBluetooth::CLASS_OF_DEVICE_KEY [] = "classOfDevice"
 The Class of Device. More...
 
static const char alexaClientSDK::acsdkBluetooth::VENDOR_DEVICE_SIG_ID_KEY [] = "vendorDeviceSigId"
 The Vendor Device SigID. More...
 
static const char alexaClientSDK::acsdkBluetooth::VENDOR_DEVICE_ID_KEY [] = "vendorDeviceId"
 The Vendor Device ID. More...
 
static const char alexaClientSDK::acsdkBluetooth::DEVICE_CATEGORY_KEY [] = "deviceCategory"
 Identifying a device category. More...
 
static const char alexaClientSDK::acsdkBluetooth::CONNECTION_STATE_KEY [] = "connectionState"
 Identifying the connection status of a device. More...
 
static const std::string alexaClientSDK::acsdkBluetooth::AVS_A2DP_SOURCE = "A2DP-SOURCE"
 A2DP Source. More...
 
static const std::string alexaClientSDK::acsdkBluetooth::AVS_A2DP_SINK = "A2DP-SINK"
 A2DP Sink. More...
 
static const std::string alexaClientSDK::acsdkBluetooth::AVS_A2DP = "A2DP"
 General A2DP. More...
 
static const std::string alexaClientSDK::acsdkBluetooth::AVS_AVRCP = "AVRCP"
 
static const std::string alexaClientSDK::acsdkBluetooth::AVS_HFP = "HFP"
 HFP. More...
 
static const std::string alexaClientSDK::acsdkBluetooth::AVS_HID = "HID"
 HID. More...
 
static const std::string alexaClientSDK::acsdkBluetooth::AVS_SPP = "SPP"
 SPP. More...
 
static const std::map< std::string, std::string > alexaClientSDK::acsdkBluetooth::AVS_PROFILE_MAP
 A mapping of Bluetooth service UUIDs to AVS profile identifiers. More...
 
static const std::map< DeviceCategory, std::unordered_set< std::string > > alexaClientSDK::acsdkBluetooth::DEVICECATEGORY_PROFILES_MAP
 
static const std::string alexaClientSDK::acsdkBluetooth::BLUETOOTH_CAPABILITY_INTERFACE_TYPE = "AlexaInterface"
 
static const std::string alexaClientSDK::acsdkBluetooth::BLUETOOTH_CAPABILITY_INTERFACE_NAME = "Bluetooth"
 Bluetooth interface name. More...
 
static const std::string alexaClientSDK::acsdkBluetooth::BLUETOOTH_CAPABILITY_INTERFACE_VERSION = "2.0"
 Bluetooth interface version. Version 1.0 works with StreamingStarted and StreamingEnded. More...
 
static const std::string alexaClientSDK::acsdkBluetooth::BLUETOOTH_CAPABILITY_CONFIGURATION_VALUE
 Bluetooth configurations value. More...
 

Macro Definition Documentation

◆ LX

#define LX (   event)    alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)

Create a LogEntry using this file's TAG and the specified event string.

Parameters
Theevent string for this LogEntry.

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