2 #include <marnav/nmea/io.hpp>
8 MARNAV_NMEA_DEFINE_SENTENCE_PARSE_FUNC(bod
)
10 constexpr const char * bod::TAG
;
13 : sentence(ID
, TAG
, talker_id::global_positioning_system
)
17 bod::bod(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 bod"};
23 read(*(first
+ 0), bearing_true
);
24 read(*(first
+ 1), type_true
);
25 read(*(first
+ 2), bearing_magn
);
26 read(*(first
+ 3), type_magn
);
27 read(*(first
+ 4), waypoint_to
);
28 read(*(first
+ 5), waypoint_from
);
31 void bod::set_bearing_true(double t
) noexcept
34 type_true
= reference::TRUE
;
37 void bod::set_bearing_magn(double t
) noexcept
40 type_magn
= reference::MAGNETIC
;
43 std::vector
<std::string
> bod::get_data() const
45 return {to_string(bearing_true
), to_string(type_true
), to_string(bearing_magn
),
46 to_string(type_magn
), to_string(waypoint_to
), to_string(waypoint_from
)};