1 #include <marnav/nmea/mtw.hpp>
2 #include <marnav/nmea/io.hpp>
9 constexpr sentence_id
mtw::ID
;
10 constexpr const char * mtw::TAG
;
13 : sentence(ID
, TAG
, talker::integrated_instrumentation
)
17 mtw::mtw(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 mtw"};
23 unit::temperature temperature_unit
;
25 read(*(first
+ 0), temperature_
);
26 read(*(first
+ 1), temperature_unit
);
28 check_value(temperature_unit
, {unit::temperature::celsius
}, "temperature unit");
31 void mtw::set_temperature(units::temperature t
) noexcept
33 temperature_
= t
.get
<units::celsius
>();
36 void mtw::append_data_to(std::string
& s
) const
38 append(s
, to_string(temperature_
));
39 append(s
, to_string(unit::temperature::celsius
));