BatterySystem

Enum BatterySystem 

Source
#[non_exhaustive]
#[repr(u16)]
pub enum BatterySystem {
Show 91 variants SmartBatteryBatteryMode = 1, SmartBatteryBatteryStatus = 2, SmartBatteryAlarmWarning = 3, SmartBatteryChargerMode = 4, SmartBatteryChargerStatus = 5, SmartBatteryChargerSpecInfo = 6, SmartBatterySelectorState = 7, SmartBatterySelectorPresets = 8, SmartBatterySelectorInfo = 9, OptionalMfgFunction1 = 16, OptionalMfgFunction2 = 17, OptionalMfgFunction3 = 18, OptionalMfgFunction4 = 19, OptionalMfgFunction5 = 20, ConnectionToSMBus = 21, OutputConnection = 22, ChargerConnection = 23, BatteryInsertion = 24, UseNext = 25, OKToUse = 26, BatterySupported = 27, SelectorRevision = 28, ChargingIndicator = 29, ManufacturerAccess = 40, RemainingCapacityLimit = 41, RemainingTimeLimit = 42, AtRate = 43, CapacityMode = 44, BroadcastToCharger = 45, PrimaryBattery = 46, ChargeController = 47, TerminateCharge = 64, TerminateDischarge = 65, BelowRemainingCapacityLimit = 66, RemainingTimeLimitExpired = 67, Charging = 68, Discharging = 69, FullyCharged = 70, FullyDischarged = 71, ConditioningFlag = 72, AtRateOK = 73, SmartBatteryErrorCode = 74, NeedReplacement = 75, AtRateTimeToFull = 96, AtRateTimeToEmpty = 97, AverageCurrent = 98, MaxError = 99, RelativeStateOfCharge = 100, AbsoluteStateOfCharge = 101, RemainingCapacity = 102, FullChargeCapacity = 103, RunTimeToEmpty = 104, AverageTimeToEmpty = 105, AverageTimeToFull = 106, CycleCount = 107, BatteryPackModelLevel = 128, InternalChargeController = 129, PrimaryBatterySupport = 130, DesignCapacity = 131, SpecificationInfo = 132, ManufactureDate = 133, SerialNumber = 134, iManufacturerName = 135, iDeviceName = 136, iDeviceChemistry = 137, ManufacturerData = 138, Rechargable = 139, WarningCapacityLimit = 140, CapacityGranularity1 = 141, CapacityGranularity2 = 142, iOEMInformation = 143, InhibitCharge = 192, EnablePolling = 193, ResetToZero = 194, ACPresent = 208, BatteryPresent = 209, PowerFail = 210, AlarmInhibited = 211, ThermistorUnderRange = 212, ThermistorHot = 213, ThermistorCold = 214, ThermistorOverRange = 215, VoltageOutOfRange = 216, CurrentOutOfRange = 217, CurrentNotRegulated = 218, VoltageNotRegulated = 219, MasterMode = 220, ChargerSelectorSupport = 240, ChargerSpec = 241, Level2 = 242, Level3 = 243,
}
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 = 1

Usage ID 0x1: “Smart Battery Battery Mode”

§

SmartBatteryBatteryStatus = 2

Usage ID 0x2: “Smart Battery Battery Status”

§

SmartBatteryAlarmWarning = 3

Usage ID 0x3: “Smart Battery Alarm Warning”

§

SmartBatteryChargerMode = 4

Usage ID 0x4: “Smart Battery Charger Mode”

§

SmartBatteryChargerStatus = 5

Usage ID 0x5: “Smart Battery Charger Status”

§

SmartBatteryChargerSpecInfo = 6

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

§

SmartBatterySelectorState = 7

Usage ID 0x7: “Smart Battery Selector State”

§

SmartBatterySelectorPresets = 8

Usage ID 0x8: “Smart Battery Selector Presets”

§

SmartBatterySelectorInfo = 9

Usage ID 0x9: “Smart Battery Selector Info”

§

OptionalMfgFunction1 = 16

Usage ID 0x10: “Optional Mfg Function 1”

§

OptionalMfgFunction2 = 17

Usage ID 0x11: “Optional Mfg Function 2”

§

OptionalMfgFunction3 = 18

Usage ID 0x12: “Optional Mfg Function 3”

§

OptionalMfgFunction4 = 19

Usage ID 0x13: “Optional Mfg Function 4”

§

OptionalMfgFunction5 = 20

Usage ID 0x14: “Optional Mfg Function 5”

§

ConnectionToSMBus = 21

Usage ID 0x15: “Connection To SM Bus”

§

OutputConnection = 22

Usage ID 0x16: “Output Connection”

§

ChargerConnection = 23

Usage ID 0x17: “Charger Connection”

§

BatteryInsertion = 24

Usage ID 0x18: “Battery Insertion”

§

UseNext = 25

Usage ID 0x19: “Use Next”

§

OKToUse = 26

Usage ID 0x1A: “OK To Use”

§

BatterySupported = 27

Usage ID 0x1B: “Battery Supported”

§

SelectorRevision = 28

Usage ID 0x1C: “Selector Revision”

§

ChargingIndicator = 29

Usage ID 0x1D: “Charging Indicator”

§

ManufacturerAccess = 40

Usage ID 0x28: “Manufacturer Access”

§

RemainingCapacityLimit = 41

Usage ID 0x29: “Remaining Capacity Limit”

§

RemainingTimeLimit = 42

Usage ID 0x2A: “Remaining Time Limit”

§

AtRate = 43

Usage ID 0x2B: “At Rate”

§

CapacityMode = 44

Usage ID 0x2C: “Capacity Mode”

§

BroadcastToCharger = 45

Usage ID 0x2D: “Broadcast To Charger”

§

PrimaryBattery = 46

Usage ID 0x2E: “Primary Battery”

§

ChargeController = 47

Usage ID 0x2F: “Charge Controller”

§

TerminateCharge = 64

Usage ID 0x40: “Terminate Charge”

§

TerminateDischarge = 65

Usage ID 0x41: “Terminate Discharge”

§

BelowRemainingCapacityLimit = 66

Usage ID 0x42: “Below Remaining Capacity Limit”

§

RemainingTimeLimitExpired = 67

Usage ID 0x43: “Remaining Time Limit Expired”

§

Charging = 68

Usage ID 0x44: “Charging”

§

Discharging = 69

Usage ID 0x45: “Discharging”

§

FullyCharged = 70

Usage ID 0x46: “Fully Charged”

§

FullyDischarged = 71

Usage ID 0x47: “Fully Discharged”

§

ConditioningFlag = 72

Usage ID 0x48: “Conditioning Flag”

§

AtRateOK = 73

Usage ID 0x49: “At Rate OK”

§

SmartBatteryErrorCode = 74

Usage ID 0x4A: “Smart Battery Error Code”

§

NeedReplacement = 75

Usage ID 0x4B: “Need Replacement”

§

AtRateTimeToFull = 96

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

§

AtRateTimeToEmpty = 97

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

§

AverageCurrent = 98

Usage ID 0x62: “Average Current”

§

MaxError = 99

Usage ID 0x63: “Max Error”

§

RelativeStateOfCharge = 100

Usage ID 0x64: “Relative State Of Charge”

§

AbsoluteStateOfCharge = 101

Usage ID 0x65: “Absolute State Of Charge”

§

RemainingCapacity = 102

Usage ID 0x66: “Remaining Capacity”

§

FullChargeCapacity = 103

Usage ID 0x67: “Full Charge Capacity”

§

RunTimeToEmpty = 104

Usage ID 0x68: “Run Time To Empty”

§

AverageTimeToEmpty = 105

Usage ID 0x69: “Average Time To Empty”

§

AverageTimeToFull = 106

Usage ID 0x6A: “Average Time To Full”

§

CycleCount = 107

Usage ID 0x6B: “Cycle Count”

§

BatteryPackModelLevel = 128

Usage ID 0x80: “Battery Pack Model Level”

§

InternalChargeController = 129

Usage ID 0x81: “Internal Charge Controller”

§

PrimaryBatterySupport = 130

Usage ID 0x82: “Primary Battery Support”

§

DesignCapacity = 131

Usage ID 0x83: “Design Capacity”

§

SpecificationInfo = 132

Usage ID 0x84: “Specification Info”

§

ManufactureDate = 133

Usage ID 0x85: “Manufacture Date”

§

SerialNumber = 134

Usage ID 0x86: “Serial Number”

§

iManufacturerName = 135

Usage ID 0x87: “iManufacturer Name”

§

iDeviceName = 136

Usage ID 0x88: “iDevice Name”

§

iDeviceChemistry = 137

Usage ID 0x89: “iDevice Chemistry”

§

ManufacturerData = 138

Usage ID 0x8A: “Manufacturer Data”

§

Rechargable = 139

Usage ID 0x8B: “Rechargable”

§

WarningCapacityLimit = 140

Usage ID 0x8C: “Warning Capacity Limit”

§

CapacityGranularity1 = 141

Usage ID 0x8D: “Capacity Granularity 1”

§

CapacityGranularity2 = 142

Usage ID 0x8E: “Capacity Granularity 2”

§

iOEMInformation = 143

Usage ID 0x8F: “iOEM Information”

§

InhibitCharge = 192

Usage ID 0xC0: “Inhibit Charge”

§

EnablePolling = 193

Usage ID 0xC1: “Enable Polling”

§

ResetToZero = 194

Usage ID 0xC2: “Reset To Zero”

§

ACPresent = 208

Usage ID 0xD0: “AC Present”

§

BatteryPresent = 209

Usage ID 0xD1: “Battery Present”

§

PowerFail = 210

Usage ID 0xD2: “Power Fail”

§

AlarmInhibited = 211

Usage ID 0xD3: “Alarm Inhibited”

§

ThermistorUnderRange = 212

Usage ID 0xD4: “Thermistor Under Range”

§

ThermistorHot = 213

Usage ID 0xD5: “Thermistor Hot”

§

ThermistorCold = 214

Usage ID 0xD6: “Thermistor Cold”

§

ThermistorOverRange = 215

Usage ID 0xD7: “Thermistor Over Range”

§

VoltageOutOfRange = 216

Usage ID 0xD8: “Voltage Out Of Range”

§

CurrentOutOfRange = 217

Usage ID 0xD9: “Current Out Of Range”

§

CurrentNotRegulated = 218

Usage ID 0xDA: “Current Not Regulated”

§

VoltageNotRegulated = 219

Usage ID 0xDB: “Voltage Not Regulated”

§

MasterMode = 220

Usage ID 0xDC: “Master Mode”

§

ChargerSelectorSupport = 240

Usage ID 0xF0: “Charger Selector Support”

§

ChargerSpec = 241

Usage ID 0xF1: “Charger Spec”

§

Level2 = 242

Usage ID 0xF2: “Level 2”

§

Level3 = 243

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 Clone for BatterySystem

Source§

fn clone(&self) -> BatterySystem

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 BatterySystem

Source§

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

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

impl Display for BatterySystem

Available on crate feature std only.
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 Hash for BatterySystem

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BatterySystem

Source§

fn eq(&self, other: &BatterySystem) -> 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 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.
Source§

impl Copy for BatterySystem

Source§

impl Eq for BatterySystem

Source§

impl StructuralPartialEq for BatterySystem

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