SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
signalk_types.cpp
Go to the documentation of this file.
1
2#include "signalk_types.h"
3
4namespace sensesp {
5
15template <>
16void SKOutput<Position>::as_signalk_json(JsonDocument& doc) {
17 doc["path"] = this->get_sk_path();
18 JsonObject value = doc["value"].to<JsonObject>();
19 value["latitude"] = output_.latitude;
20 value["longitude"] = output_.longitude;
21 if (output_.altitude != kPositionInvalidAltitude) {
22 value["altitude"] = output_.altitude;
23 }
24}
25
26template <>
27void SKOutput<ENUVector>::as_signalk_json(JsonDocument& doc) {
28 doc["path"] = this->get_sk_path();
29 JsonObject value = doc["value"].to<JsonObject>();
30 value["east"] = output_.east;
31 value["north"] = output_.north;
32 if (output_.up != kPositionInvalidAltitude) {
33 value["up"] = output_.up;
34 }
35}
36
37template <>
39 doc["path"] = this->get_sk_path();
40 JsonObject value = doc["value"].to<JsonObject>();
41 value["roll"] = output_.roll;
42 value["pitch"] = output_.pitch;
43 value["yaw"] = output_.yaw;
44}
45
46} // namespace sensesp
virtual void as_signalk_json(JsonDocument &doc) override
constexpr float kPositionInvalidAltitude
Definition position.h:11