NMEA: detectio of the optional tag block in front of a sentence, ignoring it for...
[marnav.git] / src / marnav / nmea / mss.cpp
blob91a303ec3095cc590f20d92c9f530329c8e709f7
1 #include "mss.hpp"
2 #include <marnav/nmea/io.hpp>
4 namespace marnav
6 namespace nmea
8 MARNAV_NMEA_DEFINE_SENTENCE_PARSE_FUNC(mss)
10 constexpr const char * mss::TAG;
12 mss::mss()
13 : sentence(ID, TAG, talker_id::global_positioning_system)
17 mss::mss(talker talk, fields::const_iterator first, fields::const_iterator last)
18 : sentence(ID, TAG, talk)
20 if (std::distance(first, last) != 5)
21 throw std::invalid_argument{"invalid number of fields in mss"};
23 read(*(first + 0), signal_strength);
24 read(*(first + 1), signal_to_noise_ratio);
25 read(*(first + 2), beacon_frequency);
26 read(*(first + 3), beacon_datarate);
27 read(*(first + 4), unknown);
30 std::vector<std::string> mss::get_data() const
32 return {format(signal_strength, 2), format(signal_to_noise_ratio, 2),
33 format(beacon_frequency, 3), format(beacon_datarate, 3), to_string(unknown)};