14nmea_rr teseo::gll_(
"$PSTMNMEAREQUEST,100000,0\r\n",
"GLL,");
15nmea_rr teseo::gsv_(
"$PSTMNMEAREQUEST,80000,0\r\n",
"GSV,");
16nmea_rr teseo::gsa_(
"$PSTMNMEAREQUEST,4,0\r\n",
"GSA,");
17nmea_rr teseo::gga_(
"$PSTMNMEAREQUEST,2,0\r\n",
"GGA,");
18nmea_rr teseo::rmc_(
"$PSTMNMEAREQUEST,40,0\r\n",
"RMC,");
19nmea_rr teseo::vtg_(
"$PSTMNMEAREQUEST,10,0\r\n",
"VTG,");
27 assert(writer_.is_set());
28 assert(reader_.is_set());
29 assert(resetter_.is_set());
35 write(
"$PSTMGPSSUSPEND\r\n");
38 write(
"$PSTMCFGMSGL,0,1,0,0\r\n");
40 write(
"$PSTMCFGMSGL,3,1,0,0\r\n");
42 write(
"$PSTMSETPAR,1227,1,2\r\n");
45 write(
"$PSTMGPSRESTART\r\n");
49 while(((s.length()) && s.find(
"$PSTMGPSRESTART") == std::string::npos));
53 std::size_t message_count = strings.size();
54 std::size_t string_index = 0;
55 std::size_t new_string_index;
56 std::size_t vector_index;
59 for(vector_index = 0; vector_index < message_count; vector_index++) {
60 new_string_index = s.find(
"\r\n", string_index);
61 if (new_string_index == s.length() - 2) {
62 valid = s.substr(string_index, s.length() - string_index).starts_with(command.first.substr(0, command.first.length()-2));
65 assert(vector_index < message_count);
66 strings[vector_index] = s.substr(string_index, (new_string_index + 2) - string_index);
67 valid = strings[vector_index].length() >= 7 && strings[vector_index].substr(3, 4).starts_with(command.second);
72 string_index = new_string_index + 2;
75 std::for_each(strings.begin() +
count, strings.end(),
76 [](
auto &discard) { discard = std::string(); });
81 assert(writer_.is_set());
86 assert(reader_.is_set());
96 s = single_line_parser_[0];
103 write(command.first);
bool ask_gga(std::string &s)
get GGA request to the Teseo and read reply
bool ask_gsv(std::span< std::string > strings, unsigned int &count)
get GSV request to the Teseo and read reply
bool ask_vtg(std::string &s)
get VTG request to the Teseo and read reply
static bool parse_multiline_reply(std::span< std::string > strings, const std::string s, unsigned int &count, const nmea_rr &command)
utility to parse a multiline Teseo reply into separate strings
bool ask_gsa(std::span< std::string > strings, unsigned int &count)
get GSA request to the Teseo and read reply
bool ask_nmea(const nmea_rr &command, std::string &s)
send NMEA request to the Teseo and return reply
bool ask_rmc(std::string &s)
get RMC request to the Teseo and read reply
void read(std::string &s)
read data from the Teseo
bool ask_gll(std::string &s)
get GLL request to the Teseo and read reply
void initialize()
configure the Teseo for use as a position sensor (optional).
void write(const std::string &s)
write command to the Teseo
bool ask_nmea_multiple(const nmea_rr &command, std::span< std::string > strings, unsigned int &count)
send NMEA request to the Teseo and return multi line reply
void read(::std::string &s)
void write(const ::std::string &s)
const std::pair< const std::string, const std::string > nmea_rr