SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
signalk_metadata.cpp
Go to the documentation of this file.
1#include "signalk_metadata.h"
2
3namespace sensesp {
4
6 String short_name, float timeout)
7 : units_{units},
8 display_name_{display_name},
9 description_{description},
10 short_name_{short_name},
11 timeout_{timeout} {}
12
14 JsonObject json = meta.createNestedObject();
15 json["path"] = sk_path;
16 JsonObject val = json.createNestedObject("value");
17
18 if (!this->display_name_.isEmpty()) {
19 val["displayName"] = this->display_name_;
20 }
21
22 if (!this->units_.isEmpty()) {
23 val["units"] = this->units_;
24 }
25
26 if (!this->description_.isEmpty()) {
27 val["description"] = this->description_;
28 }
29
30 if (!this->short_name_.isEmpty()) {
31 val["shortName"] = this->short_name_;
32 }
33
34 if (this->timeout_ >= 0.0) {
35 val["timeout"] = this->timeout_;
36 }
37}
38
39} // namespace sensesp
Construct a new transform based on a single function.
virtual void add_entry(String sk_path, JsonArray &meta)
SKMetadata()
Default constructor creates a blank Metadata structure.