GnssSnapshot

Struct GnssSnapshot 

Source
pub struct GnssSnapshot {
    pub fix: FixKind,
    pub altitude_m: Option<i32>,
    pub accuracy_dm: Option<u16>,
    pub sats_used: u8,
    pub sats_in_view: Option<u8>,
    /* private fields */
}
Expand description

The receiver’s current view of position and constellation.

The default is what a disabled or searching receiver reports: no fix, no satellites, nothing positional to say.

Fields§

§fix: FixKind

Fix quality.

§altitude_m: Option<i32>

Altitude above the WGS-84 ellipsoid in meters, matching the units of node identity option 2. None without a three-dimensional fix.

§accuracy_dm: Option<u16>

Estimated horizontal accuracy in decimeters.

§sats_used: u8

Satellites contributing to the solution.

§sats_in_view: Option<u8>

Satellites the receiver can see, whether or not they are used. None when the receiver does not report it.

Implementations§

Source§

impl GnssSnapshot

Source

pub const SEARCHING: Self

What a receiver that is off — or on but still searching — reports.

Source

pub fn location(&self) -> &[u8]

The encoded location, in the variable-precision interleaved format. Empty when there is no position.

Source

pub fn set_location(&mut self, bytes: &[u8])

Replace the location, silently truncating past MAX_LOCATION_LEN.

Source

pub const fn accuracy_from_hdop_centi(hdop_centi: u16) -> u16

Turn a horizontal dilution of precision, in hundredths, into the accuracy estimate PROP_GNSS_PRECISION reports.

This is an estimate scaled by an assumed range error, not a measured error bound; receivers that report a real accuracy figure should set accuracy_dm from that instead. The product cannot overflow: the largest dilution the argument can express still scales to half of u16::MAX.

Source

pub fn encode(&self, key: u32, out: &mut [u8]) -> Result<usize, GnssError>

Encode the value of one positioning property.

Returns the number of bytes written; zero is the empty value, and is what the three positional properties answer without a fix.

Source

pub fn absorb(&mut self, key: u32, value: &[u8]) -> Result<(), GnssError>

Fold one property value back into the snapshot.

A host reads the positioning properties one at a time; this is how it reassembles them. The empty value clears the corresponding field rather than leaving a stale one behind.

Trait Implementations§

Source§

impl Clone for GnssSnapshot

Source§

fn clone(&self) -> GnssSnapshot

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for GnssSnapshot

Source§

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

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

impl Default for GnssSnapshot

Source§

fn default() -> GnssSnapshot

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

impl PartialEq for GnssSnapshot

Source§

fn eq(&self, other: &GnssSnapshot) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for GnssSnapshot

Source§

impl Eq for GnssSnapshot

Source§

impl StructuralPartialEq for GnssSnapshot

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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.
§

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

Performs the conversion.