AIS: smaller public interface for AIS messages regarding encoding.
[marnav.git] / src / marnav / nmea / tpt.hpp
blobbccb37e0feab1a4232533eada0baa8c2b4061275
1 #ifndef __NMEA__TPT__HPP__
2 #define __NMEA__TPT__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
7 namespace marnav
9 namespace nmea
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(tpt)
13 /// @brief TPT - Trawl Position True
14 ///
15 /// @code
16 /// 1 2 3 4 5 6
17 /// | | | | | |
18 /// $--TPT,x,M,y,P,z.z,M*hh,<CR><LF>
19 /// @endcode
20 ///
21 /// Field Number:
22 /// 1. Horizontal range relative to target in meters (0..4000)
23 /// 2. Unit of horizontal range
24 /// - M = Meters
25 /// 3. True bearing to taget (ie. relative north). Resolution is one degree.
26 /// 4. Separator
27 /// 5. Depth of trawl below the surface in meters (0..2000)
28 /// 6. Unit of depth
29 /// - M = Meters
30 ///
31 class tpt : public sentence
33 MARNAV_NMEA_SENTENCE_FRIENDS(tpt)
35 public:
36 constexpr static const sentence_id ID = sentence_id::TPT;
37 constexpr static const char * TAG = "TPT";
39 virtual ~tpt() {}
41 tpt();
42 tpt(const tpt &) = default;
43 tpt & operator=(const tpt &) = default;
45 protected:
46 tpt(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
47 virtual std::vector<std::string> get_data() const override;
49 private:
50 double range = 0.0;
51 unit::distance range_unit = unit::distance::meter;
52 double bearing = 0.0;
53 double depth = 0.0;
54 unit::distance depth_unit = unit::distance::meter;
56 public:
57 NMEA_GETTER(range)
58 NMEA_GETTER(range_unit)
59 NMEA_GETTER(bearing)
60 NMEA_GETTER(depth)
61 NMEA_GETTER(depth_unit)
63 void set_range(double t) noexcept
65 range = t;
66 range_unit = unit::distance::meter;
68 void set_bearing(double t) noexcept { bearing = t; }
69 void set_depth(double t) noexcept
71 depth = t;
72 range_unit = unit::distance::meter;
78 #endif