AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
Generic observer operations interface. More...
#include <NotifierInterface.h>
Public Member Functions | |
virtual | ~NotifierInterface ()=default |
virtual void | addObserver (const std::shared_ptr< ObserverType > &observer)=0 |
Add an observer. More... | |
virtual void | removeObserver (const std::shared_ptr< ObserverType > &observer)=0 |
Remove an observer. More... | |
virtual void | addWeakPtrObserver (const std::weak_ptr< ObserverType > &observer)=0 |
Add a weak reference to an observer. More... | |
virtual void | removeWeakPtrObserver (const std::weak_ptr< ObserverType > &observer)=0 |
Remove an observer. More... | |
virtual void | notifyObservers (std::function< void(const std::shared_ptr< ObserverType > &)> notify)=0 |
Notify the observers in the order that they were added. More... | |
virtual bool | notifyObserversInReverse (std::function< void(const std::shared_ptr< ObserverType > &)> notify)=0 |
Notify the observers in the reverse order that they were added. More... | |
virtual void | setAddObserverFunction (std::function< void(const std::shared_ptr< ObserverType > &)> postAddFunc)=0 |
Set a function for notifications on an observer additions. More... | |
Generic observer operations interface.
Interface for maintaining a set of observers that are notified with a caller defined function.
ObserverType | The type of observer notified by the template instantiation. |
|
virtualdefault |
Destructor.
|
pure virtual |
Add an observer.
Method adds a strong reference to observer. If the same observer has already been added as a strong or weak reference, the method does nothing.
If the observer function has been installed prior to this call, it will be invoked with the newly added observer.
[in] | observer | The observer to add. If observer is nullptr, the method does nothing. |
Notifier
will no longer maintain the life cycle of its observers
. Please start using the new addWeakPtrObserver()
API instead. Implemented in alexaClientSDK::notifier::Notifier< ObserverType >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaInputControllerInterfaces::InputControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaChannelControllerInterfaces::ChannelControllerObserverInterface >, alexaClientSDK::notifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::notifier::Notifier< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaLiveViewControllerInterfaces::LiveViewControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::notifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::GUIActivityEventObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, and alexaClientSDK::notifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.
|
pure virtual |
Add a weak reference to an observer.
Method adds a weak reference to observer. If the same observer has already been added as a strong or weak reference, the method does nothing.
If the observer function has been installed prior to this call, it will be invoked with the newly added observer.
[in] | observer | The observer to add. If observer is nullptr, the method does nothing. |
Implemented in alexaClientSDK::acsdkAssets::client::ArtifactWrapper, alexaClientSDK::notifier::Notifier< ObserverType >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaInputControllerInterfaces::InputControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaChannelControllerInterfaces::ChannelControllerObserverInterface >, alexaClientSDK::notifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::notifier::Notifier< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaLiveViewControllerInterfaces::LiveViewControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::notifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::GUIActivityEventObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, and alexaClientSDK::notifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.
|
pure virtual |
Notify the observers in the order that they were added.
[in] | notify | The function to invoke to notify an observer. |
Implemented in alexaClientSDK::notifier::Notifier< ObserverType >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaInputControllerInterfaces::InputControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaChannelControllerInterfaces::ChannelControllerObserverInterface >, alexaClientSDK::notifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::notifier::Notifier< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaLiveViewControllerInterfaces::LiveViewControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::notifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::GUIActivityEventObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, and alexaClientSDK::notifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.
|
pure virtual |
Notify the observers in the reverse order that they were added.
notify | The function to invoke to notify an observer. |
Implemented in alexaClientSDK::notifier::Notifier< ObserverType >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaInputControllerInterfaces::InputControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaChannelControllerInterfaces::ChannelControllerObserverInterface >, alexaClientSDK::notifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::notifier::Notifier< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaLiveViewControllerInterfaces::LiveViewControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::notifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::GUIActivityEventObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, and alexaClientSDK::notifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.
|
pure virtual |
Remove an observer.
Method removes a strong or weak reference to observer. If the class doesn't have a strong or weak reference to observer, the method does nothing.
[in] | observer | The observer to remove. If observer is nullptr, the method does nothing. |
Notifier
will no longer maintain the life cycle of its observers
. Please start using the new removeWeakPtrObserver()
API instead. Implemented in alexaClientSDK::notifier::Notifier< ObserverType >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaInputControllerInterfaces::InputControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaChannelControllerInterfaces::ChannelControllerObserverInterface >, alexaClientSDK::notifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::notifier::Notifier< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaLiveViewControllerInterfaces::LiveViewControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::notifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::GUIActivityEventObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, and alexaClientSDK::notifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.
|
pure virtual |
Remove an observer.
Method removes a strong or weak reference to observer. If the class doesn't have a strong or weak reference to observer, the method does nothing.
[in] | observer | The observer to remove. If observer is nullptr, the method does nothing. |
Implemented in alexaClientSDK::acsdkAssets::client::ArtifactWrapper, alexaClientSDK::notifier::Notifier< ObserverType >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaInputControllerInterfaces::InputControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaChannelControllerInterfaces::ChannelControllerObserverInterface >, alexaClientSDK::notifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::notifier::Notifier< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaLiveViewControllerInterfaces::LiveViewControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::notifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::GUIActivityEventObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, and alexaClientSDK::notifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.
|
pure virtual |
Set a function for notifications on an observer additions.
Set the function to be called after an observer is added (for example, to notify the newly-added observer of the current state).
If there's any observers that were added before setAddObserverFunction
is called, those added observers will be notified as well.
Use caution when setting this function. The function MUST be reentrant, or else you run the risk of deadlock. When an observer adds itself to a NotifierInterface
, this function will be called in the same context.
[in] | postAddFunc | The function to call after an observer is added. |
Implemented in alexaClientSDK::notifier::Notifier< ObserverType >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaInputControllerInterfaces::InputControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkCommunicationInterfaces::CommunicationPropertyChangeSubscriber< T > >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaChannelControllerInterfaces::ChannelControllerObserverInterface >, alexaClientSDK::notifier::Notifier< clientInterfaces::ArtifactChangeObserver >, alexaClientSDK::notifier::Notifier< aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface >, alexaClientSDK::notifier::Notifier< alexaClientSDK::alexaLiveViewControllerInterfaces::LiveViewControllerObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkSystemClockMonitorInterfaces::SystemClockMonitorObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkNotificationsInterfaces::NotificationsObserverInterface >, alexaClientSDK::notifier::Notifier< avsCommon::utils::RequiresShutdown >, alexaClientSDK::notifier::Notifier< avsCommon::sdkInterfaces::GUIActivityEventObserverInterface >, alexaClientSDK::notifier::Notifier< acsdkStartupManagerInterfaces::RequiresStartupInterface >, and alexaClientSDK::notifier::Notifier< acsdkBluetoothInterfaces::BluetoothDeviceObserverInterface >.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0