1 #ifndef __MARNAV__NMEA__PGRMZ__HPP__
2 #define __MARNAV__NMEA__PGRMZ__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(pgrmz
)
13 /// @brief PGRMZ - Garmin Altitude Information
18 /// $PGRMZ,x.x,f,h*hh<CR><LF>
30 /// Example: <tt>$PGRMZ,1494,f,*10</tt>
32 class pgrmz
: public sentence
34 MARNAV_NMEA_SENTENCE_FRIENDS(pgrmz
)
37 constexpr static const sentence_id ID
= sentence_id::PGRMZ
;
38 constexpr static const char * TAG
= "PGRMZ";
40 enum class fix_type
: char {
41 no_fix
, ///< NMEA representation: '1'
42 d2fix
, ///< NMEA representation: '2'
43 d3fix
///< NMEA representation: '3'
47 pgrmz(const pgrmz
&) = default;
48 pgrmz
& operator=(const pgrmz
&) = default;
49 pgrmz(pgrmz
&&) = default;
50 pgrmz
& operator=(pgrmz
&&) = default;
53 pgrmz(talker talk
, fields::const_iterator first
, fields::const_iterator last
);
54 virtual std::vector
<std::string
> get_data() const override
;
57 double altitude
= 0.0;
58 unit::distance altitude_unit
= unit::distance::feet
;
59 utils::optional
<fix_type
> fix
;
62 decltype(altitude
) get_altitude() const { return altitude
; }
63 decltype(altitude_unit
) get_altitude_unit() const { return altitude_unit
; }
64 decltype(fix
) get_fix() const { return fix
; }
66 void set_altitude(double t
) noexcept
69 altitude_unit
= unit::distance::feet
;
71 void set_fix(fix_type t
) noexcept
{ fix
= t
; }
74 std::string
to_string(pgrmz::fix_type value
);