ThingsBoard Client SDK 0.16.0
Client SDK to connect with ThingsBoard IoT Platform from IoT devices (Arduino, Espressif, etc.)
Loading...
Searching...
No Matches
Timeoutable_Request.h
Go to the documentation of this file.
1#ifndef Timeoutable_Request_h
2#define Timeoutable_Request_h
3
4// Local includes.
5#include "Callback_Watchdog.h"
6
7
11 public:
20 Timeoutable_Request(uint64_t const & timeout_microseconds = 0U, Callback_Watchdog::function timeout_callback = nullptr);
21
24 uint64_t const & Get_Timeout() const;
25
29 void Set_Timeout(uint64_t const & timeout_microseconds);
30
31#if !THINGSBOARD_USE_ESP_TIMER
34#endif // !THINGSBOARD_USE_ESP_TIMER
35
40
44 void Stop_Timeout_Timer();
45
49
50 private:
51 uint64_t m_timeout_microseconds = {}; // Timeout time until we expect response to request
52 Callback_Watchdog m_timeout_callback = {}; // Handles callback that will be called if request times out
53};
54
55#endif // Timeoutable_Request_h
Wrapper class which allows to start a timer and if it is not stopped in the given time then the inter...
Definition: Callback_Watchdog.h:31
std::function< void(argument_types... arguments)> function
Callback signature.
Definition: Callback.h:34
General purpose request callback that can timeout if the response to the request is not received in t...
Definition: Timeoutable_Request.h:10
void Set_Timeout_Callback(Callback_Watchdog::function timeout_callback)
Sets the callback method that will be called upon request timeout (did not receive a response from th...
Definition: Timeoutable_Request.cpp:36
uint64_t const & Get_Timeout() const
Gets the amount of microseconds until we expect to have received a response.
Definition: Timeoutable_Request.cpp:11
void Update_Timeout_Timer()
Updates the internal timeout timer.
Definition: Timeoutable_Request.cpp:20
void Set_Timeout(uint64_t const &timeout_microseconds)
Sets the amount of microseconds until we expect to have received a response.
Definition: Timeoutable_Request.cpp:15
void Start_Timeout_Timer()
Starts the internal timeout timer if we actually received a configured valid timeout time and a valid...
Definition: Timeoutable_Request.cpp:25
void Stop_Timeout_Timer()
Stops the internal timeout timer, is called as soon as an answer is received from the cloud....
Definition: Timeoutable_Request.cpp:32