#![allow(clippy::identity_op, clippy::eq_op, clippy::match_single_binding)]
#![no_std]
#[cfg(feature = "std")]
extern crate std;
use core::ops::BitOr;
#[cfg(feature = "std")]
use std::{fmt, format, string::String, string::ToString};
#[derive(Debug)]
pub enum HutError {
UnknownUsagePage { usage_page: u16 },
UnknownUsageId { usage_id: u16 },
InvalidVendorPage { vendor_page: u16 },
InvalidReservedPage { reserved_page: u16 },
UnknownUsage,
}
impl core::error::Error for HutError {}
impl core::fmt::Display for HutError {
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
match self {
HutError::UnknownUsagePage { usage_page } => {
write!(fmt, "Unknown Usage Page {}", usage_page)
}
HutError::UnknownUsageId { usage_id } => write!(fmt, "Unknown Usage ID {}", usage_id),
HutError::InvalidVendorPage { vendor_page } => {
write!(fmt, "Invalid Vendor Page {}", vendor_page)
}
HutError::InvalidReservedPage { reserved_page } => {
write!(fmt, "Invalid Reserved Page {}", reserved_page)
}
HutError::UnknownUsage => write!(fmt, "Unknown Usage"),
}
}
}
type Result<T> = core::result::Result<T, HutError>;
pub trait AsUsage {
fn usage_value(&self) -> u32;
fn usage_id_value(&self) -> u16;
fn usage(&self) -> Usage;
}
pub trait AsUsagePage {
fn usage_page_value(&self) -> u16;
fn usage_page(&self) -> UsagePage;
}
#[allow(non_camel_case_types)]
#[derive(Debug)]
#[non_exhaustive]
pub enum UsagePage {
GenericDesktop,
SimulationControls,
VRControls,
SportControls,
GameControls,
GenericDeviceControls,
KeyboardKeypad,
LED,
Button,
Ordinal,
TelephonyDevice,
Consumer,
Digitizers,
Haptics,
PhysicalInputDevice,
Unicode,
SoC,
EyeandHeadTrackers,
AuxiliaryDisplay,
Sensors,
MedicalInstrument,
BrailleDisplay,
LightingAndIllumination,
Monitor,
MonitorEnumerated,
VESAVirtualControls,
Power,
BatterySystem,
BarcodeScanner,
Scales,
MagneticStripeReader,
CameraControl,
Arcade,
FIDOAlliance,
Wacom,
ReservedUsagePage(ReservedPage),
VendorDefinedPage(VendorPage),
}
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub struct ReservedPage(u16);
impl From<&ReservedPage> for ReservedPage {
fn from(v: &ReservedPage) -> ReservedPage {
ReservedPage(v.0)
}
}
impl From<&ReservedPage> for u16 {
fn from(v: &ReservedPage) -> u16 {
v.0
}
}
impl From<ReservedPage> for u16 {
fn from(v: ReservedPage) -> u16 {
u16::from(&v)
}
}
impl From<&ReservedPage> for u32 {
fn from(v: &ReservedPage) -> u32 {
(v.0 as u32) << 16
}
}
impl From<ReservedPage> for u32 {
fn from(v: ReservedPage) -> u32 {
u32::from(&v)
}
}
impl TryFrom<u16> for ReservedPage {
type Error = HutError;
fn try_from(v: u16) -> Result<ReservedPage> {
match v {
p @ 0x13 => Ok(ReservedPage(p)),
p @ 0x15..=0x1F => Ok(ReservedPage(p)),
p @ 0x21..=0x3F => Ok(ReservedPage(p)),
p @ 0x42..=0x58 => Ok(ReservedPage(p)),
p @ 0x5A..=0x7F => Ok(ReservedPage(p)),
p @ 0x83..=0x83 => Ok(ReservedPage(p)),
p @ 0x86..=0x8B => Ok(ReservedPage(p)),
p @ 0x8F..=0x8F => Ok(ReservedPage(p)),
p @ 0x93..=0xF1CF => Ok(ReservedPage(p)),
p @ 0xF1D1..=0xFEFF => Ok(ReservedPage(p)),
n => Err(HutError::InvalidReservedPage { reserved_page: n }),
}
}
}
impl TryFrom<u32> for ReservedPage {
type Error = HutError;
fn try_from(v: u32) -> Result<ReservedPage> {
ReservedPage::try_from((v >> 16) as u16)
}
}
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
pub struct VendorPage(u16);
impl From<&VendorPage> for VendorPage {
fn from(v: &VendorPage) -> VendorPage {
VendorPage(v.0)
}
}
impl From<&VendorPage> for u16 {
fn from(v: &VendorPage) -> u16 {
v.0
}
}
impl From<VendorPage> for u16 {
fn from(v: VendorPage) -> u16 {
u16::from(&v)
}
}
impl From<&VendorPage> for u32 {
fn from(v: &VendorPage) -> u32 {
(v.0 as u32) << 16
}
}
impl From<VendorPage> for u32 {
fn from(v: VendorPage) -> u32 {
u32::from(&v)
}
}
impl TryFrom<u16> for VendorPage {
type Error = HutError;
fn try_from(v: u16) -> Result<VendorPage> {
match v {
p @ 0xff00..=0xffff => Ok(VendorPage(p)),
n => Err(HutError::InvalidVendorPage { vendor_page: n }),
}
}
}
impl TryFrom<u32> for VendorPage {
type Error = HutError;
fn try_from(v: u32) -> Result<VendorPage> {
VendorPage::try_from((v >> 16) as u16)
}
}
impl UsagePage {
pub fn from_usage_page_value(usage_page: u16) -> Result<UsagePage> {
UsagePage::try_from(usage_page)
}
pub fn from_usage_value(usage: u32) -> Result<UsagePage> {
let up: u16 = (usage >> 16) as u16;
UsagePage::try_from(up)
}
pub fn to_usage_from_value(&self, usage: u16) -> Result<Usage> {
let up: u32 = (self.usage_page_value() as u32) << 16;
let u: u32 = usage as u32;
Usage::try_from(up | u)
}
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
UsagePage::GenericDesktop => "Generic Desktop".into(),
UsagePage::SimulationControls => "Simulation Controls".into(),
UsagePage::VRControls => "VR Controls".into(),
UsagePage::SportControls => "Sport Controls".into(),
UsagePage::GameControls => "Game Controls".into(),
UsagePage::GenericDeviceControls => "Generic Device Controls".into(),
UsagePage::KeyboardKeypad => "Keyboard/Keypad".into(),
UsagePage::LED => "LED".into(),
UsagePage::Button => "Button".into(),
UsagePage::Ordinal => "Ordinal".into(),
UsagePage::TelephonyDevice => "Telephony Device".into(),
UsagePage::Consumer => "Consumer".into(),
UsagePage::Digitizers => "Digitizers".into(),
UsagePage::Haptics => "Haptics".into(),
UsagePage::PhysicalInputDevice => "Physical Input Device".into(),
UsagePage::Unicode => "Unicode".into(),
UsagePage::SoC => "SoC".into(),
UsagePage::EyeandHeadTrackers => "Eye and Head Trackers".into(),
UsagePage::AuxiliaryDisplay => "Auxiliary Display".into(),
UsagePage::Sensors => "Sensors".into(),
UsagePage::MedicalInstrument => "Medical Instrument".into(),
UsagePage::BrailleDisplay => "Braille Display".into(),
UsagePage::LightingAndIllumination => "Lighting And Illumination".into(),
UsagePage::Monitor => "Monitor".into(),
UsagePage::MonitorEnumerated => "Monitor Enumerated".into(),
UsagePage::VESAVirtualControls => "VESA Virtual Controls".into(),
UsagePage::Power => "Power".into(),
UsagePage::BatterySystem => "Battery System".into(),
UsagePage::BarcodeScanner => "Barcode Scanner".into(),
UsagePage::Scales => "Scales".into(),
UsagePage::MagneticStripeReader => "Magnetic Stripe Reader".into(),
UsagePage::CameraControl => "Camera Control".into(),
UsagePage::Arcade => "Arcade".into(),
UsagePage::FIDOAlliance => "FIDO Alliance".into(),
UsagePage::Wacom => "Wacom".into(),
UsagePage::ReservedUsagePage(reserved_page) => {
format!("Reserved Usage Page {:04X}", u16::from(reserved_page))
}
UsagePage::VendorDefinedPage(vendor_page) => {
format!("Vendor Defined Page {:04X}", u16::from(vendor_page))
}
}
}
}
impl AsUsagePage for UsagePage {
fn usage_page_value(&self) -> u16 {
u16::from(self)
}
fn usage_page(&self) -> UsagePage {
UsagePage::try_from(u16::from(self)).unwrap()
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum GenericDesktop {
Pointer = 0x1,
Mouse = 0x2,
Joystick = 0x4,
Gamepad = 0x5,
Keyboard = 0x6,
Keypad = 0x7,
MultiaxisController = 0x8,
TabletPCSystemControls = 0x9,
WaterCoolingDevice = 0xA,
ComputerChassisDevice = 0xB,
WirelessRadioControls = 0xC,
PortableDeviceControl = 0xD,
SystemMultiAxisController = 0xE,
SpatialController = 0xF,
AssistiveControl = 0x10,
DeviceDock = 0x11,
DockableDevice = 0x12,
CallStateManagementControl = 0x13,
X = 0x30,
Y = 0x31,
Z = 0x32,
Rx = 0x33,
Ry = 0x34,
Rz = 0x35,
Slider = 0x36,
Dial = 0x37,
Wheel = 0x38,
HatSwitch = 0x39,
CountedBuffer = 0x3A,
ByteCount = 0x3B,
MotionWakeup = 0x3C,
Start = 0x3D,
Select = 0x3E,
Vx = 0x40,
Vy = 0x41,
Vz = 0x42,
Vbrx = 0x43,
Vbry = 0x44,
Vbrz = 0x45,
Vno = 0x46,
FeatureNotification = 0x47,
ResolutionMultiplier = 0x48,
Qx = 0x49,
Qy = 0x4A,
Qz = 0x4B,
Qw = 0x4C,
SystemControl = 0x80,
SystemPowerDown = 0x81,
SystemSleep = 0x82,
SystemWakeUp = 0x83,
SystemContextMenu = 0x84,
SystemMainMenu = 0x85,
SystemAppMenu = 0x86,
SystemMenuHelp = 0x87,
SystemMenuExit = 0x88,
SystemMenuSelect = 0x89,
SystemMenuRight = 0x8A,
SystemMenuLeft = 0x8B,
SystemMenuUp = 0x8C,
SystemMenuDown = 0x8D,
SystemColdRestart = 0x8E,
SystemWarmRestart = 0x8F,
DpadUp = 0x90,
DpadDown = 0x91,
DpadRight = 0x92,
DpadLeft = 0x93,
IndexTrigger = 0x94,
PalmTrigger = 0x95,
Thumbstick = 0x96,
SystemFunctionShift = 0x97,
SystemFunctionShiftLock = 0x98,
SystemFunctionShiftLockIndicator = 0x99,
SystemDismissNotification = 0x9A,
SystemDoNotDisturb = 0x9B,
SystemDock = 0xA0,
SystemUndock = 0xA1,
SystemSetup = 0xA2,
SystemBreak = 0xA3,
SystemDebuggerBreak = 0xA4,
ApplicationBreak = 0xA5,
ApplicationDebuggerBreak = 0xA6,
SystemSpeakerMute = 0xA7,
SystemHibernate = 0xA8,
SystemMicrophoneMute = 0xA9,
SystemAccessibilityBinding = 0xAA,
SystemDisplayInvert = 0xB0,
SystemDisplayInternal = 0xB1,
SystemDisplayExternal = 0xB2,
SystemDisplayBoth = 0xB3,
SystemDisplayDual = 0xB4,
SystemDisplayToggleIntExtMode = 0xB5,
SystemDisplaySwapPrimarySecondary = 0xB6,
SystemDisplayToggleLCDAutoscale = 0xB7,
SensorZone = 0xC0,
RPM = 0xC1,
CoolantLevel = 0xC2,
CoolantCriticalLevel = 0xC3,
CoolantPump = 0xC4,
ChassisEnclosure = 0xC5,
WirelessRadioButton = 0xC6,
WirelessRadioLED = 0xC7,
WirelessRadioSliderSwitch = 0xC8,
SystemDisplayRotationLockButton = 0xC9,
SystemDisplayRotationLockSliderSwitch = 0xCA,
ControlEnable = 0xCB,
DockableDeviceUniqueID = 0xD0,
DockableDeviceVendorID = 0xD1,
DockableDevicePrimaryUsagePage = 0xD2,
DockableDevicePrimaryUsageID = 0xD3,
DockableDeviceDockingState = 0xD4,
DockableDeviceDisplayOcclusion = 0xD5,
DockableDeviceObjectType = 0xD6,
CallActiveLED = 0xE0,
CallMuteToggle = 0xE1,
CallMuteLED = 0xE2,
}
impl GenericDesktop {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
GenericDesktop::Pointer => "Pointer",
GenericDesktop::Mouse => "Mouse",
GenericDesktop::Joystick => "Joystick",
GenericDesktop::Gamepad => "Gamepad",
GenericDesktop::Keyboard => "Keyboard",
GenericDesktop::Keypad => "Keypad",
GenericDesktop::MultiaxisController => "Multi-axis Controller",
GenericDesktop::TabletPCSystemControls => "Tablet PC System Controls",
GenericDesktop::WaterCoolingDevice => "Water Cooling Device",
GenericDesktop::ComputerChassisDevice => "Computer Chassis Device",
GenericDesktop::WirelessRadioControls => "Wireless Radio Controls",
GenericDesktop::PortableDeviceControl => "Portable Device Control",
GenericDesktop::SystemMultiAxisController => "System Multi-Axis Controller",
GenericDesktop::SpatialController => "Spatial Controller",
GenericDesktop::AssistiveControl => "Assistive Control",
GenericDesktop::DeviceDock => "Device Dock",
GenericDesktop::DockableDevice => "Dockable Device",
GenericDesktop::CallStateManagementControl => "Call State Management Control",
GenericDesktop::X => "X",
GenericDesktop::Y => "Y",
GenericDesktop::Z => "Z",
GenericDesktop::Rx => "Rx",
GenericDesktop::Ry => "Ry",
GenericDesktop::Rz => "Rz",
GenericDesktop::Slider => "Slider",
GenericDesktop::Dial => "Dial",
GenericDesktop::Wheel => "Wheel",
GenericDesktop::HatSwitch => "Hat Switch",
GenericDesktop::CountedBuffer => "Counted Buffer",
GenericDesktop::ByteCount => "Byte Count",
GenericDesktop::MotionWakeup => "Motion Wakeup",
GenericDesktop::Start => "Start",
GenericDesktop::Select => "Select",
GenericDesktop::Vx => "Vx",
GenericDesktop::Vy => "Vy",
GenericDesktop::Vz => "Vz",
GenericDesktop::Vbrx => "Vbrx",
GenericDesktop::Vbry => "Vbry",
GenericDesktop::Vbrz => "Vbrz",
GenericDesktop::Vno => "Vno",
GenericDesktop::FeatureNotification => "Feature Notification",
GenericDesktop::ResolutionMultiplier => "Resolution Multiplier",
GenericDesktop::Qx => "Qx",
GenericDesktop::Qy => "Qy",
GenericDesktop::Qz => "Qz",
GenericDesktop::Qw => "Qw",
GenericDesktop::SystemControl => "System Control",
GenericDesktop::SystemPowerDown => "System Power Down",
GenericDesktop::SystemSleep => "System Sleep",
GenericDesktop::SystemWakeUp => "System Wake Up",
GenericDesktop::SystemContextMenu => "System Context Menu",
GenericDesktop::SystemMainMenu => "System Main Menu",
GenericDesktop::SystemAppMenu => "System App Menu",
GenericDesktop::SystemMenuHelp => "System Menu Help",
GenericDesktop::SystemMenuExit => "System Menu Exit",
GenericDesktop::SystemMenuSelect => "System Menu Select",
GenericDesktop::SystemMenuRight => "System Menu Right",
GenericDesktop::SystemMenuLeft => "System Menu Left",
GenericDesktop::SystemMenuUp => "System Menu Up",
GenericDesktop::SystemMenuDown => "System Menu Down",
GenericDesktop::SystemColdRestart => "System Cold Restart",
GenericDesktop::SystemWarmRestart => "System Warm Restart",
GenericDesktop::DpadUp => "D-pad Up",
GenericDesktop::DpadDown => "D-pad Down",
GenericDesktop::DpadRight => "D-pad Right",
GenericDesktop::DpadLeft => "D-pad Left",
GenericDesktop::IndexTrigger => "Index Trigger",
GenericDesktop::PalmTrigger => "Palm Trigger",
GenericDesktop::Thumbstick => "Thumbstick",
GenericDesktop::SystemFunctionShift => "System Function Shift",
GenericDesktop::SystemFunctionShiftLock => "System Function Shift Lock",
GenericDesktop::SystemFunctionShiftLockIndicator => {
"System Function Shift Lock Indicator"
}
GenericDesktop::SystemDismissNotification => "System Dismiss Notification",
GenericDesktop::SystemDoNotDisturb => "System Do Not Disturb",
GenericDesktop::SystemDock => "System Dock",
GenericDesktop::SystemUndock => "System Undock",
GenericDesktop::SystemSetup => "System Setup",
GenericDesktop::SystemBreak => "System Break",
GenericDesktop::SystemDebuggerBreak => "System Debugger Break",
GenericDesktop::ApplicationBreak => "Application Break",
GenericDesktop::ApplicationDebuggerBreak => "Application Debugger Break",
GenericDesktop::SystemSpeakerMute => "System Speaker Mute",
GenericDesktop::SystemHibernate => "System Hibernate",
GenericDesktop::SystemMicrophoneMute => "System Microphone Mute",
GenericDesktop::SystemAccessibilityBinding => "System Accessibility Binding",
GenericDesktop::SystemDisplayInvert => "System Display Invert",
GenericDesktop::SystemDisplayInternal => "System Display Internal",
GenericDesktop::SystemDisplayExternal => "System Display External",
GenericDesktop::SystemDisplayBoth => "System Display Both",
GenericDesktop::SystemDisplayDual => "System Display Dual",
GenericDesktop::SystemDisplayToggleIntExtMode => "System Display Toggle Int/Ext Mode",
GenericDesktop::SystemDisplaySwapPrimarySecondary => {
"System Display Swap Primary/Secondary"
}
GenericDesktop::SystemDisplayToggleLCDAutoscale => {
"System Display Toggle LCD Autoscale"
}
GenericDesktop::SensorZone => "Sensor Zone",
GenericDesktop::RPM => "RPM",
GenericDesktop::CoolantLevel => "Coolant Level",
GenericDesktop::CoolantCriticalLevel => "Coolant Critical Level",
GenericDesktop::CoolantPump => "Coolant Pump",
GenericDesktop::ChassisEnclosure => "Chassis Enclosure",
GenericDesktop::WirelessRadioButton => "Wireless Radio Button",
GenericDesktop::WirelessRadioLED => "Wireless Radio LED",
GenericDesktop::WirelessRadioSliderSwitch => "Wireless Radio Slider Switch",
GenericDesktop::SystemDisplayRotationLockButton => {
"System Display Rotation Lock Button"
}
GenericDesktop::SystemDisplayRotationLockSliderSwitch => {
"System Display Rotation Lock Slider Switch"
}
GenericDesktop::ControlEnable => "Control Enable",
GenericDesktop::DockableDeviceUniqueID => "Dockable Device Unique ID",
GenericDesktop::DockableDeviceVendorID => "Dockable Device Vendor ID",
GenericDesktop::DockableDevicePrimaryUsagePage => "Dockable Device Primary Usage Page",
GenericDesktop::DockableDevicePrimaryUsageID => "Dockable Device Primary Usage ID",
GenericDesktop::DockableDeviceDockingState => "Dockable Device Docking State",
GenericDesktop::DockableDeviceDisplayOcclusion => "Dockable Device Display Occlusion",
GenericDesktop::DockableDeviceObjectType => "Dockable Device Object Type",
GenericDesktop::CallActiveLED => "Call Active LED",
GenericDesktop::CallMuteToggle => "Call Mute Toggle",
GenericDesktop::CallMuteLED => "Call Mute LED",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for GenericDesktop {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for GenericDesktop {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for GenericDesktop {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&GenericDesktop> for u16 {
fn from(genericdesktop: &GenericDesktop) -> u16 {
*genericdesktop as u16
}
}
impl From<GenericDesktop> for u16 {
fn from(genericdesktop: GenericDesktop) -> u16 {
u16::from(&genericdesktop)
}
}
impl From<&GenericDesktop> for u32 {
fn from(genericdesktop: &GenericDesktop) -> u32 {
let up = UsagePage::from(genericdesktop);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(genericdesktop) as u32;
up | id
}
}
impl From<&GenericDesktop> for UsagePage {
fn from(_: &GenericDesktop) -> UsagePage {
UsagePage::GenericDesktop
}
}
impl From<GenericDesktop> for UsagePage {
fn from(_: GenericDesktop) -> UsagePage {
UsagePage::GenericDesktop
}
}
impl From<&GenericDesktop> for Usage {
fn from(genericdesktop: &GenericDesktop) -> Usage {
Usage::try_from(u32::from(genericdesktop)).unwrap()
}
}
impl From<GenericDesktop> for Usage {
fn from(genericdesktop: GenericDesktop) -> Usage {
Usage::from(&genericdesktop)
}
}
impl TryFrom<u16> for GenericDesktop {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<GenericDesktop> {
match usage_id {
1 => Ok(GenericDesktop::Pointer),
2 => Ok(GenericDesktop::Mouse),
4 => Ok(GenericDesktop::Joystick),
5 => Ok(GenericDesktop::Gamepad),
6 => Ok(GenericDesktop::Keyboard),
7 => Ok(GenericDesktop::Keypad),
8 => Ok(GenericDesktop::MultiaxisController),
9 => Ok(GenericDesktop::TabletPCSystemControls),
10 => Ok(GenericDesktop::WaterCoolingDevice),
11 => Ok(GenericDesktop::ComputerChassisDevice),
12 => Ok(GenericDesktop::WirelessRadioControls),
13 => Ok(GenericDesktop::PortableDeviceControl),
14 => Ok(GenericDesktop::SystemMultiAxisController),
15 => Ok(GenericDesktop::SpatialController),
16 => Ok(GenericDesktop::AssistiveControl),
17 => Ok(GenericDesktop::DeviceDock),
18 => Ok(GenericDesktop::DockableDevice),
19 => Ok(GenericDesktop::CallStateManagementControl),
48 => Ok(GenericDesktop::X),
49 => Ok(GenericDesktop::Y),
50 => Ok(GenericDesktop::Z),
51 => Ok(GenericDesktop::Rx),
52 => Ok(GenericDesktop::Ry),
53 => Ok(GenericDesktop::Rz),
54 => Ok(GenericDesktop::Slider),
55 => Ok(GenericDesktop::Dial),
56 => Ok(GenericDesktop::Wheel),
57 => Ok(GenericDesktop::HatSwitch),
58 => Ok(GenericDesktop::CountedBuffer),
59 => Ok(GenericDesktop::ByteCount),
60 => Ok(GenericDesktop::MotionWakeup),
61 => Ok(GenericDesktop::Start),
62 => Ok(GenericDesktop::Select),
64 => Ok(GenericDesktop::Vx),
65 => Ok(GenericDesktop::Vy),
66 => Ok(GenericDesktop::Vz),
67 => Ok(GenericDesktop::Vbrx),
68 => Ok(GenericDesktop::Vbry),
69 => Ok(GenericDesktop::Vbrz),
70 => Ok(GenericDesktop::Vno),
71 => Ok(GenericDesktop::FeatureNotification),
72 => Ok(GenericDesktop::ResolutionMultiplier),
73 => Ok(GenericDesktop::Qx),
74 => Ok(GenericDesktop::Qy),
75 => Ok(GenericDesktop::Qz),
76 => Ok(GenericDesktop::Qw),
128 => Ok(GenericDesktop::SystemControl),
129 => Ok(GenericDesktop::SystemPowerDown),
130 => Ok(GenericDesktop::SystemSleep),
131 => Ok(GenericDesktop::SystemWakeUp),
132 => Ok(GenericDesktop::SystemContextMenu),
133 => Ok(GenericDesktop::SystemMainMenu),
134 => Ok(GenericDesktop::SystemAppMenu),
135 => Ok(GenericDesktop::SystemMenuHelp),
136 => Ok(GenericDesktop::SystemMenuExit),
137 => Ok(GenericDesktop::SystemMenuSelect),
138 => Ok(GenericDesktop::SystemMenuRight),
139 => Ok(GenericDesktop::SystemMenuLeft),
140 => Ok(GenericDesktop::SystemMenuUp),
141 => Ok(GenericDesktop::SystemMenuDown),
142 => Ok(GenericDesktop::SystemColdRestart),
143 => Ok(GenericDesktop::SystemWarmRestart),
144 => Ok(GenericDesktop::DpadUp),
145 => Ok(GenericDesktop::DpadDown),
146 => Ok(GenericDesktop::DpadRight),
147 => Ok(GenericDesktop::DpadLeft),
148 => Ok(GenericDesktop::IndexTrigger),
149 => Ok(GenericDesktop::PalmTrigger),
150 => Ok(GenericDesktop::Thumbstick),
151 => Ok(GenericDesktop::SystemFunctionShift),
152 => Ok(GenericDesktop::SystemFunctionShiftLock),
153 => Ok(GenericDesktop::SystemFunctionShiftLockIndicator),
154 => Ok(GenericDesktop::SystemDismissNotification),
155 => Ok(GenericDesktop::SystemDoNotDisturb),
160 => Ok(GenericDesktop::SystemDock),
161 => Ok(GenericDesktop::SystemUndock),
162 => Ok(GenericDesktop::SystemSetup),
163 => Ok(GenericDesktop::SystemBreak),
164 => Ok(GenericDesktop::SystemDebuggerBreak),
165 => Ok(GenericDesktop::ApplicationBreak),
166 => Ok(GenericDesktop::ApplicationDebuggerBreak),
167 => Ok(GenericDesktop::SystemSpeakerMute),
168 => Ok(GenericDesktop::SystemHibernate),
169 => Ok(GenericDesktop::SystemMicrophoneMute),
170 => Ok(GenericDesktop::SystemAccessibilityBinding),
176 => Ok(GenericDesktop::SystemDisplayInvert),
177 => Ok(GenericDesktop::SystemDisplayInternal),
178 => Ok(GenericDesktop::SystemDisplayExternal),
179 => Ok(GenericDesktop::SystemDisplayBoth),
180 => Ok(GenericDesktop::SystemDisplayDual),
181 => Ok(GenericDesktop::SystemDisplayToggleIntExtMode),
182 => Ok(GenericDesktop::SystemDisplaySwapPrimarySecondary),
183 => Ok(GenericDesktop::SystemDisplayToggleLCDAutoscale),
192 => Ok(GenericDesktop::SensorZone),
193 => Ok(GenericDesktop::RPM),
194 => Ok(GenericDesktop::CoolantLevel),
195 => Ok(GenericDesktop::CoolantCriticalLevel),
196 => Ok(GenericDesktop::CoolantPump),
197 => Ok(GenericDesktop::ChassisEnclosure),
198 => Ok(GenericDesktop::WirelessRadioButton),
199 => Ok(GenericDesktop::WirelessRadioLED),
200 => Ok(GenericDesktop::WirelessRadioSliderSwitch),
201 => Ok(GenericDesktop::SystemDisplayRotationLockButton),
202 => Ok(GenericDesktop::SystemDisplayRotationLockSliderSwitch),
203 => Ok(GenericDesktop::ControlEnable),
208 => Ok(GenericDesktop::DockableDeviceUniqueID),
209 => Ok(GenericDesktop::DockableDeviceVendorID),
210 => Ok(GenericDesktop::DockableDevicePrimaryUsagePage),
211 => Ok(GenericDesktop::DockableDevicePrimaryUsageID),
212 => Ok(GenericDesktop::DockableDeviceDockingState),
213 => Ok(GenericDesktop::DockableDeviceDisplayOcclusion),
214 => Ok(GenericDesktop::DockableDeviceObjectType),
224 => Ok(GenericDesktop::CallActiveLED),
225 => Ok(GenericDesktop::CallMuteToggle),
226 => Ok(GenericDesktop::CallMuteLED),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for GenericDesktop {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum SimulationControls {
FlightSimulationDevice = 0x1,
AutomobileSimulationDevice = 0x2,
TankSimulationDevice = 0x3,
SpaceshipSimulationDevice = 0x4,
SubmarineSimulationDevice = 0x5,
SailingSimulationDevice = 0x6,
MotorcycleSimulationDevice = 0x7,
SportsSimulationDevice = 0x8,
AirplaneSimulationDevice = 0x9,
HelicopterSimulationDevice = 0xA,
MagicCarpetSimulationDevice = 0xB,
BicycleSimulationDevice = 0xC,
FlightControlStick = 0x20,
FlightStick = 0x21,
CyclicControl = 0x22,
CyclicTrim = 0x23,
FlightYoke = 0x24,
TrackControl = 0x25,
Aileron = 0xB0,
AileronTrim = 0xB1,
AntiTorqueControl = 0xB2,
AutopilotEnable = 0xB3,
ChaffRelease = 0xB4,
CollectiveControl = 0xB5,
DiveBrake = 0xB6,
ElectronicCountermeasures = 0xB7,
Elevator = 0xB8,
ElevatorTrim = 0xB9,
Rudder = 0xBA,
Throttle = 0xBB,
FlightCommunications = 0xBC,
FlareRelease = 0xBD,
LandingGear = 0xBE,
ToeBrake = 0xBF,
Trigger = 0xC0,
WeaponsArm = 0xC1,
WeaponsSelect = 0xC2,
WingFlaps = 0xC3,
Accelerator = 0xC4,
Brake = 0xC5,
Clutch = 0xC6,
Shifter = 0xC7,
Steering = 0xC8,
TurretDirection = 0xC9,
BarrelElevation = 0xCA,
DivePlane = 0xCB,
Ballast = 0xCC,
BicycleCrank = 0xCD,
HandleBars = 0xCE,
FrontBrake = 0xCF,
RearBrake = 0xD0,
}
impl SimulationControls {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
SimulationControls::FlightSimulationDevice => "Flight Simulation Device",
SimulationControls::AutomobileSimulationDevice => "Automobile Simulation Device",
SimulationControls::TankSimulationDevice => "Tank Simulation Device",
SimulationControls::SpaceshipSimulationDevice => "Spaceship Simulation Device",
SimulationControls::SubmarineSimulationDevice => "Submarine Simulation Device",
SimulationControls::SailingSimulationDevice => "Sailing Simulation Device",
SimulationControls::MotorcycleSimulationDevice => "Motorcycle Simulation Device",
SimulationControls::SportsSimulationDevice => "Sports Simulation Device",
SimulationControls::AirplaneSimulationDevice => "Airplane Simulation Device",
SimulationControls::HelicopterSimulationDevice => "Helicopter Simulation Device",
SimulationControls::MagicCarpetSimulationDevice => "Magic Carpet Simulation Device",
SimulationControls::BicycleSimulationDevice => "Bicycle Simulation Device",
SimulationControls::FlightControlStick => "Flight Control Stick",
SimulationControls::FlightStick => "Flight Stick",
SimulationControls::CyclicControl => "Cyclic Control",
SimulationControls::CyclicTrim => "Cyclic Trim",
SimulationControls::FlightYoke => "Flight Yoke",
SimulationControls::TrackControl => "Track Control",
SimulationControls::Aileron => "Aileron",
SimulationControls::AileronTrim => "Aileron Trim",
SimulationControls::AntiTorqueControl => "Anti-Torque Control",
SimulationControls::AutopilotEnable => "Autopilot Enable",
SimulationControls::ChaffRelease => "Chaff Release",
SimulationControls::CollectiveControl => "Collective Control",
SimulationControls::DiveBrake => "Dive Brake",
SimulationControls::ElectronicCountermeasures => "Electronic Countermeasures",
SimulationControls::Elevator => "Elevator",
SimulationControls::ElevatorTrim => "Elevator Trim",
SimulationControls::Rudder => "Rudder",
SimulationControls::Throttle => "Throttle",
SimulationControls::FlightCommunications => "Flight Communications",
SimulationControls::FlareRelease => "Flare Release",
SimulationControls::LandingGear => "Landing Gear",
SimulationControls::ToeBrake => "Toe Brake",
SimulationControls::Trigger => "Trigger",
SimulationControls::WeaponsArm => "Weapons Arm",
SimulationControls::WeaponsSelect => "Weapons Select",
SimulationControls::WingFlaps => "Wing Flaps",
SimulationControls::Accelerator => "Accelerator",
SimulationControls::Brake => "Brake",
SimulationControls::Clutch => "Clutch",
SimulationControls::Shifter => "Shifter",
SimulationControls::Steering => "Steering",
SimulationControls::TurretDirection => "Turret Direction",
SimulationControls::BarrelElevation => "Barrel Elevation",
SimulationControls::DivePlane => "Dive Plane",
SimulationControls::Ballast => "Ballast",
SimulationControls::BicycleCrank => "Bicycle Crank",
SimulationControls::HandleBars => "Handle Bars",
SimulationControls::FrontBrake => "Front Brake",
SimulationControls::RearBrake => "Rear Brake",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for SimulationControls {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for SimulationControls {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for SimulationControls {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&SimulationControls> for u16 {
fn from(simulationcontrols: &SimulationControls) -> u16 {
*simulationcontrols as u16
}
}
impl From<SimulationControls> for u16 {
fn from(simulationcontrols: SimulationControls) -> u16 {
u16::from(&simulationcontrols)
}
}
impl From<&SimulationControls> for u32 {
fn from(simulationcontrols: &SimulationControls) -> u32 {
let up = UsagePage::from(simulationcontrols);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(simulationcontrols) as u32;
up | id
}
}
impl From<&SimulationControls> for UsagePage {
fn from(_: &SimulationControls) -> UsagePage {
UsagePage::SimulationControls
}
}
impl From<SimulationControls> for UsagePage {
fn from(_: SimulationControls) -> UsagePage {
UsagePage::SimulationControls
}
}
impl From<&SimulationControls> for Usage {
fn from(simulationcontrols: &SimulationControls) -> Usage {
Usage::try_from(u32::from(simulationcontrols)).unwrap()
}
}
impl From<SimulationControls> for Usage {
fn from(simulationcontrols: SimulationControls) -> Usage {
Usage::from(&simulationcontrols)
}
}
impl TryFrom<u16> for SimulationControls {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<SimulationControls> {
match usage_id {
1 => Ok(SimulationControls::FlightSimulationDevice),
2 => Ok(SimulationControls::AutomobileSimulationDevice),
3 => Ok(SimulationControls::TankSimulationDevice),
4 => Ok(SimulationControls::SpaceshipSimulationDevice),
5 => Ok(SimulationControls::SubmarineSimulationDevice),
6 => Ok(SimulationControls::SailingSimulationDevice),
7 => Ok(SimulationControls::MotorcycleSimulationDevice),
8 => Ok(SimulationControls::SportsSimulationDevice),
9 => Ok(SimulationControls::AirplaneSimulationDevice),
10 => Ok(SimulationControls::HelicopterSimulationDevice),
11 => Ok(SimulationControls::MagicCarpetSimulationDevice),
12 => Ok(SimulationControls::BicycleSimulationDevice),
32 => Ok(SimulationControls::FlightControlStick),
33 => Ok(SimulationControls::FlightStick),
34 => Ok(SimulationControls::CyclicControl),
35 => Ok(SimulationControls::CyclicTrim),
36 => Ok(SimulationControls::FlightYoke),
37 => Ok(SimulationControls::TrackControl),
176 => Ok(SimulationControls::Aileron),
177 => Ok(SimulationControls::AileronTrim),
178 => Ok(SimulationControls::AntiTorqueControl),
179 => Ok(SimulationControls::AutopilotEnable),
180 => Ok(SimulationControls::ChaffRelease),
181 => Ok(SimulationControls::CollectiveControl),
182 => Ok(SimulationControls::DiveBrake),
183 => Ok(SimulationControls::ElectronicCountermeasures),
184 => Ok(SimulationControls::Elevator),
185 => Ok(SimulationControls::ElevatorTrim),
186 => Ok(SimulationControls::Rudder),
187 => Ok(SimulationControls::Throttle),
188 => Ok(SimulationControls::FlightCommunications),
189 => Ok(SimulationControls::FlareRelease),
190 => Ok(SimulationControls::LandingGear),
191 => Ok(SimulationControls::ToeBrake),
192 => Ok(SimulationControls::Trigger),
193 => Ok(SimulationControls::WeaponsArm),
194 => Ok(SimulationControls::WeaponsSelect),
195 => Ok(SimulationControls::WingFlaps),
196 => Ok(SimulationControls::Accelerator),
197 => Ok(SimulationControls::Brake),
198 => Ok(SimulationControls::Clutch),
199 => Ok(SimulationControls::Shifter),
200 => Ok(SimulationControls::Steering),
201 => Ok(SimulationControls::TurretDirection),
202 => Ok(SimulationControls::BarrelElevation),
203 => Ok(SimulationControls::DivePlane),
204 => Ok(SimulationControls::Ballast),
205 => Ok(SimulationControls::BicycleCrank),
206 => Ok(SimulationControls::HandleBars),
207 => Ok(SimulationControls::FrontBrake),
208 => Ok(SimulationControls::RearBrake),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for SimulationControls {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum VRControls {
Belt = 0x1,
BodySuit = 0x2,
Flexor = 0x3,
Glove = 0x4,
HeadTracker = 0x5,
HeadMountedDisplay = 0x6,
HandTracker = 0x7,
Oculometer = 0x8,
Vest = 0x9,
AnimatronicDevice = 0xA,
StereoEnable = 0x20,
DisplayEnable = 0x21,
}
impl VRControls {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
VRControls::Belt => "Belt",
VRControls::BodySuit => "Body Suit",
VRControls::Flexor => "Flexor",
VRControls::Glove => "Glove",
VRControls::HeadTracker => "Head Tracker",
VRControls::HeadMountedDisplay => "Head Mounted Display",
VRControls::HandTracker => "Hand Tracker",
VRControls::Oculometer => "Oculometer",
VRControls::Vest => "Vest",
VRControls::AnimatronicDevice => "Animatronic Device",
VRControls::StereoEnable => "Stereo Enable",
VRControls::DisplayEnable => "Display Enable",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for VRControls {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for VRControls {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for VRControls {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&VRControls> for u16 {
fn from(vrcontrols: &VRControls) -> u16 {
*vrcontrols as u16
}
}
impl From<VRControls> for u16 {
fn from(vrcontrols: VRControls) -> u16 {
u16::from(&vrcontrols)
}
}
impl From<&VRControls> for u32 {
fn from(vrcontrols: &VRControls) -> u32 {
let up = UsagePage::from(vrcontrols);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(vrcontrols) as u32;
up | id
}
}
impl From<&VRControls> for UsagePage {
fn from(_: &VRControls) -> UsagePage {
UsagePage::VRControls
}
}
impl From<VRControls> for UsagePage {
fn from(_: VRControls) -> UsagePage {
UsagePage::VRControls
}
}
impl From<&VRControls> for Usage {
fn from(vrcontrols: &VRControls) -> Usage {
Usage::try_from(u32::from(vrcontrols)).unwrap()
}
}
impl From<VRControls> for Usage {
fn from(vrcontrols: VRControls) -> Usage {
Usage::from(&vrcontrols)
}
}
impl TryFrom<u16> for VRControls {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<VRControls> {
match usage_id {
1 => Ok(VRControls::Belt),
2 => Ok(VRControls::BodySuit),
3 => Ok(VRControls::Flexor),
4 => Ok(VRControls::Glove),
5 => Ok(VRControls::HeadTracker),
6 => Ok(VRControls::HeadMountedDisplay),
7 => Ok(VRControls::HandTracker),
8 => Ok(VRControls::Oculometer),
9 => Ok(VRControls::Vest),
10 => Ok(VRControls::AnimatronicDevice),
32 => Ok(VRControls::StereoEnable),
33 => Ok(VRControls::DisplayEnable),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for VRControls {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum SportControls {
BaseballBat = 0x1,
GolfClub = 0x2,
RowingMachine = 0x3,
Treadmill = 0x4,
Oar = 0x30,
Slope = 0x31,
Rate = 0x32,
StickSpeed = 0x33,
StickFaceAngle = 0x34,
StickHeelToe = 0x35,
StickFollowThrough = 0x36,
StickTempo = 0x37,
StickType = 0x38,
StickHeight = 0x39,
Putter = 0x50,
OneIron = 0x51,
TwoIron = 0x52,
ThreeIron = 0x53,
FourIron = 0x54,
FiveIron = 0x55,
SixIron = 0x56,
SevenIron = 0x57,
EightIron = 0x58,
NineIron = 0x59,
One0Iron = 0x5A,
One1Iron = 0x5B,
SandWedge = 0x5C,
LoftWedge = 0x5D,
PowerWedge = 0x5E,
OneWood = 0x5F,
ThreeWood = 0x60,
FiveWood = 0x61,
SevenWood = 0x62,
NineWood = 0x63,
}
impl SportControls {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
SportControls::BaseballBat => "Baseball Bat",
SportControls::GolfClub => "Golf Club",
SportControls::RowingMachine => "Rowing Machine",
SportControls::Treadmill => "Treadmill",
SportControls::Oar => "Oar",
SportControls::Slope => "Slope",
SportControls::Rate => "Rate",
SportControls::StickSpeed => "Stick Speed",
SportControls::StickFaceAngle => "Stick Face Angle",
SportControls::StickHeelToe => "Stick Heel/Toe",
SportControls::StickFollowThrough => "Stick Follow Through",
SportControls::StickTempo => "Stick Tempo",
SportControls::StickType => "Stick Type",
SportControls::StickHeight => "Stick Height",
SportControls::Putter => "Putter",
SportControls::OneIron => "1 Iron",
SportControls::TwoIron => "2 Iron",
SportControls::ThreeIron => "3 Iron",
SportControls::FourIron => "4 Iron",
SportControls::FiveIron => "5 Iron",
SportControls::SixIron => "6 Iron",
SportControls::SevenIron => "7 Iron",
SportControls::EightIron => "8 Iron",
SportControls::NineIron => "9 Iron",
SportControls::One0Iron => "10 Iron",
SportControls::One1Iron => "11 Iron",
SportControls::SandWedge => "Sand Wedge",
SportControls::LoftWedge => "Loft Wedge",
SportControls::PowerWedge => "Power Wedge",
SportControls::OneWood => "1 Wood",
SportControls::ThreeWood => "3 Wood",
SportControls::FiveWood => "5 Wood",
SportControls::SevenWood => "7 Wood",
SportControls::NineWood => "9 Wood",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for SportControls {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for SportControls {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for SportControls {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&SportControls> for u16 {
fn from(sportcontrols: &SportControls) -> u16 {
*sportcontrols as u16
}
}
impl From<SportControls> for u16 {
fn from(sportcontrols: SportControls) -> u16 {
u16::from(&sportcontrols)
}
}
impl From<&SportControls> for u32 {
fn from(sportcontrols: &SportControls) -> u32 {
let up = UsagePage::from(sportcontrols);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(sportcontrols) as u32;
up | id
}
}
impl From<&SportControls> for UsagePage {
fn from(_: &SportControls) -> UsagePage {
UsagePage::SportControls
}
}
impl From<SportControls> for UsagePage {
fn from(_: SportControls) -> UsagePage {
UsagePage::SportControls
}
}
impl From<&SportControls> for Usage {
fn from(sportcontrols: &SportControls) -> Usage {
Usage::try_from(u32::from(sportcontrols)).unwrap()
}
}
impl From<SportControls> for Usage {
fn from(sportcontrols: SportControls) -> Usage {
Usage::from(&sportcontrols)
}
}
impl TryFrom<u16> for SportControls {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<SportControls> {
match usage_id {
1 => Ok(SportControls::BaseballBat),
2 => Ok(SportControls::GolfClub),
3 => Ok(SportControls::RowingMachine),
4 => Ok(SportControls::Treadmill),
48 => Ok(SportControls::Oar),
49 => Ok(SportControls::Slope),
50 => Ok(SportControls::Rate),
51 => Ok(SportControls::StickSpeed),
52 => Ok(SportControls::StickFaceAngle),
53 => Ok(SportControls::StickHeelToe),
54 => Ok(SportControls::StickFollowThrough),
55 => Ok(SportControls::StickTempo),
56 => Ok(SportControls::StickType),
57 => Ok(SportControls::StickHeight),
80 => Ok(SportControls::Putter),
81 => Ok(SportControls::OneIron),
82 => Ok(SportControls::TwoIron),
83 => Ok(SportControls::ThreeIron),
84 => Ok(SportControls::FourIron),
85 => Ok(SportControls::FiveIron),
86 => Ok(SportControls::SixIron),
87 => Ok(SportControls::SevenIron),
88 => Ok(SportControls::EightIron),
89 => Ok(SportControls::NineIron),
90 => Ok(SportControls::One0Iron),
91 => Ok(SportControls::One1Iron),
92 => Ok(SportControls::SandWedge),
93 => Ok(SportControls::LoftWedge),
94 => Ok(SportControls::PowerWedge),
95 => Ok(SportControls::OneWood),
96 => Ok(SportControls::ThreeWood),
97 => Ok(SportControls::FiveWood),
98 => Ok(SportControls::SevenWood),
99 => Ok(SportControls::NineWood),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for SportControls {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum GameControls {
ThreeDGameController = 0x1,
PinballDevice = 0x2,
GunDevice = 0x3,
PointofView = 0x20,
TurnRightLeft = 0x21,
PitchForwardBackward = 0x22,
RollRightLeft = 0x23,
MoveRightLeft = 0x24,
MoveForwardBackward = 0x25,
MoveUpDown = 0x26,
LeanRightLeft = 0x27,
LeanForwardBackward = 0x28,
HeightofPOV = 0x29,
Flipper = 0x2A,
SecondaryFlipper = 0x2B,
Bump = 0x2C,
NewGame = 0x2D,
ShootBall = 0x2E,
Player = 0x2F,
GunBolt = 0x30,
GunClip = 0x31,
GunSelector = 0x32,
GunSingleShot = 0x33,
GunBurst = 0x34,
GunAutomatic = 0x35,
GunSafety = 0x36,
GamepadFireJump = 0x37,
GamepadTrigger = 0x39,
FormfittingGamepad = 0x3A,
}
impl GameControls {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
GameControls::ThreeDGameController => "3D Game Controller",
GameControls::PinballDevice => "Pinball Device",
GameControls::GunDevice => "Gun Device",
GameControls::PointofView => "Point of View",
GameControls::TurnRightLeft => "Turn Right/Left",
GameControls::PitchForwardBackward => "Pitch Forward/Backward",
GameControls::RollRightLeft => "Roll Right/Left",
GameControls::MoveRightLeft => "Move Right/Left",
GameControls::MoveForwardBackward => "Move Forward/Backward",
GameControls::MoveUpDown => "Move Up/Down",
GameControls::LeanRightLeft => "Lean Right/Left",
GameControls::LeanForwardBackward => "Lean Forward/Backward",
GameControls::HeightofPOV => "Height of POV",
GameControls::Flipper => "Flipper",
GameControls::SecondaryFlipper => "Secondary Flipper",
GameControls::Bump => "Bump",
GameControls::NewGame => "New Game",
GameControls::ShootBall => "Shoot Ball",
GameControls::Player => "Player",
GameControls::GunBolt => "Gun Bolt",
GameControls::GunClip => "Gun Clip",
GameControls::GunSelector => "Gun Selector",
GameControls::GunSingleShot => "Gun Single Shot",
GameControls::GunBurst => "Gun Burst",
GameControls::GunAutomatic => "Gun Automatic",
GameControls::GunSafety => "Gun Safety",
GameControls::GamepadFireJump => "Gamepad Fire/Jump",
GameControls::GamepadTrigger => "Gamepad Trigger",
GameControls::FormfittingGamepad => "Form-fitting Gamepad",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for GameControls {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for GameControls {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for GameControls {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&GameControls> for u16 {
fn from(gamecontrols: &GameControls) -> u16 {
*gamecontrols as u16
}
}
impl From<GameControls> for u16 {
fn from(gamecontrols: GameControls) -> u16 {
u16::from(&gamecontrols)
}
}
impl From<&GameControls> for u32 {
fn from(gamecontrols: &GameControls) -> u32 {
let up = UsagePage::from(gamecontrols);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(gamecontrols) as u32;
up | id
}
}
impl From<&GameControls> for UsagePage {
fn from(_: &GameControls) -> UsagePage {
UsagePage::GameControls
}
}
impl From<GameControls> for UsagePage {
fn from(_: GameControls) -> UsagePage {
UsagePage::GameControls
}
}
impl From<&GameControls> for Usage {
fn from(gamecontrols: &GameControls) -> Usage {
Usage::try_from(u32::from(gamecontrols)).unwrap()
}
}
impl From<GameControls> for Usage {
fn from(gamecontrols: GameControls) -> Usage {
Usage::from(&gamecontrols)
}
}
impl TryFrom<u16> for GameControls {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<GameControls> {
match usage_id {
1 => Ok(GameControls::ThreeDGameController),
2 => Ok(GameControls::PinballDevice),
3 => Ok(GameControls::GunDevice),
32 => Ok(GameControls::PointofView),
33 => Ok(GameControls::TurnRightLeft),
34 => Ok(GameControls::PitchForwardBackward),
35 => Ok(GameControls::RollRightLeft),
36 => Ok(GameControls::MoveRightLeft),
37 => Ok(GameControls::MoveForwardBackward),
38 => Ok(GameControls::MoveUpDown),
39 => Ok(GameControls::LeanRightLeft),
40 => Ok(GameControls::LeanForwardBackward),
41 => Ok(GameControls::HeightofPOV),
42 => Ok(GameControls::Flipper),
43 => Ok(GameControls::SecondaryFlipper),
44 => Ok(GameControls::Bump),
45 => Ok(GameControls::NewGame),
46 => Ok(GameControls::ShootBall),
47 => Ok(GameControls::Player),
48 => Ok(GameControls::GunBolt),
49 => Ok(GameControls::GunClip),
50 => Ok(GameControls::GunSelector),
51 => Ok(GameControls::GunSingleShot),
52 => Ok(GameControls::GunBurst),
53 => Ok(GameControls::GunAutomatic),
54 => Ok(GameControls::GunSafety),
55 => Ok(GameControls::GamepadFireJump),
57 => Ok(GameControls::GamepadTrigger),
58 => Ok(GameControls::FormfittingGamepad),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for GameControls {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum GenericDeviceControls {
BackgroundNonuserControls = 0x1,
BatteryStrength = 0x20,
WirelessChannel = 0x21,
WirelessID = 0x22,
DiscoverWirelessControl = 0x23,
SecurityCodeCharacterEntered = 0x24,
SecurityCodeCharacterErased = 0x25,
SecurityCodeCleared = 0x26,
SequenceID = 0x27,
SequenceIDReset = 0x28,
RFSignalStrength = 0x29,
SoftwareVersion = 0x2A,
ProtocolVersion = 0x2B,
HardwareVersion = 0x2C,
Major = 0x2D,
Minor = 0x2E,
Revision = 0x2F,
Handedness = 0x30,
EitherHand = 0x31,
LeftHand = 0x32,
RightHand = 0x33,
BothHands = 0x34,
GripPoseOffset = 0x40,
PointerPoseOffset = 0x41,
}
impl GenericDeviceControls {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
GenericDeviceControls::BackgroundNonuserControls => "Background/Nonuser Controls",
GenericDeviceControls::BatteryStrength => "Battery Strength",
GenericDeviceControls::WirelessChannel => "Wireless Channel",
GenericDeviceControls::WirelessID => "Wireless ID",
GenericDeviceControls::DiscoverWirelessControl => "Discover Wireless Control",
GenericDeviceControls::SecurityCodeCharacterEntered => {
"Security Code Character Entered"
}
GenericDeviceControls::SecurityCodeCharacterErased => "Security Code Character Erased",
GenericDeviceControls::SecurityCodeCleared => "Security Code Cleared",
GenericDeviceControls::SequenceID => "Sequence ID",
GenericDeviceControls::SequenceIDReset => "Sequence ID Reset",
GenericDeviceControls::RFSignalStrength => "RF Signal Strength",
GenericDeviceControls::SoftwareVersion => "Software Version",
GenericDeviceControls::ProtocolVersion => "Protocol Version",
GenericDeviceControls::HardwareVersion => "Hardware Version",
GenericDeviceControls::Major => "Major",
GenericDeviceControls::Minor => "Minor",
GenericDeviceControls::Revision => "Revision",
GenericDeviceControls::Handedness => "Handedness",
GenericDeviceControls::EitherHand => "Either Hand",
GenericDeviceControls::LeftHand => "Left Hand",
GenericDeviceControls::RightHand => "Right Hand",
GenericDeviceControls::BothHands => "Both Hands",
GenericDeviceControls::GripPoseOffset => "Grip Pose Offset",
GenericDeviceControls::PointerPoseOffset => "Pointer Pose Offset",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for GenericDeviceControls {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for GenericDeviceControls {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for GenericDeviceControls {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&GenericDeviceControls> for u16 {
fn from(genericdevicecontrols: &GenericDeviceControls) -> u16 {
*genericdevicecontrols as u16
}
}
impl From<GenericDeviceControls> for u16 {
fn from(genericdevicecontrols: GenericDeviceControls) -> u16 {
u16::from(&genericdevicecontrols)
}
}
impl From<&GenericDeviceControls> for u32 {
fn from(genericdevicecontrols: &GenericDeviceControls) -> u32 {
let up = UsagePage::from(genericdevicecontrols);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(genericdevicecontrols) as u32;
up | id
}
}
impl From<&GenericDeviceControls> for UsagePage {
fn from(_: &GenericDeviceControls) -> UsagePage {
UsagePage::GenericDeviceControls
}
}
impl From<GenericDeviceControls> for UsagePage {
fn from(_: GenericDeviceControls) -> UsagePage {
UsagePage::GenericDeviceControls
}
}
impl From<&GenericDeviceControls> for Usage {
fn from(genericdevicecontrols: &GenericDeviceControls) -> Usage {
Usage::try_from(u32::from(genericdevicecontrols)).unwrap()
}
}
impl From<GenericDeviceControls> for Usage {
fn from(genericdevicecontrols: GenericDeviceControls) -> Usage {
Usage::from(&genericdevicecontrols)
}
}
impl TryFrom<u16> for GenericDeviceControls {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<GenericDeviceControls> {
match usage_id {
1 => Ok(GenericDeviceControls::BackgroundNonuserControls),
32 => Ok(GenericDeviceControls::BatteryStrength),
33 => Ok(GenericDeviceControls::WirelessChannel),
34 => Ok(GenericDeviceControls::WirelessID),
35 => Ok(GenericDeviceControls::DiscoverWirelessControl),
36 => Ok(GenericDeviceControls::SecurityCodeCharacterEntered),
37 => Ok(GenericDeviceControls::SecurityCodeCharacterErased),
38 => Ok(GenericDeviceControls::SecurityCodeCleared),
39 => Ok(GenericDeviceControls::SequenceID),
40 => Ok(GenericDeviceControls::SequenceIDReset),
41 => Ok(GenericDeviceControls::RFSignalStrength),
42 => Ok(GenericDeviceControls::SoftwareVersion),
43 => Ok(GenericDeviceControls::ProtocolVersion),
44 => Ok(GenericDeviceControls::HardwareVersion),
45 => Ok(GenericDeviceControls::Major),
46 => Ok(GenericDeviceControls::Minor),
47 => Ok(GenericDeviceControls::Revision),
48 => Ok(GenericDeviceControls::Handedness),
49 => Ok(GenericDeviceControls::EitherHand),
50 => Ok(GenericDeviceControls::LeftHand),
51 => Ok(GenericDeviceControls::RightHand),
52 => Ok(GenericDeviceControls::BothHands),
64 => Ok(GenericDeviceControls::GripPoseOffset),
65 => Ok(GenericDeviceControls::PointerPoseOffset),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for GenericDeviceControls {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum KeyboardKeypad {
ErrorRollOver = 0x1,
POSTFail = 0x2,
ErrorUndefined = 0x3,
KeyboardA = 0x4,
KeyboardB = 0x5,
KeyboardC = 0x6,
KeyboardD = 0x7,
KeyboardE = 0x8,
KeyboardF = 0x9,
KeyboardG = 0xA,
KeyboardH = 0xB,
KeyboardI = 0xC,
KeyboardJ = 0xD,
KeyboardK = 0xE,
KeyboardL = 0xF,
KeyboardM = 0x10,
KeyboardN = 0x11,
KeyboardO = 0x12,
KeyboardP = 0x13,
KeyboardQ = 0x14,
KeyboardR = 0x15,
KeyboardS = 0x16,
KeyboardT = 0x17,
KeyboardU = 0x18,
KeyboardV = 0x19,
KeyboardW = 0x1A,
KeyboardX = 0x1B,
KeyboardY = 0x1C,
KeyboardZ = 0x1D,
Keyboard1andBang = 0x1E,
Keyboard2andAt = 0x1F,
Keyboard3andHash = 0x20,
Keyboard4andDollar = 0x21,
Keyboard5andPercent = 0x22,
Keyboard6andCaret = 0x23,
Keyboard7andAmpersand = 0x24,
Keyboard8andStar = 0x25,
Keyboard9andLeftBracket = 0x26,
Keyboard0andRightBracket = 0x27,
KeyboardReturnEnter = 0x28,
KeyboardEscape = 0x29,
KeyboardDelete = 0x2A,
KeyboardTab = 0x2B,
KeyboardSpacebar = 0x2C,
KeyboardDashandUnderscore = 0x2D,
KeyboardEqualsandPlus = 0x2E,
KeyboardLeftBrace = 0x2F,
KeyboardRightBrace = 0x30,
KeyboardBackslashandPipe = 0x31,
KeyboardNonUSHashandTilde = 0x32,
KeyboardSemiColonandColon = 0x33,
KeyboardLeftAposandDouble = 0x34,
KeyboardGraveAccentandTilde = 0x35,
KeyboardCommaandLessThan = 0x36,
KeyboardPeriodandGreaterThan = 0x37,
KeyboardForwardSlashandQuestionMark = 0x38,
KeyboardCapsLock = 0x39,
KeyboardF1 = 0x3A,
KeyboardF2 = 0x3B,
KeyboardF3 = 0x3C,
KeyboardF4 = 0x3D,
KeyboardF5 = 0x3E,
KeyboardF6 = 0x3F,
KeyboardF7 = 0x40,
KeyboardF8 = 0x41,
KeyboardF9 = 0x42,
KeyboardF10 = 0x43,
KeyboardF11 = 0x44,
KeyboardF12 = 0x45,
KeyboardPrintScreen = 0x46,
KeyboardScrollLock = 0x47,
KeyboardPause = 0x48,
KeyboardInsert = 0x49,
KeyboardHome = 0x4A,
KeyboardPageUp = 0x4B,
KeyboardDeleteForward = 0x4C,
KeyboardEnd = 0x4D,
KeyboardPageDown = 0x4E,
KeyboardRightArrow = 0x4F,
KeyboardLeftArrow = 0x50,
KeyboardDownArrow = 0x51,
KeyboardUpArrow = 0x52,
KeypadNumLockandClear = 0x53,
KeypadForwardSlash = 0x54,
KeypadStar = 0x55,
KeypadDash = 0x56,
KeypadPlus = 0x57,
KeypadENTER = 0x58,
Keypad1andEnd = 0x59,
Keypad2andDownArrow = 0x5A,
Keypad3andPageDn = 0x5B,
Keypad4andLeftArrow = 0x5C,
Keypad5 = 0x5D,
Keypad6andRightArrow = 0x5E,
Keypad7andHome = 0x5F,
Keypad8andUpArrow = 0x60,
Keypad9andPageUp = 0x61,
Keypad0andInsert = 0x62,
KeypadPeriodandDelete = 0x63,
KeyboardNonUSBackslashandPipe = 0x64,
KeyboardApplication = 0x65,
KeyboardPower = 0x66,
KeypadEquals = 0x67,
KeyboardF13 = 0x68,
KeyboardF14 = 0x69,
KeyboardF15 = 0x6A,
KeyboardF16 = 0x6B,
KeyboardF17 = 0x6C,
KeyboardF18 = 0x6D,
KeyboardF19 = 0x6E,
KeyboardF20 = 0x6F,
KeyboardF21 = 0x70,
KeyboardF22 = 0x71,
KeyboardF23 = 0x72,
KeyboardF24 = 0x73,
KeyboardExecute = 0x74,
KeyboardHelp = 0x75,
KeyboardMenu = 0x76,
KeyboardSelect = 0x77,
KeyboardStop = 0x78,
KeyboardAgain = 0x79,
KeyboardUndo = 0x7A,
KeyboardCut = 0x7B,
KeyboardCopy = 0x7C,
KeyboardPaste = 0x7D,
KeyboardFind = 0x7E,
KeyboardMute = 0x7F,
KeyboardVolumeUp = 0x80,
KeyboardVolumeDown = 0x81,
KeyboardLockingCapsLock = 0x82,
KeyboardLockingNumLock = 0x83,
KeyboardLockingScrollLock = 0x84,
KeypadComma = 0x85,
KeypadEqualSign = 0x86,
KeyboardInternational1 = 0x87,
KeyboardInternational2 = 0x88,
KeyboardInternational3 = 0x89,
KeyboardInternational4 = 0x8A,
KeyboardInternational5 = 0x8B,
KeyboardInternational6 = 0x8C,
KeyboardInternational7 = 0x8D,
KeyboardInternational8 = 0x8E,
KeyboardInternational9 = 0x8F,
KeyboardLANG1 = 0x90,
KeyboardLANG2 = 0x91,
KeyboardLANG3 = 0x92,
KeyboardLANG4 = 0x93,
KeyboardLANG5 = 0x94,
KeyboardLANG6 = 0x95,
KeyboardLANG7 = 0x96,
KeyboardLANG8 = 0x97,
KeyboardLANG9 = 0x98,
KeyboardAlternateErase = 0x99,
KeyboardSysReqAttention = 0x9A,
KeyboardCancel = 0x9B,
KeyboardClear = 0x9C,
KeyboardPrior = 0x9D,
KeyboardReturn = 0x9E,
KeyboardSeparator = 0x9F,
KeyboardOut = 0xA0,
KeyboardOper = 0xA1,
KeyboardClearAgain = 0xA2,
KeyboardCrSelProps = 0xA3,
KeyboardExSel = 0xA4,
KeypadDouble0 = 0xB0,
KeypadTriple0 = 0xB1,
ThousandsSeparator = 0xB2,
DecimalSeparator = 0xB3,
CurrencyUnit = 0xB4,
CurrencySubunit = 0xB5,
KeypadLeftBracket = 0xB6,
KeypadRightBracket = 0xB7,
KeypadLeftBrace = 0xB8,
KeypadRightBrace = 0xB9,
KeypadTab = 0xBA,
KeypadBackspace = 0xBB,
KeypadA = 0xBC,
KeypadB = 0xBD,
KeypadC = 0xBE,
KeypadD = 0xBF,
KeypadE = 0xC0,
KeypadF = 0xC1,
KeypadXOR = 0xC2,
KeypadCaret = 0xC3,
KeypadPercentage = 0xC4,
KeypadLess = 0xC5,
KeypadGreater = 0xC6,
KeypadAmpersand = 0xC7,
KeypadDoubleAmpersand = 0xC8,
KeypadBar = 0xC9,
KeypadDoubleBar = 0xCA,
KeypadColon = 0xCB,
KeypadHash = 0xCC,
KeypadSpace = 0xCD,
KeypadAt = 0xCE,
KeypadBang = 0xCF,
KeypadMemoryStore = 0xD0,
KeypadMemoryRecall = 0xD1,
KeypadMemoryClear = 0xD2,
KeypadMemoryAdd = 0xD3,
KeypadMemorySubtract = 0xD4,
KeypadMemoryMultiply = 0xD5,
KeypadMemoryDivide = 0xD6,
KeypadPlusMinus = 0xD7,
KeypadClear = 0xD8,
KeypadClearEntry = 0xD9,
KeypadBinary = 0xDA,
KeypadOctal = 0xDB,
KeypadDecimal = 0xDC,
KeypadHexadecimal = 0xDD,
KeyboardLeftControl = 0xE0,
KeyboardLeftShift = 0xE1,
KeyboardLeftAlt = 0xE2,
KeyboardLeftGUI = 0xE3,
KeyboardRightControl = 0xE4,
KeyboardRightShift = 0xE5,
KeyboardRightAlt = 0xE6,
KeyboardRightGUI = 0xE7,
}
impl KeyboardKeypad {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
KeyboardKeypad::ErrorRollOver => "ErrorRollOver",
KeyboardKeypad::POSTFail => "POSTFail",
KeyboardKeypad::ErrorUndefined => "ErrorUndefined",
KeyboardKeypad::KeyboardA => "Keyboard A",
KeyboardKeypad::KeyboardB => "Keyboard B",
KeyboardKeypad::KeyboardC => "Keyboard C",
KeyboardKeypad::KeyboardD => "Keyboard D",
KeyboardKeypad::KeyboardE => "Keyboard E",
KeyboardKeypad::KeyboardF => "Keyboard F",
KeyboardKeypad::KeyboardG => "Keyboard G",
KeyboardKeypad::KeyboardH => "Keyboard H",
KeyboardKeypad::KeyboardI => "Keyboard I",
KeyboardKeypad::KeyboardJ => "Keyboard J",
KeyboardKeypad::KeyboardK => "Keyboard K",
KeyboardKeypad::KeyboardL => "Keyboard L",
KeyboardKeypad::KeyboardM => "Keyboard M",
KeyboardKeypad::KeyboardN => "Keyboard N",
KeyboardKeypad::KeyboardO => "Keyboard O",
KeyboardKeypad::KeyboardP => "Keyboard P",
KeyboardKeypad::KeyboardQ => "Keyboard Q",
KeyboardKeypad::KeyboardR => "Keyboard R",
KeyboardKeypad::KeyboardS => "Keyboard S",
KeyboardKeypad::KeyboardT => "Keyboard T",
KeyboardKeypad::KeyboardU => "Keyboard U",
KeyboardKeypad::KeyboardV => "Keyboard V",
KeyboardKeypad::KeyboardW => "Keyboard W",
KeyboardKeypad::KeyboardX => "Keyboard X",
KeyboardKeypad::KeyboardY => "Keyboard Y",
KeyboardKeypad::KeyboardZ => "Keyboard Z",
KeyboardKeypad::Keyboard1andBang => "Keyboard 1 and Bang",
KeyboardKeypad::Keyboard2andAt => "Keyboard 2 and At",
KeyboardKeypad::Keyboard3andHash => "Keyboard 3 and Hash",
KeyboardKeypad::Keyboard4andDollar => "Keyboard 4 and Dollar",
KeyboardKeypad::Keyboard5andPercent => "Keyboard 5 and Percent",
KeyboardKeypad::Keyboard6andCaret => "Keyboard 6 and Caret",
KeyboardKeypad::Keyboard7andAmpersand => "Keyboard 7 and Ampersand",
KeyboardKeypad::Keyboard8andStar => "Keyboard 8 and Star",
KeyboardKeypad::Keyboard9andLeftBracket => "Keyboard 9 and Left Bracket",
KeyboardKeypad::Keyboard0andRightBracket => "Keyboard 0 and Right Bracket",
KeyboardKeypad::KeyboardReturnEnter => "Keyboard Return Enter",
KeyboardKeypad::KeyboardEscape => "Keyboard Escape",
KeyboardKeypad::KeyboardDelete => "Keyboard Delete",
KeyboardKeypad::KeyboardTab => "Keyboard Tab",
KeyboardKeypad::KeyboardSpacebar => "Keyboard Spacebar",
KeyboardKeypad::KeyboardDashandUnderscore => "Keyboard Dash and Underscore",
KeyboardKeypad::KeyboardEqualsandPlus => "Keyboard Equals and Plus",
KeyboardKeypad::KeyboardLeftBrace => "Keyboard Left Brace",
KeyboardKeypad::KeyboardRightBrace => "Keyboard Right Brace",
KeyboardKeypad::KeyboardBackslashandPipe => "Keyboard Backslash and Pipe",
KeyboardKeypad::KeyboardNonUSHashandTilde => "Keyboard Non-US Hash and Tilde",
KeyboardKeypad::KeyboardSemiColonandColon => "Keyboard SemiColon and Colon",
KeyboardKeypad::KeyboardLeftAposandDouble => "Keyboard Left Apos and Double",
KeyboardKeypad::KeyboardGraveAccentandTilde => "Keyboard Grave Accent and Tilde",
KeyboardKeypad::KeyboardCommaandLessThan => "Keyboard Comma and LessThan",
KeyboardKeypad::KeyboardPeriodandGreaterThan => "Keyboard Period and GreaterThan",
KeyboardKeypad::KeyboardForwardSlashandQuestionMark => {
"Keyboard ForwardSlash and QuestionMark"
}
KeyboardKeypad::KeyboardCapsLock => "Keyboard Caps Lock",
KeyboardKeypad::KeyboardF1 => "Keyboard F1",
KeyboardKeypad::KeyboardF2 => "Keyboard F2",
KeyboardKeypad::KeyboardF3 => "Keyboard F3",
KeyboardKeypad::KeyboardF4 => "Keyboard F4",
KeyboardKeypad::KeyboardF5 => "Keyboard F5",
KeyboardKeypad::KeyboardF6 => "Keyboard F6",
KeyboardKeypad::KeyboardF7 => "Keyboard F7",
KeyboardKeypad::KeyboardF8 => "Keyboard F8",
KeyboardKeypad::KeyboardF9 => "Keyboard F9",
KeyboardKeypad::KeyboardF10 => "Keyboard F10",
KeyboardKeypad::KeyboardF11 => "Keyboard F11",
KeyboardKeypad::KeyboardF12 => "Keyboard F12",
KeyboardKeypad::KeyboardPrintScreen => "Keyboard PrintScreen",
KeyboardKeypad::KeyboardScrollLock => "Keyboard Scroll Lock",
KeyboardKeypad::KeyboardPause => "Keyboard Pause",
KeyboardKeypad::KeyboardInsert => "Keyboard Insert",
KeyboardKeypad::KeyboardHome => "Keyboard Home",
KeyboardKeypad::KeyboardPageUp => "Keyboard PageUp",
KeyboardKeypad::KeyboardDeleteForward => "Keyboard Delete Forward",
KeyboardKeypad::KeyboardEnd => "Keyboard End",
KeyboardKeypad::KeyboardPageDown => "Keyboard PageDown",
KeyboardKeypad::KeyboardRightArrow => "Keyboard RightArrow",
KeyboardKeypad::KeyboardLeftArrow => "Keyboard LeftArrow",
KeyboardKeypad::KeyboardDownArrow => "Keyboard DownArrow",
KeyboardKeypad::KeyboardUpArrow => "Keyboard UpArrow",
KeyboardKeypad::KeypadNumLockandClear => "Keypad Num Lock and Clear",
KeyboardKeypad::KeypadForwardSlash => "Keypad ForwardSlash",
KeyboardKeypad::KeypadStar => "Keypad Star",
KeyboardKeypad::KeypadDash => "Keypad Dash",
KeyboardKeypad::KeypadPlus => "Keypad Plus",
KeyboardKeypad::KeypadENTER => "Keypad ENTER",
KeyboardKeypad::Keypad1andEnd => "Keypad 1 and End",
KeyboardKeypad::Keypad2andDownArrow => "Keypad 2 and Down Arrow",
KeyboardKeypad::Keypad3andPageDn => "Keypad 3 and PageDn",
KeyboardKeypad::Keypad4andLeftArrow => "Keypad 4 and Left Arrow",
KeyboardKeypad::Keypad5 => "Keypad 5",
KeyboardKeypad::Keypad6andRightArrow => "Keypad 6 and Right Arrow",
KeyboardKeypad::Keypad7andHome => "Keypad 7 and Home",
KeyboardKeypad::Keypad8andUpArrow => "Keypad 8 and Up Arrow",
KeyboardKeypad::Keypad9andPageUp => "Keypad 9 and PageUp",
KeyboardKeypad::Keypad0andInsert => "Keypad 0 and Insert",
KeyboardKeypad::KeypadPeriodandDelete => "Keypad Period and Delete",
KeyboardKeypad::KeyboardNonUSBackslashandPipe => "Keyboard Non-US Backslash and Pipe",
KeyboardKeypad::KeyboardApplication => "Keyboard Application",
KeyboardKeypad::KeyboardPower => "Keyboard Power",
KeyboardKeypad::KeypadEquals => "Keypad Equals",
KeyboardKeypad::KeyboardF13 => "Keyboard F13",
KeyboardKeypad::KeyboardF14 => "Keyboard F14",
KeyboardKeypad::KeyboardF15 => "Keyboard F15",
KeyboardKeypad::KeyboardF16 => "Keyboard F16",
KeyboardKeypad::KeyboardF17 => "Keyboard F17",
KeyboardKeypad::KeyboardF18 => "Keyboard F18",
KeyboardKeypad::KeyboardF19 => "Keyboard F19",
KeyboardKeypad::KeyboardF20 => "Keyboard F20",
KeyboardKeypad::KeyboardF21 => "Keyboard F21",
KeyboardKeypad::KeyboardF22 => "Keyboard F22",
KeyboardKeypad::KeyboardF23 => "Keyboard F23",
KeyboardKeypad::KeyboardF24 => "Keyboard F24",
KeyboardKeypad::KeyboardExecute => "Keyboard Execute",
KeyboardKeypad::KeyboardHelp => "Keyboard Help",
KeyboardKeypad::KeyboardMenu => "Keyboard Menu",
KeyboardKeypad::KeyboardSelect => "Keyboard Select",
KeyboardKeypad::KeyboardStop => "Keyboard Stop",
KeyboardKeypad::KeyboardAgain => "Keyboard Again",
KeyboardKeypad::KeyboardUndo => "Keyboard Undo",
KeyboardKeypad::KeyboardCut => "Keyboard Cut",
KeyboardKeypad::KeyboardCopy => "Keyboard Copy",
KeyboardKeypad::KeyboardPaste => "Keyboard Paste",
KeyboardKeypad::KeyboardFind => "Keyboard Find",
KeyboardKeypad::KeyboardMute => "Keyboard Mute",
KeyboardKeypad::KeyboardVolumeUp => "Keyboard Volume Up",
KeyboardKeypad::KeyboardVolumeDown => "Keyboard Volume Down",
KeyboardKeypad::KeyboardLockingCapsLock => "Keyboard Locking Caps Lock",
KeyboardKeypad::KeyboardLockingNumLock => "Keyboard Locking Num Lock",
KeyboardKeypad::KeyboardLockingScrollLock => "Keyboard Locking Scroll Lock",
KeyboardKeypad::KeypadComma => "Keypad Comma",
KeyboardKeypad::KeypadEqualSign => "Keypad Equal Sign",
KeyboardKeypad::KeyboardInternational1 => "Keyboard International1",
KeyboardKeypad::KeyboardInternational2 => "Keyboard International2",
KeyboardKeypad::KeyboardInternational3 => "Keyboard International3",
KeyboardKeypad::KeyboardInternational4 => "Keyboard International4",
KeyboardKeypad::KeyboardInternational5 => "Keyboard International5",
KeyboardKeypad::KeyboardInternational6 => "Keyboard International6",
KeyboardKeypad::KeyboardInternational7 => "Keyboard International7",
KeyboardKeypad::KeyboardInternational8 => "Keyboard International8",
KeyboardKeypad::KeyboardInternational9 => "Keyboard International9",
KeyboardKeypad::KeyboardLANG1 => "Keyboard LANG1",
KeyboardKeypad::KeyboardLANG2 => "Keyboard LANG2",
KeyboardKeypad::KeyboardLANG3 => "Keyboard LANG3",
KeyboardKeypad::KeyboardLANG4 => "Keyboard LANG4",
KeyboardKeypad::KeyboardLANG5 => "Keyboard LANG5",
KeyboardKeypad::KeyboardLANG6 => "Keyboard LANG6",
KeyboardKeypad::KeyboardLANG7 => "Keyboard LANG7",
KeyboardKeypad::KeyboardLANG8 => "Keyboard LANG8",
KeyboardKeypad::KeyboardLANG9 => "Keyboard LANG9",
KeyboardKeypad::KeyboardAlternateErase => "Keyboard Alternate Erase",
KeyboardKeypad::KeyboardSysReqAttention => "Keyboard SysReq Attention",
KeyboardKeypad::KeyboardCancel => "Keyboard Cancel",
KeyboardKeypad::KeyboardClear => "Keyboard Clear",
KeyboardKeypad::KeyboardPrior => "Keyboard Prior",
KeyboardKeypad::KeyboardReturn => "Keyboard Return",
KeyboardKeypad::KeyboardSeparator => "Keyboard Separator",
KeyboardKeypad::KeyboardOut => "Keyboard Out",
KeyboardKeypad::KeyboardOper => "Keyboard Oper",
KeyboardKeypad::KeyboardClearAgain => "Keyboard Clear Again",
KeyboardKeypad::KeyboardCrSelProps => "Keyboard CrSel Props",
KeyboardKeypad::KeyboardExSel => "Keyboard ExSel",
KeyboardKeypad::KeypadDouble0 => "Keypad Double 0",
KeyboardKeypad::KeypadTriple0 => "Keypad Triple 0",
KeyboardKeypad::ThousandsSeparator => "Thousands Separator",
KeyboardKeypad::DecimalSeparator => "Decimal Separator",
KeyboardKeypad::CurrencyUnit => "Currency Unit",
KeyboardKeypad::CurrencySubunit => "Currency Sub-unit",
KeyboardKeypad::KeypadLeftBracket => "Keypad Left Bracket",
KeyboardKeypad::KeypadRightBracket => "Keypad Right Bracket",
KeyboardKeypad::KeypadLeftBrace => "Keypad Left Brace",
KeyboardKeypad::KeypadRightBrace => "Keypad Right Brace",
KeyboardKeypad::KeypadTab => "Keypad Tab",
KeyboardKeypad::KeypadBackspace => "Keypad Backspace",
KeyboardKeypad::KeypadA => "Keypad A",
KeyboardKeypad::KeypadB => "Keypad B",
KeyboardKeypad::KeypadC => "Keypad C",
KeyboardKeypad::KeypadD => "Keypad D",
KeyboardKeypad::KeypadE => "Keypad E",
KeyboardKeypad::KeypadF => "Keypad F",
KeyboardKeypad::KeypadXOR => "Keypad XOR",
KeyboardKeypad::KeypadCaret => "Keypad Caret",
KeyboardKeypad::KeypadPercentage => "Keypad Percentage",
KeyboardKeypad::KeypadLess => "Keypad Less",
KeyboardKeypad::KeypadGreater => "Keypad Greater",
KeyboardKeypad::KeypadAmpersand => "Keypad Ampersand",
KeyboardKeypad::KeypadDoubleAmpersand => "Keypad Double Ampersand",
KeyboardKeypad::KeypadBar => "Keypad Bar",
KeyboardKeypad::KeypadDoubleBar => "Keypad Double Bar",
KeyboardKeypad::KeypadColon => "Keypad Colon",
KeyboardKeypad::KeypadHash => "Keypad Hash",
KeyboardKeypad::KeypadSpace => "Keypad Space",
KeyboardKeypad::KeypadAt => "Keypad At",
KeyboardKeypad::KeypadBang => "Keypad Bang",
KeyboardKeypad::KeypadMemoryStore => "Keypad Memory Store",
KeyboardKeypad::KeypadMemoryRecall => "Keypad Memory Recall",
KeyboardKeypad::KeypadMemoryClear => "Keypad Memory Clear",
KeyboardKeypad::KeypadMemoryAdd => "Keypad Memory Add",
KeyboardKeypad::KeypadMemorySubtract => "Keypad Memory Subtract",
KeyboardKeypad::KeypadMemoryMultiply => "Keypad Memory Multiply",
KeyboardKeypad::KeypadMemoryDivide => "Keypad Memory Divide",
KeyboardKeypad::KeypadPlusMinus => "Keypad Plus Minus",
KeyboardKeypad::KeypadClear => "Keypad Clear",
KeyboardKeypad::KeypadClearEntry => "Keypad Clear Entry",
KeyboardKeypad::KeypadBinary => "Keypad Binary",
KeyboardKeypad::KeypadOctal => "Keypad Octal",
KeyboardKeypad::KeypadDecimal => "Keypad Decimal",
KeyboardKeypad::KeypadHexadecimal => "Keypad Hexadecimal",
KeyboardKeypad::KeyboardLeftControl => "Keyboard LeftControl",
KeyboardKeypad::KeyboardLeftShift => "Keyboard LeftShift",
KeyboardKeypad::KeyboardLeftAlt => "Keyboard LeftAlt",
KeyboardKeypad::KeyboardLeftGUI => "Keyboard Left GUI",
KeyboardKeypad::KeyboardRightControl => "Keyboard RightControl",
KeyboardKeypad::KeyboardRightShift => "Keyboard RightShift",
KeyboardKeypad::KeyboardRightAlt => "Keyboard RightAlt",
KeyboardKeypad::KeyboardRightGUI => "Keyboard Right GUI",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for KeyboardKeypad {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for KeyboardKeypad {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for KeyboardKeypad {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&KeyboardKeypad> for u16 {
fn from(keyboardkeypad: &KeyboardKeypad) -> u16 {
*keyboardkeypad as u16
}
}
impl From<KeyboardKeypad> for u16 {
fn from(keyboardkeypad: KeyboardKeypad) -> u16 {
u16::from(&keyboardkeypad)
}
}
impl From<&KeyboardKeypad> for u32 {
fn from(keyboardkeypad: &KeyboardKeypad) -> u32 {
let up = UsagePage::from(keyboardkeypad);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(keyboardkeypad) as u32;
up | id
}
}
impl From<&KeyboardKeypad> for UsagePage {
fn from(_: &KeyboardKeypad) -> UsagePage {
UsagePage::KeyboardKeypad
}
}
impl From<KeyboardKeypad> for UsagePage {
fn from(_: KeyboardKeypad) -> UsagePage {
UsagePage::KeyboardKeypad
}
}
impl From<&KeyboardKeypad> for Usage {
fn from(keyboardkeypad: &KeyboardKeypad) -> Usage {
Usage::try_from(u32::from(keyboardkeypad)).unwrap()
}
}
impl From<KeyboardKeypad> for Usage {
fn from(keyboardkeypad: KeyboardKeypad) -> Usage {
Usage::from(&keyboardkeypad)
}
}
impl TryFrom<u16> for KeyboardKeypad {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<KeyboardKeypad> {
match usage_id {
1 => Ok(KeyboardKeypad::ErrorRollOver),
2 => Ok(KeyboardKeypad::POSTFail),
3 => Ok(KeyboardKeypad::ErrorUndefined),
4 => Ok(KeyboardKeypad::KeyboardA),
5 => Ok(KeyboardKeypad::KeyboardB),
6 => Ok(KeyboardKeypad::KeyboardC),
7 => Ok(KeyboardKeypad::KeyboardD),
8 => Ok(KeyboardKeypad::KeyboardE),
9 => Ok(KeyboardKeypad::KeyboardF),
10 => Ok(KeyboardKeypad::KeyboardG),
11 => Ok(KeyboardKeypad::KeyboardH),
12 => Ok(KeyboardKeypad::KeyboardI),
13 => Ok(KeyboardKeypad::KeyboardJ),
14 => Ok(KeyboardKeypad::KeyboardK),
15 => Ok(KeyboardKeypad::KeyboardL),
16 => Ok(KeyboardKeypad::KeyboardM),
17 => Ok(KeyboardKeypad::KeyboardN),
18 => Ok(KeyboardKeypad::KeyboardO),
19 => Ok(KeyboardKeypad::KeyboardP),
20 => Ok(KeyboardKeypad::KeyboardQ),
21 => Ok(KeyboardKeypad::KeyboardR),
22 => Ok(KeyboardKeypad::KeyboardS),
23 => Ok(KeyboardKeypad::KeyboardT),
24 => Ok(KeyboardKeypad::KeyboardU),
25 => Ok(KeyboardKeypad::KeyboardV),
26 => Ok(KeyboardKeypad::KeyboardW),
27 => Ok(KeyboardKeypad::KeyboardX),
28 => Ok(KeyboardKeypad::KeyboardY),
29 => Ok(KeyboardKeypad::KeyboardZ),
30 => Ok(KeyboardKeypad::Keyboard1andBang),
31 => Ok(KeyboardKeypad::Keyboard2andAt),
32 => Ok(KeyboardKeypad::Keyboard3andHash),
33 => Ok(KeyboardKeypad::Keyboard4andDollar),
34 => Ok(KeyboardKeypad::Keyboard5andPercent),
35 => Ok(KeyboardKeypad::Keyboard6andCaret),
36 => Ok(KeyboardKeypad::Keyboard7andAmpersand),
37 => Ok(KeyboardKeypad::Keyboard8andStar),
38 => Ok(KeyboardKeypad::Keyboard9andLeftBracket),
39 => Ok(KeyboardKeypad::Keyboard0andRightBracket),
40 => Ok(KeyboardKeypad::KeyboardReturnEnter),
41 => Ok(KeyboardKeypad::KeyboardEscape),
42 => Ok(KeyboardKeypad::KeyboardDelete),
43 => Ok(KeyboardKeypad::KeyboardTab),
44 => Ok(KeyboardKeypad::KeyboardSpacebar),
45 => Ok(KeyboardKeypad::KeyboardDashandUnderscore),
46 => Ok(KeyboardKeypad::KeyboardEqualsandPlus),
47 => Ok(KeyboardKeypad::KeyboardLeftBrace),
48 => Ok(KeyboardKeypad::KeyboardRightBrace),
49 => Ok(KeyboardKeypad::KeyboardBackslashandPipe),
50 => Ok(KeyboardKeypad::KeyboardNonUSHashandTilde),
51 => Ok(KeyboardKeypad::KeyboardSemiColonandColon),
52 => Ok(KeyboardKeypad::KeyboardLeftAposandDouble),
53 => Ok(KeyboardKeypad::KeyboardGraveAccentandTilde),
54 => Ok(KeyboardKeypad::KeyboardCommaandLessThan),
55 => Ok(KeyboardKeypad::KeyboardPeriodandGreaterThan),
56 => Ok(KeyboardKeypad::KeyboardForwardSlashandQuestionMark),
57 => Ok(KeyboardKeypad::KeyboardCapsLock),
58 => Ok(KeyboardKeypad::KeyboardF1),
59 => Ok(KeyboardKeypad::KeyboardF2),
60 => Ok(KeyboardKeypad::KeyboardF3),
61 => Ok(KeyboardKeypad::KeyboardF4),
62 => Ok(KeyboardKeypad::KeyboardF5),
63 => Ok(KeyboardKeypad::KeyboardF6),
64 => Ok(KeyboardKeypad::KeyboardF7),
65 => Ok(KeyboardKeypad::KeyboardF8),
66 => Ok(KeyboardKeypad::KeyboardF9),
67 => Ok(KeyboardKeypad::KeyboardF10),
68 => Ok(KeyboardKeypad::KeyboardF11),
69 => Ok(KeyboardKeypad::KeyboardF12),
70 => Ok(KeyboardKeypad::KeyboardPrintScreen),
71 => Ok(KeyboardKeypad::KeyboardScrollLock),
72 => Ok(KeyboardKeypad::KeyboardPause),
73 => Ok(KeyboardKeypad::KeyboardInsert),
74 => Ok(KeyboardKeypad::KeyboardHome),
75 => Ok(KeyboardKeypad::KeyboardPageUp),
76 => Ok(KeyboardKeypad::KeyboardDeleteForward),
77 => Ok(KeyboardKeypad::KeyboardEnd),
78 => Ok(KeyboardKeypad::KeyboardPageDown),
79 => Ok(KeyboardKeypad::KeyboardRightArrow),
80 => Ok(KeyboardKeypad::KeyboardLeftArrow),
81 => Ok(KeyboardKeypad::KeyboardDownArrow),
82 => Ok(KeyboardKeypad::KeyboardUpArrow),
83 => Ok(KeyboardKeypad::KeypadNumLockandClear),
84 => Ok(KeyboardKeypad::KeypadForwardSlash),
85 => Ok(KeyboardKeypad::KeypadStar),
86 => Ok(KeyboardKeypad::KeypadDash),
87 => Ok(KeyboardKeypad::KeypadPlus),
88 => Ok(KeyboardKeypad::KeypadENTER),
89 => Ok(KeyboardKeypad::Keypad1andEnd),
90 => Ok(KeyboardKeypad::Keypad2andDownArrow),
91 => Ok(KeyboardKeypad::Keypad3andPageDn),
92 => Ok(KeyboardKeypad::Keypad4andLeftArrow),
93 => Ok(KeyboardKeypad::Keypad5),
94 => Ok(KeyboardKeypad::Keypad6andRightArrow),
95 => Ok(KeyboardKeypad::Keypad7andHome),
96 => Ok(KeyboardKeypad::Keypad8andUpArrow),
97 => Ok(KeyboardKeypad::Keypad9andPageUp),
98 => Ok(KeyboardKeypad::Keypad0andInsert),
99 => Ok(KeyboardKeypad::KeypadPeriodandDelete),
100 => Ok(KeyboardKeypad::KeyboardNonUSBackslashandPipe),
101 => Ok(KeyboardKeypad::KeyboardApplication),
102 => Ok(KeyboardKeypad::KeyboardPower),
103 => Ok(KeyboardKeypad::KeypadEquals),
104 => Ok(KeyboardKeypad::KeyboardF13),
105 => Ok(KeyboardKeypad::KeyboardF14),
106 => Ok(KeyboardKeypad::KeyboardF15),
107 => Ok(KeyboardKeypad::KeyboardF16),
108 => Ok(KeyboardKeypad::KeyboardF17),
109 => Ok(KeyboardKeypad::KeyboardF18),
110 => Ok(KeyboardKeypad::KeyboardF19),
111 => Ok(KeyboardKeypad::KeyboardF20),
112 => Ok(KeyboardKeypad::KeyboardF21),
113 => Ok(KeyboardKeypad::KeyboardF22),
114 => Ok(KeyboardKeypad::KeyboardF23),
115 => Ok(KeyboardKeypad::KeyboardF24),
116 => Ok(KeyboardKeypad::KeyboardExecute),
117 => Ok(KeyboardKeypad::KeyboardHelp),
118 => Ok(KeyboardKeypad::KeyboardMenu),
119 => Ok(KeyboardKeypad::KeyboardSelect),
120 => Ok(KeyboardKeypad::KeyboardStop),
121 => Ok(KeyboardKeypad::KeyboardAgain),
122 => Ok(KeyboardKeypad::KeyboardUndo),
123 => Ok(KeyboardKeypad::KeyboardCut),
124 => Ok(KeyboardKeypad::KeyboardCopy),
125 => Ok(KeyboardKeypad::KeyboardPaste),
126 => Ok(KeyboardKeypad::KeyboardFind),
127 => Ok(KeyboardKeypad::KeyboardMute),
128 => Ok(KeyboardKeypad::KeyboardVolumeUp),
129 => Ok(KeyboardKeypad::KeyboardVolumeDown),
130 => Ok(KeyboardKeypad::KeyboardLockingCapsLock),
131 => Ok(KeyboardKeypad::KeyboardLockingNumLock),
132 => Ok(KeyboardKeypad::KeyboardLockingScrollLock),
133 => Ok(KeyboardKeypad::KeypadComma),
134 => Ok(KeyboardKeypad::KeypadEqualSign),
135 => Ok(KeyboardKeypad::KeyboardInternational1),
136 => Ok(KeyboardKeypad::KeyboardInternational2),
137 => Ok(KeyboardKeypad::KeyboardInternational3),
138 => Ok(KeyboardKeypad::KeyboardInternational4),
139 => Ok(KeyboardKeypad::KeyboardInternational5),
140 => Ok(KeyboardKeypad::KeyboardInternational6),
141 => Ok(KeyboardKeypad::KeyboardInternational7),
142 => Ok(KeyboardKeypad::KeyboardInternational8),
143 => Ok(KeyboardKeypad::KeyboardInternational9),
144 => Ok(KeyboardKeypad::KeyboardLANG1),
145 => Ok(KeyboardKeypad::KeyboardLANG2),
146 => Ok(KeyboardKeypad::KeyboardLANG3),
147 => Ok(KeyboardKeypad::KeyboardLANG4),
148 => Ok(KeyboardKeypad::KeyboardLANG5),
149 => Ok(KeyboardKeypad::KeyboardLANG6),
150 => Ok(KeyboardKeypad::KeyboardLANG7),
151 => Ok(KeyboardKeypad::KeyboardLANG8),
152 => Ok(KeyboardKeypad::KeyboardLANG9),
153 => Ok(KeyboardKeypad::KeyboardAlternateErase),
154 => Ok(KeyboardKeypad::KeyboardSysReqAttention),
155 => Ok(KeyboardKeypad::KeyboardCancel),
156 => Ok(KeyboardKeypad::KeyboardClear),
157 => Ok(KeyboardKeypad::KeyboardPrior),
158 => Ok(KeyboardKeypad::KeyboardReturn),
159 => Ok(KeyboardKeypad::KeyboardSeparator),
160 => Ok(KeyboardKeypad::KeyboardOut),
161 => Ok(KeyboardKeypad::KeyboardOper),
162 => Ok(KeyboardKeypad::KeyboardClearAgain),
163 => Ok(KeyboardKeypad::KeyboardCrSelProps),
164 => Ok(KeyboardKeypad::KeyboardExSel),
176 => Ok(KeyboardKeypad::KeypadDouble0),
177 => Ok(KeyboardKeypad::KeypadTriple0),
178 => Ok(KeyboardKeypad::ThousandsSeparator),
179 => Ok(KeyboardKeypad::DecimalSeparator),
180 => Ok(KeyboardKeypad::CurrencyUnit),
181 => Ok(KeyboardKeypad::CurrencySubunit),
182 => Ok(KeyboardKeypad::KeypadLeftBracket),
183 => Ok(KeyboardKeypad::KeypadRightBracket),
184 => Ok(KeyboardKeypad::KeypadLeftBrace),
185 => Ok(KeyboardKeypad::KeypadRightBrace),
186 => Ok(KeyboardKeypad::KeypadTab),
187 => Ok(KeyboardKeypad::KeypadBackspace),
188 => Ok(KeyboardKeypad::KeypadA),
189 => Ok(KeyboardKeypad::KeypadB),
190 => Ok(KeyboardKeypad::KeypadC),
191 => Ok(KeyboardKeypad::KeypadD),
192 => Ok(KeyboardKeypad::KeypadE),
193 => Ok(KeyboardKeypad::KeypadF),
194 => Ok(KeyboardKeypad::KeypadXOR),
195 => Ok(KeyboardKeypad::KeypadCaret),
196 => Ok(KeyboardKeypad::KeypadPercentage),
197 => Ok(KeyboardKeypad::KeypadLess),
198 => Ok(KeyboardKeypad::KeypadGreater),
199 => Ok(KeyboardKeypad::KeypadAmpersand),
200 => Ok(KeyboardKeypad::KeypadDoubleAmpersand),
201 => Ok(KeyboardKeypad::KeypadBar),
202 => Ok(KeyboardKeypad::KeypadDoubleBar),
203 => Ok(KeyboardKeypad::KeypadColon),
204 => Ok(KeyboardKeypad::KeypadHash),
205 => Ok(KeyboardKeypad::KeypadSpace),
206 => Ok(KeyboardKeypad::KeypadAt),
207 => Ok(KeyboardKeypad::KeypadBang),
208 => Ok(KeyboardKeypad::KeypadMemoryStore),
209 => Ok(KeyboardKeypad::KeypadMemoryRecall),
210 => Ok(KeyboardKeypad::KeypadMemoryClear),
211 => Ok(KeyboardKeypad::KeypadMemoryAdd),
212 => Ok(KeyboardKeypad::KeypadMemorySubtract),
213 => Ok(KeyboardKeypad::KeypadMemoryMultiply),
214 => Ok(KeyboardKeypad::KeypadMemoryDivide),
215 => Ok(KeyboardKeypad::KeypadPlusMinus),
216 => Ok(KeyboardKeypad::KeypadClear),
217 => Ok(KeyboardKeypad::KeypadClearEntry),
218 => Ok(KeyboardKeypad::KeypadBinary),
219 => Ok(KeyboardKeypad::KeypadOctal),
220 => Ok(KeyboardKeypad::KeypadDecimal),
221 => Ok(KeyboardKeypad::KeypadHexadecimal),
224 => Ok(KeyboardKeypad::KeyboardLeftControl),
225 => Ok(KeyboardKeypad::KeyboardLeftShift),
226 => Ok(KeyboardKeypad::KeyboardLeftAlt),
227 => Ok(KeyboardKeypad::KeyboardLeftGUI),
228 => Ok(KeyboardKeypad::KeyboardRightControl),
229 => Ok(KeyboardKeypad::KeyboardRightShift),
230 => Ok(KeyboardKeypad::KeyboardRightAlt),
231 => Ok(KeyboardKeypad::KeyboardRightGUI),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for KeyboardKeypad {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum LED {
NumLock = 0x1,
CapsLock = 0x2,
ScrollLock = 0x3,
Compose = 0x4,
Kana = 0x5,
Power = 0x6,
Shift = 0x7,
DoNotDisturb = 0x8,
Mute = 0x9,
ToneEnable = 0xA,
HighCutFilter = 0xB,
LowCutFilter = 0xC,
EqualizerEnable = 0xD,
SoundFieldOn = 0xE,
SurroundOn = 0xF,
Repeat = 0x10,
Stereo = 0x11,
SamplingRateDetect = 0x12,
Spinning = 0x13,
CAV = 0x14,
CLV = 0x15,
RecordingFormatDetect = 0x16,
OffHook = 0x17,
Ring = 0x18,
MessageWaiting = 0x19,
DataMode = 0x1A,
BatteryOperation = 0x1B,
BatteryOK = 0x1C,
BatteryLow = 0x1D,
Speaker = 0x1E,
Headset = 0x1F,
Hold = 0x20,
Microphone = 0x21,
Coverage = 0x22,
NightMode = 0x23,
SendCalls = 0x24,
CallPickup = 0x25,
Conference = 0x26,
Standby = 0x27,
CameraOn = 0x28,
CameraOff = 0x29,
OnLine = 0x2A,
OffLine = 0x2B,
Busy = 0x2C,
Ready = 0x2D,
PaperOut = 0x2E,
PaperJam = 0x2F,
Remote = 0x30,
Forward = 0x31,
Reverse = 0x32,
Stop = 0x33,
Rewind = 0x34,
FastForward = 0x35,
Play = 0x36,
Pause = 0x37,
Record = 0x38,
Error = 0x39,
UsageSelectedIndicator = 0x3A,
UsageInUseIndicator = 0x3B,
UsageMultiModeIndicator = 0x3C,
IndicatorOn = 0x3D,
IndicatorFlash = 0x3E,
IndicatorSlowBlink = 0x3F,
IndicatorFastBlink = 0x40,
IndicatorOff = 0x41,
FlashOnTime = 0x42,
SlowBlinkOnTime = 0x43,
SlowBlinkOffTime = 0x44,
FastBlinkOnTime = 0x45,
FastBlinkOffTime = 0x46,
UsageIndicatorColor = 0x47,
IndicatorRed = 0x48,
IndicatorGreen = 0x49,
IndicatorAmber = 0x4A,
GenericIndicator = 0x4B,
SystemSuspend = 0x4C,
ExternalPowerConnected = 0x4D,
IndicatorBlue = 0x4E,
IndicatorOrange = 0x4F,
GoodStatus = 0x50,
WarningStatus = 0x51,
RGBLED = 0x52,
RedLEDChannel = 0x53,
BlueLEDChannel = 0x54,
GreenLEDChannel = 0x55,
LEDIntensity = 0x56,
SystemMicrophoneMute = 0x57,
PlayerIndicator = 0x60,
Player1 = 0x61,
Player2 = 0x62,
Player3 = 0x63,
Player4 = 0x64,
Player5 = 0x65,
Player6 = 0x66,
Player7 = 0x67,
Player8 = 0x68,
}
impl LED {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
LED::NumLock => "Num Lock",
LED::CapsLock => "Caps Lock",
LED::ScrollLock => "Scroll Lock",
LED::Compose => "Compose",
LED::Kana => "Kana",
LED::Power => "Power",
LED::Shift => "Shift",
LED::DoNotDisturb => "Do Not Disturb",
LED::Mute => "Mute",
LED::ToneEnable => "Tone Enable",
LED::HighCutFilter => "High Cut Filter",
LED::LowCutFilter => "Low Cut Filter",
LED::EqualizerEnable => "Equalizer Enable",
LED::SoundFieldOn => "Sound Field On",
LED::SurroundOn => "Surround On",
LED::Repeat => "Repeat",
LED::Stereo => "Stereo",
LED::SamplingRateDetect => "Sampling Rate Detect",
LED::Spinning => "Spinning",
LED::CAV => "CAV",
LED::CLV => "CLV",
LED::RecordingFormatDetect => "Recording Format Detect",
LED::OffHook => "Off-Hook",
LED::Ring => "Ring",
LED::MessageWaiting => "Message Waiting",
LED::DataMode => "Data Mode",
LED::BatteryOperation => "Battery Operation",
LED::BatteryOK => "Battery OK",
LED::BatteryLow => "Battery Low",
LED::Speaker => "Speaker",
LED::Headset => "Headset",
LED::Hold => "Hold",
LED::Microphone => "Microphone",
LED::Coverage => "Coverage",
LED::NightMode => "Night Mode",
LED::SendCalls => "Send Calls",
LED::CallPickup => "Call Pickup",
LED::Conference => "Conference",
LED::Standby => "Stand-by",
LED::CameraOn => "Camera On",
LED::CameraOff => "Camera Off",
LED::OnLine => "On-Line",
LED::OffLine => "Off-Line",
LED::Busy => "Busy",
LED::Ready => "Ready",
LED::PaperOut => "Paper-Out",
LED::PaperJam => "Paper-Jam",
LED::Remote => "Remote",
LED::Forward => "Forward",
LED::Reverse => "Reverse",
LED::Stop => "Stop",
LED::Rewind => "Rewind",
LED::FastForward => "Fast Forward",
LED::Play => "Play",
LED::Pause => "Pause",
LED::Record => "Record",
LED::Error => "Error",
LED::UsageSelectedIndicator => "Usage Selected Indicator",
LED::UsageInUseIndicator => "Usage In Use Indicator",
LED::UsageMultiModeIndicator => "Usage Multi Mode Indicator",
LED::IndicatorOn => "Indicator On",
LED::IndicatorFlash => "Indicator Flash",
LED::IndicatorSlowBlink => "Indicator Slow Blink",
LED::IndicatorFastBlink => "Indicator Fast Blink",
LED::IndicatorOff => "Indicator Off",
LED::FlashOnTime => "Flash On Time",
LED::SlowBlinkOnTime => "Slow Blink On Time",
LED::SlowBlinkOffTime => "Slow Blink Off Time",
LED::FastBlinkOnTime => "Fast Blink On Time",
LED::FastBlinkOffTime => "Fast Blink Off Time",
LED::UsageIndicatorColor => "Usage Indicator Color",
LED::IndicatorRed => "Indicator Red",
LED::IndicatorGreen => "Indicator Green",
LED::IndicatorAmber => "Indicator Amber",
LED::GenericIndicator => "Generic Indicator",
LED::SystemSuspend => "System Suspend",
LED::ExternalPowerConnected => "External Power Connected",
LED::IndicatorBlue => "Indicator Blue",
LED::IndicatorOrange => "Indicator Orange",
LED::GoodStatus => "Good Status",
LED::WarningStatus => "Warning Status",
LED::RGBLED => "RGB LED",
LED::RedLEDChannel => "Red LED Channel",
LED::BlueLEDChannel => "Blue LED Channel",
LED::GreenLEDChannel => "Green LED Channel",
LED::LEDIntensity => "LED Intensity",
LED::SystemMicrophoneMute => "System Microphone Mute",
LED::PlayerIndicator => "Player Indicator",
LED::Player1 => "Player 1",
LED::Player2 => "Player 2",
LED::Player3 => "Player 3",
LED::Player4 => "Player 4",
LED::Player5 => "Player 5",
LED::Player6 => "Player 6",
LED::Player7 => "Player 7",
LED::Player8 => "Player 8",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for LED {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for LED {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for LED {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&LED> for u16 {
fn from(led: &LED) -> u16 {
*led as u16
}
}
impl From<LED> for u16 {
fn from(led: LED) -> u16 {
u16::from(&led)
}
}
impl From<&LED> for u32 {
fn from(led: &LED) -> u32 {
let up = UsagePage::from(led);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(led) as u32;
up | id
}
}
impl From<&LED> for UsagePage {
fn from(_: &LED) -> UsagePage {
UsagePage::LED
}
}
impl From<LED> for UsagePage {
fn from(_: LED) -> UsagePage {
UsagePage::LED
}
}
impl From<&LED> for Usage {
fn from(led: &LED) -> Usage {
Usage::try_from(u32::from(led)).unwrap()
}
}
impl From<LED> for Usage {
fn from(led: LED) -> Usage {
Usage::from(&led)
}
}
impl TryFrom<u16> for LED {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<LED> {
match usage_id {
1 => Ok(LED::NumLock),
2 => Ok(LED::CapsLock),
3 => Ok(LED::ScrollLock),
4 => Ok(LED::Compose),
5 => Ok(LED::Kana),
6 => Ok(LED::Power),
7 => Ok(LED::Shift),
8 => Ok(LED::DoNotDisturb),
9 => Ok(LED::Mute),
10 => Ok(LED::ToneEnable),
11 => Ok(LED::HighCutFilter),
12 => Ok(LED::LowCutFilter),
13 => Ok(LED::EqualizerEnable),
14 => Ok(LED::SoundFieldOn),
15 => Ok(LED::SurroundOn),
16 => Ok(LED::Repeat),
17 => Ok(LED::Stereo),
18 => Ok(LED::SamplingRateDetect),
19 => Ok(LED::Spinning),
20 => Ok(LED::CAV),
21 => Ok(LED::CLV),
22 => Ok(LED::RecordingFormatDetect),
23 => Ok(LED::OffHook),
24 => Ok(LED::Ring),
25 => Ok(LED::MessageWaiting),
26 => Ok(LED::DataMode),
27 => Ok(LED::BatteryOperation),
28 => Ok(LED::BatteryOK),
29 => Ok(LED::BatteryLow),
30 => Ok(LED::Speaker),
31 => Ok(LED::Headset),
32 => Ok(LED::Hold),
33 => Ok(LED::Microphone),
34 => Ok(LED::Coverage),
35 => Ok(LED::NightMode),
36 => Ok(LED::SendCalls),
37 => Ok(LED::CallPickup),
38 => Ok(LED::Conference),
39 => Ok(LED::Standby),
40 => Ok(LED::CameraOn),
41 => Ok(LED::CameraOff),
42 => Ok(LED::OnLine),
43 => Ok(LED::OffLine),
44 => Ok(LED::Busy),
45 => Ok(LED::Ready),
46 => Ok(LED::PaperOut),
47 => Ok(LED::PaperJam),
48 => Ok(LED::Remote),
49 => Ok(LED::Forward),
50 => Ok(LED::Reverse),
51 => Ok(LED::Stop),
52 => Ok(LED::Rewind),
53 => Ok(LED::FastForward),
54 => Ok(LED::Play),
55 => Ok(LED::Pause),
56 => Ok(LED::Record),
57 => Ok(LED::Error),
58 => Ok(LED::UsageSelectedIndicator),
59 => Ok(LED::UsageInUseIndicator),
60 => Ok(LED::UsageMultiModeIndicator),
61 => Ok(LED::IndicatorOn),
62 => Ok(LED::IndicatorFlash),
63 => Ok(LED::IndicatorSlowBlink),
64 => Ok(LED::IndicatorFastBlink),
65 => Ok(LED::IndicatorOff),
66 => Ok(LED::FlashOnTime),
67 => Ok(LED::SlowBlinkOnTime),
68 => Ok(LED::SlowBlinkOffTime),
69 => Ok(LED::FastBlinkOnTime),
70 => Ok(LED::FastBlinkOffTime),
71 => Ok(LED::UsageIndicatorColor),
72 => Ok(LED::IndicatorRed),
73 => Ok(LED::IndicatorGreen),
74 => Ok(LED::IndicatorAmber),
75 => Ok(LED::GenericIndicator),
76 => Ok(LED::SystemSuspend),
77 => Ok(LED::ExternalPowerConnected),
78 => Ok(LED::IndicatorBlue),
79 => Ok(LED::IndicatorOrange),
80 => Ok(LED::GoodStatus),
81 => Ok(LED::WarningStatus),
82 => Ok(LED::RGBLED),
83 => Ok(LED::RedLEDChannel),
84 => Ok(LED::BlueLEDChannel),
85 => Ok(LED::GreenLEDChannel),
86 => Ok(LED::LEDIntensity),
87 => Ok(LED::SystemMicrophoneMute),
96 => Ok(LED::PlayerIndicator),
97 => Ok(LED::Player1),
98 => Ok(LED::Player2),
99 => Ok(LED::Player3),
100 => Ok(LED::Player4),
101 => Ok(LED::Player5),
102 => Ok(LED::Player6),
103 => Ok(LED::Player7),
104 => Ok(LED::Player8),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for LED {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug)]
#[non_exhaustive]
pub enum Button {
Button(u16),
}
impl Button {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
Button::Button(button) => format!("Button {button}"),
}
}
}
#[cfg(feature = "std")]
impl fmt::Display for Button {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for Button {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for Button {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&Button> for u16 {
fn from(button: &Button) -> u16 {
match *button {
Button::Button(button) => button,
}
}
}
impl From<Button> for u16 {
fn from(button: Button) -> u16 {
u16::from(&button)
}
}
impl From<&Button> for u32 {
fn from(button: &Button) -> u32 {
let up = UsagePage::from(button);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(button) as u32;
up | id
}
}
impl From<&Button> for UsagePage {
fn from(_: &Button) -> UsagePage {
UsagePage::Button
}
}
impl From<Button> for UsagePage {
fn from(_: Button) -> UsagePage {
UsagePage::Button
}
}
impl From<&Button> for Usage {
fn from(button: &Button) -> Usage {
Usage::try_from(u32::from(button)).unwrap()
}
}
impl From<Button> for Usage {
fn from(button: Button) -> Usage {
Usage::from(&button)
}
}
impl TryFrom<u16> for Button {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<Button> {
match usage_id {
n => Ok(Button::Button(n)),
}
}
}
impl BitOr<u16> for Button {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug)]
#[non_exhaustive]
pub enum Ordinal {
Ordinal(u16),
}
impl Ordinal {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
Ordinal::Ordinal(instance) => format!("Instance {instance}"),
}
}
}
#[cfg(feature = "std")]
impl fmt::Display for Ordinal {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for Ordinal {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for Ordinal {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&Ordinal> for u16 {
fn from(ordinal: &Ordinal) -> u16 {
match *ordinal {
Ordinal::Ordinal(instance) => instance,
}
}
}
impl From<Ordinal> for u16 {
fn from(ordinal: Ordinal) -> u16 {
u16::from(&ordinal)
}
}
impl From<&Ordinal> for u32 {
fn from(ordinal: &Ordinal) -> u32 {
let up = UsagePage::from(ordinal);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(ordinal) as u32;
up | id
}
}
impl From<&Ordinal> for UsagePage {
fn from(_: &Ordinal) -> UsagePage {
UsagePage::Ordinal
}
}
impl From<Ordinal> for UsagePage {
fn from(_: Ordinal) -> UsagePage {
UsagePage::Ordinal
}
}
impl From<&Ordinal> for Usage {
fn from(ordinal: &Ordinal) -> Usage {
Usage::try_from(u32::from(ordinal)).unwrap()
}
}
impl From<Ordinal> for Usage {
fn from(ordinal: Ordinal) -> Usage {
Usage::from(&ordinal)
}
}
impl TryFrom<u16> for Ordinal {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<Ordinal> {
match usage_id {
n => Ok(Ordinal::Ordinal(n)),
}
}
}
impl BitOr<u16> for Ordinal {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum TelephonyDevice {
Phone = 0x1,
AnsweringMachine = 0x2,
MessageControls = 0x3,
Handset = 0x4,
Headset = 0x5,
TelephonyKeyPad = 0x6,
ProgrammableButton = 0x7,
HookSwitch = 0x20,
Flash = 0x21,
Feature = 0x22,
Hold = 0x23,
Redial = 0x24,
Transfer = 0x25,
Drop = 0x26,
Park = 0x27,
ForwardCalls = 0x28,
AlternateFunction = 0x29,
Line = 0x2A,
SpeakerPhone = 0x2B,
Conference = 0x2C,
RingEnable = 0x2D,
RingSelect = 0x2E,
PhoneMute = 0x2F,
CallerID = 0x30,
Send = 0x31,
SpeedDial = 0x50,
StoreNumber = 0x51,
RecallNumber = 0x52,
PhoneDirectory = 0x53,
VoiceMail = 0x70,
ScreenCalls = 0x71,
DoNotDisturb = 0x72,
Message = 0x73,
AnswerOnOff = 0x74,
InsideDialTone = 0x90,
OutsideDialTone = 0x91,
InsideRingTone = 0x92,
OutsideRingTone = 0x93,
PriorityRingTone = 0x94,
InsideRingback = 0x95,
PriorityRingback = 0x96,
LineBusyTone = 0x97,
ReorderTone = 0x98,
CallWaitingTone = 0x99,
ConfirmationTone1 = 0x9A,
ConfirmationTone2 = 0x9B,
TonesOff = 0x9C,
OutsideRingback = 0x9D,
Ringer = 0x9E,
PhoneKey0 = 0xB0,
PhoneKey1 = 0xB1,
PhoneKey2 = 0xB2,
PhoneKey3 = 0xB3,
PhoneKey4 = 0xB4,
PhoneKey5 = 0xB5,
PhoneKey6 = 0xB6,
PhoneKey7 = 0xB7,
PhoneKey8 = 0xB8,
PhoneKey9 = 0xB9,
PhoneKeyStar = 0xBA,
PhoneKeyPound = 0xBB,
PhoneKeyA = 0xBC,
PhoneKeyB = 0xBD,
PhoneKeyC = 0xBE,
PhoneKeyD = 0xBF,
PhoneCallHistoryKey = 0xC0,
PhoneCallerIDKey = 0xC1,
PhoneSettingsKey = 0xC2,
HostControl = 0xF0,
HostAvailable = 0xF1,
HostCallActive = 0xF2,
ActivateHandsetAudio = 0xF3,
RingType = 0xF4,
RedialablePhoneNumber = 0xF5,
StopRingTone = 0xF8,
PSTNRingTone = 0xF9,
HostRingTone = 0xFA,
AlertSoundError = 0xFB,
AlertSoundConfirm = 0xFC,
AlertSoundNotification = 0xFD,
SilentRing = 0xFE,
EmailMessageWaiting = 0x108,
VoicemailMessageWaiting = 0x109,
HostHold = 0x10A,
IncomingCallHistoryCount = 0x110,
OutgoingCallHistoryCount = 0x111,
IncomingCallHistory = 0x112,
OutgoingCallHistory = 0x113,
PhoneLocale = 0x114,
PhoneTimeSecond = 0x140,
PhoneTimeMinute = 0x141,
PhoneTimeHour = 0x142,
PhoneDateDay = 0x143,
PhoneDateMonth = 0x144,
PhoneDateYear = 0x145,
HandsetNickname = 0x146,
AddressBookID = 0x147,
CallDuration = 0x14A,
DualModePhone = 0x14B,
}
impl TelephonyDevice {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
TelephonyDevice::Phone => "Phone",
TelephonyDevice::AnsweringMachine => "Answering Machine",
TelephonyDevice::MessageControls => "Message Controls",
TelephonyDevice::Handset => "Handset",
TelephonyDevice::Headset => "Headset",
TelephonyDevice::TelephonyKeyPad => "Telephony Key Pad",
TelephonyDevice::ProgrammableButton => "Programmable Button",
TelephonyDevice::HookSwitch => "Hook Switch",
TelephonyDevice::Flash => "Flash",
TelephonyDevice::Feature => "Feature",
TelephonyDevice::Hold => "Hold",
TelephonyDevice::Redial => "Redial",
TelephonyDevice::Transfer => "Transfer",
TelephonyDevice::Drop => "Drop",
TelephonyDevice::Park => "Park",
TelephonyDevice::ForwardCalls => "Forward Calls",
TelephonyDevice::AlternateFunction => "Alternate Function",
TelephonyDevice::Line => "Line",
TelephonyDevice::SpeakerPhone => "Speaker Phone",
TelephonyDevice::Conference => "Conference",
TelephonyDevice::RingEnable => "Ring Enable",
TelephonyDevice::RingSelect => "Ring Select",
TelephonyDevice::PhoneMute => "Phone Mute",
TelephonyDevice::CallerID => "Caller ID",
TelephonyDevice::Send => "Send",
TelephonyDevice::SpeedDial => "Speed Dial",
TelephonyDevice::StoreNumber => "Store Number",
TelephonyDevice::RecallNumber => "Recall Number",
TelephonyDevice::PhoneDirectory => "Phone Directory",
TelephonyDevice::VoiceMail => "Voice Mail",
TelephonyDevice::ScreenCalls => "Screen Calls",
TelephonyDevice::DoNotDisturb => "Do Not Disturb",
TelephonyDevice::Message => "Message",
TelephonyDevice::AnswerOnOff => "Answer On/Off",
TelephonyDevice::InsideDialTone => "Inside Dial Tone",
TelephonyDevice::OutsideDialTone => "Outside Dial Tone",
TelephonyDevice::InsideRingTone => "Inside Ring Tone",
TelephonyDevice::OutsideRingTone => "Outside Ring Tone",
TelephonyDevice::PriorityRingTone => "Priority Ring Tone",
TelephonyDevice::InsideRingback => "Inside Ringback",
TelephonyDevice::PriorityRingback => "Priority Ringback",
TelephonyDevice::LineBusyTone => "Line Busy Tone",
TelephonyDevice::ReorderTone => "Reorder Tone",
TelephonyDevice::CallWaitingTone => "Call Waiting Tone",
TelephonyDevice::ConfirmationTone1 => "Confirmation Tone 1",
TelephonyDevice::ConfirmationTone2 => "Confirmation Tone 2",
TelephonyDevice::TonesOff => "Tones Off",
TelephonyDevice::OutsideRingback => "Outside Ringback",
TelephonyDevice::Ringer => "Ringer",
TelephonyDevice::PhoneKey0 => "Phone Key 0",
TelephonyDevice::PhoneKey1 => "Phone Key 1",
TelephonyDevice::PhoneKey2 => "Phone Key 2",
TelephonyDevice::PhoneKey3 => "Phone Key 3",
TelephonyDevice::PhoneKey4 => "Phone Key 4",
TelephonyDevice::PhoneKey5 => "Phone Key 5",
TelephonyDevice::PhoneKey6 => "Phone Key 6",
TelephonyDevice::PhoneKey7 => "Phone Key 7",
TelephonyDevice::PhoneKey8 => "Phone Key 8",
TelephonyDevice::PhoneKey9 => "Phone Key 9",
TelephonyDevice::PhoneKeyStar => "Phone Key Star",
TelephonyDevice::PhoneKeyPound => "Phone Key Pound",
TelephonyDevice::PhoneKeyA => "Phone Key A",
TelephonyDevice::PhoneKeyB => "Phone Key B",
TelephonyDevice::PhoneKeyC => "Phone Key C",
TelephonyDevice::PhoneKeyD => "Phone Key D",
TelephonyDevice::PhoneCallHistoryKey => "Phone Call History Key",
TelephonyDevice::PhoneCallerIDKey => "Phone Caller ID Key",
TelephonyDevice::PhoneSettingsKey => "Phone Settings Key",
TelephonyDevice::HostControl => "Host Control",
TelephonyDevice::HostAvailable => "Host Available",
TelephonyDevice::HostCallActive => "Host Call Active",
TelephonyDevice::ActivateHandsetAudio => "Activate Handset Audio",
TelephonyDevice::RingType => "Ring Type",
TelephonyDevice::RedialablePhoneNumber => "Re-dialable Phone Number",
TelephonyDevice::StopRingTone => "Stop Ring Tone",
TelephonyDevice::PSTNRingTone => "PSTN Ring Tone",
TelephonyDevice::HostRingTone => "Host Ring Tone",
TelephonyDevice::AlertSoundError => "Alert Sound Error",
TelephonyDevice::AlertSoundConfirm => "Alert Sound Confirm",
TelephonyDevice::AlertSoundNotification => "Alert Sound Notification",
TelephonyDevice::SilentRing => "Silent Ring",
TelephonyDevice::EmailMessageWaiting => "Email Message Waiting",
TelephonyDevice::VoicemailMessageWaiting => "Voicemail Message Waiting",
TelephonyDevice::HostHold => "Host Hold",
TelephonyDevice::IncomingCallHistoryCount => "Incoming Call History Count",
TelephonyDevice::OutgoingCallHistoryCount => "Outgoing Call History Count",
TelephonyDevice::IncomingCallHistory => "Incoming Call History",
TelephonyDevice::OutgoingCallHistory => "Outgoing Call History",
TelephonyDevice::PhoneLocale => "Phone Locale",
TelephonyDevice::PhoneTimeSecond => "Phone Time Second",
TelephonyDevice::PhoneTimeMinute => "Phone Time Minute",
TelephonyDevice::PhoneTimeHour => "Phone Time Hour",
TelephonyDevice::PhoneDateDay => "Phone Date Day",
TelephonyDevice::PhoneDateMonth => "Phone Date Month",
TelephonyDevice::PhoneDateYear => "Phone Date Year",
TelephonyDevice::HandsetNickname => "Handset Nickname",
TelephonyDevice::AddressBookID => "Address Book ID",
TelephonyDevice::CallDuration => "Call Duration",
TelephonyDevice::DualModePhone => "Dual Mode Phone",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for TelephonyDevice {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for TelephonyDevice {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for TelephonyDevice {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&TelephonyDevice> for u16 {
fn from(telephonydevice: &TelephonyDevice) -> u16 {
*telephonydevice as u16
}
}
impl From<TelephonyDevice> for u16 {
fn from(telephonydevice: TelephonyDevice) -> u16 {
u16::from(&telephonydevice)
}
}
impl From<&TelephonyDevice> for u32 {
fn from(telephonydevice: &TelephonyDevice) -> u32 {
let up = UsagePage::from(telephonydevice);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(telephonydevice) as u32;
up | id
}
}
impl From<&TelephonyDevice> for UsagePage {
fn from(_: &TelephonyDevice) -> UsagePage {
UsagePage::TelephonyDevice
}
}
impl From<TelephonyDevice> for UsagePage {
fn from(_: TelephonyDevice) -> UsagePage {
UsagePage::TelephonyDevice
}
}
impl From<&TelephonyDevice> for Usage {
fn from(telephonydevice: &TelephonyDevice) -> Usage {
Usage::try_from(u32::from(telephonydevice)).unwrap()
}
}
impl From<TelephonyDevice> for Usage {
fn from(telephonydevice: TelephonyDevice) -> Usage {
Usage::from(&telephonydevice)
}
}
impl TryFrom<u16> for TelephonyDevice {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<TelephonyDevice> {
match usage_id {
1 => Ok(TelephonyDevice::Phone),
2 => Ok(TelephonyDevice::AnsweringMachine),
3 => Ok(TelephonyDevice::MessageControls),
4 => Ok(TelephonyDevice::Handset),
5 => Ok(TelephonyDevice::Headset),
6 => Ok(TelephonyDevice::TelephonyKeyPad),
7 => Ok(TelephonyDevice::ProgrammableButton),
32 => Ok(TelephonyDevice::HookSwitch),
33 => Ok(TelephonyDevice::Flash),
34 => Ok(TelephonyDevice::Feature),
35 => Ok(TelephonyDevice::Hold),
36 => Ok(TelephonyDevice::Redial),
37 => Ok(TelephonyDevice::Transfer),
38 => Ok(TelephonyDevice::Drop),
39 => Ok(TelephonyDevice::Park),
40 => Ok(TelephonyDevice::ForwardCalls),
41 => Ok(TelephonyDevice::AlternateFunction),
42 => Ok(TelephonyDevice::Line),
43 => Ok(TelephonyDevice::SpeakerPhone),
44 => Ok(TelephonyDevice::Conference),
45 => Ok(TelephonyDevice::RingEnable),
46 => Ok(TelephonyDevice::RingSelect),
47 => Ok(TelephonyDevice::PhoneMute),
48 => Ok(TelephonyDevice::CallerID),
49 => Ok(TelephonyDevice::Send),
80 => Ok(TelephonyDevice::SpeedDial),
81 => Ok(TelephonyDevice::StoreNumber),
82 => Ok(TelephonyDevice::RecallNumber),
83 => Ok(TelephonyDevice::PhoneDirectory),
112 => Ok(TelephonyDevice::VoiceMail),
113 => Ok(TelephonyDevice::ScreenCalls),
114 => Ok(TelephonyDevice::DoNotDisturb),
115 => Ok(TelephonyDevice::Message),
116 => Ok(TelephonyDevice::AnswerOnOff),
144 => Ok(TelephonyDevice::InsideDialTone),
145 => Ok(TelephonyDevice::OutsideDialTone),
146 => Ok(TelephonyDevice::InsideRingTone),
147 => Ok(TelephonyDevice::OutsideRingTone),
148 => Ok(TelephonyDevice::PriorityRingTone),
149 => Ok(TelephonyDevice::InsideRingback),
150 => Ok(TelephonyDevice::PriorityRingback),
151 => Ok(TelephonyDevice::LineBusyTone),
152 => Ok(TelephonyDevice::ReorderTone),
153 => Ok(TelephonyDevice::CallWaitingTone),
154 => Ok(TelephonyDevice::ConfirmationTone1),
155 => Ok(TelephonyDevice::ConfirmationTone2),
156 => Ok(TelephonyDevice::TonesOff),
157 => Ok(TelephonyDevice::OutsideRingback),
158 => Ok(TelephonyDevice::Ringer),
176 => Ok(TelephonyDevice::PhoneKey0),
177 => Ok(TelephonyDevice::PhoneKey1),
178 => Ok(TelephonyDevice::PhoneKey2),
179 => Ok(TelephonyDevice::PhoneKey3),
180 => Ok(TelephonyDevice::PhoneKey4),
181 => Ok(TelephonyDevice::PhoneKey5),
182 => Ok(TelephonyDevice::PhoneKey6),
183 => Ok(TelephonyDevice::PhoneKey7),
184 => Ok(TelephonyDevice::PhoneKey8),
185 => Ok(TelephonyDevice::PhoneKey9),
186 => Ok(TelephonyDevice::PhoneKeyStar),
187 => Ok(TelephonyDevice::PhoneKeyPound),
188 => Ok(TelephonyDevice::PhoneKeyA),
189 => Ok(TelephonyDevice::PhoneKeyB),
190 => Ok(TelephonyDevice::PhoneKeyC),
191 => Ok(TelephonyDevice::PhoneKeyD),
192 => Ok(TelephonyDevice::PhoneCallHistoryKey),
193 => Ok(TelephonyDevice::PhoneCallerIDKey),
194 => Ok(TelephonyDevice::PhoneSettingsKey),
240 => Ok(TelephonyDevice::HostControl),
241 => Ok(TelephonyDevice::HostAvailable),
242 => Ok(TelephonyDevice::HostCallActive),
243 => Ok(TelephonyDevice::ActivateHandsetAudio),
244 => Ok(TelephonyDevice::RingType),
245 => Ok(TelephonyDevice::RedialablePhoneNumber),
248 => Ok(TelephonyDevice::StopRingTone),
249 => Ok(TelephonyDevice::PSTNRingTone),
250 => Ok(TelephonyDevice::HostRingTone),
251 => Ok(TelephonyDevice::AlertSoundError),
252 => Ok(TelephonyDevice::AlertSoundConfirm),
253 => Ok(TelephonyDevice::AlertSoundNotification),
254 => Ok(TelephonyDevice::SilentRing),
264 => Ok(TelephonyDevice::EmailMessageWaiting),
265 => Ok(TelephonyDevice::VoicemailMessageWaiting),
266 => Ok(TelephonyDevice::HostHold),
272 => Ok(TelephonyDevice::IncomingCallHistoryCount),
273 => Ok(TelephonyDevice::OutgoingCallHistoryCount),
274 => Ok(TelephonyDevice::IncomingCallHistory),
275 => Ok(TelephonyDevice::OutgoingCallHistory),
276 => Ok(TelephonyDevice::PhoneLocale),
320 => Ok(TelephonyDevice::PhoneTimeSecond),
321 => Ok(TelephonyDevice::PhoneTimeMinute),
322 => Ok(TelephonyDevice::PhoneTimeHour),
323 => Ok(TelephonyDevice::PhoneDateDay),
324 => Ok(TelephonyDevice::PhoneDateMonth),
325 => Ok(TelephonyDevice::PhoneDateYear),
326 => Ok(TelephonyDevice::HandsetNickname),
327 => Ok(TelephonyDevice::AddressBookID),
330 => Ok(TelephonyDevice::CallDuration),
331 => Ok(TelephonyDevice::DualModePhone),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for TelephonyDevice {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum Consumer {
ConsumerControl = 0x1,
NumericKeyPad = 0x2,
ProgrammableButtons = 0x3,
Microphone = 0x4,
Headphone = 0x5,
GraphicEqualizer = 0x6,
Plus10 = 0x20,
Plus100 = 0x21,
AMPM = 0x22,
Power = 0x30,
Reset = 0x31,
Sleep = 0x32,
SleepAfter = 0x33,
SleepMode = 0x34,
Illumination = 0x35,
FunctionButtons = 0x36,
Menu = 0x40,
MenuPick = 0x41,
MenuUp = 0x42,
MenuDown = 0x43,
MenuLeft = 0x44,
MenuRight = 0x45,
MenuEscape = 0x46,
MenuValueIncrease = 0x47,
MenuValueDecrease = 0x48,
DataOnScreen = 0x60,
ClosedCaption = 0x61,
ClosedCaptionSelect = 0x62,
VCRTV = 0x63,
BroadcastMode = 0x64,
Snapshot = 0x65,
Still = 0x66,
PictureinPictureToggle = 0x67,
PictureinPictureSwap = 0x68,
RedMenuButton = 0x69,
GreenMenuButton = 0x6A,
BlueMenuButton = 0x6B,
YellowMenuButton = 0x6C,
Aspect = 0x6D,
ThreeDModeSelect = 0x6E,
DisplayBrightnessIncrement = 0x6F,
DisplayBrightnessDecrement = 0x70,
DisplayBrightness = 0x71,
DisplayBacklightToggle = 0x72,
DisplaySetBrightnesstoMinimum = 0x73,
DisplaySetBrightnesstoMaximum = 0x74,
DisplaySetAutoBrightness = 0x75,
CameraAccessEnabled = 0x76,
CameraAccessDisabled = 0x77,
CameraAccessToggle = 0x78,
KeyboardBrightnessIncrement = 0x79,
KeyboardBrightnessDecrement = 0x7A,
KeyboardBacklightSetLevel = 0x7B,
KeyboardBacklightOOC = 0x7C,
KeyboardBacklightSetMinimum = 0x7D,
KeyboardBacklightSetMaximum = 0x7E,
KeyboardBacklightAuto = 0x7F,
Selection = 0x80,
AssignSelection = 0x81,
ModeStep = 0x82,
RecallLast = 0x83,
EnterChannel = 0x84,
OrderMovie = 0x85,
Channel = 0x86,
MediaSelection = 0x87,
MediaSelectComputer = 0x88,
MediaSelectTV = 0x89,
MediaSelectWWW = 0x8A,
MediaSelectDVD = 0x8B,
MediaSelectTelephone = 0x8C,
MediaSelectProgramGuide = 0x8D,
MediaSelectVideoPhone = 0x8E,
MediaSelectGames = 0x8F,
MediaSelectMessages = 0x90,
MediaSelectCD = 0x91,
MediaSelectVCR = 0x92,
MediaSelectTuner = 0x93,
Quit = 0x94,
Help = 0x95,
MediaSelectTape = 0x96,
MediaSelectCable = 0x97,
MediaSelectSatellite = 0x98,
MediaSelectSecurity = 0x99,
MediaSelectHome = 0x9A,
MediaSelectCall = 0x9B,
ChannelIncrement = 0x9C,
ChannelDecrement = 0x9D,
MediaSelectSAP = 0x9E,
VCRPlus = 0xA0,
Once = 0xA1,
Daily = 0xA2,
Weekly = 0xA3,
Monthly = 0xA4,
Play = 0xB0,
Pause = 0xB1,
Record = 0xB2,
FastForward = 0xB3,
Rewind = 0xB4,
ScanNextTrack = 0xB5,
ScanPreviousTrack = 0xB6,
Stop = 0xB7,
Eject = 0xB8,
RandomPlay = 0xB9,
SelectDisc = 0xBA,
EnterDisc = 0xBB,
Repeat = 0xBC,
Tracking = 0xBD,
TrackNormal = 0xBE,
SlowTracking = 0xBF,
FrameForward = 0xC0,
FrameBack = 0xC1,
Mark = 0xC2,
ClearMark = 0xC3,
RepeatFromMark = 0xC4,
ReturnToMark = 0xC5,
SearchMarkForward = 0xC6,
SearchMarkBackwards = 0xC7,
CounterReset = 0xC8,
ShowCounter = 0xC9,
TrackingIncrement = 0xCA,
TrackingDecrement = 0xCB,
StopEject = 0xCC,
PlayPause = 0xCD,
PlaySkip = 0xCE,
VoiceCommand = 0xCF,
InvokeCaptureInterface = 0xD0,
StartorStopGameRecording = 0xD1,
HistoricalGameCapture = 0xD2,
CaptureGameScreenshot = 0xD3,
ShoworHideRecordingIndicator = 0xD4,
StartorStopMicrophoneCapture = 0xD5,
StartorStopCameraCapture = 0xD6,
StartorStopGameBroadcast = 0xD7,
StartorStopVoiceDictationSession = 0xD8,
InvokeDismissEmojiPicker = 0xD9,
Volume = 0xE0,
Balance = 0xE1,
Mute = 0xE2,
Bass = 0xE3,
Treble = 0xE4,
BassBoost = 0xE5,
SurroundMode = 0xE6,
Loudness = 0xE7,
MPX = 0xE8,
VolumeIncrement = 0xE9,
VolumeDecrement = 0xEA,
SpeedSelect = 0xF0,
PlaybackSpeed = 0xF1,
StandardPlay = 0xF2,
LongPlay = 0xF3,
ExtendedPlay = 0xF4,
Slow = 0xF5,
FanEnable = 0x100,
FanSpeed = 0x101,
LightEnable = 0x102,
LightIlluminationLevel = 0x103,
ClimateControlEnable = 0x104,
RoomTemperature = 0x105,
SecurityEnable = 0x106,
FireAlarm = 0x107,
PoliceAlarm = 0x108,
Proximity = 0x109,
Motion = 0x10A,
DuressAlarm = 0x10B,
HoldupAlarm = 0x10C,
MedicalAlarm = 0x10D,
BalanceRight = 0x150,
BalanceLeft = 0x151,
BassIncrement = 0x152,
BassDecrement = 0x153,
TrebleIncrement = 0x154,
TrebleDecrement = 0x155,
SpeakerSystem = 0x160,
ChannelLeft = 0x161,
ChannelRight = 0x162,
ChannelCenter = 0x163,
ChannelFront = 0x164,
ChannelCenterFront = 0x165,
ChannelSide = 0x166,
ChannelSurround = 0x167,
ChannelLowFrequencyEnhancement = 0x168,
ChannelTop = 0x169,
ChannelUnknown = 0x16A,
Subchannel = 0x170,
SubchannelIncrement = 0x171,
SubchannelDecrement = 0x172,
AlternateAudioIncrement = 0x173,
AlternateAudioDecrement = 0x174,
ApplicationLaunchButtons = 0x180,
ALLaunchButtonConfigurationTool = 0x181,
ALProgrammableButtonConfiguration = 0x182,
ALConsumerControlConfiguration = 0x183,
ALWordProcessor = 0x184,
ALTextEditor = 0x185,
ALSpreadsheet = 0x186,
ALGraphicsEditor = 0x187,
ALPresentationApp = 0x188,
ALDatabaseApp = 0x189,
ALEmailReader = 0x18A,
ALNewsreader = 0x18B,
ALVoicemail = 0x18C,
ALContactsAddressBook = 0x18D,
ALCalendarSchedule = 0x18E,
ALTaskProjectManager = 0x18F,
ALLogJournalTimecard = 0x190,
ALCheckbookFinance = 0x191,
ALCalculator = 0x192,
ALAVCapturePlayback = 0x193,
ALLocalMachineBrowser = 0x194,
ALLANWANBrowser = 0x195,
ALInternetBrowser = 0x196,
ALRemoteNetworkingISPConnect = 0x197,
ALNetworkConference = 0x198,
ALNetworkChat = 0x199,
ALTelephonyDialer = 0x19A,
ALLogon = 0x19B,
ALLogoff = 0x19C,
ALLogonLogoff = 0x19D,
ALTerminalLockScreensaver = 0x19E,
ALControlPanel = 0x19F,
ALCommandLineProcessorRun = 0x1A0,
ALProcessTaskManager = 0x1A1,
ALSelectTaskApplication = 0x1A2,
ALNextTaskApplication = 0x1A3,
ALPreviousTaskApplication = 0x1A4,
ALPreemptiveHaltTaskApplication = 0x1A5,
ALIntegratedHelpCenter = 0x1A6,
ALDocuments = 0x1A7,
ALThesaurus = 0x1A8,
ALDictionary = 0x1A9,
ALDesktop = 0x1AA,
ALSpellCheck = 0x1AB,
ALGrammarCheck = 0x1AC,
ALWirelessStatus = 0x1AD,
ALKeyboardLayout = 0x1AE,
ALVirusProtection = 0x1AF,
ALEncryption = 0x1B0,
ALScreenSaver = 0x1B1,
ALAlarms = 0x1B2,
ALClock = 0x1B3,
ALFileBrowser = 0x1B4,
ALPowerStatus = 0x1B5,
ALImageBrowser = 0x1B6,
ALAudioBrowser = 0x1B7,
ALMovieBrowser = 0x1B8,
ALDigitalRightsManager = 0x1B9,
ALDigitalWallet = 0x1BA,
ALInstantMessaging = 0x1BC,
ALOEMFeaturesTipsTutorialBrowser = 0x1BD,
ALOEMHelp = 0x1BE,
ALOnlineCommunity = 0x1BF,
ALEntertainmentContentBrowser = 0x1C0,
ALOnlineShoppingBrowser = 0x1C1,
ALSmartCardInformationHelp = 0x1C2,
ALMarketMonitorFinanceBrowser = 0x1C3,
ALCustomizedCorporateNewsBrowser = 0x1C4,
ALOnlineActivityBrowser = 0x1C5,
ALResearchSearchBrowser = 0x1C6,
ALAudioPlayer = 0x1C7,
ALMessageStatus = 0x1C8,
ALContactSync = 0x1C9,
ALNavigation = 0x1CA,
ALContextawareDesktopAssistant = 0x1CB,
GenericGUIApplicationControls = 0x200,
ACNew = 0x201,
ACOpen = 0x202,
ACClose = 0x203,
ACExit = 0x204,
ACMaximize = 0x205,
ACMinimize = 0x206,
ACSave = 0x207,
ACPrint = 0x208,
ACProperties = 0x209,
ACUndo = 0x21A,
ACCopy = 0x21B,
ACCut = 0x21C,
ACPaste = 0x21D,
ACSelectAll = 0x21E,
ACFind = 0x21F,
ACFindandReplace = 0x220,
ACSearch = 0x221,
ACGoTo = 0x222,
ACHome = 0x223,
ACBack = 0x224,
ACForward = 0x225,
ACStop = 0x226,
ACRefresh = 0x227,
ACPreviousLink = 0x228,
ACNextLink = 0x229,
ACBookmarks = 0x22A,
ACHistory = 0x22B,
ACSubscriptions = 0x22C,
ACZoomIn = 0x22D,
ACZoomOut = 0x22E,
ACZoom = 0x22F,
ACFullScreenView = 0x230,
ACNormalView = 0x231,
ACViewToggle = 0x232,
ACScrollUp = 0x233,
ACScrollDown = 0x234,
ACScroll = 0x235,
ACPanLeft = 0x236,
ACPanRight = 0x237,
ACPan = 0x238,
ACNewWindow = 0x239,
ACTileHorizontally = 0x23A,
ACTileVertically = 0x23B,
ACFormat = 0x23C,
ACEdit = 0x23D,
ACBold = 0x23E,
ACItalics = 0x23F,
ACUnderline = 0x240,
ACStrikethrough = 0x241,
ACSubscript = 0x242,
ACSuperscript = 0x243,
ACAllCaps = 0x244,
ACRotate = 0x245,
ACResize = 0x246,
ACFlipHorizontal = 0x247,
ACFlipVertical = 0x248,
ACMirrorHorizontal = 0x249,
ACMirrorVertical = 0x24A,
ACFontSelect = 0x24B,
ACFontColor = 0x24C,
ACFontSize = 0x24D,
ACJustifyLeft = 0x24E,
ACJustifyCenterH = 0x24F,
ACJustifyRight = 0x250,
ACJustifyBlockH = 0x251,
ACJustifyTop = 0x252,
ACJustifyCenterV = 0x253,
ACJustifyBottom = 0x254,
ACJustifyBlockV = 0x255,
ACIndentDecrease = 0x256,
ACIndentIncrease = 0x257,
ACNumberedList = 0x258,
ACRestartNumbering = 0x259,
ACBulletedList = 0x25A,
ACPromote = 0x25B,
ACDemote = 0x25C,
ACYes = 0x25D,
ACNo = 0x25E,
ACCancel = 0x25F,
ACCatalog = 0x260,
ACBuyCheckout = 0x261,
ACAddtoCart = 0x262,
ACExpand = 0x263,
ACExpandAll = 0x264,
ACCollapse = 0x265,
ACCollapseAll = 0x266,
ACPrintPreview = 0x267,
ACPasteSpecial = 0x268,
ACInsertMode = 0x269,
ACDelete = 0x26A,
ACLock = 0x26B,
ACUnlock = 0x26C,
ACProtect = 0x26D,
ACUnprotect = 0x26E,
ACAttachComment = 0x26F,
ACDeleteComment = 0x270,
ACViewComment = 0x271,
ACSelectWord = 0x272,
ACSelectSentence = 0x273,
ACSelectParagraph = 0x274,
ACSelectColumn = 0x275,
ACSelectRow = 0x276,
ACSelectTable = 0x277,
ACSelectObject = 0x278,
ACRedoRepeat = 0x279,
ACSort = 0x27A,
ACSortAscending = 0x27B,
ACSortDescending = 0x27C,
ACFilter = 0x27D,
ACSetClock = 0x27E,
ACViewClock = 0x27F,
ACSelectTimeZone = 0x280,
ACEditTimeZones = 0x281,
ACSetAlarm = 0x282,
ACClearAlarm = 0x283,
ACSnoozeAlarm = 0x284,
ACResetAlarm = 0x285,
ACSynchronize = 0x286,
ACSendReceive = 0x287,
ACSendTo = 0x288,
ACReply = 0x289,
ACReplyAll = 0x28A,
ACForwardMsg = 0x28B,
ACSend = 0x28C,
ACAttachFile = 0x28D,
ACUpload = 0x28E,
ACDownloadSaveTargetAs = 0x28F,
ACSetBorders = 0x290,
ACInsertRow = 0x291,
ACInsertColumn = 0x292,
ACInsertFile = 0x293,
ACInsertPicture = 0x294,
ACInsertObject = 0x295,
ACInsertSymbol = 0x296,
ACSaveandClose = 0x297,
ACRename = 0x298,
ACMerge = 0x299,
ACSplit = 0x29A,
ACDisributeHorizontally = 0x29B,
ACDistributeVertically = 0x29C,
ACNextKeyboardLayoutSelect = 0x29D,
ACNavigationGuidance = 0x29E,
ACDesktopShowAllWindows = 0x29F,
ACSoftKeyLeft = 0x2A0,
ACSoftKeyRight = 0x2A1,
ACDesktopShowAllApplications = 0x2A2,
ACIdleKeepAlive = 0x2B0,
ExtendedKeyboardAttributesCollection = 0x2C0,
KeyboardFormFactor = 0x2C1,
KeyboardKeyType = 0x2C2,
KeyboardPhysicalLayout = 0x2C3,
VendorSpecificKeyboardPhysicalLayout = 0x2C4,
KeyboardIETFLanguageTagIndex = 0x2C5,
ImplementedKeyboardInputAssistControls = 0x2C6,
KeyboardInputAssistPrevious = 0x2C7,
KeyboardInputAssistNext = 0x2C8,
KeyboardInputAssistPreviousGroup = 0x2C9,
KeyboardInputAssistNextGroup = 0x2CA,
KeyboardInputAssistAccept = 0x2CB,
KeyboardInputAssistCancel = 0x2CC,
PrivacyScreenToggle = 0x2D0,
PrivacyScreenLevelDecrement = 0x2D1,
PrivacyScreenLevelIncrement = 0x2D2,
PrivacyScreenLevelMinimum = 0x2D3,
PrivacyScreenLevelMaximum = 0x2D4,
ContactEdited = 0x500,
ContactAdded = 0x501,
ContactRecordActive = 0x502,
ContactIndex = 0x503,
ContactNickname = 0x504,
ContactFirstName = 0x505,
ContactLastName = 0x506,
ContactFullName = 0x507,
ContactPhoneNumberPersonal = 0x508,
ContactPhoneNumberBusiness = 0x509,
ContactPhoneNumberMobile = 0x50A,
ContactPhoneNumberPager = 0x50B,
ContactPhoneNumberFax = 0x50C,
ContactPhoneNumberOther = 0x50D,
ContactEmailPersonal = 0x50E,
ContactEmailBusiness = 0x50F,
ContactEmailOther = 0x510,
ContactEmailMain = 0x511,
ContactSpeedDialNumber = 0x512,
ContactStatusFlag = 0x513,
ContactMisc = 0x514,
}
impl Consumer {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
Consumer::ConsumerControl => "Consumer Control",
Consumer::NumericKeyPad => "Numeric Key Pad",
Consumer::ProgrammableButtons => "Programmable Buttons",
Consumer::Microphone => "Microphone",
Consumer::Headphone => "Headphone",
Consumer::GraphicEqualizer => "Graphic Equalizer",
Consumer::Plus10 => "+10",
Consumer::Plus100 => "+100",
Consumer::AMPM => "AM/PM",
Consumer::Power => "Power",
Consumer::Reset => "Reset",
Consumer::Sleep => "Sleep",
Consumer::SleepAfter => "Sleep After",
Consumer::SleepMode => "Sleep Mode",
Consumer::Illumination => "Illumination",
Consumer::FunctionButtons => "Function Buttons",
Consumer::Menu => "Menu",
Consumer::MenuPick => "Menu Pick",
Consumer::MenuUp => "Menu Up",
Consumer::MenuDown => "Menu Down",
Consumer::MenuLeft => "Menu Left",
Consumer::MenuRight => "Menu Right",
Consumer::MenuEscape => "Menu Escape",
Consumer::MenuValueIncrease => "Menu Value Increase",
Consumer::MenuValueDecrease => "Menu Value Decrease",
Consumer::DataOnScreen => "Data On Screen",
Consumer::ClosedCaption => "Closed Caption",
Consumer::ClosedCaptionSelect => "Closed Caption Select",
Consumer::VCRTV => "VCR/TV",
Consumer::BroadcastMode => "Broadcast Mode",
Consumer::Snapshot => "Snapshot",
Consumer::Still => "Still",
Consumer::PictureinPictureToggle => "Picture-in-Picture Toggle",
Consumer::PictureinPictureSwap => "Picture-in-Picture Swap",
Consumer::RedMenuButton => "Red Menu Button",
Consumer::GreenMenuButton => "Green Menu Button",
Consumer::BlueMenuButton => "Blue Menu Button",
Consumer::YellowMenuButton => "Yellow Menu Button",
Consumer::Aspect => "Aspect",
Consumer::ThreeDModeSelect => "3D Mode Select",
Consumer::DisplayBrightnessIncrement => "Display Brightness Increment",
Consumer::DisplayBrightnessDecrement => "Display Brightness Decrement",
Consumer::DisplayBrightness => "Display Brightness",
Consumer::DisplayBacklightToggle => "Display Backlight Toggle",
Consumer::DisplaySetBrightnesstoMinimum => "Display Set Brightness to Minimum",
Consumer::DisplaySetBrightnesstoMaximum => "Display Set Brightness to Maximum",
Consumer::DisplaySetAutoBrightness => "Display Set Auto Brightness",
Consumer::CameraAccessEnabled => "Camera Access Enabled",
Consumer::CameraAccessDisabled => "Camera Access Disabled",
Consumer::CameraAccessToggle => "Camera Access Toggle",
Consumer::KeyboardBrightnessIncrement => "Keyboard Brightness Increment",
Consumer::KeyboardBrightnessDecrement => "Keyboard Brightness Decrement",
Consumer::KeyboardBacklightSetLevel => "Keyboard Backlight Set Level",
Consumer::KeyboardBacklightOOC => "Keyboard Backlight OOC",
Consumer::KeyboardBacklightSetMinimum => "Keyboard Backlight Set Minimum",
Consumer::KeyboardBacklightSetMaximum => "Keyboard Backlight Set Maximum",
Consumer::KeyboardBacklightAuto => "Keyboard Backlight Auto",
Consumer::Selection => "Selection",
Consumer::AssignSelection => "Assign Selection",
Consumer::ModeStep => "Mode Step",
Consumer::RecallLast => "Recall Last",
Consumer::EnterChannel => "Enter Channel",
Consumer::OrderMovie => "Order Movie",
Consumer::Channel => "Channel",
Consumer::MediaSelection => "Media Selection",
Consumer::MediaSelectComputer => "Media Select Computer",
Consumer::MediaSelectTV => "Media Select TV",
Consumer::MediaSelectWWW => "Media Select WWW",
Consumer::MediaSelectDVD => "Media Select DVD",
Consumer::MediaSelectTelephone => "Media Select Telephone",
Consumer::MediaSelectProgramGuide => "Media Select Program Guide",
Consumer::MediaSelectVideoPhone => "Media Select Video Phone",
Consumer::MediaSelectGames => "Media Select Games",
Consumer::MediaSelectMessages => "Media Select Messages",
Consumer::MediaSelectCD => "Media Select CD",
Consumer::MediaSelectVCR => "Media Select VCR",
Consumer::MediaSelectTuner => "Media Select Tuner",
Consumer::Quit => "Quit",
Consumer::Help => "Help",
Consumer::MediaSelectTape => "Media Select Tape",
Consumer::MediaSelectCable => "Media Select Cable",
Consumer::MediaSelectSatellite => "Media Select Satellite",
Consumer::MediaSelectSecurity => "Media Select Security",
Consumer::MediaSelectHome => "Media Select Home",
Consumer::MediaSelectCall => "Media Select Call",
Consumer::ChannelIncrement => "Channel Increment",
Consumer::ChannelDecrement => "Channel Decrement",
Consumer::MediaSelectSAP => "Media Select SAP",
Consumer::VCRPlus => "VCR Plus",
Consumer::Once => "Once",
Consumer::Daily => "Daily",
Consumer::Weekly => "Weekly",
Consumer::Monthly => "Monthly",
Consumer::Play => "Play",
Consumer::Pause => "Pause",
Consumer::Record => "Record",
Consumer::FastForward => "Fast Forward",
Consumer::Rewind => "Rewind",
Consumer::ScanNextTrack => "Scan Next Track",
Consumer::ScanPreviousTrack => "Scan Previous Track",
Consumer::Stop => "Stop",
Consumer::Eject => "Eject",
Consumer::RandomPlay => "Random Play",
Consumer::SelectDisc => "Select Disc",
Consumer::EnterDisc => "Enter Disc",
Consumer::Repeat => "Repeat",
Consumer::Tracking => "Tracking",
Consumer::TrackNormal => "Track Normal",
Consumer::SlowTracking => "Slow Tracking",
Consumer::FrameForward => "Frame Forward",
Consumer::FrameBack => "Frame Back",
Consumer::Mark => "Mark",
Consumer::ClearMark => "Clear Mark",
Consumer::RepeatFromMark => "Repeat From Mark",
Consumer::ReturnToMark => "Return To Mark",
Consumer::SearchMarkForward => "Search Mark Forward",
Consumer::SearchMarkBackwards => "Search Mark Backwards",
Consumer::CounterReset => "Counter Reset",
Consumer::ShowCounter => "Show Counter",
Consumer::TrackingIncrement => "Tracking Increment",
Consumer::TrackingDecrement => "Tracking Decrement",
Consumer::StopEject => "Stop/Eject",
Consumer::PlayPause => "Play/Pause",
Consumer::PlaySkip => "Play/Skip",
Consumer::VoiceCommand => "Voice Command",
Consumer::InvokeCaptureInterface => "Invoke Capture Interface",
Consumer::StartorStopGameRecording => "Start or Stop Game Recording",
Consumer::HistoricalGameCapture => "Historical Game Capture",
Consumer::CaptureGameScreenshot => "Capture Game Screenshot",
Consumer::ShoworHideRecordingIndicator => "Show or Hide Recording Indicator",
Consumer::StartorStopMicrophoneCapture => "Start or Stop Microphone Capture",
Consumer::StartorStopCameraCapture => "Start or Stop Camera Capture",
Consumer::StartorStopGameBroadcast => "Start or Stop Game Broadcast",
Consumer::StartorStopVoiceDictationSession => "Start or Stop Voice Dictation Session",
Consumer::InvokeDismissEmojiPicker => "Invoke/Dismiss Emoji Picker",
Consumer::Volume => "Volume",
Consumer::Balance => "Balance",
Consumer::Mute => "Mute",
Consumer::Bass => "Bass",
Consumer::Treble => "Treble",
Consumer::BassBoost => "Bass Boost",
Consumer::SurroundMode => "Surround Mode",
Consumer::Loudness => "Loudness",
Consumer::MPX => "MPX",
Consumer::VolumeIncrement => "Volume Increment",
Consumer::VolumeDecrement => "Volume Decrement",
Consumer::SpeedSelect => "Speed Select",
Consumer::PlaybackSpeed => "Playback Speed",
Consumer::StandardPlay => "Standard Play",
Consumer::LongPlay => "Long Play",
Consumer::ExtendedPlay => "Extended Play",
Consumer::Slow => "Slow",
Consumer::FanEnable => "Fan Enable",
Consumer::FanSpeed => "Fan Speed",
Consumer::LightEnable => "Light Enable",
Consumer::LightIlluminationLevel => "Light Illumination Level",
Consumer::ClimateControlEnable => "Climate Control Enable",
Consumer::RoomTemperature => "Room Temperature",
Consumer::SecurityEnable => "Security Enable",
Consumer::FireAlarm => "Fire Alarm",
Consumer::PoliceAlarm => "Police Alarm",
Consumer::Proximity => "Proximity",
Consumer::Motion => "Motion",
Consumer::DuressAlarm => "Duress Alarm",
Consumer::HoldupAlarm => "Holdup Alarm",
Consumer::MedicalAlarm => "Medical Alarm",
Consumer::BalanceRight => "Balance Right",
Consumer::BalanceLeft => "Balance Left",
Consumer::BassIncrement => "Bass Increment",
Consumer::BassDecrement => "Bass Decrement",
Consumer::TrebleIncrement => "Treble Increment",
Consumer::TrebleDecrement => "Treble Decrement",
Consumer::SpeakerSystem => "Speaker System",
Consumer::ChannelLeft => "Channel Left",
Consumer::ChannelRight => "Channel Right",
Consumer::ChannelCenter => "Channel Center",
Consumer::ChannelFront => "Channel Front",
Consumer::ChannelCenterFront => "Channel Center Front",
Consumer::ChannelSide => "Channel Side",
Consumer::ChannelSurround => "Channel Surround",
Consumer::ChannelLowFrequencyEnhancement => "Channel Low Frequency Enhancement",
Consumer::ChannelTop => "Channel Top",
Consumer::ChannelUnknown => "Channel Unknown",
Consumer::Subchannel => "Sub-channel",
Consumer::SubchannelIncrement => "Sub-channel Increment",
Consumer::SubchannelDecrement => "Sub-channel Decrement",
Consumer::AlternateAudioIncrement => "Alternate Audio Increment",
Consumer::AlternateAudioDecrement => "Alternate Audio Decrement",
Consumer::ApplicationLaunchButtons => "Application Launch Buttons",
Consumer::ALLaunchButtonConfigurationTool => "AL Launch Button Configuration Tool",
Consumer::ALProgrammableButtonConfiguration => "AL Programmable Button Configuration",
Consumer::ALConsumerControlConfiguration => "AL Consumer Control Configuration",
Consumer::ALWordProcessor => "AL Word Processor",
Consumer::ALTextEditor => "AL Text Editor",
Consumer::ALSpreadsheet => "AL Spreadsheet",
Consumer::ALGraphicsEditor => "AL Graphics Editor",
Consumer::ALPresentationApp => "AL Presentation App",
Consumer::ALDatabaseApp => "AL Database App",
Consumer::ALEmailReader => "AL Email Reader",
Consumer::ALNewsreader => "AL Newsreader",
Consumer::ALVoicemail => "AL Voicemail",
Consumer::ALContactsAddressBook => "AL Contacts/Address Book",
Consumer::ALCalendarSchedule => "AL Calendar/Schedule",
Consumer::ALTaskProjectManager => "AL Task/Project Manager",
Consumer::ALLogJournalTimecard => "AL Log/Journal/Timecard",
Consumer::ALCheckbookFinance => "AL Checkbook/Finance",
Consumer::ALCalculator => "AL Calculator",
Consumer::ALAVCapturePlayback => "AL A/V Capture/Playback",
Consumer::ALLocalMachineBrowser => "AL Local Machine Browser",
Consumer::ALLANWANBrowser => "AL LAN/WAN Browser",
Consumer::ALInternetBrowser => "AL Internet Browser",
Consumer::ALRemoteNetworkingISPConnect => "AL Remote Networking/ISP Connect",
Consumer::ALNetworkConference => "AL Network Conference",
Consumer::ALNetworkChat => "AL Network Chat",
Consumer::ALTelephonyDialer => "AL Telephony/Dialer",
Consumer::ALLogon => "AL Logon",
Consumer::ALLogoff => "AL Logoff",
Consumer::ALLogonLogoff => "AL Logon/Logoff",
Consumer::ALTerminalLockScreensaver => "AL Terminal Lock/Screensaver",
Consumer::ALControlPanel => "AL Control Panel",
Consumer::ALCommandLineProcessorRun => "AL Command Line Processor/Run",
Consumer::ALProcessTaskManager => "AL Process/Task Manager",
Consumer::ALSelectTaskApplication => "AL Select Task/Application",
Consumer::ALNextTaskApplication => "AL Next Task/Application",
Consumer::ALPreviousTaskApplication => "AL Previous Task/Application",
Consumer::ALPreemptiveHaltTaskApplication => "AL Preemptive Halt Task/Application",
Consumer::ALIntegratedHelpCenter => "AL Integrated Help Center",
Consumer::ALDocuments => "AL Documents",
Consumer::ALThesaurus => "AL Thesaurus",
Consumer::ALDictionary => "AL Dictionary",
Consumer::ALDesktop => "AL Desktop",
Consumer::ALSpellCheck => "AL Spell Check",
Consumer::ALGrammarCheck => "AL Grammar Check",
Consumer::ALWirelessStatus => "AL Wireless Status",
Consumer::ALKeyboardLayout => "AL Keyboard Layout",
Consumer::ALVirusProtection => "AL Virus Protection",
Consumer::ALEncryption => "AL Encryption",
Consumer::ALScreenSaver => "AL Screen Saver",
Consumer::ALAlarms => "AL Alarms",
Consumer::ALClock => "AL Clock",
Consumer::ALFileBrowser => "AL File Browser",
Consumer::ALPowerStatus => "AL Power Status",
Consumer::ALImageBrowser => "AL Image Browser",
Consumer::ALAudioBrowser => "AL Audio Browser",
Consumer::ALMovieBrowser => "AL Movie Browser",
Consumer::ALDigitalRightsManager => "AL Digital Rights Manager",
Consumer::ALDigitalWallet => "AL Digital Wallet",
Consumer::ALInstantMessaging => "AL Instant Messaging",
Consumer::ALOEMFeaturesTipsTutorialBrowser => "AL OEM Features/ Tips/Tutorial Browser",
Consumer::ALOEMHelp => "AL OEM Help",
Consumer::ALOnlineCommunity => "AL Online Community",
Consumer::ALEntertainmentContentBrowser => "AL Entertainment Content Browser",
Consumer::ALOnlineShoppingBrowser => "AL Online Shopping Browser",
Consumer::ALSmartCardInformationHelp => "AL SmartCard Information/Help",
Consumer::ALMarketMonitorFinanceBrowser => "AL Market Monitor/Finance Browser",
Consumer::ALCustomizedCorporateNewsBrowser => "AL Customized Corporate News Browser",
Consumer::ALOnlineActivityBrowser => "AL Online Activity Browser",
Consumer::ALResearchSearchBrowser => "AL Research/Search Browser",
Consumer::ALAudioPlayer => "AL Audio Player",
Consumer::ALMessageStatus => "AL Message Status",
Consumer::ALContactSync => "AL Contact Sync",
Consumer::ALNavigation => "AL Navigation",
Consumer::ALContextawareDesktopAssistant => "AL Context‐aware Desktop Assistant",
Consumer::GenericGUIApplicationControls => "Generic GUI Application Controls",
Consumer::ACNew => "AC New",
Consumer::ACOpen => "AC Open",
Consumer::ACClose => "AC Close",
Consumer::ACExit => "AC Exit",
Consumer::ACMaximize => "AC Maximize",
Consumer::ACMinimize => "AC Minimize",
Consumer::ACSave => "AC Save",
Consumer::ACPrint => "AC Print",
Consumer::ACProperties => "AC Properties",
Consumer::ACUndo => "AC Undo",
Consumer::ACCopy => "AC Copy",
Consumer::ACCut => "AC Cut",
Consumer::ACPaste => "AC Paste",
Consumer::ACSelectAll => "AC Select All",
Consumer::ACFind => "AC Find",
Consumer::ACFindandReplace => "AC Find and Replace",
Consumer::ACSearch => "AC Search",
Consumer::ACGoTo => "AC Go To",
Consumer::ACHome => "AC Home",
Consumer::ACBack => "AC Back",
Consumer::ACForward => "AC Forward",
Consumer::ACStop => "AC Stop",
Consumer::ACRefresh => "AC Refresh",
Consumer::ACPreviousLink => "AC Previous Link",
Consumer::ACNextLink => "AC Next Link",
Consumer::ACBookmarks => "AC Bookmarks",
Consumer::ACHistory => "AC History",
Consumer::ACSubscriptions => "AC Subscriptions",
Consumer::ACZoomIn => "AC Zoom In",
Consumer::ACZoomOut => "AC Zoom Out",
Consumer::ACZoom => "AC Zoom",
Consumer::ACFullScreenView => "AC Full Screen View",
Consumer::ACNormalView => "AC Normal View",
Consumer::ACViewToggle => "AC View Toggle",
Consumer::ACScrollUp => "AC Scroll Up",
Consumer::ACScrollDown => "AC Scroll Down",
Consumer::ACScroll => "AC Scroll",
Consumer::ACPanLeft => "AC Pan Left",
Consumer::ACPanRight => "AC Pan Right",
Consumer::ACPan => "AC Pan",
Consumer::ACNewWindow => "AC New Window",
Consumer::ACTileHorizontally => "AC Tile Horizontally",
Consumer::ACTileVertically => "AC Tile Vertically",
Consumer::ACFormat => "AC Format",
Consumer::ACEdit => "AC Edit",
Consumer::ACBold => "AC Bold",
Consumer::ACItalics => "AC Italics",
Consumer::ACUnderline => "AC Underline",
Consumer::ACStrikethrough => "AC Strikethrough",
Consumer::ACSubscript => "AC Subscript",
Consumer::ACSuperscript => "AC Superscript",
Consumer::ACAllCaps => "AC All Caps",
Consumer::ACRotate => "AC Rotate",
Consumer::ACResize => "AC Resize",
Consumer::ACFlipHorizontal => "AC Flip Horizontal",
Consumer::ACFlipVertical => "AC Flip Vertical",
Consumer::ACMirrorHorizontal => "AC Mirror Horizontal",
Consumer::ACMirrorVertical => "AC Mirror Vertical",
Consumer::ACFontSelect => "AC Font Select",
Consumer::ACFontColor => "AC Font Color",
Consumer::ACFontSize => "AC Font Size",
Consumer::ACJustifyLeft => "AC Justify Left",
Consumer::ACJustifyCenterH => "AC Justify Center H",
Consumer::ACJustifyRight => "AC Justify Right",
Consumer::ACJustifyBlockH => "AC Justify Block H",
Consumer::ACJustifyTop => "AC Justify Top",
Consumer::ACJustifyCenterV => "AC Justify Center V",
Consumer::ACJustifyBottom => "AC Justify Bottom",
Consumer::ACJustifyBlockV => "AC Justify Block V",
Consumer::ACIndentDecrease => "AC Indent Decrease",
Consumer::ACIndentIncrease => "AC Indent Increase",
Consumer::ACNumberedList => "AC Numbered List",
Consumer::ACRestartNumbering => "AC Restart Numbering",
Consumer::ACBulletedList => "AC Bulleted List",
Consumer::ACPromote => "AC Promote",
Consumer::ACDemote => "AC Demote",
Consumer::ACYes => "AC Yes",
Consumer::ACNo => "AC No",
Consumer::ACCancel => "AC Cancel",
Consumer::ACCatalog => "AC Catalog",
Consumer::ACBuyCheckout => "AC Buy/Checkout",
Consumer::ACAddtoCart => "AC Add to Cart",
Consumer::ACExpand => "AC Expand",
Consumer::ACExpandAll => "AC Expand All",
Consumer::ACCollapse => "AC Collapse",
Consumer::ACCollapseAll => "AC Collapse All",
Consumer::ACPrintPreview => "AC Print Preview",
Consumer::ACPasteSpecial => "AC Paste Special",
Consumer::ACInsertMode => "AC Insert Mode",
Consumer::ACDelete => "AC Delete",
Consumer::ACLock => "AC Lock",
Consumer::ACUnlock => "AC Unlock",
Consumer::ACProtect => "AC Protect",
Consumer::ACUnprotect => "AC Unprotect",
Consumer::ACAttachComment => "AC Attach Comment",
Consumer::ACDeleteComment => "AC Delete Comment",
Consumer::ACViewComment => "AC View Comment",
Consumer::ACSelectWord => "AC Select Word",
Consumer::ACSelectSentence => "AC Select Sentence",
Consumer::ACSelectParagraph => "AC Select Paragraph",
Consumer::ACSelectColumn => "AC Select Column",
Consumer::ACSelectRow => "AC Select Row",
Consumer::ACSelectTable => "AC Select Table",
Consumer::ACSelectObject => "AC Select Object",
Consumer::ACRedoRepeat => "AC Redo/Repeat",
Consumer::ACSort => "AC Sort",
Consumer::ACSortAscending => "AC Sort Ascending",
Consumer::ACSortDescending => "AC Sort Descending",
Consumer::ACFilter => "AC Filter",
Consumer::ACSetClock => "AC Set Clock",
Consumer::ACViewClock => "AC View Clock",
Consumer::ACSelectTimeZone => "AC Select Time Zone",
Consumer::ACEditTimeZones => "AC Edit Time Zones",
Consumer::ACSetAlarm => "AC Set Alarm",
Consumer::ACClearAlarm => "AC Clear Alarm",
Consumer::ACSnoozeAlarm => "AC Snooze Alarm",
Consumer::ACResetAlarm => "AC Reset Alarm",
Consumer::ACSynchronize => "AC Synchronize",
Consumer::ACSendReceive => "AC Send/Receive",
Consumer::ACSendTo => "AC Send To",
Consumer::ACReply => "AC Reply",
Consumer::ACReplyAll => "AC Reply All",
Consumer::ACForwardMsg => "AC Forward Msg",
Consumer::ACSend => "AC Send",
Consumer::ACAttachFile => "AC Attach File",
Consumer::ACUpload => "AC Upload",
Consumer::ACDownloadSaveTargetAs => "AC Download (Save Target As)",
Consumer::ACSetBorders => "AC Set Borders",
Consumer::ACInsertRow => "AC Insert Row",
Consumer::ACInsertColumn => "AC Insert Column",
Consumer::ACInsertFile => "AC Insert File",
Consumer::ACInsertPicture => "AC Insert Picture",
Consumer::ACInsertObject => "AC Insert Object",
Consumer::ACInsertSymbol => "AC Insert Symbol",
Consumer::ACSaveandClose => "AC Save and Close",
Consumer::ACRename => "AC Rename",
Consumer::ACMerge => "AC Merge",
Consumer::ACSplit => "AC Split",
Consumer::ACDisributeHorizontally => "AC Disribute Horizontally",
Consumer::ACDistributeVertically => "AC Distribute Vertically",
Consumer::ACNextKeyboardLayoutSelect => "AC Next Keyboard Layout Select",
Consumer::ACNavigationGuidance => "AC Navigation Guidance",
Consumer::ACDesktopShowAllWindows => "AC Desktop Show All Windows",
Consumer::ACSoftKeyLeft => "AC Soft Key Left",
Consumer::ACSoftKeyRight => "AC Soft Key Right",
Consumer::ACDesktopShowAllApplications => "AC Desktop Show All Applications",
Consumer::ACIdleKeepAlive => "AC Idle Keep Alive",
Consumer::ExtendedKeyboardAttributesCollection => {
"Extended Keyboard Attributes Collection"
}
Consumer::KeyboardFormFactor => "Keyboard Form Factor",
Consumer::KeyboardKeyType => "Keyboard Key Type",
Consumer::KeyboardPhysicalLayout => "Keyboard Physical Layout",
Consumer::VendorSpecificKeyboardPhysicalLayout => {
"Vendor‐Specific Keyboard Physical Layout"
}
Consumer::KeyboardIETFLanguageTagIndex => "Keyboard IETF Language Tag Index",
Consumer::ImplementedKeyboardInputAssistControls => {
"Implemented Keyboard Input Assist Controls"
}
Consumer::KeyboardInputAssistPrevious => "Keyboard Input Assist Previous",
Consumer::KeyboardInputAssistNext => "Keyboard Input Assist Next",
Consumer::KeyboardInputAssistPreviousGroup => "Keyboard Input Assist Previous Group",
Consumer::KeyboardInputAssistNextGroup => "Keyboard Input Assist Next Group",
Consumer::KeyboardInputAssistAccept => "Keyboard Input Assist Accept",
Consumer::KeyboardInputAssistCancel => "Keyboard Input Assist Cancel",
Consumer::PrivacyScreenToggle => "Privacy Screen Toggle",
Consumer::PrivacyScreenLevelDecrement => "Privacy Screen Level Decrement",
Consumer::PrivacyScreenLevelIncrement => "Privacy Screen Level Increment",
Consumer::PrivacyScreenLevelMinimum => "Privacy Screen Level Minimum",
Consumer::PrivacyScreenLevelMaximum => "Privacy Screen Level Maximum",
Consumer::ContactEdited => "Contact Edited",
Consumer::ContactAdded => "Contact Added",
Consumer::ContactRecordActive => "Contact Record Active",
Consumer::ContactIndex => "Contact Index",
Consumer::ContactNickname => "Contact Nickname",
Consumer::ContactFirstName => "Contact First Name",
Consumer::ContactLastName => "Contact Last Name",
Consumer::ContactFullName => "Contact Full Name",
Consumer::ContactPhoneNumberPersonal => "Contact Phone Number Personal",
Consumer::ContactPhoneNumberBusiness => "Contact Phone Number Business",
Consumer::ContactPhoneNumberMobile => "Contact Phone Number Mobile",
Consumer::ContactPhoneNumberPager => "Contact Phone Number Pager",
Consumer::ContactPhoneNumberFax => "Contact Phone Number Fax",
Consumer::ContactPhoneNumberOther => "Contact Phone Number Other",
Consumer::ContactEmailPersonal => "Contact Email Personal",
Consumer::ContactEmailBusiness => "Contact Email Business",
Consumer::ContactEmailOther => "Contact Email Other",
Consumer::ContactEmailMain => "Contact Email Main",
Consumer::ContactSpeedDialNumber => "Contact Speed Dial Number",
Consumer::ContactStatusFlag => "Contact Status Flag",
Consumer::ContactMisc => "Contact Misc.",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for Consumer {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for Consumer {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for Consumer {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&Consumer> for u16 {
fn from(consumer: &Consumer) -> u16 {
*consumer as u16
}
}
impl From<Consumer> for u16 {
fn from(consumer: Consumer) -> u16 {
u16::from(&consumer)
}
}
impl From<&Consumer> for u32 {
fn from(consumer: &Consumer) -> u32 {
let up = UsagePage::from(consumer);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(consumer) as u32;
up | id
}
}
impl From<&Consumer> for UsagePage {
fn from(_: &Consumer) -> UsagePage {
UsagePage::Consumer
}
}
impl From<Consumer> for UsagePage {
fn from(_: Consumer) -> UsagePage {
UsagePage::Consumer
}
}
impl From<&Consumer> for Usage {
fn from(consumer: &Consumer) -> Usage {
Usage::try_from(u32::from(consumer)).unwrap()
}
}
impl From<Consumer> for Usage {
fn from(consumer: Consumer) -> Usage {
Usage::from(&consumer)
}
}
impl TryFrom<u16> for Consumer {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<Consumer> {
match usage_id {
1 => Ok(Consumer::ConsumerControl),
2 => Ok(Consumer::NumericKeyPad),
3 => Ok(Consumer::ProgrammableButtons),
4 => Ok(Consumer::Microphone),
5 => Ok(Consumer::Headphone),
6 => Ok(Consumer::GraphicEqualizer),
32 => Ok(Consumer::Plus10),
33 => Ok(Consumer::Plus100),
34 => Ok(Consumer::AMPM),
48 => Ok(Consumer::Power),
49 => Ok(Consumer::Reset),
50 => Ok(Consumer::Sleep),
51 => Ok(Consumer::SleepAfter),
52 => Ok(Consumer::SleepMode),
53 => Ok(Consumer::Illumination),
54 => Ok(Consumer::FunctionButtons),
64 => Ok(Consumer::Menu),
65 => Ok(Consumer::MenuPick),
66 => Ok(Consumer::MenuUp),
67 => Ok(Consumer::MenuDown),
68 => Ok(Consumer::MenuLeft),
69 => Ok(Consumer::MenuRight),
70 => Ok(Consumer::MenuEscape),
71 => Ok(Consumer::MenuValueIncrease),
72 => Ok(Consumer::MenuValueDecrease),
96 => Ok(Consumer::DataOnScreen),
97 => Ok(Consumer::ClosedCaption),
98 => Ok(Consumer::ClosedCaptionSelect),
99 => Ok(Consumer::VCRTV),
100 => Ok(Consumer::BroadcastMode),
101 => Ok(Consumer::Snapshot),
102 => Ok(Consumer::Still),
103 => Ok(Consumer::PictureinPictureToggle),
104 => Ok(Consumer::PictureinPictureSwap),
105 => Ok(Consumer::RedMenuButton),
106 => Ok(Consumer::GreenMenuButton),
107 => Ok(Consumer::BlueMenuButton),
108 => Ok(Consumer::YellowMenuButton),
109 => Ok(Consumer::Aspect),
110 => Ok(Consumer::ThreeDModeSelect),
111 => Ok(Consumer::DisplayBrightnessIncrement),
112 => Ok(Consumer::DisplayBrightnessDecrement),
113 => Ok(Consumer::DisplayBrightness),
114 => Ok(Consumer::DisplayBacklightToggle),
115 => Ok(Consumer::DisplaySetBrightnesstoMinimum),
116 => Ok(Consumer::DisplaySetBrightnesstoMaximum),
117 => Ok(Consumer::DisplaySetAutoBrightness),
118 => Ok(Consumer::CameraAccessEnabled),
119 => Ok(Consumer::CameraAccessDisabled),
120 => Ok(Consumer::CameraAccessToggle),
121 => Ok(Consumer::KeyboardBrightnessIncrement),
122 => Ok(Consumer::KeyboardBrightnessDecrement),
123 => Ok(Consumer::KeyboardBacklightSetLevel),
124 => Ok(Consumer::KeyboardBacklightOOC),
125 => Ok(Consumer::KeyboardBacklightSetMinimum),
126 => Ok(Consumer::KeyboardBacklightSetMaximum),
127 => Ok(Consumer::KeyboardBacklightAuto),
128 => Ok(Consumer::Selection),
129 => Ok(Consumer::AssignSelection),
130 => Ok(Consumer::ModeStep),
131 => Ok(Consumer::RecallLast),
132 => Ok(Consumer::EnterChannel),
133 => Ok(Consumer::OrderMovie),
134 => Ok(Consumer::Channel),
135 => Ok(Consumer::MediaSelection),
136 => Ok(Consumer::MediaSelectComputer),
137 => Ok(Consumer::MediaSelectTV),
138 => Ok(Consumer::MediaSelectWWW),
139 => Ok(Consumer::MediaSelectDVD),
140 => Ok(Consumer::MediaSelectTelephone),
141 => Ok(Consumer::MediaSelectProgramGuide),
142 => Ok(Consumer::MediaSelectVideoPhone),
143 => Ok(Consumer::MediaSelectGames),
144 => Ok(Consumer::MediaSelectMessages),
145 => Ok(Consumer::MediaSelectCD),
146 => Ok(Consumer::MediaSelectVCR),
147 => Ok(Consumer::MediaSelectTuner),
148 => Ok(Consumer::Quit),
149 => Ok(Consumer::Help),
150 => Ok(Consumer::MediaSelectTape),
151 => Ok(Consumer::MediaSelectCable),
152 => Ok(Consumer::MediaSelectSatellite),
153 => Ok(Consumer::MediaSelectSecurity),
154 => Ok(Consumer::MediaSelectHome),
155 => Ok(Consumer::MediaSelectCall),
156 => Ok(Consumer::ChannelIncrement),
157 => Ok(Consumer::ChannelDecrement),
158 => Ok(Consumer::MediaSelectSAP),
160 => Ok(Consumer::VCRPlus),
161 => Ok(Consumer::Once),
162 => Ok(Consumer::Daily),
163 => Ok(Consumer::Weekly),
164 => Ok(Consumer::Monthly),
176 => Ok(Consumer::Play),
177 => Ok(Consumer::Pause),
178 => Ok(Consumer::Record),
179 => Ok(Consumer::FastForward),
180 => Ok(Consumer::Rewind),
181 => Ok(Consumer::ScanNextTrack),
182 => Ok(Consumer::ScanPreviousTrack),
183 => Ok(Consumer::Stop),
184 => Ok(Consumer::Eject),
185 => Ok(Consumer::RandomPlay),
186 => Ok(Consumer::SelectDisc),
187 => Ok(Consumer::EnterDisc),
188 => Ok(Consumer::Repeat),
189 => Ok(Consumer::Tracking),
190 => Ok(Consumer::TrackNormal),
191 => Ok(Consumer::SlowTracking),
192 => Ok(Consumer::FrameForward),
193 => Ok(Consumer::FrameBack),
194 => Ok(Consumer::Mark),
195 => Ok(Consumer::ClearMark),
196 => Ok(Consumer::RepeatFromMark),
197 => Ok(Consumer::ReturnToMark),
198 => Ok(Consumer::SearchMarkForward),
199 => Ok(Consumer::SearchMarkBackwards),
200 => Ok(Consumer::CounterReset),
201 => Ok(Consumer::ShowCounter),
202 => Ok(Consumer::TrackingIncrement),
203 => Ok(Consumer::TrackingDecrement),
204 => Ok(Consumer::StopEject),
205 => Ok(Consumer::PlayPause),
206 => Ok(Consumer::PlaySkip),
207 => Ok(Consumer::VoiceCommand),
208 => Ok(Consumer::InvokeCaptureInterface),
209 => Ok(Consumer::StartorStopGameRecording),
210 => Ok(Consumer::HistoricalGameCapture),
211 => Ok(Consumer::CaptureGameScreenshot),
212 => Ok(Consumer::ShoworHideRecordingIndicator),
213 => Ok(Consumer::StartorStopMicrophoneCapture),
214 => Ok(Consumer::StartorStopCameraCapture),
215 => Ok(Consumer::StartorStopGameBroadcast),
216 => Ok(Consumer::StartorStopVoiceDictationSession),
217 => Ok(Consumer::InvokeDismissEmojiPicker),
224 => Ok(Consumer::Volume),
225 => Ok(Consumer::Balance),
226 => Ok(Consumer::Mute),
227 => Ok(Consumer::Bass),
228 => Ok(Consumer::Treble),
229 => Ok(Consumer::BassBoost),
230 => Ok(Consumer::SurroundMode),
231 => Ok(Consumer::Loudness),
232 => Ok(Consumer::MPX),
233 => Ok(Consumer::VolumeIncrement),
234 => Ok(Consumer::VolumeDecrement),
240 => Ok(Consumer::SpeedSelect),
241 => Ok(Consumer::PlaybackSpeed),
242 => Ok(Consumer::StandardPlay),
243 => Ok(Consumer::LongPlay),
244 => Ok(Consumer::ExtendedPlay),
245 => Ok(Consumer::Slow),
256 => Ok(Consumer::FanEnable),
257 => Ok(Consumer::FanSpeed),
258 => Ok(Consumer::LightEnable),
259 => Ok(Consumer::LightIlluminationLevel),
260 => Ok(Consumer::ClimateControlEnable),
261 => Ok(Consumer::RoomTemperature),
262 => Ok(Consumer::SecurityEnable),
263 => Ok(Consumer::FireAlarm),
264 => Ok(Consumer::PoliceAlarm),
265 => Ok(Consumer::Proximity),
266 => Ok(Consumer::Motion),
267 => Ok(Consumer::DuressAlarm),
268 => Ok(Consumer::HoldupAlarm),
269 => Ok(Consumer::MedicalAlarm),
336 => Ok(Consumer::BalanceRight),
337 => Ok(Consumer::BalanceLeft),
338 => Ok(Consumer::BassIncrement),
339 => Ok(Consumer::BassDecrement),
340 => Ok(Consumer::TrebleIncrement),
341 => Ok(Consumer::TrebleDecrement),
352 => Ok(Consumer::SpeakerSystem),
353 => Ok(Consumer::ChannelLeft),
354 => Ok(Consumer::ChannelRight),
355 => Ok(Consumer::ChannelCenter),
356 => Ok(Consumer::ChannelFront),
357 => Ok(Consumer::ChannelCenterFront),
358 => Ok(Consumer::ChannelSide),
359 => Ok(Consumer::ChannelSurround),
360 => Ok(Consumer::ChannelLowFrequencyEnhancement),
361 => Ok(Consumer::ChannelTop),
362 => Ok(Consumer::ChannelUnknown),
368 => Ok(Consumer::Subchannel),
369 => Ok(Consumer::SubchannelIncrement),
370 => Ok(Consumer::SubchannelDecrement),
371 => Ok(Consumer::AlternateAudioIncrement),
372 => Ok(Consumer::AlternateAudioDecrement),
384 => Ok(Consumer::ApplicationLaunchButtons),
385 => Ok(Consumer::ALLaunchButtonConfigurationTool),
386 => Ok(Consumer::ALProgrammableButtonConfiguration),
387 => Ok(Consumer::ALConsumerControlConfiguration),
388 => Ok(Consumer::ALWordProcessor),
389 => Ok(Consumer::ALTextEditor),
390 => Ok(Consumer::ALSpreadsheet),
391 => Ok(Consumer::ALGraphicsEditor),
392 => Ok(Consumer::ALPresentationApp),
393 => Ok(Consumer::ALDatabaseApp),
394 => Ok(Consumer::ALEmailReader),
395 => Ok(Consumer::ALNewsreader),
396 => Ok(Consumer::ALVoicemail),
397 => Ok(Consumer::ALContactsAddressBook),
398 => Ok(Consumer::ALCalendarSchedule),
399 => Ok(Consumer::ALTaskProjectManager),
400 => Ok(Consumer::ALLogJournalTimecard),
401 => Ok(Consumer::ALCheckbookFinance),
402 => Ok(Consumer::ALCalculator),
403 => Ok(Consumer::ALAVCapturePlayback),
404 => Ok(Consumer::ALLocalMachineBrowser),
405 => Ok(Consumer::ALLANWANBrowser),
406 => Ok(Consumer::ALInternetBrowser),
407 => Ok(Consumer::ALRemoteNetworkingISPConnect),
408 => Ok(Consumer::ALNetworkConference),
409 => Ok(Consumer::ALNetworkChat),
410 => Ok(Consumer::ALTelephonyDialer),
411 => Ok(Consumer::ALLogon),
412 => Ok(Consumer::ALLogoff),
413 => Ok(Consumer::ALLogonLogoff),
414 => Ok(Consumer::ALTerminalLockScreensaver),
415 => Ok(Consumer::ALControlPanel),
416 => Ok(Consumer::ALCommandLineProcessorRun),
417 => Ok(Consumer::ALProcessTaskManager),
418 => Ok(Consumer::ALSelectTaskApplication),
419 => Ok(Consumer::ALNextTaskApplication),
420 => Ok(Consumer::ALPreviousTaskApplication),
421 => Ok(Consumer::ALPreemptiveHaltTaskApplication),
422 => Ok(Consumer::ALIntegratedHelpCenter),
423 => Ok(Consumer::ALDocuments),
424 => Ok(Consumer::ALThesaurus),
425 => Ok(Consumer::ALDictionary),
426 => Ok(Consumer::ALDesktop),
427 => Ok(Consumer::ALSpellCheck),
428 => Ok(Consumer::ALGrammarCheck),
429 => Ok(Consumer::ALWirelessStatus),
430 => Ok(Consumer::ALKeyboardLayout),
431 => Ok(Consumer::ALVirusProtection),
432 => Ok(Consumer::ALEncryption),
433 => Ok(Consumer::ALScreenSaver),
434 => Ok(Consumer::ALAlarms),
435 => Ok(Consumer::ALClock),
436 => Ok(Consumer::ALFileBrowser),
437 => Ok(Consumer::ALPowerStatus),
438 => Ok(Consumer::ALImageBrowser),
439 => Ok(Consumer::ALAudioBrowser),
440 => Ok(Consumer::ALMovieBrowser),
441 => Ok(Consumer::ALDigitalRightsManager),
442 => Ok(Consumer::ALDigitalWallet),
444 => Ok(Consumer::ALInstantMessaging),
445 => Ok(Consumer::ALOEMFeaturesTipsTutorialBrowser),
446 => Ok(Consumer::ALOEMHelp),
447 => Ok(Consumer::ALOnlineCommunity),
448 => Ok(Consumer::ALEntertainmentContentBrowser),
449 => Ok(Consumer::ALOnlineShoppingBrowser),
450 => Ok(Consumer::ALSmartCardInformationHelp),
451 => Ok(Consumer::ALMarketMonitorFinanceBrowser),
452 => Ok(Consumer::ALCustomizedCorporateNewsBrowser),
453 => Ok(Consumer::ALOnlineActivityBrowser),
454 => Ok(Consumer::ALResearchSearchBrowser),
455 => Ok(Consumer::ALAudioPlayer),
456 => Ok(Consumer::ALMessageStatus),
457 => Ok(Consumer::ALContactSync),
458 => Ok(Consumer::ALNavigation),
459 => Ok(Consumer::ALContextawareDesktopAssistant),
512 => Ok(Consumer::GenericGUIApplicationControls),
513 => Ok(Consumer::ACNew),
514 => Ok(Consumer::ACOpen),
515 => Ok(Consumer::ACClose),
516 => Ok(Consumer::ACExit),
517 => Ok(Consumer::ACMaximize),
518 => Ok(Consumer::ACMinimize),
519 => Ok(Consumer::ACSave),
520 => Ok(Consumer::ACPrint),
521 => Ok(Consumer::ACProperties),
538 => Ok(Consumer::ACUndo),
539 => Ok(Consumer::ACCopy),
540 => Ok(Consumer::ACCut),
541 => Ok(Consumer::ACPaste),
542 => Ok(Consumer::ACSelectAll),
543 => Ok(Consumer::ACFind),
544 => Ok(Consumer::ACFindandReplace),
545 => Ok(Consumer::ACSearch),
546 => Ok(Consumer::ACGoTo),
547 => Ok(Consumer::ACHome),
548 => Ok(Consumer::ACBack),
549 => Ok(Consumer::ACForward),
550 => Ok(Consumer::ACStop),
551 => Ok(Consumer::ACRefresh),
552 => Ok(Consumer::ACPreviousLink),
553 => Ok(Consumer::ACNextLink),
554 => Ok(Consumer::ACBookmarks),
555 => Ok(Consumer::ACHistory),
556 => Ok(Consumer::ACSubscriptions),
557 => Ok(Consumer::ACZoomIn),
558 => Ok(Consumer::ACZoomOut),
559 => Ok(Consumer::ACZoom),
560 => Ok(Consumer::ACFullScreenView),
561 => Ok(Consumer::ACNormalView),
562 => Ok(Consumer::ACViewToggle),
563 => Ok(Consumer::ACScrollUp),
564 => Ok(Consumer::ACScrollDown),
565 => Ok(Consumer::ACScroll),
566 => Ok(Consumer::ACPanLeft),
567 => Ok(Consumer::ACPanRight),
568 => Ok(Consumer::ACPan),
569 => Ok(Consumer::ACNewWindow),
570 => Ok(Consumer::ACTileHorizontally),
571 => Ok(Consumer::ACTileVertically),
572 => Ok(Consumer::ACFormat),
573 => Ok(Consumer::ACEdit),
574 => Ok(Consumer::ACBold),
575 => Ok(Consumer::ACItalics),
576 => Ok(Consumer::ACUnderline),
577 => Ok(Consumer::ACStrikethrough),
578 => Ok(Consumer::ACSubscript),
579 => Ok(Consumer::ACSuperscript),
580 => Ok(Consumer::ACAllCaps),
581 => Ok(Consumer::ACRotate),
582 => Ok(Consumer::ACResize),
583 => Ok(Consumer::ACFlipHorizontal),
584 => Ok(Consumer::ACFlipVertical),
585 => Ok(Consumer::ACMirrorHorizontal),
586 => Ok(Consumer::ACMirrorVertical),
587 => Ok(Consumer::ACFontSelect),
588 => Ok(Consumer::ACFontColor),
589 => Ok(Consumer::ACFontSize),
590 => Ok(Consumer::ACJustifyLeft),
591 => Ok(Consumer::ACJustifyCenterH),
592 => Ok(Consumer::ACJustifyRight),
593 => Ok(Consumer::ACJustifyBlockH),
594 => Ok(Consumer::ACJustifyTop),
595 => Ok(Consumer::ACJustifyCenterV),
596 => Ok(Consumer::ACJustifyBottom),
597 => Ok(Consumer::ACJustifyBlockV),
598 => Ok(Consumer::ACIndentDecrease),
599 => Ok(Consumer::ACIndentIncrease),
600 => Ok(Consumer::ACNumberedList),
601 => Ok(Consumer::ACRestartNumbering),
602 => Ok(Consumer::ACBulletedList),
603 => Ok(Consumer::ACPromote),
604 => Ok(Consumer::ACDemote),
605 => Ok(Consumer::ACYes),
606 => Ok(Consumer::ACNo),
607 => Ok(Consumer::ACCancel),
608 => Ok(Consumer::ACCatalog),
609 => Ok(Consumer::ACBuyCheckout),
610 => Ok(Consumer::ACAddtoCart),
611 => Ok(Consumer::ACExpand),
612 => Ok(Consumer::ACExpandAll),
613 => Ok(Consumer::ACCollapse),
614 => Ok(Consumer::ACCollapseAll),
615 => Ok(Consumer::ACPrintPreview),
616 => Ok(Consumer::ACPasteSpecial),
617 => Ok(Consumer::ACInsertMode),
618 => Ok(Consumer::ACDelete),
619 => Ok(Consumer::ACLock),
620 => Ok(Consumer::ACUnlock),
621 => Ok(Consumer::ACProtect),
622 => Ok(Consumer::ACUnprotect),
623 => Ok(Consumer::ACAttachComment),
624 => Ok(Consumer::ACDeleteComment),
625 => Ok(Consumer::ACViewComment),
626 => Ok(Consumer::ACSelectWord),
627 => Ok(Consumer::ACSelectSentence),
628 => Ok(Consumer::ACSelectParagraph),
629 => Ok(Consumer::ACSelectColumn),
630 => Ok(Consumer::ACSelectRow),
631 => Ok(Consumer::ACSelectTable),
632 => Ok(Consumer::ACSelectObject),
633 => Ok(Consumer::ACRedoRepeat),
634 => Ok(Consumer::ACSort),
635 => Ok(Consumer::ACSortAscending),
636 => Ok(Consumer::ACSortDescending),
637 => Ok(Consumer::ACFilter),
638 => Ok(Consumer::ACSetClock),
639 => Ok(Consumer::ACViewClock),
640 => Ok(Consumer::ACSelectTimeZone),
641 => Ok(Consumer::ACEditTimeZones),
642 => Ok(Consumer::ACSetAlarm),
643 => Ok(Consumer::ACClearAlarm),
644 => Ok(Consumer::ACSnoozeAlarm),
645 => Ok(Consumer::ACResetAlarm),
646 => Ok(Consumer::ACSynchronize),
647 => Ok(Consumer::ACSendReceive),
648 => Ok(Consumer::ACSendTo),
649 => Ok(Consumer::ACReply),
650 => Ok(Consumer::ACReplyAll),
651 => Ok(Consumer::ACForwardMsg),
652 => Ok(Consumer::ACSend),
653 => Ok(Consumer::ACAttachFile),
654 => Ok(Consumer::ACUpload),
655 => Ok(Consumer::ACDownloadSaveTargetAs),
656 => Ok(Consumer::ACSetBorders),
657 => Ok(Consumer::ACInsertRow),
658 => Ok(Consumer::ACInsertColumn),
659 => Ok(Consumer::ACInsertFile),
660 => Ok(Consumer::ACInsertPicture),
661 => Ok(Consumer::ACInsertObject),
662 => Ok(Consumer::ACInsertSymbol),
663 => Ok(Consumer::ACSaveandClose),
664 => Ok(Consumer::ACRename),
665 => Ok(Consumer::ACMerge),
666 => Ok(Consumer::ACSplit),
667 => Ok(Consumer::ACDisributeHorizontally),
668 => Ok(Consumer::ACDistributeVertically),
669 => Ok(Consumer::ACNextKeyboardLayoutSelect),
670 => Ok(Consumer::ACNavigationGuidance),
671 => Ok(Consumer::ACDesktopShowAllWindows),
672 => Ok(Consumer::ACSoftKeyLeft),
673 => Ok(Consumer::ACSoftKeyRight),
674 => Ok(Consumer::ACDesktopShowAllApplications),
688 => Ok(Consumer::ACIdleKeepAlive),
704 => Ok(Consumer::ExtendedKeyboardAttributesCollection),
705 => Ok(Consumer::KeyboardFormFactor),
706 => Ok(Consumer::KeyboardKeyType),
707 => Ok(Consumer::KeyboardPhysicalLayout),
708 => Ok(Consumer::VendorSpecificKeyboardPhysicalLayout),
709 => Ok(Consumer::KeyboardIETFLanguageTagIndex),
710 => Ok(Consumer::ImplementedKeyboardInputAssistControls),
711 => Ok(Consumer::KeyboardInputAssistPrevious),
712 => Ok(Consumer::KeyboardInputAssistNext),
713 => Ok(Consumer::KeyboardInputAssistPreviousGroup),
714 => Ok(Consumer::KeyboardInputAssistNextGroup),
715 => Ok(Consumer::KeyboardInputAssistAccept),
716 => Ok(Consumer::KeyboardInputAssistCancel),
720 => Ok(Consumer::PrivacyScreenToggle),
721 => Ok(Consumer::PrivacyScreenLevelDecrement),
722 => Ok(Consumer::PrivacyScreenLevelIncrement),
723 => Ok(Consumer::PrivacyScreenLevelMinimum),
724 => Ok(Consumer::PrivacyScreenLevelMaximum),
1280 => Ok(Consumer::ContactEdited),
1281 => Ok(Consumer::ContactAdded),
1282 => Ok(Consumer::ContactRecordActive),
1283 => Ok(Consumer::ContactIndex),
1284 => Ok(Consumer::ContactNickname),
1285 => Ok(Consumer::ContactFirstName),
1286 => Ok(Consumer::ContactLastName),
1287 => Ok(Consumer::ContactFullName),
1288 => Ok(Consumer::ContactPhoneNumberPersonal),
1289 => Ok(Consumer::ContactPhoneNumberBusiness),
1290 => Ok(Consumer::ContactPhoneNumberMobile),
1291 => Ok(Consumer::ContactPhoneNumberPager),
1292 => Ok(Consumer::ContactPhoneNumberFax),
1293 => Ok(Consumer::ContactPhoneNumberOther),
1294 => Ok(Consumer::ContactEmailPersonal),
1295 => Ok(Consumer::ContactEmailBusiness),
1296 => Ok(Consumer::ContactEmailOther),
1297 => Ok(Consumer::ContactEmailMain),
1298 => Ok(Consumer::ContactSpeedDialNumber),
1299 => Ok(Consumer::ContactStatusFlag),
1300 => Ok(Consumer::ContactMisc),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for Consumer {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum Digitizers {
Digitizer = 0x1,
Pen = 0x2,
LightPen = 0x3,
TouchScreen = 0x4,
TouchPad = 0x5,
Whiteboard = 0x6,
CoordinateMeasuringMachine = 0x7,
ThreeDDigitizer = 0x8,
StereoPlotter = 0x9,
ArticulatedArm = 0xA,
Armature = 0xB,
MultiplePointDigitizer = 0xC,
FreeSpaceWand = 0xD,
DeviceConfiguration = 0xE,
CapacitiveHeatMapDigitizer = 0xF,
Stylus = 0x20,
Puck = 0x21,
Finger = 0x22,
Devicesettings = 0x23,
CharacterGesture = 0x24,
TipPressure = 0x30,
BarrelPressure = 0x31,
InRange = 0x32,
Touch = 0x33,
Untouch = 0x34,
Tap = 0x35,
Quality = 0x36,
DataValid = 0x37,
TransducerIndex = 0x38,
TabletFunctionKeys = 0x39,
ProgramChangeKeys = 0x3A,
BatteryStrength = 0x3B,
Invert = 0x3C,
XTilt = 0x3D,
YTilt = 0x3E,
Azimuth = 0x3F,
Altitude = 0x40,
Twist = 0x41,
TipSwitch = 0x42,
SecondaryTipSwitch = 0x43,
BarrelSwitch = 0x44,
Eraser = 0x45,
TabletPick = 0x46,
TouchValid = 0x47,
Width = 0x48,
Height = 0x49,
ContactIdentifier = 0x51,
DeviceMode = 0x52,
DeviceIdentifier = 0x53,
ContactCount = 0x54,
ContactCountMaximum = 0x55,
ScanTime = 0x56,
SurfaceSwitch = 0x57,
ButtonSwitch = 0x58,
PadType = 0x59,
SecondaryBarrelSwitch = 0x5A,
TransducerSerialNumber = 0x5B,
PreferredColor = 0x5C,
PreferredColorisLocked = 0x5D,
PreferredLineWidth = 0x5E,
PreferredLineWidthisLocked = 0x5F,
LatencyMode = 0x60,
GestureCharacterQuality = 0x61,
CharacterGestureDataLength = 0x62,
CharacterGestureData = 0x63,
GestureCharacterEncoding = 0x64,
UTF8CharacterGestureEncoding = 0x65,
UTF16LittleEndianCharacterGestureEncoding = 0x66,
UTF16BigEndianCharacterGestureEncoding = 0x67,
UTF32LittleEndianCharacterGestureEncoding = 0x68,
UTF32BigEndianCharacterGestureEncoding = 0x69,
CapacitiveHeatMapProtocolVendorID = 0x6A,
CapacitiveHeatMapProtocolVersion = 0x6B,
CapacitiveHeatMapFrameData = 0x6C,
GestureCharacterEnable = 0x6D,
TransducerSerialNumberPart2 = 0x6E,
NoPreferredColor = 0x6F,
PreferredLineStyle = 0x70,
PreferredLineStyleisLocked = 0x71,
Ink = 0x72,
Pencil = 0x73,
Highlighter = 0x74,
ChiselMarker = 0x75,
Brush = 0x76,
NoPreference = 0x77,
DigitizerDiagnostic = 0x80,
DigitizerError = 0x81,
ErrNormalStatus = 0x82,
ErrTransducersExceeded = 0x83,
ErrFullTransFeaturesUnavailable = 0x84,
ErrChargeLow = 0x85,
TransducerSoftwareInfo = 0x90,
TransducerVendorId = 0x91,
TransducerProductId = 0x92,
DeviceSupportedProtocols = 0x93,
TransducerSupportedProtocols = 0x94,
NoProtocol = 0x95,
WacomAESProtocol = 0x96,
USIProtocol = 0x97,
MicrosoftPenProtocol = 0x98,
SupportedReportRates = 0xA0,
ReportRate = 0xA1,
TransducerConnected = 0xA2,
SwitchDisabled = 0xA3,
SwitchUnimplemented = 0xA4,
TransducerSwitches = 0xA5,
TransducerIndexSelector = 0xA6,
ButtonPressThreshold = 0xB0,
}
impl Digitizers {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
Digitizers::Digitizer => "Digitizer",
Digitizers::Pen => "Pen",
Digitizers::LightPen => "Light Pen",
Digitizers::TouchScreen => "Touch Screen",
Digitizers::TouchPad => "Touch Pad",
Digitizers::Whiteboard => "Whiteboard",
Digitizers::CoordinateMeasuringMachine => "Coordinate Measuring Machine",
Digitizers::ThreeDDigitizer => "3D Digitizer",
Digitizers::StereoPlotter => "Stereo Plotter",
Digitizers::ArticulatedArm => "Articulated Arm",
Digitizers::Armature => "Armature",
Digitizers::MultiplePointDigitizer => "Multiple Point Digitizer",
Digitizers::FreeSpaceWand => "Free Space Wand",
Digitizers::DeviceConfiguration => "Device Configuration",
Digitizers::CapacitiveHeatMapDigitizer => "Capacitive Heat Map Digitizer",
Digitizers::Stylus => "Stylus",
Digitizers::Puck => "Puck",
Digitizers::Finger => "Finger",
Digitizers::Devicesettings => "Device settings",
Digitizers::CharacterGesture => "Character Gesture",
Digitizers::TipPressure => "Tip Pressure",
Digitizers::BarrelPressure => "Barrel Pressure",
Digitizers::InRange => "In Range",
Digitizers::Touch => "Touch",
Digitizers::Untouch => "Untouch",
Digitizers::Tap => "Tap",
Digitizers::Quality => "Quality",
Digitizers::DataValid => "Data Valid",
Digitizers::TransducerIndex => "Transducer Index",
Digitizers::TabletFunctionKeys => "Tablet Function Keys",
Digitizers::ProgramChangeKeys => "Program Change Keys",
Digitizers::BatteryStrength => "Battery Strength",
Digitizers::Invert => "Invert",
Digitizers::XTilt => "X Tilt",
Digitizers::YTilt => "Y Tilt",
Digitizers::Azimuth => "Azimuth",
Digitizers::Altitude => "Altitude",
Digitizers::Twist => "Twist",
Digitizers::TipSwitch => "Tip Switch",
Digitizers::SecondaryTipSwitch => "Secondary Tip Switch",
Digitizers::BarrelSwitch => "Barrel Switch",
Digitizers::Eraser => "Eraser",
Digitizers::TabletPick => "Tablet Pick",
Digitizers::TouchValid => "Touch Valid",
Digitizers::Width => "Width",
Digitizers::Height => "Height",
Digitizers::ContactIdentifier => "Contact Identifier",
Digitizers::DeviceMode => "Device Mode",
Digitizers::DeviceIdentifier => "Device Identifier",
Digitizers::ContactCount => "Contact Count",
Digitizers::ContactCountMaximum => "Contact Count Maximum",
Digitizers::ScanTime => "Scan Time",
Digitizers::SurfaceSwitch => "Surface Switch",
Digitizers::ButtonSwitch => "Button Switch",
Digitizers::PadType => "Pad Type",
Digitizers::SecondaryBarrelSwitch => "Secondary Barrel Switch",
Digitizers::TransducerSerialNumber => "Transducer Serial Number",
Digitizers::PreferredColor => "Preferred Color",
Digitizers::PreferredColorisLocked => "Preferred Color is Locked",
Digitizers::PreferredLineWidth => "Preferred Line Width",
Digitizers::PreferredLineWidthisLocked => "Preferred Line Width is Locked",
Digitizers::LatencyMode => "Latency Mode",
Digitizers::GestureCharacterQuality => "Gesture Character Quality",
Digitizers::CharacterGestureDataLength => "Character Gesture Data Length",
Digitizers::CharacterGestureData => "Character Gesture Data",
Digitizers::GestureCharacterEncoding => "Gesture Character Encoding",
Digitizers::UTF8CharacterGestureEncoding => "UTF8 Character Gesture Encoding",
Digitizers::UTF16LittleEndianCharacterGestureEncoding => {
"UTF16 Little Endian Character Gesture Encoding"
}
Digitizers::UTF16BigEndianCharacterGestureEncoding => {
"UTF16 Big Endian Character Gesture Encoding"
}
Digitizers::UTF32LittleEndianCharacterGestureEncoding => {
"UTF32 Little Endian Character Gesture Encoding"
}
Digitizers::UTF32BigEndianCharacterGestureEncoding => {
"UTF32 Big Endian Character Gesture Encoding"
}
Digitizers::CapacitiveHeatMapProtocolVendorID => {
"Capacitive Heat Map Protocol Vendor ID"
}
Digitizers::CapacitiveHeatMapProtocolVersion => "Capacitive Heat Map Protocol Version",
Digitizers::CapacitiveHeatMapFrameData => "Capacitive Heat Map Frame Data",
Digitizers::GestureCharacterEnable => "Gesture Character Enable",
Digitizers::TransducerSerialNumberPart2 => "Transducer Serial Number Part 2",
Digitizers::NoPreferredColor => "No Preferred Color",
Digitizers::PreferredLineStyle => "Preferred Line Style",
Digitizers::PreferredLineStyleisLocked => "Preferred Line Style is Locked",
Digitizers::Ink => "Ink",
Digitizers::Pencil => "Pencil",
Digitizers::Highlighter => "Highlighter",
Digitizers::ChiselMarker => "Chisel Marker",
Digitizers::Brush => "Brush",
Digitizers::NoPreference => "No Preference",
Digitizers::DigitizerDiagnostic => "Digitizer Diagnostic",
Digitizers::DigitizerError => "Digitizer Error",
Digitizers::ErrNormalStatus => "Err Normal Status",
Digitizers::ErrTransducersExceeded => "Err Transducers Exceeded",
Digitizers::ErrFullTransFeaturesUnavailable => "Err Full Trans Features Unavailable",
Digitizers::ErrChargeLow => "Err Charge Low",
Digitizers::TransducerSoftwareInfo => "Transducer Software Info",
Digitizers::TransducerVendorId => "Transducer Vendor Id",
Digitizers::TransducerProductId => "Transducer Product Id",
Digitizers::DeviceSupportedProtocols => "Device Supported Protocols",
Digitizers::TransducerSupportedProtocols => "Transducer Supported Protocols",
Digitizers::NoProtocol => "No Protocol",
Digitizers::WacomAESProtocol => "Wacom AES Protocol",
Digitizers::USIProtocol => "USI Protocol",
Digitizers::MicrosoftPenProtocol => "Microsoft Pen Protocol",
Digitizers::SupportedReportRates => "Supported Report Rates",
Digitizers::ReportRate => "Report Rate",
Digitizers::TransducerConnected => "Transducer Connected",
Digitizers::SwitchDisabled => "Switch Disabled",
Digitizers::SwitchUnimplemented => "Switch Unimplemented",
Digitizers::TransducerSwitches => "Transducer Switches",
Digitizers::TransducerIndexSelector => "Transducer Index Selector",
Digitizers::ButtonPressThreshold => "Button Press Threshold",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for Digitizers {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for Digitizers {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for Digitizers {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&Digitizers> for u16 {
fn from(digitizers: &Digitizers) -> u16 {
*digitizers as u16
}
}
impl From<Digitizers> for u16 {
fn from(digitizers: Digitizers) -> u16 {
u16::from(&digitizers)
}
}
impl From<&Digitizers> for u32 {
fn from(digitizers: &Digitizers) -> u32 {
let up = UsagePage::from(digitizers);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(digitizers) as u32;
up | id
}
}
impl From<&Digitizers> for UsagePage {
fn from(_: &Digitizers) -> UsagePage {
UsagePage::Digitizers
}
}
impl From<Digitizers> for UsagePage {
fn from(_: Digitizers) -> UsagePage {
UsagePage::Digitizers
}
}
impl From<&Digitizers> for Usage {
fn from(digitizers: &Digitizers) -> Usage {
Usage::try_from(u32::from(digitizers)).unwrap()
}
}
impl From<Digitizers> for Usage {
fn from(digitizers: Digitizers) -> Usage {
Usage::from(&digitizers)
}
}
impl TryFrom<u16> for Digitizers {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<Digitizers> {
match usage_id {
1 => Ok(Digitizers::Digitizer),
2 => Ok(Digitizers::Pen),
3 => Ok(Digitizers::LightPen),
4 => Ok(Digitizers::TouchScreen),
5 => Ok(Digitizers::TouchPad),
6 => Ok(Digitizers::Whiteboard),
7 => Ok(Digitizers::CoordinateMeasuringMachine),
8 => Ok(Digitizers::ThreeDDigitizer),
9 => Ok(Digitizers::StereoPlotter),
10 => Ok(Digitizers::ArticulatedArm),
11 => Ok(Digitizers::Armature),
12 => Ok(Digitizers::MultiplePointDigitizer),
13 => Ok(Digitizers::FreeSpaceWand),
14 => Ok(Digitizers::DeviceConfiguration),
15 => Ok(Digitizers::CapacitiveHeatMapDigitizer),
32 => Ok(Digitizers::Stylus),
33 => Ok(Digitizers::Puck),
34 => Ok(Digitizers::Finger),
35 => Ok(Digitizers::Devicesettings),
36 => Ok(Digitizers::CharacterGesture),
48 => Ok(Digitizers::TipPressure),
49 => Ok(Digitizers::BarrelPressure),
50 => Ok(Digitizers::InRange),
51 => Ok(Digitizers::Touch),
52 => Ok(Digitizers::Untouch),
53 => Ok(Digitizers::Tap),
54 => Ok(Digitizers::Quality),
55 => Ok(Digitizers::DataValid),
56 => Ok(Digitizers::TransducerIndex),
57 => Ok(Digitizers::TabletFunctionKeys),
58 => Ok(Digitizers::ProgramChangeKeys),
59 => Ok(Digitizers::BatteryStrength),
60 => Ok(Digitizers::Invert),
61 => Ok(Digitizers::XTilt),
62 => Ok(Digitizers::YTilt),
63 => Ok(Digitizers::Azimuth),
64 => Ok(Digitizers::Altitude),
65 => Ok(Digitizers::Twist),
66 => Ok(Digitizers::TipSwitch),
67 => Ok(Digitizers::SecondaryTipSwitch),
68 => Ok(Digitizers::BarrelSwitch),
69 => Ok(Digitizers::Eraser),
70 => Ok(Digitizers::TabletPick),
71 => Ok(Digitizers::TouchValid),
72 => Ok(Digitizers::Width),
73 => Ok(Digitizers::Height),
81 => Ok(Digitizers::ContactIdentifier),
82 => Ok(Digitizers::DeviceMode),
83 => Ok(Digitizers::DeviceIdentifier),
84 => Ok(Digitizers::ContactCount),
85 => Ok(Digitizers::ContactCountMaximum),
86 => Ok(Digitizers::ScanTime),
87 => Ok(Digitizers::SurfaceSwitch),
88 => Ok(Digitizers::ButtonSwitch),
89 => Ok(Digitizers::PadType),
90 => Ok(Digitizers::SecondaryBarrelSwitch),
91 => Ok(Digitizers::TransducerSerialNumber),
92 => Ok(Digitizers::PreferredColor),
93 => Ok(Digitizers::PreferredColorisLocked),
94 => Ok(Digitizers::PreferredLineWidth),
95 => Ok(Digitizers::PreferredLineWidthisLocked),
96 => Ok(Digitizers::LatencyMode),
97 => Ok(Digitizers::GestureCharacterQuality),
98 => Ok(Digitizers::CharacterGestureDataLength),
99 => Ok(Digitizers::CharacterGestureData),
100 => Ok(Digitizers::GestureCharacterEncoding),
101 => Ok(Digitizers::UTF8CharacterGestureEncoding),
102 => Ok(Digitizers::UTF16LittleEndianCharacterGestureEncoding),
103 => Ok(Digitizers::UTF16BigEndianCharacterGestureEncoding),
104 => Ok(Digitizers::UTF32LittleEndianCharacterGestureEncoding),
105 => Ok(Digitizers::UTF32BigEndianCharacterGestureEncoding),
106 => Ok(Digitizers::CapacitiveHeatMapProtocolVendorID),
107 => Ok(Digitizers::CapacitiveHeatMapProtocolVersion),
108 => Ok(Digitizers::CapacitiveHeatMapFrameData),
109 => Ok(Digitizers::GestureCharacterEnable),
110 => Ok(Digitizers::TransducerSerialNumberPart2),
111 => Ok(Digitizers::NoPreferredColor),
112 => Ok(Digitizers::PreferredLineStyle),
113 => Ok(Digitizers::PreferredLineStyleisLocked),
114 => Ok(Digitizers::Ink),
115 => Ok(Digitizers::Pencil),
116 => Ok(Digitizers::Highlighter),
117 => Ok(Digitizers::ChiselMarker),
118 => Ok(Digitizers::Brush),
119 => Ok(Digitizers::NoPreference),
128 => Ok(Digitizers::DigitizerDiagnostic),
129 => Ok(Digitizers::DigitizerError),
130 => Ok(Digitizers::ErrNormalStatus),
131 => Ok(Digitizers::ErrTransducersExceeded),
132 => Ok(Digitizers::ErrFullTransFeaturesUnavailable),
133 => Ok(Digitizers::ErrChargeLow),
144 => Ok(Digitizers::TransducerSoftwareInfo),
145 => Ok(Digitizers::TransducerVendorId),
146 => Ok(Digitizers::TransducerProductId),
147 => Ok(Digitizers::DeviceSupportedProtocols),
148 => Ok(Digitizers::TransducerSupportedProtocols),
149 => Ok(Digitizers::NoProtocol),
150 => Ok(Digitizers::WacomAESProtocol),
151 => Ok(Digitizers::USIProtocol),
152 => Ok(Digitizers::MicrosoftPenProtocol),
160 => Ok(Digitizers::SupportedReportRates),
161 => Ok(Digitizers::ReportRate),
162 => Ok(Digitizers::TransducerConnected),
163 => Ok(Digitizers::SwitchDisabled),
164 => Ok(Digitizers::SwitchUnimplemented),
165 => Ok(Digitizers::TransducerSwitches),
166 => Ok(Digitizers::TransducerIndexSelector),
176 => Ok(Digitizers::ButtonPressThreshold),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for Digitizers {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum Haptics {
SimpleHapticController = 0x1,
WaveformList = 0x10,
DurationList = 0x11,
AutoTrigger = 0x20,
ManualTrigger = 0x21,
AutoTriggerAssociatedControl = 0x22,
Intensity = 0x23,
RepeatCount = 0x24,
RetriggerPeriod = 0x25,
WaveformVendorPage = 0x26,
WaveformVendorID = 0x27,
WaveformCutoffTime = 0x28,
WaveformNone = 0x1001,
WaveformStop = 0x1002,
WaveformClick = 0x1003,
WaveformBuzzContinuous = 0x1004,
WaveformRumbleContinuous = 0x1005,
WaveformPress = 0x1006,
WaveformRelease = 0x1007,
WaveformHover = 0x1008,
WaveformSuccess = 0x1009,
WaveformError = 0x100A,
WaveformInkContinuous = 0x100B,
WaveformPencilContinuous = 0x100C,
WaveformMarkerContinuous = 0x100D,
WaveformChiselMarkerContinuous = 0x100E,
WaveformBrushContinuous = 0x100F,
WaveformEraserContinuous = 0x1010,
WaveformSparkleContinuous = 0x1011,
}
impl Haptics {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
Haptics::SimpleHapticController => "Simple Haptic Controller",
Haptics::WaveformList => "Waveform List",
Haptics::DurationList => "Duration List",
Haptics::AutoTrigger => "Auto Trigger",
Haptics::ManualTrigger => "Manual Trigger",
Haptics::AutoTriggerAssociatedControl => "Auto Trigger Associated Control",
Haptics::Intensity => "Intensity",
Haptics::RepeatCount => "Repeat Count",
Haptics::RetriggerPeriod => "Retrigger Period",
Haptics::WaveformVendorPage => "Waveform Vendor Page",
Haptics::WaveformVendorID => "Waveform Vendor ID",
Haptics::WaveformCutoffTime => "Waveform Cutoff Time",
Haptics::WaveformNone => "Waveform None",
Haptics::WaveformStop => "Waveform Stop",
Haptics::WaveformClick => "Waveform Click",
Haptics::WaveformBuzzContinuous => "Waveform Buzz Continuous",
Haptics::WaveformRumbleContinuous => "Waveform Rumble Continuous",
Haptics::WaveformPress => "Waveform Press",
Haptics::WaveformRelease => "Waveform Release",
Haptics::WaveformHover => "Waveform Hover",
Haptics::WaveformSuccess => "Waveform Success",
Haptics::WaveformError => "Waveform Error",
Haptics::WaveformInkContinuous => "Waveform Ink Continuous",
Haptics::WaveformPencilContinuous => "Waveform Pencil Continuous",
Haptics::WaveformMarkerContinuous => "Waveform Marker Continuous",
Haptics::WaveformChiselMarkerContinuous => "Waveform Chisel Marker Continuous",
Haptics::WaveformBrushContinuous => "Waveform Brush Continuous",
Haptics::WaveformEraserContinuous => "Waveform Eraser Continuous",
Haptics::WaveformSparkleContinuous => "Waveform Sparkle Continuous",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for Haptics {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for Haptics {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for Haptics {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&Haptics> for u16 {
fn from(haptics: &Haptics) -> u16 {
*haptics as u16
}
}
impl From<Haptics> for u16 {
fn from(haptics: Haptics) -> u16 {
u16::from(&haptics)
}
}
impl From<&Haptics> for u32 {
fn from(haptics: &Haptics) -> u32 {
let up = UsagePage::from(haptics);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(haptics) as u32;
up | id
}
}
impl From<&Haptics> for UsagePage {
fn from(_: &Haptics) -> UsagePage {
UsagePage::Haptics
}
}
impl From<Haptics> for UsagePage {
fn from(_: Haptics) -> UsagePage {
UsagePage::Haptics
}
}
impl From<&Haptics> for Usage {
fn from(haptics: &Haptics) -> Usage {
Usage::try_from(u32::from(haptics)).unwrap()
}
}
impl From<Haptics> for Usage {
fn from(haptics: Haptics) -> Usage {
Usage::from(&haptics)
}
}
impl TryFrom<u16> for Haptics {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<Haptics> {
match usage_id {
1 => Ok(Haptics::SimpleHapticController),
16 => Ok(Haptics::WaveformList),
17 => Ok(Haptics::DurationList),
32 => Ok(Haptics::AutoTrigger),
33 => Ok(Haptics::ManualTrigger),
34 => Ok(Haptics::AutoTriggerAssociatedControl),
35 => Ok(Haptics::Intensity),
36 => Ok(Haptics::RepeatCount),
37 => Ok(Haptics::RetriggerPeriod),
38 => Ok(Haptics::WaveformVendorPage),
39 => Ok(Haptics::WaveformVendorID),
40 => Ok(Haptics::WaveformCutoffTime),
4097 => Ok(Haptics::WaveformNone),
4098 => Ok(Haptics::WaveformStop),
4099 => Ok(Haptics::WaveformClick),
4100 => Ok(Haptics::WaveformBuzzContinuous),
4101 => Ok(Haptics::WaveformRumbleContinuous),
4102 => Ok(Haptics::WaveformPress),
4103 => Ok(Haptics::WaveformRelease),
4104 => Ok(Haptics::WaveformHover),
4105 => Ok(Haptics::WaveformSuccess),
4106 => Ok(Haptics::WaveformError),
4107 => Ok(Haptics::WaveformInkContinuous),
4108 => Ok(Haptics::WaveformPencilContinuous),
4109 => Ok(Haptics::WaveformMarkerContinuous),
4110 => Ok(Haptics::WaveformChiselMarkerContinuous),
4111 => Ok(Haptics::WaveformBrushContinuous),
4112 => Ok(Haptics::WaveformEraserContinuous),
4113 => Ok(Haptics::WaveformSparkleContinuous),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for Haptics {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum PhysicalInputDevice {
PhysicalInputDevice = 0x1,
Normal = 0x20,
SetEffectReport = 0x21,
EffectParameterBlockIndex = 0x22,
ParameterBlockOffset = 0x23,
ROMFlag = 0x24,
EffectType = 0x25,
ETConstantForce = 0x26,
ETRamp = 0x27,
ETCustomForce = 0x28,
ETSquare = 0x30,
ETSine = 0x31,
ETTriangle = 0x32,
ETSawtoothUp = 0x33,
ETSawtoothDown = 0x34,
ETSpring = 0x40,
ETDamper = 0x41,
ETInertia = 0x42,
ETFriction = 0x43,
Duration = 0x50,
SamplePeriod = 0x51,
Gain = 0x52,
TriggerButton = 0x53,
TriggerRepeatInterval = 0x54,
AxesEnable = 0x55,
DirectionEnable = 0x56,
Direction = 0x57,
TypeSpecificBlockOffset = 0x58,
BlockType = 0x59,
SetEnvelopeReport = 0x5A,
AttackLevel = 0x5B,
AttackTime = 0x5C,
FadeLevel = 0x5D,
FadeTime = 0x5E,
SetConditionReport = 0x5F,
CenterPointOffset = 0x60,
PositiveCoefficient = 0x61,
NegativeCoefficient = 0x62,
PositiveSaturation = 0x63,
NegativeSaturation = 0x64,
DeadBand = 0x65,
DownloadForceSample = 0x66,
IsochCustomForceEnable = 0x67,
CustomForceDataReport = 0x68,
CustomForceData = 0x69,
CustomForceVendorDefinedData = 0x6A,
SetCustomForceReport = 0x6B,
CustomForceDataOffset = 0x6C,
SampleCount = 0x6D,
SetPeriodicReport = 0x6E,
Offset = 0x6F,
Magnitude = 0x70,
Phase = 0x71,
Period = 0x72,
SetConstantForceReport = 0x73,
SetRampForceReport = 0x74,
RampStart = 0x75,
RampEnd = 0x76,
EffectOperationReport = 0x77,
EffectOperation = 0x78,
OpEffectStart = 0x79,
OpEffectStartSolo = 0x7A,
OpEffectStop = 0x7B,
LoopCount = 0x7C,
DeviceGainReport = 0x7D,
DeviceGain = 0x7E,
ParameterBlockPoolsReport = 0x7F,
RAMPoolSize = 0x80,
ROMPoolSize = 0x81,
ROMEffectBlockCount = 0x82,
SimultaneousEffectsMax = 0x83,
PoolAlignment = 0x84,
ParameterBlockMoveReport = 0x85,
MoveSource = 0x86,
MoveDestination = 0x87,
MoveLength = 0x88,
EffectParameterBlockLoadReport = 0x89,
EffectParameterBlockLoadStatus = 0x8B,
BlockLoadSuccess = 0x8C,
BlockLoadFull = 0x8D,
BlockLoadError = 0x8E,
BlockHandle = 0x8F,
EffectParameterBlockFreeReport = 0x90,
TypeSpecificBlockHandle = 0x91,
PIDStateReport = 0x92,
EffectPlaying = 0x94,
PIDDeviceControlReport = 0x95,
PIDDeviceControl = 0x96,
DCEnableActuators = 0x97,
DCDisableActuators = 0x98,
DCStopAllEffects = 0x99,
DCReset = 0x9A,
DCPause = 0x9B,
DCContinue = 0x9C,
DevicePaused = 0x9F,
ActuatorsEnabled = 0xA0,
SafetySwitch = 0xA4,
ActuatorOverrideSwitch = 0xA5,
ActuatorPower = 0xA6,
StartDelay = 0xA7,
ParameterBlockSize = 0xA8,
DeviceManagedPool = 0xA9,
SharedParameterBlocks = 0xAA,
CreateNewEffectParameterBlockReport = 0xAB,
RAMPoolAvailable = 0xAC,
}
impl PhysicalInputDevice {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
PhysicalInputDevice::PhysicalInputDevice => "Physical Input Device",
PhysicalInputDevice::Normal => "Normal",
PhysicalInputDevice::SetEffectReport => "Set Effect Report",
PhysicalInputDevice::EffectParameterBlockIndex => "Effect Parameter Block Index",
PhysicalInputDevice::ParameterBlockOffset => "Parameter Block Offset",
PhysicalInputDevice::ROMFlag => "ROM Flag",
PhysicalInputDevice::EffectType => "Effect Type",
PhysicalInputDevice::ETConstantForce => "ET Constant-Force",
PhysicalInputDevice::ETRamp => "ET Ramp",
PhysicalInputDevice::ETCustomForce => "ET Custom-Force",
PhysicalInputDevice::ETSquare => "ET Square",
PhysicalInputDevice::ETSine => "ET Sine",
PhysicalInputDevice::ETTriangle => "ET Triangle",
PhysicalInputDevice::ETSawtoothUp => "ET Sawtooth Up",
PhysicalInputDevice::ETSawtoothDown => "ET Sawtooth Down",
PhysicalInputDevice::ETSpring => "ET Spring",
PhysicalInputDevice::ETDamper => "ET Damper",
PhysicalInputDevice::ETInertia => "ET Inertia",
PhysicalInputDevice::ETFriction => "ET Friction",
PhysicalInputDevice::Duration => "Duration",
PhysicalInputDevice::SamplePeriod => "Sample Period",
PhysicalInputDevice::Gain => "Gain",
PhysicalInputDevice::TriggerButton => "Trigger Button",
PhysicalInputDevice::TriggerRepeatInterval => "Trigger Repeat Interval",
PhysicalInputDevice::AxesEnable => "Axes Enable",
PhysicalInputDevice::DirectionEnable => "Direction Enable",
PhysicalInputDevice::Direction => "Direction",
PhysicalInputDevice::TypeSpecificBlockOffset => "Type Specific Block Offset",
PhysicalInputDevice::BlockType => "Block Type",
PhysicalInputDevice::SetEnvelopeReport => "Set Envelope Report",
PhysicalInputDevice::AttackLevel => "Attack Level",
PhysicalInputDevice::AttackTime => "Attack Time",
PhysicalInputDevice::FadeLevel => "Fade Level",
PhysicalInputDevice::FadeTime => "Fade Time",
PhysicalInputDevice::SetConditionReport => "Set Condition Report",
PhysicalInputDevice::CenterPointOffset => "Center-Point Offset",
PhysicalInputDevice::PositiveCoefficient => "Positive Coefficient",
PhysicalInputDevice::NegativeCoefficient => "Negative Coefficient",
PhysicalInputDevice::PositiveSaturation => "Positive Saturation",
PhysicalInputDevice::NegativeSaturation => "Negative Saturation",
PhysicalInputDevice::DeadBand => "Dead Band",
PhysicalInputDevice::DownloadForceSample => "Download Force Sample",
PhysicalInputDevice::IsochCustomForceEnable => "Isoch Custom-Force Enable",
PhysicalInputDevice::CustomForceDataReport => "Custom-Force Data Report",
PhysicalInputDevice::CustomForceData => "Custom-Force Data",
PhysicalInputDevice::CustomForceVendorDefinedData => "Custom-Force Vendor Defined Data",
PhysicalInputDevice::SetCustomForceReport => "Set Custom-Force Report",
PhysicalInputDevice::CustomForceDataOffset => "Custom-Force Data Offset",
PhysicalInputDevice::SampleCount => "Sample Count",
PhysicalInputDevice::SetPeriodicReport => "Set Periodic Report",
PhysicalInputDevice::Offset => "Offset",
PhysicalInputDevice::Magnitude => "Magnitude",
PhysicalInputDevice::Phase => "Phase",
PhysicalInputDevice::Period => "Period",
PhysicalInputDevice::SetConstantForceReport => "Set Constant-Force Report",
PhysicalInputDevice::SetRampForceReport => "Set Ramp-Force Report",
PhysicalInputDevice::RampStart => "Ramp Start",
PhysicalInputDevice::RampEnd => "Ramp End",
PhysicalInputDevice::EffectOperationReport => "Effect Operation Report",
PhysicalInputDevice::EffectOperation => "Effect Operation",
PhysicalInputDevice::OpEffectStart => "Op Effect Start",
PhysicalInputDevice::OpEffectStartSolo => "Op Effect Start Solo",
PhysicalInputDevice::OpEffectStop => "Op Effect Stop",
PhysicalInputDevice::LoopCount => "Loop Count",
PhysicalInputDevice::DeviceGainReport => "Device Gain Report",
PhysicalInputDevice::DeviceGain => "Device Gain",
PhysicalInputDevice::ParameterBlockPoolsReport => "Parameter Block Pools Report",
PhysicalInputDevice::RAMPoolSize => "RAM Pool Size",
PhysicalInputDevice::ROMPoolSize => "ROM Pool Size",
PhysicalInputDevice::ROMEffectBlockCount => "ROM Effect Block Count",
PhysicalInputDevice::SimultaneousEffectsMax => "Simultaneous Effects Max",
PhysicalInputDevice::PoolAlignment => "Pool Alignment",
PhysicalInputDevice::ParameterBlockMoveReport => "Parameter Block Move Report",
PhysicalInputDevice::MoveSource => "Move Source",
PhysicalInputDevice::MoveDestination => "Move Destination",
PhysicalInputDevice::MoveLength => "Move Length",
PhysicalInputDevice::EffectParameterBlockLoadReport => {
"Effect Parameter Block Load Report"
}
PhysicalInputDevice::EffectParameterBlockLoadStatus => {
"Effect Parameter Block Load Status"
}
PhysicalInputDevice::BlockLoadSuccess => "Block Load Success",
PhysicalInputDevice::BlockLoadFull => "Block Load Full",
PhysicalInputDevice::BlockLoadError => "Block Load Error",
PhysicalInputDevice::BlockHandle => "Block Handle",
PhysicalInputDevice::EffectParameterBlockFreeReport => {
"Effect Parameter Block Free Report"
}
PhysicalInputDevice::TypeSpecificBlockHandle => "Type Specific Block Handle",
PhysicalInputDevice::PIDStateReport => "PID State Report",
PhysicalInputDevice::EffectPlaying => "Effect Playing",
PhysicalInputDevice::PIDDeviceControlReport => "PID Device Control Report",
PhysicalInputDevice::PIDDeviceControl => "PID Device Control",
PhysicalInputDevice::DCEnableActuators => "DC Enable Actuators",
PhysicalInputDevice::DCDisableActuators => "DC Disable Actuators",
PhysicalInputDevice::DCStopAllEffects => "DC Stop All Effects",
PhysicalInputDevice::DCReset => "DC Reset",
PhysicalInputDevice::DCPause => "DC Pause",
PhysicalInputDevice::DCContinue => "DC Continue",
PhysicalInputDevice::DevicePaused => "Device Paused",
PhysicalInputDevice::ActuatorsEnabled => "Actuators Enabled",
PhysicalInputDevice::SafetySwitch => "Safety Switch",
PhysicalInputDevice::ActuatorOverrideSwitch => "Actuator Override Switch",
PhysicalInputDevice::ActuatorPower => "Actuator Power",
PhysicalInputDevice::StartDelay => "Start Delay",
PhysicalInputDevice::ParameterBlockSize => "Parameter Block Size",
PhysicalInputDevice::DeviceManagedPool => "Device-Managed Pool",
PhysicalInputDevice::SharedParameterBlocks => "Shared Parameter Blocks",
PhysicalInputDevice::CreateNewEffectParameterBlockReport => {
"Create New Effect Parameter Block Report"
}
PhysicalInputDevice::RAMPoolAvailable => "RAM Pool Available",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for PhysicalInputDevice {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for PhysicalInputDevice {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for PhysicalInputDevice {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&PhysicalInputDevice> for u16 {
fn from(physicalinputdevice: &PhysicalInputDevice) -> u16 {
*physicalinputdevice as u16
}
}
impl From<PhysicalInputDevice> for u16 {
fn from(physicalinputdevice: PhysicalInputDevice) -> u16 {
u16::from(&physicalinputdevice)
}
}
impl From<&PhysicalInputDevice> for u32 {
fn from(physicalinputdevice: &PhysicalInputDevice) -> u32 {
let up = UsagePage::from(physicalinputdevice);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(physicalinputdevice) as u32;
up | id
}
}
impl From<&PhysicalInputDevice> for UsagePage {
fn from(_: &PhysicalInputDevice) -> UsagePage {
UsagePage::PhysicalInputDevice
}
}
impl From<PhysicalInputDevice> for UsagePage {
fn from(_: PhysicalInputDevice) -> UsagePage {
UsagePage::PhysicalInputDevice
}
}
impl From<&PhysicalInputDevice> for Usage {
fn from(physicalinputdevice: &PhysicalInputDevice) -> Usage {
Usage::try_from(u32::from(physicalinputdevice)).unwrap()
}
}
impl From<PhysicalInputDevice> for Usage {
fn from(physicalinputdevice: PhysicalInputDevice) -> Usage {
Usage::from(&physicalinputdevice)
}
}
impl TryFrom<u16> for PhysicalInputDevice {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<PhysicalInputDevice> {
match usage_id {
1 => Ok(PhysicalInputDevice::PhysicalInputDevice),
32 => Ok(PhysicalInputDevice::Normal),
33 => Ok(PhysicalInputDevice::SetEffectReport),
34 => Ok(PhysicalInputDevice::EffectParameterBlockIndex),
35 => Ok(PhysicalInputDevice::ParameterBlockOffset),
36 => Ok(PhysicalInputDevice::ROMFlag),
37 => Ok(PhysicalInputDevice::EffectType),
38 => Ok(PhysicalInputDevice::ETConstantForce),
39 => Ok(PhysicalInputDevice::ETRamp),
40 => Ok(PhysicalInputDevice::ETCustomForce),
48 => Ok(PhysicalInputDevice::ETSquare),
49 => Ok(PhysicalInputDevice::ETSine),
50 => Ok(PhysicalInputDevice::ETTriangle),
51 => Ok(PhysicalInputDevice::ETSawtoothUp),
52 => Ok(PhysicalInputDevice::ETSawtoothDown),
64 => Ok(PhysicalInputDevice::ETSpring),
65 => Ok(PhysicalInputDevice::ETDamper),
66 => Ok(PhysicalInputDevice::ETInertia),
67 => Ok(PhysicalInputDevice::ETFriction),
80 => Ok(PhysicalInputDevice::Duration),
81 => Ok(PhysicalInputDevice::SamplePeriod),
82 => Ok(PhysicalInputDevice::Gain),
83 => Ok(PhysicalInputDevice::TriggerButton),
84 => Ok(PhysicalInputDevice::TriggerRepeatInterval),
85 => Ok(PhysicalInputDevice::AxesEnable),
86 => Ok(PhysicalInputDevice::DirectionEnable),
87 => Ok(PhysicalInputDevice::Direction),
88 => Ok(PhysicalInputDevice::TypeSpecificBlockOffset),
89 => Ok(PhysicalInputDevice::BlockType),
90 => Ok(PhysicalInputDevice::SetEnvelopeReport),
91 => Ok(PhysicalInputDevice::AttackLevel),
92 => Ok(PhysicalInputDevice::AttackTime),
93 => Ok(PhysicalInputDevice::FadeLevel),
94 => Ok(PhysicalInputDevice::FadeTime),
95 => Ok(PhysicalInputDevice::SetConditionReport),
96 => Ok(PhysicalInputDevice::CenterPointOffset),
97 => Ok(PhysicalInputDevice::PositiveCoefficient),
98 => Ok(PhysicalInputDevice::NegativeCoefficient),
99 => Ok(PhysicalInputDevice::PositiveSaturation),
100 => Ok(PhysicalInputDevice::NegativeSaturation),
101 => Ok(PhysicalInputDevice::DeadBand),
102 => Ok(PhysicalInputDevice::DownloadForceSample),
103 => Ok(PhysicalInputDevice::IsochCustomForceEnable),
104 => Ok(PhysicalInputDevice::CustomForceDataReport),
105 => Ok(PhysicalInputDevice::CustomForceData),
106 => Ok(PhysicalInputDevice::CustomForceVendorDefinedData),
107 => Ok(PhysicalInputDevice::SetCustomForceReport),
108 => Ok(PhysicalInputDevice::CustomForceDataOffset),
109 => Ok(PhysicalInputDevice::SampleCount),
110 => Ok(PhysicalInputDevice::SetPeriodicReport),
111 => Ok(PhysicalInputDevice::Offset),
112 => Ok(PhysicalInputDevice::Magnitude),
113 => Ok(PhysicalInputDevice::Phase),
114 => Ok(PhysicalInputDevice::Period),
115 => Ok(PhysicalInputDevice::SetConstantForceReport),
116 => Ok(PhysicalInputDevice::SetRampForceReport),
117 => Ok(PhysicalInputDevice::RampStart),
118 => Ok(PhysicalInputDevice::RampEnd),
119 => Ok(PhysicalInputDevice::EffectOperationReport),
120 => Ok(PhysicalInputDevice::EffectOperation),
121 => Ok(PhysicalInputDevice::OpEffectStart),
122 => Ok(PhysicalInputDevice::OpEffectStartSolo),
123 => Ok(PhysicalInputDevice::OpEffectStop),
124 => Ok(PhysicalInputDevice::LoopCount),
125 => Ok(PhysicalInputDevice::DeviceGainReport),
126 => Ok(PhysicalInputDevice::DeviceGain),
127 => Ok(PhysicalInputDevice::ParameterBlockPoolsReport),
128 => Ok(PhysicalInputDevice::RAMPoolSize),
129 => Ok(PhysicalInputDevice::ROMPoolSize),
130 => Ok(PhysicalInputDevice::ROMEffectBlockCount),
131 => Ok(PhysicalInputDevice::SimultaneousEffectsMax),
132 => Ok(PhysicalInputDevice::PoolAlignment),
133 => Ok(PhysicalInputDevice::ParameterBlockMoveReport),
134 => Ok(PhysicalInputDevice::MoveSource),
135 => Ok(PhysicalInputDevice::MoveDestination),
136 => Ok(PhysicalInputDevice::MoveLength),
137 => Ok(PhysicalInputDevice::EffectParameterBlockLoadReport),
139 => Ok(PhysicalInputDevice::EffectParameterBlockLoadStatus),
140 => Ok(PhysicalInputDevice::BlockLoadSuccess),
141 => Ok(PhysicalInputDevice::BlockLoadFull),
142 => Ok(PhysicalInputDevice::BlockLoadError),
143 => Ok(PhysicalInputDevice::BlockHandle),
144 => Ok(PhysicalInputDevice::EffectParameterBlockFreeReport),
145 => Ok(PhysicalInputDevice::TypeSpecificBlockHandle),
146 => Ok(PhysicalInputDevice::PIDStateReport),
148 => Ok(PhysicalInputDevice::EffectPlaying),
149 => Ok(PhysicalInputDevice::PIDDeviceControlReport),
150 => Ok(PhysicalInputDevice::PIDDeviceControl),
151 => Ok(PhysicalInputDevice::DCEnableActuators),
152 => Ok(PhysicalInputDevice::DCDisableActuators),
153 => Ok(PhysicalInputDevice::DCStopAllEffects),
154 => Ok(PhysicalInputDevice::DCReset),
155 => Ok(PhysicalInputDevice::DCPause),
156 => Ok(PhysicalInputDevice::DCContinue),
159 => Ok(PhysicalInputDevice::DevicePaused),
160 => Ok(PhysicalInputDevice::ActuatorsEnabled),
164 => Ok(PhysicalInputDevice::SafetySwitch),
165 => Ok(PhysicalInputDevice::ActuatorOverrideSwitch),
166 => Ok(PhysicalInputDevice::ActuatorPower),
167 => Ok(PhysicalInputDevice::StartDelay),
168 => Ok(PhysicalInputDevice::ParameterBlockSize),
169 => Ok(PhysicalInputDevice::DeviceManagedPool),
170 => Ok(PhysicalInputDevice::SharedParameterBlocks),
171 => Ok(PhysicalInputDevice::CreateNewEffectParameterBlockReport),
172 => Ok(PhysicalInputDevice::RAMPoolAvailable),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for PhysicalInputDevice {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug)]
#[non_exhaustive]
pub enum Unicode {
Unicode(u16),
}
impl Unicode {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
Unicode::Unicode(codepoint) => format!("codepoint {codepoint}"),
}
}
}
#[cfg(feature = "std")]
impl fmt::Display for Unicode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for Unicode {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for Unicode {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&Unicode> for u16 {
fn from(unicode: &Unicode) -> u16 {
match *unicode {
Unicode::Unicode(codepoint) => codepoint,
}
}
}
impl From<Unicode> for u16 {
fn from(unicode: Unicode) -> u16 {
u16::from(&unicode)
}
}
impl From<&Unicode> for u32 {
fn from(unicode: &Unicode) -> u32 {
let up = UsagePage::from(unicode);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(unicode) as u32;
up | id
}
}
impl From<&Unicode> for UsagePage {
fn from(_: &Unicode) -> UsagePage {
UsagePage::Unicode
}
}
impl From<Unicode> for UsagePage {
fn from(_: Unicode) -> UsagePage {
UsagePage::Unicode
}
}
impl From<&Unicode> for Usage {
fn from(unicode: &Unicode) -> Usage {
Usage::try_from(u32::from(unicode)).unwrap()
}
}
impl From<Unicode> for Usage {
fn from(unicode: Unicode) -> Usage {
Usage::from(&unicode)
}
}
impl TryFrom<u16> for Unicode {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<Unicode> {
match usage_id {
n => Ok(Unicode::Unicode(n)),
}
}
}
impl BitOr<u16> for Unicode {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum SoC {
SocControl = 0x1,
FirmwareTransfer = 0x2,
FirmwareFileId = 0x3,
FileOffsetInBytes = 0x4,
FileTransferSizeMaxInBytes = 0x5,
FilePayload = 0x6,
FilePayloadSizeInBytes = 0x7,
FilePayloadContainsLastBytes = 0x8,
FileTransferStop = 0x9,
FileTransferTillEnd = 0xA,
}
impl SoC {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
SoC::SocControl => "SocControl",
SoC::FirmwareTransfer => "FirmwareTransfer",
SoC::FirmwareFileId => "FirmwareFileId",
SoC::FileOffsetInBytes => "FileOffsetInBytes",
SoC::FileTransferSizeMaxInBytes => "FileTransferSizeMaxInBytes",
SoC::FilePayload => "FilePayload",
SoC::FilePayloadSizeInBytes => "FilePayloadSizeInBytes",
SoC::FilePayloadContainsLastBytes => "FilePayloadContainsLastBytes",
SoC::FileTransferStop => "FileTransferStop",
SoC::FileTransferTillEnd => "FileTransferTillEnd",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for SoC {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for SoC {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for SoC {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&SoC> for u16 {
fn from(soc: &SoC) -> u16 {
*soc as u16
}
}
impl From<SoC> for u16 {
fn from(soc: SoC) -> u16 {
u16::from(&soc)
}
}
impl From<&SoC> for u32 {
fn from(soc: &SoC) -> u32 {
let up = UsagePage::from(soc);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(soc) as u32;
up | id
}
}
impl From<&SoC> for UsagePage {
fn from(_: &SoC) -> UsagePage {
UsagePage::SoC
}
}
impl From<SoC> for UsagePage {
fn from(_: SoC) -> UsagePage {
UsagePage::SoC
}
}
impl From<&SoC> for Usage {
fn from(soc: &SoC) -> Usage {
Usage::try_from(u32::from(soc)).unwrap()
}
}
impl From<SoC> for Usage {
fn from(soc: SoC) -> Usage {
Usage::from(&soc)
}
}
impl TryFrom<u16> for SoC {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<SoC> {
match usage_id {
1 => Ok(SoC::SocControl),
2 => Ok(SoC::FirmwareTransfer),
3 => Ok(SoC::FirmwareFileId),
4 => Ok(SoC::FileOffsetInBytes),
5 => Ok(SoC::FileTransferSizeMaxInBytes),
6 => Ok(SoC::FilePayload),
7 => Ok(SoC::FilePayloadSizeInBytes),
8 => Ok(SoC::FilePayloadContainsLastBytes),
9 => Ok(SoC::FileTransferStop),
10 => Ok(SoC::FileTransferTillEnd),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for SoC {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum EyeandHeadTrackers {
EyeTracker = 0x1,
HeadTracker = 0x2,
TrackingData = 0x10,
Capabilities = 0x11,
Configuration = 0x12,
Status = 0x13,
Control = 0x14,
SensorTimestamp = 0x20,
PositionX = 0x21,
PositionY = 0x22,
PositionZ = 0x23,
GazePoint = 0x24,
LeftEyePosition = 0x25,
RightEyePosition = 0x26,
HeadPosition = 0x27,
HeadDirectionPoint = 0x28,
RotationaboutXaxis = 0x29,
RotationaboutYaxis = 0x2A,
RotationaboutZaxis = 0x2B,
TrackerQuality = 0x100,
MinimumTrackingDistance = 0x101,
OptimumTrackingDistance = 0x102,
MaximumTrackingDistance = 0x103,
MaximumScreenPlaneWidth = 0x104,
MaximumScreenPlaneHeight = 0x105,
DisplayManufacturerID = 0x200,
DisplayProductID = 0x201,
DisplaySerialNumber = 0x202,
DisplayManufacturerDate = 0x203,
CalibratedScreenWidth = 0x204,
CalibratedScreenHeight = 0x205,
SamplingFrequency = 0x300,
ConfigurationStatus = 0x301,
DeviceModeRequest = 0x400,
}
impl EyeandHeadTrackers {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
EyeandHeadTrackers::EyeTracker => "Eye Tracker",
EyeandHeadTrackers::HeadTracker => "Head Tracker",
EyeandHeadTrackers::TrackingData => "Tracking Data",
EyeandHeadTrackers::Capabilities => "Capabilities",
EyeandHeadTrackers::Configuration => "Configuration",
EyeandHeadTrackers::Status => "Status",
EyeandHeadTrackers::Control => "Control",
EyeandHeadTrackers::SensorTimestamp => "Sensor Timestamp",
EyeandHeadTrackers::PositionX => "Position X",
EyeandHeadTrackers::PositionY => "Position Y",
EyeandHeadTrackers::PositionZ => "Position Z",
EyeandHeadTrackers::GazePoint => "Gaze Point",
EyeandHeadTrackers::LeftEyePosition => "Left Eye Position",
EyeandHeadTrackers::RightEyePosition => "Right Eye Position",
EyeandHeadTrackers::HeadPosition => "Head Position",
EyeandHeadTrackers::HeadDirectionPoint => "Head Direction Point",
EyeandHeadTrackers::RotationaboutXaxis => "Rotation about X axis",
EyeandHeadTrackers::RotationaboutYaxis => "Rotation about Y axis",
EyeandHeadTrackers::RotationaboutZaxis => "Rotation about Z axis",
EyeandHeadTrackers::TrackerQuality => "Tracker Quality",
EyeandHeadTrackers::MinimumTrackingDistance => "Minimum Tracking Distance",
EyeandHeadTrackers::OptimumTrackingDistance => "Optimum Tracking Distance",
EyeandHeadTrackers::MaximumTrackingDistance => "Maximum Tracking Distance",
EyeandHeadTrackers::MaximumScreenPlaneWidth => "Maximum Screen Plane Width",
EyeandHeadTrackers::MaximumScreenPlaneHeight => "Maximum Screen Plane Height",
EyeandHeadTrackers::DisplayManufacturerID => "Display Manufacturer ID",
EyeandHeadTrackers::DisplayProductID => "Display Product ID",
EyeandHeadTrackers::DisplaySerialNumber => "Display Serial Number",
EyeandHeadTrackers::DisplayManufacturerDate => "Display Manufacturer Date",
EyeandHeadTrackers::CalibratedScreenWidth => "Calibrated Screen Width",
EyeandHeadTrackers::CalibratedScreenHeight => "Calibrated Screen Height",
EyeandHeadTrackers::SamplingFrequency => "Sampling Frequency",
EyeandHeadTrackers::ConfigurationStatus => "Configuration Status",
EyeandHeadTrackers::DeviceModeRequest => "Device Mode Request",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for EyeandHeadTrackers {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for EyeandHeadTrackers {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for EyeandHeadTrackers {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&EyeandHeadTrackers> for u16 {
fn from(eyeandheadtrackers: &EyeandHeadTrackers) -> u16 {
*eyeandheadtrackers as u16
}
}
impl From<EyeandHeadTrackers> for u16 {
fn from(eyeandheadtrackers: EyeandHeadTrackers) -> u16 {
u16::from(&eyeandheadtrackers)
}
}
impl From<&EyeandHeadTrackers> for u32 {
fn from(eyeandheadtrackers: &EyeandHeadTrackers) -> u32 {
let up = UsagePage::from(eyeandheadtrackers);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(eyeandheadtrackers) as u32;
up | id
}
}
impl From<&EyeandHeadTrackers> for UsagePage {
fn from(_: &EyeandHeadTrackers) -> UsagePage {
UsagePage::EyeandHeadTrackers
}
}
impl From<EyeandHeadTrackers> for UsagePage {
fn from(_: EyeandHeadTrackers) -> UsagePage {
UsagePage::EyeandHeadTrackers
}
}
impl From<&EyeandHeadTrackers> for Usage {
fn from(eyeandheadtrackers: &EyeandHeadTrackers) -> Usage {
Usage::try_from(u32::from(eyeandheadtrackers)).unwrap()
}
}
impl From<EyeandHeadTrackers> for Usage {
fn from(eyeandheadtrackers: EyeandHeadTrackers) -> Usage {
Usage::from(&eyeandheadtrackers)
}
}
impl TryFrom<u16> for EyeandHeadTrackers {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<EyeandHeadTrackers> {
match usage_id {
1 => Ok(EyeandHeadTrackers::EyeTracker),
2 => Ok(EyeandHeadTrackers::HeadTracker),
16 => Ok(EyeandHeadTrackers::TrackingData),
17 => Ok(EyeandHeadTrackers::Capabilities),
18 => Ok(EyeandHeadTrackers::Configuration),
19 => Ok(EyeandHeadTrackers::Status),
20 => Ok(EyeandHeadTrackers::Control),
32 => Ok(EyeandHeadTrackers::SensorTimestamp),
33 => Ok(EyeandHeadTrackers::PositionX),
34 => Ok(EyeandHeadTrackers::PositionY),
35 => Ok(EyeandHeadTrackers::PositionZ),
36 => Ok(EyeandHeadTrackers::GazePoint),
37 => Ok(EyeandHeadTrackers::LeftEyePosition),
38 => Ok(EyeandHeadTrackers::RightEyePosition),
39 => Ok(EyeandHeadTrackers::HeadPosition),
40 => Ok(EyeandHeadTrackers::HeadDirectionPoint),
41 => Ok(EyeandHeadTrackers::RotationaboutXaxis),
42 => Ok(EyeandHeadTrackers::RotationaboutYaxis),
43 => Ok(EyeandHeadTrackers::RotationaboutZaxis),
256 => Ok(EyeandHeadTrackers::TrackerQuality),
257 => Ok(EyeandHeadTrackers::MinimumTrackingDistance),
258 => Ok(EyeandHeadTrackers::OptimumTrackingDistance),
259 => Ok(EyeandHeadTrackers::MaximumTrackingDistance),
260 => Ok(EyeandHeadTrackers::MaximumScreenPlaneWidth),
261 => Ok(EyeandHeadTrackers::MaximumScreenPlaneHeight),
512 => Ok(EyeandHeadTrackers::DisplayManufacturerID),
513 => Ok(EyeandHeadTrackers::DisplayProductID),
514 => Ok(EyeandHeadTrackers::DisplaySerialNumber),
515 => Ok(EyeandHeadTrackers::DisplayManufacturerDate),
516 => Ok(EyeandHeadTrackers::CalibratedScreenWidth),
517 => Ok(EyeandHeadTrackers::CalibratedScreenHeight),
768 => Ok(EyeandHeadTrackers::SamplingFrequency),
769 => Ok(EyeandHeadTrackers::ConfigurationStatus),
1024 => Ok(EyeandHeadTrackers::DeviceModeRequest),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for EyeandHeadTrackers {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum AuxiliaryDisplay {
AlphanumericDisplay = 0x1,
AuxiliaryDisplay = 0x2,
DisplayAttributesReport = 0x20,
ASCIICharacterSet = 0x21,
DataReadBack = 0x22,
FontReadBack = 0x23,
DisplayControlReport = 0x24,
ClearDisplay = 0x25,
DisplayEnable = 0x26,
ScreenSaverDelay = 0x27,
ScreenSaverEnable = 0x28,
VerticalScroll = 0x29,
HorizontalScroll = 0x2A,
CharacterReport = 0x2B,
DisplayData = 0x2C,
DisplayStatus = 0x2D,
StatNotReady = 0x2E,
StatReady = 0x2F,
ErrNotaloadablecharacter = 0x30,
ErrFontdatacannotberead = 0x31,
CursorPositionReport = 0x32,
Row = 0x33,
Column = 0x34,
Rows = 0x35,
Columns = 0x36,
CursorPixelPositioning = 0x37,
CursorMode = 0x38,
CursorEnable = 0x39,
CursorBlink = 0x3A,
FontReport = 0x3B,
FontData = 0x3C,
CharacterWidth = 0x3D,
CharacterHeight = 0x3E,
CharacterSpacingHorizontal = 0x3F,
CharacterSpacingVertical = 0x40,
UnicodeCharacterSet = 0x41,
Font7Segment = 0x42,
SevenSegmentDirectMap = 0x43,
Font14Segment = 0x44,
One4SegmentDirectMap = 0x45,
DisplayBrightness = 0x46,
DisplayContrast = 0x47,
CharacterAttribute = 0x48,
AttributeReadback = 0x49,
AttributeData = 0x4A,
CharAttrEnhance = 0x4B,
CharAttrUnderline = 0x4C,
CharAttrBlink = 0x4D,
BitmapSizeX = 0x80,
BitmapSizeY = 0x81,
MaxBlitSize = 0x82,
BitDepthFormat = 0x83,
DisplayOrientation = 0x84,
PaletteReport = 0x85,
PaletteDataSize = 0x86,
PaletteDataOffset = 0x87,
PaletteData = 0x88,
BlitReport = 0x8A,
BlitRectangleX1 = 0x8B,
BlitRectangleY1 = 0x8C,
BlitRectangleX2 = 0x8D,
BlitRectangleY2 = 0x8E,
BlitData = 0x8F,
SoftButton = 0x90,
SoftButtonID = 0x91,
SoftButtonSide = 0x92,
SoftButtonOffset1 = 0x93,
SoftButtonOffset2 = 0x94,
SoftButtonReport = 0x95,
SoftKeys = 0xC2,
DisplayDataExtensions = 0xCC,
CharacterMapping = 0xCF,
UnicodeEquivalent = 0xDD,
CharacterPageMapping = 0xDF,
RequestReport = 0xFF,
}
impl AuxiliaryDisplay {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
AuxiliaryDisplay::AlphanumericDisplay => "Alphanumeric Display",
AuxiliaryDisplay::AuxiliaryDisplay => "Auxiliary Display",
AuxiliaryDisplay::DisplayAttributesReport => "Display Attributes Report",
AuxiliaryDisplay::ASCIICharacterSet => "ASCII Character Set",
AuxiliaryDisplay::DataReadBack => "Data Read Back",
AuxiliaryDisplay::FontReadBack => "Font Read Back",
AuxiliaryDisplay::DisplayControlReport => "Display Control Report",
AuxiliaryDisplay::ClearDisplay => "Clear Display",
AuxiliaryDisplay::DisplayEnable => "Display Enable",
AuxiliaryDisplay::ScreenSaverDelay => "Screen Saver Delay",
AuxiliaryDisplay::ScreenSaverEnable => "Screen Saver Enable",
AuxiliaryDisplay::VerticalScroll => "Vertical Scroll",
AuxiliaryDisplay::HorizontalScroll => "Horizontal Scroll",
AuxiliaryDisplay::CharacterReport => "Character Report",
AuxiliaryDisplay::DisplayData => "Display Data",
AuxiliaryDisplay::DisplayStatus => "Display Status",
AuxiliaryDisplay::StatNotReady => "Stat Not Ready",
AuxiliaryDisplay::StatReady => "Stat Ready",
AuxiliaryDisplay::ErrNotaloadablecharacter => "Err Not a loadable character",
AuxiliaryDisplay::ErrFontdatacannotberead => "Err Font data cannot be read",
AuxiliaryDisplay::CursorPositionReport => "Cursor Position Report",
AuxiliaryDisplay::Row => "Row",
AuxiliaryDisplay::Column => "Column",
AuxiliaryDisplay::Rows => "Rows",
AuxiliaryDisplay::Columns => "Columns",
AuxiliaryDisplay::CursorPixelPositioning => "Cursor Pixel Positioning",
AuxiliaryDisplay::CursorMode => "Cursor Mode",
AuxiliaryDisplay::CursorEnable => "Cursor Enable",
AuxiliaryDisplay::CursorBlink => "Cursor Blink",
AuxiliaryDisplay::FontReport => "Font Report",
AuxiliaryDisplay::FontData => "Font Data",
AuxiliaryDisplay::CharacterWidth => "Character Width",
AuxiliaryDisplay::CharacterHeight => "Character Height",
AuxiliaryDisplay::CharacterSpacingHorizontal => "Character Spacing Horizontal",
AuxiliaryDisplay::CharacterSpacingVertical => "Character Spacing Vertical",
AuxiliaryDisplay::UnicodeCharacterSet => "Unicode Character Set",
AuxiliaryDisplay::Font7Segment => "Font 7-Segment",
AuxiliaryDisplay::SevenSegmentDirectMap => "7-Segment Direct Map",
AuxiliaryDisplay::Font14Segment => "Font 14-Segment",
AuxiliaryDisplay::One4SegmentDirectMap => "14-Segment Direct Map",
AuxiliaryDisplay::DisplayBrightness => "Display Brightness",
AuxiliaryDisplay::DisplayContrast => "Display Contrast",
AuxiliaryDisplay::CharacterAttribute => "Character Attribute",
AuxiliaryDisplay::AttributeReadback => "Attribute Readback",
AuxiliaryDisplay::AttributeData => "Attribute Data",
AuxiliaryDisplay::CharAttrEnhance => "Char Attr Enhance",
AuxiliaryDisplay::CharAttrUnderline => "Char Attr Underline",
AuxiliaryDisplay::CharAttrBlink => "Char Attr Blink",
AuxiliaryDisplay::BitmapSizeX => "Bitmap Size X",
AuxiliaryDisplay::BitmapSizeY => "Bitmap Size Y",
AuxiliaryDisplay::MaxBlitSize => "Max Blit Size",
AuxiliaryDisplay::BitDepthFormat => "Bit Depth Format",
AuxiliaryDisplay::DisplayOrientation => "Display Orientation",
AuxiliaryDisplay::PaletteReport => "Palette Report",
AuxiliaryDisplay::PaletteDataSize => "Palette Data Size",
AuxiliaryDisplay::PaletteDataOffset => "Palette Data Offset",
AuxiliaryDisplay::PaletteData => "Palette Data",
AuxiliaryDisplay::BlitReport => "Blit Report",
AuxiliaryDisplay::BlitRectangleX1 => "Blit Rectangle X1",
AuxiliaryDisplay::BlitRectangleY1 => "Blit Rectangle Y1",
AuxiliaryDisplay::BlitRectangleX2 => "Blit Rectangle X2",
AuxiliaryDisplay::BlitRectangleY2 => "Blit Rectangle Y2",
AuxiliaryDisplay::BlitData => "Blit Data",
AuxiliaryDisplay::SoftButton => "Soft Button",
AuxiliaryDisplay::SoftButtonID => "Soft Button ID",
AuxiliaryDisplay::SoftButtonSide => "Soft Button Side",
AuxiliaryDisplay::SoftButtonOffset1 => "Soft Button Offset 1",
AuxiliaryDisplay::SoftButtonOffset2 => "Soft Button Offset 2",
AuxiliaryDisplay::SoftButtonReport => "Soft Button Report",
AuxiliaryDisplay::SoftKeys => "Soft Keys",
AuxiliaryDisplay::DisplayDataExtensions => "Display Data Extensions",
AuxiliaryDisplay::CharacterMapping => "Character Mapping",
AuxiliaryDisplay::UnicodeEquivalent => "Unicode Equivalent",
AuxiliaryDisplay::CharacterPageMapping => "Character Page Mapping",
AuxiliaryDisplay::RequestReport => "Request Report",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for AuxiliaryDisplay {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for AuxiliaryDisplay {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for AuxiliaryDisplay {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&AuxiliaryDisplay> for u16 {
fn from(auxiliarydisplay: &AuxiliaryDisplay) -> u16 {
*auxiliarydisplay as u16
}
}
impl From<AuxiliaryDisplay> for u16 {
fn from(auxiliarydisplay: AuxiliaryDisplay) -> u16 {
u16::from(&auxiliarydisplay)
}
}
impl From<&AuxiliaryDisplay> for u32 {
fn from(auxiliarydisplay: &AuxiliaryDisplay) -> u32 {
let up = UsagePage::from(auxiliarydisplay);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(auxiliarydisplay) as u32;
up | id
}
}
impl From<&AuxiliaryDisplay> for UsagePage {
fn from(_: &AuxiliaryDisplay) -> UsagePage {
UsagePage::AuxiliaryDisplay
}
}
impl From<AuxiliaryDisplay> for UsagePage {
fn from(_: AuxiliaryDisplay) -> UsagePage {
UsagePage::AuxiliaryDisplay
}
}
impl From<&AuxiliaryDisplay> for Usage {
fn from(auxiliarydisplay: &AuxiliaryDisplay) -> Usage {
Usage::try_from(u32::from(auxiliarydisplay)).unwrap()
}
}
impl From<AuxiliaryDisplay> for Usage {
fn from(auxiliarydisplay: AuxiliaryDisplay) -> Usage {
Usage::from(&auxiliarydisplay)
}
}
impl TryFrom<u16> for AuxiliaryDisplay {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<AuxiliaryDisplay> {
match usage_id {
1 => Ok(AuxiliaryDisplay::AlphanumericDisplay),
2 => Ok(AuxiliaryDisplay::AuxiliaryDisplay),
32 => Ok(AuxiliaryDisplay::DisplayAttributesReport),
33 => Ok(AuxiliaryDisplay::ASCIICharacterSet),
34 => Ok(AuxiliaryDisplay::DataReadBack),
35 => Ok(AuxiliaryDisplay::FontReadBack),
36 => Ok(AuxiliaryDisplay::DisplayControlReport),
37 => Ok(AuxiliaryDisplay::ClearDisplay),
38 => Ok(AuxiliaryDisplay::DisplayEnable),
39 => Ok(AuxiliaryDisplay::ScreenSaverDelay),
40 => Ok(AuxiliaryDisplay::ScreenSaverEnable),
41 => Ok(AuxiliaryDisplay::VerticalScroll),
42 => Ok(AuxiliaryDisplay::HorizontalScroll),
43 => Ok(AuxiliaryDisplay::CharacterReport),
44 => Ok(AuxiliaryDisplay::DisplayData),
45 => Ok(AuxiliaryDisplay::DisplayStatus),
46 => Ok(AuxiliaryDisplay::StatNotReady),
47 => Ok(AuxiliaryDisplay::StatReady),
48 => Ok(AuxiliaryDisplay::ErrNotaloadablecharacter),
49 => Ok(AuxiliaryDisplay::ErrFontdatacannotberead),
50 => Ok(AuxiliaryDisplay::CursorPositionReport),
51 => Ok(AuxiliaryDisplay::Row),
52 => Ok(AuxiliaryDisplay::Column),
53 => Ok(AuxiliaryDisplay::Rows),
54 => Ok(AuxiliaryDisplay::Columns),
55 => Ok(AuxiliaryDisplay::CursorPixelPositioning),
56 => Ok(AuxiliaryDisplay::CursorMode),
57 => Ok(AuxiliaryDisplay::CursorEnable),
58 => Ok(AuxiliaryDisplay::CursorBlink),
59 => Ok(AuxiliaryDisplay::FontReport),
60 => Ok(AuxiliaryDisplay::FontData),
61 => Ok(AuxiliaryDisplay::CharacterWidth),
62 => Ok(AuxiliaryDisplay::CharacterHeight),
63 => Ok(AuxiliaryDisplay::CharacterSpacingHorizontal),
64 => Ok(AuxiliaryDisplay::CharacterSpacingVertical),
65 => Ok(AuxiliaryDisplay::UnicodeCharacterSet),
66 => Ok(AuxiliaryDisplay::Font7Segment),
67 => Ok(AuxiliaryDisplay::SevenSegmentDirectMap),
68 => Ok(AuxiliaryDisplay::Font14Segment),
69 => Ok(AuxiliaryDisplay::One4SegmentDirectMap),
70 => Ok(AuxiliaryDisplay::DisplayBrightness),
71 => Ok(AuxiliaryDisplay::DisplayContrast),
72 => Ok(AuxiliaryDisplay::CharacterAttribute),
73 => Ok(AuxiliaryDisplay::AttributeReadback),
74 => Ok(AuxiliaryDisplay::AttributeData),
75 => Ok(AuxiliaryDisplay::CharAttrEnhance),
76 => Ok(AuxiliaryDisplay::CharAttrUnderline),
77 => Ok(AuxiliaryDisplay::CharAttrBlink),
128 => Ok(AuxiliaryDisplay::BitmapSizeX),
129 => Ok(AuxiliaryDisplay::BitmapSizeY),
130 => Ok(AuxiliaryDisplay::MaxBlitSize),
131 => Ok(AuxiliaryDisplay::BitDepthFormat),
132 => Ok(AuxiliaryDisplay::DisplayOrientation),
133 => Ok(AuxiliaryDisplay::PaletteReport),
134 => Ok(AuxiliaryDisplay::PaletteDataSize),
135 => Ok(AuxiliaryDisplay::PaletteDataOffset),
136 => Ok(AuxiliaryDisplay::PaletteData),
138 => Ok(AuxiliaryDisplay::BlitReport),
139 => Ok(AuxiliaryDisplay::BlitRectangleX1),
140 => Ok(AuxiliaryDisplay::BlitRectangleY1),
141 => Ok(AuxiliaryDisplay::BlitRectangleX2),
142 => Ok(AuxiliaryDisplay::BlitRectangleY2),
143 => Ok(AuxiliaryDisplay::BlitData),
144 => Ok(AuxiliaryDisplay::SoftButton),
145 => Ok(AuxiliaryDisplay::SoftButtonID),
146 => Ok(AuxiliaryDisplay::SoftButtonSide),
147 => Ok(AuxiliaryDisplay::SoftButtonOffset1),
148 => Ok(AuxiliaryDisplay::SoftButtonOffset2),
149 => Ok(AuxiliaryDisplay::SoftButtonReport),
194 => Ok(AuxiliaryDisplay::SoftKeys),
204 => Ok(AuxiliaryDisplay::DisplayDataExtensions),
207 => Ok(AuxiliaryDisplay::CharacterMapping),
221 => Ok(AuxiliaryDisplay::UnicodeEquivalent),
223 => Ok(AuxiliaryDisplay::CharacterPageMapping),
255 => Ok(AuxiliaryDisplay::RequestReport),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for AuxiliaryDisplay {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum Sensors {
Sensor = 0x1,
Biometric = 0x10,
BiometricHumanPresence = 0x11,
BiometricHumanProximity = 0x12,
BiometricHumanTouch = 0x13,
BiometricBloodPressure = 0x14,
BiometricBodyTemperature = 0x15,
BiometricHeartRate = 0x16,
BiometricHeartRateVariability = 0x17,
BiometricPeripheralOxygenSaturation = 0x18,
BiometricRespiratoryRate = 0x19,
Electrical = 0x20,
ElectricalCapacitance = 0x21,
ElectricalCurrent = 0x22,
ElectricalPower = 0x23,
ElectricalInductance = 0x24,
ElectricalResistance = 0x25,
ElectricalVoltage = 0x26,
ElectricalPotentiometer = 0x27,
ElectricalFrequency = 0x28,
ElectricalPeriod = 0x29,
Environmental = 0x30,
EnvironmentalAtmosphericPressure = 0x31,
EnvironmentalHumidity = 0x32,
EnvironmentalTemperature = 0x33,
EnvironmentalWindDirection = 0x34,
EnvironmentalWindSpeed = 0x35,
EnvironmentalAirQuality = 0x36,
EnvironmentalHeatIndex = 0x37,
EnvironmentalSurfaceTemperature = 0x38,
EnvironmentalVolatileOrganicCompounds = 0x39,
EnvironmentalObjectPresence = 0x3A,
EnvironmentalObjectProximity = 0x3B,
Light = 0x40,
LightAmbientLight = 0x41,
LightConsumerInfrared = 0x42,
LightInfraredLight = 0x43,
LightVisibleLight = 0x44,
LightUltravioletLight = 0x45,
Location = 0x50,
LocationBroadcast = 0x51,
LocationDeadReckoning = 0x52,
LocationGPSGlobalPositioningSystem = 0x53,
LocationLookup = 0x54,
LocationOther = 0x55,
LocationStatic = 0x56,
LocationTriangulation = 0x57,
Mechanical = 0x60,
MechanicalBooleanSwitch = 0x61,
MechanicalBooleanSwitchArray = 0x62,
MechanicalMultivalueSwitch = 0x63,
MechanicalForce = 0x64,
MechanicalPressure = 0x65,
MechanicalStrain = 0x66,
MechanicalWeight = 0x67,
MechanicalHapticVibrator = 0x68,
MechanicalHallEffectSwitch = 0x69,
Motion = 0x70,
MotionAccelerometer1D = 0x71,
MotionAccelerometer2D = 0x72,
MotionAccelerometer3D = 0x73,
MotionGyrometer1D = 0x74,
MotionGyrometer2D = 0x75,
MotionGyrometer3D = 0x76,
MotionMotionDetector = 0x77,
MotionSpeedometer = 0x78,
MotionAccelerometer = 0x79,
MotionGyrometer = 0x7A,
MotionGravityVector = 0x7B,
MotionLinearAccelerometer = 0x7C,
Orientation = 0x80,
OrientationCompass1D = 0x81,
OrientationCompass2D = 0x82,
OrientationCompass3D = 0x83,
OrientationInclinometer1D = 0x84,
OrientationInclinometer2D = 0x85,
OrientationInclinometer3D = 0x86,
OrientationDistance1D = 0x87,
OrientationDistance2D = 0x88,
OrientationDistance3D = 0x89,
OrientationDeviceOrientation = 0x8A,
OrientationCompass = 0x8B,
OrientationInclinometer = 0x8C,
OrientationDistance = 0x8D,
OrientationRelativeOrientation = 0x8E,
OrientationSimpleOrientation = 0x8F,
Scanner = 0x90,
ScannerBarcode = 0x91,
ScannerRFID = 0x92,
ScannerNFC = 0x93,
Time = 0xA0,
TimeAlarmTimer = 0xA1,
TimeRealTimeClock = 0xA2,
PersonalActivity = 0xB0,
PersonalActivityActivityDetection = 0xB1,
PersonalActivityDevicePosition = 0xB2,
PersonalActivityFloorTracker = 0xB3,
PersonalActivityPedometer = 0xB4,
PersonalActivityStepDetection = 0xB5,
OrientationExtended = 0xC0,
OrientationExtendedGeomagneticOrientation = 0xC1,
OrientationExtendedMagnetometer = 0xC2,
Gesture = 0xD0,
GestureChassisFlipGesture = 0xD1,
GestureHingeFoldGesture = 0xD2,
Other = 0xE0,
OtherCustom = 0xE1,
OtherGeneric = 0xE2,
OtherGenericEnumerator = 0xE3,
OtherHingeAngle = 0xE4,
VendorReserved1 = 0xF0,
VendorReserved2 = 0xF1,
VendorReserved3 = 0xF2,
VendorReserved4 = 0xF3,
VendorReserved5 = 0xF4,
VendorReserved6 = 0xF5,
VendorReserved7 = 0xF6,
VendorReserved8 = 0xF7,
VendorReserved9 = 0xF8,
VendorReserved10 = 0xF9,
VendorReserved11 = 0xFA,
VendorReserved12 = 0xFB,
VendorReserved13 = 0xFC,
VendorReserved14 = 0xFD,
VendorReserved15 = 0xFE,
VendorReserved16 = 0xFF,
Event = 0x200,
EventSensorState = 0x201,
EventSensorEvent = 0x202,
Property = 0x300,
PropertyFriendlyName = 0x301,
PropertyPersistentUniqueID = 0x302,
PropertySensorStatus = 0x303,
PropertyMinimumReportInterval = 0x304,
PropertySensorManufacturer = 0x305,
PropertySensorModel = 0x306,
PropertySensorSerialNumber = 0x307,
PropertySensorDescription = 0x308,
PropertySensorConnectionType = 0x309,
PropertySensorDevicePath = 0x30A,
PropertyHardwareRevision = 0x30B,
PropertyFirmwareVersion = 0x30C,
PropertyReleaseDate = 0x30D,
PropertyReportInterval = 0x30E,
PropertyChangeSensitivityAbsolute = 0x30F,
PropertyChangeSensitivityPercentofRange = 0x310,
PropertyChangeSensitivityPercentRelative = 0x311,
PropertyAccuracy = 0x312,
PropertyResolution = 0x313,
PropertyMaximum = 0x314,
PropertyMinimum = 0x315,
PropertyReportingState = 0x316,
PropertySamplingRate = 0x317,
PropertyResponseCurve = 0x318,
PropertyPowerState = 0x319,
PropertyMaximumFIFOEvents = 0x31A,
PropertyReportLatency = 0x31B,
PropertyFlushFIFOEvents = 0x31C,
PropertyMaximumPowerConsumption = 0x31D,
PropertyIsPrimary = 0x31E,
PropertyHumanPresenceDetectionType = 0x31F,
DataFieldLocation = 0x400,
DataFieldAltitudeAntennaSeaLevel = 0x402,
DataFieldDifferentialReferenceStationID = 0x403,
DataFieldAltitudeEllipsoidError = 0x404,
DataFieldAltitudeEllipsoid = 0x405,
DataFieldAltitudeSeaLevelError = 0x406,
DataFieldAltitudeSeaLevel = 0x407,
DataFieldDifferentialGPSDataAge = 0x408,
DataFieldErrorRadius = 0x409,
DataFieldFixQuality = 0x40A,
DataFieldFixType = 0x40B,
DataFieldGeoidalSeparation = 0x40C,
DataFieldGPSOperationMode = 0x40D,
DataFieldGPSSelectionMode = 0x40E,
DataFieldGPSStatus = 0x40F,
DataFieldPositionDilutionofPrecision = 0x410,
DataFieldHorizontalDilutionofPrecision = 0x411,
DataFieldVerticalDilutionofPrecision = 0x412,
DataFieldLatitude = 0x413,
DataFieldLongitude = 0x414,
DataFieldTrueHeading = 0x415,
DataFieldMagneticHeading = 0x416,
DataFieldMagneticVariation = 0x417,
DataFieldSpeed = 0x418,
DataFieldSatellitesinView = 0x419,
DataFieldSatellitesinViewAzimuth = 0x41A,
DataFieldSatellitesinViewElevation = 0x41B,
DataFieldSatellitesinViewIDs = 0x41C,
DataFieldSatellitesinViewPRNs = 0x41D,
DataFieldSatellitesinViewSNRatios = 0x41E,
DataFieldSatellitesUsedCount = 0x41F,
DataFieldSatellitesUsedPRNs = 0x420,
DataFieldNMEASentence = 0x421,
DataFieldAddressLine1 = 0x422,
DataFieldAddressLine2 = 0x423,
DataFieldCity = 0x424,
DataFieldStateorProvince = 0x425,
DataFieldCountryorRegion = 0x426,
DataFieldPostalCode = 0x427,
PropertyLocation = 0x42A,
PropertyLocationDesiredAccuracy = 0x42B,
DataFieldEnvironmental = 0x430,
DataFieldAtmosphericPressure = 0x431,
DataFieldRelativeHumidity = 0x433,
DataFieldTemperature = 0x434,
DataFieldWindDirection = 0x435,
DataFieldWindSpeed = 0x436,
DataFieldAirQualityIndex = 0x437,
DataFieldEquivalentCO2 = 0x438,
DataFieldVolatileOrganicCompoundConcentration = 0x439,
DataFieldObjectPresence = 0x43A,
DataFieldObjectProximityRange = 0x43B,
DataFieldObjectProximityOutofRange = 0x43C,
PropertyEnvironmental = 0x440,
PropertyReferencePressure = 0x441,
DataFieldMotion = 0x450,
DataFieldMotionState = 0x451,
DataFieldAcceleration = 0x452,
DataFieldAccelerationAxisX = 0x453,
DataFieldAccelerationAxisY = 0x454,
DataFieldAccelerationAxisZ = 0x455,
DataFieldAngularVelocity = 0x456,
DataFieldAngularVelocityaboutXAxis = 0x457,
DataFieldAngularVelocityaboutYAxis = 0x458,
DataFieldAngularVelocityaboutZAxis = 0x459,
DataFieldAngularPosition = 0x45A,
DataFieldAngularPositionaboutXAxis = 0x45B,
DataFieldAngularPositionaboutYAxis = 0x45C,
DataFieldAngularPositionaboutZAxis = 0x45D,
DataFieldMotionSpeed = 0x45E,
DataFieldMotionIntensity = 0x45F,
DataFieldOrientation = 0x470,
DataFieldHeading = 0x471,
DataFieldHeadingXAxis = 0x472,
DataFieldHeadingYAxis = 0x473,
DataFieldHeadingZAxis = 0x474,
DataFieldHeadingCompensatedMagneticNorth = 0x475,
DataFieldHeadingCompensatedTrueNorth = 0x476,
DataFieldHeadingMagneticNorth = 0x477,
DataFieldHeadingTrueNorth = 0x478,
DataFieldDistance = 0x479,
DataFieldDistanceXAxis = 0x47A,
DataFieldDistanceYAxis = 0x47B,
DataFieldDistanceZAxis = 0x47C,
DataFieldDistanceOutofRange = 0x47D,
DataFieldTilt = 0x47E,
DataFieldTiltXAxis = 0x47F,
DataFieldTiltYAxis = 0x480,
DataFieldTiltZAxis = 0x481,
DataFieldRotationMatrix = 0x482,
DataFieldQuaternion = 0x483,
DataFieldMagneticFlux = 0x484,
DataFieldMagneticFluxXAxis = 0x485,
DataFieldMagneticFluxYAxis = 0x486,
DataFieldMagneticFluxZAxis = 0x487,
DataFieldMagnetometerAccuracy = 0x488,
DataFieldSimpleOrientationDirection = 0x489,
DataFieldMechanical = 0x490,
DataFieldBooleanSwitchState = 0x491,
DataFieldBooleanSwitchArrayStates = 0x492,
DataFieldMultivalueSwitchValue = 0x493,
DataFieldForce = 0x494,
DataFieldAbsolutePressure = 0x495,
DataFieldGaugePressure = 0x496,
DataFieldStrain = 0x497,
DataFieldWeight = 0x498,
PropertyMechanical = 0x4A0,
PropertyVibrationState = 0x4A1,
PropertyForwardVibrationSpeed = 0x4A2,
PropertyBackwardVibrationSpeed = 0x4A3,
DataFieldBiometric = 0x4B0,
DataFieldHumanPresence = 0x4B1,
DataFieldHumanProximityRange = 0x4B2,
DataFieldHumanProximityOutofRange = 0x4B3,
DataFieldHumanTouchState = 0x4B4,
DataFieldBloodPressure = 0x4B5,
DataFieldBloodPressureDiastolic = 0x4B6,
DataFieldBloodPressureSystolic = 0x4B7,
DataFieldHeartRate = 0x4B8,
DataFieldRestingHeartRate = 0x4B9,
DataFieldHeartbeatInterval = 0x4BA,
DataFieldRespiratoryRate = 0x4BB,
DataFieldSpO2 = 0x4BC,
DataFieldHumanAttentionDetected = 0x4BD,
DataFieldHumanHeadAzimuth = 0x4BE,
DataFieldHumanHeadAltitude = 0x4BF,
DataFieldHumanHeadRoll = 0x4C0,
DataFieldHumanHeadPitch = 0x4C1,
DataFieldHumanHeadYaw = 0x4C2,
DataFieldHumanCorrelationId = 0x4C3,
DataFieldLight = 0x4D0,
DataFieldIlluminance = 0x4D1,
DataFieldColorTemperature = 0x4D2,
DataFieldChromaticity = 0x4D3,
DataFieldChromaticityX = 0x4D4,
DataFieldChromaticityY = 0x4D5,
DataFieldConsumerIRSentenceReceive = 0x4D6,
DataFieldInfraredLight = 0x4D7,
DataFieldRedLight = 0x4D8,
DataFieldGreenLight = 0x4D9,
DataFieldBlueLight = 0x4DA,
DataFieldUltravioletALight = 0x4DB,
DataFieldUltravioletBLight = 0x4DC,
DataFieldUltravioletIndex = 0x4DD,
DataFieldNearInfraredLight = 0x4DE,
PropertyLight = 0x4DF,
PropertyConsumerIRSentenceSend = 0x4E0,
PropertyAutoBrightnessPreferred = 0x4E2,
PropertyAutoColorPreferred = 0x4E3,
DataFieldScanner = 0x4F0,
DataFieldRFIDTag40Bit = 0x4F1,
DataFieldNFCSentenceReceive = 0x4F2,
PropertyScanner = 0x4F8,
PropertyNFCSentenceSend = 0x4F9,
DataFieldElectrical = 0x500,
DataFieldCapacitance = 0x501,
DataFieldCurrent = 0x502,
DataFieldElectricalPower = 0x503,
DataFieldInductance = 0x504,
DataFieldResistance = 0x505,
DataFieldVoltage = 0x506,
DataFieldFrequency = 0x507,
DataFieldPeriod = 0x508,
DataFieldPercentofRange = 0x509,
DataFieldTime = 0x520,
DataFieldYear = 0x521,
DataFieldMonth = 0x522,
DataFieldDay = 0x523,
DataFieldDayofWeek = 0x524,
DataFieldHour = 0x525,
DataFieldMinute = 0x526,
DataFieldSecond = 0x527,
DataFieldMillisecond = 0x528,
DataFieldTimestamp = 0x529,
DataFieldJulianDayofYear = 0x52A,
DataFieldTimeSinceSystemBoot = 0x52B,
PropertyTime = 0x530,
PropertyTimeZoneOffsetfromUTC = 0x531,
PropertyTimeZoneName = 0x532,
PropertyDaylightSavingsTimeObserved = 0x533,
PropertyTimeTrimAdjustment = 0x534,
PropertyArmAlarm = 0x535,
DataFieldCustom = 0x540,
DataFieldCustomUsage = 0x541,
DataFieldCustomBooleanArray = 0x542,
DataFieldCustomValue = 0x543,
DataFieldCustomValue1 = 0x544,
DataFieldCustomValue2 = 0x545,
DataFieldCustomValue3 = 0x546,
DataFieldCustomValue4 = 0x547,
DataFieldCustomValue5 = 0x548,
DataFieldCustomValue6 = 0x549,
DataFieldCustomValue7 = 0x54A,
DataFieldCustomValue8 = 0x54B,
DataFieldCustomValue9 = 0x54C,
DataFieldCustomValue10 = 0x54D,
DataFieldCustomValue11 = 0x54E,
DataFieldCustomValue12 = 0x54F,
DataFieldCustomValue13 = 0x550,
DataFieldCustomValue14 = 0x551,
DataFieldCustomValue15 = 0x552,
DataFieldCustomValue16 = 0x553,
DataFieldCustomValue17 = 0x554,
DataFieldCustomValue18 = 0x555,
DataFieldCustomValue19 = 0x556,
DataFieldCustomValue20 = 0x557,
DataFieldCustomValue21 = 0x558,
DataFieldCustomValue22 = 0x559,
DataFieldCustomValue23 = 0x55A,
DataFieldCustomValue24 = 0x55B,
DataFieldCustomValue25 = 0x55C,
DataFieldCustomValue26 = 0x55D,
DataFieldCustomValue27 = 0x55E,
DataFieldCustomValue28 = 0x55F,
DataFieldGeneric = 0x560,
DataFieldGenericGUIDorPROPERTYKEY = 0x561,
DataFieldGenericCategoryGUID = 0x562,
DataFieldGenericTypeGUID = 0x563,
DataFieldGenericEventPROPERTYKEY = 0x564,
DataFieldGenericPropertyPROPERTYKEY = 0x565,
DataFieldGenericDataFieldPROPERTYKEY = 0x566,
DataFieldGenericEvent = 0x567,
DataFieldGenericProperty = 0x568,
DataFieldGenericDataField = 0x569,
DataFieldEnumeratorTableRowIndex = 0x56A,
DataFieldEnumeratorTableRowCount = 0x56B,
DataFieldGenericGUIDorPROPERTYKEYkind = 0x56C,
DataFieldGenericGUID = 0x56D,
DataFieldGenericPROPERTYKEY = 0x56E,
DataFieldGenericTopLevelCollectionID = 0x56F,
DataFieldGenericReportID = 0x570,
DataFieldGenericReportItemPositionIndex = 0x571,
DataFieldGenericFirmwareVARTYPE = 0x572,
DataFieldGenericUnitofMeasure = 0x573,
DataFieldGenericUnitExponent = 0x574,
DataFieldGenericReportSize = 0x575,
DataFieldGenericReportCount = 0x576,
PropertyGeneric = 0x580,
PropertyEnumeratorTableRowIndex = 0x581,
PropertyEnumeratorTableRowCount = 0x582,
DataFieldPersonalActivity = 0x590,
DataFieldActivityType = 0x591,
DataFieldActivityState = 0x592,
DataFieldDevicePosition = 0x593,
DataFieldStepCount = 0x594,
DataFieldStepCountReset = 0x595,
DataFieldStepDuration = 0x596,
DataFieldStepType = 0x597,
PropertyMinimumActivityDetectionInterval = 0x5A0,
PropertySupportedActivityTypes = 0x5A1,
PropertySubscribedActivityTypes = 0x5A2,
PropertySupportedStepTypes = 0x5A3,
PropertySubscribedStepTypes = 0x5A4,
PropertyFloorHeight = 0x5A5,
DataFieldCustomTypeID = 0x5B0,
PropertyCustom = 0x5C0,
PropertyCustomValue1 = 0x5C1,
PropertyCustomValue2 = 0x5C2,
PropertyCustomValue3 = 0x5C3,
PropertyCustomValue4 = 0x5C4,
PropertyCustomValue5 = 0x5C5,
PropertyCustomValue6 = 0x5C6,
PropertyCustomValue7 = 0x5C7,
PropertyCustomValue8 = 0x5C8,
PropertyCustomValue9 = 0x5C9,
PropertyCustomValue10 = 0x5CA,
PropertyCustomValue11 = 0x5CB,
PropertyCustomValue12 = 0x5CC,
PropertyCustomValue13 = 0x5CD,
PropertyCustomValue14 = 0x5CE,
PropertyCustomValue15 = 0x5CF,
PropertyCustomValue16 = 0x5D0,
DataFieldHinge = 0x5E0,
DataFieldHingeAngle = 0x5E1,
DataFieldGestureSensor = 0x5F0,
DataFieldGestureState = 0x5F1,
DataFieldHingeFoldInitialAngle = 0x5F2,
DataFieldHingeFoldFinalAngle = 0x5F3,
DataFieldHingeFoldContributingPanel = 0x5F4,
DataFieldHingeFoldType = 0x5F5,
SensorStateUndefined = 0x800,
SensorStateReady = 0x801,
SensorStateNotAvailable = 0x802,
SensorStateNoData = 0x803,
SensorStateInitializing = 0x804,
SensorStateAccessDenied = 0x805,
SensorStateError = 0x806,
SensorEventUnknown = 0x810,
SensorEventStateChanged = 0x811,
SensorEventPropertyChanged = 0x812,
SensorEventDataUpdated = 0x813,
SensorEventPollResponse = 0x814,
SensorEventChangeSensitivity = 0x815,
SensorEventRangeMaximumReached = 0x816,
SensorEventRangeMinimumReached = 0x817,
SensorEventHighThresholdCrossUpward = 0x818,
SensorEventHighThresholdCrossDownward = 0x819,
SensorEventLowThresholdCrossUpward = 0x81A,
SensorEventLowThresholdCrossDownward = 0x81B,
SensorEventZeroThresholdCrossUpward = 0x81C,
SensorEventZeroThresholdCrossDownward = 0x81D,
SensorEventPeriodExceeded = 0x81E,
SensorEventFrequencyExceeded = 0x81F,
SensorEventComplexTrigger = 0x820,
ConnectionTypePCIntegrated = 0x830,
ConnectionTypePCAttached = 0x831,
ConnectionTypePCExternal = 0x832,
ReportingStateReportNoEvents = 0x840,
ReportingStateReportAllEvents = 0x841,
ReportingStateReportThresholdEvents = 0x842,
ReportingStateWakeOnNoEvents = 0x843,
ReportingStateWakeOnAllEvents = 0x844,
ReportingStateWakeOnThresholdEvents = 0x845,
ReportingStateAnytime = 0x846,
PowerStateUndefined = 0x850,
PowerStateD0FullPower = 0x851,
PowerStateD1LowPower = 0x852,
PowerStateD2StandbyPowerwithWakeup = 0x853,
PowerStateD3SleepwithWakeup = 0x854,
PowerStateD4PowerOff = 0x855,
AccuracyDefault = 0x860,
AccuracyHigh = 0x861,
AccuracyMedium = 0x862,
AccuracyLow = 0x863,
FixQualityNoFix = 0x870,
FixQualityGPS = 0x871,
FixQualityDGPS = 0x872,
FixTypeNoFix = 0x880,
FixTypeGPSSPSModeFixValid = 0x881,
FixTypeDGPSSPSModeFixValid = 0x882,
FixTypeGPSPPSModeFixValid = 0x883,
FixTypeRealTimeKinematic = 0x884,
FixTypeFloatRTK = 0x885,
FixTypeEstimateddeadreckoned = 0x886,
FixTypeManualInputMode = 0x887,
FixTypeSimulatorMode = 0x888,
GPSOperationModeManual = 0x890,
GPSOperationModeAutomatic = 0x891,
GPSSelectionModeAutonomous = 0x8A0,
GPSSelectionModeDGPS = 0x8A1,
GPSSelectionModeEstimateddeadreckoned = 0x8A2,
GPSSelectionModeManualInput = 0x8A3,
GPSSelectionModeSimulator = 0x8A4,
GPSSelectionModeDataNotValid = 0x8A5,
GPSStatusDataValid = 0x8B0,
GPSStatusDataNotValid = 0x8B1,
DayofWeekSunday = 0x8C0,
DayofWeekMonday = 0x8C1,
DayofWeekTuesday = 0x8C2,
DayofWeekWednesday = 0x8C3,
DayofWeekThursday = 0x8C4,
DayofWeekFriday = 0x8C5,
DayofWeekSaturday = 0x8C6,
KindCategory = 0x8D0,
KindType = 0x8D1,
KindEvent = 0x8D2,
KindProperty = 0x8D3,
KindDataField = 0x8D4,
MagnetometerAccuracyLow = 0x8E0,
MagnetometerAccuracyMedium = 0x8E1,
MagnetometerAccuracyHigh = 0x8E2,
SimpleOrientationDirectionNotRotated = 0x8F0,
SimpleOrientationDirectionRotated90DegreesCCW = 0x8F1,
SimpleOrientationDirectionRotated180DegreesCCW = 0x8F2,
SimpleOrientationDirectionRotated270DegreesCCW = 0x8F3,
SimpleOrientationDirectionFaceUp = 0x8F4,
SimpleOrientationDirectionFaceDown = 0x8F5,
VT_NULL = 0x900,
VT_BOOL = 0x901,
VT_UI1 = 0x902,
VT_I1 = 0x903,
VT_UI2 = 0x904,
VT_I2 = 0x905,
VT_UI4 = 0x906,
VT_I4 = 0x907,
VT_UI8 = 0x908,
VT_I8 = 0x909,
VT_R4 = 0x90A,
VT_R8 = 0x90B,
VT_WSTR = 0x90C,
VT_STR = 0x90D,
VT_CLSID = 0x90E,
VT_VECTORVT_UI1 = 0x90F,
VT_F16E0 = 0x910,
VT_F16E1 = 0x911,
VT_F16E2 = 0x912,
VT_F16E3 = 0x913,
VT_F16E4 = 0x914,
VT_F16E5 = 0x915,
VT_F16E6 = 0x916,
VT_F16E7 = 0x917,
VT_F16E8 = 0x918,
VT_F16E9 = 0x919,
VT_F16EA = 0x91A,
VT_F16EB = 0x91B,
VT_F16EC = 0x91C,
VT_F16ED = 0x91D,
VT_F16EE = 0x91E,
VT_F16EF = 0x91F,
VT_F32E0 = 0x920,
VT_F32E1 = 0x921,
VT_F32E2 = 0x922,
VT_F32E3 = 0x923,
VT_F32E4 = 0x924,
VT_F32E5 = 0x925,
VT_F32E6 = 0x926,
VT_F32E7 = 0x927,
VT_F32E8 = 0x928,
VT_F32E9 = 0x929,
VT_F32EA = 0x92A,
VT_F32EB = 0x92B,
VT_F32EC = 0x92C,
VT_F32ED = 0x92D,
VT_F32EE = 0x92E,
VT_F32EF = 0x92F,
ActivityTypeUnknown = 0x930,
ActivityTypeStationary = 0x931,
ActivityTypeFidgeting = 0x932,
ActivityTypeWalking = 0x933,
ActivityTypeRunning = 0x934,
ActivityTypeInVehicle = 0x935,
ActivityTypeBiking = 0x936,
ActivityTypeIdle = 0x937,
UnitNotSpecified = 0x940,
UnitLux = 0x941,
UnitDegreesKelvin = 0x942,
UnitDegreesCelsius = 0x943,
UnitPascal = 0x944,
UnitNewton = 0x945,
UnitMetersSecond = 0x946,
UnitKilogram = 0x947,
UnitMeter = 0x948,
UnitMetersSecondSecond = 0x949,
UnitFarad = 0x94A,
UnitAmpere = 0x94B,
UnitWatt = 0x94C,
UnitHenry = 0x94D,
UnitOhm = 0x94E,
UnitVolt = 0x94F,
UnitHertz = 0x950,
UnitBar = 0x951,
UnitDegreesAnticlockwise = 0x952,
UnitDegreesClockwise = 0x953,
UnitDegrees = 0x954,
UnitDegreesSecond = 0x955,
UnitDegreesSecondSecond = 0x956,
UnitKnot = 0x957,
UnitPercent = 0x958,
UnitSecond = 0x959,
UnitMillisecond = 0x95A,
UnitG = 0x95B,
UnitBytes = 0x95C,
UnitMilligauss = 0x95D,
UnitBits = 0x95E,
ActivityStateNoStateChange = 0x960,
ActivityStateStartActivity = 0x961,
ActivityStateEndActivity = 0x962,
Exponent0 = 0x970,
Exponent1 = 0x971,
Exponent2 = 0x972,
Exponent3 = 0x973,
Exponent4 = 0x974,
Exponent5 = 0x975,
Exponent6 = 0x976,
Exponent7 = 0x977,
Exponent8 = 0x978,
Exponent9 = 0x979,
ExponentA = 0x97A,
ExponentB = 0x97B,
ExponentC = 0x97C,
ExponentD = 0x97D,
ExponentE = 0x97E,
ExponentF = 0x97F,
DevicePositionUnknown = 0x980,
DevicePositionUnchanged = 0x981,
DevicePositionOnDesk = 0x982,
DevicePositionInHand = 0x983,
DevicePositionMovinginBag = 0x984,
DevicePositionStationaryinBag = 0x985,
StepTypeUnknown = 0x990,
StepTypeWalking = 0x991,
StepTypeRunning = 0x992,
GestureStateUnknown = 0x9A0,
GestureStateStarted = 0x9A1,
GestureStateCompleted = 0x9A2,
GestureStateCancelled = 0x9A3,
HingeFoldContributingPanelUnknown = 0x9B0,
HingeFoldContributingPanelPanel1 = 0x9B1,
HingeFoldContributingPanelPanel2 = 0x9B2,
HingeFoldContributingPanelBoth = 0x9B3,
HingeFoldTypeUnknown = 0x9B4,
HingeFoldTypeIncreasing = 0x9B5,
HingeFoldTypeDecreasing = 0x9B6,
HumanPresenceDetectionTypeVendorDefinedNonBiometric = 0x9C0,
HumanPresenceDetectionTypeVendorDefinedBiometric = 0x9C1,
HumanPresenceDetectionTypeFacialBiometric = 0x9C2,
HumanPresenceDetectionTypeAudioBiometric = 0x9C3,
ModifierChangeSensitivityAbsolute = 0x1000,
ModifierMaximum = 0x2000,
ModifierMinimum = 0x3000,
ModifierAccuracy = 0x4000,
ModifierResolution = 0x5000,
ModifierThresholdHigh = 0x6000,
ModifierThresholdLow = 0x7000,
ModifierCalibrationOffset = 0x8000,
ModifierCalibrationMultiplier = 0x9000,
ModifierReportInterval = 0xA000,
ModifierFrequencyMax = 0xB000,
ModifierPeriodMax = 0xC000,
ModifierChangeSensitivityPercentofRange = 0xD000,
ModifierChangeSensitivityPercentRelative = 0xE000,
ModifierVendorReserved = 0xF000,
}
impl Sensors {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
Sensors::Sensor => "Sensor",
Sensors::Biometric => "Biometric",
Sensors::BiometricHumanPresence => "Biometric: Human Presence",
Sensors::BiometricHumanProximity => "Biometric: Human Proximity",
Sensors::BiometricHumanTouch => "Biometric: Human Touch",
Sensors::BiometricBloodPressure => "Biometric: Blood Pressure",
Sensors::BiometricBodyTemperature => "Biometric: Body Temperature",
Sensors::BiometricHeartRate => "Biometric: Heart Rate",
Sensors::BiometricHeartRateVariability => "Biometric: Heart Rate Variability",
Sensors::BiometricPeripheralOxygenSaturation => {
"Biometric: Peripheral Oxygen Saturation"
}
Sensors::BiometricRespiratoryRate => "Biometric: Respiratory Rate",
Sensors::Electrical => "Electrical",
Sensors::ElectricalCapacitance => "Electrical: Capacitance",
Sensors::ElectricalCurrent => "Electrical: Current",
Sensors::ElectricalPower => "Electrical: Power",
Sensors::ElectricalInductance => "Electrical: Inductance",
Sensors::ElectricalResistance => "Electrical: Resistance",
Sensors::ElectricalVoltage => "Electrical: Voltage",
Sensors::ElectricalPotentiometer => "Electrical: Potentiometer",
Sensors::ElectricalFrequency => "Electrical: Frequency",
Sensors::ElectricalPeriod => "Electrical: Period",
Sensors::Environmental => "Environmental",
Sensors::EnvironmentalAtmosphericPressure => "Environmental: Atmospheric Pressure",
Sensors::EnvironmentalHumidity => "Environmental: Humidity",
Sensors::EnvironmentalTemperature => "Environmental: Temperature",
Sensors::EnvironmentalWindDirection => "Environmental: Wind Direction",
Sensors::EnvironmentalWindSpeed => "Environmental: Wind Speed",
Sensors::EnvironmentalAirQuality => "Environmental: Air Quality",
Sensors::EnvironmentalHeatIndex => "Environmental: Heat Index",
Sensors::EnvironmentalSurfaceTemperature => "Environmental: Surface Temperature",
Sensors::EnvironmentalVolatileOrganicCompounds => {
"Environmental: Volatile Organic Compounds"
}
Sensors::EnvironmentalObjectPresence => "Environmental: Object Presence",
Sensors::EnvironmentalObjectProximity => "Environmental: Object Proximity",
Sensors::Light => "Light",
Sensors::LightAmbientLight => "Light: Ambient Light",
Sensors::LightConsumerInfrared => "Light: Consumer Infrared",
Sensors::LightInfraredLight => "Light: Infrared Light",
Sensors::LightVisibleLight => "Light: Visible Light",
Sensors::LightUltravioletLight => "Light: Ultraviolet Light",
Sensors::Location => "Location",
Sensors::LocationBroadcast => "Location: Broadcast",
Sensors::LocationDeadReckoning => "Location: Dead Reckoning",
Sensors::LocationGPSGlobalPositioningSystem => {
"Location: GPS (Global Positioning System)"
}
Sensors::LocationLookup => "Location: Lookup",
Sensors::LocationOther => "Location: Other",
Sensors::LocationStatic => "Location: Static",
Sensors::LocationTriangulation => "Location: Triangulation",
Sensors::Mechanical => "Mechanical",
Sensors::MechanicalBooleanSwitch => "Mechanical: Boolean Switch",
Sensors::MechanicalBooleanSwitchArray => "Mechanical: Boolean Switch Array",
Sensors::MechanicalMultivalueSwitch => "Mechanical: Multivalue Switch",
Sensors::MechanicalForce => "Mechanical: Force",
Sensors::MechanicalPressure => "Mechanical: Pressure",
Sensors::MechanicalStrain => "Mechanical: Strain",
Sensors::MechanicalWeight => "Mechanical: Weight",
Sensors::MechanicalHapticVibrator => "Mechanical: Haptic Vibrator",
Sensors::MechanicalHallEffectSwitch => "Mechanical: Hall Effect Switch",
Sensors::Motion => "Motion",
Sensors::MotionAccelerometer1D => "Motion: Accelerometer 1D",
Sensors::MotionAccelerometer2D => "Motion: Accelerometer 2D",
Sensors::MotionAccelerometer3D => "Motion: Accelerometer 3D",
Sensors::MotionGyrometer1D => "Motion: Gyrometer 1D",
Sensors::MotionGyrometer2D => "Motion: Gyrometer 2D",
Sensors::MotionGyrometer3D => "Motion: Gyrometer 3D",
Sensors::MotionMotionDetector => "Motion: Motion Detector",
Sensors::MotionSpeedometer => "Motion: Speedometer",
Sensors::MotionAccelerometer => "Motion: Accelerometer",
Sensors::MotionGyrometer => "Motion: Gyrometer",
Sensors::MotionGravityVector => "Motion: Gravity Vector",
Sensors::MotionLinearAccelerometer => "Motion: Linear Accelerometer",
Sensors::Orientation => "Orientation",
Sensors::OrientationCompass1D => "Orientation: Compass 1D",
Sensors::OrientationCompass2D => "Orientation: Compass 2D",
Sensors::OrientationCompass3D => "Orientation: Compass 3D",
Sensors::OrientationInclinometer1D => "Orientation: Inclinometer 1D",
Sensors::OrientationInclinometer2D => "Orientation: Inclinometer 2D",
Sensors::OrientationInclinometer3D => "Orientation: Inclinometer 3D",
Sensors::OrientationDistance1D => "Orientation: Distance 1D",
Sensors::OrientationDistance2D => "Orientation: Distance 2D",
Sensors::OrientationDistance3D => "Orientation: Distance 3D",
Sensors::OrientationDeviceOrientation => "Orientation: Device Orientation",
Sensors::OrientationCompass => "Orientation: Compass",
Sensors::OrientationInclinometer => "Orientation: Inclinometer",
Sensors::OrientationDistance => "Orientation: Distance",
Sensors::OrientationRelativeOrientation => "Orientation: Relative Orientation",
Sensors::OrientationSimpleOrientation => "Orientation: Simple Orientation",
Sensors::Scanner => "Scanner",
Sensors::ScannerBarcode => "Scanner: Barcode",
Sensors::ScannerRFID => "Scanner: RFID",
Sensors::ScannerNFC => "Scanner: NFC",
Sensors::Time => "Time",
Sensors::TimeAlarmTimer => "Time: Alarm Timer",
Sensors::TimeRealTimeClock => "Time: Real Time Clock",
Sensors::PersonalActivity => "Personal Activity",
Sensors::PersonalActivityActivityDetection => "Personal Activity: Activity Detection",
Sensors::PersonalActivityDevicePosition => "Personal Activity: Device Position",
Sensors::PersonalActivityFloorTracker => "Personal Activity: Floor Tracker",
Sensors::PersonalActivityPedometer => "Personal Activity: Pedometer",
Sensors::PersonalActivityStepDetection => "Personal Activity: Step Detection",
Sensors::OrientationExtended => "Orientation Extended",
Sensors::OrientationExtendedGeomagneticOrientation => {
"Orientation Extended: Geomagnetic Orientation"
}
Sensors::OrientationExtendedMagnetometer => "Orientation Extended: Magnetometer",
Sensors::Gesture => "Gesture",
Sensors::GestureChassisFlipGesture => "Gesture: Chassis Flip Gesture",
Sensors::GestureHingeFoldGesture => "Gesture: Hinge Fold Gesture",
Sensors::Other => "Other",
Sensors::OtherCustom => "Other: Custom",
Sensors::OtherGeneric => "Other: Generic",
Sensors::OtherGenericEnumerator => "Other: Generic Enumerator",
Sensors::OtherHingeAngle => "Other: Hinge Angle",
Sensors::VendorReserved1 => "Vendor Reserved 1",
Sensors::VendorReserved2 => "Vendor Reserved 2",
Sensors::VendorReserved3 => "Vendor Reserved 3",
Sensors::VendorReserved4 => "Vendor Reserved 4",
Sensors::VendorReserved5 => "Vendor Reserved 5",
Sensors::VendorReserved6 => "Vendor Reserved 6",
Sensors::VendorReserved7 => "Vendor Reserved 7",
Sensors::VendorReserved8 => "Vendor Reserved 8",
Sensors::VendorReserved9 => "Vendor Reserved 9",
Sensors::VendorReserved10 => "Vendor Reserved 10",
Sensors::VendorReserved11 => "Vendor Reserved 11",
Sensors::VendorReserved12 => "Vendor Reserved 12",
Sensors::VendorReserved13 => "Vendor Reserved 13",
Sensors::VendorReserved14 => "Vendor Reserved 14",
Sensors::VendorReserved15 => "Vendor Reserved 15",
Sensors::VendorReserved16 => "Vendor Reserved 16",
Sensors::Event => "Event",
Sensors::EventSensorState => "Event: Sensor State",
Sensors::EventSensorEvent => "Event: Sensor Event",
Sensors::Property => "Property",
Sensors::PropertyFriendlyName => "Property: Friendly Name",
Sensors::PropertyPersistentUniqueID => "Property: Persistent Unique ID",
Sensors::PropertySensorStatus => "Property: Sensor Status",
Sensors::PropertyMinimumReportInterval => "Property: Minimum Report Interval",
Sensors::PropertySensorManufacturer => "Property: Sensor Manufacturer",
Sensors::PropertySensorModel => "Property: Sensor Model",
Sensors::PropertySensorSerialNumber => "Property: Sensor Serial Number",
Sensors::PropertySensorDescription => "Property: Sensor Description",
Sensors::PropertySensorConnectionType => "Property: Sensor Connection Type",
Sensors::PropertySensorDevicePath => "Property: Sensor Device Path",
Sensors::PropertyHardwareRevision => "Property: Hardware Revision",
Sensors::PropertyFirmwareVersion => "Property: Firmware Version",
Sensors::PropertyReleaseDate => "Property: Release Date",
Sensors::PropertyReportInterval => "Property: Report Interval",
Sensors::PropertyChangeSensitivityAbsolute => "Property: Change Sensitivity Absolute",
Sensors::PropertyChangeSensitivityPercentofRange => {
"Property: Change Sensitivity Percent of Range"
}
Sensors::PropertyChangeSensitivityPercentRelative => {
"Property: Change Sensitivity Percent Relative"
}
Sensors::PropertyAccuracy => "Property: Accuracy",
Sensors::PropertyResolution => "Property: Resolution",
Sensors::PropertyMaximum => "Property: Maximum",
Sensors::PropertyMinimum => "Property: Minimum",
Sensors::PropertyReportingState => "Property: Reporting State",
Sensors::PropertySamplingRate => "Property: Sampling Rate",
Sensors::PropertyResponseCurve => "Property: Response Curve",
Sensors::PropertyPowerState => "Property: Power State",
Sensors::PropertyMaximumFIFOEvents => "Property: Maximum FIFO Events",
Sensors::PropertyReportLatency => "Property: Report Latency",
Sensors::PropertyFlushFIFOEvents => "Property: Flush FIFO Events",
Sensors::PropertyMaximumPowerConsumption => "Property: Maximum Power Consumption",
Sensors::PropertyIsPrimary => "Property: Is Primary",
Sensors::PropertyHumanPresenceDetectionType => {
"Property: Human Presence Detection Type"
}
Sensors::DataFieldLocation => "Data Field: Location",
Sensors::DataFieldAltitudeAntennaSeaLevel => "Data Field: Altitude Antenna Sea Level",
Sensors::DataFieldDifferentialReferenceStationID => {
"Data Field: Differential Reference Station ID"
}
Sensors::DataFieldAltitudeEllipsoidError => "Data Field: Altitude Ellipsoid Error",
Sensors::DataFieldAltitudeEllipsoid => "Data Field: Altitude Ellipsoid",
Sensors::DataFieldAltitudeSeaLevelError => "Data Field: Altitude Sea Level Error",
Sensors::DataFieldAltitudeSeaLevel => "Data Field: Altitude Sea Level",
Sensors::DataFieldDifferentialGPSDataAge => "Data Field: Differential GPS Data Age",
Sensors::DataFieldErrorRadius => "Data Field: Error Radius",
Sensors::DataFieldFixQuality => "Data Field: Fix Quality",
Sensors::DataFieldFixType => "Data Field: Fix Type",
Sensors::DataFieldGeoidalSeparation => "Data Field: Geoidal Separation",
Sensors::DataFieldGPSOperationMode => "Data Field: GPS Operation Mode",
Sensors::DataFieldGPSSelectionMode => "Data Field: GPS Selection Mode",
Sensors::DataFieldGPSStatus => "Data Field: GPS Status",
Sensors::DataFieldPositionDilutionofPrecision => {
"Data Field: Position Dilution of Precision"
}
Sensors::DataFieldHorizontalDilutionofPrecision => {
"Data Field: Horizontal Dilution of Precision"
}
Sensors::DataFieldVerticalDilutionofPrecision => {
"Data Field: Vertical Dilution of Precision"
}
Sensors::DataFieldLatitude => "Data Field: Latitude",
Sensors::DataFieldLongitude => "Data Field: Longitude",
Sensors::DataFieldTrueHeading => "Data Field: True Heading",
Sensors::DataFieldMagneticHeading => "Data Field: Magnetic Heading",
Sensors::DataFieldMagneticVariation => "Data Field: Magnetic Variation",
Sensors::DataFieldSpeed => "Data Field: Speed",
Sensors::DataFieldSatellitesinView => "Data Field: Satellites in View",
Sensors::DataFieldSatellitesinViewAzimuth => "Data Field: Satellites in View Azimuth",
Sensors::DataFieldSatellitesinViewElevation => {
"Data Field: Satellites in View Elevation"
}
Sensors::DataFieldSatellitesinViewIDs => "Data Field: Satellites in View IDs",
Sensors::DataFieldSatellitesinViewPRNs => "Data Field: Satellites in View PRNs",
Sensors::DataFieldSatellitesinViewSNRatios => {
"Data Field: Satellites in View S/N Ratios"
}
Sensors::DataFieldSatellitesUsedCount => "Data Field: Satellites Used Count",
Sensors::DataFieldSatellitesUsedPRNs => "Data Field: Satellites Used PRNs",
Sensors::DataFieldNMEASentence => "Data Field: NMEA Sentence",
Sensors::DataFieldAddressLine1 => "Data Field: Address Line 1",
Sensors::DataFieldAddressLine2 => "Data Field: Address Line 2",
Sensors::DataFieldCity => "Data Field: City",
Sensors::DataFieldStateorProvince => "Data Field: State or Province",
Sensors::DataFieldCountryorRegion => "Data Field: Country or Region",
Sensors::DataFieldPostalCode => "Data Field: Postal Code",
Sensors::PropertyLocation => "Property: Location",
Sensors::PropertyLocationDesiredAccuracy => "Property: Location Desired Accuracy",
Sensors::DataFieldEnvironmental => "Data Field: Environmental",
Sensors::DataFieldAtmosphericPressure => "Data Field: Atmospheric Pressure",
Sensors::DataFieldRelativeHumidity => "Data Field: Relative Humidity",
Sensors::DataFieldTemperature => "Data Field: Temperature",
Sensors::DataFieldWindDirection => "Data Field: Wind Direction",
Sensors::DataFieldWindSpeed => "Data Field: Wind Speed",
Sensors::DataFieldAirQualityIndex => "Data Field: Air Quality Index",
Sensors::DataFieldEquivalentCO2 => "Data Field: Equivalent CO2",
Sensors::DataFieldVolatileOrganicCompoundConcentration => {
"Data Field: Volatile Organic Compound Concentration"
}
Sensors::DataFieldObjectPresence => "Data Field: Object Presence",
Sensors::DataFieldObjectProximityRange => "Data Field: Object Proximity Range",
Sensors::DataFieldObjectProximityOutofRange => {
"Data Field: Object Proximity Out of Range"
}
Sensors::PropertyEnvironmental => "Property: Environmental",
Sensors::PropertyReferencePressure => "Property: Reference Pressure",
Sensors::DataFieldMotion => "Data Field: Motion",
Sensors::DataFieldMotionState => "Data Field: Motion State",
Sensors::DataFieldAcceleration => "Data Field: Acceleration",
Sensors::DataFieldAccelerationAxisX => "Data Field: Acceleration Axis X",
Sensors::DataFieldAccelerationAxisY => "Data Field: Acceleration Axis Y",
Sensors::DataFieldAccelerationAxisZ => "Data Field: Acceleration Axis Z",
Sensors::DataFieldAngularVelocity => "Data Field: Angular Velocity",
Sensors::DataFieldAngularVelocityaboutXAxis => {
"Data Field: Angular Velocity about X Axis"
}
Sensors::DataFieldAngularVelocityaboutYAxis => {
"Data Field: Angular Velocity about Y Axis"
}
Sensors::DataFieldAngularVelocityaboutZAxis => {
"Data Field: Angular Velocity about Z Axis"
}
Sensors::DataFieldAngularPosition => "Data Field: Angular Position",
Sensors::DataFieldAngularPositionaboutXAxis => {
"Data Field: Angular Position about X Axis"
}
Sensors::DataFieldAngularPositionaboutYAxis => {
"Data Field: Angular Position about Y Axis"
}
Sensors::DataFieldAngularPositionaboutZAxis => {
"Data Field: Angular Position about Z Axis"
}
Sensors::DataFieldMotionSpeed => "Data Field: Motion Speed",
Sensors::DataFieldMotionIntensity => "Data Field: Motion Intensity",
Sensors::DataFieldOrientation => "Data Field: Orientation",
Sensors::DataFieldHeading => "Data Field: Heading",
Sensors::DataFieldHeadingXAxis => "Data Field: Heading X Axis",
Sensors::DataFieldHeadingYAxis => "Data Field: Heading Y Axis",
Sensors::DataFieldHeadingZAxis => "Data Field: Heading Z Axis",
Sensors::DataFieldHeadingCompensatedMagneticNorth => {
"Data Field: Heading Compensated Magnetic North"
}
Sensors::DataFieldHeadingCompensatedTrueNorth => {
"Data Field: Heading Compensated True North"
}
Sensors::DataFieldHeadingMagneticNorth => "Data Field: Heading Magnetic North",
Sensors::DataFieldHeadingTrueNorth => "Data Field: Heading True North",
Sensors::DataFieldDistance => "Data Field: Distance",
Sensors::DataFieldDistanceXAxis => "Data Field: Distance X Axis",
Sensors::DataFieldDistanceYAxis => "Data Field: Distance Y Axis",
Sensors::DataFieldDistanceZAxis => "Data Field: Distance Z Axis",
Sensors::DataFieldDistanceOutofRange => "Data Field: Distance Out-of-Range",
Sensors::DataFieldTilt => "Data Field: Tilt",
Sensors::DataFieldTiltXAxis => "Data Field: Tilt X Axis",
Sensors::DataFieldTiltYAxis => "Data Field: Tilt Y Axis",
Sensors::DataFieldTiltZAxis => "Data Field: Tilt Z Axis",
Sensors::DataFieldRotationMatrix => "Data Field: Rotation Matrix",
Sensors::DataFieldQuaternion => "Data Field: Quaternion",
Sensors::DataFieldMagneticFlux => "Data Field: Magnetic Flux",
Sensors::DataFieldMagneticFluxXAxis => "Data Field: Magnetic Flux X Axis",
Sensors::DataFieldMagneticFluxYAxis => "Data Field: Magnetic Flux Y Axis",
Sensors::DataFieldMagneticFluxZAxis => "Data Field: Magnetic Flux Z Axis",
Sensors::DataFieldMagnetometerAccuracy => "Data Field: Magnetometer Accuracy",
Sensors::DataFieldSimpleOrientationDirection => {
"Data Field: Simple Orientation Direction"
}
Sensors::DataFieldMechanical => "Data Field: Mechanical",
Sensors::DataFieldBooleanSwitchState => "Data Field: Boolean Switch State",
Sensors::DataFieldBooleanSwitchArrayStates => "Data Field: Boolean Switch Array States",
Sensors::DataFieldMultivalueSwitchValue => "Data Field: Multivalue Switch Value",
Sensors::DataFieldForce => "Data Field: Force",
Sensors::DataFieldAbsolutePressure => "Data Field: Absolute Pressure",
Sensors::DataFieldGaugePressure => "Data Field: Gauge Pressure",
Sensors::DataFieldStrain => "Data Field: Strain",
Sensors::DataFieldWeight => "Data Field: Weight",
Sensors::PropertyMechanical => "Property: Mechanical",
Sensors::PropertyVibrationState => "Property: Vibration State",
Sensors::PropertyForwardVibrationSpeed => "Property: Forward Vibration Speed",
Sensors::PropertyBackwardVibrationSpeed => "Property: Backward Vibration Speed",
Sensors::DataFieldBiometric => "Data Field: Biometric",
Sensors::DataFieldHumanPresence => "Data Field: Human Presence",
Sensors::DataFieldHumanProximityRange => "Data Field: Human Proximity Range",
Sensors::DataFieldHumanProximityOutofRange => {
"Data Field: Human Proximity Out of Range"
}
Sensors::DataFieldHumanTouchState => "Data Field: Human Touch State",
Sensors::DataFieldBloodPressure => "Data Field: Blood Pressure",
Sensors::DataFieldBloodPressureDiastolic => "Data Field: Blood Pressure Diastolic",
Sensors::DataFieldBloodPressureSystolic => "Data Field: Blood Pressure Systolic",
Sensors::DataFieldHeartRate => "Data Field: Heart Rate",
Sensors::DataFieldRestingHeartRate => "Data Field: Resting Heart Rate",
Sensors::DataFieldHeartbeatInterval => "Data Field: Heartbeat Interval",
Sensors::DataFieldRespiratoryRate => "Data Field: Respiratory Rate",
Sensors::DataFieldSpO2 => "Data Field: SpO2",
Sensors::DataFieldHumanAttentionDetected => "Data Field: Human Attention Detected",
Sensors::DataFieldHumanHeadAzimuth => "Data Field: Human Head Azimuth",
Sensors::DataFieldHumanHeadAltitude => "Data Field: Human Head Altitude",
Sensors::DataFieldHumanHeadRoll => "Data Field: Human Head Roll",
Sensors::DataFieldHumanHeadPitch => "Data Field: Human Head Pitch",
Sensors::DataFieldHumanHeadYaw => "Data Field: Human Head Yaw",
Sensors::DataFieldHumanCorrelationId => "Data Field: Human Correlation Id",
Sensors::DataFieldLight => "Data Field: Light",
Sensors::DataFieldIlluminance => "Data Field: Illuminance",
Sensors::DataFieldColorTemperature => "Data Field: Color Temperature",
Sensors::DataFieldChromaticity => "Data Field: Chromaticity",
Sensors::DataFieldChromaticityX => "Data Field: Chromaticity X",
Sensors::DataFieldChromaticityY => "Data Field: Chromaticity Y",
Sensors::DataFieldConsumerIRSentenceReceive => {
"Data Field: Consumer IR Sentence Receive"
}
Sensors::DataFieldInfraredLight => "Data Field: Infrared Light",
Sensors::DataFieldRedLight => "Data Field: Red Light",
Sensors::DataFieldGreenLight => "Data Field: Green Light",
Sensors::DataFieldBlueLight => "Data Field: Blue Light",
Sensors::DataFieldUltravioletALight => "Data Field: Ultraviolet A Light",
Sensors::DataFieldUltravioletBLight => "Data Field: Ultraviolet B Light",
Sensors::DataFieldUltravioletIndex => "Data Field: Ultraviolet Index",
Sensors::DataFieldNearInfraredLight => "Data Field: Near Infrared Light",
Sensors::PropertyLight => "Property: Light",
Sensors::PropertyConsumerIRSentenceSend => "Property: Consumer IR Sentence Send",
Sensors::PropertyAutoBrightnessPreferred => "Property: Auto Brightness Preferred",
Sensors::PropertyAutoColorPreferred => "Property: Auto Color Preferred",
Sensors::DataFieldScanner => "Data Field: Scanner",
Sensors::DataFieldRFIDTag40Bit => "Data Field: RFID Tag 40 Bit",
Sensors::DataFieldNFCSentenceReceive => "Data Field: NFC Sentence Receive",
Sensors::PropertyScanner => "Property: Scanner",
Sensors::PropertyNFCSentenceSend => "Property: NFC Sentence Send",
Sensors::DataFieldElectrical => "Data Field: Electrical",
Sensors::DataFieldCapacitance => "Data Field: Capacitance",
Sensors::DataFieldCurrent => "Data Field: Current",
Sensors::DataFieldElectricalPower => "Data Field: Electrical Power",
Sensors::DataFieldInductance => "Data Field: Inductance",
Sensors::DataFieldResistance => "Data Field: Resistance",
Sensors::DataFieldVoltage => "Data Field: Voltage",
Sensors::DataFieldFrequency => "Data Field: Frequency",
Sensors::DataFieldPeriod => "Data Field: Period",
Sensors::DataFieldPercentofRange => "Data Field: Percent of Range",
Sensors::DataFieldTime => "Data Field: Time",
Sensors::DataFieldYear => "Data Field: Year",
Sensors::DataFieldMonth => "Data Field: Month",
Sensors::DataFieldDay => "Data Field: Day",
Sensors::DataFieldDayofWeek => "Data Field: Day of Week",
Sensors::DataFieldHour => "Data Field: Hour",
Sensors::DataFieldMinute => "Data Field: Minute",
Sensors::DataFieldSecond => "Data Field: Second",
Sensors::DataFieldMillisecond => "Data Field: Millisecond",
Sensors::DataFieldTimestamp => "Data Field: Timestamp",
Sensors::DataFieldJulianDayofYear => "Data Field: Julian Day of Year",
Sensors::DataFieldTimeSinceSystemBoot => "Data Field: Time Since System Boot",
Sensors::PropertyTime => "Property: Time",
Sensors::PropertyTimeZoneOffsetfromUTC => "Property: Time Zone Offset from UTC",
Sensors::PropertyTimeZoneName => "Property: Time Zone Name",
Sensors::PropertyDaylightSavingsTimeObserved => {
"Property: Daylight Savings Time Observed"
}
Sensors::PropertyTimeTrimAdjustment => "Property: Time Trim Adjustment",
Sensors::PropertyArmAlarm => "Property: Arm Alarm",
Sensors::DataFieldCustom => "Data Field: Custom",
Sensors::DataFieldCustomUsage => "Data Field: Custom Usage",
Sensors::DataFieldCustomBooleanArray => "Data Field: Custom Boolean Array",
Sensors::DataFieldCustomValue => "Data Field: Custom Value",
Sensors::DataFieldCustomValue1 => "Data Field: Custom Value 1",
Sensors::DataFieldCustomValue2 => "Data Field: Custom Value 2",
Sensors::DataFieldCustomValue3 => "Data Field: Custom Value 3",
Sensors::DataFieldCustomValue4 => "Data Field: Custom Value 4",
Sensors::DataFieldCustomValue5 => "Data Field: Custom Value 5",
Sensors::DataFieldCustomValue6 => "Data Field: Custom Value 6",
Sensors::DataFieldCustomValue7 => "Data Field: Custom Value 7",
Sensors::DataFieldCustomValue8 => "Data Field: Custom Value 8",
Sensors::DataFieldCustomValue9 => "Data Field: Custom Value 9",
Sensors::DataFieldCustomValue10 => "Data Field: Custom Value 10",
Sensors::DataFieldCustomValue11 => "Data Field: Custom Value 11",
Sensors::DataFieldCustomValue12 => "Data Field: Custom Value 12",
Sensors::DataFieldCustomValue13 => "Data Field: Custom Value 13",
Sensors::DataFieldCustomValue14 => "Data Field: Custom Value 14",
Sensors::DataFieldCustomValue15 => "Data Field: Custom Value 15",
Sensors::DataFieldCustomValue16 => "Data Field: Custom Value 16",
Sensors::DataFieldCustomValue17 => "Data Field: Custom Value 17",
Sensors::DataFieldCustomValue18 => "Data Field: Custom Value 18",
Sensors::DataFieldCustomValue19 => "Data Field: Custom Value 19",
Sensors::DataFieldCustomValue20 => "Data Field: Custom Value 20",
Sensors::DataFieldCustomValue21 => "Data Field: Custom Value 21",
Sensors::DataFieldCustomValue22 => "Data Field: Custom Value 22",
Sensors::DataFieldCustomValue23 => "Data Field: Custom Value 23",
Sensors::DataFieldCustomValue24 => "Data Field: Custom Value 24",
Sensors::DataFieldCustomValue25 => "Data Field: Custom Value 25",
Sensors::DataFieldCustomValue26 => "Data Field: Custom Value 26",
Sensors::DataFieldCustomValue27 => "Data Field: Custom Value 27",
Sensors::DataFieldCustomValue28 => "Data Field: Custom Value 28",
Sensors::DataFieldGeneric => "Data Field: Generic",
Sensors::DataFieldGenericGUIDorPROPERTYKEY => "Data Field: Generic GUID or PROPERTYKEY",
Sensors::DataFieldGenericCategoryGUID => "Data Field: Generic Category GUID",
Sensors::DataFieldGenericTypeGUID => "Data Field: Generic Type GUID",
Sensors::DataFieldGenericEventPROPERTYKEY => "Data Field: Generic Event PROPERTYKEY",
Sensors::DataFieldGenericPropertyPROPERTYKEY => {
"Data Field: Generic Property PROPERTYKEY"
}
Sensors::DataFieldGenericDataFieldPROPERTYKEY => {
"Data Field: Generic Data Field PROPERTYKEY"
}
Sensors::DataFieldGenericEvent => "Data Field: Generic Event",
Sensors::DataFieldGenericProperty => "Data Field: Generic Property",
Sensors::DataFieldGenericDataField => "Data Field: Generic Data Field",
Sensors::DataFieldEnumeratorTableRowIndex => "Data Field: Enumerator Table Row Index",
Sensors::DataFieldEnumeratorTableRowCount => "Data Field: Enumerator Table Row Count",
Sensors::DataFieldGenericGUIDorPROPERTYKEYkind => {
"Data Field: Generic GUID or PROPERTYKEY kind"
}
Sensors::DataFieldGenericGUID => "Data Field: Generic GUID",
Sensors::DataFieldGenericPROPERTYKEY => "Data Field: Generic PROPERTYKEY",
Sensors::DataFieldGenericTopLevelCollectionID => {
"Data Field: Generic Top Level Collection ID"
}
Sensors::DataFieldGenericReportID => "Data Field: Generic Report ID",
Sensors::DataFieldGenericReportItemPositionIndex => {
"Data Field: Generic Report Item Position Index"
}
Sensors::DataFieldGenericFirmwareVARTYPE => "Data Field: Generic Firmware VARTYPE",
Sensors::DataFieldGenericUnitofMeasure => "Data Field: Generic Unit of Measure",
Sensors::DataFieldGenericUnitExponent => "Data Field: Generic Unit Exponent",
Sensors::DataFieldGenericReportSize => "Data Field: Generic Report Size",
Sensors::DataFieldGenericReportCount => "Data Field: Generic Report Count",
Sensors::PropertyGeneric => "Property: Generic",
Sensors::PropertyEnumeratorTableRowIndex => "Property: Enumerator Table Row Index",
Sensors::PropertyEnumeratorTableRowCount => "Property: Enumerator Table Row Count",
Sensors::DataFieldPersonalActivity => "Data Field: Personal Activity",
Sensors::DataFieldActivityType => "Data Field: Activity Type",
Sensors::DataFieldActivityState => "Data Field: Activity State",
Sensors::DataFieldDevicePosition => "Data Field: Device Position",
Sensors::DataFieldStepCount => "Data Field: Step Count",
Sensors::DataFieldStepCountReset => "Data Field: Step Count Reset",
Sensors::DataFieldStepDuration => "Data Field: Step Duration",
Sensors::DataFieldStepType => "Data Field: Step Type",
Sensors::PropertyMinimumActivityDetectionInterval => {
"Property: Minimum Activity Detection Interval"
}
Sensors::PropertySupportedActivityTypes => "Property: Supported Activity Types",
Sensors::PropertySubscribedActivityTypes => "Property: Subscribed Activity Types",
Sensors::PropertySupportedStepTypes => "Property: Supported Step Types",
Sensors::PropertySubscribedStepTypes => "Property: Subscribed Step Types",
Sensors::PropertyFloorHeight => "Property: Floor Height",
Sensors::DataFieldCustomTypeID => "Data Field: Custom Type ID",
Sensors::PropertyCustom => "Property: Custom",
Sensors::PropertyCustomValue1 => "Property: Custom Value 1",
Sensors::PropertyCustomValue2 => "Property: Custom Value 2",
Sensors::PropertyCustomValue3 => "Property: Custom Value 3",
Sensors::PropertyCustomValue4 => "Property: Custom Value 4",
Sensors::PropertyCustomValue5 => "Property: Custom Value 5",
Sensors::PropertyCustomValue6 => "Property: Custom Value 6",
Sensors::PropertyCustomValue7 => "Property: Custom Value 7",
Sensors::PropertyCustomValue8 => "Property: Custom Value 8",
Sensors::PropertyCustomValue9 => "Property: Custom Value 9",
Sensors::PropertyCustomValue10 => "Property: Custom Value 10",
Sensors::PropertyCustomValue11 => "Property: Custom Value 11",
Sensors::PropertyCustomValue12 => "Property: Custom Value 12",
Sensors::PropertyCustomValue13 => "Property: Custom Value 13",
Sensors::PropertyCustomValue14 => "Property: Custom Value 14",
Sensors::PropertyCustomValue15 => "Property: Custom Value 15",
Sensors::PropertyCustomValue16 => "Property: Custom Value 16",
Sensors::DataFieldHinge => "Data Field: Hinge",
Sensors::DataFieldHingeAngle => "Data Field: Hinge Angle",
Sensors::DataFieldGestureSensor => "Data Field: Gesture Sensor",
Sensors::DataFieldGestureState => "Data Field: Gesture State",
Sensors::DataFieldHingeFoldInitialAngle => "Data Field: Hinge Fold Initial Angle",
Sensors::DataFieldHingeFoldFinalAngle => "Data Field: Hinge Fold Final Angle",
Sensors::DataFieldHingeFoldContributingPanel => {
"Data Field: Hinge Fold Contributing Panel"
}
Sensors::DataFieldHingeFoldType => "Data Field: Hinge Fold Type",
Sensors::SensorStateUndefined => "Sensor State: Undefined",
Sensors::SensorStateReady => "Sensor State: Ready",
Sensors::SensorStateNotAvailable => "Sensor State: Not Available",
Sensors::SensorStateNoData => "Sensor State: No Data",
Sensors::SensorStateInitializing => "Sensor State: Initializing",
Sensors::SensorStateAccessDenied => "Sensor State: Access Denied",
Sensors::SensorStateError => "Sensor State: Error",
Sensors::SensorEventUnknown => "Sensor Event: Unknown",
Sensors::SensorEventStateChanged => "Sensor Event: State Changed",
Sensors::SensorEventPropertyChanged => "Sensor Event: Property Changed",
Sensors::SensorEventDataUpdated => "Sensor Event: Data Updated",
Sensors::SensorEventPollResponse => "Sensor Event: Poll Response",
Sensors::SensorEventChangeSensitivity => "Sensor Event: Change Sensitivity",
Sensors::SensorEventRangeMaximumReached => "Sensor Event: Range Maximum Reached",
Sensors::SensorEventRangeMinimumReached => "Sensor Event: Range Minimum Reached",
Sensors::SensorEventHighThresholdCrossUpward => {
"Sensor Event: High Threshold Cross Upward"
}
Sensors::SensorEventHighThresholdCrossDownward => {
"Sensor Event: High Threshold Cross Downward"
}
Sensors::SensorEventLowThresholdCrossUpward => {
"Sensor Event: Low Threshold Cross Upward"
}
Sensors::SensorEventLowThresholdCrossDownward => {
"Sensor Event: Low Threshold Cross Downward"
}
Sensors::SensorEventZeroThresholdCrossUpward => {
"Sensor Event: Zero Threshold Cross Upward"
}
Sensors::SensorEventZeroThresholdCrossDownward => {
"Sensor Event: Zero Threshold Cross Downward"
}
Sensors::SensorEventPeriodExceeded => "Sensor Event: Period Exceeded",
Sensors::SensorEventFrequencyExceeded => "Sensor Event: Frequency Exceeded",
Sensors::SensorEventComplexTrigger => "Sensor Event: Complex Trigger",
Sensors::ConnectionTypePCIntegrated => "Connection Type: PC Integrated",
Sensors::ConnectionTypePCAttached => "Connection Type: PC Attached",
Sensors::ConnectionTypePCExternal => "Connection Type: PC External",
Sensors::ReportingStateReportNoEvents => "Reporting State: Report No Events",
Sensors::ReportingStateReportAllEvents => "Reporting State: Report All Events",
Sensors::ReportingStateReportThresholdEvents => {
"Reporting State: Report Threshold Events"
}
Sensors::ReportingStateWakeOnNoEvents => "Reporting State: Wake On No Events",
Sensors::ReportingStateWakeOnAllEvents => "Reporting State: Wake On All Events",
Sensors::ReportingStateWakeOnThresholdEvents => {
"Reporting State: Wake On Threshold Events"
}
Sensors::ReportingStateAnytime => "Reporting State: Anytime",
Sensors::PowerStateUndefined => "Power State: Undefined",
Sensors::PowerStateD0FullPower => "Power State: D0 Full Power",
Sensors::PowerStateD1LowPower => "Power State: D1 Low Power",
Sensors::PowerStateD2StandbyPowerwithWakeup => {
"Power State: D2 Standby Power with Wakeup"
}
Sensors::PowerStateD3SleepwithWakeup => "Power State: D3 Sleep with Wakeup",
Sensors::PowerStateD4PowerOff => "Power State: D4 Power Off",
Sensors::AccuracyDefault => "Accuracy: Default",
Sensors::AccuracyHigh => "Accuracy: High",
Sensors::AccuracyMedium => "Accuracy: Medium",
Sensors::AccuracyLow => "Accuracy: Low",
Sensors::FixQualityNoFix => "Fix Quality: No Fix",
Sensors::FixQualityGPS => "Fix Quality: GPS",
Sensors::FixQualityDGPS => "Fix Quality: DGPS",
Sensors::FixTypeNoFix => "Fix Type: No Fix",
Sensors::FixTypeGPSSPSModeFixValid => "Fix Type: GPS SPS Mode, Fix Valid",
Sensors::FixTypeDGPSSPSModeFixValid => "Fix Type: DGPS SPS Mode, Fix Valid",
Sensors::FixTypeGPSPPSModeFixValid => "Fix Type: GPS PPS Mode, Fix Valid",
Sensors::FixTypeRealTimeKinematic => "Fix Type: Real Time Kinematic",
Sensors::FixTypeFloatRTK => "Fix Type: Float RTK",
Sensors::FixTypeEstimateddeadreckoned => "Fix Type: Estimated (dead reckoned)",
Sensors::FixTypeManualInputMode => "Fix Type: Manual Input Mode",
Sensors::FixTypeSimulatorMode => "Fix Type: Simulator Mode",
Sensors::GPSOperationModeManual => "GPS Operation Mode: Manual",
Sensors::GPSOperationModeAutomatic => "GPS Operation Mode: Automatic",
Sensors::GPSSelectionModeAutonomous => "GPS Selection Mode: Autonomous",
Sensors::GPSSelectionModeDGPS => "GPS Selection Mode: DGPS",
Sensors::GPSSelectionModeEstimateddeadreckoned => {
"GPS Selection Mode: Estimated (dead reckoned)"
}
Sensors::GPSSelectionModeManualInput => "GPS Selection Mode: Manual Input",
Sensors::GPSSelectionModeSimulator => "GPS Selection Mode: Simulator",
Sensors::GPSSelectionModeDataNotValid => "GPS Selection Mode: Data Not Valid",
Sensors::GPSStatusDataValid => "GPS Status Data: Valid",
Sensors::GPSStatusDataNotValid => "GPS Status Data: Not Valid",
Sensors::DayofWeekSunday => "Day of Week: Sunday",
Sensors::DayofWeekMonday => "Day of Week: Monday",
Sensors::DayofWeekTuesday => "Day of Week: Tuesday",
Sensors::DayofWeekWednesday => "Day of Week: Wednesday",
Sensors::DayofWeekThursday => "Day of Week: Thursday",
Sensors::DayofWeekFriday => "Day of Week: Friday",
Sensors::DayofWeekSaturday => "Day of Week: Saturday",
Sensors::KindCategory => "Kind: Category",
Sensors::KindType => "Kind: Type",
Sensors::KindEvent => "Kind: Event",
Sensors::KindProperty => "Kind: Property",
Sensors::KindDataField => "Kind: Data Field",
Sensors::MagnetometerAccuracyLow => "Magnetometer Accuracy: Low",
Sensors::MagnetometerAccuracyMedium => "Magnetometer Accuracy: Medium",
Sensors::MagnetometerAccuracyHigh => "Magnetometer Accuracy: High",
Sensors::SimpleOrientationDirectionNotRotated => {
"Simple Orientation Direction: Not Rotated"
}
Sensors::SimpleOrientationDirectionRotated90DegreesCCW => {
"Simple Orientation Direction: Rotated 90 Degrees CCW"
}
Sensors::SimpleOrientationDirectionRotated180DegreesCCW => {
"Simple Orientation Direction: Rotated 180 Degrees CCW"
}
Sensors::SimpleOrientationDirectionRotated270DegreesCCW => {
"Simple Orientation Direction: Rotated 270 Degrees CCW"
}
Sensors::SimpleOrientationDirectionFaceUp => "Simple Orientation Direction: Face Up",
Sensors::SimpleOrientationDirectionFaceDown => {
"Simple Orientation Direction: Face Down"
}
Sensors::VT_NULL => "VT_NULL",
Sensors::VT_BOOL => "VT_BOOL",
Sensors::VT_UI1 => "VT_UI1",
Sensors::VT_I1 => "VT_I1",
Sensors::VT_UI2 => "VT_UI2",
Sensors::VT_I2 => "VT_I2",
Sensors::VT_UI4 => "VT_UI4",
Sensors::VT_I4 => "VT_I4",
Sensors::VT_UI8 => "VT_UI8",
Sensors::VT_I8 => "VT_I8",
Sensors::VT_R4 => "VT_R4",
Sensors::VT_R8 => "VT_R8",
Sensors::VT_WSTR => "VT_WSTR",
Sensors::VT_STR => "VT_STR",
Sensors::VT_CLSID => "VT_CLSID",
Sensors::VT_VECTORVT_UI1 => "VT_VECTOR VT_UI1",
Sensors::VT_F16E0 => "VT_F16E0",
Sensors::VT_F16E1 => "VT_F16E1",
Sensors::VT_F16E2 => "VT_F16E2",
Sensors::VT_F16E3 => "VT_F16E3",
Sensors::VT_F16E4 => "VT_F16E4",
Sensors::VT_F16E5 => "VT_F16E5",
Sensors::VT_F16E6 => "VT_F16E6",
Sensors::VT_F16E7 => "VT_F16E7",
Sensors::VT_F16E8 => "VT_F16E8",
Sensors::VT_F16E9 => "VT_F16E9",
Sensors::VT_F16EA => "VT_F16EA",
Sensors::VT_F16EB => "VT_F16EB",
Sensors::VT_F16EC => "VT_F16EC",
Sensors::VT_F16ED => "VT_F16ED",
Sensors::VT_F16EE => "VT_F16EE",
Sensors::VT_F16EF => "VT_F16EF",
Sensors::VT_F32E0 => "VT_F32E0",
Sensors::VT_F32E1 => "VT_F32E1",
Sensors::VT_F32E2 => "VT_F32E2",
Sensors::VT_F32E3 => "VT_F32E3",
Sensors::VT_F32E4 => "VT_F32E4",
Sensors::VT_F32E5 => "VT_F32E5",
Sensors::VT_F32E6 => "VT_F32E6",
Sensors::VT_F32E7 => "VT_F32E7",
Sensors::VT_F32E8 => "VT_F32E8",
Sensors::VT_F32E9 => "VT_F32E9",
Sensors::VT_F32EA => "VT_F32EA",
Sensors::VT_F32EB => "VT_F32EB",
Sensors::VT_F32EC => "VT_F32EC",
Sensors::VT_F32ED => "VT_F32ED",
Sensors::VT_F32EE => "VT_F32EE",
Sensors::VT_F32EF => "VT_F32EF",
Sensors::ActivityTypeUnknown => "Activity Type: Unknown",
Sensors::ActivityTypeStationary => "Activity Type: Stationary",
Sensors::ActivityTypeFidgeting => "Activity Type: Fidgeting",
Sensors::ActivityTypeWalking => "Activity Type: Walking",
Sensors::ActivityTypeRunning => "Activity Type: Running",
Sensors::ActivityTypeInVehicle => "Activity Type: In Vehicle",
Sensors::ActivityTypeBiking => "Activity Type: Biking",
Sensors::ActivityTypeIdle => "Activity Type: Idle",
Sensors::UnitNotSpecified => "Unit: Not Specified",
Sensors::UnitLux => "Unit: Lux",
Sensors::UnitDegreesKelvin => "Unit: Degrees Kelvin",
Sensors::UnitDegreesCelsius => "Unit: Degrees Celsius",
Sensors::UnitPascal => "Unit: Pascal",
Sensors::UnitNewton => "Unit: Newton",
Sensors::UnitMetersSecond => "Unit: Meters/Second",
Sensors::UnitKilogram => "Unit: Kilogram",
Sensors::UnitMeter => "Unit: Meter",
Sensors::UnitMetersSecondSecond => "Unit: Meters/Second/Second",
Sensors::UnitFarad => "Unit: Farad",
Sensors::UnitAmpere => "Unit: Ampere",
Sensors::UnitWatt => "Unit: Watt",
Sensors::UnitHenry => "Unit: Henry",
Sensors::UnitOhm => "Unit: Ohm",
Sensors::UnitVolt => "Unit: Volt",
Sensors::UnitHertz => "Unit: Hertz",
Sensors::UnitBar => "Unit: Bar",
Sensors::UnitDegreesAnticlockwise => "Unit: Degrees Anti-clockwise",
Sensors::UnitDegreesClockwise => "Unit: Degrees Clockwise",
Sensors::UnitDegrees => "Unit: Degrees",
Sensors::UnitDegreesSecond => "Unit: Degrees/Second",
Sensors::UnitDegreesSecondSecond => "Unit: Degrees/Second/Second",
Sensors::UnitKnot => "Unit: Knot",
Sensors::UnitPercent => "Unit: Percent",
Sensors::UnitSecond => "Unit: Second",
Sensors::UnitMillisecond => "Unit: Millisecond",
Sensors::UnitG => "Unit: G",
Sensors::UnitBytes => "Unit: Bytes",
Sensors::UnitMilligauss => "Unit: Milligauss",
Sensors::UnitBits => "Unit: Bits",
Sensors::ActivityStateNoStateChange => "Activity State: No State Change",
Sensors::ActivityStateStartActivity => "Activity State: Start Activity",
Sensors::ActivityStateEndActivity => "Activity State: End Activity",
Sensors::Exponent0 => "Exponent 0",
Sensors::Exponent1 => "Exponent 1",
Sensors::Exponent2 => "Exponent 2",
Sensors::Exponent3 => "Exponent 3",
Sensors::Exponent4 => "Exponent 4",
Sensors::Exponent5 => "Exponent 5",
Sensors::Exponent6 => "Exponent 6",
Sensors::Exponent7 => "Exponent 7",
Sensors::Exponent8 => "Exponent 8",
Sensors::Exponent9 => "Exponent 9",
Sensors::ExponentA => "Exponent A",
Sensors::ExponentB => "Exponent B",
Sensors::ExponentC => "Exponent C",
Sensors::ExponentD => "Exponent D",
Sensors::ExponentE => "Exponent E",
Sensors::ExponentF => "Exponent F",
Sensors::DevicePositionUnknown => "Device Position: Unknown",
Sensors::DevicePositionUnchanged => "Device Position: Unchanged",
Sensors::DevicePositionOnDesk => "Device Position: On Desk",
Sensors::DevicePositionInHand => "Device Position: In Hand",
Sensors::DevicePositionMovinginBag => "Device Position: Moving in Bag",
Sensors::DevicePositionStationaryinBag => "Device Position: Stationary in Bag",
Sensors::StepTypeUnknown => "Step Type: Unknown",
Sensors::StepTypeWalking => "Step Type: Walking",
Sensors::StepTypeRunning => "Step Type: Running",
Sensors::GestureStateUnknown => "Gesture State: Unknown",
Sensors::GestureStateStarted => "Gesture State: Started",
Sensors::GestureStateCompleted => "Gesture State: Completed",
Sensors::GestureStateCancelled => "Gesture State: Cancelled",
Sensors::HingeFoldContributingPanelUnknown => "Hinge Fold Contributing Panel: Unknown",
Sensors::HingeFoldContributingPanelPanel1 => "Hinge Fold Contributing Panel: Panel 1",
Sensors::HingeFoldContributingPanelPanel2 => "Hinge Fold Contributing Panel: Panel 2",
Sensors::HingeFoldContributingPanelBoth => "Hinge Fold Contributing Panel: Both",
Sensors::HingeFoldTypeUnknown => "Hinge Fold Type: Unknown",
Sensors::HingeFoldTypeIncreasing => "Hinge Fold Type: Increasing",
Sensors::HingeFoldTypeDecreasing => "Hinge Fold Type: Decreasing",
Sensors::HumanPresenceDetectionTypeVendorDefinedNonBiometric => {
"Human Presence Detection Type: Vendor-Defined Non-Biometric"
}
Sensors::HumanPresenceDetectionTypeVendorDefinedBiometric => {
"Human Presence Detection Type: Vendor-Defined Biometric"
}
Sensors::HumanPresenceDetectionTypeFacialBiometric => {
"Human Presence Detection Type: Facial Biometric"
}
Sensors::HumanPresenceDetectionTypeAudioBiometric => {
"Human Presence Detection Type: Audio Biometric"
}
Sensors::ModifierChangeSensitivityAbsolute => "Modifier: Change Sensitivity Absolute",
Sensors::ModifierMaximum => "Modifier: Maximum",
Sensors::ModifierMinimum => "Modifier: Minimum",
Sensors::ModifierAccuracy => "Modifier: Accuracy",
Sensors::ModifierResolution => "Modifier: Resolution",
Sensors::ModifierThresholdHigh => "Modifier: Threshold High",
Sensors::ModifierThresholdLow => "Modifier: Threshold Low",
Sensors::ModifierCalibrationOffset => "Modifier: Calibration Offset",
Sensors::ModifierCalibrationMultiplier => "Modifier: Calibration Multiplier",
Sensors::ModifierReportInterval => "Modifier: Report Interval",
Sensors::ModifierFrequencyMax => "Modifier: Frequency Max",
Sensors::ModifierPeriodMax => "Modifier: Period Max",
Sensors::ModifierChangeSensitivityPercentofRange => {
"Modifier: Change Sensitivity Percent of Range"
}
Sensors::ModifierChangeSensitivityPercentRelative => {
"Modifier: Change Sensitivity Percent Relative"
}
Sensors::ModifierVendorReserved => "Modifier: Vendor Reserved",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for Sensors {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for Sensors {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for Sensors {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&Sensors> for u16 {
fn from(sensors: &Sensors) -> u16 {
*sensors as u16
}
}
impl From<Sensors> for u16 {
fn from(sensors: Sensors) -> u16 {
u16::from(&sensors)
}
}
impl From<&Sensors> for u32 {
fn from(sensors: &Sensors) -> u32 {
let up = UsagePage::from(sensors);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(sensors) as u32;
up | id
}
}
impl From<&Sensors> for UsagePage {
fn from(_: &Sensors) -> UsagePage {
UsagePage::Sensors
}
}
impl From<Sensors> for UsagePage {
fn from(_: Sensors) -> UsagePage {
UsagePage::Sensors
}
}
impl From<&Sensors> for Usage {
fn from(sensors: &Sensors) -> Usage {
Usage::try_from(u32::from(sensors)).unwrap()
}
}
impl From<Sensors> for Usage {
fn from(sensors: Sensors) -> Usage {
Usage::from(&sensors)
}
}
impl TryFrom<u16> for Sensors {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<Sensors> {
match usage_id {
1 => Ok(Sensors::Sensor),
16 => Ok(Sensors::Biometric),
17 => Ok(Sensors::BiometricHumanPresence),
18 => Ok(Sensors::BiometricHumanProximity),
19 => Ok(Sensors::BiometricHumanTouch),
20 => Ok(Sensors::BiometricBloodPressure),
21 => Ok(Sensors::BiometricBodyTemperature),
22 => Ok(Sensors::BiometricHeartRate),
23 => Ok(Sensors::BiometricHeartRateVariability),
24 => Ok(Sensors::BiometricPeripheralOxygenSaturation),
25 => Ok(Sensors::BiometricRespiratoryRate),
32 => Ok(Sensors::Electrical),
33 => Ok(Sensors::ElectricalCapacitance),
34 => Ok(Sensors::ElectricalCurrent),
35 => Ok(Sensors::ElectricalPower),
36 => Ok(Sensors::ElectricalInductance),
37 => Ok(Sensors::ElectricalResistance),
38 => Ok(Sensors::ElectricalVoltage),
39 => Ok(Sensors::ElectricalPotentiometer),
40 => Ok(Sensors::ElectricalFrequency),
41 => Ok(Sensors::ElectricalPeriod),
48 => Ok(Sensors::Environmental),
49 => Ok(Sensors::EnvironmentalAtmosphericPressure),
50 => Ok(Sensors::EnvironmentalHumidity),
51 => Ok(Sensors::EnvironmentalTemperature),
52 => Ok(Sensors::EnvironmentalWindDirection),
53 => Ok(Sensors::EnvironmentalWindSpeed),
54 => Ok(Sensors::EnvironmentalAirQuality),
55 => Ok(Sensors::EnvironmentalHeatIndex),
56 => Ok(Sensors::EnvironmentalSurfaceTemperature),
57 => Ok(Sensors::EnvironmentalVolatileOrganicCompounds),
58 => Ok(Sensors::EnvironmentalObjectPresence),
59 => Ok(Sensors::EnvironmentalObjectProximity),
64 => Ok(Sensors::Light),
65 => Ok(Sensors::LightAmbientLight),
66 => Ok(Sensors::LightConsumerInfrared),
67 => Ok(Sensors::LightInfraredLight),
68 => Ok(Sensors::LightVisibleLight),
69 => Ok(Sensors::LightUltravioletLight),
80 => Ok(Sensors::Location),
81 => Ok(Sensors::LocationBroadcast),
82 => Ok(Sensors::LocationDeadReckoning),
83 => Ok(Sensors::LocationGPSGlobalPositioningSystem),
84 => Ok(Sensors::LocationLookup),
85 => Ok(Sensors::LocationOther),
86 => Ok(Sensors::LocationStatic),
87 => Ok(Sensors::LocationTriangulation),
96 => Ok(Sensors::Mechanical),
97 => Ok(Sensors::MechanicalBooleanSwitch),
98 => Ok(Sensors::MechanicalBooleanSwitchArray),
99 => Ok(Sensors::MechanicalMultivalueSwitch),
100 => Ok(Sensors::MechanicalForce),
101 => Ok(Sensors::MechanicalPressure),
102 => Ok(Sensors::MechanicalStrain),
103 => Ok(Sensors::MechanicalWeight),
104 => Ok(Sensors::MechanicalHapticVibrator),
105 => Ok(Sensors::MechanicalHallEffectSwitch),
112 => Ok(Sensors::Motion),
113 => Ok(Sensors::MotionAccelerometer1D),
114 => Ok(Sensors::MotionAccelerometer2D),
115 => Ok(Sensors::MotionAccelerometer3D),
116 => Ok(Sensors::MotionGyrometer1D),
117 => Ok(Sensors::MotionGyrometer2D),
118 => Ok(Sensors::MotionGyrometer3D),
119 => Ok(Sensors::MotionMotionDetector),
120 => Ok(Sensors::MotionSpeedometer),
121 => Ok(Sensors::MotionAccelerometer),
122 => Ok(Sensors::MotionGyrometer),
123 => Ok(Sensors::MotionGravityVector),
124 => Ok(Sensors::MotionLinearAccelerometer),
128 => Ok(Sensors::Orientation),
129 => Ok(Sensors::OrientationCompass1D),
130 => Ok(Sensors::OrientationCompass2D),
131 => Ok(Sensors::OrientationCompass3D),
132 => Ok(Sensors::OrientationInclinometer1D),
133 => Ok(Sensors::OrientationInclinometer2D),
134 => Ok(Sensors::OrientationInclinometer3D),
135 => Ok(Sensors::OrientationDistance1D),
136 => Ok(Sensors::OrientationDistance2D),
137 => Ok(Sensors::OrientationDistance3D),
138 => Ok(Sensors::OrientationDeviceOrientation),
139 => Ok(Sensors::OrientationCompass),
140 => Ok(Sensors::OrientationInclinometer),
141 => Ok(Sensors::OrientationDistance),
142 => Ok(Sensors::OrientationRelativeOrientation),
143 => Ok(Sensors::OrientationSimpleOrientation),
144 => Ok(Sensors::Scanner),
145 => Ok(Sensors::ScannerBarcode),
146 => Ok(Sensors::ScannerRFID),
147 => Ok(Sensors::ScannerNFC),
160 => Ok(Sensors::Time),
161 => Ok(Sensors::TimeAlarmTimer),
162 => Ok(Sensors::TimeRealTimeClock),
176 => Ok(Sensors::PersonalActivity),
177 => Ok(Sensors::PersonalActivityActivityDetection),
178 => Ok(Sensors::PersonalActivityDevicePosition),
179 => Ok(Sensors::PersonalActivityFloorTracker),
180 => Ok(Sensors::PersonalActivityPedometer),
181 => Ok(Sensors::PersonalActivityStepDetection),
192 => Ok(Sensors::OrientationExtended),
193 => Ok(Sensors::OrientationExtendedGeomagneticOrientation),
194 => Ok(Sensors::OrientationExtendedMagnetometer),
208 => Ok(Sensors::Gesture),
209 => Ok(Sensors::GestureChassisFlipGesture),
210 => Ok(Sensors::GestureHingeFoldGesture),
224 => Ok(Sensors::Other),
225 => Ok(Sensors::OtherCustom),
226 => Ok(Sensors::OtherGeneric),
227 => Ok(Sensors::OtherGenericEnumerator),
228 => Ok(Sensors::OtherHingeAngle),
240 => Ok(Sensors::VendorReserved1),
241 => Ok(Sensors::VendorReserved2),
242 => Ok(Sensors::VendorReserved3),
243 => Ok(Sensors::VendorReserved4),
244 => Ok(Sensors::VendorReserved5),
245 => Ok(Sensors::VendorReserved6),
246 => Ok(Sensors::VendorReserved7),
247 => Ok(Sensors::VendorReserved8),
248 => Ok(Sensors::VendorReserved9),
249 => Ok(Sensors::VendorReserved10),
250 => Ok(Sensors::VendorReserved11),
251 => Ok(Sensors::VendorReserved12),
252 => Ok(Sensors::VendorReserved13),
253 => Ok(Sensors::VendorReserved14),
254 => Ok(Sensors::VendorReserved15),
255 => Ok(Sensors::VendorReserved16),
512 => Ok(Sensors::Event),
513 => Ok(Sensors::EventSensorState),
514 => Ok(Sensors::EventSensorEvent),
768 => Ok(Sensors::Property),
769 => Ok(Sensors::PropertyFriendlyName),
770 => Ok(Sensors::PropertyPersistentUniqueID),
771 => Ok(Sensors::PropertySensorStatus),
772 => Ok(Sensors::PropertyMinimumReportInterval),
773 => Ok(Sensors::PropertySensorManufacturer),
774 => Ok(Sensors::PropertySensorModel),
775 => Ok(Sensors::PropertySensorSerialNumber),
776 => Ok(Sensors::PropertySensorDescription),
777 => Ok(Sensors::PropertySensorConnectionType),
778 => Ok(Sensors::PropertySensorDevicePath),
779 => Ok(Sensors::PropertyHardwareRevision),
780 => Ok(Sensors::PropertyFirmwareVersion),
781 => Ok(Sensors::PropertyReleaseDate),
782 => Ok(Sensors::PropertyReportInterval),
783 => Ok(Sensors::PropertyChangeSensitivityAbsolute),
784 => Ok(Sensors::PropertyChangeSensitivityPercentofRange),
785 => Ok(Sensors::PropertyChangeSensitivityPercentRelative),
786 => Ok(Sensors::PropertyAccuracy),
787 => Ok(Sensors::PropertyResolution),
788 => Ok(Sensors::PropertyMaximum),
789 => Ok(Sensors::PropertyMinimum),
790 => Ok(Sensors::PropertyReportingState),
791 => Ok(Sensors::PropertySamplingRate),
792 => Ok(Sensors::PropertyResponseCurve),
793 => Ok(Sensors::PropertyPowerState),
794 => Ok(Sensors::PropertyMaximumFIFOEvents),
795 => Ok(Sensors::PropertyReportLatency),
796 => Ok(Sensors::PropertyFlushFIFOEvents),
797 => Ok(Sensors::PropertyMaximumPowerConsumption),
798 => Ok(Sensors::PropertyIsPrimary),
799 => Ok(Sensors::PropertyHumanPresenceDetectionType),
1024 => Ok(Sensors::DataFieldLocation),
1026 => Ok(Sensors::DataFieldAltitudeAntennaSeaLevel),
1027 => Ok(Sensors::DataFieldDifferentialReferenceStationID),
1028 => Ok(Sensors::DataFieldAltitudeEllipsoidError),
1029 => Ok(Sensors::DataFieldAltitudeEllipsoid),
1030 => Ok(Sensors::DataFieldAltitudeSeaLevelError),
1031 => Ok(Sensors::DataFieldAltitudeSeaLevel),
1032 => Ok(Sensors::DataFieldDifferentialGPSDataAge),
1033 => Ok(Sensors::DataFieldErrorRadius),
1034 => Ok(Sensors::DataFieldFixQuality),
1035 => Ok(Sensors::DataFieldFixType),
1036 => Ok(Sensors::DataFieldGeoidalSeparation),
1037 => Ok(Sensors::DataFieldGPSOperationMode),
1038 => Ok(Sensors::DataFieldGPSSelectionMode),
1039 => Ok(Sensors::DataFieldGPSStatus),
1040 => Ok(Sensors::DataFieldPositionDilutionofPrecision),
1041 => Ok(Sensors::DataFieldHorizontalDilutionofPrecision),
1042 => Ok(Sensors::DataFieldVerticalDilutionofPrecision),
1043 => Ok(Sensors::DataFieldLatitude),
1044 => Ok(Sensors::DataFieldLongitude),
1045 => Ok(Sensors::DataFieldTrueHeading),
1046 => Ok(Sensors::DataFieldMagneticHeading),
1047 => Ok(Sensors::DataFieldMagneticVariation),
1048 => Ok(Sensors::DataFieldSpeed),
1049 => Ok(Sensors::DataFieldSatellitesinView),
1050 => Ok(Sensors::DataFieldSatellitesinViewAzimuth),
1051 => Ok(Sensors::DataFieldSatellitesinViewElevation),
1052 => Ok(Sensors::DataFieldSatellitesinViewIDs),
1053 => Ok(Sensors::DataFieldSatellitesinViewPRNs),
1054 => Ok(Sensors::DataFieldSatellitesinViewSNRatios),
1055 => Ok(Sensors::DataFieldSatellitesUsedCount),
1056 => Ok(Sensors::DataFieldSatellitesUsedPRNs),
1057 => Ok(Sensors::DataFieldNMEASentence),
1058 => Ok(Sensors::DataFieldAddressLine1),
1059 => Ok(Sensors::DataFieldAddressLine2),
1060 => Ok(Sensors::DataFieldCity),
1061 => Ok(Sensors::DataFieldStateorProvince),
1062 => Ok(Sensors::DataFieldCountryorRegion),
1063 => Ok(Sensors::DataFieldPostalCode),
1066 => Ok(Sensors::PropertyLocation),
1067 => Ok(Sensors::PropertyLocationDesiredAccuracy),
1072 => Ok(Sensors::DataFieldEnvironmental),
1073 => Ok(Sensors::DataFieldAtmosphericPressure),
1075 => Ok(Sensors::DataFieldRelativeHumidity),
1076 => Ok(Sensors::DataFieldTemperature),
1077 => Ok(Sensors::DataFieldWindDirection),
1078 => Ok(Sensors::DataFieldWindSpeed),
1079 => Ok(Sensors::DataFieldAirQualityIndex),
1080 => Ok(Sensors::DataFieldEquivalentCO2),
1081 => Ok(Sensors::DataFieldVolatileOrganicCompoundConcentration),
1082 => Ok(Sensors::DataFieldObjectPresence),
1083 => Ok(Sensors::DataFieldObjectProximityRange),
1084 => Ok(Sensors::DataFieldObjectProximityOutofRange),
1088 => Ok(Sensors::PropertyEnvironmental),
1089 => Ok(Sensors::PropertyReferencePressure),
1104 => Ok(Sensors::DataFieldMotion),
1105 => Ok(Sensors::DataFieldMotionState),
1106 => Ok(Sensors::DataFieldAcceleration),
1107 => Ok(Sensors::DataFieldAccelerationAxisX),
1108 => Ok(Sensors::DataFieldAccelerationAxisY),
1109 => Ok(Sensors::DataFieldAccelerationAxisZ),
1110 => Ok(Sensors::DataFieldAngularVelocity),
1111 => Ok(Sensors::DataFieldAngularVelocityaboutXAxis),
1112 => Ok(Sensors::DataFieldAngularVelocityaboutYAxis),
1113 => Ok(Sensors::DataFieldAngularVelocityaboutZAxis),
1114 => Ok(Sensors::DataFieldAngularPosition),
1115 => Ok(Sensors::DataFieldAngularPositionaboutXAxis),
1116 => Ok(Sensors::DataFieldAngularPositionaboutYAxis),
1117 => Ok(Sensors::DataFieldAngularPositionaboutZAxis),
1118 => Ok(Sensors::DataFieldMotionSpeed),
1119 => Ok(Sensors::DataFieldMotionIntensity),
1136 => Ok(Sensors::DataFieldOrientation),
1137 => Ok(Sensors::DataFieldHeading),
1138 => Ok(Sensors::DataFieldHeadingXAxis),
1139 => Ok(Sensors::DataFieldHeadingYAxis),
1140 => Ok(Sensors::DataFieldHeadingZAxis),
1141 => Ok(Sensors::DataFieldHeadingCompensatedMagneticNorth),
1142 => Ok(Sensors::DataFieldHeadingCompensatedTrueNorth),
1143 => Ok(Sensors::DataFieldHeadingMagneticNorth),
1144 => Ok(Sensors::DataFieldHeadingTrueNorth),
1145 => Ok(Sensors::DataFieldDistance),
1146 => Ok(Sensors::DataFieldDistanceXAxis),
1147 => Ok(Sensors::DataFieldDistanceYAxis),
1148 => Ok(Sensors::DataFieldDistanceZAxis),
1149 => Ok(Sensors::DataFieldDistanceOutofRange),
1150 => Ok(Sensors::DataFieldTilt),
1151 => Ok(Sensors::DataFieldTiltXAxis),
1152 => Ok(Sensors::DataFieldTiltYAxis),
1153 => Ok(Sensors::DataFieldTiltZAxis),
1154 => Ok(Sensors::DataFieldRotationMatrix),
1155 => Ok(Sensors::DataFieldQuaternion),
1156 => Ok(Sensors::DataFieldMagneticFlux),
1157 => Ok(Sensors::DataFieldMagneticFluxXAxis),
1158 => Ok(Sensors::DataFieldMagneticFluxYAxis),
1159 => Ok(Sensors::DataFieldMagneticFluxZAxis),
1160 => Ok(Sensors::DataFieldMagnetometerAccuracy),
1161 => Ok(Sensors::DataFieldSimpleOrientationDirection),
1168 => Ok(Sensors::DataFieldMechanical),
1169 => Ok(Sensors::DataFieldBooleanSwitchState),
1170 => Ok(Sensors::DataFieldBooleanSwitchArrayStates),
1171 => Ok(Sensors::DataFieldMultivalueSwitchValue),
1172 => Ok(Sensors::DataFieldForce),
1173 => Ok(Sensors::DataFieldAbsolutePressure),
1174 => Ok(Sensors::DataFieldGaugePressure),
1175 => Ok(Sensors::DataFieldStrain),
1176 => Ok(Sensors::DataFieldWeight),
1184 => Ok(Sensors::PropertyMechanical),
1185 => Ok(Sensors::PropertyVibrationState),
1186 => Ok(Sensors::PropertyForwardVibrationSpeed),
1187 => Ok(Sensors::PropertyBackwardVibrationSpeed),
1200 => Ok(Sensors::DataFieldBiometric),
1201 => Ok(Sensors::DataFieldHumanPresence),
1202 => Ok(Sensors::DataFieldHumanProximityRange),
1203 => Ok(Sensors::DataFieldHumanProximityOutofRange),
1204 => Ok(Sensors::DataFieldHumanTouchState),
1205 => Ok(Sensors::DataFieldBloodPressure),
1206 => Ok(Sensors::DataFieldBloodPressureDiastolic),
1207 => Ok(Sensors::DataFieldBloodPressureSystolic),
1208 => Ok(Sensors::DataFieldHeartRate),
1209 => Ok(Sensors::DataFieldRestingHeartRate),
1210 => Ok(Sensors::DataFieldHeartbeatInterval),
1211 => Ok(Sensors::DataFieldRespiratoryRate),
1212 => Ok(Sensors::DataFieldSpO2),
1213 => Ok(Sensors::DataFieldHumanAttentionDetected),
1214 => Ok(Sensors::DataFieldHumanHeadAzimuth),
1215 => Ok(Sensors::DataFieldHumanHeadAltitude),
1216 => Ok(Sensors::DataFieldHumanHeadRoll),
1217 => Ok(Sensors::DataFieldHumanHeadPitch),
1218 => Ok(Sensors::DataFieldHumanHeadYaw),
1219 => Ok(Sensors::DataFieldHumanCorrelationId),
1232 => Ok(Sensors::DataFieldLight),
1233 => Ok(Sensors::DataFieldIlluminance),
1234 => Ok(Sensors::DataFieldColorTemperature),
1235 => Ok(Sensors::DataFieldChromaticity),
1236 => Ok(Sensors::DataFieldChromaticityX),
1237 => Ok(Sensors::DataFieldChromaticityY),
1238 => Ok(Sensors::DataFieldConsumerIRSentenceReceive),
1239 => Ok(Sensors::DataFieldInfraredLight),
1240 => Ok(Sensors::DataFieldRedLight),
1241 => Ok(Sensors::DataFieldGreenLight),
1242 => Ok(Sensors::DataFieldBlueLight),
1243 => Ok(Sensors::DataFieldUltravioletALight),
1244 => Ok(Sensors::DataFieldUltravioletBLight),
1245 => Ok(Sensors::DataFieldUltravioletIndex),
1246 => Ok(Sensors::DataFieldNearInfraredLight),
1247 => Ok(Sensors::PropertyLight),
1248 => Ok(Sensors::PropertyConsumerIRSentenceSend),
1250 => Ok(Sensors::PropertyAutoBrightnessPreferred),
1251 => Ok(Sensors::PropertyAutoColorPreferred),
1264 => Ok(Sensors::DataFieldScanner),
1265 => Ok(Sensors::DataFieldRFIDTag40Bit),
1266 => Ok(Sensors::DataFieldNFCSentenceReceive),
1272 => Ok(Sensors::PropertyScanner),
1273 => Ok(Sensors::PropertyNFCSentenceSend),
1280 => Ok(Sensors::DataFieldElectrical),
1281 => Ok(Sensors::DataFieldCapacitance),
1282 => Ok(Sensors::DataFieldCurrent),
1283 => Ok(Sensors::DataFieldElectricalPower),
1284 => Ok(Sensors::DataFieldInductance),
1285 => Ok(Sensors::DataFieldResistance),
1286 => Ok(Sensors::DataFieldVoltage),
1287 => Ok(Sensors::DataFieldFrequency),
1288 => Ok(Sensors::DataFieldPeriod),
1289 => Ok(Sensors::DataFieldPercentofRange),
1312 => Ok(Sensors::DataFieldTime),
1313 => Ok(Sensors::DataFieldYear),
1314 => Ok(Sensors::DataFieldMonth),
1315 => Ok(Sensors::DataFieldDay),
1316 => Ok(Sensors::DataFieldDayofWeek),
1317 => Ok(Sensors::DataFieldHour),
1318 => Ok(Sensors::DataFieldMinute),
1319 => Ok(Sensors::DataFieldSecond),
1320 => Ok(Sensors::DataFieldMillisecond),
1321 => Ok(Sensors::DataFieldTimestamp),
1322 => Ok(Sensors::DataFieldJulianDayofYear),
1323 => Ok(Sensors::DataFieldTimeSinceSystemBoot),
1328 => Ok(Sensors::PropertyTime),
1329 => Ok(Sensors::PropertyTimeZoneOffsetfromUTC),
1330 => Ok(Sensors::PropertyTimeZoneName),
1331 => Ok(Sensors::PropertyDaylightSavingsTimeObserved),
1332 => Ok(Sensors::PropertyTimeTrimAdjustment),
1333 => Ok(Sensors::PropertyArmAlarm),
1344 => Ok(Sensors::DataFieldCustom),
1345 => Ok(Sensors::DataFieldCustomUsage),
1346 => Ok(Sensors::DataFieldCustomBooleanArray),
1347 => Ok(Sensors::DataFieldCustomValue),
1348 => Ok(Sensors::DataFieldCustomValue1),
1349 => Ok(Sensors::DataFieldCustomValue2),
1350 => Ok(Sensors::DataFieldCustomValue3),
1351 => Ok(Sensors::DataFieldCustomValue4),
1352 => Ok(Sensors::DataFieldCustomValue5),
1353 => Ok(Sensors::DataFieldCustomValue6),
1354 => Ok(Sensors::DataFieldCustomValue7),
1355 => Ok(Sensors::DataFieldCustomValue8),
1356 => Ok(Sensors::DataFieldCustomValue9),
1357 => Ok(Sensors::DataFieldCustomValue10),
1358 => Ok(Sensors::DataFieldCustomValue11),
1359 => Ok(Sensors::DataFieldCustomValue12),
1360 => Ok(Sensors::DataFieldCustomValue13),
1361 => Ok(Sensors::DataFieldCustomValue14),
1362 => Ok(Sensors::DataFieldCustomValue15),
1363 => Ok(Sensors::DataFieldCustomValue16),
1364 => Ok(Sensors::DataFieldCustomValue17),
1365 => Ok(Sensors::DataFieldCustomValue18),
1366 => Ok(Sensors::DataFieldCustomValue19),
1367 => Ok(Sensors::DataFieldCustomValue20),
1368 => Ok(Sensors::DataFieldCustomValue21),
1369 => Ok(Sensors::DataFieldCustomValue22),
1370 => Ok(Sensors::DataFieldCustomValue23),
1371 => Ok(Sensors::DataFieldCustomValue24),
1372 => Ok(Sensors::DataFieldCustomValue25),
1373 => Ok(Sensors::DataFieldCustomValue26),
1374 => Ok(Sensors::DataFieldCustomValue27),
1375 => Ok(Sensors::DataFieldCustomValue28),
1376 => Ok(Sensors::DataFieldGeneric),
1377 => Ok(Sensors::DataFieldGenericGUIDorPROPERTYKEY),
1378 => Ok(Sensors::DataFieldGenericCategoryGUID),
1379 => Ok(Sensors::DataFieldGenericTypeGUID),
1380 => Ok(Sensors::DataFieldGenericEventPROPERTYKEY),
1381 => Ok(Sensors::DataFieldGenericPropertyPROPERTYKEY),
1382 => Ok(Sensors::DataFieldGenericDataFieldPROPERTYKEY),
1383 => Ok(Sensors::DataFieldGenericEvent),
1384 => Ok(Sensors::DataFieldGenericProperty),
1385 => Ok(Sensors::DataFieldGenericDataField),
1386 => Ok(Sensors::DataFieldEnumeratorTableRowIndex),
1387 => Ok(Sensors::DataFieldEnumeratorTableRowCount),
1388 => Ok(Sensors::DataFieldGenericGUIDorPROPERTYKEYkind),
1389 => Ok(Sensors::DataFieldGenericGUID),
1390 => Ok(Sensors::DataFieldGenericPROPERTYKEY),
1391 => Ok(Sensors::DataFieldGenericTopLevelCollectionID),
1392 => Ok(Sensors::DataFieldGenericReportID),
1393 => Ok(Sensors::DataFieldGenericReportItemPositionIndex),
1394 => Ok(Sensors::DataFieldGenericFirmwareVARTYPE),
1395 => Ok(Sensors::DataFieldGenericUnitofMeasure),
1396 => Ok(Sensors::DataFieldGenericUnitExponent),
1397 => Ok(Sensors::DataFieldGenericReportSize),
1398 => Ok(Sensors::DataFieldGenericReportCount),
1408 => Ok(Sensors::PropertyGeneric),
1409 => Ok(Sensors::PropertyEnumeratorTableRowIndex),
1410 => Ok(Sensors::PropertyEnumeratorTableRowCount),
1424 => Ok(Sensors::DataFieldPersonalActivity),
1425 => Ok(Sensors::DataFieldActivityType),
1426 => Ok(Sensors::DataFieldActivityState),
1427 => Ok(Sensors::DataFieldDevicePosition),
1428 => Ok(Sensors::DataFieldStepCount),
1429 => Ok(Sensors::DataFieldStepCountReset),
1430 => Ok(Sensors::DataFieldStepDuration),
1431 => Ok(Sensors::DataFieldStepType),
1440 => Ok(Sensors::PropertyMinimumActivityDetectionInterval),
1441 => Ok(Sensors::PropertySupportedActivityTypes),
1442 => Ok(Sensors::PropertySubscribedActivityTypes),
1443 => Ok(Sensors::PropertySupportedStepTypes),
1444 => Ok(Sensors::PropertySubscribedStepTypes),
1445 => Ok(Sensors::PropertyFloorHeight),
1456 => Ok(Sensors::DataFieldCustomTypeID),
1472 => Ok(Sensors::PropertyCustom),
1473 => Ok(Sensors::PropertyCustomValue1),
1474 => Ok(Sensors::PropertyCustomValue2),
1475 => Ok(Sensors::PropertyCustomValue3),
1476 => Ok(Sensors::PropertyCustomValue4),
1477 => Ok(Sensors::PropertyCustomValue5),
1478 => Ok(Sensors::PropertyCustomValue6),
1479 => Ok(Sensors::PropertyCustomValue7),
1480 => Ok(Sensors::PropertyCustomValue8),
1481 => Ok(Sensors::PropertyCustomValue9),
1482 => Ok(Sensors::PropertyCustomValue10),
1483 => Ok(Sensors::PropertyCustomValue11),
1484 => Ok(Sensors::PropertyCustomValue12),
1485 => Ok(Sensors::PropertyCustomValue13),
1486 => Ok(Sensors::PropertyCustomValue14),
1487 => Ok(Sensors::PropertyCustomValue15),
1488 => Ok(Sensors::PropertyCustomValue16),
1504 => Ok(Sensors::DataFieldHinge),
1505 => Ok(Sensors::DataFieldHingeAngle),
1520 => Ok(Sensors::DataFieldGestureSensor),
1521 => Ok(Sensors::DataFieldGestureState),
1522 => Ok(Sensors::DataFieldHingeFoldInitialAngle),
1523 => Ok(Sensors::DataFieldHingeFoldFinalAngle),
1524 => Ok(Sensors::DataFieldHingeFoldContributingPanel),
1525 => Ok(Sensors::DataFieldHingeFoldType),
2048 => Ok(Sensors::SensorStateUndefined),
2049 => Ok(Sensors::SensorStateReady),
2050 => Ok(Sensors::SensorStateNotAvailable),
2051 => Ok(Sensors::SensorStateNoData),
2052 => Ok(Sensors::SensorStateInitializing),
2053 => Ok(Sensors::SensorStateAccessDenied),
2054 => Ok(Sensors::SensorStateError),
2064 => Ok(Sensors::SensorEventUnknown),
2065 => Ok(Sensors::SensorEventStateChanged),
2066 => Ok(Sensors::SensorEventPropertyChanged),
2067 => Ok(Sensors::SensorEventDataUpdated),
2068 => Ok(Sensors::SensorEventPollResponse),
2069 => Ok(Sensors::SensorEventChangeSensitivity),
2070 => Ok(Sensors::SensorEventRangeMaximumReached),
2071 => Ok(Sensors::SensorEventRangeMinimumReached),
2072 => Ok(Sensors::SensorEventHighThresholdCrossUpward),
2073 => Ok(Sensors::SensorEventHighThresholdCrossDownward),
2074 => Ok(Sensors::SensorEventLowThresholdCrossUpward),
2075 => Ok(Sensors::SensorEventLowThresholdCrossDownward),
2076 => Ok(Sensors::SensorEventZeroThresholdCrossUpward),
2077 => Ok(Sensors::SensorEventZeroThresholdCrossDownward),
2078 => Ok(Sensors::SensorEventPeriodExceeded),
2079 => Ok(Sensors::SensorEventFrequencyExceeded),
2080 => Ok(Sensors::SensorEventComplexTrigger),
2096 => Ok(Sensors::ConnectionTypePCIntegrated),
2097 => Ok(Sensors::ConnectionTypePCAttached),
2098 => Ok(Sensors::ConnectionTypePCExternal),
2112 => Ok(Sensors::ReportingStateReportNoEvents),
2113 => Ok(Sensors::ReportingStateReportAllEvents),
2114 => Ok(Sensors::ReportingStateReportThresholdEvents),
2115 => Ok(Sensors::ReportingStateWakeOnNoEvents),
2116 => Ok(Sensors::ReportingStateWakeOnAllEvents),
2117 => Ok(Sensors::ReportingStateWakeOnThresholdEvents),
2118 => Ok(Sensors::ReportingStateAnytime),
2128 => Ok(Sensors::PowerStateUndefined),
2129 => Ok(Sensors::PowerStateD0FullPower),
2130 => Ok(Sensors::PowerStateD1LowPower),
2131 => Ok(Sensors::PowerStateD2StandbyPowerwithWakeup),
2132 => Ok(Sensors::PowerStateD3SleepwithWakeup),
2133 => Ok(Sensors::PowerStateD4PowerOff),
2144 => Ok(Sensors::AccuracyDefault),
2145 => Ok(Sensors::AccuracyHigh),
2146 => Ok(Sensors::AccuracyMedium),
2147 => Ok(Sensors::AccuracyLow),
2160 => Ok(Sensors::FixQualityNoFix),
2161 => Ok(Sensors::FixQualityGPS),
2162 => Ok(Sensors::FixQualityDGPS),
2176 => Ok(Sensors::FixTypeNoFix),
2177 => Ok(Sensors::FixTypeGPSSPSModeFixValid),
2178 => Ok(Sensors::FixTypeDGPSSPSModeFixValid),
2179 => Ok(Sensors::FixTypeGPSPPSModeFixValid),
2180 => Ok(Sensors::FixTypeRealTimeKinematic),
2181 => Ok(Sensors::FixTypeFloatRTK),
2182 => Ok(Sensors::FixTypeEstimateddeadreckoned),
2183 => Ok(Sensors::FixTypeManualInputMode),
2184 => Ok(Sensors::FixTypeSimulatorMode),
2192 => Ok(Sensors::GPSOperationModeManual),
2193 => Ok(Sensors::GPSOperationModeAutomatic),
2208 => Ok(Sensors::GPSSelectionModeAutonomous),
2209 => Ok(Sensors::GPSSelectionModeDGPS),
2210 => Ok(Sensors::GPSSelectionModeEstimateddeadreckoned),
2211 => Ok(Sensors::GPSSelectionModeManualInput),
2212 => Ok(Sensors::GPSSelectionModeSimulator),
2213 => Ok(Sensors::GPSSelectionModeDataNotValid),
2224 => Ok(Sensors::GPSStatusDataValid),
2225 => Ok(Sensors::GPSStatusDataNotValid),
2240 => Ok(Sensors::DayofWeekSunday),
2241 => Ok(Sensors::DayofWeekMonday),
2242 => Ok(Sensors::DayofWeekTuesday),
2243 => Ok(Sensors::DayofWeekWednesday),
2244 => Ok(Sensors::DayofWeekThursday),
2245 => Ok(Sensors::DayofWeekFriday),
2246 => Ok(Sensors::DayofWeekSaturday),
2256 => Ok(Sensors::KindCategory),
2257 => Ok(Sensors::KindType),
2258 => Ok(Sensors::KindEvent),
2259 => Ok(Sensors::KindProperty),
2260 => Ok(Sensors::KindDataField),
2272 => Ok(Sensors::MagnetometerAccuracyLow),
2273 => Ok(Sensors::MagnetometerAccuracyMedium),
2274 => Ok(Sensors::MagnetometerAccuracyHigh),
2288 => Ok(Sensors::SimpleOrientationDirectionNotRotated),
2289 => Ok(Sensors::SimpleOrientationDirectionRotated90DegreesCCW),
2290 => Ok(Sensors::SimpleOrientationDirectionRotated180DegreesCCW),
2291 => Ok(Sensors::SimpleOrientationDirectionRotated270DegreesCCW),
2292 => Ok(Sensors::SimpleOrientationDirectionFaceUp),
2293 => Ok(Sensors::SimpleOrientationDirectionFaceDown),
2304 => Ok(Sensors::VT_NULL),
2305 => Ok(Sensors::VT_BOOL),
2306 => Ok(Sensors::VT_UI1),
2307 => Ok(Sensors::VT_I1),
2308 => Ok(Sensors::VT_UI2),
2309 => Ok(Sensors::VT_I2),
2310 => Ok(Sensors::VT_UI4),
2311 => Ok(Sensors::VT_I4),
2312 => Ok(Sensors::VT_UI8),
2313 => Ok(Sensors::VT_I8),
2314 => Ok(Sensors::VT_R4),
2315 => Ok(Sensors::VT_R8),
2316 => Ok(Sensors::VT_WSTR),
2317 => Ok(Sensors::VT_STR),
2318 => Ok(Sensors::VT_CLSID),
2319 => Ok(Sensors::VT_VECTORVT_UI1),
2320 => Ok(Sensors::VT_F16E0),
2321 => Ok(Sensors::VT_F16E1),
2322 => Ok(Sensors::VT_F16E2),
2323 => Ok(Sensors::VT_F16E3),
2324 => Ok(Sensors::VT_F16E4),
2325 => Ok(Sensors::VT_F16E5),
2326 => Ok(Sensors::VT_F16E6),
2327 => Ok(Sensors::VT_F16E7),
2328 => Ok(Sensors::VT_F16E8),
2329 => Ok(Sensors::VT_F16E9),
2330 => Ok(Sensors::VT_F16EA),
2331 => Ok(Sensors::VT_F16EB),
2332 => Ok(Sensors::VT_F16EC),
2333 => Ok(Sensors::VT_F16ED),
2334 => Ok(Sensors::VT_F16EE),
2335 => Ok(Sensors::VT_F16EF),
2336 => Ok(Sensors::VT_F32E0),
2337 => Ok(Sensors::VT_F32E1),
2338 => Ok(Sensors::VT_F32E2),
2339 => Ok(Sensors::VT_F32E3),
2340 => Ok(Sensors::VT_F32E4),
2341 => Ok(Sensors::VT_F32E5),
2342 => Ok(Sensors::VT_F32E6),
2343 => Ok(Sensors::VT_F32E7),
2344 => Ok(Sensors::VT_F32E8),
2345 => Ok(Sensors::VT_F32E9),
2346 => Ok(Sensors::VT_F32EA),
2347 => Ok(Sensors::VT_F32EB),
2348 => Ok(Sensors::VT_F32EC),
2349 => Ok(Sensors::VT_F32ED),
2350 => Ok(Sensors::VT_F32EE),
2351 => Ok(Sensors::VT_F32EF),
2352 => Ok(Sensors::ActivityTypeUnknown),
2353 => Ok(Sensors::ActivityTypeStationary),
2354 => Ok(Sensors::ActivityTypeFidgeting),
2355 => Ok(Sensors::ActivityTypeWalking),
2356 => Ok(Sensors::ActivityTypeRunning),
2357 => Ok(Sensors::ActivityTypeInVehicle),
2358 => Ok(Sensors::ActivityTypeBiking),
2359 => Ok(Sensors::ActivityTypeIdle),
2368 => Ok(Sensors::UnitNotSpecified),
2369 => Ok(Sensors::UnitLux),
2370 => Ok(Sensors::UnitDegreesKelvin),
2371 => Ok(Sensors::UnitDegreesCelsius),
2372 => Ok(Sensors::UnitPascal),
2373 => Ok(Sensors::UnitNewton),
2374 => Ok(Sensors::UnitMetersSecond),
2375 => Ok(Sensors::UnitKilogram),
2376 => Ok(Sensors::UnitMeter),
2377 => Ok(Sensors::UnitMetersSecondSecond),
2378 => Ok(Sensors::UnitFarad),
2379 => Ok(Sensors::UnitAmpere),
2380 => Ok(Sensors::UnitWatt),
2381 => Ok(Sensors::UnitHenry),
2382 => Ok(Sensors::UnitOhm),
2383 => Ok(Sensors::UnitVolt),
2384 => Ok(Sensors::UnitHertz),
2385 => Ok(Sensors::UnitBar),
2386 => Ok(Sensors::UnitDegreesAnticlockwise),
2387 => Ok(Sensors::UnitDegreesClockwise),
2388 => Ok(Sensors::UnitDegrees),
2389 => Ok(Sensors::UnitDegreesSecond),
2390 => Ok(Sensors::UnitDegreesSecondSecond),
2391 => Ok(Sensors::UnitKnot),
2392 => Ok(Sensors::UnitPercent),
2393 => Ok(Sensors::UnitSecond),
2394 => Ok(Sensors::UnitMillisecond),
2395 => Ok(Sensors::UnitG),
2396 => Ok(Sensors::UnitBytes),
2397 => Ok(Sensors::UnitMilligauss),
2398 => Ok(Sensors::UnitBits),
2400 => Ok(Sensors::ActivityStateNoStateChange),
2401 => Ok(Sensors::ActivityStateStartActivity),
2402 => Ok(Sensors::ActivityStateEndActivity),
2416 => Ok(Sensors::Exponent0),
2417 => Ok(Sensors::Exponent1),
2418 => Ok(Sensors::Exponent2),
2419 => Ok(Sensors::Exponent3),
2420 => Ok(Sensors::Exponent4),
2421 => Ok(Sensors::Exponent5),
2422 => Ok(Sensors::Exponent6),
2423 => Ok(Sensors::Exponent7),
2424 => Ok(Sensors::Exponent8),
2425 => Ok(Sensors::Exponent9),
2426 => Ok(Sensors::ExponentA),
2427 => Ok(Sensors::ExponentB),
2428 => Ok(Sensors::ExponentC),
2429 => Ok(Sensors::ExponentD),
2430 => Ok(Sensors::ExponentE),
2431 => Ok(Sensors::ExponentF),
2432 => Ok(Sensors::DevicePositionUnknown),
2433 => Ok(Sensors::DevicePositionUnchanged),
2434 => Ok(Sensors::DevicePositionOnDesk),
2435 => Ok(Sensors::DevicePositionInHand),
2436 => Ok(Sensors::DevicePositionMovinginBag),
2437 => Ok(Sensors::DevicePositionStationaryinBag),
2448 => Ok(Sensors::StepTypeUnknown),
2449 => Ok(Sensors::StepTypeWalking),
2450 => Ok(Sensors::StepTypeRunning),
2464 => Ok(Sensors::GestureStateUnknown),
2465 => Ok(Sensors::GestureStateStarted),
2466 => Ok(Sensors::GestureStateCompleted),
2467 => Ok(Sensors::GestureStateCancelled),
2480 => Ok(Sensors::HingeFoldContributingPanelUnknown),
2481 => Ok(Sensors::HingeFoldContributingPanelPanel1),
2482 => Ok(Sensors::HingeFoldContributingPanelPanel2),
2483 => Ok(Sensors::HingeFoldContributingPanelBoth),
2484 => Ok(Sensors::HingeFoldTypeUnknown),
2485 => Ok(Sensors::HingeFoldTypeIncreasing),
2486 => Ok(Sensors::HingeFoldTypeDecreasing),
2496 => Ok(Sensors::HumanPresenceDetectionTypeVendorDefinedNonBiometric),
2497 => Ok(Sensors::HumanPresenceDetectionTypeVendorDefinedBiometric),
2498 => Ok(Sensors::HumanPresenceDetectionTypeFacialBiometric),
2499 => Ok(Sensors::HumanPresenceDetectionTypeAudioBiometric),
4096 => Ok(Sensors::ModifierChangeSensitivityAbsolute),
8192 => Ok(Sensors::ModifierMaximum),
12288 => Ok(Sensors::ModifierMinimum),
16384 => Ok(Sensors::ModifierAccuracy),
20480 => Ok(Sensors::ModifierResolution),
24576 => Ok(Sensors::ModifierThresholdHigh),
28672 => Ok(Sensors::ModifierThresholdLow),
32768 => Ok(Sensors::ModifierCalibrationOffset),
36864 => Ok(Sensors::ModifierCalibrationMultiplier),
40960 => Ok(Sensors::ModifierReportInterval),
45056 => Ok(Sensors::ModifierFrequencyMax),
49152 => Ok(Sensors::ModifierPeriodMax),
53248 => Ok(Sensors::ModifierChangeSensitivityPercentofRange),
57344 => Ok(Sensors::ModifierChangeSensitivityPercentRelative),
61440 => Ok(Sensors::ModifierVendorReserved),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for Sensors {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum MedicalInstrument {
MedicalUltrasound = 0x1,
VCRAcquisition = 0x20,
FreezeThaw = 0x21,
ClipStore = 0x22,
Update = 0x23,
Next = 0x24,
Save = 0x25,
Print = 0x26,
MicrophoneEnable = 0x27,
Cine = 0x40,
TransmitPower = 0x41,
Volume = 0x42,
Focus = 0x43,
Depth = 0x44,
SoftStepPrimary = 0x60,
SoftStepSecondary = 0x61,
DepthGainCompensation = 0x70,
ZoomSelect = 0x80,
ZoomAdjust = 0x81,
SpectralDopplerModeSelect = 0x82,
SpectralDopplerAdjust = 0x83,
ColorDopplerModeSelect = 0x84,
ColorDopplerAdjust = 0x85,
MotionModeSelect = 0x86,
MotionModeAdjust = 0x87,
TwoDModeSelect = 0x88,
TwoDModeAdjust = 0x89,
SoftControlSelect = 0xA0,
SoftControlAdjust = 0xA1,
}
impl MedicalInstrument {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
MedicalInstrument::MedicalUltrasound => "Medical Ultrasound",
MedicalInstrument::VCRAcquisition => "VCR/Acquisition",
MedicalInstrument::FreezeThaw => "Freeze/Thaw",
MedicalInstrument::ClipStore => "Clip Store",
MedicalInstrument::Update => "Update",
MedicalInstrument::Next => "Next",
MedicalInstrument::Save => "Save",
MedicalInstrument::Print => "Print",
MedicalInstrument::MicrophoneEnable => "Microphone Enable",
MedicalInstrument::Cine => "Cine",
MedicalInstrument::TransmitPower => "Transmit Power",
MedicalInstrument::Volume => "Volume",
MedicalInstrument::Focus => "Focus",
MedicalInstrument::Depth => "Depth",
MedicalInstrument::SoftStepPrimary => "Soft Step - Primary",
MedicalInstrument::SoftStepSecondary => "Soft Step - Secondary",
MedicalInstrument::DepthGainCompensation => "Depth Gain Compensation",
MedicalInstrument::ZoomSelect => "Zoom Select",
MedicalInstrument::ZoomAdjust => "Zoom Adjust",
MedicalInstrument::SpectralDopplerModeSelect => "Spectral Doppler Mode Select",
MedicalInstrument::SpectralDopplerAdjust => "Spectral Doppler Adjust",
MedicalInstrument::ColorDopplerModeSelect => "Color Doppler Mode Select",
MedicalInstrument::ColorDopplerAdjust => "Color Doppler Adjust",
MedicalInstrument::MotionModeSelect => "Motion Mode Select",
MedicalInstrument::MotionModeAdjust => "Motion Mode Adjust",
MedicalInstrument::TwoDModeSelect => "2-D Mode Select",
MedicalInstrument::TwoDModeAdjust => "2-D Mode Adjust",
MedicalInstrument::SoftControlSelect => "Soft Control Select",
MedicalInstrument::SoftControlAdjust => "Soft Control Adjust",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for MedicalInstrument {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for MedicalInstrument {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for MedicalInstrument {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&MedicalInstrument> for u16 {
fn from(medicalinstrument: &MedicalInstrument) -> u16 {
*medicalinstrument as u16
}
}
impl From<MedicalInstrument> for u16 {
fn from(medicalinstrument: MedicalInstrument) -> u16 {
u16::from(&medicalinstrument)
}
}
impl From<&MedicalInstrument> for u32 {
fn from(medicalinstrument: &MedicalInstrument) -> u32 {
let up = UsagePage::from(medicalinstrument);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(medicalinstrument) as u32;
up | id
}
}
impl From<&MedicalInstrument> for UsagePage {
fn from(_: &MedicalInstrument) -> UsagePage {
UsagePage::MedicalInstrument
}
}
impl From<MedicalInstrument> for UsagePage {
fn from(_: MedicalInstrument) -> UsagePage {
UsagePage::MedicalInstrument
}
}
impl From<&MedicalInstrument> for Usage {
fn from(medicalinstrument: &MedicalInstrument) -> Usage {
Usage::try_from(u32::from(medicalinstrument)).unwrap()
}
}
impl From<MedicalInstrument> for Usage {
fn from(medicalinstrument: MedicalInstrument) -> Usage {
Usage::from(&medicalinstrument)
}
}
impl TryFrom<u16> for MedicalInstrument {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<MedicalInstrument> {
match usage_id {
1 => Ok(MedicalInstrument::MedicalUltrasound),
32 => Ok(MedicalInstrument::VCRAcquisition),
33 => Ok(MedicalInstrument::FreezeThaw),
34 => Ok(MedicalInstrument::ClipStore),
35 => Ok(MedicalInstrument::Update),
36 => Ok(MedicalInstrument::Next),
37 => Ok(MedicalInstrument::Save),
38 => Ok(MedicalInstrument::Print),
39 => Ok(MedicalInstrument::MicrophoneEnable),
64 => Ok(MedicalInstrument::Cine),
65 => Ok(MedicalInstrument::TransmitPower),
66 => Ok(MedicalInstrument::Volume),
67 => Ok(MedicalInstrument::Focus),
68 => Ok(MedicalInstrument::Depth),
96 => Ok(MedicalInstrument::SoftStepPrimary),
97 => Ok(MedicalInstrument::SoftStepSecondary),
112 => Ok(MedicalInstrument::DepthGainCompensation),
128 => Ok(MedicalInstrument::ZoomSelect),
129 => Ok(MedicalInstrument::ZoomAdjust),
130 => Ok(MedicalInstrument::SpectralDopplerModeSelect),
131 => Ok(MedicalInstrument::SpectralDopplerAdjust),
132 => Ok(MedicalInstrument::ColorDopplerModeSelect),
133 => Ok(MedicalInstrument::ColorDopplerAdjust),
134 => Ok(MedicalInstrument::MotionModeSelect),
135 => Ok(MedicalInstrument::MotionModeAdjust),
136 => Ok(MedicalInstrument::TwoDModeSelect),
137 => Ok(MedicalInstrument::TwoDModeAdjust),
160 => Ok(MedicalInstrument::SoftControlSelect),
161 => Ok(MedicalInstrument::SoftControlAdjust),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for MedicalInstrument {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum BrailleDisplay {
BrailleDisplay = 0x1,
BrailleRow = 0x2,
EightDotBrailleCell = 0x3,
SixDotBrailleCell = 0x4,
NumberofBrailleCells = 0x5,
ScreenReaderControl = 0x6,
ScreenReaderIdentifier = 0x7,
RouterSet1 = 0xFA,
RouterSet2 = 0xFB,
RouterSet3 = 0xFC,
RouterKey = 0x100,
RowRouterKey = 0x101,
BrailleButtons = 0x200,
BrailleKeyboardDot1 = 0x201,
BrailleKeyboardDot2 = 0x202,
BrailleKeyboardDot3 = 0x203,
BrailleKeyboardDot4 = 0x204,
BrailleKeyboardDot5 = 0x205,
BrailleKeyboardDot6 = 0x206,
BrailleKeyboardDot7 = 0x207,
BrailleKeyboardDot8 = 0x208,
BrailleKeyboardSpace = 0x209,
BrailleKeyboardLeftSpace = 0x20A,
BrailleKeyboardRightSpace = 0x20B,
BrailleFaceControls = 0x20C,
BrailleLeftControls = 0x20D,
BrailleRightControls = 0x20E,
BrailleTopControls = 0x20F,
BrailleJoystickCenter = 0x210,
BrailleJoystickUp = 0x211,
BrailleJoystickDown = 0x212,
BrailleJoystickLeft = 0x213,
BrailleJoystickRight = 0x214,
BrailleDPadCenter = 0x215,
BrailleDPadUp = 0x216,
BrailleDPadDown = 0x217,
BrailleDPadLeft = 0x218,
BrailleDPadRight = 0x219,
BraillePanLeft = 0x21A,
BraillePanRight = 0x21B,
BrailleRockerUp = 0x21C,
BrailleRockerDown = 0x21D,
BrailleRockerPress = 0x21E,
}
impl BrailleDisplay {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
BrailleDisplay::BrailleDisplay => "Braille Display",
BrailleDisplay::BrailleRow => "Braille Row",
BrailleDisplay::EightDotBrailleCell => "8 Dot Braille Cell",
BrailleDisplay::SixDotBrailleCell => "6 Dot Braille Cell",
BrailleDisplay::NumberofBrailleCells => "Number of Braille Cells",
BrailleDisplay::ScreenReaderControl => "Screen Reader Control",
BrailleDisplay::ScreenReaderIdentifier => "Screen Reader Identifier",
BrailleDisplay::RouterSet1 => "Router Set 1",
BrailleDisplay::RouterSet2 => "Router Set 2",
BrailleDisplay::RouterSet3 => "Router Set 3",
BrailleDisplay::RouterKey => "Router Key",
BrailleDisplay::RowRouterKey => "Row Router Key",
BrailleDisplay::BrailleButtons => "Braille Buttons",
BrailleDisplay::BrailleKeyboardDot1 => "Braille Keyboard Dot 1",
BrailleDisplay::BrailleKeyboardDot2 => "Braille Keyboard Dot 2",
BrailleDisplay::BrailleKeyboardDot3 => "Braille Keyboard Dot 3",
BrailleDisplay::BrailleKeyboardDot4 => "Braille Keyboard Dot 4",
BrailleDisplay::BrailleKeyboardDot5 => "Braille Keyboard Dot 5",
BrailleDisplay::BrailleKeyboardDot6 => "Braille Keyboard Dot 6",
BrailleDisplay::BrailleKeyboardDot7 => "Braille Keyboard Dot 7",
BrailleDisplay::BrailleKeyboardDot8 => "Braille Keyboard Dot 8",
BrailleDisplay::BrailleKeyboardSpace => "Braille Keyboard Space",
BrailleDisplay::BrailleKeyboardLeftSpace => "Braille Keyboard Left Space",
BrailleDisplay::BrailleKeyboardRightSpace => "Braille Keyboard Right Space",
BrailleDisplay::BrailleFaceControls => "Braille Face Controls",
BrailleDisplay::BrailleLeftControls => "Braille Left Controls",
BrailleDisplay::BrailleRightControls => "Braille Right Controls",
BrailleDisplay::BrailleTopControls => "Braille Top Controls",
BrailleDisplay::BrailleJoystickCenter => "Braille Joystick Center",
BrailleDisplay::BrailleJoystickUp => "Braille Joystick Up",
BrailleDisplay::BrailleJoystickDown => "Braille Joystick Down",
BrailleDisplay::BrailleJoystickLeft => "Braille Joystick Left",
BrailleDisplay::BrailleJoystickRight => "Braille Joystick Right",
BrailleDisplay::BrailleDPadCenter => "Braille D-Pad Center",
BrailleDisplay::BrailleDPadUp => "Braille D-Pad Up",
BrailleDisplay::BrailleDPadDown => "Braille D-Pad Down",
BrailleDisplay::BrailleDPadLeft => "Braille D-Pad Left",
BrailleDisplay::BrailleDPadRight => "Braille D-Pad Right",
BrailleDisplay::BraillePanLeft => "Braille Pan Left",
BrailleDisplay::BraillePanRight => "Braille Pan Right",
BrailleDisplay::BrailleRockerUp => "Braille Rocker Up",
BrailleDisplay::BrailleRockerDown => "Braille Rocker Down",
BrailleDisplay::BrailleRockerPress => "Braille Rocker Press",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for BrailleDisplay {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for BrailleDisplay {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for BrailleDisplay {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&BrailleDisplay> for u16 {
fn from(brailledisplay: &BrailleDisplay) -> u16 {
*brailledisplay as u16
}
}
impl From<BrailleDisplay> for u16 {
fn from(brailledisplay: BrailleDisplay) -> u16 {
u16::from(&brailledisplay)
}
}
impl From<&BrailleDisplay> for u32 {
fn from(brailledisplay: &BrailleDisplay) -> u32 {
let up = UsagePage::from(brailledisplay);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(brailledisplay) as u32;
up | id
}
}
impl From<&BrailleDisplay> for UsagePage {
fn from(_: &BrailleDisplay) -> UsagePage {
UsagePage::BrailleDisplay
}
}
impl From<BrailleDisplay> for UsagePage {
fn from(_: BrailleDisplay) -> UsagePage {
UsagePage::BrailleDisplay
}
}
impl From<&BrailleDisplay> for Usage {
fn from(brailledisplay: &BrailleDisplay) -> Usage {
Usage::try_from(u32::from(brailledisplay)).unwrap()
}
}
impl From<BrailleDisplay> for Usage {
fn from(brailledisplay: BrailleDisplay) -> Usage {
Usage::from(&brailledisplay)
}
}
impl TryFrom<u16> for BrailleDisplay {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<BrailleDisplay> {
match usage_id {
1 => Ok(BrailleDisplay::BrailleDisplay),
2 => Ok(BrailleDisplay::BrailleRow),
3 => Ok(BrailleDisplay::EightDotBrailleCell),
4 => Ok(BrailleDisplay::SixDotBrailleCell),
5 => Ok(BrailleDisplay::NumberofBrailleCells),
6 => Ok(BrailleDisplay::ScreenReaderControl),
7 => Ok(BrailleDisplay::ScreenReaderIdentifier),
250 => Ok(BrailleDisplay::RouterSet1),
251 => Ok(BrailleDisplay::RouterSet2),
252 => Ok(BrailleDisplay::RouterSet3),
256 => Ok(BrailleDisplay::RouterKey),
257 => Ok(BrailleDisplay::RowRouterKey),
512 => Ok(BrailleDisplay::BrailleButtons),
513 => Ok(BrailleDisplay::BrailleKeyboardDot1),
514 => Ok(BrailleDisplay::BrailleKeyboardDot2),
515 => Ok(BrailleDisplay::BrailleKeyboardDot3),
516 => Ok(BrailleDisplay::BrailleKeyboardDot4),
517 => Ok(BrailleDisplay::BrailleKeyboardDot5),
518 => Ok(BrailleDisplay::BrailleKeyboardDot6),
519 => Ok(BrailleDisplay::BrailleKeyboardDot7),
520 => Ok(BrailleDisplay::BrailleKeyboardDot8),
521 => Ok(BrailleDisplay::BrailleKeyboardSpace),
522 => Ok(BrailleDisplay::BrailleKeyboardLeftSpace),
523 => Ok(BrailleDisplay::BrailleKeyboardRightSpace),
524 => Ok(BrailleDisplay::BrailleFaceControls),
525 => Ok(BrailleDisplay::BrailleLeftControls),
526 => Ok(BrailleDisplay::BrailleRightControls),
527 => Ok(BrailleDisplay::BrailleTopControls),
528 => Ok(BrailleDisplay::BrailleJoystickCenter),
529 => Ok(BrailleDisplay::BrailleJoystickUp),
530 => Ok(BrailleDisplay::BrailleJoystickDown),
531 => Ok(BrailleDisplay::BrailleJoystickLeft),
532 => Ok(BrailleDisplay::BrailleJoystickRight),
533 => Ok(BrailleDisplay::BrailleDPadCenter),
534 => Ok(BrailleDisplay::BrailleDPadUp),
535 => Ok(BrailleDisplay::BrailleDPadDown),
536 => Ok(BrailleDisplay::BrailleDPadLeft),
537 => Ok(BrailleDisplay::BrailleDPadRight),
538 => Ok(BrailleDisplay::BraillePanLeft),
539 => Ok(BrailleDisplay::BraillePanRight),
540 => Ok(BrailleDisplay::BrailleRockerUp),
541 => Ok(BrailleDisplay::BrailleRockerDown),
542 => Ok(BrailleDisplay::BrailleRockerPress),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for BrailleDisplay {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum LightingAndIllumination {
LampArray = 0x1,
LampArrayAttributesReport = 0x2,
LampCount = 0x3,
BoundingBoxWidthInMicrometers = 0x4,
BoundingBoxHeightInMicrometers = 0x5,
BoundingBoxDepthInMicrometers = 0x6,
LampArrayKind = 0x7,
MinUpdateIntervalInMicroseconds = 0x8,
LampAttributesRequestReport = 0x20,
LampId = 0x21,
LampAttributesResponseReport = 0x22,
PositionXInMicrometers = 0x23,
PositionYInMicrometers = 0x24,
PositionZInMicrometers = 0x25,
LampPurposes = 0x26,
UpdateLatencyInMicroseconds = 0x27,
RedLevelCount = 0x28,
GreenLevelCount = 0x29,
BlueLevelCount = 0x2A,
IntensityLevelCount = 0x2B,
IsProgrammable = 0x2C,
InputBinding = 0x2D,
LampMultiUpdateReport = 0x50,
RedUpdateChannel = 0x51,
GreenUpdateChannel = 0x52,
BlueUpdateChannel = 0x53,
IntensityUpdateChannel = 0x54,
LampUpdateFlags = 0x55,
LampRangeUpdateReport = 0x60,
LampIdStart = 0x61,
LampIdEnd = 0x62,
LampArrayControlReport = 0x70,
AutonomousMode = 0x71,
}
impl LightingAndIllumination {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
LightingAndIllumination::LampArray => "LampArray",
LightingAndIllumination::LampArrayAttributesReport => "LampArrayAttributesReport",
LightingAndIllumination::LampCount => "LampCount",
LightingAndIllumination::BoundingBoxWidthInMicrometers => {
"BoundingBoxWidthInMicrometers"
}
LightingAndIllumination::BoundingBoxHeightInMicrometers => {
"BoundingBoxHeightInMicrometers"
}
LightingAndIllumination::BoundingBoxDepthInMicrometers => {
"BoundingBoxDepthInMicrometers"
}
LightingAndIllumination::LampArrayKind => "LampArrayKind",
LightingAndIllumination::MinUpdateIntervalInMicroseconds => {
"MinUpdateIntervalInMicroseconds"
}
LightingAndIllumination::LampAttributesRequestReport => "LampAttributesRequestReport",
LightingAndIllumination::LampId => "LampId",
LightingAndIllumination::LampAttributesResponseReport => "LampAttributesResponseReport",
LightingAndIllumination::PositionXInMicrometers => "PositionXInMicrometers",
LightingAndIllumination::PositionYInMicrometers => "PositionYInMicrometers",
LightingAndIllumination::PositionZInMicrometers => "PositionZInMicrometers",
LightingAndIllumination::LampPurposes => "LampPurposes",
LightingAndIllumination::UpdateLatencyInMicroseconds => "UpdateLatencyInMicroseconds",
LightingAndIllumination::RedLevelCount => "RedLevelCount",
LightingAndIllumination::GreenLevelCount => "GreenLevelCount",
LightingAndIllumination::BlueLevelCount => "BlueLevelCount",
LightingAndIllumination::IntensityLevelCount => "IntensityLevelCount",
LightingAndIllumination::IsProgrammable => "IsProgrammable",
LightingAndIllumination::InputBinding => "InputBinding",
LightingAndIllumination::LampMultiUpdateReport => "LampMultiUpdateReport",
LightingAndIllumination::RedUpdateChannel => "RedUpdateChannel",
LightingAndIllumination::GreenUpdateChannel => "GreenUpdateChannel",
LightingAndIllumination::BlueUpdateChannel => "BlueUpdateChannel",
LightingAndIllumination::IntensityUpdateChannel => "IntensityUpdateChannel",
LightingAndIllumination::LampUpdateFlags => "LampUpdateFlags",
LightingAndIllumination::LampRangeUpdateReport => "LampRangeUpdateReport",
LightingAndIllumination::LampIdStart => "LampIdStart",
LightingAndIllumination::LampIdEnd => "LampIdEnd",
LightingAndIllumination::LampArrayControlReport => "LampArrayControlReport",
LightingAndIllumination::AutonomousMode => "AutonomousMode",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for LightingAndIllumination {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for LightingAndIllumination {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for LightingAndIllumination {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&LightingAndIllumination> for u16 {
fn from(lightingandillumination: &LightingAndIllumination) -> u16 {
*lightingandillumination as u16
}
}
impl From<LightingAndIllumination> for u16 {
fn from(lightingandillumination: LightingAndIllumination) -> u16 {
u16::from(&lightingandillumination)
}
}
impl From<&LightingAndIllumination> for u32 {
fn from(lightingandillumination: &LightingAndIllumination) -> u32 {
let up = UsagePage::from(lightingandillumination);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(lightingandillumination) as u32;
up | id
}
}
impl From<&LightingAndIllumination> for UsagePage {
fn from(_: &LightingAndIllumination) -> UsagePage {
UsagePage::LightingAndIllumination
}
}
impl From<LightingAndIllumination> for UsagePage {
fn from(_: LightingAndIllumination) -> UsagePage {
UsagePage::LightingAndIllumination
}
}
impl From<&LightingAndIllumination> for Usage {
fn from(lightingandillumination: &LightingAndIllumination) -> Usage {
Usage::try_from(u32::from(lightingandillumination)).unwrap()
}
}
impl From<LightingAndIllumination> for Usage {
fn from(lightingandillumination: LightingAndIllumination) -> Usage {
Usage::from(&lightingandillumination)
}
}
impl TryFrom<u16> for LightingAndIllumination {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<LightingAndIllumination> {
match usage_id {
1 => Ok(LightingAndIllumination::LampArray),
2 => Ok(LightingAndIllumination::LampArrayAttributesReport),
3 => Ok(LightingAndIllumination::LampCount),
4 => Ok(LightingAndIllumination::BoundingBoxWidthInMicrometers),
5 => Ok(LightingAndIllumination::BoundingBoxHeightInMicrometers),
6 => Ok(LightingAndIllumination::BoundingBoxDepthInMicrometers),
7 => Ok(LightingAndIllumination::LampArrayKind),
8 => Ok(LightingAndIllumination::MinUpdateIntervalInMicroseconds),
32 => Ok(LightingAndIllumination::LampAttributesRequestReport),
33 => Ok(LightingAndIllumination::LampId),
34 => Ok(LightingAndIllumination::LampAttributesResponseReport),
35 => Ok(LightingAndIllumination::PositionXInMicrometers),
36 => Ok(LightingAndIllumination::PositionYInMicrometers),
37 => Ok(LightingAndIllumination::PositionZInMicrometers),
38 => Ok(LightingAndIllumination::LampPurposes),
39 => Ok(LightingAndIllumination::UpdateLatencyInMicroseconds),
40 => Ok(LightingAndIllumination::RedLevelCount),
41 => Ok(LightingAndIllumination::GreenLevelCount),
42 => Ok(LightingAndIllumination::BlueLevelCount),
43 => Ok(LightingAndIllumination::IntensityLevelCount),
44 => Ok(LightingAndIllumination::IsProgrammable),
45 => Ok(LightingAndIllumination::InputBinding),
80 => Ok(LightingAndIllumination::LampMultiUpdateReport),
81 => Ok(LightingAndIllumination::RedUpdateChannel),
82 => Ok(LightingAndIllumination::GreenUpdateChannel),
83 => Ok(LightingAndIllumination::BlueUpdateChannel),
84 => Ok(LightingAndIllumination::IntensityUpdateChannel),
85 => Ok(LightingAndIllumination::LampUpdateFlags),
96 => Ok(LightingAndIllumination::LampRangeUpdateReport),
97 => Ok(LightingAndIllumination::LampIdStart),
98 => Ok(LightingAndIllumination::LampIdEnd),
112 => Ok(LightingAndIllumination::LampArrayControlReport),
113 => Ok(LightingAndIllumination::AutonomousMode),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for LightingAndIllumination {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum Monitor {
MonitorControl = 0x1,
EDIDInformation = 0x2,
VDIFInformation = 0x3,
VESAVersion = 0x4,
}
impl Monitor {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
Monitor::MonitorControl => "Monitor Control",
Monitor::EDIDInformation => "EDID Information",
Monitor::VDIFInformation => "VDIF Information",
Monitor::VESAVersion => "VESA Version",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for Monitor {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for Monitor {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for Monitor {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&Monitor> for u16 {
fn from(monitor: &Monitor) -> u16 {
*monitor as u16
}
}
impl From<Monitor> for u16 {
fn from(monitor: Monitor) -> u16 {
u16::from(&monitor)
}
}
impl From<&Monitor> for u32 {
fn from(monitor: &Monitor) -> u32 {
let up = UsagePage::from(monitor);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(monitor) as u32;
up | id
}
}
impl From<&Monitor> for UsagePage {
fn from(_: &Monitor) -> UsagePage {
UsagePage::Monitor
}
}
impl From<Monitor> for UsagePage {
fn from(_: Monitor) -> UsagePage {
UsagePage::Monitor
}
}
impl From<&Monitor> for Usage {
fn from(monitor: &Monitor) -> Usage {
Usage::try_from(u32::from(monitor)).unwrap()
}
}
impl From<Monitor> for Usage {
fn from(monitor: Monitor) -> Usage {
Usage::from(&monitor)
}
}
impl TryFrom<u16> for Monitor {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<Monitor> {
match usage_id {
1 => Ok(Monitor::MonitorControl),
2 => Ok(Monitor::EDIDInformation),
3 => Ok(Monitor::VDIFInformation),
4 => Ok(Monitor::VESAVersion),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for Monitor {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug)]
#[non_exhaustive]
pub enum MonitorEnumerated {
MonitorEnumerated(u16),
}
impl MonitorEnumerated {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
MonitorEnumerated::MonitorEnumerated(enumerate) => format!("Enumerate {enumerate}"),
}
}
}
#[cfg(feature = "std")]
impl fmt::Display for MonitorEnumerated {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for MonitorEnumerated {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for MonitorEnumerated {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&MonitorEnumerated> for u16 {
fn from(monitorenumerated: &MonitorEnumerated) -> u16 {
match *monitorenumerated {
MonitorEnumerated::MonitorEnumerated(enumerate) => enumerate,
}
}
}
impl From<MonitorEnumerated> for u16 {
fn from(monitorenumerated: MonitorEnumerated) -> u16 {
u16::from(&monitorenumerated)
}
}
impl From<&MonitorEnumerated> for u32 {
fn from(monitorenumerated: &MonitorEnumerated) -> u32 {
let up = UsagePage::from(monitorenumerated);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(monitorenumerated) as u32;
up | id
}
}
impl From<&MonitorEnumerated> for UsagePage {
fn from(_: &MonitorEnumerated) -> UsagePage {
UsagePage::MonitorEnumerated
}
}
impl From<MonitorEnumerated> for UsagePage {
fn from(_: MonitorEnumerated) -> UsagePage {
UsagePage::MonitorEnumerated
}
}
impl From<&MonitorEnumerated> for Usage {
fn from(monitorenumerated: &MonitorEnumerated) -> Usage {
Usage::try_from(u32::from(monitorenumerated)).unwrap()
}
}
impl From<MonitorEnumerated> for Usage {
fn from(monitorenumerated: MonitorEnumerated) -> Usage {
Usage::from(&monitorenumerated)
}
}
impl TryFrom<u16> for MonitorEnumerated {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<MonitorEnumerated> {
match usage_id {
n => Ok(MonitorEnumerated::MonitorEnumerated(n)),
}
}
}
impl BitOr<u16> for MonitorEnumerated {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum VESAVirtualControls {
Degauss = 0x1,
Brightness = 0x10,
Contrast = 0x12,
RedVideoGain = 0x16,
GreenVideoGain = 0x18,
BlueVideoGain = 0x1A,
Focus = 0x1C,
HorizontalPosition = 0x20,
HorizontalSize = 0x22,
HorizontalPincushion = 0x24,
HorizontalPincushionBalance = 0x26,
HorizontalMisconvergence = 0x28,
HorizontalLinearity = 0x2A,
HorizontalLinearityBalance = 0x2C,
VerticalPosition = 0x30,
VerticalSize = 0x32,
VerticalPincushion = 0x34,
VerticalPincushionBalance = 0x36,
VerticalMisconvergence = 0x38,
VerticalLinearity = 0x3A,
VerticalLinearityBalance = 0x3C,
ParallelogramDistortionKeyBalance = 0x40,
TrapezoidalDistortionKey = 0x42,
TiltRotation = 0x44,
TopCornerDistortionControl = 0x46,
TopCornerDistortionBalance = 0x48,
BottomCornerDistortionControl = 0x4A,
BottomCornerDistortionBalance = 0x4C,
HorizontalMoiré = 0x56,
VerticalMoiré = 0x58,
InputLevelSelect = 0x5E,
InputSourceSelect = 0x60,
RedVideoBlackLevel = 0x6C,
GreenVideoBlackLevel = 0x6E,
BlueVideoBlackLevel = 0x70,
AutoSizeCenter = 0xA2,
PolarityHorizontalSynchronization = 0xA4,
PolarityVerticalSynchronization = 0xA6,
SynchronizationType = 0xA8,
ScreenOrientation = 0xAA,
HorizontalFrequency = 0xAC,
VerticalFrequency = 0xAE,
Settings = 0xB0,
OnScreenDisplay = 0xCA,
StereoMode = 0xD4,
}
impl VESAVirtualControls {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
VESAVirtualControls::Degauss => "Degauss",
VESAVirtualControls::Brightness => "Brightness",
VESAVirtualControls::Contrast => "Contrast",
VESAVirtualControls::RedVideoGain => "Red Video Gain",
VESAVirtualControls::GreenVideoGain => "Green Video Gain",
VESAVirtualControls::BlueVideoGain => "Blue Video Gain",
VESAVirtualControls::Focus => "Focus",
VESAVirtualControls::HorizontalPosition => "Horizontal Position",
VESAVirtualControls::HorizontalSize => "Horizontal Size",
VESAVirtualControls::HorizontalPincushion => "Horizontal Pincushion",
VESAVirtualControls::HorizontalPincushionBalance => "Horizontal Pincushion Balance",
VESAVirtualControls::HorizontalMisconvergence => "Horizontal Misconvergence",
VESAVirtualControls::HorizontalLinearity => "Horizontal Linearity",
VESAVirtualControls::HorizontalLinearityBalance => "Horizontal Linearity Balance",
VESAVirtualControls::VerticalPosition => "Vertical Position",
VESAVirtualControls::VerticalSize => "Vertical Size",
VESAVirtualControls::VerticalPincushion => "Vertical Pincushion",
VESAVirtualControls::VerticalPincushionBalance => "Vertical Pincushion Balance",
VESAVirtualControls::VerticalMisconvergence => "Vertical Misconvergence",
VESAVirtualControls::VerticalLinearity => "Vertical Linearity",
VESAVirtualControls::VerticalLinearityBalance => "Vertical Linearity Balance",
VESAVirtualControls::ParallelogramDistortionKeyBalance => {
"Parallelogram Distortion (Key Balance)"
}
VESAVirtualControls::TrapezoidalDistortionKey => "Trapezoidal Distortion (Key)",
VESAVirtualControls::TiltRotation => "Tilt (Rotation)",
VESAVirtualControls::TopCornerDistortionControl => "Top Corner Distortion Control",
VESAVirtualControls::TopCornerDistortionBalance => "Top Corner Distortion Balance",
VESAVirtualControls::BottomCornerDistortionControl => {
"Bottom Corner Distortion Control"
}
VESAVirtualControls::BottomCornerDistortionBalance => {
"Bottom Corner Distortion Balance"
}
VESAVirtualControls::HorizontalMoiré => "Horizontal Moiré",
VESAVirtualControls::VerticalMoiré => "Vertical Moiré",
VESAVirtualControls::InputLevelSelect => "Input Level Select",
VESAVirtualControls::InputSourceSelect => "Input Source Select",
VESAVirtualControls::RedVideoBlackLevel => "Red Video Black Level",
VESAVirtualControls::GreenVideoBlackLevel => "Green Video Black Level",
VESAVirtualControls::BlueVideoBlackLevel => "Blue Video Black Level",
VESAVirtualControls::AutoSizeCenter => "Auto Size Center",
VESAVirtualControls::PolarityHorizontalSynchronization => {
"Polarity Horizontal Synchronization"
}
VESAVirtualControls::PolarityVerticalSynchronization => {
"Polarity Vertical Synchronization"
}
VESAVirtualControls::SynchronizationType => "Synchronization Type",
VESAVirtualControls::ScreenOrientation => "Screen Orientation",
VESAVirtualControls::HorizontalFrequency => "Horizontal Frequency",
VESAVirtualControls::VerticalFrequency => "Vertical Frequency",
VESAVirtualControls::Settings => "Settings",
VESAVirtualControls::OnScreenDisplay => "On Screen Display",
VESAVirtualControls::StereoMode => "Stereo Mode",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for VESAVirtualControls {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for VESAVirtualControls {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for VESAVirtualControls {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&VESAVirtualControls> for u16 {
fn from(vesavirtualcontrols: &VESAVirtualControls) -> u16 {
*vesavirtualcontrols as u16
}
}
impl From<VESAVirtualControls> for u16 {
fn from(vesavirtualcontrols: VESAVirtualControls) -> u16 {
u16::from(&vesavirtualcontrols)
}
}
impl From<&VESAVirtualControls> for u32 {
fn from(vesavirtualcontrols: &VESAVirtualControls) -> u32 {
let up = UsagePage::from(vesavirtualcontrols);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(vesavirtualcontrols) as u32;
up | id
}
}
impl From<&VESAVirtualControls> for UsagePage {
fn from(_: &VESAVirtualControls) -> UsagePage {
UsagePage::VESAVirtualControls
}
}
impl From<VESAVirtualControls> for UsagePage {
fn from(_: VESAVirtualControls) -> UsagePage {
UsagePage::VESAVirtualControls
}
}
impl From<&VESAVirtualControls> for Usage {
fn from(vesavirtualcontrols: &VESAVirtualControls) -> Usage {
Usage::try_from(u32::from(vesavirtualcontrols)).unwrap()
}
}
impl From<VESAVirtualControls> for Usage {
fn from(vesavirtualcontrols: VESAVirtualControls) -> Usage {
Usage::from(&vesavirtualcontrols)
}
}
impl TryFrom<u16> for VESAVirtualControls {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<VESAVirtualControls> {
match usage_id {
1 => Ok(VESAVirtualControls::Degauss),
16 => Ok(VESAVirtualControls::Brightness),
18 => Ok(VESAVirtualControls::Contrast),
22 => Ok(VESAVirtualControls::RedVideoGain),
24 => Ok(VESAVirtualControls::GreenVideoGain),
26 => Ok(VESAVirtualControls::BlueVideoGain),
28 => Ok(VESAVirtualControls::Focus),
32 => Ok(VESAVirtualControls::HorizontalPosition),
34 => Ok(VESAVirtualControls::HorizontalSize),
36 => Ok(VESAVirtualControls::HorizontalPincushion),
38 => Ok(VESAVirtualControls::HorizontalPincushionBalance),
40 => Ok(VESAVirtualControls::HorizontalMisconvergence),
42 => Ok(VESAVirtualControls::HorizontalLinearity),
44 => Ok(VESAVirtualControls::HorizontalLinearityBalance),
48 => Ok(VESAVirtualControls::VerticalPosition),
50 => Ok(VESAVirtualControls::VerticalSize),
52 => Ok(VESAVirtualControls::VerticalPincushion),
54 => Ok(VESAVirtualControls::VerticalPincushionBalance),
56 => Ok(VESAVirtualControls::VerticalMisconvergence),
58 => Ok(VESAVirtualControls::VerticalLinearity),
60 => Ok(VESAVirtualControls::VerticalLinearityBalance),
64 => Ok(VESAVirtualControls::ParallelogramDistortionKeyBalance),
66 => Ok(VESAVirtualControls::TrapezoidalDistortionKey),
68 => Ok(VESAVirtualControls::TiltRotation),
70 => Ok(VESAVirtualControls::TopCornerDistortionControl),
72 => Ok(VESAVirtualControls::TopCornerDistortionBalance),
74 => Ok(VESAVirtualControls::BottomCornerDistortionControl),
76 => Ok(VESAVirtualControls::BottomCornerDistortionBalance),
86 => Ok(VESAVirtualControls::HorizontalMoiré),
88 => Ok(VESAVirtualControls::VerticalMoiré),
94 => Ok(VESAVirtualControls::InputLevelSelect),
96 => Ok(VESAVirtualControls::InputSourceSelect),
108 => Ok(VESAVirtualControls::RedVideoBlackLevel),
110 => Ok(VESAVirtualControls::GreenVideoBlackLevel),
112 => Ok(VESAVirtualControls::BlueVideoBlackLevel),
162 => Ok(VESAVirtualControls::AutoSizeCenter),
164 => Ok(VESAVirtualControls::PolarityHorizontalSynchronization),
166 => Ok(VESAVirtualControls::PolarityVerticalSynchronization),
168 => Ok(VESAVirtualControls::SynchronizationType),
170 => Ok(VESAVirtualControls::ScreenOrientation),
172 => Ok(VESAVirtualControls::HorizontalFrequency),
174 => Ok(VESAVirtualControls::VerticalFrequency),
176 => Ok(VESAVirtualControls::Settings),
202 => Ok(VESAVirtualControls::OnScreenDisplay),
212 => Ok(VESAVirtualControls::StereoMode),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for VESAVirtualControls {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum Power {
iName = 0x1,
PresentStatus = 0x2,
ChangedStatus = 0x3,
UPS = 0x4,
PowerSupply = 0x5,
BatterySystem = 0x10,
BatterySystemId = 0x11,
Battery = 0x12,
BatteryId = 0x13,
Charger = 0x14,
ChargerId = 0x15,
PowerConverter = 0x16,
PowerConverterId = 0x17,
OutletSystem = 0x18,
OutletSystemId = 0x19,
Input = 0x1A,
InputId = 0x1B,
Output = 0x1C,
OutputId = 0x1D,
Flow = 0x1E,
FlowId = 0x1F,
Outlet = 0x20,
OutletId = 0x21,
Gang = 0x22,
GangId = 0x23,
PowerSummary = 0x24,
PowerSummaryId = 0x25,
Voltage = 0x30,
Current = 0x31,
Frequency = 0x32,
ApparentPower = 0x33,
ActivePower = 0x34,
PercentLoad = 0x35,
Temperature = 0x36,
Humidity = 0x37,
BadCount = 0x38,
ConfigVoltage = 0x40,
ConfigCurrent = 0x41,
ConfigFrequency = 0x42,
ConfigApparentPower = 0x43,
ConfigActivePower = 0x44,
ConfigPercentLoad = 0x45,
ConfigTemperature = 0x46,
ConfigHumidity = 0x47,
SwitchOnControl = 0x50,
SwitchOffControl = 0x51,
ToggleControl = 0x52,
LowVoltageTransfer = 0x53,
HighVoltageTransfer = 0x54,
DelayBeforeReboot = 0x55,
DelayBeforeStartup = 0x56,
DelayBeforeShutdown = 0x57,
Test = 0x58,
ModuleReset = 0x59,
AudibleAlarmControl = 0x5A,
Present = 0x60,
Good = 0x61,
InternalFailure = 0x62,
VoltagOutOfRange = 0x63,
FrequencyOutOfRange = 0x64,
Overload = 0x65,
OverCharged = 0x66,
OverTemperature = 0x67,
ShutdownRequested = 0x68,
ShutdownImminent = 0x69,
SwitchOnOff = 0x6B,
Switchable = 0x6C,
Used = 0x6D,
Boost = 0x6E,
Buck = 0x6F,
Initialized = 0x70,
Tested = 0x71,
AwaitingPower = 0x72,
CommunicationLost = 0x73,
iManufacturer = 0xFD,
iProduct = 0xFE,
iSerialNumber = 0xFF,
}
impl Power {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
Power::iName => "iName",
Power::PresentStatus => "Present Status",
Power::ChangedStatus => "Changed Status",
Power::UPS => "UPS",
Power::PowerSupply => "Power Supply",
Power::BatterySystem => "Battery System",
Power::BatterySystemId => "Battery System Id",
Power::Battery => "Battery",
Power::BatteryId => "Battery Id",
Power::Charger => "Charger",
Power::ChargerId => "Charger Id",
Power::PowerConverter => "Power Converter",
Power::PowerConverterId => "Power Converter Id",
Power::OutletSystem => "Outlet System",
Power::OutletSystemId => "Outlet System Id",
Power::Input => "Input",
Power::InputId => "Input Id",
Power::Output => "Output",
Power::OutputId => "Output Id",
Power::Flow => "Flow",
Power::FlowId => "Flow Id",
Power::Outlet => "Outlet",
Power::OutletId => "Outlet Id",
Power::Gang => "Gang",
Power::GangId => "Gang Id",
Power::PowerSummary => "Power Summary",
Power::PowerSummaryId => "Power Summary Id",
Power::Voltage => "Voltage",
Power::Current => "Current",
Power::Frequency => "Frequency",
Power::ApparentPower => "Apparent Power",
Power::ActivePower => "Active Power",
Power::PercentLoad => "Percent Load",
Power::Temperature => "Temperature",
Power::Humidity => "Humidity",
Power::BadCount => "Bad Count",
Power::ConfigVoltage => "Config Voltage",
Power::ConfigCurrent => "Config Current",
Power::ConfigFrequency => "Config Frequency",
Power::ConfigApparentPower => "Config Apparent Power",
Power::ConfigActivePower => "Config Active Power",
Power::ConfigPercentLoad => "Config Percent Load",
Power::ConfigTemperature => "Config Temperature",
Power::ConfigHumidity => "Config Humidity",
Power::SwitchOnControl => "Switch On Control",
Power::SwitchOffControl => "Switch Off Control",
Power::ToggleControl => "Toggle Control",
Power::LowVoltageTransfer => "Low Voltage Transfer",
Power::HighVoltageTransfer => "High Voltage Transfer",
Power::DelayBeforeReboot => "Delay Before Reboot",
Power::DelayBeforeStartup => "Delay Before Startup",
Power::DelayBeforeShutdown => "Delay Before Shutdown",
Power::Test => "Test",
Power::ModuleReset => "Module Reset",
Power::AudibleAlarmControl => "Audible Alarm Control",
Power::Present => "Present",
Power::Good => "Good",
Power::InternalFailure => "Internal Failure",
Power::VoltagOutOfRange => "Voltag Out Of Range",
Power::FrequencyOutOfRange => "Frequency Out Of Range",
Power::Overload => "Overload",
Power::OverCharged => "Over Charged",
Power::OverTemperature => "Over Temperature",
Power::ShutdownRequested => "Shutdown Requested",
Power::ShutdownImminent => "Shutdown Imminent",
Power::SwitchOnOff => "Switch On/Off",
Power::Switchable => "Switchable",
Power::Used => "Used",
Power::Boost => "Boost",
Power::Buck => "Buck",
Power::Initialized => "Initialized",
Power::Tested => "Tested",
Power::AwaitingPower => "Awaiting Power",
Power::CommunicationLost => "Communication Lost",
Power::iManufacturer => "iManufacturer",
Power::iProduct => "iProduct",
Power::iSerialNumber => "iSerialNumber",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for Power {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for Power {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for Power {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&Power> for u16 {
fn from(power: &Power) -> u16 {
*power as u16
}
}
impl From<Power> for u16 {
fn from(power: Power) -> u16 {
u16::from(&power)
}
}
impl From<&Power> for u32 {
fn from(power: &Power) -> u32 {
let up = UsagePage::from(power);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(power) as u32;
up | id
}
}
impl From<&Power> for UsagePage {
fn from(_: &Power) -> UsagePage {
UsagePage::Power
}
}
impl From<Power> for UsagePage {
fn from(_: Power) -> UsagePage {
UsagePage::Power
}
}
impl From<&Power> for Usage {
fn from(power: &Power) -> Usage {
Usage::try_from(u32::from(power)).unwrap()
}
}
impl From<Power> for Usage {
fn from(power: Power) -> Usage {
Usage::from(&power)
}
}
impl TryFrom<u16> for Power {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<Power> {
match usage_id {
1 => Ok(Power::iName),
2 => Ok(Power::PresentStatus),
3 => Ok(Power::ChangedStatus),
4 => Ok(Power::UPS),
5 => Ok(Power::PowerSupply),
16 => Ok(Power::BatterySystem),
17 => Ok(Power::BatterySystemId),
18 => Ok(Power::Battery),
19 => Ok(Power::BatteryId),
20 => Ok(Power::Charger),
21 => Ok(Power::ChargerId),
22 => Ok(Power::PowerConverter),
23 => Ok(Power::PowerConverterId),
24 => Ok(Power::OutletSystem),
25 => Ok(Power::OutletSystemId),
26 => Ok(Power::Input),
27 => Ok(Power::InputId),
28 => Ok(Power::Output),
29 => Ok(Power::OutputId),
30 => Ok(Power::Flow),
31 => Ok(Power::FlowId),
32 => Ok(Power::Outlet),
33 => Ok(Power::OutletId),
34 => Ok(Power::Gang),
35 => Ok(Power::GangId),
36 => Ok(Power::PowerSummary),
37 => Ok(Power::PowerSummaryId),
48 => Ok(Power::Voltage),
49 => Ok(Power::Current),
50 => Ok(Power::Frequency),
51 => Ok(Power::ApparentPower),
52 => Ok(Power::ActivePower),
53 => Ok(Power::PercentLoad),
54 => Ok(Power::Temperature),
55 => Ok(Power::Humidity),
56 => Ok(Power::BadCount),
64 => Ok(Power::ConfigVoltage),
65 => Ok(Power::ConfigCurrent),
66 => Ok(Power::ConfigFrequency),
67 => Ok(Power::ConfigApparentPower),
68 => Ok(Power::ConfigActivePower),
69 => Ok(Power::ConfigPercentLoad),
70 => Ok(Power::ConfigTemperature),
71 => Ok(Power::ConfigHumidity),
80 => Ok(Power::SwitchOnControl),
81 => Ok(Power::SwitchOffControl),
82 => Ok(Power::ToggleControl),
83 => Ok(Power::LowVoltageTransfer),
84 => Ok(Power::HighVoltageTransfer),
85 => Ok(Power::DelayBeforeReboot),
86 => Ok(Power::DelayBeforeStartup),
87 => Ok(Power::DelayBeforeShutdown),
88 => Ok(Power::Test),
89 => Ok(Power::ModuleReset),
90 => Ok(Power::AudibleAlarmControl),
96 => Ok(Power::Present),
97 => Ok(Power::Good),
98 => Ok(Power::InternalFailure),
99 => Ok(Power::VoltagOutOfRange),
100 => Ok(Power::FrequencyOutOfRange),
101 => Ok(Power::Overload),
102 => Ok(Power::OverCharged),
103 => Ok(Power::OverTemperature),
104 => Ok(Power::ShutdownRequested),
105 => Ok(Power::ShutdownImminent),
107 => Ok(Power::SwitchOnOff),
108 => Ok(Power::Switchable),
109 => Ok(Power::Used),
110 => Ok(Power::Boost),
111 => Ok(Power::Buck),
112 => Ok(Power::Initialized),
113 => Ok(Power::Tested),
114 => Ok(Power::AwaitingPower),
115 => Ok(Power::CommunicationLost),
253 => Ok(Power::iManufacturer),
254 => Ok(Power::iProduct),
255 => Ok(Power::iSerialNumber),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for Power {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum BatterySystem {
SmartBatteryBatteryMode = 0x1,
SmartBatteryBatteryStatus = 0x2,
SmartBatteryAlarmWarning = 0x3,
SmartBatteryChargerMode = 0x4,
SmartBatteryChargerStatus = 0x5,
SmartBatteryChargerSpecInfo = 0x6,
SmartBatterySelectorState = 0x7,
SmartBatterySelectorPresets = 0x8,
SmartBatterySelectorInfo = 0x9,
OptionalMfgFunction1 = 0x10,
OptionalMfgFunction2 = 0x11,
OptionalMfgFunction3 = 0x12,
OptionalMfgFunction4 = 0x13,
OptionalMfgFunction5 = 0x14,
ConnectionToSMBus = 0x15,
OutputConnection = 0x16,
ChargerConnection = 0x17,
BatteryInsertion = 0x18,
UseNext = 0x19,
OKToUse = 0x1A,
BatterySupported = 0x1B,
SelectorRevision = 0x1C,
ChargingIndicator = 0x1D,
ManufacturerAccess = 0x28,
RemainingCapacityLimit = 0x29,
RemainingTimeLimit = 0x2A,
AtRate = 0x2B,
CapacityMode = 0x2C,
BroadcastToCharger = 0x2D,
PrimaryBattery = 0x2E,
ChargeController = 0x2F,
TerminateCharge = 0x40,
TerminateDischarge = 0x41,
BelowRemainingCapacityLimit = 0x42,
RemainingTimeLimitExpired = 0x43,
Charging = 0x44,
Discharging = 0x45,
FullyCharged = 0x46,
FullyDischarged = 0x47,
ConditioningFlag = 0x48,
AtRateOK = 0x49,
SmartBatteryErrorCode = 0x4A,
NeedReplacement = 0x4B,
AtRateTimeToFull = 0x60,
AtRateTimeToEmpty = 0x61,
AverageCurrent = 0x62,
MaxError = 0x63,
RelativeStateOfCharge = 0x64,
AbsoluteStateOfCharge = 0x65,
RemainingCapacity = 0x66,
FullChargeCapacity = 0x67,
RunTimeToEmpty = 0x68,
AverageTimeToEmpty = 0x69,
AverageTimeToFull = 0x6A,
CycleCount = 0x6B,
BatteryPackModelLevel = 0x80,
InternalChargeController = 0x81,
PrimaryBatterySupport = 0x82,
DesignCapacity = 0x83,
SpecificationInfo = 0x84,
ManufactureDate = 0x85,
SerialNumber = 0x86,
iManufacturerName = 0x87,
iDeviceName = 0x88,
iDeviceChemistry = 0x89,
ManufacturerData = 0x8A,
Rechargable = 0x8B,
WarningCapacityLimit = 0x8C,
CapacityGranularity1 = 0x8D,
CapacityGranularity2 = 0x8E,
iOEMInformation = 0x8F,
InhibitCharge = 0xC0,
EnablePolling = 0xC1,
ResetToZero = 0xC2,
ACPresent = 0xD0,
BatteryPresent = 0xD1,
PowerFail = 0xD2,
AlarmInhibited = 0xD3,
ThermistorUnderRange = 0xD4,
ThermistorHot = 0xD5,
ThermistorCold = 0xD6,
ThermistorOverRange = 0xD7,
VoltageOutOfRange = 0xD8,
CurrentOutOfRange = 0xD9,
CurrentNotRegulated = 0xDA,
VoltageNotRegulated = 0xDB,
MasterMode = 0xDC,
ChargerSelectorSupport = 0xF0,
ChargerSpec = 0xF1,
Level2 = 0xF2,
Level3 = 0xF3,
}
impl BatterySystem {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
BatterySystem::SmartBatteryBatteryMode => "Smart Battery Battery Mode",
BatterySystem::SmartBatteryBatteryStatus => "Smart Battery Battery Status",
BatterySystem::SmartBatteryAlarmWarning => "Smart Battery Alarm Warning",
BatterySystem::SmartBatteryChargerMode => "Smart Battery Charger Mode",
BatterySystem::SmartBatteryChargerStatus => "Smart Battery Charger Status",
BatterySystem::SmartBatteryChargerSpecInfo => "Smart Battery Charger Spec Info",
BatterySystem::SmartBatterySelectorState => "Smart Battery Selector State",
BatterySystem::SmartBatterySelectorPresets => "Smart Battery Selector Presets",
BatterySystem::SmartBatterySelectorInfo => "Smart Battery Selector Info",
BatterySystem::OptionalMfgFunction1 => "Optional Mfg Function 1",
BatterySystem::OptionalMfgFunction2 => "Optional Mfg Function 2",
BatterySystem::OptionalMfgFunction3 => "Optional Mfg Function 3",
BatterySystem::OptionalMfgFunction4 => "Optional Mfg Function 4",
BatterySystem::OptionalMfgFunction5 => "Optional Mfg Function 5",
BatterySystem::ConnectionToSMBus => "Connection To SM Bus",
BatterySystem::OutputConnection => "Output Connection",
BatterySystem::ChargerConnection => "Charger Connection",
BatterySystem::BatteryInsertion => "Battery Insertion",
BatterySystem::UseNext => "Use Next",
BatterySystem::OKToUse => "OK To Use",
BatterySystem::BatterySupported => "Battery Supported",
BatterySystem::SelectorRevision => "Selector Revision",
BatterySystem::ChargingIndicator => "Charging Indicator",
BatterySystem::ManufacturerAccess => "Manufacturer Access",
BatterySystem::RemainingCapacityLimit => "Remaining Capacity Limit",
BatterySystem::RemainingTimeLimit => "Remaining Time Limit",
BatterySystem::AtRate => "At Rate",
BatterySystem::CapacityMode => "Capacity Mode",
BatterySystem::BroadcastToCharger => "Broadcast To Charger",
BatterySystem::PrimaryBattery => "Primary Battery",
BatterySystem::ChargeController => "Charge Controller",
BatterySystem::TerminateCharge => "Terminate Charge",
BatterySystem::TerminateDischarge => "Terminate Discharge",
BatterySystem::BelowRemainingCapacityLimit => "Below Remaining Capacity Limit",
BatterySystem::RemainingTimeLimitExpired => "Remaining Time Limit Expired",
BatterySystem::Charging => "Charging",
BatterySystem::Discharging => "Discharging",
BatterySystem::FullyCharged => "Fully Charged",
BatterySystem::FullyDischarged => "Fully Discharged",
BatterySystem::ConditioningFlag => "Conditioning Flag",
BatterySystem::AtRateOK => "At Rate OK",
BatterySystem::SmartBatteryErrorCode => "Smart Battery Error Code",
BatterySystem::NeedReplacement => "Need Replacement",
BatterySystem::AtRateTimeToFull => "At Rate Time To Full",
BatterySystem::AtRateTimeToEmpty => "At Rate Time To Empty",
BatterySystem::AverageCurrent => "Average Current",
BatterySystem::MaxError => "Max Error",
BatterySystem::RelativeStateOfCharge => "Relative State Of Charge",
BatterySystem::AbsoluteStateOfCharge => "Absolute State Of Charge",
BatterySystem::RemainingCapacity => "Remaining Capacity",
BatterySystem::FullChargeCapacity => "Full Charge Capacity",
BatterySystem::RunTimeToEmpty => "Run Time To Empty",
BatterySystem::AverageTimeToEmpty => "Average Time To Empty",
BatterySystem::AverageTimeToFull => "Average Time To Full",
BatterySystem::CycleCount => "Cycle Count",
BatterySystem::BatteryPackModelLevel => "Battery Pack Model Level",
BatterySystem::InternalChargeController => "Internal Charge Controller",
BatterySystem::PrimaryBatterySupport => "Primary Battery Support",
BatterySystem::DesignCapacity => "Design Capacity",
BatterySystem::SpecificationInfo => "Specification Info",
BatterySystem::ManufactureDate => "Manufacture Date",
BatterySystem::SerialNumber => "Serial Number",
BatterySystem::iManufacturerName => "iManufacturer Name",
BatterySystem::iDeviceName => "iDevice Name",
BatterySystem::iDeviceChemistry => "iDevice Chemistry",
BatterySystem::ManufacturerData => "Manufacturer Data",
BatterySystem::Rechargable => "Rechargable",
BatterySystem::WarningCapacityLimit => "Warning Capacity Limit",
BatterySystem::CapacityGranularity1 => "Capacity Granularity 1",
BatterySystem::CapacityGranularity2 => "Capacity Granularity 2",
BatterySystem::iOEMInformation => "iOEM Information",
BatterySystem::InhibitCharge => "Inhibit Charge",
BatterySystem::EnablePolling => "Enable Polling",
BatterySystem::ResetToZero => "Reset To Zero",
BatterySystem::ACPresent => "AC Present",
BatterySystem::BatteryPresent => "Battery Present",
BatterySystem::PowerFail => "Power Fail",
BatterySystem::AlarmInhibited => "Alarm Inhibited",
BatterySystem::ThermistorUnderRange => "Thermistor Under Range",
BatterySystem::ThermistorHot => "Thermistor Hot",
BatterySystem::ThermistorCold => "Thermistor Cold",
BatterySystem::ThermistorOverRange => "Thermistor Over Range",
BatterySystem::VoltageOutOfRange => "Voltage Out Of Range",
BatterySystem::CurrentOutOfRange => "Current Out Of Range",
BatterySystem::CurrentNotRegulated => "Current Not Regulated",
BatterySystem::VoltageNotRegulated => "Voltage Not Regulated",
BatterySystem::MasterMode => "Master Mode",
BatterySystem::ChargerSelectorSupport => "Charger Selector Support",
BatterySystem::ChargerSpec => "Charger Spec",
BatterySystem::Level2 => "Level 2",
BatterySystem::Level3 => "Level 3",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for BatterySystem {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for BatterySystem {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for BatterySystem {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&BatterySystem> for u16 {
fn from(batterysystem: &BatterySystem) -> u16 {
*batterysystem as u16
}
}
impl From<BatterySystem> for u16 {
fn from(batterysystem: BatterySystem) -> u16 {
u16::from(&batterysystem)
}
}
impl From<&BatterySystem> for u32 {
fn from(batterysystem: &BatterySystem) -> u32 {
let up = UsagePage::from(batterysystem);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(batterysystem) as u32;
up | id
}
}
impl From<&BatterySystem> for UsagePage {
fn from(_: &BatterySystem) -> UsagePage {
UsagePage::BatterySystem
}
}
impl From<BatterySystem> for UsagePage {
fn from(_: BatterySystem) -> UsagePage {
UsagePage::BatterySystem
}
}
impl From<&BatterySystem> for Usage {
fn from(batterysystem: &BatterySystem) -> Usage {
Usage::try_from(u32::from(batterysystem)).unwrap()
}
}
impl From<BatterySystem> for Usage {
fn from(batterysystem: BatterySystem) -> Usage {
Usage::from(&batterysystem)
}
}
impl TryFrom<u16> for BatterySystem {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<BatterySystem> {
match usage_id {
1 => Ok(BatterySystem::SmartBatteryBatteryMode),
2 => Ok(BatterySystem::SmartBatteryBatteryStatus),
3 => Ok(BatterySystem::SmartBatteryAlarmWarning),
4 => Ok(BatterySystem::SmartBatteryChargerMode),
5 => Ok(BatterySystem::SmartBatteryChargerStatus),
6 => Ok(BatterySystem::SmartBatteryChargerSpecInfo),
7 => Ok(BatterySystem::SmartBatterySelectorState),
8 => Ok(BatterySystem::SmartBatterySelectorPresets),
9 => Ok(BatterySystem::SmartBatterySelectorInfo),
16 => Ok(BatterySystem::OptionalMfgFunction1),
17 => Ok(BatterySystem::OptionalMfgFunction2),
18 => Ok(BatterySystem::OptionalMfgFunction3),
19 => Ok(BatterySystem::OptionalMfgFunction4),
20 => Ok(BatterySystem::OptionalMfgFunction5),
21 => Ok(BatterySystem::ConnectionToSMBus),
22 => Ok(BatterySystem::OutputConnection),
23 => Ok(BatterySystem::ChargerConnection),
24 => Ok(BatterySystem::BatteryInsertion),
25 => Ok(BatterySystem::UseNext),
26 => Ok(BatterySystem::OKToUse),
27 => Ok(BatterySystem::BatterySupported),
28 => Ok(BatterySystem::SelectorRevision),
29 => Ok(BatterySystem::ChargingIndicator),
40 => Ok(BatterySystem::ManufacturerAccess),
41 => Ok(BatterySystem::RemainingCapacityLimit),
42 => Ok(BatterySystem::RemainingTimeLimit),
43 => Ok(BatterySystem::AtRate),
44 => Ok(BatterySystem::CapacityMode),
45 => Ok(BatterySystem::BroadcastToCharger),
46 => Ok(BatterySystem::PrimaryBattery),
47 => Ok(BatterySystem::ChargeController),
64 => Ok(BatterySystem::TerminateCharge),
65 => Ok(BatterySystem::TerminateDischarge),
66 => Ok(BatterySystem::BelowRemainingCapacityLimit),
67 => Ok(BatterySystem::RemainingTimeLimitExpired),
68 => Ok(BatterySystem::Charging),
69 => Ok(BatterySystem::Discharging),
70 => Ok(BatterySystem::FullyCharged),
71 => Ok(BatterySystem::FullyDischarged),
72 => Ok(BatterySystem::ConditioningFlag),
73 => Ok(BatterySystem::AtRateOK),
74 => Ok(BatterySystem::SmartBatteryErrorCode),
75 => Ok(BatterySystem::NeedReplacement),
96 => Ok(BatterySystem::AtRateTimeToFull),
97 => Ok(BatterySystem::AtRateTimeToEmpty),
98 => Ok(BatterySystem::AverageCurrent),
99 => Ok(BatterySystem::MaxError),
100 => Ok(BatterySystem::RelativeStateOfCharge),
101 => Ok(BatterySystem::AbsoluteStateOfCharge),
102 => Ok(BatterySystem::RemainingCapacity),
103 => Ok(BatterySystem::FullChargeCapacity),
104 => Ok(BatterySystem::RunTimeToEmpty),
105 => Ok(BatterySystem::AverageTimeToEmpty),
106 => Ok(BatterySystem::AverageTimeToFull),
107 => Ok(BatterySystem::CycleCount),
128 => Ok(BatterySystem::BatteryPackModelLevel),
129 => Ok(BatterySystem::InternalChargeController),
130 => Ok(BatterySystem::PrimaryBatterySupport),
131 => Ok(BatterySystem::DesignCapacity),
132 => Ok(BatterySystem::SpecificationInfo),
133 => Ok(BatterySystem::ManufactureDate),
134 => Ok(BatterySystem::SerialNumber),
135 => Ok(BatterySystem::iManufacturerName),
136 => Ok(BatterySystem::iDeviceName),
137 => Ok(BatterySystem::iDeviceChemistry),
138 => Ok(BatterySystem::ManufacturerData),
139 => Ok(BatterySystem::Rechargable),
140 => Ok(BatterySystem::WarningCapacityLimit),
141 => Ok(BatterySystem::CapacityGranularity1),
142 => Ok(BatterySystem::CapacityGranularity2),
143 => Ok(BatterySystem::iOEMInformation),
192 => Ok(BatterySystem::InhibitCharge),
193 => Ok(BatterySystem::EnablePolling),
194 => Ok(BatterySystem::ResetToZero),
208 => Ok(BatterySystem::ACPresent),
209 => Ok(BatterySystem::BatteryPresent),
210 => Ok(BatterySystem::PowerFail),
211 => Ok(BatterySystem::AlarmInhibited),
212 => Ok(BatterySystem::ThermistorUnderRange),
213 => Ok(BatterySystem::ThermistorHot),
214 => Ok(BatterySystem::ThermistorCold),
215 => Ok(BatterySystem::ThermistorOverRange),
216 => Ok(BatterySystem::VoltageOutOfRange),
217 => Ok(BatterySystem::CurrentOutOfRange),
218 => Ok(BatterySystem::CurrentNotRegulated),
219 => Ok(BatterySystem::VoltageNotRegulated),
220 => Ok(BatterySystem::MasterMode),
240 => Ok(BatterySystem::ChargerSelectorSupport),
241 => Ok(BatterySystem::ChargerSpec),
242 => Ok(BatterySystem::Level2),
243 => Ok(BatterySystem::Level3),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for BatterySystem {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum BarcodeScanner {
BarcodeBadgeReader = 0x1,
BarcodeScanner = 0x2,
DumbBarCodeScanner = 0x3,
CordlessScannerBase = 0x4,
BarCodeScannerCradle = 0x5,
AttributeReport = 0x10,
SettingsReport = 0x11,
ScannedDataReport = 0x12,
RawScannedDataReport = 0x13,
TriggerReport = 0x14,
StatusReport = 0x15,
UPCEANControlReport = 0x16,
EAN23LabelControlReport = 0x17,
Code39ControlReport = 0x18,
Interleaved2of5ControlReport = 0x19,
Standard2of5ControlReport = 0x1A,
MSIPlesseyControlReport = 0x1B,
CodabarControlReport = 0x1C,
Code128ControlReport = 0x1D,
Misc1DControlReport = 0x1E,
TwoDControlReport = 0x1F,
AimingPointerMode = 0x30,
BarCodePresentSensor = 0x31,
Class1ALaser = 0x32,
Class2Laser = 0x33,
HeaterPresent = 0x34,
ContactScanner = 0x35,
ElectronicArticleSurveillanceNotification = 0x36,
ConstantElectronicArticleSurveillance = 0x37,
ErrorIndication = 0x38,
FixedBeeper = 0x39,
GoodDecodeIndication = 0x3A,
HandsFreeScanning = 0x3B,
IntrinsicallySafe = 0x3C,
KlasseEinsLaser = 0x3D,
LongRangeScanner = 0x3E,
MirrorSpeedControl = 0x3F,
NotOnFileIndication = 0x40,
ProgrammableBeeper = 0x41,
Triggerless = 0x42,
Wand = 0x43,
WaterResistant = 0x44,
MultiRangeScanner = 0x45,
ProximitySensor = 0x46,
FragmentDecoding = 0x4D,
ScannerReadConfidence = 0x4E,
DataPrefix = 0x4F,
PrefixAIMI = 0x50,
PrefixNone = 0x51,
PrefixProprietary = 0x52,
ActiveTime = 0x55,
AimingLaserPattern = 0x56,
BarCodePresent = 0x57,
BeeperState = 0x58,
LaserOnTime = 0x59,
LaserState = 0x5A,
LockoutTime = 0x5B,
MotorState = 0x5C,
MotorTimeout = 0x5D,
PowerOnResetScanner = 0x5E,
PreventReadofBarcodes = 0x5F,
InitiateBarcodeRead = 0x60,
TriggerState = 0x61,
TriggerMode = 0x62,
TriggerModeBlinkingLaserOn = 0x63,
TriggerModeContinuousLaserOn = 0x64,
TriggerModeLaseronwhilePulled = 0x65,
TriggerModeLaserstaysonafterrelease = 0x66,
CommitParameterstoNVM = 0x6D,
ParameterScanning = 0x6E,
ParametersChanged = 0x6F,
Setparameterdefaultvalues = 0x70,
ScannerInCradle = 0x75,
ScannerInRange = 0x76,
AimDuration = 0x7A,
GoodReadLampDuration = 0x7B,
GoodReadLampIntensity = 0x7C,
GoodReadLED = 0x7D,
GoodReadToneFrequency = 0x7E,
GoodReadToneLength = 0x7F,
GoodReadToneVolume = 0x80,
NoReadMessage = 0x82,
NotonFileVolume = 0x83,
PowerupBeep = 0x84,
SoundErrorBeep = 0x85,
SoundGoodReadBeep = 0x86,
SoundNotOnFileBeep = 0x87,
GoodReadWhentoWrite = 0x88,
GRWTIAfterDecode = 0x89,
GRWTIBeepLampaftertransmit = 0x8A,
GRWTINoBeepLampuseatall = 0x8B,
BooklandEAN = 0x91,
ConvertEAN8to13Type = 0x92,
ConvertUPCAtoEAN13 = 0x93,
ConvertUPCEtoA = 0x94,
EAN13 = 0x95,
EAN8 = 0x96,
EAN99128Mandatory = 0x97,
EAN99P5128Optional = 0x98,
EnableEANTwoLabel = 0x99,
UPCEAN = 0x9A,
UPCEANCouponCode = 0x9B,
UPCEANPeriodicals = 0x9C,
UPCA = 0x9D,
UPCAwith128Mandatory = 0x9E,
UPCAwith128Optional = 0x9F,
UPCAwithP5Optional = 0xA0,
UPCE = 0xA1,
UPCE1 = 0xA2,
Periodical = 0xA9,
PeriodicalAutoDiscriminatePlus2 = 0xAA,
PeriodicalOnlyDecodewithPlus2 = 0xAB,
PeriodicalIgnorePlus2 = 0xAC,
PeriodicalAutoDiscriminatePlus5 = 0xAD,
PeriodicalOnlyDecodewithPlus5 = 0xAE,
PeriodicalIgnorePlus5 = 0xAF,
Check = 0xB0,
CheckDisablePrice = 0xB1,
CheckEnable4digitPrice = 0xB2,
CheckEnable5digitPrice = 0xB3,
CheckEnableEuropean4digitPrice = 0xB4,
CheckEnableEuropean5digitPrice = 0xB5,
EANTwoLabel = 0xB7,
EANThreeLabel = 0xB8,
EAN8FlagDigit1 = 0xB9,
EAN8FlagDigit2 = 0xBA,
EAN8FlagDigit3 = 0xBB,
EAN13FlagDigit1 = 0xBC,
EAN13FlagDigit2 = 0xBD,
EAN13FlagDigit3 = 0xBE,
AddEAN23LabelDefinition = 0xBF,
ClearallEAN23LabelDefinitions = 0xC0,
Codabar = 0xC3,
Code128 = 0xC4,
Code39 = 0xC7,
Code93 = 0xC8,
FullASCIIConversion = 0xC9,
Interleaved2of5 = 0xCA,
ItalianPharmacyCode = 0xCB,
MSIPlessey = 0xCC,
Standard2of5IATA = 0xCD,
Standard2of5 = 0xCE,
TransmitStartStop = 0xD3,
TriOptic = 0xD4,
UCCEAN128 = 0xD5,
CheckDigit = 0xD6,
CheckDigitDisable = 0xD7,
CheckDigitEnableInterleaved2of5OPCC = 0xD8,
CheckDigitEnableInterleaved2of5USS = 0xD9,
CheckDigitEnableStandard2of5OPCC = 0xDA,
CheckDigitEnableStandard2of5USS = 0xDB,
CheckDigitEnableOneMSIPlessey = 0xDC,
CheckDigitEnableTwoMSIPlessey = 0xDD,
CheckDigitCodabarEnable = 0xDE,
CheckDigitCode39Enable = 0xDF,
TransmitCheckDigit = 0xF0,
DisableCheckDigitTransmit = 0xF1,
EnableCheckDigitTransmit = 0xF2,
SymbologyIdentifier1 = 0xFB,
SymbologyIdentifier2 = 0xFC,
SymbologyIdentifier3 = 0xFD,
DecodedData = 0xFE,
DecodeDataContinued = 0xFF,
BarSpaceData = 0x100,
ScannerDataAccuracy = 0x101,
RawDataPolarity = 0x102,
PolarityInvertedBarCode = 0x103,
PolarityNormalBarCode = 0x104,
MinimumLengthtoDecode = 0x106,
MaximumLengthtoDecode = 0x107,
DiscreteLengthtoDecode1 = 0x108,
DiscreteLengthtoDecode2 = 0x109,
DataLengthMethod = 0x10A,
DLMethodReadany = 0x10B,
DLMethodCheckinRange = 0x10C,
DLMethodCheckforDiscrete = 0x10D,
AztecCode = 0x110,
BC412 = 0x111,
ChannelCode = 0x112,
Code16 = 0x113,
Code32 = 0x114,
Code49 = 0x115,
CodeOne = 0x116,
Colorcode = 0x117,
DataMatrix = 0x118,
MaxiCode = 0x119,
MicroPDF = 0x11A,
PDF417 = 0x11B,
PosiCode = 0x11C,
QRCode = 0x11D,
SuperCode = 0x11E,
UltraCode = 0x11F,
USD5SlugCode = 0x120,
VeriCode = 0x121,
}
impl BarcodeScanner {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
BarcodeScanner::BarcodeBadgeReader => "Barcode Badge Reader",
BarcodeScanner::BarcodeScanner => "Barcode Scanner",
BarcodeScanner::DumbBarCodeScanner => "Dumb Bar Code Scanner",
BarcodeScanner::CordlessScannerBase => "Cordless Scanner Base",
BarcodeScanner::BarCodeScannerCradle => "Bar Code Scanner Cradle",
BarcodeScanner::AttributeReport => "Attribute Report",
BarcodeScanner::SettingsReport => "Settings Report",
BarcodeScanner::ScannedDataReport => "Scanned Data Report",
BarcodeScanner::RawScannedDataReport => "Raw Scanned Data Report",
BarcodeScanner::TriggerReport => "Trigger Report",
BarcodeScanner::StatusReport => "Status Report",
BarcodeScanner::UPCEANControlReport => "UPC/EAN Control Report",
BarcodeScanner::EAN23LabelControlReport => "EAN 2/3 Label Control Report",
BarcodeScanner::Code39ControlReport => "Code 39 Control Report",
BarcodeScanner::Interleaved2of5ControlReport => "Interleaved 2 of 5 Control Report",
BarcodeScanner::Standard2of5ControlReport => "Standard 2 of 5 Control Report",
BarcodeScanner::MSIPlesseyControlReport => "MSI Plessey Control Report",
BarcodeScanner::CodabarControlReport => "Codabar Control Report",
BarcodeScanner::Code128ControlReport => "Code 128 Control Report",
BarcodeScanner::Misc1DControlReport => "Misc 1D Control Report",
BarcodeScanner::TwoDControlReport => "2D Control Report",
BarcodeScanner::AimingPointerMode => "Aiming/Pointer Mode",
BarcodeScanner::BarCodePresentSensor => "Bar Code Present Sensor",
BarcodeScanner::Class1ALaser => "Class 1A Laser",
BarcodeScanner::Class2Laser => "Class 2 Laser",
BarcodeScanner::HeaterPresent => "Heater Present",
BarcodeScanner::ContactScanner => "Contact Scanner",
BarcodeScanner::ElectronicArticleSurveillanceNotification => {
"Electronic Article Surveillance Notification"
}
BarcodeScanner::ConstantElectronicArticleSurveillance => {
"Constant Electronic Article Surveillance"
}
BarcodeScanner::ErrorIndication => "Error Indication",
BarcodeScanner::FixedBeeper => "Fixed Beeper",
BarcodeScanner::GoodDecodeIndication => "Good Decode Indication",
BarcodeScanner::HandsFreeScanning => "Hands Free Scanning",
BarcodeScanner::IntrinsicallySafe => "Intrinsically Safe",
BarcodeScanner::KlasseEinsLaser => "Klasse Eins Laser",
BarcodeScanner::LongRangeScanner => "Long Range Scanner",
BarcodeScanner::MirrorSpeedControl => "Mirror Speed Control",
BarcodeScanner::NotOnFileIndication => "Not On File Indication",
BarcodeScanner::ProgrammableBeeper => "Programmable Beeper",
BarcodeScanner::Triggerless => "Triggerless",
BarcodeScanner::Wand => "Wand",
BarcodeScanner::WaterResistant => "Water Resistant",
BarcodeScanner::MultiRangeScanner => "Multi-Range Scanner",
BarcodeScanner::ProximitySensor => "Proximity Sensor",
BarcodeScanner::FragmentDecoding => "Fragment Decoding",
BarcodeScanner::ScannerReadConfidence => "Scanner Read Confidence",
BarcodeScanner::DataPrefix => "Data Prefix",
BarcodeScanner::PrefixAIMI => "Prefix AIMI",
BarcodeScanner::PrefixNone => "Prefix None",
BarcodeScanner::PrefixProprietary => "Prefix Proprietary",
BarcodeScanner::ActiveTime => "Active Time",
BarcodeScanner::AimingLaserPattern => "Aiming Laser Pattern",
BarcodeScanner::BarCodePresent => "Bar Code Present",
BarcodeScanner::BeeperState => "Beeper State",
BarcodeScanner::LaserOnTime => "Laser On Time",
BarcodeScanner::LaserState => "Laser State",
BarcodeScanner::LockoutTime => "Lockout Time",
BarcodeScanner::MotorState => "Motor State",
BarcodeScanner::MotorTimeout => "Motor Timeout",
BarcodeScanner::PowerOnResetScanner => "Power On Reset Scanner",
BarcodeScanner::PreventReadofBarcodes => "Prevent Read of Barcodes",
BarcodeScanner::InitiateBarcodeRead => "Initiate Barcode Read",
BarcodeScanner::TriggerState => "Trigger State",
BarcodeScanner::TriggerMode => "Trigger Mode",
BarcodeScanner::TriggerModeBlinkingLaserOn => "Trigger Mode Blinking Laser On",
BarcodeScanner::TriggerModeContinuousLaserOn => "Trigger Mode Continuous Laser On",
BarcodeScanner::TriggerModeLaseronwhilePulled => "Trigger Mode Laser on while Pulled",
BarcodeScanner::TriggerModeLaserstaysonafterrelease => {
"Trigger Mode Laser stays on after release"
}
BarcodeScanner::CommitParameterstoNVM => "Commit Parameters to NVM",
BarcodeScanner::ParameterScanning => "Parameter Scanning",
BarcodeScanner::ParametersChanged => "Parameters Changed",
BarcodeScanner::Setparameterdefaultvalues => "Set parameter default values",
BarcodeScanner::ScannerInCradle => "Scanner In Cradle",
BarcodeScanner::ScannerInRange => "Scanner In Range",
BarcodeScanner::AimDuration => "Aim Duration",
BarcodeScanner::GoodReadLampDuration => "Good Read Lamp Duration",
BarcodeScanner::GoodReadLampIntensity => "Good Read Lamp Intensity",
BarcodeScanner::GoodReadLED => "Good Read LED",
BarcodeScanner::GoodReadToneFrequency => "Good Read Tone Frequency",
BarcodeScanner::GoodReadToneLength => "Good Read Tone Length",
BarcodeScanner::GoodReadToneVolume => "Good Read Tone Volume",
BarcodeScanner::NoReadMessage => "No Read Message",
BarcodeScanner::NotonFileVolume => "Not on File Volume",
BarcodeScanner::PowerupBeep => "Powerup Beep",
BarcodeScanner::SoundErrorBeep => "Sound Error Beep",
BarcodeScanner::SoundGoodReadBeep => "Sound Good Read Beep",
BarcodeScanner::SoundNotOnFileBeep => "Sound Not On File Beep",
BarcodeScanner::GoodReadWhentoWrite => "Good Read When to Write",
BarcodeScanner::GRWTIAfterDecode => "GRWTI After Decode",
BarcodeScanner::GRWTIBeepLampaftertransmit => "GRWTI Beep/Lamp after transmit",
BarcodeScanner::GRWTINoBeepLampuseatall => "GRWTI No Beep/Lamp use at all",
BarcodeScanner::BooklandEAN => "Bookland EAN",
BarcodeScanner::ConvertEAN8to13Type => "Convert EAN 8 to 13 Type",
BarcodeScanner::ConvertUPCAtoEAN13 => "Convert UPC A to EAN-13",
BarcodeScanner::ConvertUPCEtoA => "Convert UPC-E to A",
BarcodeScanner::EAN13 => "EAN-13",
BarcodeScanner::EAN8 => "EAN-8",
BarcodeScanner::EAN99128Mandatory => "EAN-99 128 Mandatory",
BarcodeScanner::EAN99P5128Optional => "EAN-99 P5/128 Optional",
BarcodeScanner::EnableEANTwoLabel => "Enable EAN Two Label",
BarcodeScanner::UPCEAN => "UPC/EAN",
BarcodeScanner::UPCEANCouponCode => "UPC/EAN Coupon Code",
BarcodeScanner::UPCEANPeriodicals => "UPC/EAN Periodicals",
BarcodeScanner::UPCA => "UPC-A",
BarcodeScanner::UPCAwith128Mandatory => "UPC-A with 128 Mandatory",
BarcodeScanner::UPCAwith128Optional => "UPC-A with 128 Optional",
BarcodeScanner::UPCAwithP5Optional => "UPC-A with P5 Optional",
BarcodeScanner::UPCE => "UPC-E",
BarcodeScanner::UPCE1 => "UPC-E1",
BarcodeScanner::Periodical => "Periodical",
BarcodeScanner::PeriodicalAutoDiscriminatePlus2 => "Periodical Auto-Discriminate +2",
BarcodeScanner::PeriodicalOnlyDecodewithPlus2 => "Periodical Only Decode with +2",
BarcodeScanner::PeriodicalIgnorePlus2 => "Periodical Ignore +2",
BarcodeScanner::PeriodicalAutoDiscriminatePlus5 => "Periodical Auto-Discriminate +5",
BarcodeScanner::PeriodicalOnlyDecodewithPlus5 => "Periodical Only Decode with +5",
BarcodeScanner::PeriodicalIgnorePlus5 => "Periodical Ignore +5",
BarcodeScanner::Check => "Check",
BarcodeScanner::CheckDisablePrice => "Check Disable Price",
BarcodeScanner::CheckEnable4digitPrice => "Check Enable 4 digit Price",
BarcodeScanner::CheckEnable5digitPrice => "Check Enable 5 digit Price",
BarcodeScanner::CheckEnableEuropean4digitPrice => "Check Enable European 4 digit Price",
BarcodeScanner::CheckEnableEuropean5digitPrice => "Check Enable European 5 digit Price",
BarcodeScanner::EANTwoLabel => "EAN Two Label",
BarcodeScanner::EANThreeLabel => "EAN Three Label",
BarcodeScanner::EAN8FlagDigit1 => "EAN 8 Flag Digit 1",
BarcodeScanner::EAN8FlagDigit2 => "EAN 8 Flag Digit 2",
BarcodeScanner::EAN8FlagDigit3 => "EAN 8 Flag Digit 3",
BarcodeScanner::EAN13FlagDigit1 => "EAN 13 Flag Digit 1",
BarcodeScanner::EAN13FlagDigit2 => "EAN 13 Flag Digit 2",
BarcodeScanner::EAN13FlagDigit3 => "EAN 13 Flag Digit 3",
BarcodeScanner::AddEAN23LabelDefinition => "Add EAN 2/3 Label Definition",
BarcodeScanner::ClearallEAN23LabelDefinitions => "Clear all EAN 2/3 Label Definitions",
BarcodeScanner::Codabar => "Codabar",
BarcodeScanner::Code128 => "Code 128",
BarcodeScanner::Code39 => "Code 39",
BarcodeScanner::Code93 => "Code 93",
BarcodeScanner::FullASCIIConversion => "Full ASCII Conversion",
BarcodeScanner::Interleaved2of5 => "Interleaved 2 of 5",
BarcodeScanner::ItalianPharmacyCode => "Italian Pharmacy Code",
BarcodeScanner::MSIPlessey => "MSI/Plessey",
BarcodeScanner::Standard2of5IATA => "Standard 2 of 5 IATA",
BarcodeScanner::Standard2of5 => "Standard 2 of 5",
BarcodeScanner::TransmitStartStop => "Transmit Start/Stop",
BarcodeScanner::TriOptic => "Tri-Optic",
BarcodeScanner::UCCEAN128 => "UCC/EAN-128",
BarcodeScanner::CheckDigit => "Check Digit",
BarcodeScanner::CheckDigitDisable => "Check Digit Disable",
BarcodeScanner::CheckDigitEnableInterleaved2of5OPCC => {
"Check Digit Enable Interleaved 2 of 5 OPCC"
}
BarcodeScanner::CheckDigitEnableInterleaved2of5USS => {
"Check Digit Enable Interleaved 2 of 5 USS"
}
BarcodeScanner::CheckDigitEnableStandard2of5OPCC => {
"Check Digit Enable Standard 2 of 5 OPCC"
}
BarcodeScanner::CheckDigitEnableStandard2of5USS => {
"Check Digit Enable Standard 2 of 5 USS"
}
BarcodeScanner::CheckDigitEnableOneMSIPlessey => "Check Digit Enable One MSI Plessey",
BarcodeScanner::CheckDigitEnableTwoMSIPlessey => "Check Digit Enable Two MSI Plessey",
BarcodeScanner::CheckDigitCodabarEnable => "Check Digit Codabar Enable",
BarcodeScanner::CheckDigitCode39Enable => "Check Digit Code 39 Enable",
BarcodeScanner::TransmitCheckDigit => "Transmit Check Digit",
BarcodeScanner::DisableCheckDigitTransmit => "Disable Check Digit Transmit",
BarcodeScanner::EnableCheckDigitTransmit => "Enable Check Digit Transmit",
BarcodeScanner::SymbologyIdentifier1 => "Symbology Identifier 1",
BarcodeScanner::SymbologyIdentifier2 => "Symbology Identifier 2",
BarcodeScanner::SymbologyIdentifier3 => "Symbology Identifier 3",
BarcodeScanner::DecodedData => "Decoded Data",
BarcodeScanner::DecodeDataContinued => "Decode Data Continued",
BarcodeScanner::BarSpaceData => "Bar Space Data",
BarcodeScanner::ScannerDataAccuracy => "Scanner Data Accuracy",
BarcodeScanner::RawDataPolarity => "Raw Data Polarity",
BarcodeScanner::PolarityInvertedBarCode => "Polarity Inverted Bar Code",
BarcodeScanner::PolarityNormalBarCode => "Polarity Normal Bar Code",
BarcodeScanner::MinimumLengthtoDecode => "Minimum Length to Decode",
BarcodeScanner::MaximumLengthtoDecode => "Maximum Length to Decode",
BarcodeScanner::DiscreteLengthtoDecode1 => "Discrete Length to Decode 1",
BarcodeScanner::DiscreteLengthtoDecode2 => "Discrete Length to Decode 2",
BarcodeScanner::DataLengthMethod => "Data Length Method",
BarcodeScanner::DLMethodReadany => "DL Method Read any",
BarcodeScanner::DLMethodCheckinRange => "DL Method Check in Range",
BarcodeScanner::DLMethodCheckforDiscrete => "DL Method Check for Discrete",
BarcodeScanner::AztecCode => "Aztec Code",
BarcodeScanner::BC412 => "BC412",
BarcodeScanner::ChannelCode => "Channel Code",
BarcodeScanner::Code16 => "Code 16",
BarcodeScanner::Code32 => "Code 32",
BarcodeScanner::Code49 => "Code 49",
BarcodeScanner::CodeOne => "Code One",
BarcodeScanner::Colorcode => "Colorcode",
BarcodeScanner::DataMatrix => "Data Matrix",
BarcodeScanner::MaxiCode => "MaxiCode",
BarcodeScanner::MicroPDF => "MicroPDF",
BarcodeScanner::PDF417 => "PDF-417",
BarcodeScanner::PosiCode => "PosiCode",
BarcodeScanner::QRCode => "QR Code",
BarcodeScanner::SuperCode => "SuperCode",
BarcodeScanner::UltraCode => "UltraCode",
BarcodeScanner::USD5SlugCode => "USD-5 (Slug Code)",
BarcodeScanner::VeriCode => "VeriCode",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for BarcodeScanner {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for BarcodeScanner {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for BarcodeScanner {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&BarcodeScanner> for u16 {
fn from(barcodescanner: &BarcodeScanner) -> u16 {
*barcodescanner as u16
}
}
impl From<BarcodeScanner> for u16 {
fn from(barcodescanner: BarcodeScanner) -> u16 {
u16::from(&barcodescanner)
}
}
impl From<&BarcodeScanner> for u32 {
fn from(barcodescanner: &BarcodeScanner) -> u32 {
let up = UsagePage::from(barcodescanner);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(barcodescanner) as u32;
up | id
}
}
impl From<&BarcodeScanner> for UsagePage {
fn from(_: &BarcodeScanner) -> UsagePage {
UsagePage::BarcodeScanner
}
}
impl From<BarcodeScanner> for UsagePage {
fn from(_: BarcodeScanner) -> UsagePage {
UsagePage::BarcodeScanner
}
}
impl From<&BarcodeScanner> for Usage {
fn from(barcodescanner: &BarcodeScanner) -> Usage {
Usage::try_from(u32::from(barcodescanner)).unwrap()
}
}
impl From<BarcodeScanner> for Usage {
fn from(barcodescanner: BarcodeScanner) -> Usage {
Usage::from(&barcodescanner)
}
}
impl TryFrom<u16> for BarcodeScanner {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<BarcodeScanner> {
match usage_id {
1 => Ok(BarcodeScanner::BarcodeBadgeReader),
2 => Ok(BarcodeScanner::BarcodeScanner),
3 => Ok(BarcodeScanner::DumbBarCodeScanner),
4 => Ok(BarcodeScanner::CordlessScannerBase),
5 => Ok(BarcodeScanner::BarCodeScannerCradle),
16 => Ok(BarcodeScanner::AttributeReport),
17 => Ok(BarcodeScanner::SettingsReport),
18 => Ok(BarcodeScanner::ScannedDataReport),
19 => Ok(BarcodeScanner::RawScannedDataReport),
20 => Ok(BarcodeScanner::TriggerReport),
21 => Ok(BarcodeScanner::StatusReport),
22 => Ok(BarcodeScanner::UPCEANControlReport),
23 => Ok(BarcodeScanner::EAN23LabelControlReport),
24 => Ok(BarcodeScanner::Code39ControlReport),
25 => Ok(BarcodeScanner::Interleaved2of5ControlReport),
26 => Ok(BarcodeScanner::Standard2of5ControlReport),
27 => Ok(BarcodeScanner::MSIPlesseyControlReport),
28 => Ok(BarcodeScanner::CodabarControlReport),
29 => Ok(BarcodeScanner::Code128ControlReport),
30 => Ok(BarcodeScanner::Misc1DControlReport),
31 => Ok(BarcodeScanner::TwoDControlReport),
48 => Ok(BarcodeScanner::AimingPointerMode),
49 => Ok(BarcodeScanner::BarCodePresentSensor),
50 => Ok(BarcodeScanner::Class1ALaser),
51 => Ok(BarcodeScanner::Class2Laser),
52 => Ok(BarcodeScanner::HeaterPresent),
53 => Ok(BarcodeScanner::ContactScanner),
54 => Ok(BarcodeScanner::ElectronicArticleSurveillanceNotification),
55 => Ok(BarcodeScanner::ConstantElectronicArticleSurveillance),
56 => Ok(BarcodeScanner::ErrorIndication),
57 => Ok(BarcodeScanner::FixedBeeper),
58 => Ok(BarcodeScanner::GoodDecodeIndication),
59 => Ok(BarcodeScanner::HandsFreeScanning),
60 => Ok(BarcodeScanner::IntrinsicallySafe),
61 => Ok(BarcodeScanner::KlasseEinsLaser),
62 => Ok(BarcodeScanner::LongRangeScanner),
63 => Ok(BarcodeScanner::MirrorSpeedControl),
64 => Ok(BarcodeScanner::NotOnFileIndication),
65 => Ok(BarcodeScanner::ProgrammableBeeper),
66 => Ok(BarcodeScanner::Triggerless),
67 => Ok(BarcodeScanner::Wand),
68 => Ok(BarcodeScanner::WaterResistant),
69 => Ok(BarcodeScanner::MultiRangeScanner),
70 => Ok(BarcodeScanner::ProximitySensor),
77 => Ok(BarcodeScanner::FragmentDecoding),
78 => Ok(BarcodeScanner::ScannerReadConfidence),
79 => Ok(BarcodeScanner::DataPrefix),
80 => Ok(BarcodeScanner::PrefixAIMI),
81 => Ok(BarcodeScanner::PrefixNone),
82 => Ok(BarcodeScanner::PrefixProprietary),
85 => Ok(BarcodeScanner::ActiveTime),
86 => Ok(BarcodeScanner::AimingLaserPattern),
87 => Ok(BarcodeScanner::BarCodePresent),
88 => Ok(BarcodeScanner::BeeperState),
89 => Ok(BarcodeScanner::LaserOnTime),
90 => Ok(BarcodeScanner::LaserState),
91 => Ok(BarcodeScanner::LockoutTime),
92 => Ok(BarcodeScanner::MotorState),
93 => Ok(BarcodeScanner::MotorTimeout),
94 => Ok(BarcodeScanner::PowerOnResetScanner),
95 => Ok(BarcodeScanner::PreventReadofBarcodes),
96 => Ok(BarcodeScanner::InitiateBarcodeRead),
97 => Ok(BarcodeScanner::TriggerState),
98 => Ok(BarcodeScanner::TriggerMode),
99 => Ok(BarcodeScanner::TriggerModeBlinkingLaserOn),
100 => Ok(BarcodeScanner::TriggerModeContinuousLaserOn),
101 => Ok(BarcodeScanner::TriggerModeLaseronwhilePulled),
102 => Ok(BarcodeScanner::TriggerModeLaserstaysonafterrelease),
109 => Ok(BarcodeScanner::CommitParameterstoNVM),
110 => Ok(BarcodeScanner::ParameterScanning),
111 => Ok(BarcodeScanner::ParametersChanged),
112 => Ok(BarcodeScanner::Setparameterdefaultvalues),
117 => Ok(BarcodeScanner::ScannerInCradle),
118 => Ok(BarcodeScanner::ScannerInRange),
122 => Ok(BarcodeScanner::AimDuration),
123 => Ok(BarcodeScanner::GoodReadLampDuration),
124 => Ok(BarcodeScanner::GoodReadLampIntensity),
125 => Ok(BarcodeScanner::GoodReadLED),
126 => Ok(BarcodeScanner::GoodReadToneFrequency),
127 => Ok(BarcodeScanner::GoodReadToneLength),
128 => Ok(BarcodeScanner::GoodReadToneVolume),
130 => Ok(BarcodeScanner::NoReadMessage),
131 => Ok(BarcodeScanner::NotonFileVolume),
132 => Ok(BarcodeScanner::PowerupBeep),
133 => Ok(BarcodeScanner::SoundErrorBeep),
134 => Ok(BarcodeScanner::SoundGoodReadBeep),
135 => Ok(BarcodeScanner::SoundNotOnFileBeep),
136 => Ok(BarcodeScanner::GoodReadWhentoWrite),
137 => Ok(BarcodeScanner::GRWTIAfterDecode),
138 => Ok(BarcodeScanner::GRWTIBeepLampaftertransmit),
139 => Ok(BarcodeScanner::GRWTINoBeepLampuseatall),
145 => Ok(BarcodeScanner::BooklandEAN),
146 => Ok(BarcodeScanner::ConvertEAN8to13Type),
147 => Ok(BarcodeScanner::ConvertUPCAtoEAN13),
148 => Ok(BarcodeScanner::ConvertUPCEtoA),
149 => Ok(BarcodeScanner::EAN13),
150 => Ok(BarcodeScanner::EAN8),
151 => Ok(BarcodeScanner::EAN99128Mandatory),
152 => Ok(BarcodeScanner::EAN99P5128Optional),
153 => Ok(BarcodeScanner::EnableEANTwoLabel),
154 => Ok(BarcodeScanner::UPCEAN),
155 => Ok(BarcodeScanner::UPCEANCouponCode),
156 => Ok(BarcodeScanner::UPCEANPeriodicals),
157 => Ok(BarcodeScanner::UPCA),
158 => Ok(BarcodeScanner::UPCAwith128Mandatory),
159 => Ok(BarcodeScanner::UPCAwith128Optional),
160 => Ok(BarcodeScanner::UPCAwithP5Optional),
161 => Ok(BarcodeScanner::UPCE),
162 => Ok(BarcodeScanner::UPCE1),
169 => Ok(BarcodeScanner::Periodical),
170 => Ok(BarcodeScanner::PeriodicalAutoDiscriminatePlus2),
171 => Ok(BarcodeScanner::PeriodicalOnlyDecodewithPlus2),
172 => Ok(BarcodeScanner::PeriodicalIgnorePlus2),
173 => Ok(BarcodeScanner::PeriodicalAutoDiscriminatePlus5),
174 => Ok(BarcodeScanner::PeriodicalOnlyDecodewithPlus5),
175 => Ok(BarcodeScanner::PeriodicalIgnorePlus5),
176 => Ok(BarcodeScanner::Check),
177 => Ok(BarcodeScanner::CheckDisablePrice),
178 => Ok(BarcodeScanner::CheckEnable4digitPrice),
179 => Ok(BarcodeScanner::CheckEnable5digitPrice),
180 => Ok(BarcodeScanner::CheckEnableEuropean4digitPrice),
181 => Ok(BarcodeScanner::CheckEnableEuropean5digitPrice),
183 => Ok(BarcodeScanner::EANTwoLabel),
184 => Ok(BarcodeScanner::EANThreeLabel),
185 => Ok(BarcodeScanner::EAN8FlagDigit1),
186 => Ok(BarcodeScanner::EAN8FlagDigit2),
187 => Ok(BarcodeScanner::EAN8FlagDigit3),
188 => Ok(BarcodeScanner::EAN13FlagDigit1),
189 => Ok(BarcodeScanner::EAN13FlagDigit2),
190 => Ok(BarcodeScanner::EAN13FlagDigit3),
191 => Ok(BarcodeScanner::AddEAN23LabelDefinition),
192 => Ok(BarcodeScanner::ClearallEAN23LabelDefinitions),
195 => Ok(BarcodeScanner::Codabar),
196 => Ok(BarcodeScanner::Code128),
199 => Ok(BarcodeScanner::Code39),
200 => Ok(BarcodeScanner::Code93),
201 => Ok(BarcodeScanner::FullASCIIConversion),
202 => Ok(BarcodeScanner::Interleaved2of5),
203 => Ok(BarcodeScanner::ItalianPharmacyCode),
204 => Ok(BarcodeScanner::MSIPlessey),
205 => Ok(BarcodeScanner::Standard2of5IATA),
206 => Ok(BarcodeScanner::Standard2of5),
211 => Ok(BarcodeScanner::TransmitStartStop),
212 => Ok(BarcodeScanner::TriOptic),
213 => Ok(BarcodeScanner::UCCEAN128),
214 => Ok(BarcodeScanner::CheckDigit),
215 => Ok(BarcodeScanner::CheckDigitDisable),
216 => Ok(BarcodeScanner::CheckDigitEnableInterleaved2of5OPCC),
217 => Ok(BarcodeScanner::CheckDigitEnableInterleaved2of5USS),
218 => Ok(BarcodeScanner::CheckDigitEnableStandard2of5OPCC),
219 => Ok(BarcodeScanner::CheckDigitEnableStandard2of5USS),
220 => Ok(BarcodeScanner::CheckDigitEnableOneMSIPlessey),
221 => Ok(BarcodeScanner::CheckDigitEnableTwoMSIPlessey),
222 => Ok(BarcodeScanner::CheckDigitCodabarEnable),
223 => Ok(BarcodeScanner::CheckDigitCode39Enable),
240 => Ok(BarcodeScanner::TransmitCheckDigit),
241 => Ok(BarcodeScanner::DisableCheckDigitTransmit),
242 => Ok(BarcodeScanner::EnableCheckDigitTransmit),
251 => Ok(BarcodeScanner::SymbologyIdentifier1),
252 => Ok(BarcodeScanner::SymbologyIdentifier2),
253 => Ok(BarcodeScanner::SymbologyIdentifier3),
254 => Ok(BarcodeScanner::DecodedData),
255 => Ok(BarcodeScanner::DecodeDataContinued),
256 => Ok(BarcodeScanner::BarSpaceData),
257 => Ok(BarcodeScanner::ScannerDataAccuracy),
258 => Ok(BarcodeScanner::RawDataPolarity),
259 => Ok(BarcodeScanner::PolarityInvertedBarCode),
260 => Ok(BarcodeScanner::PolarityNormalBarCode),
262 => Ok(BarcodeScanner::MinimumLengthtoDecode),
263 => Ok(BarcodeScanner::MaximumLengthtoDecode),
264 => Ok(BarcodeScanner::DiscreteLengthtoDecode1),
265 => Ok(BarcodeScanner::DiscreteLengthtoDecode2),
266 => Ok(BarcodeScanner::DataLengthMethod),
267 => Ok(BarcodeScanner::DLMethodReadany),
268 => Ok(BarcodeScanner::DLMethodCheckinRange),
269 => Ok(BarcodeScanner::DLMethodCheckforDiscrete),
272 => Ok(BarcodeScanner::AztecCode),
273 => Ok(BarcodeScanner::BC412),
274 => Ok(BarcodeScanner::ChannelCode),
275 => Ok(BarcodeScanner::Code16),
276 => Ok(BarcodeScanner::Code32),
277 => Ok(BarcodeScanner::Code49),
278 => Ok(BarcodeScanner::CodeOne),
279 => Ok(BarcodeScanner::Colorcode),
280 => Ok(BarcodeScanner::DataMatrix),
281 => Ok(BarcodeScanner::MaxiCode),
282 => Ok(BarcodeScanner::MicroPDF),
283 => Ok(BarcodeScanner::PDF417),
284 => Ok(BarcodeScanner::PosiCode),
285 => Ok(BarcodeScanner::QRCode),
286 => Ok(BarcodeScanner::SuperCode),
287 => Ok(BarcodeScanner::UltraCode),
288 => Ok(BarcodeScanner::USD5SlugCode),
289 => Ok(BarcodeScanner::VeriCode),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for BarcodeScanner {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum Scales {
Scales = 0x1,
ScaleDevice = 0x20,
ScaleClass = 0x21,
ScaleClassIMetric = 0x22,
ScaleClassIIMetric = 0x23,
ScaleClassIIIMetric = 0x24,
ScaleClassIIILMetric = 0x25,
ScaleClassIVMetric = 0x26,
ScaleClassIIIEnglish = 0x27,
ScaleClassIIILEnglish = 0x28,
ScaleClassIVEnglish = 0x29,
ScaleClassGeneric = 0x2A,
ScaleAttributeReport = 0x30,
ScaleControlReport = 0x31,
ScaleDataReport = 0x32,
ScaleStatusReport = 0x33,
ScaleWeightLimitReport = 0x34,
ScaleStatisticsReport = 0x35,
DataWeight = 0x40,
DataScaling = 0x41,
WeightUnit = 0x50,
WeightUnitMilligram = 0x51,
WeightUnitGram = 0x52,
WeightUnitKilogram = 0x53,
WeightUnitCarats = 0x54,
WeightUnitTaels = 0x55,
WeightUnitGrains = 0x56,
WeightUnitPennyweights = 0x57,
WeightUnitMetricTon = 0x58,
WeightUnitAvoirTon = 0x59,
WeightUnitTroyOunce = 0x5A,
WeightUnitOunce = 0x5B,
WeightUnitPound = 0x5C,
CalibrationCount = 0x60,
ReZeroCount = 0x61,
ScaleStatus = 0x70,
ScaleStatusFault = 0x71,
ScaleStatusStableatCenterofZero = 0x72,
ScaleStatusInMotion = 0x73,
ScaleStatusWeightStable = 0x74,
ScaleStatusUnderZero = 0x75,
ScaleStatusOverWeightLimit = 0x76,
ScaleStatusRequiresCalibration = 0x77,
ScaleStatusRequiresRezeroing = 0x78,
ZeroScale = 0x80,
EnforcedZeroReturn = 0x81,
}
impl Scales {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
Scales::Scales => "Scales",
Scales::ScaleDevice => "Scale Device",
Scales::ScaleClass => "Scale Class",
Scales::ScaleClassIMetric => "Scale Class I Metric",
Scales::ScaleClassIIMetric => "Scale Class II Metric",
Scales::ScaleClassIIIMetric => "Scale Class III Metric",
Scales::ScaleClassIIILMetric => "Scale Class IIIL Metric",
Scales::ScaleClassIVMetric => "Scale Class IV Metric",
Scales::ScaleClassIIIEnglish => "Scale Class III English",
Scales::ScaleClassIIILEnglish => "Scale Class IIIL English",
Scales::ScaleClassIVEnglish => "Scale Class IV English",
Scales::ScaleClassGeneric => "Scale Class Generic",
Scales::ScaleAttributeReport => "Scale Attribute Report",
Scales::ScaleControlReport => "Scale Control Report",
Scales::ScaleDataReport => "Scale Data Report",
Scales::ScaleStatusReport => "Scale Status Report",
Scales::ScaleWeightLimitReport => "Scale Weight Limit Report",
Scales::ScaleStatisticsReport => "Scale Statistics Report",
Scales::DataWeight => "Data Weight",
Scales::DataScaling => "Data Scaling",
Scales::WeightUnit => "Weight Unit",
Scales::WeightUnitMilligram => "Weight Unit Milligram",
Scales::WeightUnitGram => "Weight Unit Gram",
Scales::WeightUnitKilogram => "Weight Unit Kilogram",
Scales::WeightUnitCarats => "Weight Unit Carats",
Scales::WeightUnitTaels => "Weight Unit Taels",
Scales::WeightUnitGrains => "Weight Unit Grains",
Scales::WeightUnitPennyweights => "Weight Unit Pennyweights",
Scales::WeightUnitMetricTon => "Weight Unit Metric Ton",
Scales::WeightUnitAvoirTon => "Weight Unit Avoir Ton",
Scales::WeightUnitTroyOunce => "Weight Unit Troy Ounce",
Scales::WeightUnitOunce => "Weight Unit Ounce",
Scales::WeightUnitPound => "Weight Unit Pound",
Scales::CalibrationCount => "Calibration Count",
Scales::ReZeroCount => "Re-Zero Count",
Scales::ScaleStatus => "Scale Status",
Scales::ScaleStatusFault => "Scale Status Fault",
Scales::ScaleStatusStableatCenterofZero => "Scale Status Stable at Center of Zero",
Scales::ScaleStatusInMotion => "Scale Status In Motion",
Scales::ScaleStatusWeightStable => "Scale Status Weight Stable",
Scales::ScaleStatusUnderZero => "Scale Status Under Zero",
Scales::ScaleStatusOverWeightLimit => "Scale Status Over Weight Limit",
Scales::ScaleStatusRequiresCalibration => "Scale Status Requires Calibration",
Scales::ScaleStatusRequiresRezeroing => "Scale Status Requires Rezeroing",
Scales::ZeroScale => "Zero Scale",
Scales::EnforcedZeroReturn => "Enforced Zero Return",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for Scales {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for Scales {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for Scales {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&Scales> for u16 {
fn from(scales: &Scales) -> u16 {
*scales as u16
}
}
impl From<Scales> for u16 {
fn from(scales: Scales) -> u16 {
u16::from(&scales)
}
}
impl From<&Scales> for u32 {
fn from(scales: &Scales) -> u32 {
let up = UsagePage::from(scales);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(scales) as u32;
up | id
}
}
impl From<&Scales> for UsagePage {
fn from(_: &Scales) -> UsagePage {
UsagePage::Scales
}
}
impl From<Scales> for UsagePage {
fn from(_: Scales) -> UsagePage {
UsagePage::Scales
}
}
impl From<&Scales> for Usage {
fn from(scales: &Scales) -> Usage {
Usage::try_from(u32::from(scales)).unwrap()
}
}
impl From<Scales> for Usage {
fn from(scales: Scales) -> Usage {
Usage::from(&scales)
}
}
impl TryFrom<u16> for Scales {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<Scales> {
match usage_id {
1 => Ok(Scales::Scales),
32 => Ok(Scales::ScaleDevice),
33 => Ok(Scales::ScaleClass),
34 => Ok(Scales::ScaleClassIMetric),
35 => Ok(Scales::ScaleClassIIMetric),
36 => Ok(Scales::ScaleClassIIIMetric),
37 => Ok(Scales::ScaleClassIIILMetric),
38 => Ok(Scales::ScaleClassIVMetric),
39 => Ok(Scales::ScaleClassIIIEnglish),
40 => Ok(Scales::ScaleClassIIILEnglish),
41 => Ok(Scales::ScaleClassIVEnglish),
42 => Ok(Scales::ScaleClassGeneric),
48 => Ok(Scales::ScaleAttributeReport),
49 => Ok(Scales::ScaleControlReport),
50 => Ok(Scales::ScaleDataReport),
51 => Ok(Scales::ScaleStatusReport),
52 => Ok(Scales::ScaleWeightLimitReport),
53 => Ok(Scales::ScaleStatisticsReport),
64 => Ok(Scales::DataWeight),
65 => Ok(Scales::DataScaling),
80 => Ok(Scales::WeightUnit),
81 => Ok(Scales::WeightUnitMilligram),
82 => Ok(Scales::WeightUnitGram),
83 => Ok(Scales::WeightUnitKilogram),
84 => Ok(Scales::WeightUnitCarats),
85 => Ok(Scales::WeightUnitTaels),
86 => Ok(Scales::WeightUnitGrains),
87 => Ok(Scales::WeightUnitPennyweights),
88 => Ok(Scales::WeightUnitMetricTon),
89 => Ok(Scales::WeightUnitAvoirTon),
90 => Ok(Scales::WeightUnitTroyOunce),
91 => Ok(Scales::WeightUnitOunce),
92 => Ok(Scales::WeightUnitPound),
96 => Ok(Scales::CalibrationCount),
97 => Ok(Scales::ReZeroCount),
112 => Ok(Scales::ScaleStatus),
113 => Ok(Scales::ScaleStatusFault),
114 => Ok(Scales::ScaleStatusStableatCenterofZero),
115 => Ok(Scales::ScaleStatusInMotion),
116 => Ok(Scales::ScaleStatusWeightStable),
117 => Ok(Scales::ScaleStatusUnderZero),
118 => Ok(Scales::ScaleStatusOverWeightLimit),
119 => Ok(Scales::ScaleStatusRequiresCalibration),
120 => Ok(Scales::ScaleStatusRequiresRezeroing),
128 => Ok(Scales::ZeroScale),
129 => Ok(Scales::EnforcedZeroReturn),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for Scales {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum MagneticStripeReader {
MSRDeviceReadOnly = 0x1,
Track1Length = 0x11,
Track2Length = 0x12,
Track3Length = 0x13,
TrackJISLength = 0x14,
TrackData = 0x20,
Track1Data = 0x21,
Track2Data = 0x22,
Track3Data = 0x23,
TrackJISData = 0x24,
}
impl MagneticStripeReader {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
MagneticStripeReader::MSRDeviceReadOnly => "MSR Device Read-Only",
MagneticStripeReader::Track1Length => "Track 1 Length",
MagneticStripeReader::Track2Length => "Track 2 Length",
MagneticStripeReader::Track3Length => "Track 3 Length",
MagneticStripeReader::TrackJISLength => "Track JIS Length",
MagneticStripeReader::TrackData => "Track Data",
MagneticStripeReader::Track1Data => "Track 1 Data",
MagneticStripeReader::Track2Data => "Track 2 Data",
MagneticStripeReader::Track3Data => "Track 3 Data",
MagneticStripeReader::TrackJISData => "Track JIS Data",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for MagneticStripeReader {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for MagneticStripeReader {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for MagneticStripeReader {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&MagneticStripeReader> for u16 {
fn from(magneticstripereader: &MagneticStripeReader) -> u16 {
*magneticstripereader as u16
}
}
impl From<MagneticStripeReader> for u16 {
fn from(magneticstripereader: MagneticStripeReader) -> u16 {
u16::from(&magneticstripereader)
}
}
impl From<&MagneticStripeReader> for u32 {
fn from(magneticstripereader: &MagneticStripeReader) -> u32 {
let up = UsagePage::from(magneticstripereader);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(magneticstripereader) as u32;
up | id
}
}
impl From<&MagneticStripeReader> for UsagePage {
fn from(_: &MagneticStripeReader) -> UsagePage {
UsagePage::MagneticStripeReader
}
}
impl From<MagneticStripeReader> for UsagePage {
fn from(_: MagneticStripeReader) -> UsagePage {
UsagePage::MagneticStripeReader
}
}
impl From<&MagneticStripeReader> for Usage {
fn from(magneticstripereader: &MagneticStripeReader) -> Usage {
Usage::try_from(u32::from(magneticstripereader)).unwrap()
}
}
impl From<MagneticStripeReader> for Usage {
fn from(magneticstripereader: MagneticStripeReader) -> Usage {
Usage::from(&magneticstripereader)
}
}
impl TryFrom<u16> for MagneticStripeReader {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<MagneticStripeReader> {
match usage_id {
1 => Ok(MagneticStripeReader::MSRDeviceReadOnly),
17 => Ok(MagneticStripeReader::Track1Length),
18 => Ok(MagneticStripeReader::Track2Length),
19 => Ok(MagneticStripeReader::Track3Length),
20 => Ok(MagneticStripeReader::TrackJISLength),
32 => Ok(MagneticStripeReader::TrackData),
33 => Ok(MagneticStripeReader::Track1Data),
34 => Ok(MagneticStripeReader::Track2Data),
35 => Ok(MagneticStripeReader::Track3Data),
36 => Ok(MagneticStripeReader::TrackJISData),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for MagneticStripeReader {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum CameraControl {
CameraAutofocus = 0x20,
CameraShutter = 0x21,
}
impl CameraControl {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
CameraControl::CameraAutofocus => "Camera Auto-focus",
CameraControl::CameraShutter => "Camera Shutter",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for CameraControl {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for CameraControl {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for CameraControl {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&CameraControl> for u16 {
fn from(cameracontrol: &CameraControl) -> u16 {
*cameracontrol as u16
}
}
impl From<CameraControl> for u16 {
fn from(cameracontrol: CameraControl) -> u16 {
u16::from(&cameracontrol)
}
}
impl From<&CameraControl> for u32 {
fn from(cameracontrol: &CameraControl) -> u32 {
let up = UsagePage::from(cameracontrol);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(cameracontrol) as u32;
up | id
}
}
impl From<&CameraControl> for UsagePage {
fn from(_: &CameraControl) -> UsagePage {
UsagePage::CameraControl
}
}
impl From<CameraControl> for UsagePage {
fn from(_: CameraControl) -> UsagePage {
UsagePage::CameraControl
}
}
impl From<&CameraControl> for Usage {
fn from(cameracontrol: &CameraControl) -> Usage {
Usage::try_from(u32::from(cameracontrol)).unwrap()
}
}
impl From<CameraControl> for Usage {
fn from(cameracontrol: CameraControl) -> Usage {
Usage::from(&cameracontrol)
}
}
impl TryFrom<u16> for CameraControl {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<CameraControl> {
match usage_id {
32 => Ok(CameraControl::CameraAutofocus),
33 => Ok(CameraControl::CameraShutter),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for CameraControl {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum Arcade {
GeneralPurposeIOCard = 0x1,
CoinDoor = 0x2,
WatchdogTimer = 0x3,
GeneralPurposeAnalogInputState = 0x30,
GeneralPurposeDigitalInputState = 0x31,
GeneralPurposeOpticalInputState = 0x32,
GeneralPurposeDigitalOutputState = 0x33,
NumberofCoinDoors = 0x34,
CoinDrawerDropCount = 0x35,
CoinDrawerStart = 0x36,
CoinDrawerService = 0x37,
CoinDrawerTilt = 0x38,
CoinDoorTest = 0x39,
CoinDoorLockout = 0x40,
WatchdogTimeout = 0x41,
WatchdogAction = 0x42,
WatchdogReboot = 0x43,
WatchdogRestart = 0x44,
AlarmInput = 0x45,
CoinDoorCounter = 0x46,
IODirectionMapping = 0x47,
SetIODirectionMapping = 0x48,
ExtendedOpticalInputState = 0x49,
PinPadInputState = 0x4A,
PinPadStatus = 0x4B,
PinPadOutput = 0x4C,
PinPadCommand = 0x4D,
}
impl Arcade {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
Arcade::GeneralPurposeIOCard => "General Purpose IO Card",
Arcade::CoinDoor => "Coin Door",
Arcade::WatchdogTimer => "Watchdog Timer",
Arcade::GeneralPurposeAnalogInputState => "General Purpose Analog Input State",
Arcade::GeneralPurposeDigitalInputState => "General Purpose Digital Input State",
Arcade::GeneralPurposeOpticalInputState => "General Purpose Optical Input State",
Arcade::GeneralPurposeDigitalOutputState => "General Purpose Digital Output State",
Arcade::NumberofCoinDoors => "Number of Coin Doors",
Arcade::CoinDrawerDropCount => "Coin Drawer Drop Count",
Arcade::CoinDrawerStart => "Coin Drawer Start",
Arcade::CoinDrawerService => "Coin Drawer Service",
Arcade::CoinDrawerTilt => "Coin Drawer Tilt",
Arcade::CoinDoorTest => "Coin Door Test",
Arcade::CoinDoorLockout => "Coin Door Lockout",
Arcade::WatchdogTimeout => "Watchdog Timeout",
Arcade::WatchdogAction => "Watchdog Action",
Arcade::WatchdogReboot => "Watchdog Reboot",
Arcade::WatchdogRestart => "Watchdog Restart",
Arcade::AlarmInput => "Alarm Input",
Arcade::CoinDoorCounter => "Coin Door Counter",
Arcade::IODirectionMapping => "I/O Direction Mapping",
Arcade::SetIODirectionMapping => "Set I/O Direction Mapping",
Arcade::ExtendedOpticalInputState => "Extended Optical Input State",
Arcade::PinPadInputState => "Pin Pad Input State",
Arcade::PinPadStatus => "Pin Pad Status",
Arcade::PinPadOutput => "Pin Pad Output",
Arcade::PinPadCommand => "Pin Pad Command",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for Arcade {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for Arcade {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for Arcade {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&Arcade> for u16 {
fn from(arcade: &Arcade) -> u16 {
*arcade as u16
}
}
impl From<Arcade> for u16 {
fn from(arcade: Arcade) -> u16 {
u16::from(&arcade)
}
}
impl From<&Arcade> for u32 {
fn from(arcade: &Arcade) -> u32 {
let up = UsagePage::from(arcade);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(arcade) as u32;
up | id
}
}
impl From<&Arcade> for UsagePage {
fn from(_: &Arcade) -> UsagePage {
UsagePage::Arcade
}
}
impl From<Arcade> for UsagePage {
fn from(_: Arcade) -> UsagePage {
UsagePage::Arcade
}
}
impl From<&Arcade> for Usage {
fn from(arcade: &Arcade) -> Usage {
Usage::try_from(u32::from(arcade)).unwrap()
}
}
impl From<Arcade> for Usage {
fn from(arcade: Arcade) -> Usage {
Usage::from(&arcade)
}
}
impl TryFrom<u16> for Arcade {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<Arcade> {
match usage_id {
1 => Ok(Arcade::GeneralPurposeIOCard),
2 => Ok(Arcade::CoinDoor),
3 => Ok(Arcade::WatchdogTimer),
48 => Ok(Arcade::GeneralPurposeAnalogInputState),
49 => Ok(Arcade::GeneralPurposeDigitalInputState),
50 => Ok(Arcade::GeneralPurposeOpticalInputState),
51 => Ok(Arcade::GeneralPurposeDigitalOutputState),
52 => Ok(Arcade::NumberofCoinDoors),
53 => Ok(Arcade::CoinDrawerDropCount),
54 => Ok(Arcade::CoinDrawerStart),
55 => Ok(Arcade::CoinDrawerService),
56 => Ok(Arcade::CoinDrawerTilt),
57 => Ok(Arcade::CoinDoorTest),
64 => Ok(Arcade::CoinDoorLockout),
65 => Ok(Arcade::WatchdogTimeout),
66 => Ok(Arcade::WatchdogAction),
67 => Ok(Arcade::WatchdogReboot),
68 => Ok(Arcade::WatchdogRestart),
69 => Ok(Arcade::AlarmInput),
70 => Ok(Arcade::CoinDoorCounter),
71 => Ok(Arcade::IODirectionMapping),
72 => Ok(Arcade::SetIODirectionMapping),
73 => Ok(Arcade::ExtendedOpticalInputState),
74 => Ok(Arcade::PinPadInputState),
75 => Ok(Arcade::PinPadStatus),
76 => Ok(Arcade::PinPadOutput),
77 => Ok(Arcade::PinPadCommand),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for Arcade {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum FIDOAlliance {
U2FAuthenticatorDevice = 0x1,
InputReportData = 0x20,
OutputReportData = 0x21,
}
impl FIDOAlliance {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
FIDOAlliance::U2FAuthenticatorDevice => "U2F Authenticator Device",
FIDOAlliance::InputReportData => "Input Report Data",
FIDOAlliance::OutputReportData => "Output Report Data",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for FIDOAlliance {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for FIDOAlliance {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for FIDOAlliance {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&FIDOAlliance> for u16 {
fn from(fidoalliance: &FIDOAlliance) -> u16 {
*fidoalliance as u16
}
}
impl From<FIDOAlliance> for u16 {
fn from(fidoalliance: FIDOAlliance) -> u16 {
u16::from(&fidoalliance)
}
}
impl From<&FIDOAlliance> for u32 {
fn from(fidoalliance: &FIDOAlliance) -> u32 {
let up = UsagePage::from(fidoalliance);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(fidoalliance) as u32;
up | id
}
}
impl From<&FIDOAlliance> for UsagePage {
fn from(_: &FIDOAlliance) -> UsagePage {
UsagePage::FIDOAlliance
}
}
impl From<FIDOAlliance> for UsagePage {
fn from(_: FIDOAlliance) -> UsagePage {
UsagePage::FIDOAlliance
}
}
impl From<&FIDOAlliance> for Usage {
fn from(fidoalliance: &FIDOAlliance) -> Usage {
Usage::try_from(u32::from(fidoalliance)).unwrap()
}
}
impl From<FIDOAlliance> for Usage {
fn from(fidoalliance: FIDOAlliance) -> Usage {
Usage::from(&fidoalliance)
}
}
impl TryFrom<u16> for FIDOAlliance {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<FIDOAlliance> {
match usage_id {
1 => Ok(FIDOAlliance::U2FAuthenticatorDevice),
32 => Ok(FIDOAlliance::InputReportData),
33 => Ok(FIDOAlliance::OutputReportData),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for FIDOAlliance {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
#[repr(u16)]
pub enum Wacom {
WacomDigitizer = 0x1,
WacomPen = 0x2,
LightPen = 0x3,
TouchScreen = 0x4,
TouchPad = 0x5,
WhiteBoard = 0x6,
CoordinateMeasuringMachine = 0x7,
ThreeDDigitizer = 0x8,
StereoPlotter = 0x9,
ArticulatedArm = 0xA,
Armature = 0xB,
MultiplePointDigitizer = 0xC,
FreeSpaceWand = 0xD,
DeviceConfiguration = 0xE,
Stylus = 0x20,
Puck = 0x21,
Finger = 0x22,
DeviceSettings = 0x23,
TipPressure = 0x30,
BarrelPressure = 0x31,
InRange = 0x32,
Touch = 0x33,
Untouch = 0x34,
Tap = 0x35,
WacomSense = 0x36,
DataValid = 0x37,
TransducerIndex = 0x38,
WacomDigitizerFnKeys = 0x39,
ProgramChangeKeys = 0x3A,
BatteryStrength = 0x3B,
Invert = 0x3C,
XTilt = 0x3D,
YTilt = 0x3E,
Azimuth = 0x3F,
Altitude = 0x40,
Twist = 0x41,
TipSwitch = 0x42,
SecondaryTipSwitch = 0x43,
BarrelSwitch = 0x44,
Eraser = 0x45,
TabletPick = 0x46,
Confidence = 0x47,
Width = 0x48,
Height = 0x49,
ContactId = 0x51,
Inputmode = 0x52,
DeviceIndex = 0x53,
ContactCount = 0x54,
ContactMax = 0x55,
ScanTime = 0x56,
SurfaceSwitch = 0x57,
ButtonSwitch = 0x58,
ButtonType = 0x59,
SecondaryBarrelSwitch = 0x5A,
TransducerSerialNumber = 0x5B,
WacomSerialHi = 0x5C,
PreferredColorisLocked = 0x5D,
PreferredLineWidth = 0x5E,
PreferredLineWidthisLocked = 0x5F,
PreferredLineStyle = 0x70,
PreferredLineStyleisLocked = 0x71,
Ink = 0x72,
Pencil = 0x73,
Highlighter = 0x74,
ChiselMarker = 0x75,
Brush = 0x76,
WacomToolType = 0x77,
DigitizerDiagnostic = 0x80,
DigitizerError = 0x81,
ErrNormalStatus = 0x82,
ErrTransducersExceeded = 0x83,
ErrFullTransFeaturesUnavail = 0x84,
ErrChargeLow = 0x85,
X = 0x130,
Y = 0x131,
WacomDistance = 0x132,
WacomTouchStrip = 0x136,
WacomTouchStrip2 = 0x137,
WacomTouchRing = 0x138,
WacomTouchRingStatus = 0x139,
WacomAccelerometerX = 0x401,
WacomAccelerometerY = 0x402,
WacomAccelerometerZ = 0x403,
WacomBatteryCharging = 0x404,
WacomBatteryLevel = 0x43B,
WacomTouchOnOff = 0x454,
WacomExpressKey00 = 0x910,
WacomExpressKeyCap00 = 0x950,
WacomModeChange = 0x980,
WacomButtonDesktopCenter = 0x981,
WacomButtonOnScreenKeyboard = 0x982,
WacomButtonDisplaySetting = 0x983,
WacomButtonTouchOnOff = 0x986,
WacomButtonHome = 0x990,
WacomButtonUp = 0x991,
WacomButtonDown = 0x992,
WacomButtonLeft = 0x993,
WacomButtonRight = 0x994,
WacomButtonCenter = 0x995,
WacomFingerWheel = 0xD03,
WacomOffsetLeft = 0xD30,
WacomOffsetTop = 0xD31,
WacomOffsetRight = 0xD32,
WacomOffsetBottom = 0xD33,
WacomDataMode = 0x1002,
WacomDigitizerInfo = 0x1013,
}
impl Wacom {
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
Wacom::WacomDigitizer => "Wacom Digitizer",
Wacom::WacomPen => "Wacom Pen",
Wacom::LightPen => "Light Pen",
Wacom::TouchScreen => "Touch Screen",
Wacom::TouchPad => "Touch Pad",
Wacom::WhiteBoard => "White Board",
Wacom::CoordinateMeasuringMachine => "Coordinate Measuring Machine",
Wacom::ThreeDDigitizer => "3-D Digitizer",
Wacom::StereoPlotter => "Stereo Plotter",
Wacom::ArticulatedArm => "Articulated Arm",
Wacom::Armature => "Armature",
Wacom::MultiplePointDigitizer => "Multiple Point Digitizer",
Wacom::FreeSpaceWand => "Free Space Wand",
Wacom::DeviceConfiguration => "Device Configuration",
Wacom::Stylus => "Stylus",
Wacom::Puck => "Puck",
Wacom::Finger => "Finger",
Wacom::DeviceSettings => "Device Settings",
Wacom::TipPressure => "Tip Pressure",
Wacom::BarrelPressure => "Barrel Pressure",
Wacom::InRange => "In Range",
Wacom::Touch => "Touch",
Wacom::Untouch => "Untouch",
Wacom::Tap => "Tap",
Wacom::WacomSense => "Wacom Sense",
Wacom::DataValid => "Data Valid",
Wacom::TransducerIndex => "Transducer Index",
Wacom::WacomDigitizerFnKeys => "Wacom DigitizerFnKeys",
Wacom::ProgramChangeKeys => "Program Change Keys",
Wacom::BatteryStrength => "Battery Strength",
Wacom::Invert => "Invert",
Wacom::XTilt => "X Tilt",
Wacom::YTilt => "Y Tilt",
Wacom::Azimuth => "Azimuth",
Wacom::Altitude => "Altitude",
Wacom::Twist => "Twist",
Wacom::TipSwitch => "Tip Switch",
Wacom::SecondaryTipSwitch => "Secondary Tip Switch",
Wacom::BarrelSwitch => "Barrel Switch",
Wacom::Eraser => "Eraser",
Wacom::TabletPick => "Tablet Pick",
Wacom::Confidence => "Confidence",
Wacom::Width => "Width",
Wacom::Height => "Height",
Wacom::ContactId => "Contact Id",
Wacom::Inputmode => "Inputmode",
Wacom::DeviceIndex => "Device Index",
Wacom::ContactCount => "Contact Count",
Wacom::ContactMax => "Contact Max",
Wacom::ScanTime => "Scan Time",
Wacom::SurfaceSwitch => "Surface Switch",
Wacom::ButtonSwitch => "Button Switch",
Wacom::ButtonType => "Button Type",
Wacom::SecondaryBarrelSwitch => "Secondary Barrel Switch",
Wacom::TransducerSerialNumber => "Transducer Serial Number",
Wacom::WacomSerialHi => "Wacom SerialHi",
Wacom::PreferredColorisLocked => "Preferred Color is Locked",
Wacom::PreferredLineWidth => "Preferred Line Width",
Wacom::PreferredLineWidthisLocked => "Preferred Line Width is Locked",
Wacom::PreferredLineStyle => "Preferred Line Style",
Wacom::PreferredLineStyleisLocked => "Preferred Line Style is Locked",
Wacom::Ink => "Ink",
Wacom::Pencil => "Pencil",
Wacom::Highlighter => "Highlighter",
Wacom::ChiselMarker => "Chisel Marker",
Wacom::Brush => "Brush",
Wacom::WacomToolType => "Wacom ToolType",
Wacom::DigitizerDiagnostic => "Digitizer Diagnostic",
Wacom::DigitizerError => "Digitizer Error",
Wacom::ErrNormalStatus => "Err Normal Status",
Wacom::ErrTransducersExceeded => "Err Transducers Exceeded",
Wacom::ErrFullTransFeaturesUnavail => "Err Full Trans Features Unavail",
Wacom::ErrChargeLow => "Err Charge Low",
Wacom::X => "X",
Wacom::Y => "Y",
Wacom::WacomDistance => "Wacom Distance",
Wacom::WacomTouchStrip => "Wacom TouchStrip",
Wacom::WacomTouchStrip2 => "Wacom TouchStrip2",
Wacom::WacomTouchRing => "Wacom TouchRing",
Wacom::WacomTouchRingStatus => "Wacom TouchRingStatus",
Wacom::WacomAccelerometerX => "Wacom Accelerometer X",
Wacom::WacomAccelerometerY => "Wacom Accelerometer Y",
Wacom::WacomAccelerometerZ => "Wacom Accelerometer Z",
Wacom::WacomBatteryCharging => "Wacom Battery Charging",
Wacom::WacomBatteryLevel => "Wacom Battery Level",
Wacom::WacomTouchOnOff => "Wacom TouchOnOff",
Wacom::WacomExpressKey00 => "Wacom ExpressKey00",
Wacom::WacomExpressKeyCap00 => "Wacom ExpressKeyCap00",
Wacom::WacomModeChange => "Wacom Mode Change",
Wacom::WacomButtonDesktopCenter => "Wacom Button Desktop Center",
Wacom::WacomButtonOnScreenKeyboard => "Wacom Button On Screen Keyboard",
Wacom::WacomButtonDisplaySetting => "Wacom Button Display Setting",
Wacom::WacomButtonTouchOnOff => "Wacom Button Touch On/Off",
Wacom::WacomButtonHome => "Wacom Button Home",
Wacom::WacomButtonUp => "Wacom Button Up",
Wacom::WacomButtonDown => "Wacom Button Down",
Wacom::WacomButtonLeft => "Wacom Button Left",
Wacom::WacomButtonRight => "Wacom Button Right",
Wacom::WacomButtonCenter => "Wacom Button Center",
Wacom::WacomFingerWheel => "Wacom FingerWheel",
Wacom::WacomOffsetLeft => "Wacom Offset Left",
Wacom::WacomOffsetTop => "Wacom Offset Top",
Wacom::WacomOffsetRight => "Wacom Offset Right",
Wacom::WacomOffsetBottom => "Wacom Offset Bottom",
Wacom::WacomDataMode => "Wacom DataMode",
Wacom::WacomDigitizerInfo => "Wacom Digitizer Info",
}
.into()
}
}
#[cfg(feature = "std")]
impl fmt::Display for Wacom {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl AsUsage for Wacom {
fn usage_value(&self) -> u32 {
u32::from(self)
}
fn usage_id_value(&self) -> u16 {
u16::from(self)
}
fn usage(&self) -> Usage {
Usage::from(self)
}
}
impl AsUsagePage for Wacom {
fn usage_page_value(&self) -> u16 {
let up = UsagePage::from(self);
u16::from(up)
}
fn usage_page(&self) -> UsagePage {
UsagePage::from(self)
}
}
impl From<&Wacom> for u16 {
fn from(wacom: &Wacom) -> u16 {
*wacom as u16
}
}
impl From<Wacom> for u16 {
fn from(wacom: Wacom) -> u16 {
u16::from(&wacom)
}
}
impl From<&Wacom> for u32 {
fn from(wacom: &Wacom) -> u32 {
let up = UsagePage::from(wacom);
let up = (u16::from(&up) as u32) << 16;
let id = u16::from(wacom) as u32;
up | id
}
}
impl From<&Wacom> for UsagePage {
fn from(_: &Wacom) -> UsagePage {
UsagePage::Wacom
}
}
impl From<Wacom> for UsagePage {
fn from(_: Wacom) -> UsagePage {
UsagePage::Wacom
}
}
impl From<&Wacom> for Usage {
fn from(wacom: &Wacom) -> Usage {
Usage::try_from(u32::from(wacom)).unwrap()
}
}
impl From<Wacom> for Usage {
fn from(wacom: Wacom) -> Usage {
Usage::from(&wacom)
}
}
impl TryFrom<u16> for Wacom {
type Error = HutError;
fn try_from(usage_id: u16) -> Result<Wacom> {
match usage_id {
1 => Ok(Wacom::WacomDigitizer),
2 => Ok(Wacom::WacomPen),
3 => Ok(Wacom::LightPen),
4 => Ok(Wacom::TouchScreen),
5 => Ok(Wacom::TouchPad),
6 => Ok(Wacom::WhiteBoard),
7 => Ok(Wacom::CoordinateMeasuringMachine),
8 => Ok(Wacom::ThreeDDigitizer),
9 => Ok(Wacom::StereoPlotter),
10 => Ok(Wacom::ArticulatedArm),
11 => Ok(Wacom::Armature),
12 => Ok(Wacom::MultiplePointDigitizer),
13 => Ok(Wacom::FreeSpaceWand),
14 => Ok(Wacom::DeviceConfiguration),
32 => Ok(Wacom::Stylus),
33 => Ok(Wacom::Puck),
34 => Ok(Wacom::Finger),
35 => Ok(Wacom::DeviceSettings),
48 => Ok(Wacom::TipPressure),
49 => Ok(Wacom::BarrelPressure),
50 => Ok(Wacom::InRange),
51 => Ok(Wacom::Touch),
52 => Ok(Wacom::Untouch),
53 => Ok(Wacom::Tap),
54 => Ok(Wacom::WacomSense),
55 => Ok(Wacom::DataValid),
56 => Ok(Wacom::TransducerIndex),
57 => Ok(Wacom::WacomDigitizerFnKeys),
58 => Ok(Wacom::ProgramChangeKeys),
59 => Ok(Wacom::BatteryStrength),
60 => Ok(Wacom::Invert),
61 => Ok(Wacom::XTilt),
62 => Ok(Wacom::YTilt),
63 => Ok(Wacom::Azimuth),
64 => Ok(Wacom::Altitude),
65 => Ok(Wacom::Twist),
66 => Ok(Wacom::TipSwitch),
67 => Ok(Wacom::SecondaryTipSwitch),
68 => Ok(Wacom::BarrelSwitch),
69 => Ok(Wacom::Eraser),
70 => Ok(Wacom::TabletPick),
71 => Ok(Wacom::Confidence),
72 => Ok(Wacom::Width),
73 => Ok(Wacom::Height),
81 => Ok(Wacom::ContactId),
82 => Ok(Wacom::Inputmode),
83 => Ok(Wacom::DeviceIndex),
84 => Ok(Wacom::ContactCount),
85 => Ok(Wacom::ContactMax),
86 => Ok(Wacom::ScanTime),
87 => Ok(Wacom::SurfaceSwitch),
88 => Ok(Wacom::ButtonSwitch),
89 => Ok(Wacom::ButtonType),
90 => Ok(Wacom::SecondaryBarrelSwitch),
91 => Ok(Wacom::TransducerSerialNumber),
92 => Ok(Wacom::WacomSerialHi),
93 => Ok(Wacom::PreferredColorisLocked),
94 => Ok(Wacom::PreferredLineWidth),
95 => Ok(Wacom::PreferredLineWidthisLocked),
112 => Ok(Wacom::PreferredLineStyle),
113 => Ok(Wacom::PreferredLineStyleisLocked),
114 => Ok(Wacom::Ink),
115 => Ok(Wacom::Pencil),
116 => Ok(Wacom::Highlighter),
117 => Ok(Wacom::ChiselMarker),
118 => Ok(Wacom::Brush),
119 => Ok(Wacom::WacomToolType),
128 => Ok(Wacom::DigitizerDiagnostic),
129 => Ok(Wacom::DigitizerError),
130 => Ok(Wacom::ErrNormalStatus),
131 => Ok(Wacom::ErrTransducersExceeded),
132 => Ok(Wacom::ErrFullTransFeaturesUnavail),
133 => Ok(Wacom::ErrChargeLow),
304 => Ok(Wacom::X),
305 => Ok(Wacom::Y),
306 => Ok(Wacom::WacomDistance),
310 => Ok(Wacom::WacomTouchStrip),
311 => Ok(Wacom::WacomTouchStrip2),
312 => Ok(Wacom::WacomTouchRing),
313 => Ok(Wacom::WacomTouchRingStatus),
1025 => Ok(Wacom::WacomAccelerometerX),
1026 => Ok(Wacom::WacomAccelerometerY),
1027 => Ok(Wacom::WacomAccelerometerZ),
1028 => Ok(Wacom::WacomBatteryCharging),
1083 => Ok(Wacom::WacomBatteryLevel),
1108 => Ok(Wacom::WacomTouchOnOff),
2320 => Ok(Wacom::WacomExpressKey00),
2384 => Ok(Wacom::WacomExpressKeyCap00),
2432 => Ok(Wacom::WacomModeChange),
2433 => Ok(Wacom::WacomButtonDesktopCenter),
2434 => Ok(Wacom::WacomButtonOnScreenKeyboard),
2435 => Ok(Wacom::WacomButtonDisplaySetting),
2438 => Ok(Wacom::WacomButtonTouchOnOff),
2448 => Ok(Wacom::WacomButtonHome),
2449 => Ok(Wacom::WacomButtonUp),
2450 => Ok(Wacom::WacomButtonDown),
2451 => Ok(Wacom::WacomButtonLeft),
2452 => Ok(Wacom::WacomButtonRight),
2453 => Ok(Wacom::WacomButtonCenter),
3331 => Ok(Wacom::WacomFingerWheel),
3376 => Ok(Wacom::WacomOffsetLeft),
3377 => Ok(Wacom::WacomOffsetTop),
3378 => Ok(Wacom::WacomOffsetRight),
3379 => Ok(Wacom::WacomOffsetBottom),
4098 => Ok(Wacom::WacomDataMode),
4115 => Ok(Wacom::WacomDigitizerInfo),
n => Err(HutError::UnknownUsageId { usage_id: n }),
}
}
}
impl BitOr<u16> for Wacom {
type Output = Usage;
fn bitor(self, usage: u16) -> Usage {
let up = u16::from(self) as u32;
let u = usage as u32;
Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
}
}
#[allow(non_camel_case_types)]
#[derive(Debug)]
#[non_exhaustive]
pub enum ReservedUsagePage {
Undefined,
ReservedUsage { usage_id: u16 },
}
impl ReservedUsagePage {
#[cfg(feature = "std")]
fn name(&self) -> String {
match self {
ReservedUsagePage::Undefined => "Reserved Usage Undefined".to_string(),
ReservedUsagePage::ReservedUsage { usage_id } => {
format!("Reserved Usage 0x{usage_id:02x}")
}
}
}
}
#[cfg(feature = "std")]
impl fmt::Display for ReservedUsagePage {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl From<&ReservedUsagePage> for u16 {
fn from(v: &ReservedUsagePage) -> u16 {
match v {
ReservedUsagePage::Undefined => 0x00,
ReservedUsagePage::ReservedUsage { usage_id } => *usage_id,
}
}
}
#[allow(non_camel_case_types)]
#[derive(Debug)]
#[non_exhaustive]
pub enum VendorDefinedPage {
Undefined,
VendorUsage { usage_id: u16 },
}
impl VendorDefinedPage {
#[cfg(feature = "std")]
fn name(&self) -> String {
match self {
VendorDefinedPage::Undefined => "Vendor Usage Undefined".to_string(),
VendorDefinedPage::VendorUsage { usage_id } => {
format!("Vendor Usage 0x{usage_id:02x}")
}
}
}
}
#[cfg(feature = "std")]
impl fmt::Display for VendorDefinedPage {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl From<&VendorDefinedPage> for u16 {
fn from(v: &VendorDefinedPage) -> u16 {
match v {
VendorDefinedPage::Undefined => 0x00,
VendorDefinedPage::VendorUsage { usage_id } => *usage_id,
}
}
}
impl From<&Usage> for UsagePage {
#[allow(clippy::unneeded_struct_pattern)]
fn from(usage: &Usage) -> UsagePage {
match usage {
Usage::GenericDesktop { .. } => UsagePage::GenericDesktop,
Usage::SimulationControls { .. } => UsagePage::SimulationControls,
Usage::VRControls { .. } => UsagePage::VRControls,
Usage::SportControls { .. } => UsagePage::SportControls,
Usage::GameControls { .. } => UsagePage::GameControls,
Usage::GenericDeviceControls { .. } => UsagePage::GenericDeviceControls,
Usage::KeyboardKeypad { .. } => UsagePage::KeyboardKeypad,
Usage::LED { .. } => UsagePage::LED,
Usage::Button { .. } => UsagePage::Button,
Usage::Ordinal { .. } => UsagePage::Ordinal,
Usage::TelephonyDevice { .. } => UsagePage::TelephonyDevice,
Usage::Consumer { .. } => UsagePage::Consumer,
Usage::Digitizers { .. } => UsagePage::Digitizers,
Usage::Haptics { .. } => UsagePage::Haptics,
Usage::PhysicalInputDevice { .. } => UsagePage::PhysicalInputDevice,
Usage::Unicode { .. } => UsagePage::Unicode,
Usage::SoC { .. } => UsagePage::SoC,
Usage::EyeandHeadTrackers { .. } => UsagePage::EyeandHeadTrackers,
Usage::AuxiliaryDisplay { .. } => UsagePage::AuxiliaryDisplay,
Usage::Sensors { .. } => UsagePage::Sensors,
Usage::MedicalInstrument { .. } => UsagePage::MedicalInstrument,
Usage::BrailleDisplay { .. } => UsagePage::BrailleDisplay,
Usage::LightingAndIllumination { .. } => UsagePage::LightingAndIllumination,
Usage::Monitor { .. } => UsagePage::Monitor,
Usage::MonitorEnumerated { .. } => UsagePage::MonitorEnumerated,
Usage::VESAVirtualControls { .. } => UsagePage::VESAVirtualControls,
Usage::Power { .. } => UsagePage::Power,
Usage::BatterySystem { .. } => UsagePage::BatterySystem,
Usage::BarcodeScanner { .. } => UsagePage::BarcodeScanner,
Usage::Scales { .. } => UsagePage::Scales,
Usage::MagneticStripeReader { .. } => UsagePage::MagneticStripeReader,
Usage::CameraControl { .. } => UsagePage::CameraControl,
Usage::Arcade { .. } => UsagePage::Arcade,
Usage::FIDOAlliance { .. } => UsagePage::FIDOAlliance,
Usage::Wacom { .. } => UsagePage::Wacom,
Usage::ReservedUsagePage { reserved_page, .. } => {
UsagePage::ReservedUsagePage(*reserved_page)
}
Usage::VendorDefinedPage { vendor_page, .. } => {
UsagePage::VendorDefinedPage(*vendor_page)
}
}
}
}
impl From<&UsagePage> for u16 {
#[allow(clippy::unneeded_struct_pattern)]
fn from(usage_page: &UsagePage) -> u16 {
match usage_page {
UsagePage::GenericDesktop { .. } => 1,
UsagePage::SimulationControls { .. } => 2,
UsagePage::VRControls { .. } => 3,
UsagePage::SportControls { .. } => 4,
UsagePage::GameControls { .. } => 5,
UsagePage::GenericDeviceControls { .. } => 6,
UsagePage::KeyboardKeypad { .. } => 7,
UsagePage::LED { .. } => 8,
UsagePage::Button { .. } => 9,
UsagePage::Ordinal { .. } => 10,
UsagePage::TelephonyDevice { .. } => 11,
UsagePage::Consumer { .. } => 12,
UsagePage::Digitizers { .. } => 13,
UsagePage::Haptics { .. } => 14,
UsagePage::PhysicalInputDevice { .. } => 15,
UsagePage::Unicode { .. } => 16,
UsagePage::SoC { .. } => 17,
UsagePage::EyeandHeadTrackers { .. } => 18,
UsagePage::AuxiliaryDisplay { .. } => 20,
UsagePage::Sensors { .. } => 32,
UsagePage::MedicalInstrument { .. } => 64,
UsagePage::BrailleDisplay { .. } => 65,
UsagePage::LightingAndIllumination { .. } => 89,
UsagePage::Monitor { .. } => 128,
UsagePage::MonitorEnumerated { .. } => 129,
UsagePage::VESAVirtualControls { .. } => 130,
UsagePage::Power { .. } => 132,
UsagePage::BatterySystem { .. } => 133,
UsagePage::BarcodeScanner { .. } => 140,
UsagePage::Scales { .. } => 141,
UsagePage::MagneticStripeReader { .. } => 142,
UsagePage::CameraControl { .. } => 144,
UsagePage::Arcade { .. } => 145,
UsagePage::FIDOAlliance { .. } => 61904,
UsagePage::Wacom { .. } => 65293,
UsagePage::ReservedUsagePage(reserved_page) => u16::from(reserved_page),
UsagePage::VendorDefinedPage(vendor_page) => u16::from(vendor_page),
}
}
}
impl From<UsagePage> for u16 {
fn from(usage_page: UsagePage) -> u16 {
u16::from(&usage_page)
}
}
impl TryFrom<u16> for UsagePage {
type Error = HutError;
fn try_from(usage_page: u16) -> Result<UsagePage> {
match usage_page {
1 => Ok(UsagePage::GenericDesktop),
2 => Ok(UsagePage::SimulationControls),
3 => Ok(UsagePage::VRControls),
4 => Ok(UsagePage::SportControls),
5 => Ok(UsagePage::GameControls),
6 => Ok(UsagePage::GenericDeviceControls),
7 => Ok(UsagePage::KeyboardKeypad),
8 => Ok(UsagePage::LED),
9 => Ok(UsagePage::Button),
10 => Ok(UsagePage::Ordinal),
11 => Ok(UsagePage::TelephonyDevice),
12 => Ok(UsagePage::Consumer),
13 => Ok(UsagePage::Digitizers),
14 => Ok(UsagePage::Haptics),
15 => Ok(UsagePage::PhysicalInputDevice),
16 => Ok(UsagePage::Unicode),
17 => Ok(UsagePage::SoC),
18 => Ok(UsagePage::EyeandHeadTrackers),
20 => Ok(UsagePage::AuxiliaryDisplay),
32 => Ok(UsagePage::Sensors),
64 => Ok(UsagePage::MedicalInstrument),
65 => Ok(UsagePage::BrailleDisplay),
89 => Ok(UsagePage::LightingAndIllumination),
128 => Ok(UsagePage::Monitor),
129 => Ok(UsagePage::MonitorEnumerated),
130 => Ok(UsagePage::VESAVirtualControls),
132 => Ok(UsagePage::Power),
133 => Ok(UsagePage::BatterySystem),
140 => Ok(UsagePage::BarcodeScanner),
141 => Ok(UsagePage::Scales),
142 => Ok(UsagePage::MagneticStripeReader),
144 => Ok(UsagePage::CameraControl),
145 => Ok(UsagePage::Arcade),
61904 => Ok(UsagePage::FIDOAlliance),
65293 => Ok(UsagePage::Wacom),
page @ 0xff00..=0xffff => Ok(UsagePage::VendorDefinedPage(VendorPage(page))),
n => match ReservedPage::try_from(n) {
Ok(r) => Ok(UsagePage::ReservedUsagePage(r)),
Err(_) => Err(HutError::UnknownUsagePage { usage_page: n }),
},
}
}
}
impl TryFrom<u32> for UsagePage {
type Error = HutError;
fn try_from(usage_page: u32) -> Result<UsagePage> {
UsagePage::try_from((usage_page >> 16) as u16)
}
}
#[cfg(feature = "std")]
impl fmt::Display for UsagePage {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
#[allow(non_camel_case_types)]
#[derive(Debug)]
#[non_exhaustive]
pub enum Usage {
GenericDesktop(GenericDesktop),
SimulationControls(SimulationControls),
VRControls(VRControls),
SportControls(SportControls),
GameControls(GameControls),
GenericDeviceControls(GenericDeviceControls),
KeyboardKeypad(KeyboardKeypad),
LED(LED),
Button(Button),
Ordinal(Ordinal),
TelephonyDevice(TelephonyDevice),
Consumer(Consumer),
Digitizers(Digitizers),
Haptics(Haptics),
PhysicalInputDevice(PhysicalInputDevice),
Unicode(Unicode),
SoC(SoC),
EyeandHeadTrackers(EyeandHeadTrackers),
AuxiliaryDisplay(AuxiliaryDisplay),
Sensors(Sensors),
MedicalInstrument(MedicalInstrument),
BrailleDisplay(BrailleDisplay),
LightingAndIllumination(LightingAndIllumination),
Monitor(Monitor),
MonitorEnumerated(MonitorEnumerated),
VESAVirtualControls(VESAVirtualControls),
Power(Power),
BatterySystem(BatterySystem),
BarcodeScanner(BarcodeScanner),
Scales(Scales),
MagneticStripeReader(MagneticStripeReader),
CameraControl(CameraControl),
Arcade(Arcade),
FIDOAlliance(FIDOAlliance),
Wacom(Wacom),
ReservedUsagePage {
reserved_page: ReservedPage,
usage: ReservedUsagePage,
},
VendorDefinedPage {
vendor_page: VendorPage,
usage: VendorDefinedPage,
},
}
impl Usage {
#[cfg(feature = "std")]
pub fn new_from_page_and_id(usage_page: u16, usage_id: u16) -> Result<Usage> {
Usage::try_from(((usage_page as u32) << 16) | usage_id as u32)
}
#[cfg(feature = "std")]
pub fn name(&self) -> String {
match self {
Usage::GenericDesktop(usage) => usage.name(),
Usage::SimulationControls(usage) => usage.name(),
Usage::VRControls(usage) => usage.name(),
Usage::SportControls(usage) => usage.name(),
Usage::GameControls(usage) => usage.name(),
Usage::GenericDeviceControls(usage) => usage.name(),
Usage::KeyboardKeypad(usage) => usage.name(),
Usage::LED(usage) => usage.name(),
Usage::Button(usage) => usage.name(),
Usage::Ordinal(usage) => usage.name(),
Usage::TelephonyDevice(usage) => usage.name(),
Usage::Consumer(usage) => usage.name(),
Usage::Digitizers(usage) => usage.name(),
Usage::Haptics(usage) => usage.name(),
Usage::PhysicalInputDevice(usage) => usage.name(),
Usage::Unicode(usage) => usage.name(),
Usage::SoC(usage) => usage.name(),
Usage::EyeandHeadTrackers(usage) => usage.name(),
Usage::AuxiliaryDisplay(usage) => usage.name(),
Usage::Sensors(usage) => usage.name(),
Usage::MedicalInstrument(usage) => usage.name(),
Usage::BrailleDisplay(usage) => usage.name(),
Usage::LightingAndIllumination(usage) => usage.name(),
Usage::Monitor(usage) => usage.name(),
Usage::MonitorEnumerated(usage) => usage.name(),
Usage::VESAVirtualControls(usage) => usage.name(),
Usage::Power(usage) => usage.name(),
Usage::BatterySystem(usage) => usage.name(),
Usage::BarcodeScanner(usage) => usage.name(),
Usage::Scales(usage) => usage.name(),
Usage::MagneticStripeReader(usage) => usage.name(),
Usage::CameraControl(usage) => usage.name(),
Usage::Arcade(usage) => usage.name(),
Usage::FIDOAlliance(usage) => usage.name(),
Usage::Wacom(usage) => usage.name(),
Usage::ReservedUsagePage { usage, .. } => usage.name(),
Usage::VendorDefinedPage { usage, .. } => usage.name(),
}
}
}
impl AsUsage for Usage {
fn usage_value(&self) -> u32 {
self.into()
}
fn usage_id_value(&self) -> u16 {
self.into()
}
fn usage(&self) -> Usage {
Usage::try_from(self.usage_value()).unwrap()
}
}
impl PartialEq for Usage {
fn eq(&self, other: &Self) -> bool {
u32::from(self) == u32::from(other)
}
}
impl AsUsagePage for Usage {
fn usage_page_value(&self) -> u16 {
UsagePage::from(self).into()
}
fn usage_page(&self) -> UsagePage {
match self {
Usage::GenericDesktop(_) => UsagePage::GenericDesktop,
Usage::SimulationControls(_) => UsagePage::SimulationControls,
Usage::VRControls(_) => UsagePage::VRControls,
Usage::SportControls(_) => UsagePage::SportControls,
Usage::GameControls(_) => UsagePage::GameControls,
Usage::GenericDeviceControls(_) => UsagePage::GenericDeviceControls,
Usage::KeyboardKeypad(_) => UsagePage::KeyboardKeypad,
Usage::LED(_) => UsagePage::LED,
Usage::Button(_) => UsagePage::Button,
Usage::Ordinal(_) => UsagePage::Ordinal,
Usage::TelephonyDevice(_) => UsagePage::TelephonyDevice,
Usage::Consumer(_) => UsagePage::Consumer,
Usage::Digitizers(_) => UsagePage::Digitizers,
Usage::Haptics(_) => UsagePage::Haptics,
Usage::PhysicalInputDevice(_) => UsagePage::PhysicalInputDevice,
Usage::Unicode(_) => UsagePage::Unicode,
Usage::SoC(_) => UsagePage::SoC,
Usage::EyeandHeadTrackers(_) => UsagePage::EyeandHeadTrackers,
Usage::AuxiliaryDisplay(_) => UsagePage::AuxiliaryDisplay,
Usage::Sensors(_) => UsagePage::Sensors,
Usage::MedicalInstrument(_) => UsagePage::MedicalInstrument,
Usage::BrailleDisplay(_) => UsagePage::BrailleDisplay,
Usage::LightingAndIllumination(_) => UsagePage::LightingAndIllumination,
Usage::Monitor(_) => UsagePage::Monitor,
Usage::MonitorEnumerated(_) => UsagePage::MonitorEnumerated,
Usage::VESAVirtualControls(_) => UsagePage::VESAVirtualControls,
Usage::Power(_) => UsagePage::Power,
Usage::BatterySystem(_) => UsagePage::BatterySystem,
Usage::BarcodeScanner(_) => UsagePage::BarcodeScanner,
Usage::Scales(_) => UsagePage::Scales,
Usage::MagneticStripeReader(_) => UsagePage::MagneticStripeReader,
Usage::CameraControl(_) => UsagePage::CameraControl,
Usage::Arcade(_) => UsagePage::Arcade,
Usage::FIDOAlliance(_) => UsagePage::FIDOAlliance,
Usage::Wacom(_) => UsagePage::Wacom,
Usage::ReservedUsagePage { reserved_page, .. } => {
UsagePage::ReservedUsagePage(*reserved_page)
}
Usage::VendorDefinedPage { vendor_page, .. } => {
UsagePage::VendorDefinedPage(*vendor_page)
}
}
}
}
#[cfg(feature = "std")]
impl fmt::Display for Usage {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.name())
}
}
impl From<&Usage> for u16 {
fn from(usage: &Usage) -> u16 {
let u: u32 = u32::from(usage);
(u & 0xFFFF) as u16
}
}
impl From<Usage> for u16 {
fn from(usage: Usage) -> u16 {
u16::from(&usage)
}
}
impl From<&Usage> for u32 {
fn from(usage: &Usage) -> u32 {
match usage {
Usage::GenericDesktop(usage) => (1 << 16) | u16::from(usage) as u32,
Usage::SimulationControls(usage) => (2 << 16) | u16::from(usage) as u32,
Usage::VRControls(usage) => (3 << 16) | u16::from(usage) as u32,
Usage::SportControls(usage) => (4 << 16) | u16::from(usage) as u32,
Usage::GameControls(usage) => (5 << 16) | u16::from(usage) as u32,
Usage::GenericDeviceControls(usage) => (6 << 16) | u16::from(usage) as u32,
Usage::KeyboardKeypad(usage) => (7 << 16) | u16::from(usage) as u32,
Usage::LED(usage) => (8 << 16) | u16::from(usage) as u32,
Usage::Button(usage) => (9 << 16) | u16::from(usage) as u32,
Usage::Ordinal(usage) => (10 << 16) | u16::from(usage) as u32,
Usage::TelephonyDevice(usage) => (11 << 16) | u16::from(usage) as u32,
Usage::Consumer(usage) => (12 << 16) | u16::from(usage) as u32,
Usage::Digitizers(usage) => (13 << 16) | u16::from(usage) as u32,
Usage::Haptics(usage) => (14 << 16) | u16::from(usage) as u32,
Usage::PhysicalInputDevice(usage) => (15 << 16) | u16::from(usage) as u32,
Usage::Unicode(usage) => (16 << 16) | u16::from(usage) as u32,
Usage::SoC(usage) => (17 << 16) | u16::from(usage) as u32,
Usage::EyeandHeadTrackers(usage) => (18 << 16) | u16::from(usage) as u32,
Usage::AuxiliaryDisplay(usage) => (20 << 16) | u16::from(usage) as u32,
Usage::Sensors(usage) => (32 << 16) | u16::from(usage) as u32,
Usage::MedicalInstrument(usage) => (64 << 16) | u16::from(usage) as u32,
Usage::BrailleDisplay(usage) => (65 << 16) | u16::from(usage) as u32,
Usage::LightingAndIllumination(usage) => (89 << 16) | u16::from(usage) as u32,
Usage::Monitor(usage) => (128 << 16) | u16::from(usage) as u32,
Usage::MonitorEnumerated(usage) => (129 << 16) | u16::from(usage) as u32,
Usage::VESAVirtualControls(usage) => (130 << 16) | u16::from(usage) as u32,
Usage::Power(usage) => (132 << 16) | u16::from(usage) as u32,
Usage::BatterySystem(usage) => (133 << 16) | u16::from(usage) as u32,
Usage::BarcodeScanner(usage) => (140 << 16) | u16::from(usage) as u32,
Usage::Scales(usage) => (141 << 16) | u16::from(usage) as u32,
Usage::MagneticStripeReader(usage) => (142 << 16) | u16::from(usage) as u32,
Usage::CameraControl(usage) => (144 << 16) | u16::from(usage) as u32,
Usage::Arcade(usage) => (145 << 16) | u16::from(usage) as u32,
Usage::FIDOAlliance(usage) => (61904 << 16) | u16::from(usage) as u32,
Usage::Wacom(usage) => (65293 << 16) | u16::from(usage) as u32,
Usage::ReservedUsagePage {
reserved_page,
usage,
} => ((u16::from(reserved_page) as u32) << 16) | u16::from(usage) as u32,
Usage::VendorDefinedPage { vendor_page, usage } => {
((u16::from(vendor_page) as u32) << 16) | u16::from(usage) as u32
}
}
}
}
impl TryFrom<u32> for Usage {
type Error = HutError;
fn try_from(up: u32) -> Result<Usage> {
match (up >> 16, up & 0xFFFF) {
(1, n) => Ok(Usage::GenericDesktop(GenericDesktop::try_from(n as u16)?)),
(2, n) => Ok(Usage::SimulationControls(SimulationControls::try_from(
n as u16,
)?)),
(3, n) => Ok(Usage::VRControls(VRControls::try_from(n as u16)?)),
(4, n) => Ok(Usage::SportControls(SportControls::try_from(n as u16)?)),
(5, n) => Ok(Usage::GameControls(GameControls::try_from(n as u16)?)),
(6, n) => Ok(Usage::GenericDeviceControls(
GenericDeviceControls::try_from(n as u16)?,
)),
(7, n) => Ok(Usage::KeyboardKeypad(KeyboardKeypad::try_from(n as u16)?)),
(8, n) => Ok(Usage::LED(LED::try_from(n as u16)?)),
(9, n) => Ok(Usage::Button(Button::try_from(n as u16)?)),
(10, n) => Ok(Usage::Ordinal(Ordinal::try_from(n as u16)?)),
(11, n) => Ok(Usage::TelephonyDevice(TelephonyDevice::try_from(n as u16)?)),
(12, n) => Ok(Usage::Consumer(Consumer::try_from(n as u16)?)),
(13, n) => Ok(Usage::Digitizers(Digitizers::try_from(n as u16)?)),
(14, n) => Ok(Usage::Haptics(Haptics::try_from(n as u16)?)),
(15, n) => Ok(Usage::PhysicalInputDevice(PhysicalInputDevice::try_from(
n as u16,
)?)),
(16, n) => Ok(Usage::Unicode(Unicode::try_from(n as u16)?)),
(17, n) => Ok(Usage::SoC(SoC::try_from(n as u16)?)),
(18, n) => Ok(Usage::EyeandHeadTrackers(EyeandHeadTrackers::try_from(
n as u16,
)?)),
(20, n) => Ok(Usage::AuxiliaryDisplay(AuxiliaryDisplay::try_from(
n as u16,
)?)),
(32, n) => Ok(Usage::Sensors(Sensors::try_from(n as u16)?)),
(64, n) => Ok(Usage::MedicalInstrument(MedicalInstrument::try_from(
n as u16,
)?)),
(65, n) => Ok(Usage::BrailleDisplay(BrailleDisplay::try_from(n as u16)?)),
(89, n) => Ok(Usage::LightingAndIllumination(
LightingAndIllumination::try_from(n as u16)?,
)),
(128, n) => Ok(Usage::Monitor(Monitor::try_from(n as u16)?)),
(129, n) => Ok(Usage::MonitorEnumerated(MonitorEnumerated::try_from(
n as u16,
)?)),
(130, n) => Ok(Usage::VESAVirtualControls(VESAVirtualControls::try_from(
n as u16,
)?)),
(132, n) => Ok(Usage::Power(Power::try_from(n as u16)?)),
(133, n) => Ok(Usage::BatterySystem(BatterySystem::try_from(n as u16)?)),
(140, n) => Ok(Usage::BarcodeScanner(BarcodeScanner::try_from(n as u16)?)),
(141, n) => Ok(Usage::Scales(Scales::try_from(n as u16)?)),
(142, n) => Ok(Usage::MagneticStripeReader(MagneticStripeReader::try_from(
n as u16,
)?)),
(144, n) => Ok(Usage::CameraControl(CameraControl::try_from(n as u16)?)),
(145, n) => Ok(Usage::Arcade(Arcade::try_from(n as u16)?)),
(61904, n) => Ok(Usage::FIDOAlliance(FIDOAlliance::try_from(n as u16)?)),
(65293, n) => Ok(Usage::Wacom(Wacom::try_from(n as u16)?)),
(p @ 0xff00..=0xffff, n) => Ok(Usage::VendorDefinedPage {
vendor_page: VendorPage(p as u16),
usage: VendorDefinedPage::VendorUsage { usage_id: n as u16 },
}),
(p, n) => match ReservedPage::try_from(p as u16) {
Ok(r) => Ok(Usage::ReservedUsagePage {
reserved_page: r,
usage: ReservedUsagePage::ReservedUsage { usage_id: n as u16 },
}),
_ => Err(HutError::UnknownUsage),
},
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn conversions() {
let hid_usage_page: u16 = 0x01; let hid_usage_id: u16 = 0x02; let hid_usage: u32 = ((hid_usage_page as u32) << 16) | hid_usage_id as u32;
let u = GenericDesktop::Mouse;
assert!(matches!(
Usage::try_from(hid_usage).unwrap(),
Usage::GenericDesktop(_)
));
assert_eq!(u32::from(&u), hid_usage);
assert_eq!(u.usage_value(), hid_usage);
assert_eq!(hid_usage_id, u16::from(&u));
assert_eq!(hid_usage_id, u.usage_id_value());
assert!(matches!(UsagePage::from(&u), UsagePage::GenericDesktop));
let up = UsagePage::from(&u);
assert_eq!(hid_usage_page, u16::from(&up));
assert_eq!(hid_usage_page, up.usage_page_value());
}
#[test]
fn buttons() {
let hid_usage_page: u16 = 0x9;
let hid_usage_id: u16 = 0x5;
let hid_usage: u32 = ((hid_usage_page as u32) << 16) | hid_usage_id as u32;
let u = Button::Button(5);
assert!(matches!(
Usage::try_from(hid_usage).unwrap(),
Usage::Button(_)
));
assert_eq!(u32::from(&u), hid_usage);
assert_eq!(u.usage_value(), hid_usage);
assert_eq!(hid_usage_id, u16::from(&u));
assert_eq!(hid_usage_id, u.usage_id_value());
assert!(matches!(UsagePage::from(&u), UsagePage::Button));
let up = UsagePage::from(&u);
assert_eq!(hid_usage_page, u16::from(&up));
assert_eq!(hid_usage_page, up.usage_page_value());
}
#[test]
fn ordinals() {
let hid_usage_page: u16 = 0xA;
let hid_usage_id: u16 = 0x8;
let hid_usage: u32 = ((hid_usage_page as u32) << 16) | hid_usage_id as u32;
let u = Ordinal::Ordinal(8);
assert!(matches!(
Usage::try_from(hid_usage).unwrap(),
Usage::Ordinal(_)
));
assert_eq!(u32::from(&u), hid_usage);
assert_eq!(u.usage_value(), hid_usage);
assert_eq!(hid_usage_id, u16::from(&u));
assert_eq!(hid_usage_id, u.usage_id_value());
assert!(matches!(UsagePage::from(&u), UsagePage::Ordinal));
let up = UsagePage::from(&u);
assert_eq!(hid_usage_page, u16::from(&up));
assert_eq!(hid_usage_page, up.usage_page_value());
}
#[cfg(feature = "std")]
#[test]
fn names() {
assert_eq!(UsagePage::GenericDesktop.name().as_str(), "Generic Desktop");
assert_eq!(
UsagePage::PhysicalInputDevice.name().as_str(),
"Physical Input Device"
);
assert_eq!(GenericDesktop::CallMuteLED.name().as_str(), "Call Mute LED");
assert_eq!(VRControls::HeadTracker.name().as_str(), "Head Tracker");
}
#[test]
fn usages() {
let mouse = GenericDesktop::Mouse;
let usage = Usage::GenericDesktop(GenericDesktop::Mouse);
assert_eq!(mouse.usage(), usage);
}
}