1 #ifndef __MARNAV__NMEA__GSA__HPP__
2 #define __MARNAV__NMEA__GSA__HPP__
5 #include <marnav/nmea/sentence.hpp>
6 #include <marnav/utils/optional.hpp>
12 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(gsa
)
14 /// @brief GSA - GPS DOP and active satellites
19 /// $--GSA,a,a,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x.x,x.x,x.x*hh<CR><LF>
23 /// 1. Selection mode: M=Manual, forced to operate in 2D or 3D, A=Automatic, 3D/2D
24 /// 2. Mode (1 = no fix, 2 = 2D fix, 3 = 3D fix)
25 /// 3. ID of 1st satellite used for fix
26 /// 4. ID of 2nd satellite used for fix
27 /// 5. ID of 3rd satellite used for fix
28 /// 6. ID of 4th satellite used for fix
29 /// 7. ID of 5th satellite used for fix
30 /// 8. ID of 6th satellite used for fix
31 /// 9. ID of 7th satellite used for fix
32 /// 10. ID of 8th satellite used for fix
33 /// 11. ID of 9th satellite used for fix
34 /// 12. ID of 10th satellite used for fix
35 /// 13. ID of 11th satellite used for fix
36 /// 14. ID of 12th satellite used for fix
41 class gsa
: public sentence
43 MARNAV_NMEA_SENTENCE_FRIENDS(gsa
)
46 constexpr static const sentence_id ID
= sentence_id::GSA
;
47 constexpr static const char * TAG
= "GSA";
49 constexpr static const int max_satellite_ids
= 12;
52 gsa(const gsa
&) = default;
53 gsa
& operator=(const gsa
&) = default;
54 gsa(gsa
&&) = default;
55 gsa
& operator=(gsa
&&) = default;
58 gsa(talker talk
, fields::const_iterator first
, fields::const_iterator last
);
59 virtual std::vector
<std::string
> get_data() const override
;
62 utils::optional
<selection_mode
> sel_mode
; // A:automatic 2D/3D, M:manual
63 utils::optional
<uint32_t> mode
; // 1 = no fix, 2 = 2D fix, 3 = 3D fix
64 std::array
<utils::optional
<uint32_t>, max_satellite_ids
> satellite_id
;
65 utils::optional
<double> pdop
;
66 utils::optional
<double> hdop
;
67 utils::optional
<double> vdop
;
69 void check_index(int index
) const;
72 decltype(sel_mode
) get_sel_mode() const { return sel_mode
; }
73 decltype(mode
) get_mode() const { return mode
; }
74 utils::optional
<uint32_t> get_satellite_id(int index
) const;
75 decltype(pdop
) get_pdop() const { return pdop
; }
76 decltype(hdop
) get_hdop() const { return hdop
; }
77 decltype(vdop
) get_vdop() const { return vdop
; }
79 void set_sel_mode(selection_mode t
) noexcept
{ sel_mode
= t
; }
80 void set_mode(uint32_t t
) noexcept
{ mode
= t
; }
81 void set_satellite_id(int index
, uint32_t t
);
82 void set_pdop(double t
) noexcept
{ pdop
= t
; }
83 void set_hdop(double t
) noexcept
{ hdop
= t
; }
84 void set_vdop(double t
) noexcept
{ vdop
= t
; }