1#ifndef SENSESP_SIGNALK_SIGNALK_PUT_REQUEST_H_
2#define SENSESP_SIGNALK_SIGNALK_PUT_REQUEST_H_
4#include <ArduinoJson.h>
34 std::function<
void(JsonDocument&)> callback,
35 uint32_t timeout = 5000);
88 virtual bool to_json(JsonObject& root)
override;
89 virtual bool from_json(
const JsonObject& config)
override;
146 bool ignore_duplicates =
true, uint32_t
timeout = 5000)
150 virtual void set(
const T& new_value)
override {
158 ESP_LOGW(__FILENAME__,
159 "Ignoring PUT request (previous request still outstanding)");
164 put_data[
"value"] =
value_;
174 static const char schema[] = R
"###({"type":"object","properties":{"sk_path":{"title":"Signal K Path","type":"string"}} })###";
A base class for all template variations of the PUT request class SKPutRequest. This base class keeps...
virtual void set_put_value(JsonObject &put_data)=0
SKPutRequestBase(const String &sk_path, const String &config_path="", uint32_t timeout=5000)
String pending_request_id_
virtual bool from_json(const JsonObject &config) override
virtual bool to_json(JsonObject &root) override
virtual void on_response(JsonDocument &response)
Used to send requests to the server to change the value of the specified path to a specific value acc...
SKPutRequest(String sk_path, String config_path="", bool ignore_duplicates=true, uint32_t timeout=5000)
virtual void set_put_value(JsonObject &put_data) override
virtual void set(const T &new_value) override
reactesp::DelayEvent * timeout_cleanup
std::function< void(JsonDocument &)> callback
A base class for all objects that are capable of sending "requests" to the SignalK server (and option...
static void handle_response(JsonDocument &response)
static String send_request(JsonDocument &request, std::function< void(JsonDocument &)> callback, uint32_t timeout=5000)
static PendingRequest * get_request(String request_id)
static std::map< String, PendingRequest * > request_map_
static void remove_request(String request_id)
A base class for piece of code (like a transform) that accepts data for input. ValueConsumers can acc...
const String ConfigSchema(const SmartSwitchController &obj)
SKPutRequest< int > IntSKPutRequest
SKPutRequest< bool > BoolSKPutRequest
SKPutRequest< float > FloatSKPutRequest
SKPutRequest< String > StringSKPutRequest