35 #include "model/comm_driver.h"
36 #include "observable.h"
38 double PosPartsToDegrees(
float degrees,
float minutes,
float percent_of_minute);
40 std::string DegreesToString(
double degrees);
42 std::string TimeToString(
const time_t time);
46 enum class Type { NE, NW, SE, SW, Undef };
49 Position(
double _lat,
double _lon, Type t);
58 bool IsValid()
const {
return type != Type::Undef; }
75 std::string TypeToStr(
const Type t)
const;
78 Type LatLongToType(
double lat,
double lon);
81 double TypeToLat(Type t,
double lat);
84 double TypeToLong(Type t,
double lon);
93 : type(t), name(TypeToString(t)), source(
NavAddr()), prio(0){};
95 virtual std::string key()
const {
return std::string(
"@!appmsg-") + name; }
97 std::string GetKey()
const {
return key(); }
99 std::string TypeToString(
const Type t)
const;
102 const std::string name;
108 : type(tp), name(nm), source(src), prio(0){};
111 enum class AppMsg::Type {
128 std::vector<NavAddr> sources;
134 enum class Quality { none, gnss, differential };
136 GnssFix(
Position p, time_t t, Quality q = Quality::none,
int s_used = -1)
141 satellites_used(s_used){};
144 std::string to_string()
const {
145 std::stringstream buf;
146 buf << pos.
to_string() <<
" " << TimeToString(time);
157 #define POS_UPDATE (int)(1)
158 #define COG_UPDATE (int)(1 << 1)
159 #define SOG_UPDATE (int)(1 << 2)
160 #define VAR_UPDATE (int)(1 << 3)
161 #define HDT_UPDATE (int)(1 << 4)
162 #define POS_VALID (int)(1 << 5)
166 BasicNavDataMsg(
double lat,
double lon,
double SOG,
double COG,
double VAR,
167 double HDT,
int valid_flag, time_t t)
168 :
AppMsg(AppMsg::Type::BasicNavData,
"basic-nav-data",
NavAddr()),
178 :
AppMsg(AppMsg::Type::BasicNavData,
"basic-nav-data",
NavAddr()),
199 enum class WDSource { position, velocity, heading, var, sats };
202 :
AppMsg(AppMsg::Type::GPSWatchdog,
"gps-watchdog",
NavAddr()),
204 wd_source(_source){};
208 const int gps_watchdog;
209 const WDSource wd_source;
223 std::string callsign;
236 CustomMsg(
const std::string s, std::shared_ptr<const void> ptr)
237 :
AppMsg(Type::CustomMsg,
"custom",
NavAddr()), id(s), payload(ptr) {}
239 std::string key()
const override {
240 return std::string(
"@##_appmsg-custom-") + id;
243 const std::string id;
244 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.