1 #ifndef MARNAV_NMEA_ALR_HPP
2 #define MARNAV_NMEA_ALR_HPP
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/time.hpp>
11 /// @brief ALR - Set Alarm State
16 /// $--ALR,hhmmss.ss,xxx,a,a,c--c*hh<CR><LF>
22 /// 3. Alarm condition
23 /// - A = Exceeded threshold
24 /// - V = Not exceeded threshold
25 /// 4. Alarm acknowledge state
27 /// - V = Unacknowledged
30 class alr
: public sentence
32 friend class detail::factory
;
35 constexpr static sentence_id ID
= sentence_id::ALR
;
36 constexpr static const char * TAG
= "ALR";
39 enum class condition
: char {
40 threshold_exceeded
, ///< NMEA representation: 'A'
41 threshold_not_exceeded
, ///< NMEA representation: 'V'
44 /// Alarm acknowledge state
45 enum class acknowledge
: char {
46 acknowledged
, ///< NMEA representation: 'A'
47 not_acknowledged
, ///< NMEA representation: 'V'
52 alr(const alr
&) = default;
53 alr
& operator=(const alr
&) = default;
54 alr(alr
&&) = default;
55 alr
& operator=(alr
&&) = default;
58 alr(talker talk
, fields::const_iterator first
, fields::const_iterator last
);
59 virtual void append_data_to(std::string
&) const override
;
63 uint32_t number_
= 0u;
64 condition condition_
= condition::threshold_exceeded
;
65 acknowledge acknowledge_
= acknowledge::acknowledged
;
69 nmea::time
get_time_utc() const { return time_utc_
; }
70 uint32_t get_number() const { return number_
; }
71 condition
get_condition() const { return condition_
; }
72 acknowledge
get_acknowledge() const { return acknowledge_
; }
73 const std::string
& get_text() const { return text_
; }
75 void set_time_utc(const nmea::time
& t
) { time_utc_
= t
; }
76 void set_number(uint32_t n
) { number_
= n
; }
77 void set_condition(condition c
) { condition_
= c
; }
78 void set_acknowledge(acknowledge a
) { acknowledge_
= a
; }
79 void set_text(const std::string
& t
);
82 std::string
to_string(alr::condition t
);
83 std::string
to_string(alr::acknowledge t
);
85 std::string
to_name(alr::condition t
);
86 std::string
to_name(alr::acknowledge t
);