|
| | Server_Side_RPC ()=default |
| | Constructor. More...
|
| |
| | ~Server_Side_RPC () override=default |
| |
| template<typename InputIterator > |
| bool | RPC_Subscribe (InputIterator const &first, InputIterator const &last) |
| | Subscribes multiple server-side RPC callbacks, that will be called if a request from the server for the method with the given name is received. More...
|
| |
| bool | RPC_Subscribe (RPC_Callback const &callback) |
| | Subscribe one server-side RPC callback, that will be called if a request from the server for the method with the given name is received. More...
|
| |
| bool | RPC_Unsubscribe () |
| | Unsubcribes all server-side RPC callbacks. See https://thingsboard.io/docs/user-guide/rpc/#server-side-rpc for more information. More...
|
| |
| API_Process_Type | Get_Process_Type () const override |
| | Returns the way the server response should be processed. More...
|
| |
| void | Process_Response (char const *topic, uint8_t *payload, uint32_t length) override |
| | Process callback that will be called upon response arrival. More...
|
| |
| void | Process_Json_Response (char const *topic, JsonDocument const &data) override |
| | Process callback that will be called upon response arrival. More...
|
| |
| bool | Is_Response_Topic_Matching (char const *topic) const override |
| | Compares received response topic and the topic this api implementation handles responses on, messages from all other topics are ignored and only messages from topics that match are handled. More...
|
| |
| bool | Unsubscribe () override |
| | Unsubcribes all callbacks, to clear up any ongoing subscriptions and stop receiving information over the previously subscribed topic. More...
|
| |
| bool | Resubscribe_Permanent_Subscriptions () override |
| | Forwards the call to let the API clear up any ongoing single-event subscriptions (Provision, Attribute Request, RPC Request) and simply resubscribes the topic for all permanent subscriptions (RPC, Shared Attribute Update) More...
|
| |
| void | loop () override |
| | Internal loop method to update inernal timers for API calls that can timeout. More...
|
| |
| void | Initialize () override |
| | Method that allows to construct internal objects, after the required callback member methods have been set already. More...
|
| |
| void | Set_Client_Callbacks (Callback< void, IAPI_Implementation & >::function subscribe_api_callback, Callback< bool, char const *const, JsonDocument const & >::function send_json_callback, Callback< bool, char const *const, char const *const >::function send_json_string_callback, Callback< bool, char const *const >::function subscribe_topic_callback, Callback< bool, char const *const >::function unsubscribe_topic_callback, Callback< uint16_t >::function get_receive_size_callback, Callback< uint16_t >::function get_send_size_callback, Callback< bool, uint16_t, uint16_t >::function set_buffer_size_callback, Callback< size_t * >::function get_request_id_callback) override |
| | Sets the underlying callbacks that are required for the different API Implementation to communicate with the cloud. More...
|
| |
| virtual | ~IAPI_Implementation () |
| | 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...
|
| |
| virtual API_Process_Type | Get_Process_Type () const =0 |
| | Returns the way the server response should be processed. More...
|
| |
| virtual void | Process_Response (char const *topic, uint8_t *payload, uint32_t length)=0 |
| | Process callback that will be called upon response arrival. More...
|
| |
| virtual void | Process_Json_Response (char const *topic, JsonDocument const &data)=0 |
| | Process callback that will be called upon response arrival. More...
|
| |
| virtual bool | Is_Response_Topic_Matching (char const *topic) const =0 |
| | Compares received response topic and the topic this api implementation handles responses on, messages from all other topics are ignored and only messages from topics that match are handled. More...
|
| |
| virtual bool | Unsubscribe ()=0 |
| | Unsubcribes all callbacks, to clear up any ongoing subscriptions and stop receiving information over the previously subscribed topic. More...
|
| |
| virtual bool | Resubscribe_Permanent_Subscriptions ()=0 |
| | Forwards the call to let the API clear up any ongoing single-event subscriptions (Provision, Attribute Request, RPC Request) and simply resubscribes the topic for all permanent subscriptions (RPC, Shared Attribute Update) More...
|
| |
| virtual void | loop ()=0 |
| | Internal loop method to update inernal timers for API calls that can timeout. More...
|
| |
| virtual void | Initialize ()=0 |
| | Method that allows to construct internal objects, after the required callback member methods have been set already. More...
|
| |
| virtual void | Set_Client_Callbacks (Callback< void, IAPI_Implementation & >::function subscribe_api_callback, Callback< bool, char const *const, JsonDocument const & >::function send_json_callback, Callback< bool, char const *const, char const *const >::function send_json_string_callback, Callback< bool, char const *const >::function subscribe_topic_callback, Callback< bool, char const *const >::function unsubscribe_topic_callback, Callback< uint16_t >::function get_receive_size_callback, Callback< uint16_t >::function get_send_size_callback, Callback< bool, uint16_t, uint16_t >::function set_buffer_size_callback, Callback< size_t * >::function get_request_id_callback)=0 |
| | Sets the underlying callbacks that are required for the different API Implementation to communicate with the cloud. More...
|
| |
template<
size_t MaxSubscriptions = DEFAULT_SUBSCRIPTION_AMOUNT,
size_t MaxRPC = DEFAULT_RPC_AMOUNT, typename Logger = DefaultLogger>
class Server_Side_RPC< MaxSubscriptions, MaxRPC, Logger >
Handles the internal implementation of the ThingsBoard server-side RPC API. See https://thingsboard.io/docs/user-guide/rpc/#server-side-rpc for more information.
- Template Parameters
-
| Logger | Implementation that should be used to print error messages generated by internal processes and additional debugging messages if THINGSBOARD_ENABLE_DEBUG is set, default = DefaultLogger |
| MaxSubscriptions | Maximum amount of simultaneous server-side RPC subscriptions. Once the maximum amount has been reached it is not possible to increase the size, this is done because it allows to allcoate the memory on the stack instead of the heap, default = DEFAULT_SUBSCRIPTION_AMOUNT (1) |
| MaxRPC | Maximum amount of key-value pairs that will ever be sent in the subscribed callback method of an RPC_Callback, allows to use a StaticJsonDocument on the stack in the background. If we simply use .to<JsonVariant>(); on the received document and use .set() to change the internal value then the size requirements are 0. However if we attempt to send multiple key-value pairs, we have to adjust the size accordingly. See https://arduinojson.org/v6/assistant/ for more information on how to estimate the required size and divide the result by 16 to receive the required MaxRPC value, default = DEFAULT_RPC_AMOUNT (0) |