1 #include <marnav/nmea/hdt.hpp>
2 #include <marnav/nmea/io.hpp>
9 constexpr sentence_id
hdt::ID
;
10 constexpr const char * hdt::TAG
;
13 : sentence(ID
, TAG
, talker::integrated_instrumentation
)
17 hdt::hdt(talker talk
, fields::const_iterator first
, fields::const_iterator last
)
18 : sentence(ID
, TAG
, talk
)
20 if (std::distance(first
, last
) != 2)
21 throw std::invalid_argument
{"invalid number of fields in hdt"};
23 read(*(first
+ 0), heading_
);
24 read(*(first
+ 1), heading_true_
);
27 void hdt::set_heading(double t
) noexcept
30 heading_true_
= reference::TRUE
;
33 void hdt::append_data_to(std::string
& s
) const
35 append(s
, to_string(heading_
));
36 append(s
, to_string(heading_true_
));