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