NMEA: detectio of the optional tag block in front of a sentence, ignoring it for...
[marnav.git] / src / marnav / nmea / dse.hpp
blob9ec85ba0a2ab79faf998fd95b0064e2e8e37696f
1 #ifndef __MARNAV__NMEA__DSE__HPP__
2 #define __MARNAV__NMEA__DSE__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
6 #include <marnav/utils/mmsi.hpp>
8 namespace marnav
10 namespace nmea
12 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(dse)
14 /// @brief DSE - Extended DSC
15 ///
16 /// @note This class is @b EXPERIMENTAL
17 ///
18 /// @code
19 /// 1 2 3 4 5 6
20 /// | | | | | |
21 /// $--DSE,x,x,a,xxxxxxxxx,xx,c--c,...,xx,c--c*hh<CR><LF>
22 /// @endcode
23 ///
24 /// Field Number:
25 /// 1. Total number of messages
26 /// 2. Sentence number
27 /// 3. Query/Reply Flag
28 /// - Q = Query
29 /// - R = Reply
30 /// - A = ?
31 /// 4. Address (identical to DSC)
32 /// 5. Data set, code
33 /// 6. Data set, data
34 ///
35 /// There may be a variable number of data sets (code, data)
36 ///
37 /// @todo Implementation of data set fields
38 ///
39 class dse : public sentence
41 MARNAV_NMEA_SENTENCE_FRIENDS(dse)
43 public:
44 constexpr static const sentence_id ID = sentence_id::DSE;
45 constexpr static const char * TAG = "DSE";
47 enum class query_flag : char { query, reply, a };
49 enum class code_id : uint32_t {
50 enhanced_position_resolution, ///< 100
51 source_and_data_of_position, ///< 101
52 current_speed_of_vessel, ///< 102
53 current_course_of_vessel, ///< 103
54 additional_station_identification, ///< 104
55 enhanced_geographic_area, ///< 105
56 number_of_persons_on_board ///< 106
59 struct dataset {
60 code_id code;
61 std::string data;
64 dse();
65 dse(const dse &) = default;
66 dse & operator=(const dse &) = default;
67 dse(dse &&) = default;
68 dse & operator=(dse &&) = default;
70 protected:
71 dse(talker talk, fields::const_iterator first, fields::const_iterator last);
72 virtual std::vector<std::string> get_data() const override;
74 private:
75 uint32_t number_of_messages = 1;
76 uint32_t sentence_number = 1;
77 query_flag flag = query_flag::query;
78 uint64_t address = 0;
80 public:
81 decltype(number_of_messages) get_number_of_messages() const { return number_of_messages; }
82 decltype(sentence_number) get_sentence_number() const { return sentence_number; }
83 decltype(flag) get_flag() const { return flag; }
84 utils::mmsi get_mmsi() const;
86 void set_number_of_messages(uint32_t t) noexcept { number_of_messages = t; }
87 void set_sentence_number(uint32_t t) noexcept { sentence_number = t; }
88 void set_flag(query_flag t) noexcept { flag = t; }
89 void set_mmsi(const utils::mmsi & t) noexcept;
92 std::string to_string(dse::query_flag value);
93 std::string to_string(dse::code_id value);
97 #endif