![]() |
ThingsBoard Client SDK 0.16.0
Client SDK to connect with ThingsBoard IoT Platform from IoT devices (Arduino, Espressif, etc.)
|
General purpose request callback that can timeout if the response to the request is not received in the expected amount of time and the internal watchdog times out. More...
#include <Timeoutable_Request.h>
Public Member Functions | |
| Timeoutable_Request (uint64_t const &timeout_microseconds=0U, Callback_Watchdog::function timeout_callback=nullptr) | |
| Constructs request timeout callback. More... | |
| uint64_t const & | Get_Timeout () const |
| Gets the amount of microseconds until we expect to have received a response. More... | |
| void | Set_Timeout (uint64_t const &timeout_microseconds) |
| Sets the amount of microseconds until we expect to have received a response. More... | |
| void | Update_Timeout_Timer () |
| Updates the internal timeout timer. More... | |
| void | Start_Timeout_Timer () |
| Starts the internal timeout timer if we actually received a configured valid timeout time and a valid callback. More... | |
| void | Stop_Timeout_Timer () |
| Stops the internal timeout timer, is called as soon as an answer is received from the cloud. If this method is not called in time the initally subscribed callback will be used to inform the user of the timeout instead. More... | |
| 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 the cloud in the given timeout time) More... | |
General purpose request callback that can timeout if the response to the request is not received in the expected amount of time and the internal watchdog times out.
| Timeoutable_Request::Timeoutable_Request | ( | uint64_t const & | timeout_microseconds = 0U, |
| Callback_Watchdog::function | timeout_callback = nullptr |
||
| ) |
Constructs request timeout callback.
| timeout_microseconds | Amount of microseconds until a response should have been received from the server, counted from the moment the request is sent. If a response is not received in the timeout time, the timeout callback method will be called to inform the user that the request has failed. If the value is 0 the timer will not be started and therefore never call the timeout callback method, default = 0 |
| timeout_callback | Callback method that will be called upon request timeout (did not receive a response in the given timeout time). Can happen if the requested method does not exist on the cloud, or if the connection could not be established. A nullptr means even if a timeout occured the callback is simply ignored and the user not informed, default = nullptr |
| uint64_t const & Timeoutable_Request::Get_Timeout | ( | ) | const |
Gets the amount of microseconds until we expect to have received a response.
| void Timeoutable_Request::Set_Timeout | ( | uint64_t const & | timeout_microseconds | ) |
Sets the amount of microseconds until we expect to have received a response.
| timeout_microseconds | Timeout time until timeout callback is called |
| void Timeoutable_Request::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 the cloud in the given timeout time)
| timeout_callback | Callback function that will be called |
| void Timeoutable_Request::Start_Timeout_Timer | ( | ) |
Starts the internal timeout timer if we actually received a configured valid timeout time and a valid callback.
| void Timeoutable_Request::Stop_Timeout_Timer | ( | ) |
Stops the internal timeout timer, is called as soon as an answer is received from the cloud. If this method is not called in time the initally subscribed callback will be used to inform the user of the timeout instead.
| void Timeoutable_Request::Update_Timeout_Timer | ( | ) |
Updates the internal timeout timer.