1 #ifndef __NMEA__DTM__HPP__
2 #define __NMEA__DTM__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(dtm
)
13 /// @brief DTM - Datum Reference
18 /// $ --DTM,ref,x,llll,c,llll,c,aaa,ref*hh<CR><LF>
22 /// 1. Local datum code.
24 /// 2. Local datum subcode. May be blank.
25 /// 3. Latitude offset (minutes)
26 /// 4. Latitude hemisphere
29 /// 5. Longitude offset (minutes)
30 /// 6. Longitude hemisphere
33 /// 7. Altitude offset in meters
34 /// 8. Datum name. What’s usually seen here is "W84", the standard WGS84 datum used by GPS.
37 /// @note Datum code, subcode and datum name are truncated to 5 characters.
39 class dtm
: public sentence
41 MARNAV_NMEA_SENTENCE_FRIENDS(dtm
)
44 constexpr static const sentence_id ID
= sentence_id::DTM
;
45 constexpr static const char * TAG
= "DTM";
48 dtm(const dtm
&) = default;
49 dtm
& operator=(const dtm
&) = default;
50 dtm(dtm
&&) = default;
51 dtm
& operator=(dtm
&&) = default;
54 dtm(const std::string
& talker
, fields::const_iterator first
, fields::const_iterator last
);
55 virtual std::vector
<std::string
> get_data() const override
;
58 std::string ref
= "W84";
59 utils::optional
<std::string
> subcode
;
60 double lat_offset
= 0.0;
61 direction lat_hem
= direction::north
;
62 double lon_offset
= 0.0;
63 direction lon_hem
= direction::east
;
64 double altitude
= 0.0;
65 std::string name
= "W84";
68 MARNAV_NMEA_GETTER(ref
)
69 MARNAV_NMEA_GETTER(subcode
)
70 MARNAV_NMEA_GETTER(lat_offset
)
71 MARNAV_NMEA_GETTER(lat_hem
)
72 MARNAV_NMEA_GETTER(lon_offset
)
73 MARNAV_NMEA_GETTER(lon_hem
)
74 MARNAV_NMEA_GETTER(altitude
)
75 MARNAV_NMEA_GETTER(name
)
77 void set_ref(const std::string
& t
) noexcept
;
78 void set_subcode(const std::string
& t
) noexcept
;
79 void set_lat_offset(double t
, direction h
);
80 void set_lon_offset(double t
, direction h
);
81 void set_altitude(double t
) { altitude
= t
; }
82 void set_name(const std::string
& t
) noexcept
;