gpsd_json
Types and functions for working with GPSD’s JSON API.
https://gpsd.io/gpsd_json.html
This library does not cover the full API presently, instead it only covers basic parts of the API that I wanted for my project. Pull requests to add support for parts that you want are very welcome!
Types
pub type Command {
WatchCommand(
enable: option.Option(Bool),
json: option.Option(Bool),
)
PollCommand
}
Constructors
-
WatchCommand( enable: option.Option(Bool), json: option.Option(Bool), )This command sets watcher mode.
https://gpsd.io/gpsd_json.html#_watch
Arguments
- enable
-
Enable (true) or disable (false) watcher mode.
- json
-
Enable (true) or disable (false) dumping of JSON reports.
-
PollCommandThe 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.
pub type NmeaMode {
UnknownNmeaMode
NoFixNmeaMode
TwoDimensionalNmeaMode
ThreeDimensionalNmeaMode
}
Constructors
-
UnknownNmeaMode -
NoFixNmeaMode -
TwoDimensionalNmeaMode -
ThreeDimensionalNmeaMode
pub type Response {
TpvResponse(Tpv)
PollResponse(time: String, active: Int, tpv: List(Tpv))
OtherResponse(class: String)
}
Constructors
-
TpvResponse(Tpv)A TPV object is a time-position-velocity report.
-
PollResponse(time: String, active: Int, tpv: List(Tpv))Response to the POLL command.
https://gpsd.io/gpsd_json.html#_poll
Arguments
- time
-
Timestamp in ISO 8601 format. May have a fractional part of up to .001sec precision.
- active
-
Count of active devices.
-
OtherResponse(class: String)
pub type Tpv {
Tpv(
mode: NmeaMode,
device: option.Option(String),
time: option.Option(String),
latitude: option.Option(Float),
longitude: option.Option(Float),
)
}
Constructors
-
Tpv( mode: NmeaMode, device: option.Option(String), time: option.Option(String), latitude: option.Option(Float), longitude: option.Option(Float), )Arguments
- device
-
The name of the originating device
- time
-
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. May be present, but invalid, if there is no fix. Verify 3 consecutive 3D fixes before believing it is UTC. Even then it may be off by several seconds until the current leap seconds is known.
- latitude
-
Latitude in degrees: +/- signifies North/South.
- longitude
-
Longitude in degrees: +/- signifies East/West.
Values
pub fn command_to_string(command: Command) -> String
pub fn response_decoder() -> decode.Decoder(Response)