SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
sensesp::SKPutRequest< T > Class Template Reference

Used to send requests to the server to change the value of the specified path to a specific value according to the specification at https://signalk.org/specification/1.5.0/doc/put.html. More...

#include <sensesp/signalk/signalk_put_request.h>

Inheritance diagram for sensesp::SKPutRequest< T >:
[legend]

Public Member Functions

 SKPutRequest (String sk_path, String config_path="", bool ignore_duplicates=true, uint32_t timeout=5000)
 
virtual void set (const T &new_value) override
 
virtual void set_put_value (JsonObject &put_data) override
 
- Public Member Functions inherited from sensesp::SKPutRequestBase
 SKPutRequestBase (const String &sk_path, const String &config_path="", uint32_t timeout=5000)
 
virtual bool to_json (JsonObject &root) override
 
virtual bool from_json (const JsonObject &config) override
 
String get_sk_path ()
 
bool request_pending ()
 
- Public Member Functions inherited from sensesp::FileSystemSaveable
 FileSystemSaveable (const String &config_path)
 
virtual bool load () override
 Load and populate the object from a persistent storage.
 
virtual bool save () override
 Save the object to a persistent storage.
 
virtual bool clear () override
 Delete the data from a persistent storage.
 
bool find_config_file (const String &config_path, String &filename)
 
- Public Member Functions inherited from sensesp::Saveable
 Saveable (const String &config_path)
 
virtual bool refresh ()
 Refresh the object. This may or may not access the persistent storage but is not expected to overwrite the object's state.
 
const String & get_config_path () const
 
- Public Member Functions inherited from sensesp::Serializable
- Public Member Functions inherited from sensesp::ValueConsumer< T >
virtual void set_input (const T &new_value)
 
void connect_from (ValueProducer< T > *producer)
 

Protected Attributes

value_
 
bool ignore_duplicates_
 
- Protected Attributes inherited from sensesp::SKPutRequestBase
String sk_path {}
 
uint32_t timeout {}
 
String pending_request_id_ {}
 
- Protected Attributes inherited from sensesp::Saveable
const String config_path_
 

Additional Inherited Members

- Public Types inherited from sensesp::ValueConsumer< T >
using input_type = T
 
- Static Public Member Functions inherited from sensesp::SKRequest
static String send_request (JsonDocument &request, std::function< void(JsonDocument &)> callback, uint32_t timeout=5000)
 
static void handle_response (JsonDocument &response)
 
- Protected Member Functions inherited from sensesp::SKPutRequestBase
void send_put_request ()
 
virtual void on_response (JsonDocument &response)
 
- Static Protected Member Functions inherited from sensesp::SKRequest
static void remove_request (String request_id)
 
static PendingRequestget_request (String request_id)
 
- Static Protected Attributes inherited from sensesp::SKRequest
static std::map< String, PendingRequest * > request_map_
 

Detailed Description

template<typename T>
class sensesp::SKPutRequest< T >

Used to send requests to the server to change the value of the specified path to a specific value according to the specification at https://signalk.org/specification/1.5.0/doc/put.html.

Definition at line 133 of file signalk_put_request.h.

Constructor & Destructor Documentation

◆ SKPutRequest()

template<typename T >
sensesp::SKPutRequest< T >::SKPutRequest ( String sk_path,
String config_path = "",
bool ignore_duplicates = true,
uint32_t timeout = 5000 )
inline

The constructor

Parameters
sk_pathThe SignalK path the put request will be made on
config_pathThe configuration path to save the configuration
ignore_duplicatesTRUE if incoming values that have not changed since the last one should not generated a PUT request
timeoutThe number of milliseconds to wait for a COMPLETED or FAILED response to be received from the server

Definition at line 145 of file signalk_put_request.h.

Member Function Documentation

◆ set()

template<typename T >
virtual void sensesp::SKPutRequest< T >::set ( const T & new_value)
inlineoverridevirtual

Used to set an input of this consumer. It is called automatically by a ValueProducer but can also be called manually.

Parameters
new_valuethe value of the input

Reimplemented from sensesp::ValueConsumer< T >.

Definition at line 150 of file signalk_put_request.h.

Here is the call graph for this function:

◆ set_put_value()

template<typename T >
virtual void sensesp::SKPutRequest< T >::set_put_value ( JsonObject & put_data)
inlineoverridevirtual

Sets the "value" field of the put request with the appropriate value.

Implements sensesp::SKPutRequestBase.

Definition at line 163 of file signalk_put_request.h.

Member Data Documentation

◆ ignore_duplicates_

template<typename T >
bool sensesp::SKPutRequest< T >::ignore_duplicates_
protected

Definition at line 169 of file signalk_put_request.h.

◆ value_

template<typename T >
T sensesp::SKPutRequest< T >::value_
protected

Definition at line 168 of file signalk_put_request.h.


The documentation for this class was generated from the following file: