AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Bluetooth.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ACSDKBLUETOOTH_BLUETOOTH_H_
17 #define ACSDKBLUETOOTH_BLUETOOTH_H_
18 
19 #include <atomic>
20 #include <deque>
21 #include <functional>
22 #include <map>
23 #include <memory>
24 #include <string>
25 #include <queue>
26 #include <unordered_set>
27 
66 
70 
71 namespace alexaClientSDK {
72 namespace acsdkBluetooth {
73 
75 static const constexpr char* BLUETOOTH_MEDIA_PLAYER_NAME = "BluetoothMediaPlayer";
76 
120  : public std::enable_shared_from_this<Bluetooth>
129 public:
131 
135  enum class StreamingState {
137  INACTIVE,
138 
140  PAUSED,
141 
144 
147 
149  ACTIVE
150  };
151 
155  enum class FocusTransitionState {
157  NONE,
158 
160  INTERNAL,
161 
167  PENDING_INTERNAL,
168 
170  EXTERNAL
171  };
172 
185  ACTIVE,
186 
195  PENDING_INACTIVE,
196 
205  INACTIVE
206  };
207 
229  static std::shared_ptr<Bluetooth> createBluetoothCapabilityAgent(
230  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
231  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
232  std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionEncounteredSender,
233  std::shared_ptr<acsdkBluetoothInterfaces::BluetoothStorageInterface> bluetoothStorage,
234  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceManagerInterface> deviceManager,
235  std::shared_ptr<avsCommon::utils::bluetooth::BluetoothEventBus> eventBus,
236  std::shared_ptr<registrationManager::CustomerDataManagerInterface> customerDataManager,
237  std::shared_ptr<acsdkApplicationAudioPipelineFactoryInterfaces::ApplicationAudioPipelineFactoryInterface>
238  audioPipelineFactory,
242  std::shared_ptr<acsdkShutdownManagerInterfaces::ShutdownNotifierInterface> shutdownNotifier,
246  std::shared_ptr<acsdkBluetoothInterfaces::BluetoothDeviceConnectionRulesProviderInterface>
247  connectionRulesProvider,
248  std::shared_ptr<BluetoothMediaInputTransformer> mediaInputTransformer,
249  std::shared_ptr<acsdkBluetoothInterfaces::BluetoothNotifierInterface> bluetoothNotifier);
250 
254  void handleDirectiveImmediately(std::shared_ptr<avsCommon::avs::AVSDirective> directive) override;
255  void preHandleDirective(std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info) override;
256  void handleDirective(std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info) override;
257  void cancelDirective(std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info) override;
260 
263  void setDiscoverableMode(bool discoverable) override;
264  void setScanMode(bool scanning) override;
265  void pair(const std::string& addr) override;
266  void unpair(const std::string& addr) override;
267  void connect(const std::string& addr) override;
268  void disconnect(const std::string& addr) override;
270 
273  std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration>> getCapabilityConfigurations() override;
275 
276  // @name ContextRequester Functions
278  void onContextAvailable(const std::string& jsonContext) override;
281 
282  // @name RequiresShutdown Functions
284  void doShutdown() override;
286 
289  void onFirstByteRead(
292  void onPlaybackStarted(
295  void onPlaybackStopped(
298  void onPlaybackFinished(
301  void onPlaybackError(
304  std::string error,
307 
310  void clearData() override;
312 protected:
315  void onEventFired(const avsCommon::utils::bluetooth::BluetoothEvent& event) override;
317 
318 private:
339  Bluetooth(
340  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> contextManager,
341  std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerInterface> focusManager,
342  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
343  std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionEncounteredSender,
344  std::shared_ptr<acsdkBluetoothInterfaces::BluetoothStorageInterface> bluetoothStorage,
345  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceManagerInterface> deviceManager,
346  std::shared_ptr<avsCommon::utils::bluetooth::BluetoothEventBus> eventBus,
347  std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> mediaPlayer,
348  std::shared_ptr<registrationManager::CustomerDataManagerInterface> customerDataManager,
349  std::unordered_set<std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceConnectionRuleInterface>>
350  enabledConnectionRules,
351  std::shared_ptr<avsCommon::sdkInterfaces::ChannelVolumeInterface> bluetoothChannelVolumeInterface,
352  std::shared_ptr<BluetoothMediaInputTransformer> mediaInputTransformer,
353  std::shared_ptr<acsdkBluetoothInterfaces::BluetoothNotifierInterface> bluetoothNotifier);
354 
360  bool init();
361 
366  void syncWithDeviceManager();
367 
368  // TODO ACSDK-1392: Optimize by updating the context only when there is a delta.
370  void executeUpdateContext();
371 
381  bool extractAvsProfiles(
382  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device,
383  rapidjson::Document::AllocatorType& allocator,
384  rapidjson::Value* supportedProfiles);
385 
391  void executeSetHandlingCompleted(std::shared_ptr<DirectiveInfo> info);
392 
398  void removeDirective(std::shared_ptr<DirectiveInfo> info);
399 
407  void sendExceptionEncountered(
408  std::shared_ptr<CapabilityAgent::DirectiveInfo> info,
409  const std::string& message,
411 
413  void executeEnterForeground();
414 
416  void executeEnterBackground(avsCommon::avs::MixingBehavior behavior);
417 
419  void executeEnterNone();
420 
424  void executeHandleEnterDiscoverableMode();
425 
429  void executeHandleExitDiscoverableMode();
430 
434  void executeHandleScanDevices();
435 
442  bool executeHandlePairDevices(const std::unordered_set<std::string>& uuids);
443 
450  bool executeHandleUnpairDevices(const std::unordered_set<std::string>& uuids);
451 
459  bool executeHandleConnectByDeviceIds(const std::unordered_set<std::string>& uuids);
460 
468  bool executeHandleDisconnectDevices(const std::unordered_set<std::string>& uuids);
469 
476  bool executeSetDiscoverableMode(bool discoverable);
477 
485  bool executeSetScanMode(bool scanning, bool shouldReport = true);
486 
493  bool executePairDevices(const std::unordered_set<std::string>& uuids);
494 
501  bool executeUnpairDevices(const std::unordered_set<std::string>& uuids);
502 
509  std::map<std::string, std::string> executeSetDeviceCategories(
510  const std::map<std::string, std::string>& uuidCategoryMap);
511 
518  void executeConnectByDeviceIds(const std::unordered_set<std::string>& uuids);
519 
528  void executeConnectByProfile(const std::string& profileName, const std::string& profileVersion);
529 
536  void executeDisconnectDevices(const std::unordered_set<std::string>& uuids);
537 
544  void executeOnDeviceDisconnect(
545  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device,
546  avsCommon::avs::Requester requester);
547 
554  void executeOnDeviceConnect(
555  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device,
556  bool shouldNotifyConnection = true);
557 
564  bool executeFunctionOnDevice(
565  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface>& device,
566  std::function<std::future<bool>(
567  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface>&)> function);
568 
574  void executePlay(std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
575 
581  void executeStop(std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
582 
588  void executeNext(std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
589 
595  void executePrevious(std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
596 
598  void executeInitializeMediaSource();
599 
601  void cleanupMediaSource();
602 
604  void executeAbortMediaPlayback();
605 
613  void setCurrentStream(std::shared_ptr<avsCommon::utils::bluetooth::FormattedAudioStreamAdapter> stream);
614 
617 
618  void onFormattedAudioStreamAdapterData(
619  avsCommon::utils::AudioFormat audioFormat,
620  const unsigned char* buffer,
621  size_t size) override;
622 
624 
631  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> retrieveDeviceByMac(
632  const std::string& mac);
633 
640  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> retrieveDeviceByUuid(
641  const std::string& uuid);
642 
650  bool retrieveDeviceCategoryByUuid(const std::string& uuid, DeviceCategory* category);
651 
657  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceConnectionRuleInterface>
658  retrieveConnectionRuleByUuid(const std::string& uuid);
659 
668  bool retrieveUuid(const std::string& mac, std::string* uuid);
669 
676  std::unordered_set<std::string> retrieveUuidsFromConnectionPayload(const rapidjson::Document& payload);
677 
679  void clearUnusedUuids();
680 
687  void executeSendEvent(const std::string& eventName, const std::string& eventPayload);
688 
696  void executeQueueEventAndRequestContext(const std::string& eventName, const std::string& eventPayload);
697 
704  void executeSendScanDevicesReport(
705  const std::list<std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface>>& devices,
706  bool hasMore);
707 
709  void executeSendScanDevicesFailed();
710 
712  void executeSendEnterDiscoverableModeSucceeded();
713 
715  void executeSendEnterDiscoverableModeFailed();
716 
722  void executeSendPairDevicesSucceeded(
723  const std::unordered_set<std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface>>&
724  devices);
725 
732  void executeSendPairFailedEvent(const std::string& eventName, const std::unordered_set<std::string>& uuids);
733 
739  void executeSendPairDevicesFailed(const std::unordered_set<std::string>& uuids);
740 
746  void executeSendUnpairDevicesSucceeded(
747  const std::unordered_set<std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface>>&
748  devices);
749 
755  void executeSendUnpairDevicesFailed(const std::unordered_set<std::string>& uuids);
756 
762  void executeSetDeviceCategoriesSucceeded(const std::map<std::string, std::string>& uuidCategoryMap);
763 
769  void executeSetDeviceCategoriesFailed(const std::map<std::string, std::string>& uuidCategoryMap);
770 
777  void executeSendConnectByDeviceIdsSucceeded(
778  const std::unordered_set<std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface>>&
779  devices,
780  avsCommon::avs::Requester requester);
781 
788  void executeSendConnectByDeviceIdsFailed(
789  const std::unordered_set<std::string>& uuids,
790  avsCommon::avs::Requester requester);
791 
799  void executeSendConnectByProfileSucceeded(
800  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device,
801  const std::string& profileName,
802  avsCommon::avs::Requester requester);
803 
811  void executeSendConnectByProfileFailed(const std::string& profileName, avsCommon::avs::Requester requester);
812 
819  void executeSendDisconnectDevicesSucceeded(
820  const std::unordered_set<std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface>>&
821  devices,
822  avsCommon::avs::Requester requester);
823 
831  void executeSendConnectFailedEvent(
832  const std::string& eventName,
833  const std::unordered_set<std::string>& uuids,
834  avsCommon::avs::Requester requester);
835 
842  void executeSendDisconnectDevicesFailed(
843  const std::unordered_set<std::string>& uuids,
844  avsCommon::avs::Requester requester);
845 
852  void executeSendMediaControlEvent(
853  const std::string& eventName,
854  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
855 
861  void executeSendMediaControlPlaySucceeded(
862  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
863 
869  void executeSendMediaControlPlayFailed(
870  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
871 
877  void executeSendMediaControlStopSucceeded(
878  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
879 
885  void executeSendMediaControlStopFailed(
886  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
887 
893  void executeSendMediaControlNextSucceeded(
894  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
895 
901  void executeSendMediaControlNextFailed(
902  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
903 
909  void executeSendMediaControlPreviousSucceeded(
910  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
911 
917  void executeSendMediaControlPreviousFailed(
918  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
919 
926  void executeSendStreamingEvent(
927  const std::string& eventName,
928  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
929 
935  void executeSendStreamingStarted(
936  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
937 
943  void executeSendStreamingEnded(
944  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
945 
949  ObserverInterface::DeviceAttributes generateDeviceAttributes(
950  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
951 
959  template <typename ServiceType>
960  std::shared_ptr<ServiceType> getService(
961  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device);
962 
971  void executeInsertBluetoothEventState(
972  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device,
976 
984  std::shared_ptr<BluetoothEventState> executeRemoveBluetoothEventState(
985  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> device,
987 
991  void executeRestrictA2DPDevices();
992 
997  void executeUnrestrictA2DPDevices();
998 
1004  void executeAcquireFocus(const std::string& callingMethodName = "");
1005 
1011  void executeReleaseFocus(const std::string& callingMethodName = "");
1012 
1014  std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration>> m_capabilityConfigurations;
1015 
1017  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> m_messageSender;
1018 
1020  std::shared_ptr<avsCommon::sdkInterfaces::ContextManagerInterface> m_contextManager;
1021 
1023  std::shared_ptr<avsCommon::sdkInterfaces::FocusManagerInterface> m_focusManager;
1024 
1025  // TODO 1396: Combine @c m_streamingState and @c m_focusState into a single state machine if possible.
1030  StreamingState m_streamingState;
1031 
1035  FocusTransitionState m_focusTransitionState;
1036 
1040  ScanningTransitionState m_scanningTransitionState;
1041 
1043  avsCommon::avs::FocusState m_focusState;
1044 
1047 
1049  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceManagerInterface> m_deviceManager;
1050 
1052  std::queue<std::pair<std::string, std::string>> m_eventQueue;
1053 
1055  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> m_activeA2DPDevice;
1056 
1058  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface> m_disabledA2DPDevice;
1059 
1061  std::vector<std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface>> m_restrictedDevices;
1062 
1064  std::shared_ptr<avsCommon::utils::mediaPlayer::MediaPlayerInterface> m_mediaPlayer;
1065 
1067  std::shared_ptr<acsdkBluetoothInterfaces::BluetoothStorageInterface> m_db;
1068 
1070  std::shared_ptr<avsCommon::utils::bluetooth::BluetoothEventBus> m_eventBus;
1071 
1073  std::shared_ptr<BluetoothMediaInputTransformer> m_mediaInputTransformer;
1074 
1076  std::shared_ptr<avsCommon::utils::bluetooth::FormattedAudioStreamAdapter> m_mediaStream;
1077 
1079  std::shared_ptr<avsCommon::avs::attachment::InProcessAttachment> m_mediaAttachment;
1080 
1082  std::shared_ptr<avsCommon::avs::attachment::AttachmentWriter> m_mediaAttachmentWriter;
1083 
1085  std::shared_ptr<avsCommon::avs::attachment::AttachmentReader> m_mediaAttachmentReader;
1086 
1088  std::map<
1090  std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceConnectionRuleInterface>>
1091  m_enabledConnectionRules;
1092 
1094  std::map<DeviceCategory, std::set<std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface>>>
1095  m_connectedDevices;
1096 
1098  std::map<std::string, std::unordered_set<std::shared_ptr<BluetoothEventState>>> m_bluetoothEventStates;
1099 
1102  std::shared_ptr<avsCommon::sdkInterfaces::ChannelVolumeInterface> m_bluetoothChannelVolumeInterface;
1103 
1105  std::shared_ptr<acsdkBluetoothInterfaces::BluetoothNotifierInterface> m_bluetoothNotifier;
1106 
1108  std::atomic<uint8_t> m_pendingFocusTransitions;
1109 
1112 };
1113 
1121  switch (state) {
1123  return "INACTIVE";
1125  return "PAUSED";
1127  return "PENDING_PAUSED";
1129  return "PENDING_ACTIVE";
1131  return "ACTIVE";
1132  }
1133 
1134  return "UNKNOWN";
1135 }
1136 
1144 inline std::ostream& operator<<(std::ostream& stream, const Bluetooth::StreamingState state) {
1145  return stream << streamingStateToString(state);
1146 }
1147 
1155  switch (state) {
1157  return "NONE";
1159  return "INTERNAL";
1161  return "PENDING_INTERNAL";
1163  return "EXTERNAL";
1164  }
1165 
1166  return "UNKNOWN";
1167 }
1168 
1177 inline std::ostream& operator<<(std::ostream& stream, const Bluetooth::FocusTransitionState state) {
1178  return stream << focusTransitionStateToString(state);
1179 }
1180 
1188  switch (state) {
1190  return "ACTIVE";
1192  return "PENDING_ACTIVE";
1194  return "INACTIVE";
1195  }
1196 
1197  return "UNKNWON";
1198 }
1199 
1208 inline std::ostream& operator<<(std::ostream& stream, const Bluetooth::ScanningTransitionState state) {
1209  return stream << scanningStateToString(state);
1210 }
1211 
1212 } // namespace acsdkBluetooth
1213 } // namespace alexaClientSDK
1214 
1215 #endif // ACSDKBLUETOOTH_BLUETOOTH_H_
void onPlaybackError(avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId id, const avsCommon::utils::mediaPlayer::ErrorType &type, std::string error, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
Definition: Bluetooth.cpp:2382
Definition: CapabilityAgent.h:47
MixingBehavior
Definition: MixingBehavior.h:25
void handleDirective(std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
Definition: Bluetooth.cpp:1508
void cancelDirective(std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
Definition: Bluetooth.cpp:2151
void connect(const std::string &addr) override
Definition: Bluetooth.cpp:1410
FocusTransitionState
Definition: Bluetooth.h:155
std::unordered_set< std::shared_ptr< avsCommon::avs::CapabilityConfiguration > > getCapabilityConfigurations() override
Definition: Bluetooth.cpp:821
Focus in Bluetooth class is lost because another class has taken focus.
void disconnect(const std::string &addr) override
Definition: Bluetooth.cpp:1421
ContextRequestError
Definition: ContextRequesterInterface.h:40
ExceptionErrorType
Definition: ExceptionErrorType.h:28
AVRCP Pause is sent, waiting for local playback to stop.
std::string scanningStateToString(Bluetooth::ScanningTransitionState state)
Definition: Bluetooth.h:1187
static const constexpr char * BLUETOOTH_MEDIA_PLAYER_NAME
String to identify the Bluetooth media player to render audio.
Definition: Bluetooth.h:75
FocusState
Definition: FocusState.h:29
void pair(const std::string &addr) override
Definition: Bluetooth.cpp:1388
std::string focusTransitionStateToString(Bluetooth::FocusTransitionState state)
Definition: Bluetooth.h:1154
void setDiscoverableMode(bool discoverable) override
Definition: Bluetooth.cpp:1366
avsCommon::avs::DirectiveHandlerConfiguration getConfiguration() const override
Definition: Bluetooth.cpp:747
void handleDirectiveImmediately(std::shared_ptr< avsCommon::avs::AVSDirective > directive) override
Definition: Bluetooth.cpp:1461
void onFirstByteRead(avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
Definition: Bluetooth.cpp:2331
void setScanMode(bool scanning) override
Definition: Bluetooth.cpp:1377
std::ostream & operator<<(std::ostream &stream, const Bluetooth::StreamingState state)
Definition: Bluetooth.h:1144
static std::shared_ptr< 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)
Definition: Bluetooth.cpp:555
void clearData() override
Definition: Bluetooth.cpp:825
void unpair(const std::string &addr) override
Definition: Bluetooth.cpp:1399
Focus in Bluetooth class is lost because it explicitly released focus.
void onContextAvailable(const std::string &jsonContext) override
Definition: Bluetooth.cpp:1432
std::unordered_map< directiveRoutingRule::DirectiveRoutingRule, BlockingPolicy > DirectiveHandlerConfiguration
Definition: DirectiveHandlerConfiguration.h:32
void onPlaybackStopped(avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
Definition: Bluetooth.cpp:2356
DeviceCategory
Definition: DeviceCategory.h:24
MediaPlayerInterface::SourceId SourceId
A type that identifies which source is currently being operated on.
Definition: MediaPlayerObserverInterface.h:49
This focus is used to represent when a Channel is not being used or when an observer should stop...
AVRCP Play is sent, waiting for local playback to start.
void preHandleDirective(std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
Definition: Bluetooth.cpp:1466
void onEventFired(const avsCommon::utils::bluetooth::BluetoothEvent &event) override
Definition: Bluetooth.cpp:3182
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
void onFocusChanged(avsCommon::avs::FocusState newFocus, avsCommon::avs::MixingBehavior behavior) override
Definition: Bluetooth.cpp:1323
DeviceState
Definition: BluetoothDeviceInterface.h:48
void onPlaybackStarted(avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
Definition: Bluetooth.cpp:2335
void onPlaybackFinished(avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface::SourceId id, const avsCommon::utils::mediaPlayer::MediaPlayerState &state) override
Definition: Bluetooth.cpp:2370
ErrorType
Identifies the specific type of error in a PlaybackFailed event.
Definition: ErrorTypes.h:27
void onContextFailure(const avsCommon::sdkInterfaces::ContextRequestError error) override
Definition: Bluetooth.cpp:1452
ScanningTransitionState
Definition: Bluetooth.h:177
void doShutdown() override
Definition: Bluetooth.cpp:771
StreamingState
Definition: Bluetooth.h:135
Requester
An enum class indicating whether an operation originated from a Device or Cloud (AVS).
Definition: Requester.h:24
std::string streamingStateToString(Bluetooth::StreamingState state)
Definition: Bluetooth.h:1120
Base class for a BluetoothEvent.
Definition: BluetoothEvents.h:66

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