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, 12>>,
/* 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";
// feature `GGA` should be enabled to parse this sentence.
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, 12>>
Implementations§
source§impl<'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";
// feature `GGA` should be enabled to parse this sentence.
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 degrees. None if not fixed.
sourcepub fn longitude(&self) -> Option<f64>
pub fn longitude(&self) -> Option<f64>
Returns last fixed longitude in degrees. 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, 58>
pub fn satellites(&self) -> Vec<Satellite, 58>
Returns used satellites
sourcepub fn parse(&mut self, sentence: &'a str) -> Result<SentenceType, Error<'a>>
pub fn parse(&mut self, sentence: &'a str) -> Result<SentenceType, Error<'a>>
Parse any NMEA sentence and stores the result of sentences that include:
- altitude
- latitude and longitude
- speed_over_ground
- and other
The type of sentence is returned if implemented and valid.
pub fn parse_for_fix(&mut self, xs: &'a str) -> Result<FixType, Error<'a>>
pub fn last_txt(&self) -> Option<&TxtData>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Nmea
impl<'de> Deserialize<'de> for Nmea
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more