gpsd_json(5)

gpsd request/response protocol

Section 5 libgps-dev bookworm source

Description

'\" t

gpsd_json - gpsd request/response protocol

gpsd is a service daemon that can be used to monitor GPSes, DGPS receivers, Marine AIS broadcasts, and various other location-related and kinematic sensors.

Clients may communicate with gpsd via textual requests and responses over a socket. It is a bad idea for applications to speak the protocol directly: rather, they should use the libgps client library (for C; bindings also exist for other languages) and take appropriate care to conditionalize their code on the major and minor protocol version symbols.

The GPSD protocol is built on top of JSON, JavaScript Object Notation, as specified in RFC 7159: The JavaScript Object Notation (JSON) Data Interchange Format. GPSDs use of JSON is restricted in some ways that make parsing it in fixed-extent languages (such as C) easier.

A request line is introduced by "?" and may include multiple commands. Commands begin with a command identifier, followed either by a terminating ; or by an equal sign "=" and a JSON object treated as an argument. Any ; or newline indication (either LF or CR-LF) after the end of a command is ignored. All request lines must be composed of US-ASCII characters and may be no more than 80 characters in length, exclusive of the trailing newline.

Responses are JSON objects all of which have a "class" attribute the value of which is either the name of the invoking command. There are reports (including but not limited to as "TPV", "SKY", "DEVICE", and "ERROR") which are not direct responses to commands.

The order of JSON attributes within a response object is never significant, and you may specify command attributes in any order. Responses never contain the special JSON value null; instead, attributes with empty or undefined values are omitted. The length limit for responses and reports is 1536 characters, including a trailing newline; longer responses will be truncated, so client code must be prepared for the possibility of invalid JSON fragments.

In JSON reports, if an attribute is present only if the parent attribute is present or has a particular range, then the parent attribute is emitted first.

There is one constraint on the order in which attributes will be omitted. If an optional attribute is present only when a parent attribute has a specified value or range of values, the parent attribute will be emitted first to make parsing easier.

The next subsection section documents the core GPSD protocol. Extensions are documented in the following subsections. The extensions may not be supported in your gpsd instance if it has been compiled with a restricted feature set.

Here are the core-protocol responses:

TPV

A TPV object is a time-position-velocity report. The "class" and "mode" fields will reliably be present. The "mode" field will be emitted before optional fields that may be absent when there is no fix. Error estimates will be emitted after the fix components theyre associated with. Others may be reported or not depending on the fix quality.

All error estimates (epc, epd, epe, eph, ept, epv, epx, epy) are guessed to be 95% confidence, may also be 50%, one sigma, or two sigma confidence. Many GNSS receivers do not specify a confidence level. None specify how the value is calculated. Use error estimates with caution, and only as relative "goodness" indicators. If the GPS reports a value to gpsd, then gpsd will report that value. Otherwise gpsd will try to compute the value from the skyview.

allbox tab(:); lB lB lB lB. T{ Name T}:T{ Always? T}:T{ Type T}:T{ Description T}

l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l. T{ class T}:T{ Yes T}:T{ string T}:T{ Fixed: "TPV" T} T{ device T}:T{ No T}:T{ string T}:T{ Name of the originating device. T} T{ status T}:T{ No T}:T{ numeric T}:T{ GPS fix status: %d, 2=DGPS fix, 3=RTK Fixed point, 4=RTK Floating point, 5=DR fix, 6=GNSSDR fix, 7=Time (surveyed) fix, 8=Simulated, 9=P(Y) fix, otherwise not present. Similar to FAA Quality Indicator in NMEA. T} T{ mode T}:T{ Yes T}:T{ numeric T}:T{ NMEA mode: %d, 0=no mode value yet seen, 1=no fix, 2=2D, 3=3D. T} T{ time T}:T{ No T}:T{ string T}:T{ Time/date stamp in ISO8601 format, UTC. May have a fractional part of up to .001sec precision. May be absent if the mode is not 2D or 3D. T} T{ altHAE T}:T{ No T}:T{ numeric T}:T{ Altitude, height above allipsoid, in meters. Probably WGS84. T} T{ altMSL T}:T{ No T}:T{ numeric T}:T{ MSL Altitude in meters. The geoid used is rarely specified and is often inaccurate. See the comments below on geoidSep. altMSL is altHAE minus geoidSep. T} T{ alt T}:T{ No T}:T{ numeric T}:T{ Deprecated. Undefined. Use altHAE or altMSL. T} T{ climb T}:T{ No T}:T{ numeric T}:T{ Climb (positive) or sink (negative) rate, meters per second. T} T{ datum T}:T{ No T}:T{ string T}:T{ Current datum. Hopefully WGS84. T} T{ depth T}:T{ No T}:T{ numeric T}:T{ Depth in meters. Probably depth below the keel... T} T{ dgpsAge T}:T{ No T}:T{ numeric T}:T{ Age of DGPS data. In seconds T} T{ dgpsSta T}:T{ No T}:T{ numeric T}:T{ Station of DGPS data. T} T{ epc T}:T{ No T}:T{ numeric T}:T{ Estimated climb error in meters per second. Certainty unknown. T} T{ epd T}:T{ No T}:T{ numeric T}:T{ Estimated track (direction) error in degrees. Certainty unknown. T} T{ eph T}:T{ No T}:T{ numeric T}:T{ Estimated horizontal Position (2D) Error in meters. Also known as Estimated Position Error (epe). Certainty unknown. T} T{ eps T}:T{ No T}:T{ numeric T}:T{ Estimated speed error in meters per second. Certainty unknown. T} T{ ept T}:T{ No T}:T{ numeric T}:T{ Estimated timestamp error in seconds. Certainty unknown. T} T{ epx T}:T{ No T}:T{ numeric T}:T{ Longitude error estimate in meters. Certainty unknown. T} T{ epy T}:T{ No T}:T{ numeric T}:T{ Latitude error estimate in meters. Certainty unknown. T} T{ epv T}:T{ No T}:T{ numeric T}:T{ Estimated vertical error in meters. Certainty unknown. T} T{ geoidSep T}:T{ No T}:T{ numeric T}:T{ Geoid separation is the difference between the WGS84 reference ellipsoid and the geoid (Mean Sea Level) in meters. Almost no GNSS receiver specifies how they compute their geoid. gpsd interpolates the geoid from a 5x5 degree table of EGM2008 values when the receiver does not supply a geoid separation. The gpsd computed geoidSep is usually within one meter of the "true" value, but can be off as much as 12 meters. T} T{ lat T}:T{ No T}:T{ numeric T}:T{ Latitude in degrees: +/- signifies North/South. T} T{ leapseconds T}:T{ No T}:T{ integer T}:T{ Current leap seconds. T} T{ lon T}:T{ No T}:T{ numeric T}:T{ Longitude in degrees: +/- signifies East/West. T} T{ track T}:T{ No T}:T{ numeric T}:T{ Course over ground, degrees from true north. T} T{ magtrack T}:T{ No T}:T{ numeric T}:T{ Course over ground, degrees magnetic. T} T{ magvar T}:T{ No T}:T{ numeric T}:T{ Magnetic variation, degrees. Also known as the magnetic declination (the direction of the horizontal component of the magnetic field measured clockwise from north) in degrees, Positive is West variation. Negative is East variation. T} T{ speed T}:T{ No T}:T{ numeric T}:T{ Speed over ground, meters per second. T} T{ ecefx T}:T{ No T}:T{ numeric T}:T{ ECEF X position in meters. T} T{ ecefy T}:T{ No T}:T{ numeric T}:T{ ECEF Y position in meters. T} T{ ecefz T}:T{ No T}:T{ numeric T}:T{ ECEF Z position in meters. T} T{ ecefpAcc T}:T{ No T}:T{ numeric T}:T{ ECEF position error in meters. Certainty unknown. T} T{ ecefvx T}:T{ No T}:T{ numeric T}:T{ ECEF X velocity in meters per second. T} T{ ecefvy T}:T{ No T}:T{ numeric T}:T{ ECEF Y velocity in meters per second. T} T{ ecefvz T}:T{ No T}:T{ numeric T}:T{ ECEF Z velocity in meters per second. T} T{ ecefvAcc T}:T{ No T}:T{ numeric T}:T{ ECEF velocity error in meters per second. Certainty unknown. T} T{ sep T}:T{ No T}:T{ numeric T}:T{ Estimated Spherical (3D) Position Error in meters. Guessed to be 95% confidence, but many GNSS receivers do not specify, so certainty unknown. T} T{ relD T}:T{ No T}:T{ numeric T}:T{ Down component of relative position vector in meters. T} T{ relE T}:T{ No T}:T{ numeric T}:T{ East component of relative position vector in meters. T} T{ relN T}:T{ No T}:T{ numeric T}:T{ North component of relative position vector in meters. T} T{ velD T}:T{ No T}:T{ numeric T}:T{ Down velocity component in meters. T} T{ velE T}:T{ No T}:T{ numeric T}:T{ wEast velocity component in meters. T} T{ velN T}:T{ No T}:T{ numeric T}:T{ North velocity component in meters. T} T{ wanglem T}:T{ No T}:T{ numeric T}:T{ Wind angle magnetic in degrees. T} T{ wangler T}:T{ No T}:T{ numeric T}:T{ Wind angle relative in degrees. T} T{ wanglet T}:T{ No T}:T{ numeric T}:T{ Wind angle true in degrees. T} T{ wspeedr T}:T{ No T}:T{ numeric T}:T{ Wind speed relative in meters per second. T} T{ wspeedt T}:T{ No T}:T{ numeric T}:T{ Wind speed true in meters per second. T}

When the C client library parses a response of this kind, it will assert validity bits in the top-level set member for each field received; see gps.h for bitmask names and values.

Invalid or unknown floating-point values will be set to NAN. Always check floating points with isfinite() before use.

Heres an example:

{"class":"TPV","device":"/dev/pts/1", "time":"2005-06-08T10:34:48.283Z","ept":0.005, "lat":46.498293369,"lon":7.567411672,"alt":1343.127, "eph":36.000,"epv":32.321, "track":10.3788,"speed":0.091,"climb":-0.085,"mode":3}

SKY

A SKY object reports a sky view of the GPS satellite positions. If there is no GPS device available, or no skyview has been reported yet, only the "class" field will reliably be present.

allbox tab(:); lB lB lB lB. T{ Name T}:T{ Always? T}:T{ Type T}:T{ Description T}

l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l. T{ class T}:T{ Yes T}:T{ string T}:T{ Fixed: "SKY" T} T{ device T}:T{ No T}:T{ string T}:T{ Name of originating device T} T{ time T}:T{ No T}:T{ string T}:T{ Time/date stamp in ISO8601 format, UTC. May have a fractional part of up to .001sec precision. T} T{ gdop T}:T{ No T}:T{ numeric T}:T{ Geometric (hyperspherical) dilution of precision, a combination of PDOP and TDOP. A dimensionless factor which should be multiplied by a base UERE to get an error estimate. T} T{ hdop T}:T{ No T}:T{ numeric T}:T{ Horizontal dilution of precision, a dimensionless factor which should be multiplied by a base UERE to get a circular error estimate. T} T{ pdop T}:T{ No T}:T{ numeric T}:T{ Position (spherical/3D) dilution of precision, a dimensionless factor which should be multiplied by a base UERE to get an error estimate. T} T{ tdop T}:T{ No T}:T{ numeric T}:T{ Time dilution of precision, a dimensionless factor which should be multiplied by a base UERE to get an error estimate. T} T{ vdop T}:T{ No T}:T{ numeric T}:T{ Vertical (altitude) dilution of precision, a dimensionless factor which should be multiplied by a base UERE to get an error estimate. T} T{ xdop T}:T{ No T}:T{ numeric T}:T{ Longitudinal dilution of precision, a dimensionless factor which should be multiplied by a base UERE to get an error estimate. T} T{ ydop T}:T{ No T}:T{ numeric T}:T{ Latitudinal dilution of precision, a dimensionless factor which should be multiplied by a base UERE to get an error estimate. T} T{ nSat T}:T{ No T}:T{ numeric T}:T{ Number of satellite objects in "satellites" array. T} T{ uSat T}:T{ No T}:T{ numeric T}:T{ Number of satellites used in navigation solution. T} T{ satellites T}:T{ Yes T}:T{ list T}:T{ List of satellite objects in skyview T}

Many devices compute dilution of precision factors but do not include them in their reports. Many that do report DOPs report only HDOP, two-dimensional circular error. gpsd always passes through whatever the device reports, then attempts to fill in other DOPs by calculating the appropriate determinants in a covariance matrix based on the satellite view. DOPs may be missing if some of these determinants are singular. It can even happen that the device reports an error estimate in meters when the corresponding DOP is unavailable; some devices use more sophisticated error modeling than the covariance calculation.

The satellite list objects have the following elements:

allbox tab(:); lB lB lB lB. T{ Name T}:T{ Always? T}:T{ Type T}:T{ Description T}

l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l. T{ PRN T}:T{ Yes T}:T{ numeric T}:T{ PRN ID of the satellite. 1-63 are GNSS satellites, 64-96 are GLONASS satellites, 100-164 are SBAS satellites T} T{ az T}:T{ No T}:T{ numeric T}:T{ Azimuth, degrees from true north. T} T{ el T}:T{ No T}:T{ numeric T}:T{ Elevation in degrees. T} T{ ss T}:T{ No T}:T{ numeric T}:T{ Signal to Noise ratio in dBHz. T} T{ used T}:T{ Yes T}:T{ boolean T}:T{ Used in current solution? (SBAS/WAAS/EGNOS satellites may be flagged used if the solution has corrections from them, but not all drivers make this information available.) T} T{ gnssid T}:T{ No T}:T{ numeric T}:T{ The GNSS ID, as defined by u-blox, not NMEA. 0=GPS, 2=Galileo, 3=Beidou, 5=QZSS, 6-GLONASS. T} T{ svid T}:T{ No T}:T{ numeric T}:T{ The satellite ID within its constellation. As defined by u-blox, not NMEA). T} T{ sigid T}:T{ No T}:T{ numeric T}:T{ The signal ID of this signal. As defined by u-blox, not NMEA. See u-blox doc for details. T} T{ freqid T}:T{ No T}:T{ numeric T}:T{ For GLONASS satellites only: the frequency ID of the signal. As defined by u-blox, range 0 to 13. The freqid is the frequency slot plus 7. T} T{ health T}:T{ No T}:T{ numeric T}:T{ The health of this satellite. 0 is unknown, 1 is OK, and 2 is unhealthy. T}

Note that satellite objects do not have a "class" field, as they are never shipped outside of a SKY object.

When the C client library parses a SKY response, it will assert the SATELLITE_SET bit in the top-level set member.

Heres an example:

{"class":"SKY","device":"/dev/pts/1", "time":"2005-07-08T11:28:07.114Z", "xdop":1.55,"hdop":1.24,"pdop":1.99, "satellites":[ {"PRN":23,"el":6,"az":84,"ss":0,"used":false}, {"PRN":28,"el":7,"az":160,"ss":0,"used":false}, {"PRN":8,"el":66,"az":189,"ss":44,"used":true}, {"PRN":29,"el":13,"az":273,"ss":0,"used":false}, {"PRN":10,"el":51,"az":304,"ss":29,"used":true}, {"PRN":4,"el":15,"az":199,"ss":36,"used":true}, {"PRN":2,"el":34,"az":241,"ss":43,"used":true}, {"PRN":27,"el":71,"az":76,"ss":43,"used":true}]}

GST

A GST object is a pseudorange noise report.

allbox tab(:); lB lB lB lB. T{ Name T}:T{ Always? T}:T{ Type T}:T{ Description T}

l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l. T{ class T}:T{ Yes T}:T{ string T}:T{ Fixed: "GST" T} T{ device T}:T{ No T}:T{ string T}:T{ Name of originating device T} T{ time T}:T{ No T}:T{ string T}:T{ Time/date stamp in ISO8601 format, UTC. May have a fractional part of up to .001sec precision. T} T{ rms T}:T{ No T}:T{ numeric T}:T{ Value of the standard deviation of the range inputs to the navigation process (range inputs include pseudoranges and DGPS corrections). T} T{ major T}:T{ No T}:T{ numeric T}:T{ Standard deviation of semi-major axis of error ellipse, in meters. T} T{ minor T}:T{ No T}:T{ numeric T}:T{ Standard deviation of semi-minor axis of error ellipse, in meters. T} T{ orient T}:T{ No T}:T{ numeric T}:T{ Orientation of semi-major axis of error ellipse, in degrees from true north. T} T{ lat T}:T{ No T}:T{ numeric T}:T{ Standard deviation of latitude error, in meters. T} T{ lon T}:T{ No T}:T{ numeric T}:T{ Standard deviation of longitude error, in meters. T} T{ alt T}:T{ No T}:T{ numeric T}:T{ Standard deviation of altitude error, in meters. T}

Heres an example:

{"class":"GST","device":"/dev/ttyUSB0", "time":"2010-12-07T10:23:07.096Z","rms":2.440, "major":1.660,"minor":1.120,"orient":68.989, "lat":1.600,"lon":1.200,"alt":2.520}

ATT

An ATT object is a vehicle-attitude report. It is returned by digital-compass and gyroscope sensors; depending on device, it may include: heading, pitch, roll, yaw, gyroscope, and magnetic-field readings. Because such sensors are often bundled as part of marine-navigation systems, the ATT response may also include water depth.

The "class" and "mode" fields will reliably be present. Others may be reported or not depending on the specific device type.

allbox tab(:); lB lB lB lB. T{ Name T}:T{ Always? T}:T{ Type T}:T{ Description T}

l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l. T{ class T}:T{ Yes T}:T{ string T}:T{ Fixed: "ATT" T} T{ device T}:T{ Yes T}:T{ string T}:T{ Name of originating device T} T{ time T}:T{ No T}:T{ string T}:T{ Time/date stamp in ISO8601 format, UTC. May have a fractional part of up to .001sec precision. T} T{ heading T}:T{ No T}:T{ numeric T}:T{ Heading, degrees from true north. T} T{ mag_st T}:T{ No T}:T{ string T}:T{ Magnetometer status. T} T{ pitch T}:T{ No T}:T{ numeric T}:T{ Pitch in degrees. T} T{ pitch_st T}:T{ No T}:T{ string T}:T{ Pitch sensor status. T} T{ yaw T}:T{ No T}:T{ numeric T}:T{ Yaw in degrees T} T{ yaw_st T}:T{ No T}:T{ string T}:T{ Yaw sensor status. T} T{ roll T}:T{ No T}:T{ numeric T}:T{ Roll in degrees. T} T{ roll_st T}:T{ No T}:T{ string T}:T{ Roll sensor status. T} T{ dip T}:T{ No T}:T{ numeric T}:T{ Local magnetic inclination, degrees, positive when the magnetic field points downward (into the Earth). T} T{ mag_len T}:T{ No T}:T{ numeric T}:T{ Scalar magnetic field strength. T} T{ mag_x T}:T{ No T}:T{ numeric T}:T{ X component of magnetic field strength. T} T{ mag_y T}:T{ No T}:T{ numeric T}:T{ Y component of magnetic field strength. T} T{ mag_z T}:T{ No T}:T{ numeric T}:T{ Z component of magnetic field strength. T} T{ acc_len T}:T{ No T}:T{ numeric T}:T{ Scalar acceleration. T} T{ acc_x T}:T{ No T}:T{ numeric T}:T{ X component of acceleration. T} T{ acc_y T}:T{ No T}:T{ numeric T}:T{ Y component of acceleration. T} T{ acc_z T}:T{ No T}:T{ numeric T}:T{ Z component of acceleration. T} T{ gyro_x T}:T{ No T}:T{ numeric T}:T{ X component of acceleration. T} T{ gyro_y T}:T{ No T}:T{ numeric T}:T{ Y component of acceleration. T} T{ depth T}:T{ No T}:T{ numeric T}:T{ Water depth in meters. T} T{ temp T}:T{ No T}:T{ numeric T}:T{ Temperature at the sensor, degrees centigrade. T}

The heading, pitch, and roll status codes (if present) vary by device. For the TNT Revolution digital compasses, they are coded as follows:

allbox tab(:); lB lB. T{ Code T}:T{ Description T}

l l l l l l l l l l l l l l. T{ C T}:T{ magnetometer calibration alarm T} T{ L T}:T{ low alarm T} T{ M T}:T{ low warning T} T{ N T}:T{ normal T} T{ O T}:T{ high warning T} T{ P T}:T{ high alarm T} T{ V T}:T{ magnetometer voltage level alarm T}

When the C client library parses a response of this kind, it will assert ATT_IS.

Heres an example:

{"class":"ATT","time":1270938096.843, "heading":14223.00,"mag_st":"N", "pitch":169.00,"pitch_st":"N", "roll":-43.00,"roll_st":"N", "dip":13641.000,"mag_x":2454.000}

And here are the commands:

?VERSION;

Returns an object with the following attributes:

allbox tab(:); lB lB lB lB. T{ Name T}:T{ Always? T}:T{ Type T}:T{ Description T}

l l l l l l l l l l l l l l l l l l l l l l l l. T{ class T}:T{ Yes T}:T{ string T}:T{ Fixed: "VERSION" T} T{ release T}:T{ Yes T}:T{ string T}:T{ Public release level T} T{ rev T}:T{ Yes T}:T{ string T}:T{ Internal revision-control level. T} T{ proto_major T}:T{ Yes T}:T{ numeric T}:T{ API major revision level. T} T{ proto_minor T}:T{ Yes T}:T{ numeric T}:T{ API minor revision level. T} T{ remote T}:T{ No T}:T{ string T}:T{ URL of the remote daemon reporting this version. If empty, this is the version of the local daemon. T}

The daemon ships a VERSION response to each client when the client first connects to it.

When the C client library parses a response of this kind, it will assert the VERSION_SET bit in the top-level set member.

Heres an example:

{"class":"VERSION","version":"2.40dev", "rev":"06f62e14eae9886cde907dae61c124c53eb1101f", "proto_major":3,"proto_minor":1 }

?DEVICES;

Returns a device list object with the following elements:

allbox tab(:); lB lB lB lB. T{ Name T}:T{ Always? T}:T{ Type T}:T{ Description T}

l l l l l l l l l l l l. T{ class T}:T{ Yes T}:T{ string T}:T{ Fixed: "DEVICES" T} T{ devices T}:T{ Yes T}:T{ list T}:T{ List of device descriptions T} T{ remote T}:T{ No T}:T{ string T}:T{ URL of the remote daemon reporting the device set. If empty, this is a DEVICES response from the local daemon. T}

When the C client library parses a response of this kind, it will assert the DEVICELIST_SET bit in the top-level set member.

Heres an example:

{"class"="DEVICES","devices":[ {"class":"DEVICE","path":"/dev/pts/1","flags":1,"driver":"SiRF binary"}, {"class":"DEVICE","path":"/dev/pts/3","flags":4,"driver":"AIVDM"}]}

The daemon occasionally ships a bare DEVICE object to the client (that is, one not inside a DEVICES wrapper). The data content of these objects will be described later as a response to the ?DEVICE command.

?WATCH;

This command sets watcher mode. It also sets or elicits a report of per-subscriber policy and the raw bit. An argument WATCH object changes the subscribers policy. The response describes the subscribers policy. The response will also include a DEVICES object.

A WATCH object has the following elements:

allbox tab(:); lB lB lB lB. T{ Name T}:T{ Always? T}:T{ Type T}:T{ Description T}

l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l. T{ class T}:T{ Yes T}:T{ string T}:T{ Fixed: "WATCH" T} T{ enable T}:T{ No T}:T{ boolean T}:T{ Enable (true) or disable (false) watcher mode. Default is true. T} T{ json T}:T{ No T}:T{ boolean T}:T{ Enable (true) or disable (false) dumping of JSON reports. Default is false. T} T{ nmea T}:T{ No T}:T{ boolean T}:T{ Enable (true) or disable (false) dumping of binary packets as pseudo-NMEA. Default is false. T} T{ raw T}:T{ No T}:T{ integer T}:T{ Controls raw mode. When this attribute is set to 1 for a channel, gpsd reports the unprocessed NMEA or AIVDM data stream from whatever device is attached. Binary GPS packets are hex-dumped. RTCM2 and RTCM3 packets are not dumped in raw mode. When this attribute is set to 2 for a channel that processes binary data, gpsd reports the received data verbatim without hex-dumping. T} T{ scaled T}:T{ No T}:T{ boolean T}:T{ If true, apply scaling divisors to output before dumping; default is false. T} T{ split24 T}:T{ No T}:T{ boolean T}:T{ If true, aggregate AIS type24 sentence parts. If false, report each part as a separate JSON object, leaving the client to match MMSIs and aggregate. Default is false. Applies only to AIS reports. T} T{ pps T}:T{ No T}:T{ boolean T}:T{ If true, emit the TOFF JSON message on each cycle and a PPS JSON message when the device issues 1PPS. Default is false. T} T{ device T}:T{ No T}:T{ string T}:T{ If present, enable watching only of the specified device rather than all devices. Useful with raw and NMEA modes in which device responses arent tagged. Has no effect when used with enable:false. T} T{ remote T}:T{ No T}:T{ string T}:T{ URL of the remote daemon reporting the watch set. If empty, this is a WATCH response from the local daemon. T}

There is an additional boolean "timing" attribute which is undocumented because that portion of the interface is considered unstable and for developer use only.

In watcher mode, GPS reports are dumped as TPV and SKY responses. AIS, Subframe and RTCM reporting is described in the next section.

When the C client library parses a response of this kind, it will assert the POLICY_SET bit in the top-level set member.

Heres an example:

{"class":"WATCH", "raw":1,"scaled":true}

?POLL;

The POLL command requests data from the last-seen fixes on all active GPS devices. Devices must previously have been activated by ?WATCH to be pollable.

Polling can lead to possibly surprising results when it is used on a device such as an NMEA GPS for which a complete fix has to be accumulated from several sentences. If you poll while those sentences are being emitted, the response will contain the last complete fix data and may be as much as one cycle time (typically 1 second) stale.

The POLL response will contain a timestamped list of TPV objects describing cached data, and a timestamped list of SKY objects describing satellite configuration. If a device has not seen fixes, it will be reported with a mode field of zero.

allbox tab(:); lB lB lB lB. T{ Name T}:T{ Always? T}:T{ Type T}:T{ Description T}

l l l l l l l l l l l l l l l l l l l l. T{ class T}:T{ Yes T}:T{ string T}:T{ Fixed: "POLL" T} T{ time T}:T{ Yes T}:T{ Numeric T}:T{ Timestamp in ISO 8601 format. May have a fractional part of up to .001sec precision. T} T{ active T}:T{ Yes T}:T{ Numeric T}:T{ Count of active devices. T} T{ tpv T}:T{ Yes T}:T{ JSON array T}:T{ Comma-separated list of TPV objects. T} T{ sky T}:T{ Yes T}:T{ JSON array T}:T{ Comma-separated list of SKY objects. T}

Heres an example of a POLL response:

{"class":"POLL","time":"2010-06-04T10:31:00.289Z","active":1, "tpv":[{"class":"TPV","device":"/dev/ttyUSB0", "time":"2010-09-08T13:33:06.095Z", "ept":0.005,"lat":40.035093060, "lon":-75.519748733,"track":99.4319,"speed":0.123,"mode":2}], "sky":[{"class":"SKY","device":"/dev/ttyUSB0", "time":1270517264.240,"hdop":9.20, "satellites":[{"PRN":16,"el":55,"az":42,"ss":36,"used":true}, {"PRN":19,"el":25,"az":177,"ss":0,"used":false}, {"PRN":7,"el":13,"az":295,"ss":0,"used":false}, {"PRN":6,"el":56,"az":135,"ss":32,"used":true}, {"PRN":13,"el":47,"az":304,"ss":0,"used":false}, {"PRN":23,"el":66,"az":259,"ss":0,"used":false}, {"PRN":20,"el":7,"az":226,"ss":0,"used":false}, {"PRN":3,"el":52,"az":163,"ss":32,"used":true}, {"PRN":31,"el":16,"az":102,"ss":0,"used":false} ]}]}

Note

Client software should not assume the field inventory of the POLL response is fixed for all time. As gpsd collects and caches more data from more sensor types, those data are likely to find their way into this response.

TOFF

This message is emitted on each cycle and reports the offset between the hosts clock time and the GPS time at top of the second (actually, when the first data for the reporting cycle is received).

This message exactly mirrors the PPS message except for two details.

TOFF emits no NTP precision, this is assumed to be -2. See the NTP documentation for their definition of precision.

The TOFF message reports the GPS time as derived from the GPS serial data stream. The PPS message reports the GPS time as derived from the GPS PPS pulse.

A TOFF object has the following elements:

allbox tab(:); lB lB lB lB. T{ Name T}:T{ Always? T}:T{ Type T}:T{ Description T}

l l l l l l l l l l l l l l l l l l l l l l l l. T{ class T}:T{ Yes T}:T{ string T}:T{ Fixed: "TOFF" T} T{ device T}:T{ Yes T}:T{ string T}:T{ Name of the originating device T} T{ real_sec T}:T{ Yes T}:T{ numeric T}:T{ seconds from the GPS clock T} T{ real_nsec T}:T{ Yes T}:T{ numeric T}:T{ nanoseconds from the GPS clock T} T{ clock_sec T}:T{ Yes T}:T{ numeric T}:T{ seconds from the system clock T} T{ clock_nsec T}:T{ Yes T}:T{ numeric T}:T{ nanoseconds from the system clock T}

This message is emitted once per second to watchers of a device and is intended to report the timestamps of the in-band report of the GPS and seconds as reported by the system clock (which may be NTP-corrected) when the first valid timestamp of the reporting cycle was seen.

The message contains two second/nanosecond pairs: real_sec and real_nsec contain the time the GPS thinks it was at the start of the current cycle; clock_sec and clock_nsec contain the time the system clock thinks it was on receipt of the first timing message of the cycle. real_nsec is always to nanosecond precision. clock_nsec is nanosecond precision on most systems.

Heres an example:

{"class":"TOFF","device":"/dev/ttyUSB0", "real_sec":1330212592, "real_nsec":343182, "clock_sec":1330212592,"clock_nsec":343184, "precision":-2}

PPS