NMEA: remove deprecated type talker_id
[marnav.git] / src / marnav / nmea / hdt.cpp
blobf71182e9c553547d453cb4cbcacaadab17f633ad
1 #include <marnav/nmea/hdt.hpp>
2 #include <marnav/nmea/io.hpp>
3 #include <stdexcept>
5 namespace marnav
7 namespace nmea
9 constexpr sentence_id hdt::ID;
10 constexpr const char * hdt::TAG;
12 hdt::hdt()
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
29 heading_ = t;
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_));