Struct BatteryState

Source
pub struct BatteryState {
Show 16 fields pub header: Option<Header>, pub voltage: f64, pub temperature: f64, pub current: f64, pub charge: f64, pub capacity: f64, pub design_capacity: f64, pub percentage: f64, pub power_supply_status: i32, pub power_supply_health: i32, pub power_supply_technology: i32, pub present: bool, pub cell_voltage: Vec<f64>, pub cell_temperature: Vec<f64>, pub location: String, pub serial_number: String,
}

Fields§

§header: Option<Header>§voltage: f64

Voltage in Volts (Mandatory)

§temperature: f64

Temperature in Degrees Celsius (If unmeasured NaN)

§current: f64

Negative when discharging (A) (If unmeasured NaN)

§charge: f64

Current charge in Ah (If unmeasured NaN)

§capacity: f64

Capacity in Ah (last full capacity) (If unmeasured NaN)

§design_capacity: f64

Capacity in Ah (design capacity) (If unmeasured NaN)

§percentage: f64

Charge percentage on 0 to 1 range (If unmeasured NaN)

§power_supply_status: i32

The charging status as reported. Values defined above

§power_supply_health: i32

The battery health metric. Values defined above

§power_supply_technology: i32

The battery chemistry. Values defined above

§present: bool

True if the battery is present

§cell_voltage: Vec<f64>

An array of individual cell voltages for each cell in the pack

§cell_temperature: Vec<f64>

If individual voltages unknown but number of cells known set each to NaN

An array of individual cell temperatures for each cell in the pack

§location: String

If individual temperatures unknown but number of cells known set each to NaN

The location into which the battery is inserted. (slot number or plug)

§serial_number: String

The best approximation of the battery serial number

Implementations§

Source§

impl BatteryState

Source

pub fn power_supply_status(&self) -> PowerSupplyStatus

Returns the enum value of power_supply_status, or the default if the field is set to an invalid enum value.

Source

pub fn set_power_supply_status(&mut self, value: PowerSupplyStatus)

Sets power_supply_status to the provided enum value.

Source

pub fn power_supply_health(&self) -> PowerSupplyHealth

Returns the enum value of power_supply_health, or the default if the field is set to an invalid enum value.

Source

pub fn set_power_supply_health(&mut self, value: PowerSupplyHealth)

Sets power_supply_health to the provided enum value.

Source

pub fn power_supply_technology(&self) -> PowerSupplyTechnology

Returns the enum value of power_supply_technology, or the default if the field is set to an invalid enum value.

Source

pub fn set_power_supply_technology(&mut self, value: PowerSupplyTechnology)

Sets power_supply_technology to the provided enum value.

Trait Implementations§

Source§

impl Clone for BatteryState

Source§

fn clone(&self) -> BatteryState

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BatteryState

Source§

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

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

impl Default for BatteryState

Source§

fn default() -> Self

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

impl Message for BatteryState

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl PartialEq for BatteryState

Source§

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

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

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 BatteryState

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