Skip to main content

Location

Struct Location 

Source
pub struct Location {
Show 17 fields pub protocol_version: u8, pub status: Status, pub height_type: HeightType, pub direction: Option<f32>, pub speed_horizontal: Option<f32>, pub speed_vertical: Option<f32>, pub latitude: f64, pub longitude: f64, pub altitude_baro: Option<f32>, pub altitude_geo: Option<f32>, pub height: Option<f32>, pub horizontal_accuracy: HorizontalAccuracy, pub vertical_accuracy: VerticalAccuracy, pub baro_accuracy: VerticalAccuracy, pub speed_accuracy: SpeedAccuracy, pub timestamp_accuracy: TimestampAccuracy, pub timestamp: Option<f32>,
}
Expand description

Location and vector message.

Fields the transmitter marks as unknown decode to None.

Fields§

§protocol_version: u8

Protocol version from the header.

§status: Status

Operational status.

§height_type: HeightType

Reference of height.

§direction: Option<f32>

Track over ground in degrees clockwise from true north, 0 to 359.

§speed_horizontal: Option<f32>

Ground speed in m/s (0.25 m/s steps up to 63.75, then 0.75 m/s steps up to 254.25).

§speed_vertical: Option<f32>

Vertical speed in m/s, positive up, 0.5 m/s steps, -62 to 62.

§latitude: f64

Latitude in degrees. 0 together with longitude 0 means unknown, see Location::position.

§longitude: f64

Longitude in degrees.

§altitude_baro: Option<f32>

Pressure altitude in meters (standard atmosphere).

§altitude_geo: Option<f32>

Geodetic altitude in meters above the WGS84 ellipsoid.

§height: Option<f32>

Height in meters above the reference in height_type.

§horizontal_accuracy: HorizontalAccuracy

Horizontal accuracy code.

§vertical_accuracy: VerticalAccuracy

Geodetic altitude accuracy code.

§baro_accuracy: VerticalAccuracy

Pressure altitude accuracy code.

§speed_accuracy: SpeedAccuracy

Speed accuracy code.

§timestamp_accuracy: TimestampAccuracy

Timestamp accuracy code.

§timestamp: Option<f32>

Time of the position in seconds after the full UTC hour, 0.1 s steps.

Implementations§

Source§

impl Location

Source

pub fn decode(raw: &[u8; 25]) -> Result<Self, Error>

Decodes a Location message.

Source

pub fn encode(&self) -> Result<[u8; 25], Error>

Encodes the message, rejecting values outside the field ranges.

Source

pub fn position(&self) -> Option<(f64, f64)>

Latitude and longitude, or None when the transmitter sent 0, 0 (unknown).

Source

pub fn check(&self) -> impl Iterator<Item = LocationIssue>

Checks the decoded values against the ranges the standard allows and reports every problem found. The decoder itself accepts any bit pattern (as the reference library does), so receivers that want to drop corrupted or spoofed frames should call this.

Source

pub fn is_plausible(&self) -> bool

true if Location::check finds nothing.

Trait Implementations§

Source§

impl Clone for Location

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Location

Source§

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

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

impl Default for Location

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Location

Available on crate feature serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Location

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Location

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Location

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.