Struct Device

Source
pub struct Device {
Show 19 fields pub id: String, pub homie_version: String, pub name: Option<String>, pub state: State, pub implementation: Option<String>, pub nodes: HashMap<String, Node>, pub extensions: Vec<Extension>, pub local_ip: Option<String>, pub mac: Option<String>, pub firmware_name: Option<String>, pub firmware_version: Option<String>, pub stats_interval: Option<Duration>, pub stats_uptime: Option<Duration>, pub stats_signal: Option<i64>, pub stats_cputemp: Option<f64>, pub stats_cpuload: Option<i64>, pub stats_battery: Option<i64>, pub stats_freeheap: Option<u64>, pub stats_supply: Option<f64>,
}
Expand description

A Homie device which has been discovered.

The id, homie_version, name and state are required, but might not be available immediately when the device is first discovered. The implementation is optional.

Fields§

§id: String

The subtopic ID of the device. This is unique per Homie base topic, and should follow the Homie ID format.

§homie_version: String

The version of the Homie convention which the device implements.

§name: Option<String>

The human-readable name of the device. This is a required attribute, but might not be available as soon as the device is first discovered.

§state: State

The current state of the device according to the Homie device lifecycle.

§implementation: Option<String>

An identifier for the Homie implementation which the device uses.

§nodes: HashMap<String, Node>

The nodes of the device, keyed by their IDs.

§extensions: Vec<Extension>

The Homie extensions implemented by the device.

§local_ip: Option<String>

The IP address of the device on the local network.

§mac: Option<String>

The MAC address of the device’s network interface.

§firmware_name: Option<String>

The name of the firmware running on the device.

§firmware_version: Option<String>

The version of the firware running on the device.

§stats_interval: Option<Duration>

The interval at which the device refreshes its stats.

§stats_uptime: Option<Duration>

The amount of time since the device booted.

§stats_signal: Option<i64>

The device’s signal strength in %.

§stats_cputemp: Option<f64>

The device’s CPU temperature in °C.

§stats_cpuload: Option<i64>

The device’s CPU load in %, averaged across all CPUs over the last stats_interval.

§stats_battery: Option<i64>

The device’s battery level in %.

§stats_freeheap: Option<u64>

The device’s free heap space in bytes.

§stats_supply: Option<f64>

The device’s power supply voltage in volts.

Implementations§

Source§

impl Device

Source

pub fn has_required_attributes(&self) -> bool

Returns whether all the required attributes of the device and all its nodes and properties are filled in.

Trait Implementations§

Source§

impl Clone for Device

Source§

fn clone(&self) -> Device

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Device

Source§

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

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

impl PartialEq for Device

Source§

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

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

const 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 StructuralPartialEq for Device

Auto Trait Implementations§

§

impl Freeze for Device

§

impl RefUnwindSafe for Device

§

impl Send for Device

§

impl Sync for Device

§

impl Unpin for Device

§

impl UnwindSafe for Device

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