Struct gpsd_client::GPSData

source ·
pub struct GPSData {
Show 18 fields pub mode: Fix, pub sats: u8, pub sats_valid: u8, pub lon: f64, pub lat: f64, pub alt_hae: f64, pub alt_msl: f64, pub alt: f32, pub track: f32, pub speed: f32, pub climb: f32, pub time: String, pub epc: f32, pub eps: f32, pub ept: f32, pub epv: f32, pub epx: f32, pub epy: f32,
}
Expand description

Data from the gps device.

Fields§

§mode: Fix

NMEA mode: 0=unknown, 1=no fix, 2=2D, 3=3D.

§sats: u8

The number of satellites received by the GPS unit

§sats_valid: u8

The number of satellites with valid information.

§lon: f64

Longitude in degrees.

§lat: f64

Latitude in degrees

§alt_hae: f64

Altitude, height above ellipsoid, in meters.

§alt_msl: f64

MSL Altitude in meters. The geoid used is rarely specified and is often inaccurate.

§alt: f32

Deprecated. Altitude in meters. Use altHAE or altMSL.

§track: f32

Course over ground, degrees from true north

§speed: f32

Speed over ground, meters per second

§climb: f32

Climb (positive) or sink (negative) rate, meters per second

§time: String

Time/date stamp in ISO8601 format, UTC. May have a fractional part of up to .001sec precision.

§epc: f32

Climb/sink error estimate in meters/sec, 95% confidence.

§eps: f32

Speed error estimated in meters/sec, 95% confidence.

§ept: f32

Estimated timestamp error (%f, seconds, 95% confidence).

§epv: f32

Estimated vertical error in meters, 95% confidence. Present if mode is 3 and DOPs can be calculated from the satellite view.

§epx: f32

Longitude error estimate in meters, 95% confidence. Present if mode is 2 or 3 and DOPs can be calculated from the satellite view.

§epy: f32

Latitude error estimate in meters, 95% confidence. Present if mode is 2 or 3 and DOPs can be calculated from the satellite view.

Implementations§

source§

impl GPSData

source

pub fn convert_speed(&self, mph: bool) -> f32

Converts the speed from the gps device to miles per hour or kilometers per hour. If mph is true then it’s mph else it’s km/h.

source

pub fn travel_direction(&self) -> String

Converts the track/heading of travel to the direction N, NE, E, SE, S, SW, W, NW.

source

pub fn convert_time(&self, timezone: &str) -> Result<String, GPSError>

Takes the time that gps receiver has and converts it to the Time Zone that was given.

Trait Implementations§

source§

impl Clone for GPSData

source§

fn clone(&self) -> GPSData

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for GPSData

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for GPSData

source§

fn default() -> GPSData

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.