GPSD server command interface
Share GPS can act as a GPSD compatible server. In addition to the normal GPSD command interface (please see http://www.catb.org/gpsd/gpsd_json.html), there are also Share GPS commands specific to the application.
The setup of GPSD server connections is very similiar to NMEA.
Please see the cooresponding NMEA guide for setup:
The following are the Share GPS specific commands that can be utilized:
?SHGPS.WATCH;
This command returns the current watch settings in json format. Example response:
{"class":"SHGPS.WATCH","gga":false,"location":false,"raw":0,"rmc":false,"track": false}
For gga,rmc,track, and location, these are booleans that are used to set periodic streaming.
With regards to gga and rmc, these are the normal NMEA strings. For location and track,
these are json formatted (unless raw is 1) strings described below.
?SHGPS.WATCH={"gga":true, "rmc":true}
This is an example of setting both NMEA GGA and RMC streaming to true. This will return the
current WATCH value and then start streaming data.
?SHGPS.LOCATION;
This command returns the current location in json format. Example response:
{"class":"SHGPS.LOCATION","alt":-23.17,"lat":29.27210482,"lon":-81.71332591,
"mode":3,"time":"2016-07-04T16:18:06.000Z"}
if raw is set to 1, this will return the values in comma seperated format and not json:
3,2016-07-11T13:48:25.000Z,29.272407,-81.713531,59.8
?SHGPS.TRACK;
This command returns the current track information in json format. Example response:
{"class":"SHGPS.TRACK","dis_trav":6822.9014,"in_track":false,"start_alt":-30.0,
"start_lat":28.27210004,"start_lon":-80.71328804,"track_time":1335354}
Note that time value is in milliseconds, and distances are in meters.
if raw is set to 1, this will return the values in comma seperated format and not json:
false,28.27210004,-80.71328804,-30.0,6822.9014,1335354
?SHGPS.GGA;
This command returns standard NMEA GGA sentance
?SHGPS.RMC;
This command returns standard NMEA RMC sentance
Additional Notes:
Like GPSD, this server will ship the version string on connection. Note that for UDP, since it is connectionless, no version string is shipped, you need to ask for it.
Netcat is a good tool for testing things out. For TCP:
Now for UDP connections:
Another good set of tools are those included with GPSD for
linux, like cgps and xgps. They can take ip addresses of the
GPSD server (i.e., the mobile phone address)
xgps 192.168.219.154