35#include "comm_driver.h"
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);
47 enum class Type { NE, NW, SE, SW, Undef };
50 Position(
double _lat,
double _lon, Type t);
59 bool IsValid()
const {
return type != Type::Undef; }
76 std::string TypeToStr(
const Type t)
const;
79 Type LatLongToType(
double lat,
double lon);
82 double TypeToLat(Type t,
double lat);
85 double TypeToLong(Type t,
double lon);
94 : type(t), name(TypeToString(t)), source(
NavAddr()), prio(0){};
96 virtual std::string key()
const {
return std::string(
"@!appmsg-") + name; }
98 std::string
GetKey()
const {
return key(); }
100 std::string TypeToString(
const Type t)
const;
103 const std::string name;
109 : type(tp), name(nm), source(src), prio(0){};
112enum class AppMsg::Type {
129 std::vector<NavAddr> sources;
135 enum class Quality { none, gnss, differential };
137 GnssFix(
Position p, time_t t, Quality q = Quality::none,
int s_used = -1)
142 satellites_used(s_used){};
145 std::string to_string()
const {
146 std::stringstream buf;
147 buf << pos.
to_string() <<
" " << TimeToString(time);
163 BasicNavDataMsg(
double lat,
double lon,
double SOG,
double COG,
double VAR,
164 double HDT, time_t t)
165 :
AppMsg(AppMsg::Type::BasicNavData,
"basic-nav-data",
NavAddr()),
174 :
AppMsg(AppMsg::Type::BasicNavData,
"basic-nav-data",
NavAddr()),
194 enum class WDSource { position, velocity, heading, var, sats };
197 :
AppMsg(AppMsg::Type::GPSWatchdog,
"gps-watchdog",
NavAddr()),
199 wd_source(_source){};
203 const int gps_watchdog;
204 const WDSource wd_source;
218 std::string callsign;
231 CustomMsg(
const std::string s, std::shared_ptr<const void> ptr)
232 :
AppMsg(Type::CustomMsg,
"custom",
NavAddr()), id(s), payload(ptr) {}
234 std::string key()
const override {
235 return std::string(
"@##_appmsg-custom-") + id;
238 const std::string id;
239 std::shared_ptr<const void> payload;
AIS data point for a vessel.
Message withg decoded values, available on AppMsgBus.
std::string GetKey() const
Return key used to listen and notify.
Global heartbeat message with decoded values for position, speed course, etc.
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.
Watchdog message, normally created in CommBridge from wxTimer events.
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.