A base class for all objects that are capable of sending "requests" to the SignalK server (and optionally receiving the responses) according to the specification located at https://signalk.org/specification/1.5.0/doc/request_response.html.
More...
#include <sensesp/signalk/signalk_put_request.h>
|
| static String | send_request (JsonDocument &request, std::function< void(JsonDocument &)> callback, uint32_t timeout=5000) |
| static void | handle_response (JsonDocument &response) |
A base class for all objects that are capable of sending "requests" to the SignalK server (and optionally receiving the responses) according to the specification located at https://signalk.org/specification/1.5.0/doc/request_response.html.
Definition at line 19 of file signalk_put_request.h.
◆ get_request()
Returns the pending request object associated with request_id, or nullptr if no such id is found.
Definition at line 56 of file signalk_put_request.cpp.
◆ handle_response()
| void sensesp::SKRequest::handle_response |
( |
JsonDocument & | response | ) |
|
|
static |
Is called by the web socket code to handle any incoming request responses that is receives.
Definition at line 64 of file signalk_put_request.cpp.
◆ remove_request()
| void sensesp::SKRequest::remove_request |
( |
String | request_id | ) |
|
|
staticprotected |
Removes the specified request_id from the request_map, cleaning up outstanding events if necessary
Definition at line 84 of file signalk_put_request.cpp.
◆ send_request()
| String sensesp::SKRequest::send_request |
( |
JsonDocument & | request, |
|
|
std::function< void(JsonDocument &)> | callback, |
|
|
uint32_t | timeout = 5000 ) |
|
static |
Sends the specified request to the server via the connected websocket.
- Parameters
-
| request | The json document to send for the request. This document should follow the formats specified in the SignalK Request/Response specification with the exception that it should not contain a "requestId" (as this method will add it). |
| callback | The callback method that processes any and all responses from the server that correspond to the request. |
| timeout | The number of milliseconds to wait for a COMPLETED or FAILED response to be received from the server |
- Returns
- The request Id that is sent to the server.
Definition at line 13 of file signalk_put_request.cpp.
◆ request_map_
A map to hold all of the requests we are expecting future responses from...
Definition at line 55 of file signalk_put_request.h.
◆ request_map_mutex_
| SemaphoreHandle_t sensesp::SKRequest::request_map_mutex_ |
|
staticprotected |
Initial value: =
static StaticSemaphore_t request_map_mutex_buffer_
Definition at line 61 of file signalk_put_request.h.
◆ request_map_mutex_buffer_
| StaticSemaphore_t sensesp::SKRequest::request_map_mutex_buffer_ |
|
staticprotected |
Mutex to protect request_map_ from concurrent access. Uses static allocation to avoid calling FreeRTOS APIs during C++ static initialization (before the scheduler is running).
Definition at line 60 of file signalk_put_request.h.
The documentation for this class was generated from the following files: