1 #ifndef MARNAV_NMEA_ALR_HPP
2 #define MARNAV_NMEA_ALR_HPP
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/time.hpp>
9 /// @brief ALR - Set Alarm State
14 /// $--ALR,hhmmss.ss,xxx,a,a,c--c*hh<CR><LF>
20 /// 3. Alarm condition
21 /// - A = Exceeded threshold
22 /// - V = Not exceeded threshold
23 /// 4. Alarm acknowledge state
25 /// - V = Unacknowledged
28 class alr
: public sentence
30 friend class detail::factory
;
33 constexpr static sentence_id ID
= sentence_id::ALR
;
34 constexpr static const char * TAG
= "ALR";
37 enum class condition
: char {
38 threshold_exceeded
, ///< NMEA representation: 'A'
39 threshold_not_exceeded
, ///< NMEA representation: 'V'
42 /// Alarm acknowledge state
43 enum class acknowledge
: char {
44 acknowledged
, ///< NMEA representation: 'A'
45 not_acknowledged
, ///< NMEA representation: 'V'
50 alr(const alr
&) = default;
51 alr
& operator=(const alr
&) = default;
52 alr(alr
&&) = default;
53 alr
& operator=(alr
&&) = default;
56 alr(talker talk
, fields::const_iterator first
, fields::const_iterator last
);
57 void append_data_to(std::string
&, const version
&) const override
;
61 uint32_t number_
= 0u;
62 condition condition_
= condition::threshold_exceeded
;
63 acknowledge acknowledge_
= acknowledge::acknowledged
;
67 nmea::time
get_time_utc() const { return time_utc_
; }
68 uint32_t get_number() const { return number_
; }
69 condition
get_condition() const { return condition_
; }
70 acknowledge
get_acknowledge() const { return acknowledge_
; }
71 const std::string
& get_text() const { return text_
; }
73 void set_time_utc(const nmea::time
& t
) { time_utc_
= t
; }
74 void set_number(uint32_t n
) { number_
= n
; }
75 void set_condition(condition c
) { condition_
= c
; }
76 void set_acknowledge(acknowledge a
) { acknowledge_
= a
; }
77 void set_text(const std::string
& t
);
80 std::string
to_string(alr::condition t
);
81 std::string
to_string(alr::acknowledge t
);
83 std::string
to_name(alr::condition t
);
84 std::string
to_name(alr::acknowledge t
);