SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
signalk_listener.h
Go to the documentation of this file.
1#ifndef _signalk_listener_H_
2#define _signalk_listener_H_
3
4#include <ArduinoJson.h>
5
6#include <set>
7
8#include "sensesp.h"
12
13namespace sensesp {
14static const char SIGNALKINPUT_SCHEMA[] PROGMEM = R"({
15 "type": "object",
16 "properties": {
17 "sk_path": { "title": "Signal K Path", "type": "string" }
18 }
19 })";
20
28class SKListener : virtual public Observable, public Configurable {
29 public:
40 SKListener(String sk_path, int listen_delay, String config_path="");
41
47 String& get_sk_path() { return sk_path; }
48
49 int get_listen_delay() { return listen_delay; }
50
51 virtual void parse_value(const JsonObject& json) {}
52
53 static const std::vector<SKListener*>& get_listeners() { return listeners; }
54
55 static bool take_semaphore(unsigned long int timeout_ms = 0);
56 static void release_semaphore();
57
58 protected:
60
61 private:
62 static std::vector<SKListener*> listeners;
63 int listen_delay;
64 static SemaphoreHandle_t semaphore_;
65
66 virtual void get_configuration(JsonObject& doc) override;
67 virtual bool set_configuration(const JsonObject& config) override;
68 virtual String get_config_schema() override;
69
70 void set_sk_path(const String& path);
71};
72
73} // namespace sensesp
74
75#endif
An object that is capable of having configuration data that can be set remotely using a RESTful API,...
Construct a new transform based on a single function.
A base class which allow observers to attach callbacks to themselves. The callbacks will be called wh...
Definition observable.h:16
An Obervable class that listens for Signal K stream deltas and notifies any observers of value change...
static void release_semaphore()
virtual void parse_value(const JsonObject &json)
static bool take_semaphore(unsigned long int timeout_ms=0)
static const std::vector< SKListener * > & get_listeners()
const uint8_t PAGE_css_bootstrap[] PROGMEM