SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
signalk_emitter.h
Go to the documentation of this file.
1#ifndef SENSESP_SIGNALK_SIGNALK_EMITTER_H_
2#define SENSESP_SIGNALK_SIGNALK_EMITTER_H_
3
4#include "sensesp.h"
5
6#include <ArduinoJson.h>
7#include <set>
8
11#include "signalk_metadata.h"
12
13namespace sensesp {
14
20class SKEmitter : virtual public Observable {
21 public:
27 SKEmitter(const String& sk_path);
28
33 virtual void as_signalk_json(JsonDocument& doc) {
34 ESP_LOGE("SKEmitter", "as_signalk_json() not implemented");
35 JsonVariant obj = doc.as<JsonVariant>();
36 obj.set("ERROR! Not implemented");
37 }
38
45 virtual SKMetadata* get_metadata() { return nullptr; }
46
55 virtual void add_metadata(JsonArray& meta);
56
62 String& get_sk_path() { return sk_path_; }
63
64 void set_sk_path(const String& path) { sk_path_ = path; }
65
66 static const std::vector<SKEmitter*>& get_sources() { return sources_; }
67
68 protected:
69 String sk_path_{};
70
71 private:
72 static std::vector<SKEmitter*> sources_;
73};
74
75} // namespace sensesp
76
77#endif
A base class which allow observers to attach callbacks to themselves. The callbacks will be called wh...
Definition observable.h:16
A class that produces Signal K output to be forwarded to the Signal K server (if the system is connec...
virtual void add_metadata(JsonArray &meta)
virtual SKMetadata * get_metadata()
virtual void as_signalk_json(JsonDocument &doc)
void set_sk_path(const String &path)
static const std::vector< SKEmitter * > & get_sources()
SKEmitter(const String &sk_path)
Holds Signal K meta data that is associated with the sk_path an SKEmitter class may optionally send t...