ThingsBoard Client SDK 0.16.0
Client SDK to connect with ThingsBoard IoT Platform from IoT devices (Arduino, Espressif, etc.)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
RPC_Callback Class Reference

Server-side RPC callback wrapper, contains the needed configuration settings to create the request that should be sent to the server. Documentation about the specific use of Server-side RPC in ThingsBoard can be found here https://thingsboard.io/docs/user-guide/rpc/#server-side-rpc. More...

#include <RPC_Callback.h>

Inheritance diagram for RPC_Callback:
[legend]
Collaboration diagram for RPC_Callback:
[legend]

Public Member Functions

 RPC_Callback ()=default
 Constructs empty callback, will result in never being called. Internals are simply default constructed as nullptr. More...
 
 RPC_Callback (char const *method_name, function callback)
 Constructs callback that will be called upon server-side RPC request arrival with the given method name. More...
 
 ~RPC_Callback () override=default
 
char const * Get_Name () const
 Gets the name we expect to be sent with the server-side RPC request so that this method callback will be executed. More...
 
void Set_Name (char const *method_name)
 Sets the name we expect to be sent with the server-side RPC request so that this method callback will be executed. More...
 
- Public Member Functions inherited from Callback< void, JsonVariantConst const &, JsonDocument & >
 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...
 

Additional Inherited Members

- Public Types inherited from Callback< void, JsonVariantConst const &, JsonDocument & >
using function = std::function< void(argument_types... arguments)>
 Callback signature. More...
 

Detailed Description

Server-side RPC callback wrapper, contains the needed configuration settings to create the request that should be sent to the server. Documentation about the specific use of Server-side RPC in ThingsBoard can be found here https://thingsboard.io/docs/user-guide/rpc/#server-side-rpc.

Constructor & Destructor Documentation

◆ RPC_Callback() [1/2]

RPC_Callback::RPC_Callback ( )
default

Constructs empty callback, will result in never being called. Internals are simply default constructed as nullptr.

◆ RPC_Callback() [2/2]

RPC_Callback::RPC_Callback ( char const *  method_name,
function  callback 
)
inline

Constructs callback that will be called upon server-side RPC request arrival with the given method name.

Parameters
method_nameNon owning pointer to the name we expect to be sent with the server-side RPC request so that this method callback will be executed. Additionally it has to be kept alive by the user for the lifetime of this server-side RPC callback, otherwise the callback method will never be called
callbackcallback 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. Sometimes the server-side RPC requests expectes a response that should be sent to the server, but can be empty if that is not the case as well. See https://arduinojson.org/v6/api/jsondocument/ for more information on how to enter data into a JsonDocument

◆ ~RPC_Callback()

RPC_Callback::~RPC_Callback ( )
overridedefault

Member Function Documentation

◆ Get_Name()

char const * RPC_Callback::Get_Name ( ) const
inline

Gets the name we expect to be sent with the server-side RPC request so that this method callback will be executed.

Returns
Non owning pointer to the name we expect to be sent with the server-side RPC request. Owned by the user that passed it originally in the constructor or with the Set_Name method

◆ Set_Name()

void RPC_Callback::Set_Name ( char const *  method_name)
inline

Sets the name we expect to be sent with the server-side RPC request so that this method callback will be executed.

Parameters
method_nameNon owning pointer to the name we expect to be sent with the server-side RPC request. Additionally it has to be kept alive by the user for the lifetime of this server-side RPC callback, otherwise the callback method will never be called

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