36#include "observable.h"
38double PosPartsToDegrees(
float degrees,
float minutes,
float percent_of_minute);
40std::string DegreesToString(
double degrees);
42std::string TimeToString(
const time_t time);
46 enum class Type { NE, NW, SE, SW, Undef };
49 Position(
double _lat,
double _lon, Type t);
57 bool IsValid()
const {
return type != Type::Undef; }
74 std::string TypeToStr(
const Type t)
const;
77 Type LatLongToType(
double lat,
double lon);
80 double TypeToLat(Type t,
double lat);
83 double TypeToLong(Type t,
double lon);
90 : type(t), name(TypeToString(t)), source(
NavAddr()), prio(0) {};
92 virtual std::string key()
const {
return std::string(
"@!appmsg-") + name; }
94 std::string GetKey()
const {
return key(); }
96 std::string TypeToString(
const Type t)
const;
99 const std::string name;
105 : type(tp), name(nm), source(src), prio(0) {};
108enum class AppMsg::Type {
125 std::vector<NavAddr> sources;
131 enum class Quality { none, gnss, differential };
133 GnssFix(
Position p, time_t t, Quality q = Quality::none,
int s_used = -1)
138 satellites_used(s_used) {};
141 std::string to_string()
const {
142 std::stringstream buf;
143 buf << pos.
to_string() <<
" " << TimeToString(time);
154#define POS_UPDATE (int)(1)
155#define COG_UPDATE (int)(1 << 1)
156#define SOG_UPDATE (int)(1 << 2)
157#define VAR_UPDATE (int)(1 << 3)
158#define HDT_UPDATE (int)(1 << 4)
159#define POS_VALID (int)(1 << 5)
163 BasicNavDataMsg(
double lat,
double lon,
double SOG,
double COG,
double VAR,
164 double HDT,
int valid_flag, time_t t)
165 :
AppMsg(AppMsg::Type::BasicNavData,
"basic-nav-data",
NavAddr()),
175 :
AppMsg(AppMsg::Type::BasicNavData,
"basic-nav-data",
NavAddr()),
193 struct timespec set_time;
198 enum class WDSource { position, velocity, heading, var, sats };
201 :
AppMsg(AppMsg::Type::GPSWatchdog,
"gps-watchdog",
NavAddr()),
203 wd_source(_source) {};
207 const int gps_watchdog;
208 const WDSource wd_source;
222 std::string callsign;
235 CustomMsg(
const std::string s, std::shared_ptr<const void> ptr)
236 :
AppMsg(Type::CustomMsg,
"custom",
NavAddr()), id(s), payload(ptr) {}
238 std::string key()
const override {
239 return std::string(
"@##_appmsg-custom-") + id;
242 const std::string id;
243 std::shared_ptr<const void> payload;
AIS data point for a vessel.
A generic message containing a const pointer to basically anything, the pointer neds to be casted to ...
Issued when there are multiple sources providing 'what' with priority == 0.
Interface implemented by classes which listens.
Where messages are sent to or received from.
Position()
Construct a (0,0) position, type == Undef.
static Position ParseGGA(const std::string gga)
Parse a GGA string like "5800.588,N,01145.776,E" as present in GGA and other n0183 messages.
std::string to_string() const
Return utf string like 65°25,11N 21°12,01E.
Communication driver layer.