pub struct GpsdClientCore<Stream, Proto> { /* private fields */ }Expand description
Core implementation of a blocking GPSD client
This struct provides the fundamental functionality for synchronous communication with a GPSD server. It handles protocol negotiation, message serialization/deserialization, and maintains the connection state.
§Type Parameters
Stream- The underlying I/O stream type (e.g., TcpStream)Proto- The GPSD protocol version implementation
Implementations§
Source§impl<Stream, Proto> GpsdClientCore<Stream, Proto>where
Proto: GpsdJsonProtocol,
impl<Stream, Proto> GpsdClientCore<Stream, Proto>where
Proto: GpsdJsonProtocol,
Sourcepub fn open(stream: Stream) -> Result<Self>
pub fn open(stream: Stream) -> Result<Self>
Opens a new GPSD client connection using the provided stream
This method initializes the client with the given I/O stream and performs protocol version negotiation with the GPSD server.
§Arguments
stream- The I/O stream for communication with GPSD
§Returns
Ok(client)- Successfully connected and negotiated protocolErr(_)- Connection or protocol negotiation failed
Source§impl<Proto> GpsdClientCore<TcpStream, Proto>where
Proto: GpsdJsonProtocol,
impl<Proto> GpsdClientCore<TcpStream, Proto>where
Proto: GpsdJsonProtocol,
Sourcepub fn connect<A: ToSocketAddrs>(addr: A) -> Result<Self>
pub fn connect<A: ToSocketAddrs>(addr: A) -> Result<Self>
Connects to a GPSD server over TCP
Creates a TCP connection to the specified address and initializes a GPSD client with protocol negotiation.
§Arguments
addr- Socket address of the GPSD server (e.g., “127.0.0.1:2947”)
§Returns
Ok(client)- Successfully connected to GPSDErr(_)- Connection failed or protocol negotiation failed
§Example
let client = GpsdClient::connect("127.0.0.1:2947").unwrap();Source§impl<Stream> GpsdClientCore<Stream, V3>
impl<Stream> GpsdClientCore<Stream, V3>
Sourcepub fn version(&mut self) -> Result<Version>
pub fn version(&mut self) -> Result<Version>
Requests version information from the GPSD server
Returns details about the GPSD server version, protocol version, and capabilities.
Sourcepub fn devices(&mut self) -> Result<DeviceList>
pub 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.
Sourcepub fn device(&mut self) -> Result<Device>
pub 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.
Sourcepub fn watch(&mut self) -> Result<(Watch, DeviceList)>
pub 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.
Sourcepub fn poll(&mut self) -> Result<Poll>
pub 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.