AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Types | Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventBus Class Reference

#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< BluetoothEventBuscreateBluetoothEventBus ()
 

Detailed Description

Event bus class for Bluetooth CA. Publishes Bluetooth events to all listeners.

Member Typedef Documentation

◆ ListenerList

A type representing a collection of EventListener objects.

Constructor & Destructor Documentation

◆ BluetoothEventBus()

alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventBus::BluetoothEventBus ( )

Constructor

Member Function Documentation

◆ addListener()

void alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventBus::addListener ( const std::vector< BluetoothEventType > &  eventTypes,
std::shared_ptr< BluetoothEventListenerInterface listener 
)

Adds a listener to the bus.

Parameters
eventTypesA list of event types to subscribe listener to.
listenerAn EventListener<EventT> object to add as a listener. Listener cannot be registered multiple times for the same BluetoothEventType.

◆ createBluetoothEventBus()

std::shared_ptr< BluetoothEventBus > alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventBus::createBluetoothEventBus ( )
static

Factory method to create a shared pointer to BluetoothEventBus.

Returns
A new instance of BluetoothEventBus.

◆ removeListener()

void alexaClientSDK::avsCommon::utils::bluetooth::BluetoothEventBus::removeListener ( const std::vector< BluetoothEventType > &  eventTypes,
std::shared_ptr< BluetoothEventListenerInterface listener 
)

Removes a listener from the EventBus.

Parameters
eventTypesA list of event types to unsubscribe listener from.
listenerListener object to unsubscribe.

◆ sendEvent()

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.

Parameters
eventEvent to be sent to EventBus

The documentation for this class was generated from the following files:

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