[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-users] gpsd WATCH_RAW
From: |
Roger Oberholtzer |
Subject: |
Re: [gpsd-users] gpsd WATCH_RAW |
Date: |
Thu, 12 Mar 2015 09:41:41 +0000 |
I have made a little test program that is reading from gpsd (started with
gpsfake).
#include <stdio.h>
#include <gps.h>
main() {
struct gps_data_t gpsdata;
gps_open("localhost", DEFAULT_GPSD_PORT, &gpsdata);
(void) gps_stream(&gpsdata, WATCH_ENABLE | WATCH_RAW, NULL);
while (1) {
if (gps_waiting (&gpsdata, 500)) {
if (gps_read (&gpsdata) == -1) {
// ...
} else {
printf("%s\n", gps_data(&gpsdata));
}
}
}
(void) gps_stream(&gpsdata, WATCH_DISABLE, NULL);
(void) gps_close (&gpsdata);
}
Why would gps_data() return some JSON headers at the start? I get this:
{"class":"VERSION","release":"3.10","rev":"3.10","proto_major":3,"proto_minor":9}
{"class":"WATCH","enable":true,"json":false,"nmea":false,"raw":2,"scaled":false,"timing":false,"split24":false,"pps":false}
","flags":1,"native":0,"bps":4800,"parity":"N","stopbits":1,"cycle":1.00}]}
{"class":"WATCH","enable":true,"json":false,"nmea":false,"raw":2,"scaled":false,"timing":false,"split24":false,"pps":false}
$GPGGA,094857.50,5055.59050842,N,00701.48761436,E,2,05,2.5,45.275,M,47.654,M,22.7,0100*4B
$GPGGA,094857.60,5055.58953121,N,00701.48716086,E,2,05,2.5,45.347,M,47.654,M,22.8,0100*4F
$GPGGA,094857.70,5055.58857263,N,00701.48667388,E,2,05,2.5,45.374,M,47.654,M,22.9,0100*45
$GPGGA,094857.80,5055.58760440,N,00701.48619977,E,2,05,2.5,45.401,M,47.654,M,23.0,0100*48
$GPGGA,094857.90,5055.58664631,N,00701.48571662,E,2,05,2.5,45.423,M,47.654,M,23.1,0100*4F
The GGA stuff is ok. The JSON is a mystery. Perhaps there is a flag in the
gps_read() that tells the type of data so I can skip other than the real NMEA
strings? But when I only said I wanted RAW, should I expect other stuff as
well? Also, the JSON strings are always reported as shown here. The third line
looks odd.
If I choose WATCH_JSON, I also get these strings at the start. But as they are
JSON this seems less mysterious. Also, the third line looks odd here as well:
{"class":"VERSION","release":"3.10","rev":"3.10","proto_major":3,"proto_minor":9}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}
Z","flags":1,"native":0,"bps":4800,"parity":"N","stopbits":1,"cycle":1.00}]}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}
{"class":"TPV","tag":"GGA","device":"/dev/pts/7","mode":3,"time":"2009-04-01T09:49:28.200Z","ept":0.005,"lat":50.922154551,"lon":7.021976050,"alt":44.252,"speed":1049.000,"climb":-1.047}
{"class":"TPV","tag":"GGA","device":"/dev/pts/7","mode":3,"time":"2009-04-01T09:49:28.300Z","ept":0.005,"lat":50.922149416,"lon":7.021953345,"alt":44.250,"speed":16.956,"climb":-0.020}
{"class":"TPV","tag":"GGA","device":"/dev/pts/7","mode":3,"time":"2009-04-01T09:49:28.400Z","ept":0.005,"lat":50.922144627,"lon":7.021930506,"alt":44.248,"speed":16.920,"climb":-0.020}
{"class":"TPV","tag":"GGA","device":"/dev/pts/7","mode":3,"time":"2009-04-01T09:49:28.500Z","ept":0.005,"lat":50.922139731,"lon":7.021907576,"alt":44.246,"speed":17.018,"climb":-0.020}
{"class":"TPV","tag":"GGA","device":"/dev/pts/7","mode":3,"time":"2009-04-01T09:49:28.600Z","ept":0.005,"lat":50.922135037,"lon":7.021884639,"alt":44.245,"speed":16.953,"climb":-0.010}
Am I missing the docs for this? The libgps man page does not seem to have much
to say about this access method.
Roger Oberholtzer
Ramböll RST
Office: +46 (0)10-615 6020
Mobile: +46 (0)70-815 1696
address@hidden
________________________________________
Ramböll Sverige AB
Krukmakargatan 21
P.O. Box 17009
SE-104 62 Stockholm, Sweden
www.rambollrst.se
- [gpsd-users] gpsd WATCH_RAW, Roger Oberholtzer, 2015/03/05
- Re: [gpsd-users] gpsd WATCH_RAW, Gary E. Miller, 2015/03/05
- Re: [gpsd-users] gpsd WATCH_RAW, Eric S. Raymond, 2015/03/06
- Re: [gpsd-users] gpsd WATCH_RAW, Roger Oberholtzer, 2015/03/09
- Re: [gpsd-users] gpsd WATCH_RAW, Gary E. Miller, 2015/03/09
- Re: [gpsd-users] gpsd WATCH_RAW, Roger Oberholtzer, 2015/03/10
- Re: [gpsd-users] gpsd WATCH_RAW, Gary E. Miller, 2015/03/10
- Re: [gpsd-users] gpsd WATCH_RAW,
Roger Oberholtzer <=
- Re: [gpsd-users] gpsd WATCH_RAW, Eric S. Raymond, 2015/03/12
- Re: [gpsd-users] gpsd WATCH_RAW, Roger Oberholtzer, 2015/03/12
- Re: [gpsd-users] gpsd WATCH_RAW, Eric S. Raymond, 2015/03/12