Shared attribute update callback wrapper, contains the needed configuration settings to create the request that should be sent to the server. Documentation about the specific use of shared attribute update in ThingsBoard can be found here https://thingsboard.io/docs/reference/mqtt-api/#subscribe-to-attribute-updates-from-the-server.
More...
#include <Shared_Attribute_Callback.h>
|
| | Shared_Attribute_Callback ()=default |
| | Constructs empty callback, will result in never being called. Internals are simply default constructed as nullptr. More...
|
| |
| template<typename... Args> |
| | Shared_Attribute_Callback (function callback, Args const &... args) |
| | Constructs callback, will be called upon shared attribute update arrival, where atleast one of the given multiple shared attributes subscribed was updated by the cloud. More...
|
| |
| | ~Shared_Attribute_Callback () override=default |
| |
| CString_Container const & | Get_Attributes () const |
| | Gets all the subscribed shared attributes that will result in the callback method being called if any of those attributes values is changed by the cloud. More...
|
| |
| template<typename... Args> |
| void | Set_Attributes (Args const &... args) |
| | Sets all the subscribed shared attributes that will result in the callback method being called if any of those attributes values is changed by the cloud. More...
|
| |
| | Callback ()=default |
| | Constructs empty callback, will result in never being called. Internals are simply default constructed as nullptr. More...
|
| |
| | Callback (function callback) |
| | Constructor. More...
|
| |
| virtual | ~Callback ()=default |
| | Virtual default destructor, created to ensure that if a pointer to this class is used and deleted, we will also call the derived base class destructor. More...
|
| |
| void | Call_Callback (argument_types const &... arguments) const |
| | Calls the callback that was subscribed, when this class instance was initally created. More...
|
| |
| void | Set_Callback (function callback) |
| | Sets the callback method that will be called upon data arrival with the given data that was received. If nullptr is passed the callback will never be called and instead return with a defaulted instance of the requested return variable. More...
|
| |
template<
size_t MaxAttributes = DEFAULT_ATTRIBUTES_AMOUNT>
class Shared_Attribute_Callback< MaxAttributes >
Shared attribute update callback wrapper, contains the needed configuration settings to create the request that should be sent to the server. Documentation about the specific use of shared attribute update in ThingsBoard can be found here https://thingsboard.io/docs/reference/mqtt-api/#subscribe-to-attribute-updates-from-the-server.
- Template Parameters
-
| MaxAttributes | Maximum amount of attributes that will ever be requested with this instance of the class, allows to use an array on the stack in the background. Be aware though the size set in this template and the size passed to the ThingsBoard MaxAttributes template need to be the same or the value in this class lower, if not some of the requested keys may be lost, default = DEFAULT_ATTRIBUTES_AMOUNT (1) |
◆ Shared_Attribute_Callback() [1/2]
template<
size_t MaxAttributes = DEFAULT_ATTRIBUTES_AMOUNT>
Constructs empty callback, will result in never being called. Internals are simply default constructed as nullptr.
◆ Shared_Attribute_Callback() [2/2]
template<
size_t MaxAttributes = DEFAULT_ATTRIBUTES_AMOUNT>
template<typename... Args>
Constructs callback, will be called upon shared attribute update arrival, where atleast one of the given multiple shared attributes subscribed was updated by the cloud.
- Note
- If the update does not include any of the given shared attributes the callback is not called.
-
Directly forwards the given arguments to the overloaded Container constructor, meaning all combinatons of arguments that would initalize an std::vector can be used to call this constructor. See possible std::vector constructors here https://en.cppreference.com/w/cpp/container/vector/vector, for the possible passable parameters. The possibilites mainly consist out of the fill constructor, where a number n and a value is given and then the value is copied into that many elements, alternatively if no value is given the default constructed value is copied n times instead, or the range constructor where we can pass an interator to the start and to the end of the data container (last element + 1) to copy every element in between thoose iterators, in the same order as in the original data container. The last option is a copy constructor where we pass another container and all the values of that container will be copied into our buffer
- Template Parameters
-
| ...Args | Holds the multiple arguments that will simply be forwarded to the container constructor and therefore allow to use every overloaded constructor without having to explicitly implement them |
- Parameters
-
| callback | callback method that will be called upon data arrival with the given data that was received. If nullptr is passed the callback will never be called and instead return with a defaulted instance of the requested return variable |
| ...args | Attributes to suscribe, that will be forwarded into the overloaded Container constructor see https://en.cppreference.com/w/cpp/container/vector/vector for more information |
◆ ~Shared_Attribute_Callback()
template<
size_t MaxAttributes = DEFAULT_ATTRIBUTES_AMOUNT>
◆ Get_Attributes()
template<
size_t MaxAttributes = DEFAULT_ATTRIBUTES_AMOUNT>
Gets all the subscribed shared attributes that will result in the callback method being called if any of those attributes values is changed by the cloud.
- Returns
- Subscribed shared attributes
◆ Set_Attributes()
template<
size_t MaxAttributes = DEFAULT_ATTRIBUTES_AMOUNT>
template<typename... Args>
Sets all the subscribed shared attributes that will result in the callback method being called if any of those attributes values is changed by the cloud.
- Note
- Directly forwards the given arguments to the overloaded Container constructor, meaning all combinatons of arguments that would initalize an std::vector can be used to call this constructor. See possible std::vector constructors here https://en.cppreference.com/w/cpp/container/vector/vector, for the possible passable parameters. The possibilites mainly consist out of the fill constructor, where a number n and a value is given and then the value is copied into that many elements, alternatively if no value is given the default constructed value is copied n times instead, or the range constructor where we can pass an interator to the start and to the end of the data container (last element + 1) to copy every element in between thoose iterators, in the same order as in the original data container. The last option is a copy constructor where we pass another container and all the values of that container will be copied into our buffer
- Template Parameters
-
| ...Args | Holds the multiple arguments that will simply be forwarded to the Container assign method and therefore allow to use every overloaded Container assign without having to implement them |
- Parameters
-
The documentation for this class was generated from the following file: