37double PosPartsToDegrees(
float degrees,
float minutes,
float percent_of_minute);
39std::string DegreesToString(
double degrees);
41std::string TimeToString(
const time_t time);
45 enum class Type { NE, NW, SE, SW, Undef };
48 Position(
double _lat,
double _lon, Type t);
56 bool IsValid()
const {
return type != Type::Undef; }
73 std::string TypeToStr(
const Type t)
const;
76 Type LatLongToType(
double lat,
double lon);
79 double TypeToLat(Type t,
double lat);
82 double TypeToLong(Type t,
double lon);
90 : type(t), name(TypeToString(t)), source(
NavAddr()), prio(0) {};
95 virtual std::string
key()
const {
return "appmsg::" + name; }
100 std::string TypeToString(
const Type t)
const;
102 virtual std::string to_string()
const {
return "appmsg::" + name; }
105 const std::string name;
111 : type(tp), name(nm), source(src), prio(0) {};
114enum class AppMsg::Type {
131 std::vector<NavAddr> sources;
137 enum class Quality { none, gnss, differential };
139 GnssFix(
Position p, time_t t, Quality q = Quality::none,
int s_used = -1)
144 satellites_used(s_used) {};
146 std::string to_string()
const override {
147 std::stringstream buf;
148 buf << pos.
to_string() <<
" " << TimeToString(time);
159#define POS_UPDATE (int)(1)
160#define COG_UPDATE (int)(1 << 1)
161#define SOG_UPDATE (int)(1 << 2)
162#define VAR_UPDATE (int)(1 << 3)
163#define HDT_UPDATE (int)(1 << 4)
164#define POS_VALID (int)(1 << 5)
168 BasicNavDataMsg(
double lat,
double lon,
double SOG,
double COG,
double VAR,
169 double HDT,
int valid_flag, time_t t)
170 :
AppMsg(AppMsg::Type::BasicNavData,
"basic-nav-data",
NavAddr()),
180 :
AppMsg(AppMsg::Type::BasicNavData,
"basic-nav-data",
NavAddr()),
191 virtual std::string to_string()
const;
200 struct timespec set_time;
205 enum class WDSource { position, velocity, heading, var, sats };
208 :
AppMsg(AppMsg::Type::GPSWatchdog,
"gps-watchdog",
NavAddr()),
210 wd_source(_source) {};
214 const int gps_watchdog;
215 const WDSource wd_source;
221 std::string
key()
const override {
return "appmsg::aisdata"; }
222 std::string to_string()
const override;
231 std::string callsign;
244 CustomMsg(
const std::string s, std::shared_ptr<const void> ptr)
245 :
AppMsg(Type::CustomMsg,
"custom",
NavAddr()), id(s), payload(ptr) {}
247 std::string key()
const override {
return "appmsg::custom-" + id; }
249 const std::string id;
250 std::shared_ptr<const void> payload;
AIS data point for a vessel.
std::string key() const override
Return unique key used by Observable.
virtual std::string key() const
Return unique key used by Observable.
std::string GetKey() const
Alias for key().
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.
General observable implementation with several specializations.