1 #ifndef __MARNAV__NMEA__XDR__HPP__
2 #define __MARNAV__NMEA__XDR__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(xdr
)
13 /// @brief XDR - Transducer Measurement
18 /// $--XDR,a,x.x,a,c--c, ..... *hh<CR><LF>
22 /// 1. Transducer Type
23 /// 2. Measurement Data
24 /// 3. Units of measurement
25 /// 4. Name of transducer
27 /// There may be any number of quadruplets like this, each describing a sensor.
28 /// The last field will be a checksum as usual.
30 class xdr
: public sentence
32 MARNAV_NMEA_SENTENCE_FRIENDS(xdr
)
35 struct transducer_info
{
37 double measurement_data
;
38 char units_of_measurement
;
42 constexpr static const sentence_id ID
= sentence_id::XDR
;
43 constexpr static const char * TAG
= "XDR";
45 constexpr static const int max_transducer_info
= 10;
48 xdr(const xdr
&) = default;
49 xdr
& operator=(const xdr
&) = default;
50 xdr(xdr
&&) = default;
51 xdr
& operator=(xdr
&&) = default;
54 xdr(talker talk
, fields::const_iterator first
, fields::const_iterator last
);
55 virtual std::vector
<std::string
> get_data() const override
;
58 std::array
<utils::optional
<transducer_info
>, max_transducer_info
> transducer_data
;
60 void check_index(int index
) const;
63 utils::optional
<transducer_info
> get_info(int index
) const;
65 void set_info(int index
, const transducer_info
& info
);