AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <SettingCallbacks.h>
Public Types | |
template<size_t id> | |
using | ValueType = typename ManagerT::template ValueType< id > |
Setting value type. More... | |
template<size_t id> | |
using | FunctionType = std::function< void(const ValueType< id > &, SettingNotifications)> |
Callback function value type. More... | |
Public Member Functions | |
virtual | ~SettingCallbacks () |
template<size_t id> | |
bool | add (FunctionType< id > callback) |
void | removeAll () |
Static Public Member Functions | |
static std::shared_ptr< SettingCallbacks< ManagerT > > | create (std::shared_ptr< ManagerT > manager) |
The SettingCallbacks allow easy management of callbacks to monitor multiple settings with one object only.
This object can be used to register multiple callbacks that are member functions, lambdas and static functions. E.g.:
If you would like to listen notifications related to only one setting, see SettingEventCallback
class or extend the SettingObserverInterface
class.
SettingsT | Settings type enumeration. |
using alexaClientSDK::settings::SettingCallbacks< ManagerT >::FunctionType = std::function<void(const ValueType<id>&, SettingNotifications)> |
Callback function value type.
using alexaClientSDK::settings::SettingCallbacks< ManagerT >::ValueType = typename ManagerT::template ValueType<id> |
Setting value type.
|
virtual |
The destructor.
bool alexaClientSDK::settings::SettingCallbacks< ManagerT >::add | ( | SettingCallbacks< ManagerT >::FunctionType< id > | callback | ) |
Add a callback function to the setting with id
.
id | The property id. |
callback | The callback function. |
true
if it succeeds; false
otherwise.
|
static |
Create a SettingCallbacks object.
This method allow user to use static / lambda functions as the callbacks.
manager | The object that manages all settings. |
callback | The callback function for SettingT . |
otherCallbacks | The callback functions for the rest of the settings. |
nullptr
otherwise. void alexaClientSDK::settings::SettingCallbacks< ManagerT >::removeAll | ( | ) |
Disconnects the observed setting from all observed settings. This function also gets called by the destructor.
manager | The object that manages all settings. |
observer | The observer object to be disconnected. |
false
otherwise. AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0