Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrTimeout = errors.New("Timeout") ErrWatchModeEnabled = errors.New("Operation not available while in watch mode") )
var ErrUnsupportedProtocolVersion = errors.New("Unsupported protocol version")
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { Version Version // contains filtered or unexported fields }
Conn represents a socket connection to an GPSd daemon.
func (*Conn) Devices ¶
Devices returns a list of all devices GPSd is aware of.
ErrWatchModeEnabled will be returned if the connection is in watch mode. A nil-slice will be returned if the connection has been closed.
func (*Conn) Next ¶
Next returns the next object sent from the daemon, or an error.
The empty interface returned can be any of the following types:
- Sky: A Sky object reports a sky view of the GPS satellite positions.
- TPV: A TPV object is a time-position-velocity report.
func (*Conn) NextPosTimeout ¶
NextPosTimeout returns the next reported position, or an empty position on timeout.
type Device ¶
type Device struct { Path string `json:"path,omitempty"` Flags *int `json:"flags,omitempty"` Driver string `json:"driver,omitempty"` Subtype string `json:"subtype,omitempty"` Bps *int `json:"bps,omitempty"` Parity string `json:"parity"` StopBits int `json:"stopbits"` }
Device represents a connected sensor/GPS.
type Position ¶
type Position struct {
Lat, Lon float64 // Latitude/longitude in degrees. +/- signifies north/south.
Alt float64 // Altitude in meters.
Track float64 // Course over ground, degrees from true north.
Speed float64 // Speed over ground, meters per second.
Time time.Time // Time as reported by the device.
}
Position holds geopgraphic positioning data.
type Positioner ¶
Objects implementing the Positioner interface provides geographic positioning data.
This is particularly useful for testing if an object returned by Next can be used to determine the device position.
type Satellite ¶
type Satellite struct { // PRN ID of the satellite. 1-63 are GNSS satellites, 64-96 are GLONASS satellites, 100-164 are SBAS satellites. PRN int `json:"PRN"` // Azimuth, degrees from true north. Azimuth json.Number `json:"az"` // Elevation in degrees. Elevation json.Number `json:"el"` // Signal strength in dB. SignalStrength json.Number `json:"ss"` // 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). Used bool `json:"used"` }
Satellite represents a GPS satellite.
type Sky ¶
type Sky struct { Device string `json:"device,omitempty"` Time time.Time `json:"time,omitempty"` XDOP, YDOP, VDOP, TDOP, HDOP, PDOP, GDOP json.Number Satellites []Satellite `json:"satellites"` }
A Sky object reports a sky view of the GPS satellite positions.
type TPV ¶
type TPV struct { Device string // Name of originating device. Mode NMEAMode // NMEA mode: %d, 0=no mode value yet seen, 1=no fix, 2=2D, 3=3D. Time time.Time // Time/date stamp. May have a fractional part of up to .001sec precision. May be absent if mode is not 2D or 3D. EPT json.Number // Estimated timestamp error (%f, seconds, 95% confidence). Present if time is present. Lat, Lon, Alt json.Number EPX, EPY, EPV json.Number // Lat, Lon, Alt error estimate in meters, 95% confidence. Present if mode is 2 or 3 and DOPs can be calculated from the satellite view. Track, Speed, Climb json.Number EPD, EPS, EPC json.Number }
A TPV object is a time-position-velocity report.