3#include <WebSocketsClient.h>
18static const char* NULL_AUTH_TOKEN =
"";
40 virtual void start()
override;
54 return delta_count_producer_;
83 String server_address_ =
"";
86 String conf_server_address_ =
"";
91 String auth_token_ = NULL_AUTH_TOKEN;
92 bool server_detected_ =
false;
93 bool token_test_success_ =
false;
110 std::list<JsonObject> received_updates_;
115 bool take_received_updates_semaphore(
unsigned long int timeout_ms = 0) {
120 return xSemaphoreTake(received_updates_semaphore_, timeout_ms) == pdTRUE;
123 void release_received_updates_semaphore() {
124 xSemaphoreGive(received_updates_semaphore_);
130 void process_received_updates();
136 void test_token(
const String host,
const uint16_t port);
137 void send_access_request(
const String host,
const uint16_t port);
138 void poll_access_request(
const String host,
const uint16_t port,
140 void connect_ws(
const String host,
const uint16_t port);
141 void subscribe_listeners();
142 bool get_mdns_service(String& server_address, uint16_t& server_port);
145 task_connection_state_ = state;
146 connection_state_.set(state);
An object that is capable of having configuration data that can be set remotely using a RESTful API,...
Automatic calling of the start() method at startup.
A base class for any sensor or piece of code that outputs a value for consumption elsewhere.
The websocket connection to the Signal K server.
void on_disconnected()
Called when the websocket connection is disconnected.
void on_receive_delta(uint8_t *payload)
Called when the websocket receives a delta.
virtual void get_configuration(JsonObject &doc) override final
void on_error()
Called when the websocket connection encounters an error.
virtual void start() override
void on_connected(uint8_t *payload)
Called when the websocket connection is established.
void on_receive_updates(DynamicJsonDocument &message)
Called when a delta update is received.
virtual String get_config_schema() override
String get_connection_status()
Get a String representation of the current connection state.
const String get_server_address() const
void on_receive_put(DynamicJsonDocument &message)
Called when a PUT event is received.
void sendTXT(String &payload)
Send some processed data to the websocket.
const uint16_t get_server_port() const
ValueProducer< int > & get_delta_count_producer()
virtual bool set_configuration(const JsonObject &config) override final