Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"class":"TPV","tag":"0x0106","device":"/dev/ttyACM2","mode":1,"time":"2015-08-28T07:38:51.000Z","ept":0.005}
- {"class":"TPV","tag":"GLL","device":"/dev/ttyACM2","mode":0,"time":"2015-08-28T07:38:51.000Z","ept":0.005}
- {"class":"TPV","tag":"0x0106","device":"/dev/ttyACM0","mode":3,"time":"2015-08-28T07:38:51.000Z","ept":0.005,"lat":-27.550550287,"lon":153.102791027,"alt":56.883,"epx":2.991,"epy":2.991,"epv}
- {"class":"SKY","tag":"GSV","device":"/dev/ttyACM0","xdop":0.79,"ydop":0.75,"vdop":1.88,"tdop":1.01,"hdop":0.99,"gdop":2.35,"pdop":2.12,"satellites":[{"PRN":4,"el":0,"az":0,"ss":33,"used":fal}
- {"class":"TPV","tag":"GLL","device":"/dev/ttyACM0","mode":3,"time":"2015-08-28T07:38:51.000Z","ept":0.005,"lat":-27.550550333,"lon":153.102791000,"alt":57.800,"epx":11.922,"epy":11.180,"epv"}
- {"class":"TPV","tag":"0x0106","device":"/dev/ttyACM1","mode":1}
- {"class":"TPV","tag":"0x0106","device":"/dev/ttyACM2","mode":1,"time":"2015-08-28T07:38:52.000Z","ept":0.005}
- {"class":"TPV","tag":"GLL","device":"/dev/ttyACM2","mode":0,"time":"2015-08-28T07:38:52.000Z","ept":0.005}
- {"class":"TPV","tag":"0x0106","device":"/dev/ttyACM0","mode":3,"time":"2015-08-28T07:38:52.000Z","ept":0.005,"lat":-27.550550218,"lon":153.102790984,"alt":56.919,"epx":2.963,"epy":2.963,"epv}
- {"class":"SKY","tag":"GSV","device":"/dev/ttyACM0","xdop":0.79,"ydop":0.75,"vdop":1.88,"tdop":1.01,"hdop":0.99,"gdop":2.35,"pdop":2.12,"satellites":[{"PRN":4,"el":0,"az":0,"ss":33,"used":fal}
- {"class":"TPV","tag":"GLL","device":"/dev/ttyACM0","mode":3,"time":"2015-08-28T07:38:52.000Z","ept":0.005,"lat":-27.550550167,"lon":153.102791000,"alt":57.800,"epx":11.922,"epy":11.180,"epv"}
- {"class":"TPV","tag":"0x0106","device":"/dev/ttyACM1","mode":1}
- #include <iostream>
- #include <stdlib.h>
- #include <libgpsmm.h>
- using namespace std;
- int main(void)
- {
- int port;
- gpsmm gps_rec("localhost", DEFAULT_GPSD_PORT);
- port = atoi(DEFAULT_GPSD_PORT);
- printf("port: %dn", port);
- if (gps_rec.stream(WATCH_ENABLE|WATCH_JSON) == NULL) {
- cerr << "No GPSD running.n";
- return 1;
- }
- for (;;) {
- // more info for gps_data_t: https://fossies.org/dox/gpsd-3.15/structgps__data__t.html
- struct gps_data_t* newdata;
- if (!gps_rec.waiting(50000000))
- continue;
- if ((newdata = gps_rec.read()) == NULL) {
- cerr << "Read error.n";
- return 1;
- } else {
- cout
- << "path: "<< newdata->devices.list[0].path
- << "tndevices: "<< newdata->devices.ndevices
- << "tlatitude: "<< newdata->fix.latitude
- << "tlongitude: "<< newdata->fix.longitude
- << endl;
- }
- }
- return 0;
- }
- root@overo:~# gps_test
- port: 2947
- path: ndevices: 0 latitude: nan longitude: nan
- path: /dev/ttyACM0 ndevices: 3 latitude: nan longitude: nan
- path: /dev/ttyACM0 ndevices: 3 latitude: nan longitude: nan
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: nan longitude: nan
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: nan longitude: nan
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5506 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: nan longitude: nan
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5506 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5506 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5506 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: -27.5505 longitude: 153.103
- path: /dev/ttyACM0 ndevices: 3 latitude: nan longitude: nan
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement