![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <BluetoothEventBus.h>
Public Types | |
using | ListenerList = std::list< std::weak_ptr< BluetoothEventListenerInterface > > |
Public Member Functions | |
BluetoothEventBus () | |
void | sendEvent (const BluetoothEvent &event) |
void | addListener (const std::vector< BluetoothEventType > &eventTypes, std::shared_ptr< BluetoothEventListenerInterface > listener) |
void | removeListener (const std::vector< BluetoothEventType > &eventTypes, std::shared_ptr< BluetoothEventListenerInterface > listener) |
Static Public Member Functions | |
static std::shared_ptr< BluetoothEventBus > | createBluetoothEventBus () |
Event bus class for Bluetooth CA. Publishes Bluetooth events to all listeners.
using alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventBus::ListenerList = std::list<std::weak_ptr<BluetoothEventListenerInterface> > |
A type representing a collection of EventListener
objects.
alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventBus::BluetoothEventBus | ( | ) |
Constructor
void alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventBus::addListener | ( | const std::vector< BluetoothEventType > & | eventTypes, |
std::shared_ptr< BluetoothEventListenerInterface > | listener | ||
) |
Adds a listener to the bus.
eventTypes | A list of event types to subscribe listener to. |
listener | An EventListener<EventT> object to add as a listener. Listener cannot be registered multiple times for the same BluetoothEventType. |
|
static |
Factory method to create a shared pointer to BluetoothEventBus
.
BluetoothEventBus
. void alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventBus::removeListener | ( | const std::vector< BluetoothEventType > & | eventTypes, |
std::shared_ptr< BluetoothEventListenerInterface > | listener | ||
) |
Removes a listener from the EventBus
.
eventTypes | A list of event types to unsubscribe listener from. |
listener | Listener object to unsubscribe. |
void alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventBus::sendEvent | ( | const BluetoothEvent & | event | ) |
Send the event to EventBus
. Method blocks until all the listeners process the event. The method is thread safe.
event | Event to be sent to EventBus |
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0