Enum BatterySystem

Source
#[non_exhaustive]
pub enum BatterySystem {
Show 91 variants SmartBatteryBatteryMode, SmartBatteryBatteryStatus, SmartBatteryAlarmWarning, SmartBatteryChargerMode, SmartBatteryChargerStatus, SmartBatteryChargerSpecInfo, SmartBatterySelectorState, SmartBatterySelectorPresets, SmartBatterySelectorInfo, OptionalMfgFunction1, OptionalMfgFunction2, OptionalMfgFunction3, OptionalMfgFunction4, OptionalMfgFunction5, ConnectionToSMBus, OutputConnection, ChargerConnection, BatteryInsertion, UseNext, OKToUse, BatterySupported, SelectorRevision, ChargingIndicator, ManufacturerAccess, RemainingCapacityLimit, RemainingTimeLimit, AtRate, CapacityMode, BroadcastToCharger, PrimaryBattery, ChargeController, TerminateCharge, TerminateDischarge, BelowRemainingCapacityLimit, RemainingTimeLimitExpired, Charging, Discharging, FullyCharged, FullyDischarged, ConditioningFlag, AtRateOK, SmartBatteryErrorCode, NeedReplacement, AtRateTimeToFull, AtRateTimeToEmpty, AverageCurrent, MaxError, RelativeStateOfCharge, AbsoluteStateOfCharge, RemainingCapacity, FullChargeCapacity, RunTimeToEmpty, AverageTimeToEmpty, AverageTimeToFull, CycleCount, BatteryPackModelLevel, InternalChargeController, PrimaryBatterySupport, DesignCapacity, SpecificationInfo, ManufactureDate, SerialNumber, iManufacturerName, iDeviceName, iDeviceChemistry, ManufacturerData, Rechargable, WarningCapacityLimit, CapacityGranularity1, CapacityGranularity2, iOEMInformation, InhibitCharge, EnablePolling, ResetToZero, ACPresent, BatteryPresent, PowerFail, AlarmInhibited, ThermistorUnderRange, ThermistorHot, ThermistorCold, ThermistorOverRange, VoltageOutOfRange, CurrentOutOfRange, CurrentNotRegulated, VoltageNotRegulated, MasterMode, ChargerSelectorSupport, ChargerSpec, Level2, Level3,
}
Expand description

Usage Page 0x85: “Battery System”

This enum is autogenerated from the HID Usage Tables.

let u1 = Usage::BatterySystem(BatterySystem::SmartBatteryBatteryStatus);
let u2 = Usage::new_from_page_and_id(0x85, 0x2).unwrap();
let u3 = Usage::from(BatterySystem::SmartBatteryBatteryStatus);
let u4: Usage = BatterySystem::SmartBatteryBatteryStatus.into();
assert_eq!(u1, u2);
assert_eq!(u1, u3);
assert_eq!(u1, u4);

assert!(matches!(u1.usage_page(), UsagePage::BatterySystem));
assert_eq!(0x85, u1.usage_page_value());
assert_eq!(0x2, u1.usage_id_value());
assert_eq!((0x85 << 16) | 0x2, u1.usage_value());
assert_eq!("Smart Battery Battery Status", u1.name());

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

SmartBatteryBatteryMode

Usage ID 0x1: “Smart Battery Battery Mode”

§

SmartBatteryBatteryStatus

Usage ID 0x2: “Smart Battery Battery Status”

§

SmartBatteryAlarmWarning

Usage ID 0x3: “Smart Battery Alarm Warning”

§

SmartBatteryChargerMode

Usage ID 0x4: “Smart Battery Charger Mode”

§

SmartBatteryChargerStatus

Usage ID 0x5: “Smart Battery Charger Status”

§

SmartBatteryChargerSpecInfo

Usage ID 0x6: “Smart Battery Charger Spec Info”

§

SmartBatterySelectorState

Usage ID 0x7: “Smart Battery Selector State”

§

SmartBatterySelectorPresets

Usage ID 0x8: “Smart Battery Selector Presets”

§

SmartBatterySelectorInfo

Usage ID 0x9: “Smart Battery Selector Info”

§

OptionalMfgFunction1

Usage ID 0x10: “Optional Mfg Function 1”

§

OptionalMfgFunction2

Usage ID 0x11: “Optional Mfg Function 2”

§

OptionalMfgFunction3

Usage ID 0x12: “Optional Mfg Function 3”

§

OptionalMfgFunction4

Usage ID 0x13: “Optional Mfg Function 4”

§

OptionalMfgFunction5

Usage ID 0x14: “Optional Mfg Function 5”

§

ConnectionToSMBus

Usage ID 0x15: “Connection To SM Bus”

§

OutputConnection

Usage ID 0x16: “Output Connection”

§

ChargerConnection

Usage ID 0x17: “Charger Connection”

§

BatteryInsertion

Usage ID 0x18: “Battery Insertion”

§

UseNext

Usage ID 0x19: “Use Next”

§

OKToUse

Usage ID 0x1A: “OK To Use”

§

BatterySupported

Usage ID 0x1B: “Battery Supported”

§

SelectorRevision

Usage ID 0x1C: “Selector Revision”

§

ChargingIndicator

Usage ID 0x1D: “Charging Indicator”

§

ManufacturerAccess

Usage ID 0x28: “Manufacturer Access”

§

RemainingCapacityLimit

Usage ID 0x29: “Remaining Capacity Limit”

§

RemainingTimeLimit

Usage ID 0x2A: “Remaining Time Limit”

§

AtRate

Usage ID 0x2B: “At Rate”

§

CapacityMode

Usage ID 0x2C: “Capacity Mode”

§

BroadcastToCharger

Usage ID 0x2D: “Broadcast To Charger”

§

PrimaryBattery

Usage ID 0x2E: “Primary Battery”

§

ChargeController

Usage ID 0x2F: “Charge Controller”

§

TerminateCharge

Usage ID 0x40: “Terminate Charge”

§

TerminateDischarge

Usage ID 0x41: “Terminate Discharge”

§

BelowRemainingCapacityLimit

Usage ID 0x42: “Below Remaining Capacity Limit”

§

RemainingTimeLimitExpired

Usage ID 0x43: “Remaining Time Limit Expired”

§

Charging

Usage ID 0x44: “Charging”

§

Discharging

Usage ID 0x45: “Discharging”

§

FullyCharged

Usage ID 0x46: “Fully Charged”

§

FullyDischarged

Usage ID 0x47: “Fully Discharged”

§

ConditioningFlag

Usage ID 0x48: “Conditioning Flag”

§

AtRateOK

Usage ID 0x49: “At Rate OK”

§

SmartBatteryErrorCode

Usage ID 0x4A: “Smart Battery Error Code”

§

NeedReplacement

Usage ID 0x4B: “Need Replacement”

§

AtRateTimeToFull

Usage ID 0x60: “At Rate Time To Full”

§

AtRateTimeToEmpty

Usage ID 0x61: “At Rate Time To Empty”

§

AverageCurrent

Usage ID 0x62: “Average Current”

§

MaxError

Usage ID 0x63: “Max Error”

§

RelativeStateOfCharge

Usage ID 0x64: “Relative State Of Charge”

§

AbsoluteStateOfCharge

Usage ID 0x65: “Absolute State Of Charge”

§

RemainingCapacity

Usage ID 0x66: “Remaining Capacity”

§

FullChargeCapacity

Usage ID 0x67: “Full Charge Capacity”

§

RunTimeToEmpty

Usage ID 0x68: “Run Time To Empty”

§

AverageTimeToEmpty

Usage ID 0x69: “Average Time To Empty”

§

AverageTimeToFull

Usage ID 0x6A: “Average Time To Full”

§

CycleCount

Usage ID 0x6B: “Cycle Count”

§

BatteryPackModelLevel

Usage ID 0x80: “Battery Pack Model Level”

§

InternalChargeController

Usage ID 0x81: “Internal Charge Controller”

§

PrimaryBatterySupport

Usage ID 0x82: “Primary Battery Support”

§

DesignCapacity

Usage ID 0x83: “Design Capacity”

§

SpecificationInfo

Usage ID 0x84: “Specification Info”

§

ManufactureDate

Usage ID 0x85: “Manufacture Date”

§

SerialNumber

Usage ID 0x86: “Serial Number”

§

iManufacturerName

Usage ID 0x87: “iManufacturer Name”

§

iDeviceName

Usage ID 0x88: “iDevice Name”

§

iDeviceChemistry

Usage ID 0x89: “iDevice Chemistry”

§

ManufacturerData

Usage ID 0x8A: “Manufacturer Data”

§

Rechargable

Usage ID 0x8B: “Rechargable”

§

WarningCapacityLimit

Usage ID 0x8C: “Warning Capacity Limit”

§

CapacityGranularity1

Usage ID 0x8D: “Capacity Granularity 1”

§

CapacityGranularity2

Usage ID 0x8E: “Capacity Granularity 2”

§

iOEMInformation

Usage ID 0x8F: “iOEM Information”

§

InhibitCharge

Usage ID 0xC0: “Inhibit Charge”

§

EnablePolling

Usage ID 0xC1: “Enable Polling”

§

ResetToZero

Usage ID 0xC2: “Reset To Zero”

§

ACPresent

Usage ID 0xD0: “AC Present”

§

BatteryPresent

Usage ID 0xD1: “Battery Present”

§

PowerFail

Usage ID 0xD2: “Power Fail”

§

AlarmInhibited

Usage ID 0xD3: “Alarm Inhibited”

§

ThermistorUnderRange

Usage ID 0xD4: “Thermistor Under Range”

§

ThermistorHot

Usage ID 0xD5: “Thermistor Hot”

§

ThermistorCold

Usage ID 0xD6: “Thermistor Cold”

§

ThermistorOverRange

Usage ID 0xD7: “Thermistor Over Range”

§

VoltageOutOfRange

Usage ID 0xD8: “Voltage Out Of Range”

§

CurrentOutOfRange

Usage ID 0xD9: “Current Out Of Range”

§

CurrentNotRegulated

Usage ID 0xDA: “Current Not Regulated”

§

VoltageNotRegulated

Usage ID 0xDB: “Voltage Not Regulated”

§

MasterMode

Usage ID 0xDC: “Master Mode”

§

ChargerSelectorSupport

Usage ID 0xF0: “Charger Selector Support”

§

ChargerSpec

Usage ID 0xF1: “Charger Spec”

§

Level2

Usage ID 0xF2: “Level 2”

§

Level3

Usage ID 0xF3: “Level 3”

Implementations§

Trait Implementations§

Source§

impl AsUsage for BatterySystem

Source§

fn usage_value(&self) -> u32

Returns the 32 bit Usage value of this Usage

Source§

fn usage_id_value(&self) -> u16

Returns the 16 bit Usage ID value of this Usage

Source§

fn usage(&self) -> Usage

Returns this usage as Usage::BatterySystem(self) This is a convenience function to avoid having to implement From for every used type in the caller.

let gd_x = GenericDesktop::X;
let usage = Usage::from(GenericDesktop::X);
assert!(matches!(gd_x.usage(), usage));
Source§

impl AsUsagePage for BatterySystem

Source§

fn usage_page_value(&self) -> u16

Returns the 16 bit value of this UsagePage

This value is 0x85 for BatterySystem

Source§

fn usage_page(&self) -> UsagePage

Source§

impl BitOr<u16> for BatterySystem

Source§

fn bitor(self, usage: u16) -> Usage

A convenience function to combine a Usage Page with a value.

This function panics if the Usage ID value results in an unknown Usage. Where error checking is required, use UsagePage::to_usage_from_value.

Source§

type Output = Usage

The resulting type after applying the | operator.
Source§

impl Debug for BatterySystem

Source§

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

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

impl Display for BatterySystem

Source§

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

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

impl From<&BatterySystem> for Usage

Source§

fn from(batterysystem: &BatterySystem) -> Usage

Converts to this type from the input type.
Source§

impl From<&BatterySystem> for UsagePage

Source§

impl From<&BatterySystem> for u16

Source§

fn from(batterysystem: &BatterySystem) -> u16

Converts to this type from the input type.
Source§

impl From<&BatterySystem> for u32

Source§

fn from(batterysystem: &BatterySystem) -> u32

Returns the 32 bit value of this usage. This is identical to BatterySystem::usage_value().

Source§

impl From<BatterySystem> for Usage

Source§

fn from(batterysystem: BatterySystem) -> Usage

Converts to this type from the input type.
Source§

impl From<BatterySystem> for UsagePage

Source§

impl From<BatterySystem> for u16

Source§

fn from(batterysystem: BatterySystem) -> u16

Returns the 16bit value of this usage. This is identical to BatterySystem::usage_page_value().

Source§

impl TryFrom<u16> for BatterySystem

Source§

type Error = HutError

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

fn try_from(usage_id: u16) -> Result<BatterySystem, HutError>

Performs the conversion.

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.