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 49 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 57 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 75 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 10 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.
The documentation for this class was generated from the following files: