41 const String& server_address, uint16_t server_port,
42 bool use_mdns =
true);
55 return delta_tx_count_producer_;
64 return delta_rx_count_producer_;
93 String server_address_ =
"";
94 uint16_t server_port_ = 80;
96 String conf_server_address_ =
"";
97 uint16_t conf_server_port_ = 0;
98 bool use_mdns_ =
true;
100 String client_id_ =
"";
101 String polling_href_ =
"";
102 String auth_token_ = NULL_AUTH_TOKEN;
103 bool server_detected_ =
false;
104 bool token_test_success_ =
false;
116 WiFiClient wifi_client_{};
117 esp_websocket_client_handle_t client_{};
118 SKDeltaQueue* sk_delta_queue_;
120 TaskQueueProducer<int> delta_tx_tick_producer_ =
122 Integrator<int, int> delta_tx_count_producer_{1, 0,
""};
123 Integrator<int, int> delta_rx_count_producer_{1, 0,
""};
125 SemaphoreHandle_t received_updates_semaphore_ =
126 xSemaphoreCreateRecursiveMutex();
127 std::list<JsonDocument> received_updates_{};
132 bool take_received_updates_semaphore(
unsigned long int timeout_ms = 0) {
133 if (timeout_ms == 0) {
134 return xSemaphoreTake(received_updates_semaphore_, portMAX_DELAY) ==
137 return xSemaphoreTake(received_updates_semaphore_, timeout_ms) == pdTRUE;
140 void release_received_updates_semaphore() {
141 xSemaphoreGive(received_updates_semaphore_);
147 void process_received_updates();
153 void test_token(
const String host,
const uint16_t port);
154 void send_access_request(
const String host,
const uint16_t port);
155 void poll_access_request(
const String host,
const uint16_t port,
157 void connect_ws(
const String& host,
const uint16_t port);
158 void subscribe_listeners();
159 bool get_mdns_service(String& server_address, uint16_t& server_port);
162 task_connection_state_ = state;
163 connection_state_.
set(state);