SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
signalk_delta_queue.h
Go to the documentation of this file.
1#ifndef SENSESP_SIGNALK_DELTA_QUEUE_H_
2#define SENSESP_SIGNALK_DELTA_QUEUE_H_
3
4#include <ArduinoJson.h>
5#include <list>
6
7namespace sensesp {
8
17 public:
18 SKDeltaQueue(unsigned int max_buffer_size = 20);
19 void append(const String& val);
20 bool data_available();
21 void get_delta(String& output);
22
23 void connect_emitters();
24
29 this->meta_sent_ = false;
31 }
32
33 bool take_semaphore(uint64_t timeout_ms = 0);
34 void release_semaphore();
35
36 private:
37 unsigned int max_buffer_size;
38 std::list<String> buffer{};
39 bool meta_sent_;
40
41 unsigned int get_doc_size_estimate();
42 unsigned int get_metadata_size_estimate();
43
44 std::size_t get_buffer_size() {
45 std::size_t size;
47 size = buffer.size();
49 return size;
50 }
51
52 // Adds Signal K meta data to the specified document
53 void add_metadata(JsonArray updates);
54
55 SemaphoreHandle_t semaphore_ = NULL;
56};
57
58} // namespace sensesp
59
60#endif
Signal K delta queue.
SKDeltaQueue(unsigned int max_buffer_size=20)
void get_delta(String &output)
bool take_semaphore(uint64_t timeout_ms=0)
void append(const String &val)