ThingsBoard Client SDK 0.16.0
Client SDK to connect with ThingsBoard IoT Platform from IoT devices (Arduino, Espressif, etc.)
Loading...
Searching...
No Matches
RPC_Request_Callback.h
Go to the documentation of this file.
1#ifndef RPC_Request_Callback_h
2#define RPC_Request_Callback_h
3
4// Local includes.
6
7
11class RPC_Request_Callback : public Callback<void, JsonDocument const &> {
12 public:
15
29 RPC_Request_Callback(char const * method_name, function callback, JsonArray const * parameters = nullptr, uint64_t const & timeout_microseconds = 0U, Callback_Watchdog::function timeout_callback = nullptr);
30
31 ~RPC_Request_Callback() override = default;
32
36 size_t const & Get_Request_ID() const;
37
43 void Set_Request_ID(size_t const & request_id);
44
48 char const * Get_Name() const;
49
53 void Set_Name(char const * method_name);
54
58 JsonArray const * Get_Parameters() const;
59
64 void Set_Parameters(JsonArray const * parameters);
65
71
72 private:
73 char const *m_method_name = {}; // Method name
74 JsonArray const *m_parameters = {}; // Parameter json
75 size_t m_request_id = {}; // Id the request was called with
76 Timeoutable_Request m_request_timeout = {}; // Handles callback that will be called if request times out
77};
78
79#endif // RPC_Request_Callback_h
General purpose safe callback wrapper. Expects either c-style or c++ style function pointer,...
Definition: Callback.h:30
std::function< void(argument_types... arguments)> function
Callback signature.
Definition: Callback.h:34
Client-side RPC callback wrapper, contains the needed configuration settings to create the request th...
Definition: RPC_Request_Callback.h:11
~RPC_Request_Callback() override=default
size_t const & Get_Request_ID() const
Gets the unique request identifier that is connected to the original request.
Definition: RPC_Request_Callback.cpp:14
Timeoutable_Request & Get_Request_Timeout()
Gets the request timeout callback.
Definition: RPC_Request_Callback.cpp:38
RPC_Request_Callback()=default
Constructs empty callback, will result in never being called. Internals are simply default constructe...
JsonArray const * Get_Parameters() const
Gets the paramaters we want to call the client-side RPC method on the cloud with.
Definition: RPC_Request_Callback.cpp:30
char const * Get_Name() const
Gets the name of the client-side RPC method we want to call on the cloud so that this method callback...
Definition: RPC_Request_Callback.cpp:22
void Set_Parameters(JsonArray const *parameters)
Sets the paramaters we want to call the client-side RPC method with on the cloud with.
Definition: RPC_Request_Callback.cpp:34
void Set_Request_ID(size_t const &request_id)
Sets the unique request identifier that is connected to the original request.
Definition: RPC_Request_Callback.cpp:18
void Set_Name(char const *method_name)
Sets the name of the client side RPC method we want to call on the cloud so that this method callback...
Definition: RPC_Request_Callback.cpp:26
General purpose request callback that can timeout if the response to the request is not received in t...
Definition: Timeoutable_Request.h:10