Struct unbounded_gpsd::GpsdConnection
source · pub struct GpsdConnection { /* private fields */ }
Expand description
A connection to gpsd.
Implementations§
source§impl GpsdConnection
impl GpsdConnection
sourcepub fn new<A: ToSocketAddrs>(addr: A) -> GpsdResult<Self>
pub fn new<A: ToSocketAddrs>(addr: A) -> GpsdResult<Self>
Make a new connection to a given address.
sourcepub fn watch(&mut self, watch: bool) -> GpsdResult<()>
pub fn watch(&mut self, watch: bool) -> GpsdResult<()>
Enable or disable watcher mode.
sourcepub fn watch_raw(&mut self, watch: bool, json: bool, raw: u8) -> GpsdResult<()>
pub fn watch_raw(&mut self, watch: bool, json: bool, raw: u8) -> GpsdResult<()>
Enable RAW mode. In RAW mode, gpsd sends raw data from the GPS device, depending on the value of raw
:
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.
sourcepub fn poll(&mut self) -> GpsdResult<()>
pub fn poll(&mut self) -> GpsdResult<()>
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.
sourcepub fn version(&mut self) -> GpsdResult<()>
pub fn version(&mut self) -> GpsdResult<()>
Ask for the server’s version (triggers a Response::Version).
sourcepub fn devices(&mut self) -> GpsdResult<()>
pub fn devices(&mut self) -> GpsdResult<()>
Ask for the server’s devices (triggers a Response::Devices)
sourcepub fn set_read_timeout(&mut self, dur: Option<Duration>) -> GpsdResult<()>
pub fn set_read_timeout(&mut self, dur: Option<Duration>) -> GpsdResult<()>
Sets the read timeout for get_response
.
A value of None
implies that the read will never block.
sourcepub fn get_response(&mut self) -> GpsdResult<Response>
pub fn get_response(&mut self) -> GpsdResult<Response>
Polls for responses from GPSD, blocking if necessary.
Ideally, you run this in a loop somewhere to process messages.