2 #include <marnav/nmea/io.hpp>
8 MARNAV_NMEA_DEFINE_SENTENCE_PARSE_FUNC(tpt
)
10 constexpr const char * tpt::TAG
;
13 : sentence(ID
, TAG
, talker_id::global_positioning_system
)
17 tpt::tpt(talker talk
, fields::const_iterator first
, fields::const_iterator last
)
18 : sentence(ID
, TAG
, talk
)
20 if (std::distance(first
, last
) != 6)
21 throw std::invalid_argument
{"invalid number of fields in tpt"};
23 read(*(first
+ 0), range
);
24 read(*(first
+ 1), range_unit
);
25 read(*(first
+ 2), bearing
);
26 // separator omitted intentionally
27 read(*(first
+ 4), depth
);
28 read(*(first
+ 5), depth_unit
);
31 std::vector
<std::string
> tpt::get_data() const
33 return {to_string(range
), to_string(range_unit
), to_string(bearing
), "P", to_string(depth
),
34 to_string(depth_unit
)};