DeviceObject

Enum DeviceObject 

Source
pub enum DeviceObject {
    ActiveSeenPackets {
        path: Option<String>,
        activated: DateTime<Utc>,
        flags: u8,
        driver: String,
        subtype: Option<String>,
        bps: Option<u32>,
        parity: Option<String>,
        stopbits: Option<String>,
        native: Option<u8>,
        cycle: Option<f32>,
        minicycle: Option<f32>,
    },
    Active {
        path: Option<String>,
        activated: DateTime<Utc>,
        subtype: Option<String>,
        bps: Option<u32>,
        parity: Option<String>,
        stopbits: Option<String>,
        native: Option<u8>,
        cycle: Option<f32>,
        minicycle: Option<f32>,
    },
    Inactive {
        path: Option<String>,
    },
}
Expand description

Information about a device known to gpsd.

The API splits the DEVICE object into three variants:

  • ActiveSeenPackets: the device is active, and we’ve seen packets from it.
  • Active: the device is active, but we haven’t seen any packets.
  • Inactive: the device is inactive.

Basically, the aim here is to reduce the amount of Option unwrapping you have to do, as gpsd specifies that all these fields are optional.

Variants§

§

ActiveSeenPackets

Fields

§path: Option<String>

Name the device for which the control bits are being reported, or for which they are to be applied. This attribute may be omitted only when there is exactly one subscribed channel

§activated: DateTime<Utc>

Time the device was activated as an ISO8601 timestamp. If the device is inactive this attribute is absent.

§flags: u8

Bit vector of property flags. Currently defined flags are: describe packet types seen so far (GPS, RTCM2, RTCM3, AIS). Won’t be reported if empty, e.g. before gpsd has seen identifiable packets from the device.

§Flags
  • 0x01: GPS data seen
  • 0x02: RTCM2 data seen
  • 0x04: RTCM3 data seen
  • 0x08: AIS data seen

Yes, I know manual bitflags suck. I’ll fix it one day if you bug me.

§driver: String

GPSD’s name for the device driver type. Won’t be reported before gpsd has seen identifiable packets from the device.

§subtype: Option<String>

Whatever version information the device returned.

§bps: Option<u32>

Device speed in bits per second.

§parity: Option<String>

N, O or E for no parity, odd, or even.

§stopbits: Option<String>

Stop bits (1 or 2).

§native: Option<u8>

0 means NMEA mode and 1 means alternate mode (binary if it has one, for SiRF and Evermore chipsets in particular). Attempting to set this mode on a non-GPS device will yield an error.

§cycle: Option<f32>

Device cycle time in seconds.

§minicycle: Option<f32>

Device minimum cycle time in seconds. Reported from ?DEVICE when (and only when) the rate is switchable. It is read-only and not settable.

§

Active

Fields

§activated: DateTime<Utc>
§subtype: Option<String>
§parity: Option<String>
§stopbits: Option<String>
§native: Option<u8>
§cycle: Option<f32>
§minicycle: Option<f32>
§

Inactive

Fields

Trait Implementations§

Source§

impl Debug for DeviceObject

Source§

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

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

impl<'de> Deserialize<'de> for DeviceObject

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 Serialize for DeviceObject

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

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,