pub struct Nmea {Show 14 fields
pub fix_time: Option<NaiveTime>,
pub fix_date: Option<NaiveDate>,
pub fix_type: Option<FixType>,
pub latitude: Option<f64>,
pub longitude: Option<f64>,
pub altitude: Option<f32>,
pub speed_over_ground: Option<f32>,
pub true_course: Option<f32>,
pub num_of_fix_satellites: Option<u32>,
pub hdop: Option<f32>,
pub vdop: Option<f32>,
pub pdop: Option<f32>,
pub geoid_separation: Option<f32>,
pub fix_satellites_prns: Option<Vec<u32>>,
/* private fields */
}
Expand description
NMEA parser This struct parses NMEA sentences, including checksum checks and sentence validation.
Examples
use nmea::Nmea;
let mut nmea= Nmea::default();
let gga = "$GPGGA,092750.000,5321.6802,N,00630.3372,W,1,8,1.03,61.7,M,55.2,M,,*76";
nmea.parse(gga).unwrap();
println!("{}", nmea);
Fields
fix_time: Option<NaiveTime>
fix_date: Option<NaiveDate>
fix_type: Option<FixType>
latitude: Option<f64>
longitude: Option<f64>
altitude: Option<f32>
MSL Altitude in meters
speed_over_ground: Option<f32>
true_course: Option<f32>
num_of_fix_satellites: Option<u32>
hdop: Option<f32>
vdop: Option<f32>
pdop: Option<f32>
geoid_separation: Option<f32>
Geoid separation in meters
fix_satellites_prns: Option<Vec<u32>>
Implementations
sourceimpl<'a> Nmea
impl<'a> Nmea
Constructs a new Nmea
for navigation purposes.
Examples
use nmea::{Nmea, SentenceType};
let mut nmea = Nmea::create_for_navigation(&[SentenceType::RMC,
SentenceType::GGA]).unwrap();
let gga = "$GPGGA,092750.000,5321.6802,N,00630.3372,W,1,8,1.03,61.7,M,55.2,M,,*76";
nmea.parse(gga).unwrap();
println!("{}", nmea);
sourcepub fn fix_timestamp(&self) -> Option<NaiveTime>
pub fn fix_timestamp(&self) -> Option<NaiveTime>
Returns fix type
sourcepub fn latitude(&self) -> Option<f64>
pub fn latitude(&self) -> Option<f64>
Returns last fixed latitude in degress. None if not fixed.
sourcepub fn longitude(&self) -> Option<f64>
pub fn longitude(&self) -> Option<f64>
Returns last fixed longitude in degress. None if not fixed.
sourcepub fn fix_satellites(&self) -> Option<u32>
pub fn fix_satellites(&self) -> Option<u32>
Returns the number of satellites use for fix.
sourcepub fn geoid_altitude(&self) -> Option<f32>
pub fn geoid_altitude(&self) -> Option<f32>
Returns the altitude above MSL (geoid), meters.
sourcepub fn satellites(&self) -> Vec<Satellite>
pub fn satellites(&self) -> Vec<Satellite>
Returns used sattelites
sourcepub fn parse(&mut self, s: &'a str) -> Result<SentenceType, NmeaError<'a>>
pub fn parse(&mut self, s: &'a str) -> Result<SentenceType, NmeaError<'a>>
Parse any NMEA sentence and stores the result. The type of sentence is returnd if implemented and valid.
pub fn parse_for_fix(&mut self, xs: &'a [u8]) -> Result<FixType, NmeaError<'a>>
pub fn last_txt(&self) -> Option<&TxtData>
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Nmea
impl Send for Nmea
impl Sync for Nmea
impl Unpin for Nmea
impl UnwindSafe for Nmea
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more