NMEA: changed signature of nmea::make_sentence to make it more robust.
[marnav.git] / examples / parse_nmea.cpp
blobe90f0afe62a6260a8296805477c0825471d0f43d
1 #include <iostream>
2 #include <marnav/nmea/angle.hpp>
3 #include <marnav/nmea/io.hpp>
4 #include <marnav/nmea/nmea.hpp>
5 #include <marnav/nmea/rmc.hpp>
7 int main(int, char **)
9 using namespace marnav;
10 using namespace nmea;
12 std::string original
13 = "$GPRMC,201034,A,4702.4040,N,00818.3281,E,0.0,328.4,260807,0.6,E,A*17";
14 auto s = make_sentence(original);
15 auto rmc = sentence_cast<nmea::rmc>(s);
16 std::cout << "original : " << original << "\n";
17 std::cout << "tag : " << rmc->tag() << "\n";
18 std::cout << "time : " << to_string(rmc->get_time_utc()) << "\n";
19 std::cout << "status : " << to_string(rmc->get_status()) << "\n";
20 std::cout << "latitude : " << to_string(rmc->get_latitude()) << "\n";
21 std::cout << "longitude: " << to_string(rmc->get_longitude())
22 << "\n";