1 #include <marnav/nmea/bww.hpp>
2 #include <marnav/nmea/io.hpp>
7 constexpr sentence_id
bww::ID
;
8 constexpr const char * bww::TAG
;
11 : sentence(ID
, TAG
, talker::global_positioning_system
)
15 bww::bww(talker talk
, fields::const_iterator first
, fields::const_iterator last
)
16 : sentence(ID
, TAG
, talk
)
18 if (std::distance(first
, last
) != 6)
19 throw std::invalid_argument
{"invalid number of fields in bww"};
21 std::optional
<reference
> bearing_true_ref
;
22 std::optional
<reference
> bearing_mag_ref
;
24 read(*(first
+ 0), bearing_true_
);
25 read(*(first
+ 1), bearing_true_ref
);
26 read(*(first
+ 2), bearing_magn_
);
27 read(*(first
+ 3), bearing_mag_ref
);
28 read(*(first
+ 4), waypoint_to_
);
29 read(*(first
+ 5), waypoint_from_
);
31 check_value(bearing_true_ref
, {reference::TRUE
}, "");
32 check_value(bearing_mag_ref
, {reference::MAGNETIC
}, "");
35 void bww::set_bearing_true(double t
) noexcept
40 void bww::set_bearing_mag(double t
) noexcept
45 void bww::append_data_to(std::string
& s
, const version
&) const
47 append(s
, to_string(bearing_true_
));
48 append(s
, to_string_if(reference::TRUE
, bearing_true_
));
49 append(s
, to_string(bearing_magn_
));
50 append(s
, to_string_if(reference::MAGNETIC
, bearing_magn_
));
51 append(s
, to_string(waypoint_to_
));
52 append(s
, to_string(waypoint_from_
));