GPSData

Struct 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. For more information about the time zone string you can pass check out the crate chrono-tz.

Trait Implementations§

Source§

impl Clone for GPSData

Source§

fn clone(&self) -> GPSData

Returns a duplicate 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

Source§

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>,

Source§

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.