Pico GPS Teseo I2C
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1/*
2 * main.cpp
3 *
4 * Created on, //29 jul. 2024
5 * Author, //jancu
6 */
7
8
9#include <string>
10#include <vector>
11#include <iostream>
12
13import nmea;
14
15void test_gll() {
16 std::string reply = "$GPGLL,5051.83778,N,00422.55809,S,185427.150,V,N*4F";
17 nmea::gll o;
19
20 std::cout <<
21 "GLL " << std::endl <<
22 "source: " << o.source << ". " <<
23 "lat: " << o.lat << " lon: " << o.lon << ". " <<
24 o.t << ". " <<
25 "valid: " << o.valid << ". " <<
26 std::endl;
27 return;
28}
29
30void test_gga() {
31 std::string reply = "$GPGGA,191237.000,5051.78066,N,00422.57079,E,1,05,3.7,027.26,M,47.3,M,,*65";
32 nmea::gga o;
34
35 std::cout <<
36 "GGA " << std::endl <<
37 "source: " << o.source << ". " <<
38 "lat: " << o.lat << " lon: " << o.lon << ". " <<
39 o.t << ". " <<
40 "qual: " << o.qual << ", " <<
41 "sats: " << o.sats << ". " <<
42 std::endl;
43 return;
44}
45
46void test_gsa() {
47 std::vector<std::string> replies {
48 "$GNGSA,A,3,15,18,,,,,,,,,,,4.7,3.7,2.9*2D",
49 "$GNGSA,A,3,73,65,81,,,,,,,,,,4.7,3.7,2.9*2E"
50 };
51
52 for(auto r : replies) {
53 nmea::gsa o;
55
56 std::cout <<
57 "GSA " << std::endl <<
58 "source: " << o.source << ". " << std::endl <<
59 "system: " << o.system_id << ". " << std::endl;
60 for(const auto s : o.sats) {
61 std::cout << "sat prn: " << s << "." <<
62 std::endl;
63 }
64 }
65 return;
66}
67
68
69void test_gsv() {
70 std::vector<std::string> replies {
71 "$GPGSV,3,1,11,13,79,310,,14,53,113,,05,51,214,,30,47,067,*72",
72 "$GPGSV,3,2,11,15,45,295,24,22,44,145,,20,27,192,,07,16,064,*7A",
73 "$GPGSV,3,3,11,18,16,298,25,24,08,249,,08,08,029,18,,,,*40",
74 "$GLGSV,2,1,08,72,79,113,,74,77,084,,75,38,202,,65,37,317,28*68",
75 "$GLGSV,2,2,08,73,34,040,35,71,28,130,,81,13,333,24,82,08,017,*68"
76 };
77
78 for(auto r : replies) {
79 nmea::gsv o;
81
82 std::cout <<
83 "GSV " << std::endl <<
84 "source: " << o.source << ". " << std::endl;
85 for(const auto s : o.sats) {
86 std::cout << "sat prn: " << s.prn << ", elev: " <<
87 s.elev << ", azim: " << s.azim << ", snr: " << s.snr << "." <<
88 std::endl;
89 }
90 }
91 return;
92}
93
94void test_rmc() {
95 std::string reply = "$GPRMC,185427.150,V,5051.83778,N,00422.55809,E,,,240724,,,N*7F";
96 nmea::rmc o;
98
99 std::cout <<
100 "RMC " << std::endl <<
101 "source: " << o.source << ". " <<
102 "lat: " << o.lat << " lon: " << o.lon << ". " <<
103 o.t << ". " <<
104 o.d << ". " <<
105 "valid: " << o.valid << ". " <<
106 std::endl;
107 return;
108}
109
110int main() {
111 test_gll();
112 test_gga();
113 test_gsa();
114 test_gsv();
115 test_rmc();
116
117 return 0;
118}
quality qual
static bool from_data(const std::string &data, gga &gga)
Definition nmea.cpp:160
talker_id source
unsigned int sats
talker_id source
static bool from_data(const std::string &data, gll &gll)
Definition nmea.cpp:121
talker_id source
talker_id system_id
gsa_sat_array sats
static bool from_data(const std::string &data, gsa &gsa)
Definition nmea.cpp:210
static bool from_data(const std::string &data, gsv &gsv)
Definition nmea.cpp:253
talker_id source
gsv_sat_array sats
std::chrono::year_month_day d
talker_id source
static bool from_data(const std::string &data, rmc &rmc)
Definition nmea.cpp:314
void test_gsa()
Definition main.cpp:46
void test_gsv()
Definition main.cpp:69
void test_gga()
Definition main.cpp:30
void test_gll()
Definition main.cpp:15
void test_rmc()
Definition main.cpp:94
int main()
Definition main.cpp:110
std::array< std::string, NMEA_MAX_REPLIES > replies