GpsdClient

Type Alias GpsdClient 

Source
pub type GpsdClient<Stream> = GpsdClientCore<Stream, V3>;
Expand description

Type alias for an async GPSD client using protocol version 3

This is the most common async client type and should be used for connecting to modern GPSD servers (version 3.x) with async/await.

Aliased Type§

pub struct GpsdClient<Stream> { /* private fields */ }

Implementations§

Source§

impl<Stream> GpsdClient<Stream>
where Stream: AsyncRead + AsyncWrite + Unpin,

Source

pub async fn version(&mut self) -> Result<Version>

Requests version information from the GPSD server

Returns details about the GPSD server version, protocol version, and capabilities.

Source

pub async fn devices(&mut self) -> Result<DeviceList>

Lists all GPS devices known to the GPSD server

Returns information about each connected GPS receiver including device paths, driver information, and current status.

Source

pub async fn device(&mut self) -> Result<Device>

Gets information about the currently active GPS device

Returns detailed information about the device currently being used for GPS data.

Source

pub async fn watch(&mut self) -> Result<(Watch, DeviceList)>

Enables data streaming from GPSD with default settings

Returns the current watch configuration and list of available devices. After calling this method, GPS data will be streamed from the server.

Source

pub async fn poll(&mut self) -> Result<Poll>

Polls for the current GPS fix data

Returns the most recent GPS fix information available from all active devices.

Source

pub async fn watch_mode(&mut self, enable: bool) -> Result<()>

Enables or disables data streaming mode

§Arguments
  • enable - true to start streaming, false to stop
Source

pub async fn stream<Format: StreamFormat>( self, opts: StreamOptions<Format>, ) -> Result<GpsdDataStream<Stream, V3, Format>>

Starts a data stream with the specified format and options

This method consumes the client and returns a stream iterator that yields GPS data in the requested format.

§Arguments
  • opts - Stream configuration options
§Example
let mut stream = client.stream(StreamOptions::json()).await?;
while let Some(msg) = stream.next().await {
    println!("GPS data: {:?}", msg?);
}