13nmea_rr teseo::gll_(
"$PSTMNMEAREQUEST,100000,0\r\n",
"GLL,");
14nmea_rr teseo::gsv_(
"$PSTMNMEAREQUEST,80000,0\r\n",
"GSV,");
15nmea_rr teseo::gsa_(
"$PSTMNMEAREQUEST,4,0\r\n",
"GSA,");
16nmea_rr teseo::gga_(
"$PSTMNMEAREQUEST,2,0\r\n",
"GGA,");
17nmea_rr teseo::rmc_(
"$PSTMNMEAREQUEST,40,0\r\n",
"RMC,");
18nmea_rr teseo::vtg_(
"$PSTMNMEAREQUEST,10,0\r\n",
"VTG,");
26 assert(writer_.is_set());
27 assert(reader_.is_set());
28 assert(resetter_.is_set());
34 write(
"$PSTMGPSSUSPEND\r\n");
37 write(
"$PSTMCFGMSGL,0,1,0,0\r\n");
39 write(
"$PSTMCFGMSGL,3,1,0,0\r\n");
41 write(
"$PSTMSETPAR,1227,1,2\r\n");
44 write(
"$PSTMGPSRESTART\r\n");
48 while(((s.length()) && s.find(
"$PSTMGPSRESTART") == std::string::npos));
52 std::size_t message_count = strings.size();
53 std::size_t string_index = 0;
54 std::size_t new_string_index;
55 std::size_t span_index;
58 for(span_index = 0; span_index < message_count; span_index++) {
59 new_string_index = s.find(
"\r\n", string_index);
60 if (new_string_index == s.length() - 2) {
61 valid = s.substr(string_index, s.length() - string_index).starts_with(command.
command.substr(0, command.
command.length()-2));
64 assert(span_index < message_count);
65 strings[span_index] = s.substr(string_index, (new_string_index + 2) - string_index);
66 valid = strings[span_index].length() >= 7 && strings[span_index].substr(3, 4).starts_with(command.
signature);
71 string_index = new_string_index + 2;
74 std::for_each(strings.begin() +
count, strings.end(),
75 [](
auto &discard) { discard = std::string(); });
80 assert(writer_.is_set());
85 assert(reader_.is_set());
95 s = single_line_parser_[0];
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)
Struct holds combinations of NMEA commands and their reply signature validation string.
const std::string command
const std::string signature