Definition at line 58 of file gpsctrl.cc.
References GPS::NEMA::count, Error(), GPS::NEMA::geosep, GPS::NEMA::hdop, GPS::NEMA::height, i, GPS::State::kDisabled, GPS::State::kEnabled, GPS::State::kLocked, GPS::NEMA::lat, GPS::NEMA::lng, GPS::NEMA::qos, Tools::Split(), and GPS::NEMA::time.
60 if (
buffer==
"Invalid command, type help")
62 Error(
"Command was ignored by GPS.");
71 PostMessage(
string(
"get_nema\r\n"), 10);
77 PostMessage(
string(
"get_nema\r\n"), 10);
113 throw runtime_error(
"syntax error");
116 uint8_t c = cs[1][0];
117 for (
size_t i=1;
i<cs[1].size();
i++)
121 ss << std::hex << cs[2];
127 throw runtime_error(
"checksum error");
132 throw runtime_error(
"size mismatch");
134 throw runtime_error(
"type mismatch");
135 if (dat[5]!=
"W" && dat[5]!=
"E")
136 throw runtime_error(
"longitude type unknown");
138 throw runtime_error(
"height unit unknown");
140 throw runtime_error(
"hdop unit unknown");
141 if (!dat[13].empty())
142 throw runtime_error(
"unexpected data at position 13");
144 throw runtime_error(
"unexpected data at position 14");
150 nema.
qos = stoi(dat[6]);
151 nema.
count = stoi(dat[7]);
152 nema.
hdop = stof(dat[8]);
153 nema.
height = stof(dat[9]);
154 nema.
geosep = stof(dat[11]);
156 if (fabs(nema.
time-fmod(
Time().Mjd(), 1))*24*3600>5)
158 Error(
"Time mismatch: GPS time deviates from PC time by more than 5s");
float ConvLngLat(const string &l) const
Adds some functionality to boost::posix_time::ptime for our needs.
float ConvTm(const string &t) const
virtual void Update(const GPS::NEMA &)