1#![allow(clippy::identity_op, clippy::eq_op, clippy::match_single_binding)]
214#![no_std]
215
216#[cfg(feature = "std")]
217extern crate std;
218
219use core::ops::BitOr;
220#[cfg(feature = "std")]
221use std::{fmt, format, string::String, string::ToString};
222
223#[derive(Debug)]
225pub enum HutError {
226 UnknownUsagePage { usage_page: u16 },
230 UnknownUsageId { usage_id: u16 },
234 InvalidVendorPage { vendor_page: u16 },
236 InvalidReservedPage { reserved_page: u16 },
238 UnknownUsage,
242}
243
244impl core::error::Error for HutError {}
245
246impl core::fmt::Display for HutError {
247 fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
248 match self {
249 HutError::UnknownUsagePage { usage_page } => {
250 write!(fmt, "Unknown Usage Page {}", usage_page)
251 }
252 HutError::UnknownUsageId { usage_id } => write!(fmt, "Unknown Usage ID {}", usage_id),
253 HutError::InvalidVendorPage { vendor_page } => {
254 write!(fmt, "Invalid Vendor Page {}", vendor_page)
255 }
256 HutError::InvalidReservedPage { reserved_page } => {
257 write!(fmt, "Invalid Reserved Page {}", reserved_page)
258 }
259 HutError::UnknownUsage => write!(fmt, "Unknown Usage"),
260 }
261 }
262}
263
264type Result<T> = core::result::Result<T, HutError>;
265
266pub trait AsUsage {
268 fn usage_value(&self) -> u32;
270
271 fn usage_id_value(&self) -> u16;
273
274 fn usage(&self) -> Usage;
276}
277
278pub trait AsUsagePage {
280 fn usage_page_value(&self) -> u16;
282
283 fn usage_page(&self) -> UsagePage;
285}
286
287#[allow(non_camel_case_types)]
299#[derive(Debug)]
300#[non_exhaustive]
301pub enum UsagePage {
302 GenericDesktop,
305 SimulationControls,
308 VRControls,
311 SportControls,
314 GameControls,
317 GenericDeviceControls,
320 KeyboardKeypad,
323 LED,
326 Button,
329 Ordinal,
332 TelephonyDevice,
335 Consumer,
338 Digitizers,
341 Haptics,
344 PhysicalInputDevice,
347 Unicode,
350 SoC,
353 EyeandHeadTrackers,
356 AuxiliaryDisplay,
359 Sensors,
362 MedicalInstrument,
365 BrailleDisplay,
368 LightingAndIllumination,
371 Monitor,
374 MonitorEnumerated,
377 VESAVirtualControls,
380 Power,
383 BatterySystem,
386 BarcodeScanner,
389 Scales,
392 MagneticStripeReader,
395 CameraControl,
398 Arcade,
401 FIDOAlliance,
404 Wacom,
407 ReservedUsagePage(ReservedPage),
409 VendorDefinedPage(VendorPage),
411}
412
413#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
427pub struct ReservedPage(u16);
428
429impl From<&ReservedPage> for ReservedPage {
430 fn from(v: &ReservedPage) -> ReservedPage {
431 ReservedPage(v.0)
432 }
433}
434
435impl From<&ReservedPage> for u16 {
436 fn from(v: &ReservedPage) -> u16 {
437 v.0
438 }
439}
440
441impl From<ReservedPage> for u16 {
442 fn from(v: ReservedPage) -> u16 {
443 u16::from(&v)
444 }
445}
446
447impl From<&ReservedPage> for u32 {
448 fn from(v: &ReservedPage) -> u32 {
449 (v.0 as u32) << 16
450 }
451}
452
453impl From<ReservedPage> for u32 {
454 fn from(v: ReservedPage) -> u32 {
455 u32::from(&v)
456 }
457}
458
459impl TryFrom<u16> for ReservedPage {
460 type Error = HutError;
461
462 fn try_from(v: u16) -> Result<ReservedPage> {
463 match v {
464 p @ 0x13 => Ok(ReservedPage(p)),
465 p @ 0x15..=0x1F => Ok(ReservedPage(p)),
466 p @ 0x21..=0x3F => Ok(ReservedPage(p)),
467 p @ 0x42..=0x58 => Ok(ReservedPage(p)),
468 p @ 0x5A..=0x7F => Ok(ReservedPage(p)),
469 p @ 0x83..=0x83 => Ok(ReservedPage(p)),
470 p @ 0x86..=0x8B => Ok(ReservedPage(p)),
471 p @ 0x8F..=0x8F => Ok(ReservedPage(p)),
472 p @ 0x93..=0xF1CF => Ok(ReservedPage(p)),
473 p @ 0xF1D1..=0xFEFF => Ok(ReservedPage(p)),
474 n => Err(HutError::InvalidReservedPage { reserved_page: n }),
475 }
476 }
477}
478
479impl TryFrom<u32> for ReservedPage {
480 type Error = HutError;
481
482 fn try_from(v: u32) -> Result<ReservedPage> {
483 ReservedPage::try_from((v >> 16) as u16)
484 }
485}
486
487#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
501pub struct VendorPage(u16);
502
503impl From<&VendorPage> for VendorPage {
504 fn from(v: &VendorPage) -> VendorPage {
505 VendorPage(v.0)
506 }
507}
508
509impl From<&VendorPage> for u16 {
510 fn from(v: &VendorPage) -> u16 {
511 v.0
512 }
513}
514
515impl From<VendorPage> for u16 {
516 fn from(v: VendorPage) -> u16 {
517 u16::from(&v)
518 }
519}
520
521impl From<&VendorPage> for u32 {
522 fn from(v: &VendorPage) -> u32 {
523 (v.0 as u32) << 16
524 }
525}
526
527impl From<VendorPage> for u32 {
528 fn from(v: VendorPage) -> u32 {
529 u32::from(&v)
530 }
531}
532
533impl TryFrom<u16> for VendorPage {
534 type Error = HutError;
535
536 fn try_from(v: u16) -> Result<VendorPage> {
537 match v {
538 p @ 0xff00..=0xffff => Ok(VendorPage(p)),
539 n => Err(HutError::InvalidVendorPage { vendor_page: n }),
540 }
541 }
542}
543
544impl TryFrom<u32> for VendorPage {
545 type Error = HutError;
546
547 fn try_from(v: u32) -> Result<VendorPage> {
548 VendorPage::try_from((v >> 16) as u16)
549 }
550}
551
552impl UsagePage {
553 pub fn from_usage_page_value(usage_page: u16) -> Result<UsagePage> {
562 UsagePage::try_from(usage_page)
563 }
564
565 pub fn from_usage_value(usage: u32) -> Result<UsagePage> {
575 let up: u16 = (usage >> 16) as u16;
576 UsagePage::try_from(up)
577 }
578
579 pub fn to_usage_from_value(&self, usage: u16) -> Result<Usage> {
591 let up: u32 = (self.usage_page_value() as u32) << 16;
592 let u: u32 = usage as u32;
593 Usage::try_from(up | u)
594 }
595
596 #[cfg(feature = "std")]
603 pub fn name(&self) -> String {
604 match self {
605 UsagePage::GenericDesktop => "Generic Desktop".into(),
606 UsagePage::SimulationControls => "Simulation Controls".into(),
607 UsagePage::VRControls => "VR Controls".into(),
608 UsagePage::SportControls => "Sport Controls".into(),
609 UsagePage::GameControls => "Game Controls".into(),
610 UsagePage::GenericDeviceControls => "Generic Device Controls".into(),
611 UsagePage::KeyboardKeypad => "Keyboard/Keypad".into(),
612 UsagePage::LED => "LED".into(),
613 UsagePage::Button => "Button".into(),
614 UsagePage::Ordinal => "Ordinal".into(),
615 UsagePage::TelephonyDevice => "Telephony Device".into(),
616 UsagePage::Consumer => "Consumer".into(),
617 UsagePage::Digitizers => "Digitizers".into(),
618 UsagePage::Haptics => "Haptics".into(),
619 UsagePage::PhysicalInputDevice => "Physical Input Device".into(),
620 UsagePage::Unicode => "Unicode".into(),
621 UsagePage::SoC => "SoC".into(),
622 UsagePage::EyeandHeadTrackers => "Eye and Head Trackers".into(),
623 UsagePage::AuxiliaryDisplay => "Auxiliary Display".into(),
624 UsagePage::Sensors => "Sensors".into(),
625 UsagePage::MedicalInstrument => "Medical Instrument".into(),
626 UsagePage::BrailleDisplay => "Braille Display".into(),
627 UsagePage::LightingAndIllumination => "Lighting And Illumination".into(),
628 UsagePage::Monitor => "Monitor".into(),
629 UsagePage::MonitorEnumerated => "Monitor Enumerated".into(),
630 UsagePage::VESAVirtualControls => "VESA Virtual Controls".into(),
631 UsagePage::Power => "Power".into(),
632 UsagePage::BatterySystem => "Battery System".into(),
633 UsagePage::BarcodeScanner => "Barcode Scanner".into(),
634 UsagePage::Scales => "Scales".into(),
635 UsagePage::MagneticStripeReader => "Magnetic Stripe Reader".into(),
636 UsagePage::CameraControl => "Camera Control".into(),
637 UsagePage::Arcade => "Arcade".into(),
638 UsagePage::FIDOAlliance => "FIDO Alliance".into(),
639 UsagePage::Wacom => "Wacom".into(),
640 UsagePage::ReservedUsagePage(reserved_page) => {
641 format!("Reserved Usage Page {:04X}", u16::from(reserved_page))
642 }
643 UsagePage::VendorDefinedPage(vendor_page) => {
644 format!("Vendor Defined Page {:04X}", u16::from(vendor_page))
645 }
646 }
647 }
648}
649
650impl AsUsagePage for UsagePage {
651 fn usage_page_value(&self) -> u16 {
659 u16::from(self)
660 }
661
662 fn usage_page(&self) -> UsagePage {
672 UsagePage::try_from(u16::from(self)).unwrap()
673 }
674}
675
676#[allow(non_camel_case_types)]
697#[derive(Debug)]
698#[non_exhaustive]
699pub enum GenericDesktop {
700 Pointer,
702 Mouse,
704 Joystick,
706 Gamepad,
708 Keyboard,
710 Keypad,
712 MultiaxisController,
714 TabletPCSystemControls,
716 WaterCoolingDevice,
718 ComputerChassisDevice,
720 WirelessRadioControls,
722 PortableDeviceControl,
724 SystemMultiAxisController,
726 SpatialController,
728 AssistiveControl,
730 DeviceDock,
732 DockableDevice,
734 CallStateManagementControl,
736 X,
738 Y,
740 Z,
742 Rx,
744 Ry,
746 Rz,
748 Slider,
750 Dial,
752 Wheel,
754 HatSwitch,
756 CountedBuffer,
758 ByteCount,
760 MotionWakeup,
762 Start,
764 Select,
766 Vx,
768 Vy,
770 Vz,
772 Vbrx,
774 Vbry,
776 Vbrz,
778 Vno,
780 FeatureNotification,
782 ResolutionMultiplier,
784 Qx,
786 Qy,
788 Qz,
790 Qw,
792 SystemControl,
794 SystemPowerDown,
796 SystemSleep,
798 SystemWakeUp,
800 SystemContextMenu,
802 SystemMainMenu,
804 SystemAppMenu,
806 SystemMenuHelp,
808 SystemMenuExit,
810 SystemMenuSelect,
812 SystemMenuRight,
814 SystemMenuLeft,
816 SystemMenuUp,
818 SystemMenuDown,
820 SystemColdRestart,
822 SystemWarmRestart,
824 DpadUp,
826 DpadDown,
828 DpadRight,
830 DpadLeft,
832 IndexTrigger,
834 PalmTrigger,
836 Thumbstick,
838 SystemFunctionShift,
840 SystemFunctionShiftLock,
842 SystemFunctionShiftLockIndicator,
844 SystemDismissNotification,
846 SystemDoNotDisturb,
848 SystemDock,
850 SystemUndock,
852 SystemSetup,
854 SystemBreak,
856 SystemDebuggerBreak,
858 ApplicationBreak,
860 ApplicationDebuggerBreak,
862 SystemSpeakerMute,
864 SystemHibernate,
866 SystemMicrophoneMute,
868 SystemAccessibilityBinding,
870 SystemDisplayInvert,
872 SystemDisplayInternal,
874 SystemDisplayExternal,
876 SystemDisplayBoth,
878 SystemDisplayDual,
880 SystemDisplayToggleIntExtMode,
882 SystemDisplaySwapPrimarySecondary,
884 SystemDisplayToggleLCDAutoscale,
886 SensorZone,
888 RPM,
890 CoolantLevel,
892 CoolantCriticalLevel,
894 CoolantPump,
896 ChassisEnclosure,
898 WirelessRadioButton,
900 WirelessRadioLED,
902 WirelessRadioSliderSwitch,
904 SystemDisplayRotationLockButton,
906 SystemDisplayRotationLockSliderSwitch,
908 ControlEnable,
910 DockableDeviceUniqueID,
912 DockableDeviceVendorID,
914 DockableDevicePrimaryUsagePage,
916 DockableDevicePrimaryUsageID,
918 DockableDeviceDockingState,
920 DockableDeviceDisplayOcclusion,
922 DockableDeviceObjectType,
924 CallActiveLED,
926 CallMuteToggle,
928 CallMuteLED,
930}
931
932impl GenericDesktop {
933 #[cfg(feature = "std")]
934 pub fn name(&self) -> String {
935 match self {
936 GenericDesktop::Pointer => "Pointer",
937 GenericDesktop::Mouse => "Mouse",
938 GenericDesktop::Joystick => "Joystick",
939 GenericDesktop::Gamepad => "Gamepad",
940 GenericDesktop::Keyboard => "Keyboard",
941 GenericDesktop::Keypad => "Keypad",
942 GenericDesktop::MultiaxisController => "Multi-axis Controller",
943 GenericDesktop::TabletPCSystemControls => "Tablet PC System Controls",
944 GenericDesktop::WaterCoolingDevice => "Water Cooling Device",
945 GenericDesktop::ComputerChassisDevice => "Computer Chassis Device",
946 GenericDesktop::WirelessRadioControls => "Wireless Radio Controls",
947 GenericDesktop::PortableDeviceControl => "Portable Device Control",
948 GenericDesktop::SystemMultiAxisController => "System Multi-Axis Controller",
949 GenericDesktop::SpatialController => "Spatial Controller",
950 GenericDesktop::AssistiveControl => "Assistive Control",
951 GenericDesktop::DeviceDock => "Device Dock",
952 GenericDesktop::DockableDevice => "Dockable Device",
953 GenericDesktop::CallStateManagementControl => "Call State Management Control",
954 GenericDesktop::X => "X",
955 GenericDesktop::Y => "Y",
956 GenericDesktop::Z => "Z",
957 GenericDesktop::Rx => "Rx",
958 GenericDesktop::Ry => "Ry",
959 GenericDesktop::Rz => "Rz",
960 GenericDesktop::Slider => "Slider",
961 GenericDesktop::Dial => "Dial",
962 GenericDesktop::Wheel => "Wheel",
963 GenericDesktop::HatSwitch => "Hat Switch",
964 GenericDesktop::CountedBuffer => "Counted Buffer",
965 GenericDesktop::ByteCount => "Byte Count",
966 GenericDesktop::MotionWakeup => "Motion Wakeup",
967 GenericDesktop::Start => "Start",
968 GenericDesktop::Select => "Select",
969 GenericDesktop::Vx => "Vx",
970 GenericDesktop::Vy => "Vy",
971 GenericDesktop::Vz => "Vz",
972 GenericDesktop::Vbrx => "Vbrx",
973 GenericDesktop::Vbry => "Vbry",
974 GenericDesktop::Vbrz => "Vbrz",
975 GenericDesktop::Vno => "Vno",
976 GenericDesktop::FeatureNotification => "Feature Notification",
977 GenericDesktop::ResolutionMultiplier => "Resolution Multiplier",
978 GenericDesktop::Qx => "Qx",
979 GenericDesktop::Qy => "Qy",
980 GenericDesktop::Qz => "Qz",
981 GenericDesktop::Qw => "Qw",
982 GenericDesktop::SystemControl => "System Control",
983 GenericDesktop::SystemPowerDown => "System Power Down",
984 GenericDesktop::SystemSleep => "System Sleep",
985 GenericDesktop::SystemWakeUp => "System Wake Up",
986 GenericDesktop::SystemContextMenu => "System Context Menu",
987 GenericDesktop::SystemMainMenu => "System Main Menu",
988 GenericDesktop::SystemAppMenu => "System App Menu",
989 GenericDesktop::SystemMenuHelp => "System Menu Help",
990 GenericDesktop::SystemMenuExit => "System Menu Exit",
991 GenericDesktop::SystemMenuSelect => "System Menu Select",
992 GenericDesktop::SystemMenuRight => "System Menu Right",
993 GenericDesktop::SystemMenuLeft => "System Menu Left",
994 GenericDesktop::SystemMenuUp => "System Menu Up",
995 GenericDesktop::SystemMenuDown => "System Menu Down",
996 GenericDesktop::SystemColdRestart => "System Cold Restart",
997 GenericDesktop::SystemWarmRestart => "System Warm Restart",
998 GenericDesktop::DpadUp => "D-pad Up",
999 GenericDesktop::DpadDown => "D-pad Down",
1000 GenericDesktop::DpadRight => "D-pad Right",
1001 GenericDesktop::DpadLeft => "D-pad Left",
1002 GenericDesktop::IndexTrigger => "Index Trigger",
1003 GenericDesktop::PalmTrigger => "Palm Trigger",
1004 GenericDesktop::Thumbstick => "Thumbstick",
1005 GenericDesktop::SystemFunctionShift => "System Function Shift",
1006 GenericDesktop::SystemFunctionShiftLock => "System Function Shift Lock",
1007 GenericDesktop::SystemFunctionShiftLockIndicator => {
1008 "System Function Shift Lock Indicator"
1009 }
1010 GenericDesktop::SystemDismissNotification => "System Dismiss Notification",
1011 GenericDesktop::SystemDoNotDisturb => "System Do Not Disturb",
1012 GenericDesktop::SystemDock => "System Dock",
1013 GenericDesktop::SystemUndock => "System Undock",
1014 GenericDesktop::SystemSetup => "System Setup",
1015 GenericDesktop::SystemBreak => "System Break",
1016 GenericDesktop::SystemDebuggerBreak => "System Debugger Break",
1017 GenericDesktop::ApplicationBreak => "Application Break",
1018 GenericDesktop::ApplicationDebuggerBreak => "Application Debugger Break",
1019 GenericDesktop::SystemSpeakerMute => "System Speaker Mute",
1020 GenericDesktop::SystemHibernate => "System Hibernate",
1021 GenericDesktop::SystemMicrophoneMute => "System Microphone Mute",
1022 GenericDesktop::SystemAccessibilityBinding => "System Accessibility Binding",
1023 GenericDesktop::SystemDisplayInvert => "System Display Invert",
1024 GenericDesktop::SystemDisplayInternal => "System Display Internal",
1025 GenericDesktop::SystemDisplayExternal => "System Display External",
1026 GenericDesktop::SystemDisplayBoth => "System Display Both",
1027 GenericDesktop::SystemDisplayDual => "System Display Dual",
1028 GenericDesktop::SystemDisplayToggleIntExtMode => "System Display Toggle Int/Ext Mode",
1029 GenericDesktop::SystemDisplaySwapPrimarySecondary => {
1030 "System Display Swap Primary/Secondary"
1031 }
1032 GenericDesktop::SystemDisplayToggleLCDAutoscale => {
1033 "System Display Toggle LCD Autoscale"
1034 }
1035 GenericDesktop::SensorZone => "Sensor Zone",
1036 GenericDesktop::RPM => "RPM",
1037 GenericDesktop::CoolantLevel => "Coolant Level",
1038 GenericDesktop::CoolantCriticalLevel => "Coolant Critical Level",
1039 GenericDesktop::CoolantPump => "Coolant Pump",
1040 GenericDesktop::ChassisEnclosure => "Chassis Enclosure",
1041 GenericDesktop::WirelessRadioButton => "Wireless Radio Button",
1042 GenericDesktop::WirelessRadioLED => "Wireless Radio LED",
1043 GenericDesktop::WirelessRadioSliderSwitch => "Wireless Radio Slider Switch",
1044 GenericDesktop::SystemDisplayRotationLockButton => {
1045 "System Display Rotation Lock Button"
1046 }
1047 GenericDesktop::SystemDisplayRotationLockSliderSwitch => {
1048 "System Display Rotation Lock Slider Switch"
1049 }
1050 GenericDesktop::ControlEnable => "Control Enable",
1051 GenericDesktop::DockableDeviceUniqueID => "Dockable Device Unique ID",
1052 GenericDesktop::DockableDeviceVendorID => "Dockable Device Vendor ID",
1053 GenericDesktop::DockableDevicePrimaryUsagePage => "Dockable Device Primary Usage Page",
1054 GenericDesktop::DockableDevicePrimaryUsageID => "Dockable Device Primary Usage ID",
1055 GenericDesktop::DockableDeviceDockingState => "Dockable Device Docking State",
1056 GenericDesktop::DockableDeviceDisplayOcclusion => "Dockable Device Display Occlusion",
1057 GenericDesktop::DockableDeviceObjectType => "Dockable Device Object Type",
1058 GenericDesktop::CallActiveLED => "Call Active LED",
1059 GenericDesktop::CallMuteToggle => "Call Mute Toggle",
1060 GenericDesktop::CallMuteLED => "Call Mute LED",
1061 }
1062 .into()
1063 }
1064}
1065
1066#[cfg(feature = "std")]
1067impl fmt::Display for GenericDesktop {
1068 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1069 write!(f, "{}", self.name())
1070 }
1071}
1072
1073impl AsUsage for GenericDesktop {
1074 fn usage_value(&self) -> u32 {
1076 u32::from(self)
1077 }
1078
1079 fn usage_id_value(&self) -> u16 {
1081 u16::from(self)
1082 }
1083
1084 fn usage(&self) -> Usage {
1095 Usage::from(self)
1096 }
1097}
1098
1099impl AsUsagePage for GenericDesktop {
1100 fn usage_page_value(&self) -> u16 {
1104 let up = UsagePage::from(self);
1105 u16::from(up)
1106 }
1107
1108 fn usage_page(&self) -> UsagePage {
1110 UsagePage::from(self)
1111 }
1112}
1113
1114impl From<&GenericDesktop> for u16 {
1115 fn from(genericdesktop: &GenericDesktop) -> u16 {
1116 match *genericdesktop {
1117 GenericDesktop::Pointer => 1,
1118 GenericDesktop::Mouse => 2,
1119 GenericDesktop::Joystick => 4,
1120 GenericDesktop::Gamepad => 5,
1121 GenericDesktop::Keyboard => 6,
1122 GenericDesktop::Keypad => 7,
1123 GenericDesktop::MultiaxisController => 8,
1124 GenericDesktop::TabletPCSystemControls => 9,
1125 GenericDesktop::WaterCoolingDevice => 10,
1126 GenericDesktop::ComputerChassisDevice => 11,
1127 GenericDesktop::WirelessRadioControls => 12,
1128 GenericDesktop::PortableDeviceControl => 13,
1129 GenericDesktop::SystemMultiAxisController => 14,
1130 GenericDesktop::SpatialController => 15,
1131 GenericDesktop::AssistiveControl => 16,
1132 GenericDesktop::DeviceDock => 17,
1133 GenericDesktop::DockableDevice => 18,
1134 GenericDesktop::CallStateManagementControl => 19,
1135 GenericDesktop::X => 48,
1136 GenericDesktop::Y => 49,
1137 GenericDesktop::Z => 50,
1138 GenericDesktop::Rx => 51,
1139 GenericDesktop::Ry => 52,
1140 GenericDesktop::Rz => 53,
1141 GenericDesktop::Slider => 54,
1142 GenericDesktop::Dial => 55,
1143 GenericDesktop::Wheel => 56,
1144 GenericDesktop::HatSwitch => 57,
1145 GenericDesktop::CountedBuffer => 58,
1146 GenericDesktop::ByteCount => 59,
1147 GenericDesktop::MotionWakeup => 60,
1148 GenericDesktop::Start => 61,
1149 GenericDesktop::Select => 62,
1150 GenericDesktop::Vx => 64,
1151 GenericDesktop::Vy => 65,
1152 GenericDesktop::Vz => 66,
1153 GenericDesktop::Vbrx => 67,
1154 GenericDesktop::Vbry => 68,
1155 GenericDesktop::Vbrz => 69,
1156 GenericDesktop::Vno => 70,
1157 GenericDesktop::FeatureNotification => 71,
1158 GenericDesktop::ResolutionMultiplier => 72,
1159 GenericDesktop::Qx => 73,
1160 GenericDesktop::Qy => 74,
1161 GenericDesktop::Qz => 75,
1162 GenericDesktop::Qw => 76,
1163 GenericDesktop::SystemControl => 128,
1164 GenericDesktop::SystemPowerDown => 129,
1165 GenericDesktop::SystemSleep => 130,
1166 GenericDesktop::SystemWakeUp => 131,
1167 GenericDesktop::SystemContextMenu => 132,
1168 GenericDesktop::SystemMainMenu => 133,
1169 GenericDesktop::SystemAppMenu => 134,
1170 GenericDesktop::SystemMenuHelp => 135,
1171 GenericDesktop::SystemMenuExit => 136,
1172 GenericDesktop::SystemMenuSelect => 137,
1173 GenericDesktop::SystemMenuRight => 138,
1174 GenericDesktop::SystemMenuLeft => 139,
1175 GenericDesktop::SystemMenuUp => 140,
1176 GenericDesktop::SystemMenuDown => 141,
1177 GenericDesktop::SystemColdRestart => 142,
1178 GenericDesktop::SystemWarmRestart => 143,
1179 GenericDesktop::DpadUp => 144,
1180 GenericDesktop::DpadDown => 145,
1181 GenericDesktop::DpadRight => 146,
1182 GenericDesktop::DpadLeft => 147,
1183 GenericDesktop::IndexTrigger => 148,
1184 GenericDesktop::PalmTrigger => 149,
1185 GenericDesktop::Thumbstick => 150,
1186 GenericDesktop::SystemFunctionShift => 151,
1187 GenericDesktop::SystemFunctionShiftLock => 152,
1188 GenericDesktop::SystemFunctionShiftLockIndicator => 153,
1189 GenericDesktop::SystemDismissNotification => 154,
1190 GenericDesktop::SystemDoNotDisturb => 155,
1191 GenericDesktop::SystemDock => 160,
1192 GenericDesktop::SystemUndock => 161,
1193 GenericDesktop::SystemSetup => 162,
1194 GenericDesktop::SystemBreak => 163,
1195 GenericDesktop::SystemDebuggerBreak => 164,
1196 GenericDesktop::ApplicationBreak => 165,
1197 GenericDesktop::ApplicationDebuggerBreak => 166,
1198 GenericDesktop::SystemSpeakerMute => 167,
1199 GenericDesktop::SystemHibernate => 168,
1200 GenericDesktop::SystemMicrophoneMute => 169,
1201 GenericDesktop::SystemAccessibilityBinding => 170,
1202 GenericDesktop::SystemDisplayInvert => 176,
1203 GenericDesktop::SystemDisplayInternal => 177,
1204 GenericDesktop::SystemDisplayExternal => 178,
1205 GenericDesktop::SystemDisplayBoth => 179,
1206 GenericDesktop::SystemDisplayDual => 180,
1207 GenericDesktop::SystemDisplayToggleIntExtMode => 181,
1208 GenericDesktop::SystemDisplaySwapPrimarySecondary => 182,
1209 GenericDesktop::SystemDisplayToggleLCDAutoscale => 183,
1210 GenericDesktop::SensorZone => 192,
1211 GenericDesktop::RPM => 193,
1212 GenericDesktop::CoolantLevel => 194,
1213 GenericDesktop::CoolantCriticalLevel => 195,
1214 GenericDesktop::CoolantPump => 196,
1215 GenericDesktop::ChassisEnclosure => 197,
1216 GenericDesktop::WirelessRadioButton => 198,
1217 GenericDesktop::WirelessRadioLED => 199,
1218 GenericDesktop::WirelessRadioSliderSwitch => 200,
1219 GenericDesktop::SystemDisplayRotationLockButton => 201,
1220 GenericDesktop::SystemDisplayRotationLockSliderSwitch => 202,
1221 GenericDesktop::ControlEnable => 203,
1222 GenericDesktop::DockableDeviceUniqueID => 208,
1223 GenericDesktop::DockableDeviceVendorID => 209,
1224 GenericDesktop::DockableDevicePrimaryUsagePage => 210,
1225 GenericDesktop::DockableDevicePrimaryUsageID => 211,
1226 GenericDesktop::DockableDeviceDockingState => 212,
1227 GenericDesktop::DockableDeviceDisplayOcclusion => 213,
1228 GenericDesktop::DockableDeviceObjectType => 214,
1229 GenericDesktop::CallActiveLED => 224,
1230 GenericDesktop::CallMuteToggle => 225,
1231 GenericDesktop::CallMuteLED => 226,
1232 }
1233 }
1234}
1235
1236impl From<GenericDesktop> for u16 {
1237 fn from(genericdesktop: GenericDesktop) -> u16 {
1240 u16::from(&genericdesktop)
1241 }
1242}
1243
1244impl From<&GenericDesktop> for u32 {
1245 fn from(genericdesktop: &GenericDesktop) -> u32 {
1248 let up = UsagePage::from(genericdesktop);
1249 let up = (u16::from(&up) as u32) << 16;
1250 let id = u16::from(genericdesktop) as u32;
1251 up | id
1252 }
1253}
1254
1255impl From<&GenericDesktop> for UsagePage {
1256 fn from(_: &GenericDesktop) -> UsagePage {
1259 UsagePage::GenericDesktop
1260 }
1261}
1262
1263impl From<GenericDesktop> for UsagePage {
1264 fn from(_: GenericDesktop) -> UsagePage {
1267 UsagePage::GenericDesktop
1268 }
1269}
1270
1271impl From<&GenericDesktop> for Usage {
1272 fn from(genericdesktop: &GenericDesktop) -> Usage {
1273 Usage::try_from(u32::from(genericdesktop)).unwrap()
1274 }
1275}
1276
1277impl From<GenericDesktop> for Usage {
1278 fn from(genericdesktop: GenericDesktop) -> Usage {
1279 Usage::from(&genericdesktop)
1280 }
1281}
1282
1283impl TryFrom<u16> for GenericDesktop {
1284 type Error = HutError;
1285
1286 fn try_from(usage_id: u16) -> Result<GenericDesktop> {
1287 match usage_id {
1288 1 => Ok(GenericDesktop::Pointer),
1289 2 => Ok(GenericDesktop::Mouse),
1290 4 => Ok(GenericDesktop::Joystick),
1291 5 => Ok(GenericDesktop::Gamepad),
1292 6 => Ok(GenericDesktop::Keyboard),
1293 7 => Ok(GenericDesktop::Keypad),
1294 8 => Ok(GenericDesktop::MultiaxisController),
1295 9 => Ok(GenericDesktop::TabletPCSystemControls),
1296 10 => Ok(GenericDesktop::WaterCoolingDevice),
1297 11 => Ok(GenericDesktop::ComputerChassisDevice),
1298 12 => Ok(GenericDesktop::WirelessRadioControls),
1299 13 => Ok(GenericDesktop::PortableDeviceControl),
1300 14 => Ok(GenericDesktop::SystemMultiAxisController),
1301 15 => Ok(GenericDesktop::SpatialController),
1302 16 => Ok(GenericDesktop::AssistiveControl),
1303 17 => Ok(GenericDesktop::DeviceDock),
1304 18 => Ok(GenericDesktop::DockableDevice),
1305 19 => Ok(GenericDesktop::CallStateManagementControl),
1306 48 => Ok(GenericDesktop::X),
1307 49 => Ok(GenericDesktop::Y),
1308 50 => Ok(GenericDesktop::Z),
1309 51 => Ok(GenericDesktop::Rx),
1310 52 => Ok(GenericDesktop::Ry),
1311 53 => Ok(GenericDesktop::Rz),
1312 54 => Ok(GenericDesktop::Slider),
1313 55 => Ok(GenericDesktop::Dial),
1314 56 => Ok(GenericDesktop::Wheel),
1315 57 => Ok(GenericDesktop::HatSwitch),
1316 58 => Ok(GenericDesktop::CountedBuffer),
1317 59 => Ok(GenericDesktop::ByteCount),
1318 60 => Ok(GenericDesktop::MotionWakeup),
1319 61 => Ok(GenericDesktop::Start),
1320 62 => Ok(GenericDesktop::Select),
1321 64 => Ok(GenericDesktop::Vx),
1322 65 => Ok(GenericDesktop::Vy),
1323 66 => Ok(GenericDesktop::Vz),
1324 67 => Ok(GenericDesktop::Vbrx),
1325 68 => Ok(GenericDesktop::Vbry),
1326 69 => Ok(GenericDesktop::Vbrz),
1327 70 => Ok(GenericDesktop::Vno),
1328 71 => Ok(GenericDesktop::FeatureNotification),
1329 72 => Ok(GenericDesktop::ResolutionMultiplier),
1330 73 => Ok(GenericDesktop::Qx),
1331 74 => Ok(GenericDesktop::Qy),
1332 75 => Ok(GenericDesktop::Qz),
1333 76 => Ok(GenericDesktop::Qw),
1334 128 => Ok(GenericDesktop::SystemControl),
1335 129 => Ok(GenericDesktop::SystemPowerDown),
1336 130 => Ok(GenericDesktop::SystemSleep),
1337 131 => Ok(GenericDesktop::SystemWakeUp),
1338 132 => Ok(GenericDesktop::SystemContextMenu),
1339 133 => Ok(GenericDesktop::SystemMainMenu),
1340 134 => Ok(GenericDesktop::SystemAppMenu),
1341 135 => Ok(GenericDesktop::SystemMenuHelp),
1342 136 => Ok(GenericDesktop::SystemMenuExit),
1343 137 => Ok(GenericDesktop::SystemMenuSelect),
1344 138 => Ok(GenericDesktop::SystemMenuRight),
1345 139 => Ok(GenericDesktop::SystemMenuLeft),
1346 140 => Ok(GenericDesktop::SystemMenuUp),
1347 141 => Ok(GenericDesktop::SystemMenuDown),
1348 142 => Ok(GenericDesktop::SystemColdRestart),
1349 143 => Ok(GenericDesktop::SystemWarmRestart),
1350 144 => Ok(GenericDesktop::DpadUp),
1351 145 => Ok(GenericDesktop::DpadDown),
1352 146 => Ok(GenericDesktop::DpadRight),
1353 147 => Ok(GenericDesktop::DpadLeft),
1354 148 => Ok(GenericDesktop::IndexTrigger),
1355 149 => Ok(GenericDesktop::PalmTrigger),
1356 150 => Ok(GenericDesktop::Thumbstick),
1357 151 => Ok(GenericDesktop::SystemFunctionShift),
1358 152 => Ok(GenericDesktop::SystemFunctionShiftLock),
1359 153 => Ok(GenericDesktop::SystemFunctionShiftLockIndicator),
1360 154 => Ok(GenericDesktop::SystemDismissNotification),
1361 155 => Ok(GenericDesktop::SystemDoNotDisturb),
1362 160 => Ok(GenericDesktop::SystemDock),
1363 161 => Ok(GenericDesktop::SystemUndock),
1364 162 => Ok(GenericDesktop::SystemSetup),
1365 163 => Ok(GenericDesktop::SystemBreak),
1366 164 => Ok(GenericDesktop::SystemDebuggerBreak),
1367 165 => Ok(GenericDesktop::ApplicationBreak),
1368 166 => Ok(GenericDesktop::ApplicationDebuggerBreak),
1369 167 => Ok(GenericDesktop::SystemSpeakerMute),
1370 168 => Ok(GenericDesktop::SystemHibernate),
1371 169 => Ok(GenericDesktop::SystemMicrophoneMute),
1372 170 => Ok(GenericDesktop::SystemAccessibilityBinding),
1373 176 => Ok(GenericDesktop::SystemDisplayInvert),
1374 177 => Ok(GenericDesktop::SystemDisplayInternal),
1375 178 => Ok(GenericDesktop::SystemDisplayExternal),
1376 179 => Ok(GenericDesktop::SystemDisplayBoth),
1377 180 => Ok(GenericDesktop::SystemDisplayDual),
1378 181 => Ok(GenericDesktop::SystemDisplayToggleIntExtMode),
1379 182 => Ok(GenericDesktop::SystemDisplaySwapPrimarySecondary),
1380 183 => Ok(GenericDesktop::SystemDisplayToggleLCDAutoscale),
1381 192 => Ok(GenericDesktop::SensorZone),
1382 193 => Ok(GenericDesktop::RPM),
1383 194 => Ok(GenericDesktop::CoolantLevel),
1384 195 => Ok(GenericDesktop::CoolantCriticalLevel),
1385 196 => Ok(GenericDesktop::CoolantPump),
1386 197 => Ok(GenericDesktop::ChassisEnclosure),
1387 198 => Ok(GenericDesktop::WirelessRadioButton),
1388 199 => Ok(GenericDesktop::WirelessRadioLED),
1389 200 => Ok(GenericDesktop::WirelessRadioSliderSwitch),
1390 201 => Ok(GenericDesktop::SystemDisplayRotationLockButton),
1391 202 => Ok(GenericDesktop::SystemDisplayRotationLockSliderSwitch),
1392 203 => Ok(GenericDesktop::ControlEnable),
1393 208 => Ok(GenericDesktop::DockableDeviceUniqueID),
1394 209 => Ok(GenericDesktop::DockableDeviceVendorID),
1395 210 => Ok(GenericDesktop::DockableDevicePrimaryUsagePage),
1396 211 => Ok(GenericDesktop::DockableDevicePrimaryUsageID),
1397 212 => Ok(GenericDesktop::DockableDeviceDockingState),
1398 213 => Ok(GenericDesktop::DockableDeviceDisplayOcclusion),
1399 214 => Ok(GenericDesktop::DockableDeviceObjectType),
1400 224 => Ok(GenericDesktop::CallActiveLED),
1401 225 => Ok(GenericDesktop::CallMuteToggle),
1402 226 => Ok(GenericDesktop::CallMuteLED),
1403 n => Err(HutError::UnknownUsageId { usage_id: n }),
1404 }
1405 }
1406}
1407
1408impl BitOr<u16> for GenericDesktop {
1409 type Output = Usage;
1410
1411 fn bitor(self, usage: u16) -> Usage {
1418 let up = u16::from(self) as u32;
1419 let u = usage as u32;
1420 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
1421 }
1422}
1423
1424#[allow(non_camel_case_types)]
1445#[derive(Debug)]
1446#[non_exhaustive]
1447pub enum SimulationControls {
1448 FlightSimulationDevice,
1450 AutomobileSimulationDevice,
1452 TankSimulationDevice,
1454 SpaceshipSimulationDevice,
1456 SubmarineSimulationDevice,
1458 SailingSimulationDevice,
1460 MotorcycleSimulationDevice,
1462 SportsSimulationDevice,
1464 AirplaneSimulationDevice,
1466 HelicopterSimulationDevice,
1468 MagicCarpetSimulationDevice,
1470 BicycleSimulationDevice,
1472 FlightControlStick,
1474 FlightStick,
1476 CyclicControl,
1478 CyclicTrim,
1480 FlightYoke,
1482 TrackControl,
1484 Aileron,
1486 AileronTrim,
1488 AntiTorqueControl,
1490 AutopilotEnable,
1492 ChaffRelease,
1494 CollectiveControl,
1496 DiveBrake,
1498 ElectronicCountermeasures,
1500 Elevator,
1502 ElevatorTrim,
1504 Rudder,
1506 Throttle,
1508 FlightCommunications,
1510 FlareRelease,
1512 LandingGear,
1514 ToeBrake,
1516 Trigger,
1518 WeaponsArm,
1520 WeaponsSelect,
1522 WingFlaps,
1524 Accelerator,
1526 Brake,
1528 Clutch,
1530 Shifter,
1532 Steering,
1534 TurretDirection,
1536 BarrelElevation,
1538 DivePlane,
1540 Ballast,
1542 BicycleCrank,
1544 HandleBars,
1546 FrontBrake,
1548 RearBrake,
1550}
1551
1552impl SimulationControls {
1553 #[cfg(feature = "std")]
1554 pub fn name(&self) -> String {
1555 match self {
1556 SimulationControls::FlightSimulationDevice => "Flight Simulation Device",
1557 SimulationControls::AutomobileSimulationDevice => "Automobile Simulation Device",
1558 SimulationControls::TankSimulationDevice => "Tank Simulation Device",
1559 SimulationControls::SpaceshipSimulationDevice => "Spaceship Simulation Device",
1560 SimulationControls::SubmarineSimulationDevice => "Submarine Simulation Device",
1561 SimulationControls::SailingSimulationDevice => "Sailing Simulation Device",
1562 SimulationControls::MotorcycleSimulationDevice => "Motorcycle Simulation Device",
1563 SimulationControls::SportsSimulationDevice => "Sports Simulation Device",
1564 SimulationControls::AirplaneSimulationDevice => "Airplane Simulation Device",
1565 SimulationControls::HelicopterSimulationDevice => "Helicopter Simulation Device",
1566 SimulationControls::MagicCarpetSimulationDevice => "Magic Carpet Simulation Device",
1567 SimulationControls::BicycleSimulationDevice => "Bicycle Simulation Device",
1568 SimulationControls::FlightControlStick => "Flight Control Stick",
1569 SimulationControls::FlightStick => "Flight Stick",
1570 SimulationControls::CyclicControl => "Cyclic Control",
1571 SimulationControls::CyclicTrim => "Cyclic Trim",
1572 SimulationControls::FlightYoke => "Flight Yoke",
1573 SimulationControls::TrackControl => "Track Control",
1574 SimulationControls::Aileron => "Aileron",
1575 SimulationControls::AileronTrim => "Aileron Trim",
1576 SimulationControls::AntiTorqueControl => "Anti-Torque Control",
1577 SimulationControls::AutopilotEnable => "Autopilot Enable",
1578 SimulationControls::ChaffRelease => "Chaff Release",
1579 SimulationControls::CollectiveControl => "Collective Control",
1580 SimulationControls::DiveBrake => "Dive Brake",
1581 SimulationControls::ElectronicCountermeasures => "Electronic Countermeasures",
1582 SimulationControls::Elevator => "Elevator",
1583 SimulationControls::ElevatorTrim => "Elevator Trim",
1584 SimulationControls::Rudder => "Rudder",
1585 SimulationControls::Throttle => "Throttle",
1586 SimulationControls::FlightCommunications => "Flight Communications",
1587 SimulationControls::FlareRelease => "Flare Release",
1588 SimulationControls::LandingGear => "Landing Gear",
1589 SimulationControls::ToeBrake => "Toe Brake",
1590 SimulationControls::Trigger => "Trigger",
1591 SimulationControls::WeaponsArm => "Weapons Arm",
1592 SimulationControls::WeaponsSelect => "Weapons Select",
1593 SimulationControls::WingFlaps => "Wing Flaps",
1594 SimulationControls::Accelerator => "Accelerator",
1595 SimulationControls::Brake => "Brake",
1596 SimulationControls::Clutch => "Clutch",
1597 SimulationControls::Shifter => "Shifter",
1598 SimulationControls::Steering => "Steering",
1599 SimulationControls::TurretDirection => "Turret Direction",
1600 SimulationControls::BarrelElevation => "Barrel Elevation",
1601 SimulationControls::DivePlane => "Dive Plane",
1602 SimulationControls::Ballast => "Ballast",
1603 SimulationControls::BicycleCrank => "Bicycle Crank",
1604 SimulationControls::HandleBars => "Handle Bars",
1605 SimulationControls::FrontBrake => "Front Brake",
1606 SimulationControls::RearBrake => "Rear Brake",
1607 }
1608 .into()
1609 }
1610}
1611
1612#[cfg(feature = "std")]
1613impl fmt::Display for SimulationControls {
1614 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1615 write!(f, "{}", self.name())
1616 }
1617}
1618
1619impl AsUsage for SimulationControls {
1620 fn usage_value(&self) -> u32 {
1622 u32::from(self)
1623 }
1624
1625 fn usage_id_value(&self) -> u16 {
1627 u16::from(self)
1628 }
1629
1630 fn usage(&self) -> Usage {
1641 Usage::from(self)
1642 }
1643}
1644
1645impl AsUsagePage for SimulationControls {
1646 fn usage_page_value(&self) -> u16 {
1650 let up = UsagePage::from(self);
1651 u16::from(up)
1652 }
1653
1654 fn usage_page(&self) -> UsagePage {
1656 UsagePage::from(self)
1657 }
1658}
1659
1660impl From<&SimulationControls> for u16 {
1661 fn from(simulationcontrols: &SimulationControls) -> u16 {
1662 match *simulationcontrols {
1663 SimulationControls::FlightSimulationDevice => 1,
1664 SimulationControls::AutomobileSimulationDevice => 2,
1665 SimulationControls::TankSimulationDevice => 3,
1666 SimulationControls::SpaceshipSimulationDevice => 4,
1667 SimulationControls::SubmarineSimulationDevice => 5,
1668 SimulationControls::SailingSimulationDevice => 6,
1669 SimulationControls::MotorcycleSimulationDevice => 7,
1670 SimulationControls::SportsSimulationDevice => 8,
1671 SimulationControls::AirplaneSimulationDevice => 9,
1672 SimulationControls::HelicopterSimulationDevice => 10,
1673 SimulationControls::MagicCarpetSimulationDevice => 11,
1674 SimulationControls::BicycleSimulationDevice => 12,
1675 SimulationControls::FlightControlStick => 32,
1676 SimulationControls::FlightStick => 33,
1677 SimulationControls::CyclicControl => 34,
1678 SimulationControls::CyclicTrim => 35,
1679 SimulationControls::FlightYoke => 36,
1680 SimulationControls::TrackControl => 37,
1681 SimulationControls::Aileron => 176,
1682 SimulationControls::AileronTrim => 177,
1683 SimulationControls::AntiTorqueControl => 178,
1684 SimulationControls::AutopilotEnable => 179,
1685 SimulationControls::ChaffRelease => 180,
1686 SimulationControls::CollectiveControl => 181,
1687 SimulationControls::DiveBrake => 182,
1688 SimulationControls::ElectronicCountermeasures => 183,
1689 SimulationControls::Elevator => 184,
1690 SimulationControls::ElevatorTrim => 185,
1691 SimulationControls::Rudder => 186,
1692 SimulationControls::Throttle => 187,
1693 SimulationControls::FlightCommunications => 188,
1694 SimulationControls::FlareRelease => 189,
1695 SimulationControls::LandingGear => 190,
1696 SimulationControls::ToeBrake => 191,
1697 SimulationControls::Trigger => 192,
1698 SimulationControls::WeaponsArm => 193,
1699 SimulationControls::WeaponsSelect => 194,
1700 SimulationControls::WingFlaps => 195,
1701 SimulationControls::Accelerator => 196,
1702 SimulationControls::Brake => 197,
1703 SimulationControls::Clutch => 198,
1704 SimulationControls::Shifter => 199,
1705 SimulationControls::Steering => 200,
1706 SimulationControls::TurretDirection => 201,
1707 SimulationControls::BarrelElevation => 202,
1708 SimulationControls::DivePlane => 203,
1709 SimulationControls::Ballast => 204,
1710 SimulationControls::BicycleCrank => 205,
1711 SimulationControls::HandleBars => 206,
1712 SimulationControls::FrontBrake => 207,
1713 SimulationControls::RearBrake => 208,
1714 }
1715 }
1716}
1717
1718impl From<SimulationControls> for u16 {
1719 fn from(simulationcontrols: SimulationControls) -> u16 {
1722 u16::from(&simulationcontrols)
1723 }
1724}
1725
1726impl From<&SimulationControls> for u32 {
1727 fn from(simulationcontrols: &SimulationControls) -> u32 {
1730 let up = UsagePage::from(simulationcontrols);
1731 let up = (u16::from(&up) as u32) << 16;
1732 let id = u16::from(simulationcontrols) as u32;
1733 up | id
1734 }
1735}
1736
1737impl From<&SimulationControls> for UsagePage {
1738 fn from(_: &SimulationControls) -> UsagePage {
1741 UsagePage::SimulationControls
1742 }
1743}
1744
1745impl From<SimulationControls> for UsagePage {
1746 fn from(_: SimulationControls) -> UsagePage {
1749 UsagePage::SimulationControls
1750 }
1751}
1752
1753impl From<&SimulationControls> for Usage {
1754 fn from(simulationcontrols: &SimulationControls) -> Usage {
1755 Usage::try_from(u32::from(simulationcontrols)).unwrap()
1756 }
1757}
1758
1759impl From<SimulationControls> for Usage {
1760 fn from(simulationcontrols: SimulationControls) -> Usage {
1761 Usage::from(&simulationcontrols)
1762 }
1763}
1764
1765impl TryFrom<u16> for SimulationControls {
1766 type Error = HutError;
1767
1768 fn try_from(usage_id: u16) -> Result<SimulationControls> {
1769 match usage_id {
1770 1 => Ok(SimulationControls::FlightSimulationDevice),
1771 2 => Ok(SimulationControls::AutomobileSimulationDevice),
1772 3 => Ok(SimulationControls::TankSimulationDevice),
1773 4 => Ok(SimulationControls::SpaceshipSimulationDevice),
1774 5 => Ok(SimulationControls::SubmarineSimulationDevice),
1775 6 => Ok(SimulationControls::SailingSimulationDevice),
1776 7 => Ok(SimulationControls::MotorcycleSimulationDevice),
1777 8 => Ok(SimulationControls::SportsSimulationDevice),
1778 9 => Ok(SimulationControls::AirplaneSimulationDevice),
1779 10 => Ok(SimulationControls::HelicopterSimulationDevice),
1780 11 => Ok(SimulationControls::MagicCarpetSimulationDevice),
1781 12 => Ok(SimulationControls::BicycleSimulationDevice),
1782 32 => Ok(SimulationControls::FlightControlStick),
1783 33 => Ok(SimulationControls::FlightStick),
1784 34 => Ok(SimulationControls::CyclicControl),
1785 35 => Ok(SimulationControls::CyclicTrim),
1786 36 => Ok(SimulationControls::FlightYoke),
1787 37 => Ok(SimulationControls::TrackControl),
1788 176 => Ok(SimulationControls::Aileron),
1789 177 => Ok(SimulationControls::AileronTrim),
1790 178 => Ok(SimulationControls::AntiTorqueControl),
1791 179 => Ok(SimulationControls::AutopilotEnable),
1792 180 => Ok(SimulationControls::ChaffRelease),
1793 181 => Ok(SimulationControls::CollectiveControl),
1794 182 => Ok(SimulationControls::DiveBrake),
1795 183 => Ok(SimulationControls::ElectronicCountermeasures),
1796 184 => Ok(SimulationControls::Elevator),
1797 185 => Ok(SimulationControls::ElevatorTrim),
1798 186 => Ok(SimulationControls::Rudder),
1799 187 => Ok(SimulationControls::Throttle),
1800 188 => Ok(SimulationControls::FlightCommunications),
1801 189 => Ok(SimulationControls::FlareRelease),
1802 190 => Ok(SimulationControls::LandingGear),
1803 191 => Ok(SimulationControls::ToeBrake),
1804 192 => Ok(SimulationControls::Trigger),
1805 193 => Ok(SimulationControls::WeaponsArm),
1806 194 => Ok(SimulationControls::WeaponsSelect),
1807 195 => Ok(SimulationControls::WingFlaps),
1808 196 => Ok(SimulationControls::Accelerator),
1809 197 => Ok(SimulationControls::Brake),
1810 198 => Ok(SimulationControls::Clutch),
1811 199 => Ok(SimulationControls::Shifter),
1812 200 => Ok(SimulationControls::Steering),
1813 201 => Ok(SimulationControls::TurretDirection),
1814 202 => Ok(SimulationControls::BarrelElevation),
1815 203 => Ok(SimulationControls::DivePlane),
1816 204 => Ok(SimulationControls::Ballast),
1817 205 => Ok(SimulationControls::BicycleCrank),
1818 206 => Ok(SimulationControls::HandleBars),
1819 207 => Ok(SimulationControls::FrontBrake),
1820 208 => Ok(SimulationControls::RearBrake),
1821 n => Err(HutError::UnknownUsageId { usage_id: n }),
1822 }
1823 }
1824}
1825
1826impl BitOr<u16> for SimulationControls {
1827 type Output = Usage;
1828
1829 fn bitor(self, usage: u16) -> Usage {
1836 let up = u16::from(self) as u32;
1837 let u = usage as u32;
1838 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
1839 }
1840}
1841
1842#[allow(non_camel_case_types)]
1863#[derive(Debug)]
1864#[non_exhaustive]
1865pub enum VRControls {
1866 Belt,
1868 BodySuit,
1870 Flexor,
1872 Glove,
1874 HeadTracker,
1876 HeadMountedDisplay,
1878 HandTracker,
1880 Oculometer,
1882 Vest,
1884 AnimatronicDevice,
1886 StereoEnable,
1888 DisplayEnable,
1890}
1891
1892impl VRControls {
1893 #[cfg(feature = "std")]
1894 pub fn name(&self) -> String {
1895 match self {
1896 VRControls::Belt => "Belt",
1897 VRControls::BodySuit => "Body Suit",
1898 VRControls::Flexor => "Flexor",
1899 VRControls::Glove => "Glove",
1900 VRControls::HeadTracker => "Head Tracker",
1901 VRControls::HeadMountedDisplay => "Head Mounted Display",
1902 VRControls::HandTracker => "Hand Tracker",
1903 VRControls::Oculometer => "Oculometer",
1904 VRControls::Vest => "Vest",
1905 VRControls::AnimatronicDevice => "Animatronic Device",
1906 VRControls::StereoEnable => "Stereo Enable",
1907 VRControls::DisplayEnable => "Display Enable",
1908 }
1909 .into()
1910 }
1911}
1912
1913#[cfg(feature = "std")]
1914impl fmt::Display for VRControls {
1915 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1916 write!(f, "{}", self.name())
1917 }
1918}
1919
1920impl AsUsage for VRControls {
1921 fn usage_value(&self) -> u32 {
1923 u32::from(self)
1924 }
1925
1926 fn usage_id_value(&self) -> u16 {
1928 u16::from(self)
1929 }
1930
1931 fn usage(&self) -> Usage {
1942 Usage::from(self)
1943 }
1944}
1945
1946impl AsUsagePage for VRControls {
1947 fn usage_page_value(&self) -> u16 {
1951 let up = UsagePage::from(self);
1952 u16::from(up)
1953 }
1954
1955 fn usage_page(&self) -> UsagePage {
1957 UsagePage::from(self)
1958 }
1959}
1960
1961impl From<&VRControls> for u16 {
1962 fn from(vrcontrols: &VRControls) -> u16 {
1963 match *vrcontrols {
1964 VRControls::Belt => 1,
1965 VRControls::BodySuit => 2,
1966 VRControls::Flexor => 3,
1967 VRControls::Glove => 4,
1968 VRControls::HeadTracker => 5,
1969 VRControls::HeadMountedDisplay => 6,
1970 VRControls::HandTracker => 7,
1971 VRControls::Oculometer => 8,
1972 VRControls::Vest => 9,
1973 VRControls::AnimatronicDevice => 10,
1974 VRControls::StereoEnable => 32,
1975 VRControls::DisplayEnable => 33,
1976 }
1977 }
1978}
1979
1980impl From<VRControls> for u16 {
1981 fn from(vrcontrols: VRControls) -> u16 {
1984 u16::from(&vrcontrols)
1985 }
1986}
1987
1988impl From<&VRControls> for u32 {
1989 fn from(vrcontrols: &VRControls) -> u32 {
1992 let up = UsagePage::from(vrcontrols);
1993 let up = (u16::from(&up) as u32) << 16;
1994 let id = u16::from(vrcontrols) as u32;
1995 up | id
1996 }
1997}
1998
1999impl From<&VRControls> for UsagePage {
2000 fn from(_: &VRControls) -> UsagePage {
2003 UsagePage::VRControls
2004 }
2005}
2006
2007impl From<VRControls> for UsagePage {
2008 fn from(_: VRControls) -> UsagePage {
2011 UsagePage::VRControls
2012 }
2013}
2014
2015impl From<&VRControls> for Usage {
2016 fn from(vrcontrols: &VRControls) -> Usage {
2017 Usage::try_from(u32::from(vrcontrols)).unwrap()
2018 }
2019}
2020
2021impl From<VRControls> for Usage {
2022 fn from(vrcontrols: VRControls) -> Usage {
2023 Usage::from(&vrcontrols)
2024 }
2025}
2026
2027impl TryFrom<u16> for VRControls {
2028 type Error = HutError;
2029
2030 fn try_from(usage_id: u16) -> Result<VRControls> {
2031 match usage_id {
2032 1 => Ok(VRControls::Belt),
2033 2 => Ok(VRControls::BodySuit),
2034 3 => Ok(VRControls::Flexor),
2035 4 => Ok(VRControls::Glove),
2036 5 => Ok(VRControls::HeadTracker),
2037 6 => Ok(VRControls::HeadMountedDisplay),
2038 7 => Ok(VRControls::HandTracker),
2039 8 => Ok(VRControls::Oculometer),
2040 9 => Ok(VRControls::Vest),
2041 10 => Ok(VRControls::AnimatronicDevice),
2042 32 => Ok(VRControls::StereoEnable),
2043 33 => Ok(VRControls::DisplayEnable),
2044 n => Err(HutError::UnknownUsageId { usage_id: n }),
2045 }
2046 }
2047}
2048
2049impl BitOr<u16> for VRControls {
2050 type Output = Usage;
2051
2052 fn bitor(self, usage: u16) -> Usage {
2059 let up = u16::from(self) as u32;
2060 let u = usage as u32;
2061 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
2062 }
2063}
2064
2065#[allow(non_camel_case_types)]
2086#[derive(Debug)]
2087#[non_exhaustive]
2088pub enum SportControls {
2089 BaseballBat,
2091 GolfClub,
2093 RowingMachine,
2095 Treadmill,
2097 Oar,
2099 Slope,
2101 Rate,
2103 StickSpeed,
2105 StickFaceAngle,
2107 StickHeelToe,
2109 StickFollowThrough,
2111 StickTempo,
2113 StickType,
2115 StickHeight,
2117 Putter,
2119 OneIron,
2121 TwoIron,
2123 ThreeIron,
2125 FourIron,
2127 FiveIron,
2129 SixIron,
2131 SevenIron,
2133 EightIron,
2135 NineIron,
2137 One0Iron,
2139 One1Iron,
2141 SandWedge,
2143 LoftWedge,
2145 PowerWedge,
2147 OneWood,
2149 ThreeWood,
2151 FiveWood,
2153 SevenWood,
2155 NineWood,
2157}
2158
2159impl SportControls {
2160 #[cfg(feature = "std")]
2161 pub fn name(&self) -> String {
2162 match self {
2163 SportControls::BaseballBat => "Baseball Bat",
2164 SportControls::GolfClub => "Golf Club",
2165 SportControls::RowingMachine => "Rowing Machine",
2166 SportControls::Treadmill => "Treadmill",
2167 SportControls::Oar => "Oar",
2168 SportControls::Slope => "Slope",
2169 SportControls::Rate => "Rate",
2170 SportControls::StickSpeed => "Stick Speed",
2171 SportControls::StickFaceAngle => "Stick Face Angle",
2172 SportControls::StickHeelToe => "Stick Heel/Toe",
2173 SportControls::StickFollowThrough => "Stick Follow Through",
2174 SportControls::StickTempo => "Stick Tempo",
2175 SportControls::StickType => "Stick Type",
2176 SportControls::StickHeight => "Stick Height",
2177 SportControls::Putter => "Putter",
2178 SportControls::OneIron => "1 Iron",
2179 SportControls::TwoIron => "2 Iron",
2180 SportControls::ThreeIron => "3 Iron",
2181 SportControls::FourIron => "4 Iron",
2182 SportControls::FiveIron => "5 Iron",
2183 SportControls::SixIron => "6 Iron",
2184 SportControls::SevenIron => "7 Iron",
2185 SportControls::EightIron => "8 Iron",
2186 SportControls::NineIron => "9 Iron",
2187 SportControls::One0Iron => "10 Iron",
2188 SportControls::One1Iron => "11 Iron",
2189 SportControls::SandWedge => "Sand Wedge",
2190 SportControls::LoftWedge => "Loft Wedge",
2191 SportControls::PowerWedge => "Power Wedge",
2192 SportControls::OneWood => "1 Wood",
2193 SportControls::ThreeWood => "3 Wood",
2194 SportControls::FiveWood => "5 Wood",
2195 SportControls::SevenWood => "7 Wood",
2196 SportControls::NineWood => "9 Wood",
2197 }
2198 .into()
2199 }
2200}
2201
2202#[cfg(feature = "std")]
2203impl fmt::Display for SportControls {
2204 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2205 write!(f, "{}", self.name())
2206 }
2207}
2208
2209impl AsUsage for SportControls {
2210 fn usage_value(&self) -> u32 {
2212 u32::from(self)
2213 }
2214
2215 fn usage_id_value(&self) -> u16 {
2217 u16::from(self)
2218 }
2219
2220 fn usage(&self) -> Usage {
2231 Usage::from(self)
2232 }
2233}
2234
2235impl AsUsagePage for SportControls {
2236 fn usage_page_value(&self) -> u16 {
2240 let up = UsagePage::from(self);
2241 u16::from(up)
2242 }
2243
2244 fn usage_page(&self) -> UsagePage {
2246 UsagePage::from(self)
2247 }
2248}
2249
2250impl From<&SportControls> for u16 {
2251 fn from(sportcontrols: &SportControls) -> u16 {
2252 match *sportcontrols {
2253 SportControls::BaseballBat => 1,
2254 SportControls::GolfClub => 2,
2255 SportControls::RowingMachine => 3,
2256 SportControls::Treadmill => 4,
2257 SportControls::Oar => 48,
2258 SportControls::Slope => 49,
2259 SportControls::Rate => 50,
2260 SportControls::StickSpeed => 51,
2261 SportControls::StickFaceAngle => 52,
2262 SportControls::StickHeelToe => 53,
2263 SportControls::StickFollowThrough => 54,
2264 SportControls::StickTempo => 55,
2265 SportControls::StickType => 56,
2266 SportControls::StickHeight => 57,
2267 SportControls::Putter => 80,
2268 SportControls::OneIron => 81,
2269 SportControls::TwoIron => 82,
2270 SportControls::ThreeIron => 83,
2271 SportControls::FourIron => 84,
2272 SportControls::FiveIron => 85,
2273 SportControls::SixIron => 86,
2274 SportControls::SevenIron => 87,
2275 SportControls::EightIron => 88,
2276 SportControls::NineIron => 89,
2277 SportControls::One0Iron => 90,
2278 SportControls::One1Iron => 91,
2279 SportControls::SandWedge => 92,
2280 SportControls::LoftWedge => 93,
2281 SportControls::PowerWedge => 94,
2282 SportControls::OneWood => 95,
2283 SportControls::ThreeWood => 96,
2284 SportControls::FiveWood => 97,
2285 SportControls::SevenWood => 98,
2286 SportControls::NineWood => 99,
2287 }
2288 }
2289}
2290
2291impl From<SportControls> for u16 {
2292 fn from(sportcontrols: SportControls) -> u16 {
2295 u16::from(&sportcontrols)
2296 }
2297}
2298
2299impl From<&SportControls> for u32 {
2300 fn from(sportcontrols: &SportControls) -> u32 {
2303 let up = UsagePage::from(sportcontrols);
2304 let up = (u16::from(&up) as u32) << 16;
2305 let id = u16::from(sportcontrols) as u32;
2306 up | id
2307 }
2308}
2309
2310impl From<&SportControls> for UsagePage {
2311 fn from(_: &SportControls) -> UsagePage {
2314 UsagePage::SportControls
2315 }
2316}
2317
2318impl From<SportControls> for UsagePage {
2319 fn from(_: SportControls) -> UsagePage {
2322 UsagePage::SportControls
2323 }
2324}
2325
2326impl From<&SportControls> for Usage {
2327 fn from(sportcontrols: &SportControls) -> Usage {
2328 Usage::try_from(u32::from(sportcontrols)).unwrap()
2329 }
2330}
2331
2332impl From<SportControls> for Usage {
2333 fn from(sportcontrols: SportControls) -> Usage {
2334 Usage::from(&sportcontrols)
2335 }
2336}
2337
2338impl TryFrom<u16> for SportControls {
2339 type Error = HutError;
2340
2341 fn try_from(usage_id: u16) -> Result<SportControls> {
2342 match usage_id {
2343 1 => Ok(SportControls::BaseballBat),
2344 2 => Ok(SportControls::GolfClub),
2345 3 => Ok(SportControls::RowingMachine),
2346 4 => Ok(SportControls::Treadmill),
2347 48 => Ok(SportControls::Oar),
2348 49 => Ok(SportControls::Slope),
2349 50 => Ok(SportControls::Rate),
2350 51 => Ok(SportControls::StickSpeed),
2351 52 => Ok(SportControls::StickFaceAngle),
2352 53 => Ok(SportControls::StickHeelToe),
2353 54 => Ok(SportControls::StickFollowThrough),
2354 55 => Ok(SportControls::StickTempo),
2355 56 => Ok(SportControls::StickType),
2356 57 => Ok(SportControls::StickHeight),
2357 80 => Ok(SportControls::Putter),
2358 81 => Ok(SportControls::OneIron),
2359 82 => Ok(SportControls::TwoIron),
2360 83 => Ok(SportControls::ThreeIron),
2361 84 => Ok(SportControls::FourIron),
2362 85 => Ok(SportControls::FiveIron),
2363 86 => Ok(SportControls::SixIron),
2364 87 => Ok(SportControls::SevenIron),
2365 88 => Ok(SportControls::EightIron),
2366 89 => Ok(SportControls::NineIron),
2367 90 => Ok(SportControls::One0Iron),
2368 91 => Ok(SportControls::One1Iron),
2369 92 => Ok(SportControls::SandWedge),
2370 93 => Ok(SportControls::LoftWedge),
2371 94 => Ok(SportControls::PowerWedge),
2372 95 => Ok(SportControls::OneWood),
2373 96 => Ok(SportControls::ThreeWood),
2374 97 => Ok(SportControls::FiveWood),
2375 98 => Ok(SportControls::SevenWood),
2376 99 => Ok(SportControls::NineWood),
2377 n => Err(HutError::UnknownUsageId { usage_id: n }),
2378 }
2379 }
2380}
2381
2382impl BitOr<u16> for SportControls {
2383 type Output = Usage;
2384
2385 fn bitor(self, usage: u16) -> Usage {
2392 let up = u16::from(self) as u32;
2393 let u = usage as u32;
2394 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
2395 }
2396}
2397
2398#[allow(non_camel_case_types)]
2419#[derive(Debug)]
2420#[non_exhaustive]
2421pub enum GameControls {
2422 ThreeDGameController,
2424 PinballDevice,
2426 GunDevice,
2428 PointofView,
2430 TurnRightLeft,
2432 PitchForwardBackward,
2434 RollRightLeft,
2436 MoveRightLeft,
2438 MoveForwardBackward,
2440 MoveUpDown,
2442 LeanRightLeft,
2444 LeanForwardBackward,
2446 HeightofPOV,
2448 Flipper,
2450 SecondaryFlipper,
2452 Bump,
2454 NewGame,
2456 ShootBall,
2458 Player,
2460 GunBolt,
2462 GunClip,
2464 GunSelector,
2466 GunSingleShot,
2468 GunBurst,
2470 GunAutomatic,
2472 GunSafety,
2474 GamepadFireJump,
2476 GamepadTrigger,
2478 FormfittingGamepad,
2480}
2481
2482impl GameControls {
2483 #[cfg(feature = "std")]
2484 pub fn name(&self) -> String {
2485 match self {
2486 GameControls::ThreeDGameController => "3D Game Controller",
2487 GameControls::PinballDevice => "Pinball Device",
2488 GameControls::GunDevice => "Gun Device",
2489 GameControls::PointofView => "Point of View",
2490 GameControls::TurnRightLeft => "Turn Right/Left",
2491 GameControls::PitchForwardBackward => "Pitch Forward/Backward",
2492 GameControls::RollRightLeft => "Roll Right/Left",
2493 GameControls::MoveRightLeft => "Move Right/Left",
2494 GameControls::MoveForwardBackward => "Move Forward/Backward",
2495 GameControls::MoveUpDown => "Move Up/Down",
2496 GameControls::LeanRightLeft => "Lean Right/Left",
2497 GameControls::LeanForwardBackward => "Lean Forward/Backward",
2498 GameControls::HeightofPOV => "Height of POV",
2499 GameControls::Flipper => "Flipper",
2500 GameControls::SecondaryFlipper => "Secondary Flipper",
2501 GameControls::Bump => "Bump",
2502 GameControls::NewGame => "New Game",
2503 GameControls::ShootBall => "Shoot Ball",
2504 GameControls::Player => "Player",
2505 GameControls::GunBolt => "Gun Bolt",
2506 GameControls::GunClip => "Gun Clip",
2507 GameControls::GunSelector => "Gun Selector",
2508 GameControls::GunSingleShot => "Gun Single Shot",
2509 GameControls::GunBurst => "Gun Burst",
2510 GameControls::GunAutomatic => "Gun Automatic",
2511 GameControls::GunSafety => "Gun Safety",
2512 GameControls::GamepadFireJump => "Gamepad Fire/Jump",
2513 GameControls::GamepadTrigger => "Gamepad Trigger",
2514 GameControls::FormfittingGamepad => "Form-fitting Gamepad",
2515 }
2516 .into()
2517 }
2518}
2519
2520#[cfg(feature = "std")]
2521impl fmt::Display for GameControls {
2522 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2523 write!(f, "{}", self.name())
2524 }
2525}
2526
2527impl AsUsage for GameControls {
2528 fn usage_value(&self) -> u32 {
2530 u32::from(self)
2531 }
2532
2533 fn usage_id_value(&self) -> u16 {
2535 u16::from(self)
2536 }
2537
2538 fn usage(&self) -> Usage {
2549 Usage::from(self)
2550 }
2551}
2552
2553impl AsUsagePage for GameControls {
2554 fn usage_page_value(&self) -> u16 {
2558 let up = UsagePage::from(self);
2559 u16::from(up)
2560 }
2561
2562 fn usage_page(&self) -> UsagePage {
2564 UsagePage::from(self)
2565 }
2566}
2567
2568impl From<&GameControls> for u16 {
2569 fn from(gamecontrols: &GameControls) -> u16 {
2570 match *gamecontrols {
2571 GameControls::ThreeDGameController => 1,
2572 GameControls::PinballDevice => 2,
2573 GameControls::GunDevice => 3,
2574 GameControls::PointofView => 32,
2575 GameControls::TurnRightLeft => 33,
2576 GameControls::PitchForwardBackward => 34,
2577 GameControls::RollRightLeft => 35,
2578 GameControls::MoveRightLeft => 36,
2579 GameControls::MoveForwardBackward => 37,
2580 GameControls::MoveUpDown => 38,
2581 GameControls::LeanRightLeft => 39,
2582 GameControls::LeanForwardBackward => 40,
2583 GameControls::HeightofPOV => 41,
2584 GameControls::Flipper => 42,
2585 GameControls::SecondaryFlipper => 43,
2586 GameControls::Bump => 44,
2587 GameControls::NewGame => 45,
2588 GameControls::ShootBall => 46,
2589 GameControls::Player => 47,
2590 GameControls::GunBolt => 48,
2591 GameControls::GunClip => 49,
2592 GameControls::GunSelector => 50,
2593 GameControls::GunSingleShot => 51,
2594 GameControls::GunBurst => 52,
2595 GameControls::GunAutomatic => 53,
2596 GameControls::GunSafety => 54,
2597 GameControls::GamepadFireJump => 55,
2598 GameControls::GamepadTrigger => 57,
2599 GameControls::FormfittingGamepad => 58,
2600 }
2601 }
2602}
2603
2604impl From<GameControls> for u16 {
2605 fn from(gamecontrols: GameControls) -> u16 {
2608 u16::from(&gamecontrols)
2609 }
2610}
2611
2612impl From<&GameControls> for u32 {
2613 fn from(gamecontrols: &GameControls) -> u32 {
2616 let up = UsagePage::from(gamecontrols);
2617 let up = (u16::from(&up) as u32) << 16;
2618 let id = u16::from(gamecontrols) as u32;
2619 up | id
2620 }
2621}
2622
2623impl From<&GameControls> for UsagePage {
2624 fn from(_: &GameControls) -> UsagePage {
2627 UsagePage::GameControls
2628 }
2629}
2630
2631impl From<GameControls> for UsagePage {
2632 fn from(_: GameControls) -> UsagePage {
2635 UsagePage::GameControls
2636 }
2637}
2638
2639impl From<&GameControls> for Usage {
2640 fn from(gamecontrols: &GameControls) -> Usage {
2641 Usage::try_from(u32::from(gamecontrols)).unwrap()
2642 }
2643}
2644
2645impl From<GameControls> for Usage {
2646 fn from(gamecontrols: GameControls) -> Usage {
2647 Usage::from(&gamecontrols)
2648 }
2649}
2650
2651impl TryFrom<u16> for GameControls {
2652 type Error = HutError;
2653
2654 fn try_from(usage_id: u16) -> Result<GameControls> {
2655 match usage_id {
2656 1 => Ok(GameControls::ThreeDGameController),
2657 2 => Ok(GameControls::PinballDevice),
2658 3 => Ok(GameControls::GunDevice),
2659 32 => Ok(GameControls::PointofView),
2660 33 => Ok(GameControls::TurnRightLeft),
2661 34 => Ok(GameControls::PitchForwardBackward),
2662 35 => Ok(GameControls::RollRightLeft),
2663 36 => Ok(GameControls::MoveRightLeft),
2664 37 => Ok(GameControls::MoveForwardBackward),
2665 38 => Ok(GameControls::MoveUpDown),
2666 39 => Ok(GameControls::LeanRightLeft),
2667 40 => Ok(GameControls::LeanForwardBackward),
2668 41 => Ok(GameControls::HeightofPOV),
2669 42 => Ok(GameControls::Flipper),
2670 43 => Ok(GameControls::SecondaryFlipper),
2671 44 => Ok(GameControls::Bump),
2672 45 => Ok(GameControls::NewGame),
2673 46 => Ok(GameControls::ShootBall),
2674 47 => Ok(GameControls::Player),
2675 48 => Ok(GameControls::GunBolt),
2676 49 => Ok(GameControls::GunClip),
2677 50 => Ok(GameControls::GunSelector),
2678 51 => Ok(GameControls::GunSingleShot),
2679 52 => Ok(GameControls::GunBurst),
2680 53 => Ok(GameControls::GunAutomatic),
2681 54 => Ok(GameControls::GunSafety),
2682 55 => Ok(GameControls::GamepadFireJump),
2683 57 => Ok(GameControls::GamepadTrigger),
2684 58 => Ok(GameControls::FormfittingGamepad),
2685 n => Err(HutError::UnknownUsageId { usage_id: n }),
2686 }
2687 }
2688}
2689
2690impl BitOr<u16> for GameControls {
2691 type Output = Usage;
2692
2693 fn bitor(self, usage: u16) -> Usage {
2700 let up = u16::from(self) as u32;
2701 let u = usage as u32;
2702 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
2703 }
2704}
2705
2706#[allow(non_camel_case_types)]
2727#[derive(Debug)]
2728#[non_exhaustive]
2729pub enum GenericDeviceControls {
2730 BackgroundNonuserControls,
2732 BatteryStrength,
2734 WirelessChannel,
2736 WirelessID,
2738 DiscoverWirelessControl,
2740 SecurityCodeCharacterEntered,
2742 SecurityCodeCharacterErased,
2744 SecurityCodeCleared,
2746 SequenceID,
2748 SequenceIDReset,
2750 RFSignalStrength,
2752 SoftwareVersion,
2754 ProtocolVersion,
2756 HardwareVersion,
2758 Major,
2760 Minor,
2762 Revision,
2764 Handedness,
2766 EitherHand,
2768 LeftHand,
2770 RightHand,
2772 BothHands,
2774 GripPoseOffset,
2776 PointerPoseOffset,
2778}
2779
2780impl GenericDeviceControls {
2781 #[cfg(feature = "std")]
2782 pub fn name(&self) -> String {
2783 match self {
2784 GenericDeviceControls::BackgroundNonuserControls => "Background/Nonuser Controls",
2785 GenericDeviceControls::BatteryStrength => "Battery Strength",
2786 GenericDeviceControls::WirelessChannel => "Wireless Channel",
2787 GenericDeviceControls::WirelessID => "Wireless ID",
2788 GenericDeviceControls::DiscoverWirelessControl => "Discover Wireless Control",
2789 GenericDeviceControls::SecurityCodeCharacterEntered => {
2790 "Security Code Character Entered"
2791 }
2792 GenericDeviceControls::SecurityCodeCharacterErased => "Security Code Character Erased",
2793 GenericDeviceControls::SecurityCodeCleared => "Security Code Cleared",
2794 GenericDeviceControls::SequenceID => "Sequence ID",
2795 GenericDeviceControls::SequenceIDReset => "Sequence ID Reset",
2796 GenericDeviceControls::RFSignalStrength => "RF Signal Strength",
2797 GenericDeviceControls::SoftwareVersion => "Software Version",
2798 GenericDeviceControls::ProtocolVersion => "Protocol Version",
2799 GenericDeviceControls::HardwareVersion => "Hardware Version",
2800 GenericDeviceControls::Major => "Major",
2801 GenericDeviceControls::Minor => "Minor",
2802 GenericDeviceControls::Revision => "Revision",
2803 GenericDeviceControls::Handedness => "Handedness",
2804 GenericDeviceControls::EitherHand => "Either Hand",
2805 GenericDeviceControls::LeftHand => "Left Hand",
2806 GenericDeviceControls::RightHand => "Right Hand",
2807 GenericDeviceControls::BothHands => "Both Hands",
2808 GenericDeviceControls::GripPoseOffset => "Grip Pose Offset",
2809 GenericDeviceControls::PointerPoseOffset => "Pointer Pose Offset",
2810 }
2811 .into()
2812 }
2813}
2814
2815#[cfg(feature = "std")]
2816impl fmt::Display for GenericDeviceControls {
2817 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2818 write!(f, "{}", self.name())
2819 }
2820}
2821
2822impl AsUsage for GenericDeviceControls {
2823 fn usage_value(&self) -> u32 {
2825 u32::from(self)
2826 }
2827
2828 fn usage_id_value(&self) -> u16 {
2830 u16::from(self)
2831 }
2832
2833 fn usage(&self) -> Usage {
2844 Usage::from(self)
2845 }
2846}
2847
2848impl AsUsagePage for GenericDeviceControls {
2849 fn usage_page_value(&self) -> u16 {
2853 let up = UsagePage::from(self);
2854 u16::from(up)
2855 }
2856
2857 fn usage_page(&self) -> UsagePage {
2859 UsagePage::from(self)
2860 }
2861}
2862
2863impl From<&GenericDeviceControls> for u16 {
2864 fn from(genericdevicecontrols: &GenericDeviceControls) -> u16 {
2865 match *genericdevicecontrols {
2866 GenericDeviceControls::BackgroundNonuserControls => 1,
2867 GenericDeviceControls::BatteryStrength => 32,
2868 GenericDeviceControls::WirelessChannel => 33,
2869 GenericDeviceControls::WirelessID => 34,
2870 GenericDeviceControls::DiscoverWirelessControl => 35,
2871 GenericDeviceControls::SecurityCodeCharacterEntered => 36,
2872 GenericDeviceControls::SecurityCodeCharacterErased => 37,
2873 GenericDeviceControls::SecurityCodeCleared => 38,
2874 GenericDeviceControls::SequenceID => 39,
2875 GenericDeviceControls::SequenceIDReset => 40,
2876 GenericDeviceControls::RFSignalStrength => 41,
2877 GenericDeviceControls::SoftwareVersion => 42,
2878 GenericDeviceControls::ProtocolVersion => 43,
2879 GenericDeviceControls::HardwareVersion => 44,
2880 GenericDeviceControls::Major => 45,
2881 GenericDeviceControls::Minor => 46,
2882 GenericDeviceControls::Revision => 47,
2883 GenericDeviceControls::Handedness => 48,
2884 GenericDeviceControls::EitherHand => 49,
2885 GenericDeviceControls::LeftHand => 50,
2886 GenericDeviceControls::RightHand => 51,
2887 GenericDeviceControls::BothHands => 52,
2888 GenericDeviceControls::GripPoseOffset => 64,
2889 GenericDeviceControls::PointerPoseOffset => 65,
2890 }
2891 }
2892}
2893
2894impl From<GenericDeviceControls> for u16 {
2895 fn from(genericdevicecontrols: GenericDeviceControls) -> u16 {
2898 u16::from(&genericdevicecontrols)
2899 }
2900}
2901
2902impl From<&GenericDeviceControls> for u32 {
2903 fn from(genericdevicecontrols: &GenericDeviceControls) -> u32 {
2906 let up = UsagePage::from(genericdevicecontrols);
2907 let up = (u16::from(&up) as u32) << 16;
2908 let id = u16::from(genericdevicecontrols) as u32;
2909 up | id
2910 }
2911}
2912
2913impl From<&GenericDeviceControls> for UsagePage {
2914 fn from(_: &GenericDeviceControls) -> UsagePage {
2917 UsagePage::GenericDeviceControls
2918 }
2919}
2920
2921impl From<GenericDeviceControls> for UsagePage {
2922 fn from(_: GenericDeviceControls) -> UsagePage {
2925 UsagePage::GenericDeviceControls
2926 }
2927}
2928
2929impl From<&GenericDeviceControls> for Usage {
2930 fn from(genericdevicecontrols: &GenericDeviceControls) -> Usage {
2931 Usage::try_from(u32::from(genericdevicecontrols)).unwrap()
2932 }
2933}
2934
2935impl From<GenericDeviceControls> for Usage {
2936 fn from(genericdevicecontrols: GenericDeviceControls) -> Usage {
2937 Usage::from(&genericdevicecontrols)
2938 }
2939}
2940
2941impl TryFrom<u16> for GenericDeviceControls {
2942 type Error = HutError;
2943
2944 fn try_from(usage_id: u16) -> Result<GenericDeviceControls> {
2945 match usage_id {
2946 1 => Ok(GenericDeviceControls::BackgroundNonuserControls),
2947 32 => Ok(GenericDeviceControls::BatteryStrength),
2948 33 => Ok(GenericDeviceControls::WirelessChannel),
2949 34 => Ok(GenericDeviceControls::WirelessID),
2950 35 => Ok(GenericDeviceControls::DiscoverWirelessControl),
2951 36 => Ok(GenericDeviceControls::SecurityCodeCharacterEntered),
2952 37 => Ok(GenericDeviceControls::SecurityCodeCharacterErased),
2953 38 => Ok(GenericDeviceControls::SecurityCodeCleared),
2954 39 => Ok(GenericDeviceControls::SequenceID),
2955 40 => Ok(GenericDeviceControls::SequenceIDReset),
2956 41 => Ok(GenericDeviceControls::RFSignalStrength),
2957 42 => Ok(GenericDeviceControls::SoftwareVersion),
2958 43 => Ok(GenericDeviceControls::ProtocolVersion),
2959 44 => Ok(GenericDeviceControls::HardwareVersion),
2960 45 => Ok(GenericDeviceControls::Major),
2961 46 => Ok(GenericDeviceControls::Minor),
2962 47 => Ok(GenericDeviceControls::Revision),
2963 48 => Ok(GenericDeviceControls::Handedness),
2964 49 => Ok(GenericDeviceControls::EitherHand),
2965 50 => Ok(GenericDeviceControls::LeftHand),
2966 51 => Ok(GenericDeviceControls::RightHand),
2967 52 => Ok(GenericDeviceControls::BothHands),
2968 64 => Ok(GenericDeviceControls::GripPoseOffset),
2969 65 => Ok(GenericDeviceControls::PointerPoseOffset),
2970 n => Err(HutError::UnknownUsageId { usage_id: n }),
2971 }
2972 }
2973}
2974
2975impl BitOr<u16> for GenericDeviceControls {
2976 type Output = Usage;
2977
2978 fn bitor(self, usage: u16) -> Usage {
2985 let up = u16::from(self) as u32;
2986 let u = usage as u32;
2987 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
2988 }
2989}
2990
2991#[allow(non_camel_case_types)]
3012#[derive(Debug)]
3013#[non_exhaustive]
3014pub enum KeyboardKeypad {
3015 ErrorRollOver,
3017 POSTFail,
3019 ErrorUndefined,
3021 KeyboardA,
3023 KeyboardB,
3025 KeyboardC,
3027 KeyboardD,
3029 KeyboardE,
3031 KeyboardF,
3033 KeyboardG,
3035 KeyboardH,
3037 KeyboardI,
3039 KeyboardJ,
3041 KeyboardK,
3043 KeyboardL,
3045 KeyboardM,
3047 KeyboardN,
3049 KeyboardO,
3051 KeyboardP,
3053 KeyboardQ,
3055 KeyboardR,
3057 KeyboardS,
3059 KeyboardT,
3061 KeyboardU,
3063 KeyboardV,
3065 KeyboardW,
3067 KeyboardX,
3069 KeyboardY,
3071 KeyboardZ,
3073 Keyboard1andBang,
3075 Keyboard2andAt,
3077 Keyboard3andHash,
3079 Keyboard4andDollar,
3081 Keyboard5andPercent,
3083 Keyboard6andCaret,
3085 Keyboard7andAmpersand,
3087 Keyboard8andStar,
3089 Keyboard9andLeftBracket,
3091 Keyboard0andRightBracket,
3093 KeyboardReturnEnter,
3095 KeyboardEscape,
3097 KeyboardDelete,
3099 KeyboardTab,
3101 KeyboardSpacebar,
3103 KeyboardDashandUnderscore,
3105 KeyboardEqualsandPlus,
3107 KeyboardLeftBrace,
3109 KeyboardRightBrace,
3111 KeyboardBackslashandPipe,
3113 KeyboardNonUSHashandTilde,
3115 KeyboardSemiColonandColon,
3117 KeyboardLeftAposandDouble,
3119 KeyboardGraveAccentandTilde,
3121 KeyboardCommaandLessThan,
3123 KeyboardPeriodandGreaterThan,
3125 KeyboardForwardSlashandQuestionMark,
3127 KeyboardCapsLock,
3129 KeyboardF1,
3131 KeyboardF2,
3133 KeyboardF3,
3135 KeyboardF4,
3137 KeyboardF5,
3139 KeyboardF6,
3141 KeyboardF7,
3143 KeyboardF8,
3145 KeyboardF9,
3147 KeyboardF10,
3149 KeyboardF11,
3151 KeyboardF12,
3153 KeyboardPrintScreen,
3155 KeyboardScrollLock,
3157 KeyboardPause,
3159 KeyboardInsert,
3161 KeyboardHome,
3163 KeyboardPageUp,
3165 KeyboardDeleteForward,
3167 KeyboardEnd,
3169 KeyboardPageDown,
3171 KeyboardRightArrow,
3173 KeyboardLeftArrow,
3175 KeyboardDownArrow,
3177 KeyboardUpArrow,
3179 KeypadNumLockandClear,
3181 KeypadForwardSlash,
3183 KeypadStar,
3185 KeypadDash,
3187 KeypadPlus,
3189 KeypadENTER,
3191 Keypad1andEnd,
3193 Keypad2andDownArrow,
3195 Keypad3andPageDn,
3197 Keypad4andLeftArrow,
3199 Keypad5,
3201 Keypad6andRightArrow,
3203 Keypad7andHome,
3205 Keypad8andUpArrow,
3207 Keypad9andPageUp,
3209 Keypad0andInsert,
3211 KeypadPeriodandDelete,
3213 KeyboardNonUSBackslashandPipe,
3215 KeyboardApplication,
3217 KeyboardPower,
3219 KeypadEquals,
3221 KeyboardF13,
3223 KeyboardF14,
3225 KeyboardF15,
3227 KeyboardF16,
3229 KeyboardF17,
3231 KeyboardF18,
3233 KeyboardF19,
3235 KeyboardF20,
3237 KeyboardF21,
3239 KeyboardF22,
3241 KeyboardF23,
3243 KeyboardF24,
3245 KeyboardExecute,
3247 KeyboardHelp,
3249 KeyboardMenu,
3251 KeyboardSelect,
3253 KeyboardStop,
3255 KeyboardAgain,
3257 KeyboardUndo,
3259 KeyboardCut,
3261 KeyboardCopy,
3263 KeyboardPaste,
3265 KeyboardFind,
3267 KeyboardMute,
3269 KeyboardVolumeUp,
3271 KeyboardVolumeDown,
3273 KeyboardLockingCapsLock,
3275 KeyboardLockingNumLock,
3277 KeyboardLockingScrollLock,
3279 KeypadComma,
3281 KeypadEqualSign,
3283 KeyboardInternational1,
3285 KeyboardInternational2,
3287 KeyboardInternational3,
3289 KeyboardInternational4,
3291 KeyboardInternational5,
3293 KeyboardInternational6,
3295 KeyboardInternational7,
3297 KeyboardInternational8,
3299 KeyboardInternational9,
3301 KeyboardLANG1,
3303 KeyboardLANG2,
3305 KeyboardLANG3,
3307 KeyboardLANG4,
3309 KeyboardLANG5,
3311 KeyboardLANG6,
3313 KeyboardLANG7,
3315 KeyboardLANG8,
3317 KeyboardLANG9,
3319 KeyboardAlternateErase,
3321 KeyboardSysReqAttention,
3323 KeyboardCancel,
3325 KeyboardClear,
3327 KeyboardPrior,
3329 KeyboardReturn,
3331 KeyboardSeparator,
3333 KeyboardOut,
3335 KeyboardOper,
3337 KeyboardClearAgain,
3339 KeyboardCrSelProps,
3341 KeyboardExSel,
3343 KeypadDouble0,
3345 KeypadTriple0,
3347 ThousandsSeparator,
3349 DecimalSeparator,
3351 CurrencyUnit,
3353 CurrencySubunit,
3355 KeypadLeftBracket,
3357 KeypadRightBracket,
3359 KeypadLeftBrace,
3361 KeypadRightBrace,
3363 KeypadTab,
3365 KeypadBackspace,
3367 KeypadA,
3369 KeypadB,
3371 KeypadC,
3373 KeypadD,
3375 KeypadE,
3377 KeypadF,
3379 KeypadXOR,
3381 KeypadCaret,
3383 KeypadPercentage,
3385 KeypadLess,
3387 KeypadGreater,
3389 KeypadAmpersand,
3391 KeypadDoubleAmpersand,
3393 KeypadBar,
3395 KeypadDoubleBar,
3397 KeypadColon,
3399 KeypadHash,
3401 KeypadSpace,
3403 KeypadAt,
3405 KeypadBang,
3407 KeypadMemoryStore,
3409 KeypadMemoryRecall,
3411 KeypadMemoryClear,
3413 KeypadMemoryAdd,
3415 KeypadMemorySubtract,
3417 KeypadMemoryMultiply,
3419 KeypadMemoryDivide,
3421 KeypadPlusMinus,
3423 KeypadClear,
3425 KeypadClearEntry,
3427 KeypadBinary,
3429 KeypadOctal,
3431 KeypadDecimal,
3433 KeypadHexadecimal,
3435 KeyboardLeftControl,
3437 KeyboardLeftShift,
3439 KeyboardLeftAlt,
3441 KeyboardLeftGUI,
3443 KeyboardRightControl,
3445 KeyboardRightShift,
3447 KeyboardRightAlt,
3449 KeyboardRightGUI,
3451}
3452
3453impl KeyboardKeypad {
3454 #[cfg(feature = "std")]
3455 pub fn name(&self) -> String {
3456 match self {
3457 KeyboardKeypad::ErrorRollOver => "ErrorRollOver",
3458 KeyboardKeypad::POSTFail => "POSTFail",
3459 KeyboardKeypad::ErrorUndefined => "ErrorUndefined",
3460 KeyboardKeypad::KeyboardA => "Keyboard A",
3461 KeyboardKeypad::KeyboardB => "Keyboard B",
3462 KeyboardKeypad::KeyboardC => "Keyboard C",
3463 KeyboardKeypad::KeyboardD => "Keyboard D",
3464 KeyboardKeypad::KeyboardE => "Keyboard E",
3465 KeyboardKeypad::KeyboardF => "Keyboard F",
3466 KeyboardKeypad::KeyboardG => "Keyboard G",
3467 KeyboardKeypad::KeyboardH => "Keyboard H",
3468 KeyboardKeypad::KeyboardI => "Keyboard I",
3469 KeyboardKeypad::KeyboardJ => "Keyboard J",
3470 KeyboardKeypad::KeyboardK => "Keyboard K",
3471 KeyboardKeypad::KeyboardL => "Keyboard L",
3472 KeyboardKeypad::KeyboardM => "Keyboard M",
3473 KeyboardKeypad::KeyboardN => "Keyboard N",
3474 KeyboardKeypad::KeyboardO => "Keyboard O",
3475 KeyboardKeypad::KeyboardP => "Keyboard P",
3476 KeyboardKeypad::KeyboardQ => "Keyboard Q",
3477 KeyboardKeypad::KeyboardR => "Keyboard R",
3478 KeyboardKeypad::KeyboardS => "Keyboard S",
3479 KeyboardKeypad::KeyboardT => "Keyboard T",
3480 KeyboardKeypad::KeyboardU => "Keyboard U",
3481 KeyboardKeypad::KeyboardV => "Keyboard V",
3482 KeyboardKeypad::KeyboardW => "Keyboard W",
3483 KeyboardKeypad::KeyboardX => "Keyboard X",
3484 KeyboardKeypad::KeyboardY => "Keyboard Y",
3485 KeyboardKeypad::KeyboardZ => "Keyboard Z",
3486 KeyboardKeypad::Keyboard1andBang => "Keyboard 1 and Bang",
3487 KeyboardKeypad::Keyboard2andAt => "Keyboard 2 and At",
3488 KeyboardKeypad::Keyboard3andHash => "Keyboard 3 and Hash",
3489 KeyboardKeypad::Keyboard4andDollar => "Keyboard 4 and Dollar",
3490 KeyboardKeypad::Keyboard5andPercent => "Keyboard 5 and Percent",
3491 KeyboardKeypad::Keyboard6andCaret => "Keyboard 6 and Caret",
3492 KeyboardKeypad::Keyboard7andAmpersand => "Keyboard 7 and Ampersand",
3493 KeyboardKeypad::Keyboard8andStar => "Keyboard 8 and Star",
3494 KeyboardKeypad::Keyboard9andLeftBracket => "Keyboard 9 and Left Bracket",
3495 KeyboardKeypad::Keyboard0andRightBracket => "Keyboard 0 and Right Bracket",
3496 KeyboardKeypad::KeyboardReturnEnter => "Keyboard Return Enter",
3497 KeyboardKeypad::KeyboardEscape => "Keyboard Escape",
3498 KeyboardKeypad::KeyboardDelete => "Keyboard Delete",
3499 KeyboardKeypad::KeyboardTab => "Keyboard Tab",
3500 KeyboardKeypad::KeyboardSpacebar => "Keyboard Spacebar",
3501 KeyboardKeypad::KeyboardDashandUnderscore => "Keyboard Dash and Underscore",
3502 KeyboardKeypad::KeyboardEqualsandPlus => "Keyboard Equals and Plus",
3503 KeyboardKeypad::KeyboardLeftBrace => "Keyboard Left Brace",
3504 KeyboardKeypad::KeyboardRightBrace => "Keyboard Right Brace",
3505 KeyboardKeypad::KeyboardBackslashandPipe => "Keyboard Backslash and Pipe",
3506 KeyboardKeypad::KeyboardNonUSHashandTilde => "Keyboard Non-US Hash and Tilde",
3507 KeyboardKeypad::KeyboardSemiColonandColon => "Keyboard SemiColon and Colon",
3508 KeyboardKeypad::KeyboardLeftAposandDouble => "Keyboard Left Apos and Double",
3509 KeyboardKeypad::KeyboardGraveAccentandTilde => "Keyboard Grave Accent and Tilde",
3510 KeyboardKeypad::KeyboardCommaandLessThan => "Keyboard Comma and LessThan",
3511 KeyboardKeypad::KeyboardPeriodandGreaterThan => "Keyboard Period and GreaterThan",
3512 KeyboardKeypad::KeyboardForwardSlashandQuestionMark => {
3513 "Keyboard ForwardSlash and QuestionMark"
3514 }
3515 KeyboardKeypad::KeyboardCapsLock => "Keyboard Caps Lock",
3516 KeyboardKeypad::KeyboardF1 => "Keyboard F1",
3517 KeyboardKeypad::KeyboardF2 => "Keyboard F2",
3518 KeyboardKeypad::KeyboardF3 => "Keyboard F3",
3519 KeyboardKeypad::KeyboardF4 => "Keyboard F4",
3520 KeyboardKeypad::KeyboardF5 => "Keyboard F5",
3521 KeyboardKeypad::KeyboardF6 => "Keyboard F6",
3522 KeyboardKeypad::KeyboardF7 => "Keyboard F7",
3523 KeyboardKeypad::KeyboardF8 => "Keyboard F8",
3524 KeyboardKeypad::KeyboardF9 => "Keyboard F9",
3525 KeyboardKeypad::KeyboardF10 => "Keyboard F10",
3526 KeyboardKeypad::KeyboardF11 => "Keyboard F11",
3527 KeyboardKeypad::KeyboardF12 => "Keyboard F12",
3528 KeyboardKeypad::KeyboardPrintScreen => "Keyboard PrintScreen",
3529 KeyboardKeypad::KeyboardScrollLock => "Keyboard Scroll Lock",
3530 KeyboardKeypad::KeyboardPause => "Keyboard Pause",
3531 KeyboardKeypad::KeyboardInsert => "Keyboard Insert",
3532 KeyboardKeypad::KeyboardHome => "Keyboard Home",
3533 KeyboardKeypad::KeyboardPageUp => "Keyboard PageUp",
3534 KeyboardKeypad::KeyboardDeleteForward => "Keyboard Delete Forward",
3535 KeyboardKeypad::KeyboardEnd => "Keyboard End",
3536 KeyboardKeypad::KeyboardPageDown => "Keyboard PageDown",
3537 KeyboardKeypad::KeyboardRightArrow => "Keyboard RightArrow",
3538 KeyboardKeypad::KeyboardLeftArrow => "Keyboard LeftArrow",
3539 KeyboardKeypad::KeyboardDownArrow => "Keyboard DownArrow",
3540 KeyboardKeypad::KeyboardUpArrow => "Keyboard UpArrow",
3541 KeyboardKeypad::KeypadNumLockandClear => "Keypad Num Lock and Clear",
3542 KeyboardKeypad::KeypadForwardSlash => "Keypad ForwardSlash",
3543 KeyboardKeypad::KeypadStar => "Keypad Star",
3544 KeyboardKeypad::KeypadDash => "Keypad Dash",
3545 KeyboardKeypad::KeypadPlus => "Keypad Plus",
3546 KeyboardKeypad::KeypadENTER => "Keypad ENTER",
3547 KeyboardKeypad::Keypad1andEnd => "Keypad 1 and End",
3548 KeyboardKeypad::Keypad2andDownArrow => "Keypad 2 and Down Arrow",
3549 KeyboardKeypad::Keypad3andPageDn => "Keypad 3 and PageDn",
3550 KeyboardKeypad::Keypad4andLeftArrow => "Keypad 4 and Left Arrow",
3551 KeyboardKeypad::Keypad5 => "Keypad 5",
3552 KeyboardKeypad::Keypad6andRightArrow => "Keypad 6 and Right Arrow",
3553 KeyboardKeypad::Keypad7andHome => "Keypad 7 and Home",
3554 KeyboardKeypad::Keypad8andUpArrow => "Keypad 8 and Up Arrow",
3555 KeyboardKeypad::Keypad9andPageUp => "Keypad 9 and PageUp",
3556 KeyboardKeypad::Keypad0andInsert => "Keypad 0 and Insert",
3557 KeyboardKeypad::KeypadPeriodandDelete => "Keypad Period and Delete",
3558 KeyboardKeypad::KeyboardNonUSBackslashandPipe => "Keyboard Non-US Backslash and Pipe",
3559 KeyboardKeypad::KeyboardApplication => "Keyboard Application",
3560 KeyboardKeypad::KeyboardPower => "Keyboard Power",
3561 KeyboardKeypad::KeypadEquals => "Keypad Equals",
3562 KeyboardKeypad::KeyboardF13 => "Keyboard F13",
3563 KeyboardKeypad::KeyboardF14 => "Keyboard F14",
3564 KeyboardKeypad::KeyboardF15 => "Keyboard F15",
3565 KeyboardKeypad::KeyboardF16 => "Keyboard F16",
3566 KeyboardKeypad::KeyboardF17 => "Keyboard F17",
3567 KeyboardKeypad::KeyboardF18 => "Keyboard F18",
3568 KeyboardKeypad::KeyboardF19 => "Keyboard F19",
3569 KeyboardKeypad::KeyboardF20 => "Keyboard F20",
3570 KeyboardKeypad::KeyboardF21 => "Keyboard F21",
3571 KeyboardKeypad::KeyboardF22 => "Keyboard F22",
3572 KeyboardKeypad::KeyboardF23 => "Keyboard F23",
3573 KeyboardKeypad::KeyboardF24 => "Keyboard F24",
3574 KeyboardKeypad::KeyboardExecute => "Keyboard Execute",
3575 KeyboardKeypad::KeyboardHelp => "Keyboard Help",
3576 KeyboardKeypad::KeyboardMenu => "Keyboard Menu",
3577 KeyboardKeypad::KeyboardSelect => "Keyboard Select",
3578 KeyboardKeypad::KeyboardStop => "Keyboard Stop",
3579 KeyboardKeypad::KeyboardAgain => "Keyboard Again",
3580 KeyboardKeypad::KeyboardUndo => "Keyboard Undo",
3581 KeyboardKeypad::KeyboardCut => "Keyboard Cut",
3582 KeyboardKeypad::KeyboardCopy => "Keyboard Copy",
3583 KeyboardKeypad::KeyboardPaste => "Keyboard Paste",
3584 KeyboardKeypad::KeyboardFind => "Keyboard Find",
3585 KeyboardKeypad::KeyboardMute => "Keyboard Mute",
3586 KeyboardKeypad::KeyboardVolumeUp => "Keyboard Volume Up",
3587 KeyboardKeypad::KeyboardVolumeDown => "Keyboard Volume Down",
3588 KeyboardKeypad::KeyboardLockingCapsLock => "Keyboard Locking Caps Lock",
3589 KeyboardKeypad::KeyboardLockingNumLock => "Keyboard Locking Num Lock",
3590 KeyboardKeypad::KeyboardLockingScrollLock => "Keyboard Locking Scroll Lock",
3591 KeyboardKeypad::KeypadComma => "Keypad Comma",
3592 KeyboardKeypad::KeypadEqualSign => "Keypad Equal Sign",
3593 KeyboardKeypad::KeyboardInternational1 => "Keyboard International1",
3594 KeyboardKeypad::KeyboardInternational2 => "Keyboard International2",
3595 KeyboardKeypad::KeyboardInternational3 => "Keyboard International3",
3596 KeyboardKeypad::KeyboardInternational4 => "Keyboard International4",
3597 KeyboardKeypad::KeyboardInternational5 => "Keyboard International5",
3598 KeyboardKeypad::KeyboardInternational6 => "Keyboard International6",
3599 KeyboardKeypad::KeyboardInternational7 => "Keyboard International7",
3600 KeyboardKeypad::KeyboardInternational8 => "Keyboard International8",
3601 KeyboardKeypad::KeyboardInternational9 => "Keyboard International9",
3602 KeyboardKeypad::KeyboardLANG1 => "Keyboard LANG1",
3603 KeyboardKeypad::KeyboardLANG2 => "Keyboard LANG2",
3604 KeyboardKeypad::KeyboardLANG3 => "Keyboard LANG3",
3605 KeyboardKeypad::KeyboardLANG4 => "Keyboard LANG4",
3606 KeyboardKeypad::KeyboardLANG5 => "Keyboard LANG5",
3607 KeyboardKeypad::KeyboardLANG6 => "Keyboard LANG6",
3608 KeyboardKeypad::KeyboardLANG7 => "Keyboard LANG7",
3609 KeyboardKeypad::KeyboardLANG8 => "Keyboard LANG8",
3610 KeyboardKeypad::KeyboardLANG9 => "Keyboard LANG9",
3611 KeyboardKeypad::KeyboardAlternateErase => "Keyboard Alternate Erase",
3612 KeyboardKeypad::KeyboardSysReqAttention => "Keyboard SysReq Attention",
3613 KeyboardKeypad::KeyboardCancel => "Keyboard Cancel",
3614 KeyboardKeypad::KeyboardClear => "Keyboard Clear",
3615 KeyboardKeypad::KeyboardPrior => "Keyboard Prior",
3616 KeyboardKeypad::KeyboardReturn => "Keyboard Return",
3617 KeyboardKeypad::KeyboardSeparator => "Keyboard Separator",
3618 KeyboardKeypad::KeyboardOut => "Keyboard Out",
3619 KeyboardKeypad::KeyboardOper => "Keyboard Oper",
3620 KeyboardKeypad::KeyboardClearAgain => "Keyboard Clear Again",
3621 KeyboardKeypad::KeyboardCrSelProps => "Keyboard CrSel Props",
3622 KeyboardKeypad::KeyboardExSel => "Keyboard ExSel",
3623 KeyboardKeypad::KeypadDouble0 => "Keypad Double 0",
3624 KeyboardKeypad::KeypadTriple0 => "Keypad Triple 0",
3625 KeyboardKeypad::ThousandsSeparator => "Thousands Separator",
3626 KeyboardKeypad::DecimalSeparator => "Decimal Separator",
3627 KeyboardKeypad::CurrencyUnit => "Currency Unit",
3628 KeyboardKeypad::CurrencySubunit => "Currency Sub-unit",
3629 KeyboardKeypad::KeypadLeftBracket => "Keypad Left Bracket",
3630 KeyboardKeypad::KeypadRightBracket => "Keypad Right Bracket",
3631 KeyboardKeypad::KeypadLeftBrace => "Keypad Left Brace",
3632 KeyboardKeypad::KeypadRightBrace => "Keypad Right Brace",
3633 KeyboardKeypad::KeypadTab => "Keypad Tab",
3634 KeyboardKeypad::KeypadBackspace => "Keypad Backspace",
3635 KeyboardKeypad::KeypadA => "Keypad A",
3636 KeyboardKeypad::KeypadB => "Keypad B",
3637 KeyboardKeypad::KeypadC => "Keypad C",
3638 KeyboardKeypad::KeypadD => "Keypad D",
3639 KeyboardKeypad::KeypadE => "Keypad E",
3640 KeyboardKeypad::KeypadF => "Keypad F",
3641 KeyboardKeypad::KeypadXOR => "Keypad XOR",
3642 KeyboardKeypad::KeypadCaret => "Keypad Caret",
3643 KeyboardKeypad::KeypadPercentage => "Keypad Percentage",
3644 KeyboardKeypad::KeypadLess => "Keypad Less",
3645 KeyboardKeypad::KeypadGreater => "Keypad Greater",
3646 KeyboardKeypad::KeypadAmpersand => "Keypad Ampersand",
3647 KeyboardKeypad::KeypadDoubleAmpersand => "Keypad Double Ampersand",
3648 KeyboardKeypad::KeypadBar => "Keypad Bar",
3649 KeyboardKeypad::KeypadDoubleBar => "Keypad Double Bar",
3650 KeyboardKeypad::KeypadColon => "Keypad Colon",
3651 KeyboardKeypad::KeypadHash => "Keypad Hash",
3652 KeyboardKeypad::KeypadSpace => "Keypad Space",
3653 KeyboardKeypad::KeypadAt => "Keypad At",
3654 KeyboardKeypad::KeypadBang => "Keypad Bang",
3655 KeyboardKeypad::KeypadMemoryStore => "Keypad Memory Store",
3656 KeyboardKeypad::KeypadMemoryRecall => "Keypad Memory Recall",
3657 KeyboardKeypad::KeypadMemoryClear => "Keypad Memory Clear",
3658 KeyboardKeypad::KeypadMemoryAdd => "Keypad Memory Add",
3659 KeyboardKeypad::KeypadMemorySubtract => "Keypad Memory Subtract",
3660 KeyboardKeypad::KeypadMemoryMultiply => "Keypad Memory Multiply",
3661 KeyboardKeypad::KeypadMemoryDivide => "Keypad Memory Divide",
3662 KeyboardKeypad::KeypadPlusMinus => "Keypad Plus Minus",
3663 KeyboardKeypad::KeypadClear => "Keypad Clear",
3664 KeyboardKeypad::KeypadClearEntry => "Keypad Clear Entry",
3665 KeyboardKeypad::KeypadBinary => "Keypad Binary",
3666 KeyboardKeypad::KeypadOctal => "Keypad Octal",
3667 KeyboardKeypad::KeypadDecimal => "Keypad Decimal",
3668 KeyboardKeypad::KeypadHexadecimal => "Keypad Hexadecimal",
3669 KeyboardKeypad::KeyboardLeftControl => "Keyboard LeftControl",
3670 KeyboardKeypad::KeyboardLeftShift => "Keyboard LeftShift",
3671 KeyboardKeypad::KeyboardLeftAlt => "Keyboard LeftAlt",
3672 KeyboardKeypad::KeyboardLeftGUI => "Keyboard Left GUI",
3673 KeyboardKeypad::KeyboardRightControl => "Keyboard RightControl",
3674 KeyboardKeypad::KeyboardRightShift => "Keyboard RightShift",
3675 KeyboardKeypad::KeyboardRightAlt => "Keyboard RightAlt",
3676 KeyboardKeypad::KeyboardRightGUI => "Keyboard Right GUI",
3677 }
3678 .into()
3679 }
3680}
3681
3682#[cfg(feature = "std")]
3683impl fmt::Display for KeyboardKeypad {
3684 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3685 write!(f, "{}", self.name())
3686 }
3687}
3688
3689impl AsUsage for KeyboardKeypad {
3690 fn usage_value(&self) -> u32 {
3692 u32::from(self)
3693 }
3694
3695 fn usage_id_value(&self) -> u16 {
3697 u16::from(self)
3698 }
3699
3700 fn usage(&self) -> Usage {
3711 Usage::from(self)
3712 }
3713}
3714
3715impl AsUsagePage for KeyboardKeypad {
3716 fn usage_page_value(&self) -> u16 {
3720 let up = UsagePage::from(self);
3721 u16::from(up)
3722 }
3723
3724 fn usage_page(&self) -> UsagePage {
3726 UsagePage::from(self)
3727 }
3728}
3729
3730impl From<&KeyboardKeypad> for u16 {
3731 fn from(keyboardkeypad: &KeyboardKeypad) -> u16 {
3732 match *keyboardkeypad {
3733 KeyboardKeypad::ErrorRollOver => 1,
3734 KeyboardKeypad::POSTFail => 2,
3735 KeyboardKeypad::ErrorUndefined => 3,
3736 KeyboardKeypad::KeyboardA => 4,
3737 KeyboardKeypad::KeyboardB => 5,
3738 KeyboardKeypad::KeyboardC => 6,
3739 KeyboardKeypad::KeyboardD => 7,
3740 KeyboardKeypad::KeyboardE => 8,
3741 KeyboardKeypad::KeyboardF => 9,
3742 KeyboardKeypad::KeyboardG => 10,
3743 KeyboardKeypad::KeyboardH => 11,
3744 KeyboardKeypad::KeyboardI => 12,
3745 KeyboardKeypad::KeyboardJ => 13,
3746 KeyboardKeypad::KeyboardK => 14,
3747 KeyboardKeypad::KeyboardL => 15,
3748 KeyboardKeypad::KeyboardM => 16,
3749 KeyboardKeypad::KeyboardN => 17,
3750 KeyboardKeypad::KeyboardO => 18,
3751 KeyboardKeypad::KeyboardP => 19,
3752 KeyboardKeypad::KeyboardQ => 20,
3753 KeyboardKeypad::KeyboardR => 21,
3754 KeyboardKeypad::KeyboardS => 22,
3755 KeyboardKeypad::KeyboardT => 23,
3756 KeyboardKeypad::KeyboardU => 24,
3757 KeyboardKeypad::KeyboardV => 25,
3758 KeyboardKeypad::KeyboardW => 26,
3759 KeyboardKeypad::KeyboardX => 27,
3760 KeyboardKeypad::KeyboardY => 28,
3761 KeyboardKeypad::KeyboardZ => 29,
3762 KeyboardKeypad::Keyboard1andBang => 30,
3763 KeyboardKeypad::Keyboard2andAt => 31,
3764 KeyboardKeypad::Keyboard3andHash => 32,
3765 KeyboardKeypad::Keyboard4andDollar => 33,
3766 KeyboardKeypad::Keyboard5andPercent => 34,
3767 KeyboardKeypad::Keyboard6andCaret => 35,
3768 KeyboardKeypad::Keyboard7andAmpersand => 36,
3769 KeyboardKeypad::Keyboard8andStar => 37,
3770 KeyboardKeypad::Keyboard9andLeftBracket => 38,
3771 KeyboardKeypad::Keyboard0andRightBracket => 39,
3772 KeyboardKeypad::KeyboardReturnEnter => 40,
3773 KeyboardKeypad::KeyboardEscape => 41,
3774 KeyboardKeypad::KeyboardDelete => 42,
3775 KeyboardKeypad::KeyboardTab => 43,
3776 KeyboardKeypad::KeyboardSpacebar => 44,
3777 KeyboardKeypad::KeyboardDashandUnderscore => 45,
3778 KeyboardKeypad::KeyboardEqualsandPlus => 46,
3779 KeyboardKeypad::KeyboardLeftBrace => 47,
3780 KeyboardKeypad::KeyboardRightBrace => 48,
3781 KeyboardKeypad::KeyboardBackslashandPipe => 49,
3782 KeyboardKeypad::KeyboardNonUSHashandTilde => 50,
3783 KeyboardKeypad::KeyboardSemiColonandColon => 51,
3784 KeyboardKeypad::KeyboardLeftAposandDouble => 52,
3785 KeyboardKeypad::KeyboardGraveAccentandTilde => 53,
3786 KeyboardKeypad::KeyboardCommaandLessThan => 54,
3787 KeyboardKeypad::KeyboardPeriodandGreaterThan => 55,
3788 KeyboardKeypad::KeyboardForwardSlashandQuestionMark => 56,
3789 KeyboardKeypad::KeyboardCapsLock => 57,
3790 KeyboardKeypad::KeyboardF1 => 58,
3791 KeyboardKeypad::KeyboardF2 => 59,
3792 KeyboardKeypad::KeyboardF3 => 60,
3793 KeyboardKeypad::KeyboardF4 => 61,
3794 KeyboardKeypad::KeyboardF5 => 62,
3795 KeyboardKeypad::KeyboardF6 => 63,
3796 KeyboardKeypad::KeyboardF7 => 64,
3797 KeyboardKeypad::KeyboardF8 => 65,
3798 KeyboardKeypad::KeyboardF9 => 66,
3799 KeyboardKeypad::KeyboardF10 => 67,
3800 KeyboardKeypad::KeyboardF11 => 68,
3801 KeyboardKeypad::KeyboardF12 => 69,
3802 KeyboardKeypad::KeyboardPrintScreen => 70,
3803 KeyboardKeypad::KeyboardScrollLock => 71,
3804 KeyboardKeypad::KeyboardPause => 72,
3805 KeyboardKeypad::KeyboardInsert => 73,
3806 KeyboardKeypad::KeyboardHome => 74,
3807 KeyboardKeypad::KeyboardPageUp => 75,
3808 KeyboardKeypad::KeyboardDeleteForward => 76,
3809 KeyboardKeypad::KeyboardEnd => 77,
3810 KeyboardKeypad::KeyboardPageDown => 78,
3811 KeyboardKeypad::KeyboardRightArrow => 79,
3812 KeyboardKeypad::KeyboardLeftArrow => 80,
3813 KeyboardKeypad::KeyboardDownArrow => 81,
3814 KeyboardKeypad::KeyboardUpArrow => 82,
3815 KeyboardKeypad::KeypadNumLockandClear => 83,
3816 KeyboardKeypad::KeypadForwardSlash => 84,
3817 KeyboardKeypad::KeypadStar => 85,
3818 KeyboardKeypad::KeypadDash => 86,
3819 KeyboardKeypad::KeypadPlus => 87,
3820 KeyboardKeypad::KeypadENTER => 88,
3821 KeyboardKeypad::Keypad1andEnd => 89,
3822 KeyboardKeypad::Keypad2andDownArrow => 90,
3823 KeyboardKeypad::Keypad3andPageDn => 91,
3824 KeyboardKeypad::Keypad4andLeftArrow => 92,
3825 KeyboardKeypad::Keypad5 => 93,
3826 KeyboardKeypad::Keypad6andRightArrow => 94,
3827 KeyboardKeypad::Keypad7andHome => 95,
3828 KeyboardKeypad::Keypad8andUpArrow => 96,
3829 KeyboardKeypad::Keypad9andPageUp => 97,
3830 KeyboardKeypad::Keypad0andInsert => 98,
3831 KeyboardKeypad::KeypadPeriodandDelete => 99,
3832 KeyboardKeypad::KeyboardNonUSBackslashandPipe => 100,
3833 KeyboardKeypad::KeyboardApplication => 101,
3834 KeyboardKeypad::KeyboardPower => 102,
3835 KeyboardKeypad::KeypadEquals => 103,
3836 KeyboardKeypad::KeyboardF13 => 104,
3837 KeyboardKeypad::KeyboardF14 => 105,
3838 KeyboardKeypad::KeyboardF15 => 106,
3839 KeyboardKeypad::KeyboardF16 => 107,
3840 KeyboardKeypad::KeyboardF17 => 108,
3841 KeyboardKeypad::KeyboardF18 => 109,
3842 KeyboardKeypad::KeyboardF19 => 110,
3843 KeyboardKeypad::KeyboardF20 => 111,
3844 KeyboardKeypad::KeyboardF21 => 112,
3845 KeyboardKeypad::KeyboardF22 => 113,
3846 KeyboardKeypad::KeyboardF23 => 114,
3847 KeyboardKeypad::KeyboardF24 => 115,
3848 KeyboardKeypad::KeyboardExecute => 116,
3849 KeyboardKeypad::KeyboardHelp => 117,
3850 KeyboardKeypad::KeyboardMenu => 118,
3851 KeyboardKeypad::KeyboardSelect => 119,
3852 KeyboardKeypad::KeyboardStop => 120,
3853 KeyboardKeypad::KeyboardAgain => 121,
3854 KeyboardKeypad::KeyboardUndo => 122,
3855 KeyboardKeypad::KeyboardCut => 123,
3856 KeyboardKeypad::KeyboardCopy => 124,
3857 KeyboardKeypad::KeyboardPaste => 125,
3858 KeyboardKeypad::KeyboardFind => 126,
3859 KeyboardKeypad::KeyboardMute => 127,
3860 KeyboardKeypad::KeyboardVolumeUp => 128,
3861 KeyboardKeypad::KeyboardVolumeDown => 129,
3862 KeyboardKeypad::KeyboardLockingCapsLock => 130,
3863 KeyboardKeypad::KeyboardLockingNumLock => 131,
3864 KeyboardKeypad::KeyboardLockingScrollLock => 132,
3865 KeyboardKeypad::KeypadComma => 133,
3866 KeyboardKeypad::KeypadEqualSign => 134,
3867 KeyboardKeypad::KeyboardInternational1 => 135,
3868 KeyboardKeypad::KeyboardInternational2 => 136,
3869 KeyboardKeypad::KeyboardInternational3 => 137,
3870 KeyboardKeypad::KeyboardInternational4 => 138,
3871 KeyboardKeypad::KeyboardInternational5 => 139,
3872 KeyboardKeypad::KeyboardInternational6 => 140,
3873 KeyboardKeypad::KeyboardInternational7 => 141,
3874 KeyboardKeypad::KeyboardInternational8 => 142,
3875 KeyboardKeypad::KeyboardInternational9 => 143,
3876 KeyboardKeypad::KeyboardLANG1 => 144,
3877 KeyboardKeypad::KeyboardLANG2 => 145,
3878 KeyboardKeypad::KeyboardLANG3 => 146,
3879 KeyboardKeypad::KeyboardLANG4 => 147,
3880 KeyboardKeypad::KeyboardLANG5 => 148,
3881 KeyboardKeypad::KeyboardLANG6 => 149,
3882 KeyboardKeypad::KeyboardLANG7 => 150,
3883 KeyboardKeypad::KeyboardLANG8 => 151,
3884 KeyboardKeypad::KeyboardLANG9 => 152,
3885 KeyboardKeypad::KeyboardAlternateErase => 153,
3886 KeyboardKeypad::KeyboardSysReqAttention => 154,
3887 KeyboardKeypad::KeyboardCancel => 155,
3888 KeyboardKeypad::KeyboardClear => 156,
3889 KeyboardKeypad::KeyboardPrior => 157,
3890 KeyboardKeypad::KeyboardReturn => 158,
3891 KeyboardKeypad::KeyboardSeparator => 159,
3892 KeyboardKeypad::KeyboardOut => 160,
3893 KeyboardKeypad::KeyboardOper => 161,
3894 KeyboardKeypad::KeyboardClearAgain => 162,
3895 KeyboardKeypad::KeyboardCrSelProps => 163,
3896 KeyboardKeypad::KeyboardExSel => 164,
3897 KeyboardKeypad::KeypadDouble0 => 176,
3898 KeyboardKeypad::KeypadTriple0 => 177,
3899 KeyboardKeypad::ThousandsSeparator => 178,
3900 KeyboardKeypad::DecimalSeparator => 179,
3901 KeyboardKeypad::CurrencyUnit => 180,
3902 KeyboardKeypad::CurrencySubunit => 181,
3903 KeyboardKeypad::KeypadLeftBracket => 182,
3904 KeyboardKeypad::KeypadRightBracket => 183,
3905 KeyboardKeypad::KeypadLeftBrace => 184,
3906 KeyboardKeypad::KeypadRightBrace => 185,
3907 KeyboardKeypad::KeypadTab => 186,
3908 KeyboardKeypad::KeypadBackspace => 187,
3909 KeyboardKeypad::KeypadA => 188,
3910 KeyboardKeypad::KeypadB => 189,
3911 KeyboardKeypad::KeypadC => 190,
3912 KeyboardKeypad::KeypadD => 191,
3913 KeyboardKeypad::KeypadE => 192,
3914 KeyboardKeypad::KeypadF => 193,
3915 KeyboardKeypad::KeypadXOR => 194,
3916 KeyboardKeypad::KeypadCaret => 195,
3917 KeyboardKeypad::KeypadPercentage => 196,
3918 KeyboardKeypad::KeypadLess => 197,
3919 KeyboardKeypad::KeypadGreater => 198,
3920 KeyboardKeypad::KeypadAmpersand => 199,
3921 KeyboardKeypad::KeypadDoubleAmpersand => 200,
3922 KeyboardKeypad::KeypadBar => 201,
3923 KeyboardKeypad::KeypadDoubleBar => 202,
3924 KeyboardKeypad::KeypadColon => 203,
3925 KeyboardKeypad::KeypadHash => 204,
3926 KeyboardKeypad::KeypadSpace => 205,
3927 KeyboardKeypad::KeypadAt => 206,
3928 KeyboardKeypad::KeypadBang => 207,
3929 KeyboardKeypad::KeypadMemoryStore => 208,
3930 KeyboardKeypad::KeypadMemoryRecall => 209,
3931 KeyboardKeypad::KeypadMemoryClear => 210,
3932 KeyboardKeypad::KeypadMemoryAdd => 211,
3933 KeyboardKeypad::KeypadMemorySubtract => 212,
3934 KeyboardKeypad::KeypadMemoryMultiply => 213,
3935 KeyboardKeypad::KeypadMemoryDivide => 214,
3936 KeyboardKeypad::KeypadPlusMinus => 215,
3937 KeyboardKeypad::KeypadClear => 216,
3938 KeyboardKeypad::KeypadClearEntry => 217,
3939 KeyboardKeypad::KeypadBinary => 218,
3940 KeyboardKeypad::KeypadOctal => 219,
3941 KeyboardKeypad::KeypadDecimal => 220,
3942 KeyboardKeypad::KeypadHexadecimal => 221,
3943 KeyboardKeypad::KeyboardLeftControl => 224,
3944 KeyboardKeypad::KeyboardLeftShift => 225,
3945 KeyboardKeypad::KeyboardLeftAlt => 226,
3946 KeyboardKeypad::KeyboardLeftGUI => 227,
3947 KeyboardKeypad::KeyboardRightControl => 228,
3948 KeyboardKeypad::KeyboardRightShift => 229,
3949 KeyboardKeypad::KeyboardRightAlt => 230,
3950 KeyboardKeypad::KeyboardRightGUI => 231,
3951 }
3952 }
3953}
3954
3955impl From<KeyboardKeypad> for u16 {
3956 fn from(keyboardkeypad: KeyboardKeypad) -> u16 {
3959 u16::from(&keyboardkeypad)
3960 }
3961}
3962
3963impl From<&KeyboardKeypad> for u32 {
3964 fn from(keyboardkeypad: &KeyboardKeypad) -> u32 {
3967 let up = UsagePage::from(keyboardkeypad);
3968 let up = (u16::from(&up) as u32) << 16;
3969 let id = u16::from(keyboardkeypad) as u32;
3970 up | id
3971 }
3972}
3973
3974impl From<&KeyboardKeypad> for UsagePage {
3975 fn from(_: &KeyboardKeypad) -> UsagePage {
3978 UsagePage::KeyboardKeypad
3979 }
3980}
3981
3982impl From<KeyboardKeypad> for UsagePage {
3983 fn from(_: KeyboardKeypad) -> UsagePage {
3986 UsagePage::KeyboardKeypad
3987 }
3988}
3989
3990impl From<&KeyboardKeypad> for Usage {
3991 fn from(keyboardkeypad: &KeyboardKeypad) -> Usage {
3992 Usage::try_from(u32::from(keyboardkeypad)).unwrap()
3993 }
3994}
3995
3996impl From<KeyboardKeypad> for Usage {
3997 fn from(keyboardkeypad: KeyboardKeypad) -> Usage {
3998 Usage::from(&keyboardkeypad)
3999 }
4000}
4001
4002impl TryFrom<u16> for KeyboardKeypad {
4003 type Error = HutError;
4004
4005 fn try_from(usage_id: u16) -> Result<KeyboardKeypad> {
4006 match usage_id {
4007 1 => Ok(KeyboardKeypad::ErrorRollOver),
4008 2 => Ok(KeyboardKeypad::POSTFail),
4009 3 => Ok(KeyboardKeypad::ErrorUndefined),
4010 4 => Ok(KeyboardKeypad::KeyboardA),
4011 5 => Ok(KeyboardKeypad::KeyboardB),
4012 6 => Ok(KeyboardKeypad::KeyboardC),
4013 7 => Ok(KeyboardKeypad::KeyboardD),
4014 8 => Ok(KeyboardKeypad::KeyboardE),
4015 9 => Ok(KeyboardKeypad::KeyboardF),
4016 10 => Ok(KeyboardKeypad::KeyboardG),
4017 11 => Ok(KeyboardKeypad::KeyboardH),
4018 12 => Ok(KeyboardKeypad::KeyboardI),
4019 13 => Ok(KeyboardKeypad::KeyboardJ),
4020 14 => Ok(KeyboardKeypad::KeyboardK),
4021 15 => Ok(KeyboardKeypad::KeyboardL),
4022 16 => Ok(KeyboardKeypad::KeyboardM),
4023 17 => Ok(KeyboardKeypad::KeyboardN),
4024 18 => Ok(KeyboardKeypad::KeyboardO),
4025 19 => Ok(KeyboardKeypad::KeyboardP),
4026 20 => Ok(KeyboardKeypad::KeyboardQ),
4027 21 => Ok(KeyboardKeypad::KeyboardR),
4028 22 => Ok(KeyboardKeypad::KeyboardS),
4029 23 => Ok(KeyboardKeypad::KeyboardT),
4030 24 => Ok(KeyboardKeypad::KeyboardU),
4031 25 => Ok(KeyboardKeypad::KeyboardV),
4032 26 => Ok(KeyboardKeypad::KeyboardW),
4033 27 => Ok(KeyboardKeypad::KeyboardX),
4034 28 => Ok(KeyboardKeypad::KeyboardY),
4035 29 => Ok(KeyboardKeypad::KeyboardZ),
4036 30 => Ok(KeyboardKeypad::Keyboard1andBang),
4037 31 => Ok(KeyboardKeypad::Keyboard2andAt),
4038 32 => Ok(KeyboardKeypad::Keyboard3andHash),
4039 33 => Ok(KeyboardKeypad::Keyboard4andDollar),
4040 34 => Ok(KeyboardKeypad::Keyboard5andPercent),
4041 35 => Ok(KeyboardKeypad::Keyboard6andCaret),
4042 36 => Ok(KeyboardKeypad::Keyboard7andAmpersand),
4043 37 => Ok(KeyboardKeypad::Keyboard8andStar),
4044 38 => Ok(KeyboardKeypad::Keyboard9andLeftBracket),
4045 39 => Ok(KeyboardKeypad::Keyboard0andRightBracket),
4046 40 => Ok(KeyboardKeypad::KeyboardReturnEnter),
4047 41 => Ok(KeyboardKeypad::KeyboardEscape),
4048 42 => Ok(KeyboardKeypad::KeyboardDelete),
4049 43 => Ok(KeyboardKeypad::KeyboardTab),
4050 44 => Ok(KeyboardKeypad::KeyboardSpacebar),
4051 45 => Ok(KeyboardKeypad::KeyboardDashandUnderscore),
4052 46 => Ok(KeyboardKeypad::KeyboardEqualsandPlus),
4053 47 => Ok(KeyboardKeypad::KeyboardLeftBrace),
4054 48 => Ok(KeyboardKeypad::KeyboardRightBrace),
4055 49 => Ok(KeyboardKeypad::KeyboardBackslashandPipe),
4056 50 => Ok(KeyboardKeypad::KeyboardNonUSHashandTilde),
4057 51 => Ok(KeyboardKeypad::KeyboardSemiColonandColon),
4058 52 => Ok(KeyboardKeypad::KeyboardLeftAposandDouble),
4059 53 => Ok(KeyboardKeypad::KeyboardGraveAccentandTilde),
4060 54 => Ok(KeyboardKeypad::KeyboardCommaandLessThan),
4061 55 => Ok(KeyboardKeypad::KeyboardPeriodandGreaterThan),
4062 56 => Ok(KeyboardKeypad::KeyboardForwardSlashandQuestionMark),
4063 57 => Ok(KeyboardKeypad::KeyboardCapsLock),
4064 58 => Ok(KeyboardKeypad::KeyboardF1),
4065 59 => Ok(KeyboardKeypad::KeyboardF2),
4066 60 => Ok(KeyboardKeypad::KeyboardF3),
4067 61 => Ok(KeyboardKeypad::KeyboardF4),
4068 62 => Ok(KeyboardKeypad::KeyboardF5),
4069 63 => Ok(KeyboardKeypad::KeyboardF6),
4070 64 => Ok(KeyboardKeypad::KeyboardF7),
4071 65 => Ok(KeyboardKeypad::KeyboardF8),
4072 66 => Ok(KeyboardKeypad::KeyboardF9),
4073 67 => Ok(KeyboardKeypad::KeyboardF10),
4074 68 => Ok(KeyboardKeypad::KeyboardF11),
4075 69 => Ok(KeyboardKeypad::KeyboardF12),
4076 70 => Ok(KeyboardKeypad::KeyboardPrintScreen),
4077 71 => Ok(KeyboardKeypad::KeyboardScrollLock),
4078 72 => Ok(KeyboardKeypad::KeyboardPause),
4079 73 => Ok(KeyboardKeypad::KeyboardInsert),
4080 74 => Ok(KeyboardKeypad::KeyboardHome),
4081 75 => Ok(KeyboardKeypad::KeyboardPageUp),
4082 76 => Ok(KeyboardKeypad::KeyboardDeleteForward),
4083 77 => Ok(KeyboardKeypad::KeyboardEnd),
4084 78 => Ok(KeyboardKeypad::KeyboardPageDown),
4085 79 => Ok(KeyboardKeypad::KeyboardRightArrow),
4086 80 => Ok(KeyboardKeypad::KeyboardLeftArrow),
4087 81 => Ok(KeyboardKeypad::KeyboardDownArrow),
4088 82 => Ok(KeyboardKeypad::KeyboardUpArrow),
4089 83 => Ok(KeyboardKeypad::KeypadNumLockandClear),
4090 84 => Ok(KeyboardKeypad::KeypadForwardSlash),
4091 85 => Ok(KeyboardKeypad::KeypadStar),
4092 86 => Ok(KeyboardKeypad::KeypadDash),
4093 87 => Ok(KeyboardKeypad::KeypadPlus),
4094 88 => Ok(KeyboardKeypad::KeypadENTER),
4095 89 => Ok(KeyboardKeypad::Keypad1andEnd),
4096 90 => Ok(KeyboardKeypad::Keypad2andDownArrow),
4097 91 => Ok(KeyboardKeypad::Keypad3andPageDn),
4098 92 => Ok(KeyboardKeypad::Keypad4andLeftArrow),
4099 93 => Ok(KeyboardKeypad::Keypad5),
4100 94 => Ok(KeyboardKeypad::Keypad6andRightArrow),
4101 95 => Ok(KeyboardKeypad::Keypad7andHome),
4102 96 => Ok(KeyboardKeypad::Keypad8andUpArrow),
4103 97 => Ok(KeyboardKeypad::Keypad9andPageUp),
4104 98 => Ok(KeyboardKeypad::Keypad0andInsert),
4105 99 => Ok(KeyboardKeypad::KeypadPeriodandDelete),
4106 100 => Ok(KeyboardKeypad::KeyboardNonUSBackslashandPipe),
4107 101 => Ok(KeyboardKeypad::KeyboardApplication),
4108 102 => Ok(KeyboardKeypad::KeyboardPower),
4109 103 => Ok(KeyboardKeypad::KeypadEquals),
4110 104 => Ok(KeyboardKeypad::KeyboardF13),
4111 105 => Ok(KeyboardKeypad::KeyboardF14),
4112 106 => Ok(KeyboardKeypad::KeyboardF15),
4113 107 => Ok(KeyboardKeypad::KeyboardF16),
4114 108 => Ok(KeyboardKeypad::KeyboardF17),
4115 109 => Ok(KeyboardKeypad::KeyboardF18),
4116 110 => Ok(KeyboardKeypad::KeyboardF19),
4117 111 => Ok(KeyboardKeypad::KeyboardF20),
4118 112 => Ok(KeyboardKeypad::KeyboardF21),
4119 113 => Ok(KeyboardKeypad::KeyboardF22),
4120 114 => Ok(KeyboardKeypad::KeyboardF23),
4121 115 => Ok(KeyboardKeypad::KeyboardF24),
4122 116 => Ok(KeyboardKeypad::KeyboardExecute),
4123 117 => Ok(KeyboardKeypad::KeyboardHelp),
4124 118 => Ok(KeyboardKeypad::KeyboardMenu),
4125 119 => Ok(KeyboardKeypad::KeyboardSelect),
4126 120 => Ok(KeyboardKeypad::KeyboardStop),
4127 121 => Ok(KeyboardKeypad::KeyboardAgain),
4128 122 => Ok(KeyboardKeypad::KeyboardUndo),
4129 123 => Ok(KeyboardKeypad::KeyboardCut),
4130 124 => Ok(KeyboardKeypad::KeyboardCopy),
4131 125 => Ok(KeyboardKeypad::KeyboardPaste),
4132 126 => Ok(KeyboardKeypad::KeyboardFind),
4133 127 => Ok(KeyboardKeypad::KeyboardMute),
4134 128 => Ok(KeyboardKeypad::KeyboardVolumeUp),
4135 129 => Ok(KeyboardKeypad::KeyboardVolumeDown),
4136 130 => Ok(KeyboardKeypad::KeyboardLockingCapsLock),
4137 131 => Ok(KeyboardKeypad::KeyboardLockingNumLock),
4138 132 => Ok(KeyboardKeypad::KeyboardLockingScrollLock),
4139 133 => Ok(KeyboardKeypad::KeypadComma),
4140 134 => Ok(KeyboardKeypad::KeypadEqualSign),
4141 135 => Ok(KeyboardKeypad::KeyboardInternational1),
4142 136 => Ok(KeyboardKeypad::KeyboardInternational2),
4143 137 => Ok(KeyboardKeypad::KeyboardInternational3),
4144 138 => Ok(KeyboardKeypad::KeyboardInternational4),
4145 139 => Ok(KeyboardKeypad::KeyboardInternational5),
4146 140 => Ok(KeyboardKeypad::KeyboardInternational6),
4147 141 => Ok(KeyboardKeypad::KeyboardInternational7),
4148 142 => Ok(KeyboardKeypad::KeyboardInternational8),
4149 143 => Ok(KeyboardKeypad::KeyboardInternational9),
4150 144 => Ok(KeyboardKeypad::KeyboardLANG1),
4151 145 => Ok(KeyboardKeypad::KeyboardLANG2),
4152 146 => Ok(KeyboardKeypad::KeyboardLANG3),
4153 147 => Ok(KeyboardKeypad::KeyboardLANG4),
4154 148 => Ok(KeyboardKeypad::KeyboardLANG5),
4155 149 => Ok(KeyboardKeypad::KeyboardLANG6),
4156 150 => Ok(KeyboardKeypad::KeyboardLANG7),
4157 151 => Ok(KeyboardKeypad::KeyboardLANG8),
4158 152 => Ok(KeyboardKeypad::KeyboardLANG9),
4159 153 => Ok(KeyboardKeypad::KeyboardAlternateErase),
4160 154 => Ok(KeyboardKeypad::KeyboardSysReqAttention),
4161 155 => Ok(KeyboardKeypad::KeyboardCancel),
4162 156 => Ok(KeyboardKeypad::KeyboardClear),
4163 157 => Ok(KeyboardKeypad::KeyboardPrior),
4164 158 => Ok(KeyboardKeypad::KeyboardReturn),
4165 159 => Ok(KeyboardKeypad::KeyboardSeparator),
4166 160 => Ok(KeyboardKeypad::KeyboardOut),
4167 161 => Ok(KeyboardKeypad::KeyboardOper),
4168 162 => Ok(KeyboardKeypad::KeyboardClearAgain),
4169 163 => Ok(KeyboardKeypad::KeyboardCrSelProps),
4170 164 => Ok(KeyboardKeypad::KeyboardExSel),
4171 176 => Ok(KeyboardKeypad::KeypadDouble0),
4172 177 => Ok(KeyboardKeypad::KeypadTriple0),
4173 178 => Ok(KeyboardKeypad::ThousandsSeparator),
4174 179 => Ok(KeyboardKeypad::DecimalSeparator),
4175 180 => Ok(KeyboardKeypad::CurrencyUnit),
4176 181 => Ok(KeyboardKeypad::CurrencySubunit),
4177 182 => Ok(KeyboardKeypad::KeypadLeftBracket),
4178 183 => Ok(KeyboardKeypad::KeypadRightBracket),
4179 184 => Ok(KeyboardKeypad::KeypadLeftBrace),
4180 185 => Ok(KeyboardKeypad::KeypadRightBrace),
4181 186 => Ok(KeyboardKeypad::KeypadTab),
4182 187 => Ok(KeyboardKeypad::KeypadBackspace),
4183 188 => Ok(KeyboardKeypad::KeypadA),
4184 189 => Ok(KeyboardKeypad::KeypadB),
4185 190 => Ok(KeyboardKeypad::KeypadC),
4186 191 => Ok(KeyboardKeypad::KeypadD),
4187 192 => Ok(KeyboardKeypad::KeypadE),
4188 193 => Ok(KeyboardKeypad::KeypadF),
4189 194 => Ok(KeyboardKeypad::KeypadXOR),
4190 195 => Ok(KeyboardKeypad::KeypadCaret),
4191 196 => Ok(KeyboardKeypad::KeypadPercentage),
4192 197 => Ok(KeyboardKeypad::KeypadLess),
4193 198 => Ok(KeyboardKeypad::KeypadGreater),
4194 199 => Ok(KeyboardKeypad::KeypadAmpersand),
4195 200 => Ok(KeyboardKeypad::KeypadDoubleAmpersand),
4196 201 => Ok(KeyboardKeypad::KeypadBar),
4197 202 => Ok(KeyboardKeypad::KeypadDoubleBar),
4198 203 => Ok(KeyboardKeypad::KeypadColon),
4199 204 => Ok(KeyboardKeypad::KeypadHash),
4200 205 => Ok(KeyboardKeypad::KeypadSpace),
4201 206 => Ok(KeyboardKeypad::KeypadAt),
4202 207 => Ok(KeyboardKeypad::KeypadBang),
4203 208 => Ok(KeyboardKeypad::KeypadMemoryStore),
4204 209 => Ok(KeyboardKeypad::KeypadMemoryRecall),
4205 210 => Ok(KeyboardKeypad::KeypadMemoryClear),
4206 211 => Ok(KeyboardKeypad::KeypadMemoryAdd),
4207 212 => Ok(KeyboardKeypad::KeypadMemorySubtract),
4208 213 => Ok(KeyboardKeypad::KeypadMemoryMultiply),
4209 214 => Ok(KeyboardKeypad::KeypadMemoryDivide),
4210 215 => Ok(KeyboardKeypad::KeypadPlusMinus),
4211 216 => Ok(KeyboardKeypad::KeypadClear),
4212 217 => Ok(KeyboardKeypad::KeypadClearEntry),
4213 218 => Ok(KeyboardKeypad::KeypadBinary),
4214 219 => Ok(KeyboardKeypad::KeypadOctal),
4215 220 => Ok(KeyboardKeypad::KeypadDecimal),
4216 221 => Ok(KeyboardKeypad::KeypadHexadecimal),
4217 224 => Ok(KeyboardKeypad::KeyboardLeftControl),
4218 225 => Ok(KeyboardKeypad::KeyboardLeftShift),
4219 226 => Ok(KeyboardKeypad::KeyboardLeftAlt),
4220 227 => Ok(KeyboardKeypad::KeyboardLeftGUI),
4221 228 => Ok(KeyboardKeypad::KeyboardRightControl),
4222 229 => Ok(KeyboardKeypad::KeyboardRightShift),
4223 230 => Ok(KeyboardKeypad::KeyboardRightAlt),
4224 231 => Ok(KeyboardKeypad::KeyboardRightGUI),
4225 n => Err(HutError::UnknownUsageId { usage_id: n }),
4226 }
4227 }
4228}
4229
4230impl BitOr<u16> for KeyboardKeypad {
4231 type Output = Usage;
4232
4233 fn bitor(self, usage: u16) -> Usage {
4240 let up = u16::from(self) as u32;
4241 let u = usage as u32;
4242 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
4243 }
4244}
4245
4246#[allow(non_camel_case_types)]
4267#[derive(Debug)]
4268#[non_exhaustive]
4269pub enum LED {
4270 NumLock,
4272 CapsLock,
4274 ScrollLock,
4276 Compose,
4278 Kana,
4280 Power,
4282 Shift,
4284 DoNotDisturb,
4286 Mute,
4288 ToneEnable,
4290 HighCutFilter,
4292 LowCutFilter,
4294 EqualizerEnable,
4296 SoundFieldOn,
4298 SurroundOn,
4300 Repeat,
4302 Stereo,
4304 SamplingRateDetect,
4306 Spinning,
4308 CAV,
4310 CLV,
4312 RecordingFormatDetect,
4314 OffHook,
4316 Ring,
4318 MessageWaiting,
4320 DataMode,
4322 BatteryOperation,
4324 BatteryOK,
4326 BatteryLow,
4328 Speaker,
4330 Headset,
4332 Hold,
4334 Microphone,
4336 Coverage,
4338 NightMode,
4340 SendCalls,
4342 CallPickup,
4344 Conference,
4346 Standby,
4348 CameraOn,
4350 CameraOff,
4352 OnLine,
4354 OffLine,
4356 Busy,
4358 Ready,
4360 PaperOut,
4362 PaperJam,
4364 Remote,
4366 Forward,
4368 Reverse,
4370 Stop,
4372 Rewind,
4374 FastForward,
4376 Play,
4378 Pause,
4380 Record,
4382 Error,
4384 UsageSelectedIndicator,
4386 UsageInUseIndicator,
4388 UsageMultiModeIndicator,
4390 IndicatorOn,
4392 IndicatorFlash,
4394 IndicatorSlowBlink,
4396 IndicatorFastBlink,
4398 IndicatorOff,
4400 FlashOnTime,
4402 SlowBlinkOnTime,
4404 SlowBlinkOffTime,
4406 FastBlinkOnTime,
4408 FastBlinkOffTime,
4410 UsageIndicatorColor,
4412 IndicatorRed,
4414 IndicatorGreen,
4416 IndicatorAmber,
4418 GenericIndicator,
4420 SystemSuspend,
4422 ExternalPowerConnected,
4424 IndicatorBlue,
4426 IndicatorOrange,
4428 GoodStatus,
4430 WarningStatus,
4432 RGBLED,
4434 RedLEDChannel,
4436 BlueLEDChannel,
4438 GreenLEDChannel,
4440 LEDIntensity,
4442 SystemMicrophoneMute,
4444 PlayerIndicator,
4446 Player1,
4448 Player2,
4450 Player3,
4452 Player4,
4454 Player5,
4456 Player6,
4458 Player7,
4460 Player8,
4462}
4463
4464impl LED {
4465 #[cfg(feature = "std")]
4466 pub fn name(&self) -> String {
4467 match self {
4468 LED::NumLock => "Num Lock",
4469 LED::CapsLock => "Caps Lock",
4470 LED::ScrollLock => "Scroll Lock",
4471 LED::Compose => "Compose",
4472 LED::Kana => "Kana",
4473 LED::Power => "Power",
4474 LED::Shift => "Shift",
4475 LED::DoNotDisturb => "Do Not Disturb",
4476 LED::Mute => "Mute",
4477 LED::ToneEnable => "Tone Enable",
4478 LED::HighCutFilter => "High Cut Filter",
4479 LED::LowCutFilter => "Low Cut Filter",
4480 LED::EqualizerEnable => "Equalizer Enable",
4481 LED::SoundFieldOn => "Sound Field On",
4482 LED::SurroundOn => "Surround On",
4483 LED::Repeat => "Repeat",
4484 LED::Stereo => "Stereo",
4485 LED::SamplingRateDetect => "Sampling Rate Detect",
4486 LED::Spinning => "Spinning",
4487 LED::CAV => "CAV",
4488 LED::CLV => "CLV",
4489 LED::RecordingFormatDetect => "Recording Format Detect",
4490 LED::OffHook => "Off-Hook",
4491 LED::Ring => "Ring",
4492 LED::MessageWaiting => "Message Waiting",
4493 LED::DataMode => "Data Mode",
4494 LED::BatteryOperation => "Battery Operation",
4495 LED::BatteryOK => "Battery OK",
4496 LED::BatteryLow => "Battery Low",
4497 LED::Speaker => "Speaker",
4498 LED::Headset => "Headset",
4499 LED::Hold => "Hold",
4500 LED::Microphone => "Microphone",
4501 LED::Coverage => "Coverage",
4502 LED::NightMode => "Night Mode",
4503 LED::SendCalls => "Send Calls",
4504 LED::CallPickup => "Call Pickup",
4505 LED::Conference => "Conference",
4506 LED::Standby => "Stand-by",
4507 LED::CameraOn => "Camera On",
4508 LED::CameraOff => "Camera Off",
4509 LED::OnLine => "On-Line",
4510 LED::OffLine => "Off-Line",
4511 LED::Busy => "Busy",
4512 LED::Ready => "Ready",
4513 LED::PaperOut => "Paper-Out",
4514 LED::PaperJam => "Paper-Jam",
4515 LED::Remote => "Remote",
4516 LED::Forward => "Forward",
4517 LED::Reverse => "Reverse",
4518 LED::Stop => "Stop",
4519 LED::Rewind => "Rewind",
4520 LED::FastForward => "Fast Forward",
4521 LED::Play => "Play",
4522 LED::Pause => "Pause",
4523 LED::Record => "Record",
4524 LED::Error => "Error",
4525 LED::UsageSelectedIndicator => "Usage Selected Indicator",
4526 LED::UsageInUseIndicator => "Usage In Use Indicator",
4527 LED::UsageMultiModeIndicator => "Usage Multi Mode Indicator",
4528 LED::IndicatorOn => "Indicator On",
4529 LED::IndicatorFlash => "Indicator Flash",
4530 LED::IndicatorSlowBlink => "Indicator Slow Blink",
4531 LED::IndicatorFastBlink => "Indicator Fast Blink",
4532 LED::IndicatorOff => "Indicator Off",
4533 LED::FlashOnTime => "Flash On Time",
4534 LED::SlowBlinkOnTime => "Slow Blink On Time",
4535 LED::SlowBlinkOffTime => "Slow Blink Off Time",
4536 LED::FastBlinkOnTime => "Fast Blink On Time",
4537 LED::FastBlinkOffTime => "Fast Blink Off Time",
4538 LED::UsageIndicatorColor => "Usage Indicator Color",
4539 LED::IndicatorRed => "Indicator Red",
4540 LED::IndicatorGreen => "Indicator Green",
4541 LED::IndicatorAmber => "Indicator Amber",
4542 LED::GenericIndicator => "Generic Indicator",
4543 LED::SystemSuspend => "System Suspend",
4544 LED::ExternalPowerConnected => "External Power Connected",
4545 LED::IndicatorBlue => "Indicator Blue",
4546 LED::IndicatorOrange => "Indicator Orange",
4547 LED::GoodStatus => "Good Status",
4548 LED::WarningStatus => "Warning Status",
4549 LED::RGBLED => "RGB LED",
4550 LED::RedLEDChannel => "Red LED Channel",
4551 LED::BlueLEDChannel => "Blue LED Channel",
4552 LED::GreenLEDChannel => "Green LED Channel",
4553 LED::LEDIntensity => "LED Intensity",
4554 LED::SystemMicrophoneMute => "System Microphone Mute",
4555 LED::PlayerIndicator => "Player Indicator",
4556 LED::Player1 => "Player 1",
4557 LED::Player2 => "Player 2",
4558 LED::Player3 => "Player 3",
4559 LED::Player4 => "Player 4",
4560 LED::Player5 => "Player 5",
4561 LED::Player6 => "Player 6",
4562 LED::Player7 => "Player 7",
4563 LED::Player8 => "Player 8",
4564 }
4565 .into()
4566 }
4567}
4568
4569#[cfg(feature = "std")]
4570impl fmt::Display for LED {
4571 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
4572 write!(f, "{}", self.name())
4573 }
4574}
4575
4576impl AsUsage for LED {
4577 fn usage_value(&self) -> u32 {
4579 u32::from(self)
4580 }
4581
4582 fn usage_id_value(&self) -> u16 {
4584 u16::from(self)
4585 }
4586
4587 fn usage(&self) -> Usage {
4598 Usage::from(self)
4599 }
4600}
4601
4602impl AsUsagePage for LED {
4603 fn usage_page_value(&self) -> u16 {
4607 let up = UsagePage::from(self);
4608 u16::from(up)
4609 }
4610
4611 fn usage_page(&self) -> UsagePage {
4613 UsagePage::from(self)
4614 }
4615}
4616
4617impl From<&LED> for u16 {
4618 fn from(led: &LED) -> u16 {
4619 match *led {
4620 LED::NumLock => 1,
4621 LED::CapsLock => 2,
4622 LED::ScrollLock => 3,
4623 LED::Compose => 4,
4624 LED::Kana => 5,
4625 LED::Power => 6,
4626 LED::Shift => 7,
4627 LED::DoNotDisturb => 8,
4628 LED::Mute => 9,
4629 LED::ToneEnable => 10,
4630 LED::HighCutFilter => 11,
4631 LED::LowCutFilter => 12,
4632 LED::EqualizerEnable => 13,
4633 LED::SoundFieldOn => 14,
4634 LED::SurroundOn => 15,
4635 LED::Repeat => 16,
4636 LED::Stereo => 17,
4637 LED::SamplingRateDetect => 18,
4638 LED::Spinning => 19,
4639 LED::CAV => 20,
4640 LED::CLV => 21,
4641 LED::RecordingFormatDetect => 22,
4642 LED::OffHook => 23,
4643 LED::Ring => 24,
4644 LED::MessageWaiting => 25,
4645 LED::DataMode => 26,
4646 LED::BatteryOperation => 27,
4647 LED::BatteryOK => 28,
4648 LED::BatteryLow => 29,
4649 LED::Speaker => 30,
4650 LED::Headset => 31,
4651 LED::Hold => 32,
4652 LED::Microphone => 33,
4653 LED::Coverage => 34,
4654 LED::NightMode => 35,
4655 LED::SendCalls => 36,
4656 LED::CallPickup => 37,
4657 LED::Conference => 38,
4658 LED::Standby => 39,
4659 LED::CameraOn => 40,
4660 LED::CameraOff => 41,
4661 LED::OnLine => 42,
4662 LED::OffLine => 43,
4663 LED::Busy => 44,
4664 LED::Ready => 45,
4665 LED::PaperOut => 46,
4666 LED::PaperJam => 47,
4667 LED::Remote => 48,
4668 LED::Forward => 49,
4669 LED::Reverse => 50,
4670 LED::Stop => 51,
4671 LED::Rewind => 52,
4672 LED::FastForward => 53,
4673 LED::Play => 54,
4674 LED::Pause => 55,
4675 LED::Record => 56,
4676 LED::Error => 57,
4677 LED::UsageSelectedIndicator => 58,
4678 LED::UsageInUseIndicator => 59,
4679 LED::UsageMultiModeIndicator => 60,
4680 LED::IndicatorOn => 61,
4681 LED::IndicatorFlash => 62,
4682 LED::IndicatorSlowBlink => 63,
4683 LED::IndicatorFastBlink => 64,
4684 LED::IndicatorOff => 65,
4685 LED::FlashOnTime => 66,
4686 LED::SlowBlinkOnTime => 67,
4687 LED::SlowBlinkOffTime => 68,
4688 LED::FastBlinkOnTime => 69,
4689 LED::FastBlinkOffTime => 70,
4690 LED::UsageIndicatorColor => 71,
4691 LED::IndicatorRed => 72,
4692 LED::IndicatorGreen => 73,
4693 LED::IndicatorAmber => 74,
4694 LED::GenericIndicator => 75,
4695 LED::SystemSuspend => 76,
4696 LED::ExternalPowerConnected => 77,
4697 LED::IndicatorBlue => 78,
4698 LED::IndicatorOrange => 79,
4699 LED::GoodStatus => 80,
4700 LED::WarningStatus => 81,
4701 LED::RGBLED => 82,
4702 LED::RedLEDChannel => 83,
4703 LED::BlueLEDChannel => 84,
4704 LED::GreenLEDChannel => 85,
4705 LED::LEDIntensity => 86,
4706 LED::SystemMicrophoneMute => 87,
4707 LED::PlayerIndicator => 96,
4708 LED::Player1 => 97,
4709 LED::Player2 => 98,
4710 LED::Player3 => 99,
4711 LED::Player4 => 100,
4712 LED::Player5 => 101,
4713 LED::Player6 => 102,
4714 LED::Player7 => 103,
4715 LED::Player8 => 104,
4716 }
4717 }
4718}
4719
4720impl From<LED> for u16 {
4721 fn from(led: LED) -> u16 {
4724 u16::from(&led)
4725 }
4726}
4727
4728impl From<&LED> for u32 {
4729 fn from(led: &LED) -> u32 {
4732 let up = UsagePage::from(led);
4733 let up = (u16::from(&up) as u32) << 16;
4734 let id = u16::from(led) as u32;
4735 up | id
4736 }
4737}
4738
4739impl From<&LED> for UsagePage {
4740 fn from(_: &LED) -> UsagePage {
4743 UsagePage::LED
4744 }
4745}
4746
4747impl From<LED> for UsagePage {
4748 fn from(_: LED) -> UsagePage {
4751 UsagePage::LED
4752 }
4753}
4754
4755impl From<&LED> for Usage {
4756 fn from(led: &LED) -> Usage {
4757 Usage::try_from(u32::from(led)).unwrap()
4758 }
4759}
4760
4761impl From<LED> for Usage {
4762 fn from(led: LED) -> Usage {
4763 Usage::from(&led)
4764 }
4765}
4766
4767impl TryFrom<u16> for LED {
4768 type Error = HutError;
4769
4770 fn try_from(usage_id: u16) -> Result<LED> {
4771 match usage_id {
4772 1 => Ok(LED::NumLock),
4773 2 => Ok(LED::CapsLock),
4774 3 => Ok(LED::ScrollLock),
4775 4 => Ok(LED::Compose),
4776 5 => Ok(LED::Kana),
4777 6 => Ok(LED::Power),
4778 7 => Ok(LED::Shift),
4779 8 => Ok(LED::DoNotDisturb),
4780 9 => Ok(LED::Mute),
4781 10 => Ok(LED::ToneEnable),
4782 11 => Ok(LED::HighCutFilter),
4783 12 => Ok(LED::LowCutFilter),
4784 13 => Ok(LED::EqualizerEnable),
4785 14 => Ok(LED::SoundFieldOn),
4786 15 => Ok(LED::SurroundOn),
4787 16 => Ok(LED::Repeat),
4788 17 => Ok(LED::Stereo),
4789 18 => Ok(LED::SamplingRateDetect),
4790 19 => Ok(LED::Spinning),
4791 20 => Ok(LED::CAV),
4792 21 => Ok(LED::CLV),
4793 22 => Ok(LED::RecordingFormatDetect),
4794 23 => Ok(LED::OffHook),
4795 24 => Ok(LED::Ring),
4796 25 => Ok(LED::MessageWaiting),
4797 26 => Ok(LED::DataMode),
4798 27 => Ok(LED::BatteryOperation),
4799 28 => Ok(LED::BatteryOK),
4800 29 => Ok(LED::BatteryLow),
4801 30 => Ok(LED::Speaker),
4802 31 => Ok(LED::Headset),
4803 32 => Ok(LED::Hold),
4804 33 => Ok(LED::Microphone),
4805 34 => Ok(LED::Coverage),
4806 35 => Ok(LED::NightMode),
4807 36 => Ok(LED::SendCalls),
4808 37 => Ok(LED::CallPickup),
4809 38 => Ok(LED::Conference),
4810 39 => Ok(LED::Standby),
4811 40 => Ok(LED::CameraOn),
4812 41 => Ok(LED::CameraOff),
4813 42 => Ok(LED::OnLine),
4814 43 => Ok(LED::OffLine),
4815 44 => Ok(LED::Busy),
4816 45 => Ok(LED::Ready),
4817 46 => Ok(LED::PaperOut),
4818 47 => Ok(LED::PaperJam),
4819 48 => Ok(LED::Remote),
4820 49 => Ok(LED::Forward),
4821 50 => Ok(LED::Reverse),
4822 51 => Ok(LED::Stop),
4823 52 => Ok(LED::Rewind),
4824 53 => Ok(LED::FastForward),
4825 54 => Ok(LED::Play),
4826 55 => Ok(LED::Pause),
4827 56 => Ok(LED::Record),
4828 57 => Ok(LED::Error),
4829 58 => Ok(LED::UsageSelectedIndicator),
4830 59 => Ok(LED::UsageInUseIndicator),
4831 60 => Ok(LED::UsageMultiModeIndicator),
4832 61 => Ok(LED::IndicatorOn),
4833 62 => Ok(LED::IndicatorFlash),
4834 63 => Ok(LED::IndicatorSlowBlink),
4835 64 => Ok(LED::IndicatorFastBlink),
4836 65 => Ok(LED::IndicatorOff),
4837 66 => Ok(LED::FlashOnTime),
4838 67 => Ok(LED::SlowBlinkOnTime),
4839 68 => Ok(LED::SlowBlinkOffTime),
4840 69 => Ok(LED::FastBlinkOnTime),
4841 70 => Ok(LED::FastBlinkOffTime),
4842 71 => Ok(LED::UsageIndicatorColor),
4843 72 => Ok(LED::IndicatorRed),
4844 73 => Ok(LED::IndicatorGreen),
4845 74 => Ok(LED::IndicatorAmber),
4846 75 => Ok(LED::GenericIndicator),
4847 76 => Ok(LED::SystemSuspend),
4848 77 => Ok(LED::ExternalPowerConnected),
4849 78 => Ok(LED::IndicatorBlue),
4850 79 => Ok(LED::IndicatorOrange),
4851 80 => Ok(LED::GoodStatus),
4852 81 => Ok(LED::WarningStatus),
4853 82 => Ok(LED::RGBLED),
4854 83 => Ok(LED::RedLEDChannel),
4855 84 => Ok(LED::BlueLEDChannel),
4856 85 => Ok(LED::GreenLEDChannel),
4857 86 => Ok(LED::LEDIntensity),
4858 87 => Ok(LED::SystemMicrophoneMute),
4859 96 => Ok(LED::PlayerIndicator),
4860 97 => Ok(LED::Player1),
4861 98 => Ok(LED::Player2),
4862 99 => Ok(LED::Player3),
4863 100 => Ok(LED::Player4),
4864 101 => Ok(LED::Player5),
4865 102 => Ok(LED::Player6),
4866 103 => Ok(LED::Player7),
4867 104 => Ok(LED::Player8),
4868 n => Err(HutError::UnknownUsageId { usage_id: n }),
4869 }
4870 }
4871}
4872
4873impl BitOr<u16> for LED {
4874 type Output = Usage;
4875
4876 fn bitor(self, usage: u16) -> Usage {
4883 let up = u16::from(self) as u32;
4884 let u = usage as u32;
4885 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
4886 }
4887}
4888
4889#[allow(non_camel_case_types)]
4913#[derive(Debug)]
4914#[non_exhaustive]
4915pub enum Button {
4916 Button(u16),
4917}
4918
4919impl Button {
4920 #[cfg(feature = "std")]
4921 pub fn name(&self) -> String {
4922 match self {
4923 Button::Button(button) => format!("Button {button}"),
4924 }
4925 }
4926}
4927
4928#[cfg(feature = "std")]
4929impl fmt::Display for Button {
4930 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
4931 write!(f, "{}", self.name())
4932 }
4933}
4934
4935impl AsUsage for Button {
4936 fn usage_value(&self) -> u32 {
4938 u32::from(self)
4939 }
4940
4941 fn usage_id_value(&self) -> u16 {
4943 u16::from(self)
4944 }
4945
4946 fn usage(&self) -> Usage {
4957 Usage::from(self)
4958 }
4959}
4960
4961impl AsUsagePage for Button {
4962 fn usage_page_value(&self) -> u16 {
4966 let up = UsagePage::from(self);
4967 u16::from(up)
4968 }
4969
4970 fn usage_page(&self) -> UsagePage {
4972 UsagePage::from(self)
4973 }
4974}
4975
4976impl From<&Button> for u16 {
4977 fn from(button: &Button) -> u16 {
4978 match *button {
4979 Button::Button(button) => button,
4980 }
4981 }
4982}
4983
4984impl From<Button> for u16 {
4985 fn from(button: Button) -> u16 {
4988 u16::from(&button)
4989 }
4990}
4991
4992impl From<&Button> for u32 {
4993 fn from(button: &Button) -> u32 {
4996 let up = UsagePage::from(button);
4997 let up = (u16::from(&up) as u32) << 16;
4998 let id = u16::from(button) as u32;
4999 up | id
5000 }
5001}
5002
5003impl From<&Button> for UsagePage {
5004 fn from(_: &Button) -> UsagePage {
5007 UsagePage::Button
5008 }
5009}
5010
5011impl From<Button> for UsagePage {
5012 fn from(_: Button) -> UsagePage {
5015 UsagePage::Button
5016 }
5017}
5018
5019impl From<&Button> for Usage {
5020 fn from(button: &Button) -> Usage {
5021 Usage::try_from(u32::from(button)).unwrap()
5022 }
5023}
5024
5025impl From<Button> for Usage {
5026 fn from(button: Button) -> Usage {
5027 Usage::from(&button)
5028 }
5029}
5030
5031impl TryFrom<u16> for Button {
5032 type Error = HutError;
5033
5034 fn try_from(usage_id: u16) -> Result<Button> {
5035 match usage_id {
5036 n => Ok(Button::Button(n)),
5037 }
5038 }
5039}
5040
5041impl BitOr<u16> for Button {
5042 type Output = Usage;
5043
5044 fn bitor(self, usage: u16) -> Usage {
5051 let up = u16::from(self) as u32;
5052 let u = usage as u32;
5053 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
5054 }
5055}
5056
5057#[allow(non_camel_case_types)]
5081#[derive(Debug)]
5082#[non_exhaustive]
5083pub enum Ordinal {
5084 Ordinal(u16),
5085}
5086
5087impl Ordinal {
5088 #[cfg(feature = "std")]
5089 pub fn name(&self) -> String {
5090 match self {
5091 Ordinal::Ordinal(instance) => format!("Instance {instance}"),
5092 }
5093 }
5094}
5095
5096#[cfg(feature = "std")]
5097impl fmt::Display for Ordinal {
5098 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
5099 write!(f, "{}", self.name())
5100 }
5101}
5102
5103impl AsUsage for Ordinal {
5104 fn usage_value(&self) -> u32 {
5106 u32::from(self)
5107 }
5108
5109 fn usage_id_value(&self) -> u16 {
5111 u16::from(self)
5112 }
5113
5114 fn usage(&self) -> Usage {
5125 Usage::from(self)
5126 }
5127}
5128
5129impl AsUsagePage for Ordinal {
5130 fn usage_page_value(&self) -> u16 {
5134 let up = UsagePage::from(self);
5135 u16::from(up)
5136 }
5137
5138 fn usage_page(&self) -> UsagePage {
5140 UsagePage::from(self)
5141 }
5142}
5143
5144impl From<&Ordinal> for u16 {
5145 fn from(ordinal: &Ordinal) -> u16 {
5146 match *ordinal {
5147 Ordinal::Ordinal(instance) => instance,
5148 }
5149 }
5150}
5151
5152impl From<Ordinal> for u16 {
5153 fn from(ordinal: Ordinal) -> u16 {
5156 u16::from(&ordinal)
5157 }
5158}
5159
5160impl From<&Ordinal> for u32 {
5161 fn from(ordinal: &Ordinal) -> u32 {
5164 let up = UsagePage::from(ordinal);
5165 let up = (u16::from(&up) as u32) << 16;
5166 let id = u16::from(ordinal) as u32;
5167 up | id
5168 }
5169}
5170
5171impl From<&Ordinal> for UsagePage {
5172 fn from(_: &Ordinal) -> UsagePage {
5175 UsagePage::Ordinal
5176 }
5177}
5178
5179impl From<Ordinal> for UsagePage {
5180 fn from(_: Ordinal) -> UsagePage {
5183 UsagePage::Ordinal
5184 }
5185}
5186
5187impl From<&Ordinal> for Usage {
5188 fn from(ordinal: &Ordinal) -> Usage {
5189 Usage::try_from(u32::from(ordinal)).unwrap()
5190 }
5191}
5192
5193impl From<Ordinal> for Usage {
5194 fn from(ordinal: Ordinal) -> Usage {
5195 Usage::from(&ordinal)
5196 }
5197}
5198
5199impl TryFrom<u16> for Ordinal {
5200 type Error = HutError;
5201
5202 fn try_from(usage_id: u16) -> Result<Ordinal> {
5203 match usage_id {
5204 n => Ok(Ordinal::Ordinal(n)),
5205 }
5206 }
5207}
5208
5209impl BitOr<u16> for Ordinal {
5210 type Output = Usage;
5211
5212 fn bitor(self, usage: u16) -> Usage {
5219 let up = u16::from(self) as u32;
5220 let u = usage as u32;
5221 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
5222 }
5223}
5224
5225#[allow(non_camel_case_types)]
5246#[derive(Debug)]
5247#[non_exhaustive]
5248pub enum TelephonyDevice {
5249 Phone,
5251 AnsweringMachine,
5253 MessageControls,
5255 Handset,
5257 Headset,
5259 TelephonyKeyPad,
5261 ProgrammableButton,
5263 HookSwitch,
5265 Flash,
5267 Feature,
5269 Hold,
5271 Redial,
5273 Transfer,
5275 Drop,
5277 Park,
5279 ForwardCalls,
5281 AlternateFunction,
5283 Line,
5285 SpeakerPhone,
5287 Conference,
5289 RingEnable,
5291 RingSelect,
5293 PhoneMute,
5295 CallerID,
5297 Send,
5299 SpeedDial,
5301 StoreNumber,
5303 RecallNumber,
5305 PhoneDirectory,
5307 VoiceMail,
5309 ScreenCalls,
5311 DoNotDisturb,
5313 Message,
5315 AnswerOnOff,
5317 InsideDialTone,
5319 OutsideDialTone,
5321 InsideRingTone,
5323 OutsideRingTone,
5325 PriorityRingTone,
5327 InsideRingback,
5329 PriorityRingback,
5331 LineBusyTone,
5333 ReorderTone,
5335 CallWaitingTone,
5337 ConfirmationTone1,
5339 ConfirmationTone2,
5341 TonesOff,
5343 OutsideRingback,
5345 Ringer,
5347 PhoneKey0,
5349 PhoneKey1,
5351 PhoneKey2,
5353 PhoneKey3,
5355 PhoneKey4,
5357 PhoneKey5,
5359 PhoneKey6,
5361 PhoneKey7,
5363 PhoneKey8,
5365 PhoneKey9,
5367 PhoneKeyStar,
5369 PhoneKeyPound,
5371 PhoneKeyA,
5373 PhoneKeyB,
5375 PhoneKeyC,
5377 PhoneKeyD,
5379 PhoneCallHistoryKey,
5381 PhoneCallerIDKey,
5383 PhoneSettingsKey,
5385 HostControl,
5387 HostAvailable,
5389 HostCallActive,
5391 ActivateHandsetAudio,
5393 RingType,
5395 RedialablePhoneNumber,
5397 StopRingTone,
5399 PSTNRingTone,
5401 HostRingTone,
5403 AlertSoundError,
5405 AlertSoundConfirm,
5407 AlertSoundNotification,
5409 SilentRing,
5411 EmailMessageWaiting,
5413 VoicemailMessageWaiting,
5415 HostHold,
5417 IncomingCallHistoryCount,
5419 OutgoingCallHistoryCount,
5421 IncomingCallHistory,
5423 OutgoingCallHistory,
5425 PhoneLocale,
5427 PhoneTimeSecond,
5429 PhoneTimeMinute,
5431 PhoneTimeHour,
5433 PhoneDateDay,
5435 PhoneDateMonth,
5437 PhoneDateYear,
5439 HandsetNickname,
5441 AddressBookID,
5443 CallDuration,
5445 DualModePhone,
5447}
5448
5449impl TelephonyDevice {
5450 #[cfg(feature = "std")]
5451 pub fn name(&self) -> String {
5452 match self {
5453 TelephonyDevice::Phone => "Phone",
5454 TelephonyDevice::AnsweringMachine => "Answering Machine",
5455 TelephonyDevice::MessageControls => "Message Controls",
5456 TelephonyDevice::Handset => "Handset",
5457 TelephonyDevice::Headset => "Headset",
5458 TelephonyDevice::TelephonyKeyPad => "Telephony Key Pad",
5459 TelephonyDevice::ProgrammableButton => "Programmable Button",
5460 TelephonyDevice::HookSwitch => "Hook Switch",
5461 TelephonyDevice::Flash => "Flash",
5462 TelephonyDevice::Feature => "Feature",
5463 TelephonyDevice::Hold => "Hold",
5464 TelephonyDevice::Redial => "Redial",
5465 TelephonyDevice::Transfer => "Transfer",
5466 TelephonyDevice::Drop => "Drop",
5467 TelephonyDevice::Park => "Park",
5468 TelephonyDevice::ForwardCalls => "Forward Calls",
5469 TelephonyDevice::AlternateFunction => "Alternate Function",
5470 TelephonyDevice::Line => "Line",
5471 TelephonyDevice::SpeakerPhone => "Speaker Phone",
5472 TelephonyDevice::Conference => "Conference",
5473 TelephonyDevice::RingEnable => "Ring Enable",
5474 TelephonyDevice::RingSelect => "Ring Select",
5475 TelephonyDevice::PhoneMute => "Phone Mute",
5476 TelephonyDevice::CallerID => "Caller ID",
5477 TelephonyDevice::Send => "Send",
5478 TelephonyDevice::SpeedDial => "Speed Dial",
5479 TelephonyDevice::StoreNumber => "Store Number",
5480 TelephonyDevice::RecallNumber => "Recall Number",
5481 TelephonyDevice::PhoneDirectory => "Phone Directory",
5482 TelephonyDevice::VoiceMail => "Voice Mail",
5483 TelephonyDevice::ScreenCalls => "Screen Calls",
5484 TelephonyDevice::DoNotDisturb => "Do Not Disturb",
5485 TelephonyDevice::Message => "Message",
5486 TelephonyDevice::AnswerOnOff => "Answer On/Off",
5487 TelephonyDevice::InsideDialTone => "Inside Dial Tone",
5488 TelephonyDevice::OutsideDialTone => "Outside Dial Tone",
5489 TelephonyDevice::InsideRingTone => "Inside Ring Tone",
5490 TelephonyDevice::OutsideRingTone => "Outside Ring Tone",
5491 TelephonyDevice::PriorityRingTone => "Priority Ring Tone",
5492 TelephonyDevice::InsideRingback => "Inside Ringback",
5493 TelephonyDevice::PriorityRingback => "Priority Ringback",
5494 TelephonyDevice::LineBusyTone => "Line Busy Tone",
5495 TelephonyDevice::ReorderTone => "Reorder Tone",
5496 TelephonyDevice::CallWaitingTone => "Call Waiting Tone",
5497 TelephonyDevice::ConfirmationTone1 => "Confirmation Tone 1",
5498 TelephonyDevice::ConfirmationTone2 => "Confirmation Tone 2",
5499 TelephonyDevice::TonesOff => "Tones Off",
5500 TelephonyDevice::OutsideRingback => "Outside Ringback",
5501 TelephonyDevice::Ringer => "Ringer",
5502 TelephonyDevice::PhoneKey0 => "Phone Key 0",
5503 TelephonyDevice::PhoneKey1 => "Phone Key 1",
5504 TelephonyDevice::PhoneKey2 => "Phone Key 2",
5505 TelephonyDevice::PhoneKey3 => "Phone Key 3",
5506 TelephonyDevice::PhoneKey4 => "Phone Key 4",
5507 TelephonyDevice::PhoneKey5 => "Phone Key 5",
5508 TelephonyDevice::PhoneKey6 => "Phone Key 6",
5509 TelephonyDevice::PhoneKey7 => "Phone Key 7",
5510 TelephonyDevice::PhoneKey8 => "Phone Key 8",
5511 TelephonyDevice::PhoneKey9 => "Phone Key 9",
5512 TelephonyDevice::PhoneKeyStar => "Phone Key Star",
5513 TelephonyDevice::PhoneKeyPound => "Phone Key Pound",
5514 TelephonyDevice::PhoneKeyA => "Phone Key A",
5515 TelephonyDevice::PhoneKeyB => "Phone Key B",
5516 TelephonyDevice::PhoneKeyC => "Phone Key C",
5517 TelephonyDevice::PhoneKeyD => "Phone Key D",
5518 TelephonyDevice::PhoneCallHistoryKey => "Phone Call History Key",
5519 TelephonyDevice::PhoneCallerIDKey => "Phone Caller ID Key",
5520 TelephonyDevice::PhoneSettingsKey => "Phone Settings Key",
5521 TelephonyDevice::HostControl => "Host Control",
5522 TelephonyDevice::HostAvailable => "Host Available",
5523 TelephonyDevice::HostCallActive => "Host Call Active",
5524 TelephonyDevice::ActivateHandsetAudio => "Activate Handset Audio",
5525 TelephonyDevice::RingType => "Ring Type",
5526 TelephonyDevice::RedialablePhoneNumber => "Re-dialable Phone Number",
5527 TelephonyDevice::StopRingTone => "Stop Ring Tone",
5528 TelephonyDevice::PSTNRingTone => "PSTN Ring Tone",
5529 TelephonyDevice::HostRingTone => "Host Ring Tone",
5530 TelephonyDevice::AlertSoundError => "Alert Sound Error",
5531 TelephonyDevice::AlertSoundConfirm => "Alert Sound Confirm",
5532 TelephonyDevice::AlertSoundNotification => "Alert Sound Notification",
5533 TelephonyDevice::SilentRing => "Silent Ring",
5534 TelephonyDevice::EmailMessageWaiting => "Email Message Waiting",
5535 TelephonyDevice::VoicemailMessageWaiting => "Voicemail Message Waiting",
5536 TelephonyDevice::HostHold => "Host Hold",
5537 TelephonyDevice::IncomingCallHistoryCount => "Incoming Call History Count",
5538 TelephonyDevice::OutgoingCallHistoryCount => "Outgoing Call History Count",
5539 TelephonyDevice::IncomingCallHistory => "Incoming Call History",
5540 TelephonyDevice::OutgoingCallHistory => "Outgoing Call History",
5541 TelephonyDevice::PhoneLocale => "Phone Locale",
5542 TelephonyDevice::PhoneTimeSecond => "Phone Time Second",
5543 TelephonyDevice::PhoneTimeMinute => "Phone Time Minute",
5544 TelephonyDevice::PhoneTimeHour => "Phone Time Hour",
5545 TelephonyDevice::PhoneDateDay => "Phone Date Day",
5546 TelephonyDevice::PhoneDateMonth => "Phone Date Month",
5547 TelephonyDevice::PhoneDateYear => "Phone Date Year",
5548 TelephonyDevice::HandsetNickname => "Handset Nickname",
5549 TelephonyDevice::AddressBookID => "Address Book ID",
5550 TelephonyDevice::CallDuration => "Call Duration",
5551 TelephonyDevice::DualModePhone => "Dual Mode Phone",
5552 }
5553 .into()
5554 }
5555}
5556
5557#[cfg(feature = "std")]
5558impl fmt::Display for TelephonyDevice {
5559 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
5560 write!(f, "{}", self.name())
5561 }
5562}
5563
5564impl AsUsage for TelephonyDevice {
5565 fn usage_value(&self) -> u32 {
5567 u32::from(self)
5568 }
5569
5570 fn usage_id_value(&self) -> u16 {
5572 u16::from(self)
5573 }
5574
5575 fn usage(&self) -> Usage {
5586 Usage::from(self)
5587 }
5588}
5589
5590impl AsUsagePage for TelephonyDevice {
5591 fn usage_page_value(&self) -> u16 {
5595 let up = UsagePage::from(self);
5596 u16::from(up)
5597 }
5598
5599 fn usage_page(&self) -> UsagePage {
5601 UsagePage::from(self)
5602 }
5603}
5604
5605impl From<&TelephonyDevice> for u16 {
5606 fn from(telephonydevice: &TelephonyDevice) -> u16 {
5607 match *telephonydevice {
5608 TelephonyDevice::Phone => 1,
5609 TelephonyDevice::AnsweringMachine => 2,
5610 TelephonyDevice::MessageControls => 3,
5611 TelephonyDevice::Handset => 4,
5612 TelephonyDevice::Headset => 5,
5613 TelephonyDevice::TelephonyKeyPad => 6,
5614 TelephonyDevice::ProgrammableButton => 7,
5615 TelephonyDevice::HookSwitch => 32,
5616 TelephonyDevice::Flash => 33,
5617 TelephonyDevice::Feature => 34,
5618 TelephonyDevice::Hold => 35,
5619 TelephonyDevice::Redial => 36,
5620 TelephonyDevice::Transfer => 37,
5621 TelephonyDevice::Drop => 38,
5622 TelephonyDevice::Park => 39,
5623 TelephonyDevice::ForwardCalls => 40,
5624 TelephonyDevice::AlternateFunction => 41,
5625 TelephonyDevice::Line => 42,
5626 TelephonyDevice::SpeakerPhone => 43,
5627 TelephonyDevice::Conference => 44,
5628 TelephonyDevice::RingEnable => 45,
5629 TelephonyDevice::RingSelect => 46,
5630 TelephonyDevice::PhoneMute => 47,
5631 TelephonyDevice::CallerID => 48,
5632 TelephonyDevice::Send => 49,
5633 TelephonyDevice::SpeedDial => 80,
5634 TelephonyDevice::StoreNumber => 81,
5635 TelephonyDevice::RecallNumber => 82,
5636 TelephonyDevice::PhoneDirectory => 83,
5637 TelephonyDevice::VoiceMail => 112,
5638 TelephonyDevice::ScreenCalls => 113,
5639 TelephonyDevice::DoNotDisturb => 114,
5640 TelephonyDevice::Message => 115,
5641 TelephonyDevice::AnswerOnOff => 116,
5642 TelephonyDevice::InsideDialTone => 144,
5643 TelephonyDevice::OutsideDialTone => 145,
5644 TelephonyDevice::InsideRingTone => 146,
5645 TelephonyDevice::OutsideRingTone => 147,
5646 TelephonyDevice::PriorityRingTone => 148,
5647 TelephonyDevice::InsideRingback => 149,
5648 TelephonyDevice::PriorityRingback => 150,
5649 TelephonyDevice::LineBusyTone => 151,
5650 TelephonyDevice::ReorderTone => 152,
5651 TelephonyDevice::CallWaitingTone => 153,
5652 TelephonyDevice::ConfirmationTone1 => 154,
5653 TelephonyDevice::ConfirmationTone2 => 155,
5654 TelephonyDevice::TonesOff => 156,
5655 TelephonyDevice::OutsideRingback => 157,
5656 TelephonyDevice::Ringer => 158,
5657 TelephonyDevice::PhoneKey0 => 176,
5658 TelephonyDevice::PhoneKey1 => 177,
5659 TelephonyDevice::PhoneKey2 => 178,
5660 TelephonyDevice::PhoneKey3 => 179,
5661 TelephonyDevice::PhoneKey4 => 180,
5662 TelephonyDevice::PhoneKey5 => 181,
5663 TelephonyDevice::PhoneKey6 => 182,
5664 TelephonyDevice::PhoneKey7 => 183,
5665 TelephonyDevice::PhoneKey8 => 184,
5666 TelephonyDevice::PhoneKey9 => 185,
5667 TelephonyDevice::PhoneKeyStar => 186,
5668 TelephonyDevice::PhoneKeyPound => 187,
5669 TelephonyDevice::PhoneKeyA => 188,
5670 TelephonyDevice::PhoneKeyB => 189,
5671 TelephonyDevice::PhoneKeyC => 190,
5672 TelephonyDevice::PhoneKeyD => 191,
5673 TelephonyDevice::PhoneCallHistoryKey => 192,
5674 TelephonyDevice::PhoneCallerIDKey => 193,
5675 TelephonyDevice::PhoneSettingsKey => 194,
5676 TelephonyDevice::HostControl => 240,
5677 TelephonyDevice::HostAvailable => 241,
5678 TelephonyDevice::HostCallActive => 242,
5679 TelephonyDevice::ActivateHandsetAudio => 243,
5680 TelephonyDevice::RingType => 244,
5681 TelephonyDevice::RedialablePhoneNumber => 245,
5682 TelephonyDevice::StopRingTone => 248,
5683 TelephonyDevice::PSTNRingTone => 249,
5684 TelephonyDevice::HostRingTone => 250,
5685 TelephonyDevice::AlertSoundError => 251,
5686 TelephonyDevice::AlertSoundConfirm => 252,
5687 TelephonyDevice::AlertSoundNotification => 253,
5688 TelephonyDevice::SilentRing => 254,
5689 TelephonyDevice::EmailMessageWaiting => 264,
5690 TelephonyDevice::VoicemailMessageWaiting => 265,
5691 TelephonyDevice::HostHold => 266,
5692 TelephonyDevice::IncomingCallHistoryCount => 272,
5693 TelephonyDevice::OutgoingCallHistoryCount => 273,
5694 TelephonyDevice::IncomingCallHistory => 274,
5695 TelephonyDevice::OutgoingCallHistory => 275,
5696 TelephonyDevice::PhoneLocale => 276,
5697 TelephonyDevice::PhoneTimeSecond => 320,
5698 TelephonyDevice::PhoneTimeMinute => 321,
5699 TelephonyDevice::PhoneTimeHour => 322,
5700 TelephonyDevice::PhoneDateDay => 323,
5701 TelephonyDevice::PhoneDateMonth => 324,
5702 TelephonyDevice::PhoneDateYear => 325,
5703 TelephonyDevice::HandsetNickname => 326,
5704 TelephonyDevice::AddressBookID => 327,
5705 TelephonyDevice::CallDuration => 330,
5706 TelephonyDevice::DualModePhone => 331,
5707 }
5708 }
5709}
5710
5711impl From<TelephonyDevice> for u16 {
5712 fn from(telephonydevice: TelephonyDevice) -> u16 {
5715 u16::from(&telephonydevice)
5716 }
5717}
5718
5719impl From<&TelephonyDevice> for u32 {
5720 fn from(telephonydevice: &TelephonyDevice) -> u32 {
5723 let up = UsagePage::from(telephonydevice);
5724 let up = (u16::from(&up) as u32) << 16;
5725 let id = u16::from(telephonydevice) as u32;
5726 up | id
5727 }
5728}
5729
5730impl From<&TelephonyDevice> for UsagePage {
5731 fn from(_: &TelephonyDevice) -> UsagePage {
5734 UsagePage::TelephonyDevice
5735 }
5736}
5737
5738impl From<TelephonyDevice> for UsagePage {
5739 fn from(_: TelephonyDevice) -> UsagePage {
5742 UsagePage::TelephonyDevice
5743 }
5744}
5745
5746impl From<&TelephonyDevice> for Usage {
5747 fn from(telephonydevice: &TelephonyDevice) -> Usage {
5748 Usage::try_from(u32::from(telephonydevice)).unwrap()
5749 }
5750}
5751
5752impl From<TelephonyDevice> for Usage {
5753 fn from(telephonydevice: TelephonyDevice) -> Usage {
5754 Usage::from(&telephonydevice)
5755 }
5756}
5757
5758impl TryFrom<u16> for TelephonyDevice {
5759 type Error = HutError;
5760
5761 fn try_from(usage_id: u16) -> Result<TelephonyDevice> {
5762 match usage_id {
5763 1 => Ok(TelephonyDevice::Phone),
5764 2 => Ok(TelephonyDevice::AnsweringMachine),
5765 3 => Ok(TelephonyDevice::MessageControls),
5766 4 => Ok(TelephonyDevice::Handset),
5767 5 => Ok(TelephonyDevice::Headset),
5768 6 => Ok(TelephonyDevice::TelephonyKeyPad),
5769 7 => Ok(TelephonyDevice::ProgrammableButton),
5770 32 => Ok(TelephonyDevice::HookSwitch),
5771 33 => Ok(TelephonyDevice::Flash),
5772 34 => Ok(TelephonyDevice::Feature),
5773 35 => Ok(TelephonyDevice::Hold),
5774 36 => Ok(TelephonyDevice::Redial),
5775 37 => Ok(TelephonyDevice::Transfer),
5776 38 => Ok(TelephonyDevice::Drop),
5777 39 => Ok(TelephonyDevice::Park),
5778 40 => Ok(TelephonyDevice::ForwardCalls),
5779 41 => Ok(TelephonyDevice::AlternateFunction),
5780 42 => Ok(TelephonyDevice::Line),
5781 43 => Ok(TelephonyDevice::SpeakerPhone),
5782 44 => Ok(TelephonyDevice::Conference),
5783 45 => Ok(TelephonyDevice::RingEnable),
5784 46 => Ok(TelephonyDevice::RingSelect),
5785 47 => Ok(TelephonyDevice::PhoneMute),
5786 48 => Ok(TelephonyDevice::CallerID),
5787 49 => Ok(TelephonyDevice::Send),
5788 80 => Ok(TelephonyDevice::SpeedDial),
5789 81 => Ok(TelephonyDevice::StoreNumber),
5790 82 => Ok(TelephonyDevice::RecallNumber),
5791 83 => Ok(TelephonyDevice::PhoneDirectory),
5792 112 => Ok(TelephonyDevice::VoiceMail),
5793 113 => Ok(TelephonyDevice::ScreenCalls),
5794 114 => Ok(TelephonyDevice::DoNotDisturb),
5795 115 => Ok(TelephonyDevice::Message),
5796 116 => Ok(TelephonyDevice::AnswerOnOff),
5797 144 => Ok(TelephonyDevice::InsideDialTone),
5798 145 => Ok(TelephonyDevice::OutsideDialTone),
5799 146 => Ok(TelephonyDevice::InsideRingTone),
5800 147 => Ok(TelephonyDevice::OutsideRingTone),
5801 148 => Ok(TelephonyDevice::PriorityRingTone),
5802 149 => Ok(TelephonyDevice::InsideRingback),
5803 150 => Ok(TelephonyDevice::PriorityRingback),
5804 151 => Ok(TelephonyDevice::LineBusyTone),
5805 152 => Ok(TelephonyDevice::ReorderTone),
5806 153 => Ok(TelephonyDevice::CallWaitingTone),
5807 154 => Ok(TelephonyDevice::ConfirmationTone1),
5808 155 => Ok(TelephonyDevice::ConfirmationTone2),
5809 156 => Ok(TelephonyDevice::TonesOff),
5810 157 => Ok(TelephonyDevice::OutsideRingback),
5811 158 => Ok(TelephonyDevice::Ringer),
5812 176 => Ok(TelephonyDevice::PhoneKey0),
5813 177 => Ok(TelephonyDevice::PhoneKey1),
5814 178 => Ok(TelephonyDevice::PhoneKey2),
5815 179 => Ok(TelephonyDevice::PhoneKey3),
5816 180 => Ok(TelephonyDevice::PhoneKey4),
5817 181 => Ok(TelephonyDevice::PhoneKey5),
5818 182 => Ok(TelephonyDevice::PhoneKey6),
5819 183 => Ok(TelephonyDevice::PhoneKey7),
5820 184 => Ok(TelephonyDevice::PhoneKey8),
5821 185 => Ok(TelephonyDevice::PhoneKey9),
5822 186 => Ok(TelephonyDevice::PhoneKeyStar),
5823 187 => Ok(TelephonyDevice::PhoneKeyPound),
5824 188 => Ok(TelephonyDevice::PhoneKeyA),
5825 189 => Ok(TelephonyDevice::PhoneKeyB),
5826 190 => Ok(TelephonyDevice::PhoneKeyC),
5827 191 => Ok(TelephonyDevice::PhoneKeyD),
5828 192 => Ok(TelephonyDevice::PhoneCallHistoryKey),
5829 193 => Ok(TelephonyDevice::PhoneCallerIDKey),
5830 194 => Ok(TelephonyDevice::PhoneSettingsKey),
5831 240 => Ok(TelephonyDevice::HostControl),
5832 241 => Ok(TelephonyDevice::HostAvailable),
5833 242 => Ok(TelephonyDevice::HostCallActive),
5834 243 => Ok(TelephonyDevice::ActivateHandsetAudio),
5835 244 => Ok(TelephonyDevice::RingType),
5836 245 => Ok(TelephonyDevice::RedialablePhoneNumber),
5837 248 => Ok(TelephonyDevice::StopRingTone),
5838 249 => Ok(TelephonyDevice::PSTNRingTone),
5839 250 => Ok(TelephonyDevice::HostRingTone),
5840 251 => Ok(TelephonyDevice::AlertSoundError),
5841 252 => Ok(TelephonyDevice::AlertSoundConfirm),
5842 253 => Ok(TelephonyDevice::AlertSoundNotification),
5843 254 => Ok(TelephonyDevice::SilentRing),
5844 264 => Ok(TelephonyDevice::EmailMessageWaiting),
5845 265 => Ok(TelephonyDevice::VoicemailMessageWaiting),
5846 266 => Ok(TelephonyDevice::HostHold),
5847 272 => Ok(TelephonyDevice::IncomingCallHistoryCount),
5848 273 => Ok(TelephonyDevice::OutgoingCallHistoryCount),
5849 274 => Ok(TelephonyDevice::IncomingCallHistory),
5850 275 => Ok(TelephonyDevice::OutgoingCallHistory),
5851 276 => Ok(TelephonyDevice::PhoneLocale),
5852 320 => Ok(TelephonyDevice::PhoneTimeSecond),
5853 321 => Ok(TelephonyDevice::PhoneTimeMinute),
5854 322 => Ok(TelephonyDevice::PhoneTimeHour),
5855 323 => Ok(TelephonyDevice::PhoneDateDay),
5856 324 => Ok(TelephonyDevice::PhoneDateMonth),
5857 325 => Ok(TelephonyDevice::PhoneDateYear),
5858 326 => Ok(TelephonyDevice::HandsetNickname),
5859 327 => Ok(TelephonyDevice::AddressBookID),
5860 330 => Ok(TelephonyDevice::CallDuration),
5861 331 => Ok(TelephonyDevice::DualModePhone),
5862 n => Err(HutError::UnknownUsageId { usage_id: n }),
5863 }
5864 }
5865}
5866
5867impl BitOr<u16> for TelephonyDevice {
5868 type Output = Usage;
5869
5870 fn bitor(self, usage: u16) -> Usage {
5877 let up = u16::from(self) as u32;
5878 let u = usage as u32;
5879 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
5880 }
5881}
5882
5883#[allow(non_camel_case_types)]
5904#[derive(Debug)]
5905#[non_exhaustive]
5906pub enum Consumer {
5907 ConsumerControl,
5909 NumericKeyPad,
5911 ProgrammableButtons,
5913 Microphone,
5915 Headphone,
5917 GraphicEqualizer,
5919 Plus10,
5921 Plus100,
5923 AMPM,
5925 Power,
5927 Reset,
5929 Sleep,
5931 SleepAfter,
5933 SleepMode,
5935 Illumination,
5937 FunctionButtons,
5939 Menu,
5941 MenuPick,
5943 MenuUp,
5945 MenuDown,
5947 MenuLeft,
5949 MenuRight,
5951 MenuEscape,
5953 MenuValueIncrease,
5955 MenuValueDecrease,
5957 DataOnScreen,
5959 ClosedCaption,
5961 ClosedCaptionSelect,
5963 VCRTV,
5965 BroadcastMode,
5967 Snapshot,
5969 Still,
5971 PictureinPictureToggle,
5973 PictureinPictureSwap,
5975 RedMenuButton,
5977 GreenMenuButton,
5979 BlueMenuButton,
5981 YellowMenuButton,
5983 Aspect,
5985 ThreeDModeSelect,
5987 DisplayBrightnessIncrement,
5989 DisplayBrightnessDecrement,
5991 DisplayBrightness,
5993 DisplayBacklightToggle,
5995 DisplaySetBrightnesstoMinimum,
5997 DisplaySetBrightnesstoMaximum,
5999 DisplaySetAutoBrightness,
6001 CameraAccessEnabled,
6003 CameraAccessDisabled,
6005 CameraAccessToggle,
6007 KeyboardBrightnessIncrement,
6009 KeyboardBrightnessDecrement,
6011 KeyboardBacklightSetLevel,
6013 KeyboardBacklightOOC,
6015 KeyboardBacklightSetMinimum,
6017 KeyboardBacklightSetMaximum,
6019 KeyboardBacklightAuto,
6021 Selection,
6023 AssignSelection,
6025 ModeStep,
6027 RecallLast,
6029 EnterChannel,
6031 OrderMovie,
6033 Channel,
6035 MediaSelection,
6037 MediaSelectComputer,
6039 MediaSelectTV,
6041 MediaSelectWWW,
6043 MediaSelectDVD,
6045 MediaSelectTelephone,
6047 MediaSelectProgramGuide,
6049 MediaSelectVideoPhone,
6051 MediaSelectGames,
6053 MediaSelectMessages,
6055 MediaSelectCD,
6057 MediaSelectVCR,
6059 MediaSelectTuner,
6061 Quit,
6063 Help,
6065 MediaSelectTape,
6067 MediaSelectCable,
6069 MediaSelectSatellite,
6071 MediaSelectSecurity,
6073 MediaSelectHome,
6075 MediaSelectCall,
6077 ChannelIncrement,
6079 ChannelDecrement,
6081 MediaSelectSAP,
6083 VCRPlus,
6085 Once,
6087 Daily,
6089 Weekly,
6091 Monthly,
6093 Play,
6095 Pause,
6097 Record,
6099 FastForward,
6101 Rewind,
6103 ScanNextTrack,
6105 ScanPreviousTrack,
6107 Stop,
6109 Eject,
6111 RandomPlay,
6113 SelectDisc,
6115 EnterDisc,
6117 Repeat,
6119 Tracking,
6121 TrackNormal,
6123 SlowTracking,
6125 FrameForward,
6127 FrameBack,
6129 Mark,
6131 ClearMark,
6133 RepeatFromMark,
6135 ReturnToMark,
6137 SearchMarkForward,
6139 SearchMarkBackwards,
6141 CounterReset,
6143 ShowCounter,
6145 TrackingIncrement,
6147 TrackingDecrement,
6149 StopEject,
6151 PlayPause,
6153 PlaySkip,
6155 VoiceCommand,
6157 InvokeCaptureInterface,
6159 StartorStopGameRecording,
6161 HistoricalGameCapture,
6163 CaptureGameScreenshot,
6165 ShoworHideRecordingIndicator,
6167 StartorStopMicrophoneCapture,
6169 StartorStopCameraCapture,
6171 StartorStopGameBroadcast,
6173 StartorStopVoiceDictationSession,
6175 InvokeDismissEmojiPicker,
6177 Volume,
6179 Balance,
6181 Mute,
6183 Bass,
6185 Treble,
6187 BassBoost,
6189 SurroundMode,
6191 Loudness,
6193 MPX,
6195 VolumeIncrement,
6197 VolumeDecrement,
6199 SpeedSelect,
6201 PlaybackSpeed,
6203 StandardPlay,
6205 LongPlay,
6207 ExtendedPlay,
6209 Slow,
6211 FanEnable,
6213 FanSpeed,
6215 LightEnable,
6217 LightIlluminationLevel,
6219 ClimateControlEnable,
6221 RoomTemperature,
6223 SecurityEnable,
6225 FireAlarm,
6227 PoliceAlarm,
6229 Proximity,
6231 Motion,
6233 DuressAlarm,
6235 HoldupAlarm,
6237 MedicalAlarm,
6239 BalanceRight,
6241 BalanceLeft,
6243 BassIncrement,
6245 BassDecrement,
6247 TrebleIncrement,
6249 TrebleDecrement,
6251 SpeakerSystem,
6253 ChannelLeft,
6255 ChannelRight,
6257 ChannelCenter,
6259 ChannelFront,
6261 ChannelCenterFront,
6263 ChannelSide,
6265 ChannelSurround,
6267 ChannelLowFrequencyEnhancement,
6269 ChannelTop,
6271 ChannelUnknown,
6273 Subchannel,
6275 SubchannelIncrement,
6277 SubchannelDecrement,
6279 AlternateAudioIncrement,
6281 AlternateAudioDecrement,
6283 ApplicationLaunchButtons,
6285 ALLaunchButtonConfigurationTool,
6287 ALProgrammableButtonConfiguration,
6289 ALConsumerControlConfiguration,
6291 ALWordProcessor,
6293 ALTextEditor,
6295 ALSpreadsheet,
6297 ALGraphicsEditor,
6299 ALPresentationApp,
6301 ALDatabaseApp,
6303 ALEmailReader,
6305 ALNewsreader,
6307 ALVoicemail,
6309 ALContactsAddressBook,
6311 ALCalendarSchedule,
6313 ALTaskProjectManager,
6315 ALLogJournalTimecard,
6317 ALCheckbookFinance,
6319 ALCalculator,
6321 ALAVCapturePlayback,
6323 ALLocalMachineBrowser,
6325 ALLANWANBrowser,
6327 ALInternetBrowser,
6329 ALRemoteNetworkingISPConnect,
6331 ALNetworkConference,
6333 ALNetworkChat,
6335 ALTelephonyDialer,
6337 ALLogon,
6339 ALLogoff,
6341 ALLogonLogoff,
6343 ALTerminalLockScreensaver,
6345 ALControlPanel,
6347 ALCommandLineProcessorRun,
6349 ALProcessTaskManager,
6351 ALSelectTaskApplication,
6353 ALNextTaskApplication,
6355 ALPreviousTaskApplication,
6357 ALPreemptiveHaltTaskApplication,
6359 ALIntegratedHelpCenter,
6361 ALDocuments,
6363 ALThesaurus,
6365 ALDictionary,
6367 ALDesktop,
6369 ALSpellCheck,
6371 ALGrammarCheck,
6373 ALWirelessStatus,
6375 ALKeyboardLayout,
6377 ALVirusProtection,
6379 ALEncryption,
6381 ALScreenSaver,
6383 ALAlarms,
6385 ALClock,
6387 ALFileBrowser,
6389 ALPowerStatus,
6391 ALImageBrowser,
6393 ALAudioBrowser,
6395 ALMovieBrowser,
6397 ALDigitalRightsManager,
6399 ALDigitalWallet,
6401 ALInstantMessaging,
6403 ALOEMFeaturesTipsTutorialBrowser,
6405 ALOEMHelp,
6407 ALOnlineCommunity,
6409 ALEntertainmentContentBrowser,
6411 ALOnlineShoppingBrowser,
6413 ALSmartCardInformationHelp,
6415 ALMarketMonitorFinanceBrowser,
6417 ALCustomizedCorporateNewsBrowser,
6419 ALOnlineActivityBrowser,
6421 ALResearchSearchBrowser,
6423 ALAudioPlayer,
6425 ALMessageStatus,
6427 ALContactSync,
6429 ALNavigation,
6431 ALContextawareDesktopAssistant,
6433 GenericGUIApplicationControls,
6435 ACNew,
6437 ACOpen,
6439 ACClose,
6441 ACExit,
6443 ACMaximize,
6445 ACMinimize,
6447 ACSave,
6449 ACPrint,
6451 ACProperties,
6453 ACUndo,
6455 ACCopy,
6457 ACCut,
6459 ACPaste,
6461 ACSelectAll,
6463 ACFind,
6465 ACFindandReplace,
6467 ACSearch,
6469 ACGoTo,
6471 ACHome,
6473 ACBack,
6475 ACForward,
6477 ACStop,
6479 ACRefresh,
6481 ACPreviousLink,
6483 ACNextLink,
6485 ACBookmarks,
6487 ACHistory,
6489 ACSubscriptions,
6491 ACZoomIn,
6493 ACZoomOut,
6495 ACZoom,
6497 ACFullScreenView,
6499 ACNormalView,
6501 ACViewToggle,
6503 ACScrollUp,
6505 ACScrollDown,
6507 ACScroll,
6509 ACPanLeft,
6511 ACPanRight,
6513 ACPan,
6515 ACNewWindow,
6517 ACTileHorizontally,
6519 ACTileVertically,
6521 ACFormat,
6523 ACEdit,
6525 ACBold,
6527 ACItalics,
6529 ACUnderline,
6531 ACStrikethrough,
6533 ACSubscript,
6535 ACSuperscript,
6537 ACAllCaps,
6539 ACRotate,
6541 ACResize,
6543 ACFlipHorizontal,
6545 ACFlipVertical,
6547 ACMirrorHorizontal,
6549 ACMirrorVertical,
6551 ACFontSelect,
6553 ACFontColor,
6555 ACFontSize,
6557 ACJustifyLeft,
6559 ACJustifyCenterH,
6561 ACJustifyRight,
6563 ACJustifyBlockH,
6565 ACJustifyTop,
6567 ACJustifyCenterV,
6569 ACJustifyBottom,
6571 ACJustifyBlockV,
6573 ACIndentDecrease,
6575 ACIndentIncrease,
6577 ACNumberedList,
6579 ACRestartNumbering,
6581 ACBulletedList,
6583 ACPromote,
6585 ACDemote,
6587 ACYes,
6589 ACNo,
6591 ACCancel,
6593 ACCatalog,
6595 ACBuyCheckout,
6597 ACAddtoCart,
6599 ACExpand,
6601 ACExpandAll,
6603 ACCollapse,
6605 ACCollapseAll,
6607 ACPrintPreview,
6609 ACPasteSpecial,
6611 ACInsertMode,
6613 ACDelete,
6615 ACLock,
6617 ACUnlock,
6619 ACProtect,
6621 ACUnprotect,
6623 ACAttachComment,
6625 ACDeleteComment,
6627 ACViewComment,
6629 ACSelectWord,
6631 ACSelectSentence,
6633 ACSelectParagraph,
6635 ACSelectColumn,
6637 ACSelectRow,
6639 ACSelectTable,
6641 ACSelectObject,
6643 ACRedoRepeat,
6645 ACSort,
6647 ACSortAscending,
6649 ACSortDescending,
6651 ACFilter,
6653 ACSetClock,
6655 ACViewClock,
6657 ACSelectTimeZone,
6659 ACEditTimeZones,
6661 ACSetAlarm,
6663 ACClearAlarm,
6665 ACSnoozeAlarm,
6667 ACResetAlarm,
6669 ACSynchronize,
6671 ACSendReceive,
6673 ACSendTo,
6675 ACReply,
6677 ACReplyAll,
6679 ACForwardMsg,
6681 ACSend,
6683 ACAttachFile,
6685 ACUpload,
6687 ACDownloadSaveTargetAs,
6689 ACSetBorders,
6691 ACInsertRow,
6693 ACInsertColumn,
6695 ACInsertFile,
6697 ACInsertPicture,
6699 ACInsertObject,
6701 ACInsertSymbol,
6703 ACSaveandClose,
6705 ACRename,
6707 ACMerge,
6709 ACSplit,
6711 ACDisributeHorizontally,
6713 ACDistributeVertically,
6715 ACNextKeyboardLayoutSelect,
6717 ACNavigationGuidance,
6719 ACDesktopShowAllWindows,
6721 ACSoftKeyLeft,
6723 ACSoftKeyRight,
6725 ACDesktopShowAllApplications,
6727 ACIdleKeepAlive,
6729 ExtendedKeyboardAttributesCollection,
6731 KeyboardFormFactor,
6733 KeyboardKeyType,
6735 KeyboardPhysicalLayout,
6737 VendorSpecificKeyboardPhysicalLayout,
6739 KeyboardIETFLanguageTagIndex,
6741 ImplementedKeyboardInputAssistControls,
6743 KeyboardInputAssistPrevious,
6745 KeyboardInputAssistNext,
6747 KeyboardInputAssistPreviousGroup,
6749 KeyboardInputAssistNextGroup,
6751 KeyboardInputAssistAccept,
6753 KeyboardInputAssistCancel,
6755 PrivacyScreenToggle,
6757 PrivacyScreenLevelDecrement,
6759 PrivacyScreenLevelIncrement,
6761 PrivacyScreenLevelMinimum,
6763 PrivacyScreenLevelMaximum,
6765 ContactEdited,
6767 ContactAdded,
6769 ContactRecordActive,
6771 ContactIndex,
6773 ContactNickname,
6775 ContactFirstName,
6777 ContactLastName,
6779 ContactFullName,
6781 ContactPhoneNumberPersonal,
6783 ContactPhoneNumberBusiness,
6785 ContactPhoneNumberMobile,
6787 ContactPhoneNumberPager,
6789 ContactPhoneNumberFax,
6791 ContactPhoneNumberOther,
6793 ContactEmailPersonal,
6795 ContactEmailBusiness,
6797 ContactEmailOther,
6799 ContactEmailMain,
6801 ContactSpeedDialNumber,
6803 ContactStatusFlag,
6805 ContactMisc,
6807}
6808
6809impl Consumer {
6810 #[cfg(feature = "std")]
6811 pub fn name(&self) -> String {
6812 match self {
6813 Consumer::ConsumerControl => "Consumer Control",
6814 Consumer::NumericKeyPad => "Numeric Key Pad",
6815 Consumer::ProgrammableButtons => "Programmable Buttons",
6816 Consumer::Microphone => "Microphone",
6817 Consumer::Headphone => "Headphone",
6818 Consumer::GraphicEqualizer => "Graphic Equalizer",
6819 Consumer::Plus10 => "+10",
6820 Consumer::Plus100 => "+100",
6821 Consumer::AMPM => "AM/PM",
6822 Consumer::Power => "Power",
6823 Consumer::Reset => "Reset",
6824 Consumer::Sleep => "Sleep",
6825 Consumer::SleepAfter => "Sleep After",
6826 Consumer::SleepMode => "Sleep Mode",
6827 Consumer::Illumination => "Illumination",
6828 Consumer::FunctionButtons => "Function Buttons",
6829 Consumer::Menu => "Menu",
6830 Consumer::MenuPick => "Menu Pick",
6831 Consumer::MenuUp => "Menu Up",
6832 Consumer::MenuDown => "Menu Down",
6833 Consumer::MenuLeft => "Menu Left",
6834 Consumer::MenuRight => "Menu Right",
6835 Consumer::MenuEscape => "Menu Escape",
6836 Consumer::MenuValueIncrease => "Menu Value Increase",
6837 Consumer::MenuValueDecrease => "Menu Value Decrease",
6838 Consumer::DataOnScreen => "Data On Screen",
6839 Consumer::ClosedCaption => "Closed Caption",
6840 Consumer::ClosedCaptionSelect => "Closed Caption Select",
6841 Consumer::VCRTV => "VCR/TV",
6842 Consumer::BroadcastMode => "Broadcast Mode",
6843 Consumer::Snapshot => "Snapshot",
6844 Consumer::Still => "Still",
6845 Consumer::PictureinPictureToggle => "Picture-in-Picture Toggle",
6846 Consumer::PictureinPictureSwap => "Picture-in-Picture Swap",
6847 Consumer::RedMenuButton => "Red Menu Button",
6848 Consumer::GreenMenuButton => "Green Menu Button",
6849 Consumer::BlueMenuButton => "Blue Menu Button",
6850 Consumer::YellowMenuButton => "Yellow Menu Button",
6851 Consumer::Aspect => "Aspect",
6852 Consumer::ThreeDModeSelect => "3D Mode Select",
6853 Consumer::DisplayBrightnessIncrement => "Display Brightness Increment",
6854 Consumer::DisplayBrightnessDecrement => "Display Brightness Decrement",
6855 Consumer::DisplayBrightness => "Display Brightness",
6856 Consumer::DisplayBacklightToggle => "Display Backlight Toggle",
6857 Consumer::DisplaySetBrightnesstoMinimum => "Display Set Brightness to Minimum",
6858 Consumer::DisplaySetBrightnesstoMaximum => "Display Set Brightness to Maximum",
6859 Consumer::DisplaySetAutoBrightness => "Display Set Auto Brightness",
6860 Consumer::CameraAccessEnabled => "Camera Access Enabled",
6861 Consumer::CameraAccessDisabled => "Camera Access Disabled",
6862 Consumer::CameraAccessToggle => "Camera Access Toggle",
6863 Consumer::KeyboardBrightnessIncrement => "Keyboard Brightness Increment",
6864 Consumer::KeyboardBrightnessDecrement => "Keyboard Brightness Decrement",
6865 Consumer::KeyboardBacklightSetLevel => "Keyboard Backlight Set Level",
6866 Consumer::KeyboardBacklightOOC => "Keyboard Backlight OOC",
6867 Consumer::KeyboardBacklightSetMinimum => "Keyboard Backlight Set Minimum",
6868 Consumer::KeyboardBacklightSetMaximum => "Keyboard Backlight Set Maximum",
6869 Consumer::KeyboardBacklightAuto => "Keyboard Backlight Auto",
6870 Consumer::Selection => "Selection",
6871 Consumer::AssignSelection => "Assign Selection",
6872 Consumer::ModeStep => "Mode Step",
6873 Consumer::RecallLast => "Recall Last",
6874 Consumer::EnterChannel => "Enter Channel",
6875 Consumer::OrderMovie => "Order Movie",
6876 Consumer::Channel => "Channel",
6877 Consumer::MediaSelection => "Media Selection",
6878 Consumer::MediaSelectComputer => "Media Select Computer",
6879 Consumer::MediaSelectTV => "Media Select TV",
6880 Consumer::MediaSelectWWW => "Media Select WWW",
6881 Consumer::MediaSelectDVD => "Media Select DVD",
6882 Consumer::MediaSelectTelephone => "Media Select Telephone",
6883 Consumer::MediaSelectProgramGuide => "Media Select Program Guide",
6884 Consumer::MediaSelectVideoPhone => "Media Select Video Phone",
6885 Consumer::MediaSelectGames => "Media Select Games",
6886 Consumer::MediaSelectMessages => "Media Select Messages",
6887 Consumer::MediaSelectCD => "Media Select CD",
6888 Consumer::MediaSelectVCR => "Media Select VCR",
6889 Consumer::MediaSelectTuner => "Media Select Tuner",
6890 Consumer::Quit => "Quit",
6891 Consumer::Help => "Help",
6892 Consumer::MediaSelectTape => "Media Select Tape",
6893 Consumer::MediaSelectCable => "Media Select Cable",
6894 Consumer::MediaSelectSatellite => "Media Select Satellite",
6895 Consumer::MediaSelectSecurity => "Media Select Security",
6896 Consumer::MediaSelectHome => "Media Select Home",
6897 Consumer::MediaSelectCall => "Media Select Call",
6898 Consumer::ChannelIncrement => "Channel Increment",
6899 Consumer::ChannelDecrement => "Channel Decrement",
6900 Consumer::MediaSelectSAP => "Media Select SAP",
6901 Consumer::VCRPlus => "VCR Plus",
6902 Consumer::Once => "Once",
6903 Consumer::Daily => "Daily",
6904 Consumer::Weekly => "Weekly",
6905 Consumer::Monthly => "Monthly",
6906 Consumer::Play => "Play",
6907 Consumer::Pause => "Pause",
6908 Consumer::Record => "Record",
6909 Consumer::FastForward => "Fast Forward",
6910 Consumer::Rewind => "Rewind",
6911 Consumer::ScanNextTrack => "Scan Next Track",
6912 Consumer::ScanPreviousTrack => "Scan Previous Track",
6913 Consumer::Stop => "Stop",
6914 Consumer::Eject => "Eject",
6915 Consumer::RandomPlay => "Random Play",
6916 Consumer::SelectDisc => "Select Disc",
6917 Consumer::EnterDisc => "Enter Disc",
6918 Consumer::Repeat => "Repeat",
6919 Consumer::Tracking => "Tracking",
6920 Consumer::TrackNormal => "Track Normal",
6921 Consumer::SlowTracking => "Slow Tracking",
6922 Consumer::FrameForward => "Frame Forward",
6923 Consumer::FrameBack => "Frame Back",
6924 Consumer::Mark => "Mark",
6925 Consumer::ClearMark => "Clear Mark",
6926 Consumer::RepeatFromMark => "Repeat From Mark",
6927 Consumer::ReturnToMark => "Return To Mark",
6928 Consumer::SearchMarkForward => "Search Mark Forward",
6929 Consumer::SearchMarkBackwards => "Search Mark Backwards",
6930 Consumer::CounterReset => "Counter Reset",
6931 Consumer::ShowCounter => "Show Counter",
6932 Consumer::TrackingIncrement => "Tracking Increment",
6933 Consumer::TrackingDecrement => "Tracking Decrement",
6934 Consumer::StopEject => "Stop/Eject",
6935 Consumer::PlayPause => "Play/Pause",
6936 Consumer::PlaySkip => "Play/Skip",
6937 Consumer::VoiceCommand => "Voice Command",
6938 Consumer::InvokeCaptureInterface => "Invoke Capture Interface",
6939 Consumer::StartorStopGameRecording => "Start or Stop Game Recording",
6940 Consumer::HistoricalGameCapture => "Historical Game Capture",
6941 Consumer::CaptureGameScreenshot => "Capture Game Screenshot",
6942 Consumer::ShoworHideRecordingIndicator => "Show or Hide Recording Indicator",
6943 Consumer::StartorStopMicrophoneCapture => "Start or Stop Microphone Capture",
6944 Consumer::StartorStopCameraCapture => "Start or Stop Camera Capture",
6945 Consumer::StartorStopGameBroadcast => "Start or Stop Game Broadcast",
6946 Consumer::StartorStopVoiceDictationSession => "Start or Stop Voice Dictation Session",
6947 Consumer::InvokeDismissEmojiPicker => "Invoke/Dismiss Emoji Picker",
6948 Consumer::Volume => "Volume",
6949 Consumer::Balance => "Balance",
6950 Consumer::Mute => "Mute",
6951 Consumer::Bass => "Bass",
6952 Consumer::Treble => "Treble",
6953 Consumer::BassBoost => "Bass Boost",
6954 Consumer::SurroundMode => "Surround Mode",
6955 Consumer::Loudness => "Loudness",
6956 Consumer::MPX => "MPX",
6957 Consumer::VolumeIncrement => "Volume Increment",
6958 Consumer::VolumeDecrement => "Volume Decrement",
6959 Consumer::SpeedSelect => "Speed Select",
6960 Consumer::PlaybackSpeed => "Playback Speed",
6961 Consumer::StandardPlay => "Standard Play",
6962 Consumer::LongPlay => "Long Play",
6963 Consumer::ExtendedPlay => "Extended Play",
6964 Consumer::Slow => "Slow",
6965 Consumer::FanEnable => "Fan Enable",
6966 Consumer::FanSpeed => "Fan Speed",
6967 Consumer::LightEnable => "Light Enable",
6968 Consumer::LightIlluminationLevel => "Light Illumination Level",
6969 Consumer::ClimateControlEnable => "Climate Control Enable",
6970 Consumer::RoomTemperature => "Room Temperature",
6971 Consumer::SecurityEnable => "Security Enable",
6972 Consumer::FireAlarm => "Fire Alarm",
6973 Consumer::PoliceAlarm => "Police Alarm",
6974 Consumer::Proximity => "Proximity",
6975 Consumer::Motion => "Motion",
6976 Consumer::DuressAlarm => "Duress Alarm",
6977 Consumer::HoldupAlarm => "Holdup Alarm",
6978 Consumer::MedicalAlarm => "Medical Alarm",
6979 Consumer::BalanceRight => "Balance Right",
6980 Consumer::BalanceLeft => "Balance Left",
6981 Consumer::BassIncrement => "Bass Increment",
6982 Consumer::BassDecrement => "Bass Decrement",
6983 Consumer::TrebleIncrement => "Treble Increment",
6984 Consumer::TrebleDecrement => "Treble Decrement",
6985 Consumer::SpeakerSystem => "Speaker System",
6986 Consumer::ChannelLeft => "Channel Left",
6987 Consumer::ChannelRight => "Channel Right",
6988 Consumer::ChannelCenter => "Channel Center",
6989 Consumer::ChannelFront => "Channel Front",
6990 Consumer::ChannelCenterFront => "Channel Center Front",
6991 Consumer::ChannelSide => "Channel Side",
6992 Consumer::ChannelSurround => "Channel Surround",
6993 Consumer::ChannelLowFrequencyEnhancement => "Channel Low Frequency Enhancement",
6994 Consumer::ChannelTop => "Channel Top",
6995 Consumer::ChannelUnknown => "Channel Unknown",
6996 Consumer::Subchannel => "Sub-channel",
6997 Consumer::SubchannelIncrement => "Sub-channel Increment",
6998 Consumer::SubchannelDecrement => "Sub-channel Decrement",
6999 Consumer::AlternateAudioIncrement => "Alternate Audio Increment",
7000 Consumer::AlternateAudioDecrement => "Alternate Audio Decrement",
7001 Consumer::ApplicationLaunchButtons => "Application Launch Buttons",
7002 Consumer::ALLaunchButtonConfigurationTool => "AL Launch Button Configuration Tool",
7003 Consumer::ALProgrammableButtonConfiguration => "AL Programmable Button Configuration",
7004 Consumer::ALConsumerControlConfiguration => "AL Consumer Control Configuration",
7005 Consumer::ALWordProcessor => "AL Word Processor",
7006 Consumer::ALTextEditor => "AL Text Editor",
7007 Consumer::ALSpreadsheet => "AL Spreadsheet",
7008 Consumer::ALGraphicsEditor => "AL Graphics Editor",
7009 Consumer::ALPresentationApp => "AL Presentation App",
7010 Consumer::ALDatabaseApp => "AL Database App",
7011 Consumer::ALEmailReader => "AL Email Reader",
7012 Consumer::ALNewsreader => "AL Newsreader",
7013 Consumer::ALVoicemail => "AL Voicemail",
7014 Consumer::ALContactsAddressBook => "AL Contacts/Address Book",
7015 Consumer::ALCalendarSchedule => "AL Calendar/Schedule",
7016 Consumer::ALTaskProjectManager => "AL Task/Project Manager",
7017 Consumer::ALLogJournalTimecard => "AL Log/Journal/Timecard",
7018 Consumer::ALCheckbookFinance => "AL Checkbook/Finance",
7019 Consumer::ALCalculator => "AL Calculator",
7020 Consumer::ALAVCapturePlayback => "AL A/V Capture/Playback",
7021 Consumer::ALLocalMachineBrowser => "AL Local Machine Browser",
7022 Consumer::ALLANWANBrowser => "AL LAN/WAN Browser",
7023 Consumer::ALInternetBrowser => "AL Internet Browser",
7024 Consumer::ALRemoteNetworkingISPConnect => "AL Remote Networking/ISP Connect",
7025 Consumer::ALNetworkConference => "AL Network Conference",
7026 Consumer::ALNetworkChat => "AL Network Chat",
7027 Consumer::ALTelephonyDialer => "AL Telephony/Dialer",
7028 Consumer::ALLogon => "AL Logon",
7029 Consumer::ALLogoff => "AL Logoff",
7030 Consumer::ALLogonLogoff => "AL Logon/Logoff",
7031 Consumer::ALTerminalLockScreensaver => "AL Terminal Lock/Screensaver",
7032 Consumer::ALControlPanel => "AL Control Panel",
7033 Consumer::ALCommandLineProcessorRun => "AL Command Line Processor/Run",
7034 Consumer::ALProcessTaskManager => "AL Process/Task Manager",
7035 Consumer::ALSelectTaskApplication => "AL Select Task/Application",
7036 Consumer::ALNextTaskApplication => "AL Next Task/Application",
7037 Consumer::ALPreviousTaskApplication => "AL Previous Task/Application",
7038 Consumer::ALPreemptiveHaltTaskApplication => "AL Preemptive Halt Task/Application",
7039 Consumer::ALIntegratedHelpCenter => "AL Integrated Help Center",
7040 Consumer::ALDocuments => "AL Documents",
7041 Consumer::ALThesaurus => "AL Thesaurus",
7042 Consumer::ALDictionary => "AL Dictionary",
7043 Consumer::ALDesktop => "AL Desktop",
7044 Consumer::ALSpellCheck => "AL Spell Check",
7045 Consumer::ALGrammarCheck => "AL Grammar Check",
7046 Consumer::ALWirelessStatus => "AL Wireless Status",
7047 Consumer::ALKeyboardLayout => "AL Keyboard Layout",
7048 Consumer::ALVirusProtection => "AL Virus Protection",
7049 Consumer::ALEncryption => "AL Encryption",
7050 Consumer::ALScreenSaver => "AL Screen Saver",
7051 Consumer::ALAlarms => "AL Alarms",
7052 Consumer::ALClock => "AL Clock",
7053 Consumer::ALFileBrowser => "AL File Browser",
7054 Consumer::ALPowerStatus => "AL Power Status",
7055 Consumer::ALImageBrowser => "AL Image Browser",
7056 Consumer::ALAudioBrowser => "AL Audio Browser",
7057 Consumer::ALMovieBrowser => "AL Movie Browser",
7058 Consumer::ALDigitalRightsManager => "AL Digital Rights Manager",
7059 Consumer::ALDigitalWallet => "AL Digital Wallet",
7060 Consumer::ALInstantMessaging => "AL Instant Messaging",
7061 Consumer::ALOEMFeaturesTipsTutorialBrowser => "AL OEM Features/ Tips/Tutorial Browser",
7062 Consumer::ALOEMHelp => "AL OEM Help",
7063 Consumer::ALOnlineCommunity => "AL Online Community",
7064 Consumer::ALEntertainmentContentBrowser => "AL Entertainment Content Browser",
7065 Consumer::ALOnlineShoppingBrowser => "AL Online Shopping Browser",
7066 Consumer::ALSmartCardInformationHelp => "AL SmartCard Information/Help",
7067 Consumer::ALMarketMonitorFinanceBrowser => "AL Market Monitor/Finance Browser",
7068 Consumer::ALCustomizedCorporateNewsBrowser => "AL Customized Corporate News Browser",
7069 Consumer::ALOnlineActivityBrowser => "AL Online Activity Browser",
7070 Consumer::ALResearchSearchBrowser => "AL Research/Search Browser",
7071 Consumer::ALAudioPlayer => "AL Audio Player",
7072 Consumer::ALMessageStatus => "AL Message Status",
7073 Consumer::ALContactSync => "AL Contact Sync",
7074 Consumer::ALNavigation => "AL Navigation",
7075 Consumer::ALContextawareDesktopAssistant => "AL Context‐aware Desktop Assistant",
7076 Consumer::GenericGUIApplicationControls => "Generic GUI Application Controls",
7077 Consumer::ACNew => "AC New",
7078 Consumer::ACOpen => "AC Open",
7079 Consumer::ACClose => "AC Close",
7080 Consumer::ACExit => "AC Exit",
7081 Consumer::ACMaximize => "AC Maximize",
7082 Consumer::ACMinimize => "AC Minimize",
7083 Consumer::ACSave => "AC Save",
7084 Consumer::ACPrint => "AC Print",
7085 Consumer::ACProperties => "AC Properties",
7086 Consumer::ACUndo => "AC Undo",
7087 Consumer::ACCopy => "AC Copy",
7088 Consumer::ACCut => "AC Cut",
7089 Consumer::ACPaste => "AC Paste",
7090 Consumer::ACSelectAll => "AC Select All",
7091 Consumer::ACFind => "AC Find",
7092 Consumer::ACFindandReplace => "AC Find and Replace",
7093 Consumer::ACSearch => "AC Search",
7094 Consumer::ACGoTo => "AC Go To",
7095 Consumer::ACHome => "AC Home",
7096 Consumer::ACBack => "AC Back",
7097 Consumer::ACForward => "AC Forward",
7098 Consumer::ACStop => "AC Stop",
7099 Consumer::ACRefresh => "AC Refresh",
7100 Consumer::ACPreviousLink => "AC Previous Link",
7101 Consumer::ACNextLink => "AC Next Link",
7102 Consumer::ACBookmarks => "AC Bookmarks",
7103 Consumer::ACHistory => "AC History",
7104 Consumer::ACSubscriptions => "AC Subscriptions",
7105 Consumer::ACZoomIn => "AC Zoom In",
7106 Consumer::ACZoomOut => "AC Zoom Out",
7107 Consumer::ACZoom => "AC Zoom",
7108 Consumer::ACFullScreenView => "AC Full Screen View",
7109 Consumer::ACNormalView => "AC Normal View",
7110 Consumer::ACViewToggle => "AC View Toggle",
7111 Consumer::ACScrollUp => "AC Scroll Up",
7112 Consumer::ACScrollDown => "AC Scroll Down",
7113 Consumer::ACScroll => "AC Scroll",
7114 Consumer::ACPanLeft => "AC Pan Left",
7115 Consumer::ACPanRight => "AC Pan Right",
7116 Consumer::ACPan => "AC Pan",
7117 Consumer::ACNewWindow => "AC New Window",
7118 Consumer::ACTileHorizontally => "AC Tile Horizontally",
7119 Consumer::ACTileVertically => "AC Tile Vertically",
7120 Consumer::ACFormat => "AC Format",
7121 Consumer::ACEdit => "AC Edit",
7122 Consumer::ACBold => "AC Bold",
7123 Consumer::ACItalics => "AC Italics",
7124 Consumer::ACUnderline => "AC Underline",
7125 Consumer::ACStrikethrough => "AC Strikethrough",
7126 Consumer::ACSubscript => "AC Subscript",
7127 Consumer::ACSuperscript => "AC Superscript",
7128 Consumer::ACAllCaps => "AC All Caps",
7129 Consumer::ACRotate => "AC Rotate",
7130 Consumer::ACResize => "AC Resize",
7131 Consumer::ACFlipHorizontal => "AC Flip Horizontal",
7132 Consumer::ACFlipVertical => "AC Flip Vertical",
7133 Consumer::ACMirrorHorizontal => "AC Mirror Horizontal",
7134 Consumer::ACMirrorVertical => "AC Mirror Vertical",
7135 Consumer::ACFontSelect => "AC Font Select",
7136 Consumer::ACFontColor => "AC Font Color",
7137 Consumer::ACFontSize => "AC Font Size",
7138 Consumer::ACJustifyLeft => "AC Justify Left",
7139 Consumer::ACJustifyCenterH => "AC Justify Center H",
7140 Consumer::ACJustifyRight => "AC Justify Right",
7141 Consumer::ACJustifyBlockH => "AC Justify Block H",
7142 Consumer::ACJustifyTop => "AC Justify Top",
7143 Consumer::ACJustifyCenterV => "AC Justify Center V",
7144 Consumer::ACJustifyBottom => "AC Justify Bottom",
7145 Consumer::ACJustifyBlockV => "AC Justify Block V",
7146 Consumer::ACIndentDecrease => "AC Indent Decrease",
7147 Consumer::ACIndentIncrease => "AC Indent Increase",
7148 Consumer::ACNumberedList => "AC Numbered List",
7149 Consumer::ACRestartNumbering => "AC Restart Numbering",
7150 Consumer::ACBulletedList => "AC Bulleted List",
7151 Consumer::ACPromote => "AC Promote",
7152 Consumer::ACDemote => "AC Demote",
7153 Consumer::ACYes => "AC Yes",
7154 Consumer::ACNo => "AC No",
7155 Consumer::ACCancel => "AC Cancel",
7156 Consumer::ACCatalog => "AC Catalog",
7157 Consumer::ACBuyCheckout => "AC Buy/Checkout",
7158 Consumer::ACAddtoCart => "AC Add to Cart",
7159 Consumer::ACExpand => "AC Expand",
7160 Consumer::ACExpandAll => "AC Expand All",
7161 Consumer::ACCollapse => "AC Collapse",
7162 Consumer::ACCollapseAll => "AC Collapse All",
7163 Consumer::ACPrintPreview => "AC Print Preview",
7164 Consumer::ACPasteSpecial => "AC Paste Special",
7165 Consumer::ACInsertMode => "AC Insert Mode",
7166 Consumer::ACDelete => "AC Delete",
7167 Consumer::ACLock => "AC Lock",
7168 Consumer::ACUnlock => "AC Unlock",
7169 Consumer::ACProtect => "AC Protect",
7170 Consumer::ACUnprotect => "AC Unprotect",
7171 Consumer::ACAttachComment => "AC Attach Comment",
7172 Consumer::ACDeleteComment => "AC Delete Comment",
7173 Consumer::ACViewComment => "AC View Comment",
7174 Consumer::ACSelectWord => "AC Select Word",
7175 Consumer::ACSelectSentence => "AC Select Sentence",
7176 Consumer::ACSelectParagraph => "AC Select Paragraph",
7177 Consumer::ACSelectColumn => "AC Select Column",
7178 Consumer::ACSelectRow => "AC Select Row",
7179 Consumer::ACSelectTable => "AC Select Table",
7180 Consumer::ACSelectObject => "AC Select Object",
7181 Consumer::ACRedoRepeat => "AC Redo/Repeat",
7182 Consumer::ACSort => "AC Sort",
7183 Consumer::ACSortAscending => "AC Sort Ascending",
7184 Consumer::ACSortDescending => "AC Sort Descending",
7185 Consumer::ACFilter => "AC Filter",
7186 Consumer::ACSetClock => "AC Set Clock",
7187 Consumer::ACViewClock => "AC View Clock",
7188 Consumer::ACSelectTimeZone => "AC Select Time Zone",
7189 Consumer::ACEditTimeZones => "AC Edit Time Zones",
7190 Consumer::ACSetAlarm => "AC Set Alarm",
7191 Consumer::ACClearAlarm => "AC Clear Alarm",
7192 Consumer::ACSnoozeAlarm => "AC Snooze Alarm",
7193 Consumer::ACResetAlarm => "AC Reset Alarm",
7194 Consumer::ACSynchronize => "AC Synchronize",
7195 Consumer::ACSendReceive => "AC Send/Receive",
7196 Consumer::ACSendTo => "AC Send To",
7197 Consumer::ACReply => "AC Reply",
7198 Consumer::ACReplyAll => "AC Reply All",
7199 Consumer::ACForwardMsg => "AC Forward Msg",
7200 Consumer::ACSend => "AC Send",
7201 Consumer::ACAttachFile => "AC Attach File",
7202 Consumer::ACUpload => "AC Upload",
7203 Consumer::ACDownloadSaveTargetAs => "AC Download (Save Target As)",
7204 Consumer::ACSetBorders => "AC Set Borders",
7205 Consumer::ACInsertRow => "AC Insert Row",
7206 Consumer::ACInsertColumn => "AC Insert Column",
7207 Consumer::ACInsertFile => "AC Insert File",
7208 Consumer::ACInsertPicture => "AC Insert Picture",
7209 Consumer::ACInsertObject => "AC Insert Object",
7210 Consumer::ACInsertSymbol => "AC Insert Symbol",
7211 Consumer::ACSaveandClose => "AC Save and Close",
7212 Consumer::ACRename => "AC Rename",
7213 Consumer::ACMerge => "AC Merge",
7214 Consumer::ACSplit => "AC Split",
7215 Consumer::ACDisributeHorizontally => "AC Disribute Horizontally",
7216 Consumer::ACDistributeVertically => "AC Distribute Vertically",
7217 Consumer::ACNextKeyboardLayoutSelect => "AC Next Keyboard Layout Select",
7218 Consumer::ACNavigationGuidance => "AC Navigation Guidance",
7219 Consumer::ACDesktopShowAllWindows => "AC Desktop Show All Windows",
7220 Consumer::ACSoftKeyLeft => "AC Soft Key Left",
7221 Consumer::ACSoftKeyRight => "AC Soft Key Right",
7222 Consumer::ACDesktopShowAllApplications => "AC Desktop Show All Applications",
7223 Consumer::ACIdleKeepAlive => "AC Idle Keep Alive",
7224 Consumer::ExtendedKeyboardAttributesCollection => {
7225 "Extended Keyboard Attributes Collection"
7226 }
7227 Consumer::KeyboardFormFactor => "Keyboard Form Factor",
7228 Consumer::KeyboardKeyType => "Keyboard Key Type",
7229 Consumer::KeyboardPhysicalLayout => "Keyboard Physical Layout",
7230 Consumer::VendorSpecificKeyboardPhysicalLayout => {
7231 "Vendor‐Specific Keyboard Physical Layout"
7232 }
7233 Consumer::KeyboardIETFLanguageTagIndex => "Keyboard IETF Language Tag Index",
7234 Consumer::ImplementedKeyboardInputAssistControls => {
7235 "Implemented Keyboard Input Assist Controls"
7236 }
7237 Consumer::KeyboardInputAssistPrevious => "Keyboard Input Assist Previous",
7238 Consumer::KeyboardInputAssistNext => "Keyboard Input Assist Next",
7239 Consumer::KeyboardInputAssistPreviousGroup => "Keyboard Input Assist Previous Group",
7240 Consumer::KeyboardInputAssistNextGroup => "Keyboard Input Assist Next Group",
7241 Consumer::KeyboardInputAssistAccept => "Keyboard Input Assist Accept",
7242 Consumer::KeyboardInputAssistCancel => "Keyboard Input Assist Cancel",
7243 Consumer::PrivacyScreenToggle => "Privacy Screen Toggle",
7244 Consumer::PrivacyScreenLevelDecrement => "Privacy Screen Level Decrement",
7245 Consumer::PrivacyScreenLevelIncrement => "Privacy Screen Level Increment",
7246 Consumer::PrivacyScreenLevelMinimum => "Privacy Screen Level Minimum",
7247 Consumer::PrivacyScreenLevelMaximum => "Privacy Screen Level Maximum",
7248 Consumer::ContactEdited => "Contact Edited",
7249 Consumer::ContactAdded => "Contact Added",
7250 Consumer::ContactRecordActive => "Contact Record Active",
7251 Consumer::ContactIndex => "Contact Index",
7252 Consumer::ContactNickname => "Contact Nickname",
7253 Consumer::ContactFirstName => "Contact First Name",
7254 Consumer::ContactLastName => "Contact Last Name",
7255 Consumer::ContactFullName => "Contact Full Name",
7256 Consumer::ContactPhoneNumberPersonal => "Contact Phone Number Personal",
7257 Consumer::ContactPhoneNumberBusiness => "Contact Phone Number Business",
7258 Consumer::ContactPhoneNumberMobile => "Contact Phone Number Mobile",
7259 Consumer::ContactPhoneNumberPager => "Contact Phone Number Pager",
7260 Consumer::ContactPhoneNumberFax => "Contact Phone Number Fax",
7261 Consumer::ContactPhoneNumberOther => "Contact Phone Number Other",
7262 Consumer::ContactEmailPersonal => "Contact Email Personal",
7263 Consumer::ContactEmailBusiness => "Contact Email Business",
7264 Consumer::ContactEmailOther => "Contact Email Other",
7265 Consumer::ContactEmailMain => "Contact Email Main",
7266 Consumer::ContactSpeedDialNumber => "Contact Speed Dial Number",
7267 Consumer::ContactStatusFlag => "Contact Status Flag",
7268 Consumer::ContactMisc => "Contact Misc.",
7269 }
7270 .into()
7271 }
7272}
7273
7274#[cfg(feature = "std")]
7275impl fmt::Display for Consumer {
7276 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
7277 write!(f, "{}", self.name())
7278 }
7279}
7280
7281impl AsUsage for Consumer {
7282 fn usage_value(&self) -> u32 {
7284 u32::from(self)
7285 }
7286
7287 fn usage_id_value(&self) -> u16 {
7289 u16::from(self)
7290 }
7291
7292 fn usage(&self) -> Usage {
7303 Usage::from(self)
7304 }
7305}
7306
7307impl AsUsagePage for Consumer {
7308 fn usage_page_value(&self) -> u16 {
7312 let up = UsagePage::from(self);
7313 u16::from(up)
7314 }
7315
7316 fn usage_page(&self) -> UsagePage {
7318 UsagePage::from(self)
7319 }
7320}
7321
7322impl From<&Consumer> for u16 {
7323 fn from(consumer: &Consumer) -> u16 {
7324 match *consumer {
7325 Consumer::ConsumerControl => 1,
7326 Consumer::NumericKeyPad => 2,
7327 Consumer::ProgrammableButtons => 3,
7328 Consumer::Microphone => 4,
7329 Consumer::Headphone => 5,
7330 Consumer::GraphicEqualizer => 6,
7331 Consumer::Plus10 => 32,
7332 Consumer::Plus100 => 33,
7333 Consumer::AMPM => 34,
7334 Consumer::Power => 48,
7335 Consumer::Reset => 49,
7336 Consumer::Sleep => 50,
7337 Consumer::SleepAfter => 51,
7338 Consumer::SleepMode => 52,
7339 Consumer::Illumination => 53,
7340 Consumer::FunctionButtons => 54,
7341 Consumer::Menu => 64,
7342 Consumer::MenuPick => 65,
7343 Consumer::MenuUp => 66,
7344 Consumer::MenuDown => 67,
7345 Consumer::MenuLeft => 68,
7346 Consumer::MenuRight => 69,
7347 Consumer::MenuEscape => 70,
7348 Consumer::MenuValueIncrease => 71,
7349 Consumer::MenuValueDecrease => 72,
7350 Consumer::DataOnScreen => 96,
7351 Consumer::ClosedCaption => 97,
7352 Consumer::ClosedCaptionSelect => 98,
7353 Consumer::VCRTV => 99,
7354 Consumer::BroadcastMode => 100,
7355 Consumer::Snapshot => 101,
7356 Consumer::Still => 102,
7357 Consumer::PictureinPictureToggle => 103,
7358 Consumer::PictureinPictureSwap => 104,
7359 Consumer::RedMenuButton => 105,
7360 Consumer::GreenMenuButton => 106,
7361 Consumer::BlueMenuButton => 107,
7362 Consumer::YellowMenuButton => 108,
7363 Consumer::Aspect => 109,
7364 Consumer::ThreeDModeSelect => 110,
7365 Consumer::DisplayBrightnessIncrement => 111,
7366 Consumer::DisplayBrightnessDecrement => 112,
7367 Consumer::DisplayBrightness => 113,
7368 Consumer::DisplayBacklightToggle => 114,
7369 Consumer::DisplaySetBrightnesstoMinimum => 115,
7370 Consumer::DisplaySetBrightnesstoMaximum => 116,
7371 Consumer::DisplaySetAutoBrightness => 117,
7372 Consumer::CameraAccessEnabled => 118,
7373 Consumer::CameraAccessDisabled => 119,
7374 Consumer::CameraAccessToggle => 120,
7375 Consumer::KeyboardBrightnessIncrement => 121,
7376 Consumer::KeyboardBrightnessDecrement => 122,
7377 Consumer::KeyboardBacklightSetLevel => 123,
7378 Consumer::KeyboardBacklightOOC => 124,
7379 Consumer::KeyboardBacklightSetMinimum => 125,
7380 Consumer::KeyboardBacklightSetMaximum => 126,
7381 Consumer::KeyboardBacklightAuto => 127,
7382 Consumer::Selection => 128,
7383 Consumer::AssignSelection => 129,
7384 Consumer::ModeStep => 130,
7385 Consumer::RecallLast => 131,
7386 Consumer::EnterChannel => 132,
7387 Consumer::OrderMovie => 133,
7388 Consumer::Channel => 134,
7389 Consumer::MediaSelection => 135,
7390 Consumer::MediaSelectComputer => 136,
7391 Consumer::MediaSelectTV => 137,
7392 Consumer::MediaSelectWWW => 138,
7393 Consumer::MediaSelectDVD => 139,
7394 Consumer::MediaSelectTelephone => 140,
7395 Consumer::MediaSelectProgramGuide => 141,
7396 Consumer::MediaSelectVideoPhone => 142,
7397 Consumer::MediaSelectGames => 143,
7398 Consumer::MediaSelectMessages => 144,
7399 Consumer::MediaSelectCD => 145,
7400 Consumer::MediaSelectVCR => 146,
7401 Consumer::MediaSelectTuner => 147,
7402 Consumer::Quit => 148,
7403 Consumer::Help => 149,
7404 Consumer::MediaSelectTape => 150,
7405 Consumer::MediaSelectCable => 151,
7406 Consumer::MediaSelectSatellite => 152,
7407 Consumer::MediaSelectSecurity => 153,
7408 Consumer::MediaSelectHome => 154,
7409 Consumer::MediaSelectCall => 155,
7410 Consumer::ChannelIncrement => 156,
7411 Consumer::ChannelDecrement => 157,
7412 Consumer::MediaSelectSAP => 158,
7413 Consumer::VCRPlus => 160,
7414 Consumer::Once => 161,
7415 Consumer::Daily => 162,
7416 Consumer::Weekly => 163,
7417 Consumer::Monthly => 164,
7418 Consumer::Play => 176,
7419 Consumer::Pause => 177,
7420 Consumer::Record => 178,
7421 Consumer::FastForward => 179,
7422 Consumer::Rewind => 180,
7423 Consumer::ScanNextTrack => 181,
7424 Consumer::ScanPreviousTrack => 182,
7425 Consumer::Stop => 183,
7426 Consumer::Eject => 184,
7427 Consumer::RandomPlay => 185,
7428 Consumer::SelectDisc => 186,
7429 Consumer::EnterDisc => 187,
7430 Consumer::Repeat => 188,
7431 Consumer::Tracking => 189,
7432 Consumer::TrackNormal => 190,
7433 Consumer::SlowTracking => 191,
7434 Consumer::FrameForward => 192,
7435 Consumer::FrameBack => 193,
7436 Consumer::Mark => 194,
7437 Consumer::ClearMark => 195,
7438 Consumer::RepeatFromMark => 196,
7439 Consumer::ReturnToMark => 197,
7440 Consumer::SearchMarkForward => 198,
7441 Consumer::SearchMarkBackwards => 199,
7442 Consumer::CounterReset => 200,
7443 Consumer::ShowCounter => 201,
7444 Consumer::TrackingIncrement => 202,
7445 Consumer::TrackingDecrement => 203,
7446 Consumer::StopEject => 204,
7447 Consumer::PlayPause => 205,
7448 Consumer::PlaySkip => 206,
7449 Consumer::VoiceCommand => 207,
7450 Consumer::InvokeCaptureInterface => 208,
7451 Consumer::StartorStopGameRecording => 209,
7452 Consumer::HistoricalGameCapture => 210,
7453 Consumer::CaptureGameScreenshot => 211,
7454 Consumer::ShoworHideRecordingIndicator => 212,
7455 Consumer::StartorStopMicrophoneCapture => 213,
7456 Consumer::StartorStopCameraCapture => 214,
7457 Consumer::StartorStopGameBroadcast => 215,
7458 Consumer::StartorStopVoiceDictationSession => 216,
7459 Consumer::InvokeDismissEmojiPicker => 217,
7460 Consumer::Volume => 224,
7461 Consumer::Balance => 225,
7462 Consumer::Mute => 226,
7463 Consumer::Bass => 227,
7464 Consumer::Treble => 228,
7465 Consumer::BassBoost => 229,
7466 Consumer::SurroundMode => 230,
7467 Consumer::Loudness => 231,
7468 Consumer::MPX => 232,
7469 Consumer::VolumeIncrement => 233,
7470 Consumer::VolumeDecrement => 234,
7471 Consumer::SpeedSelect => 240,
7472 Consumer::PlaybackSpeed => 241,
7473 Consumer::StandardPlay => 242,
7474 Consumer::LongPlay => 243,
7475 Consumer::ExtendedPlay => 244,
7476 Consumer::Slow => 245,
7477 Consumer::FanEnable => 256,
7478 Consumer::FanSpeed => 257,
7479 Consumer::LightEnable => 258,
7480 Consumer::LightIlluminationLevel => 259,
7481 Consumer::ClimateControlEnable => 260,
7482 Consumer::RoomTemperature => 261,
7483 Consumer::SecurityEnable => 262,
7484 Consumer::FireAlarm => 263,
7485 Consumer::PoliceAlarm => 264,
7486 Consumer::Proximity => 265,
7487 Consumer::Motion => 266,
7488 Consumer::DuressAlarm => 267,
7489 Consumer::HoldupAlarm => 268,
7490 Consumer::MedicalAlarm => 269,
7491 Consumer::BalanceRight => 336,
7492 Consumer::BalanceLeft => 337,
7493 Consumer::BassIncrement => 338,
7494 Consumer::BassDecrement => 339,
7495 Consumer::TrebleIncrement => 340,
7496 Consumer::TrebleDecrement => 341,
7497 Consumer::SpeakerSystem => 352,
7498 Consumer::ChannelLeft => 353,
7499 Consumer::ChannelRight => 354,
7500 Consumer::ChannelCenter => 355,
7501 Consumer::ChannelFront => 356,
7502 Consumer::ChannelCenterFront => 357,
7503 Consumer::ChannelSide => 358,
7504 Consumer::ChannelSurround => 359,
7505 Consumer::ChannelLowFrequencyEnhancement => 360,
7506 Consumer::ChannelTop => 361,
7507 Consumer::ChannelUnknown => 362,
7508 Consumer::Subchannel => 368,
7509 Consumer::SubchannelIncrement => 369,
7510 Consumer::SubchannelDecrement => 370,
7511 Consumer::AlternateAudioIncrement => 371,
7512 Consumer::AlternateAudioDecrement => 372,
7513 Consumer::ApplicationLaunchButtons => 384,
7514 Consumer::ALLaunchButtonConfigurationTool => 385,
7515 Consumer::ALProgrammableButtonConfiguration => 386,
7516 Consumer::ALConsumerControlConfiguration => 387,
7517 Consumer::ALWordProcessor => 388,
7518 Consumer::ALTextEditor => 389,
7519 Consumer::ALSpreadsheet => 390,
7520 Consumer::ALGraphicsEditor => 391,
7521 Consumer::ALPresentationApp => 392,
7522 Consumer::ALDatabaseApp => 393,
7523 Consumer::ALEmailReader => 394,
7524 Consumer::ALNewsreader => 395,
7525 Consumer::ALVoicemail => 396,
7526 Consumer::ALContactsAddressBook => 397,
7527 Consumer::ALCalendarSchedule => 398,
7528 Consumer::ALTaskProjectManager => 399,
7529 Consumer::ALLogJournalTimecard => 400,
7530 Consumer::ALCheckbookFinance => 401,
7531 Consumer::ALCalculator => 402,
7532 Consumer::ALAVCapturePlayback => 403,
7533 Consumer::ALLocalMachineBrowser => 404,
7534 Consumer::ALLANWANBrowser => 405,
7535 Consumer::ALInternetBrowser => 406,
7536 Consumer::ALRemoteNetworkingISPConnect => 407,
7537 Consumer::ALNetworkConference => 408,
7538 Consumer::ALNetworkChat => 409,
7539 Consumer::ALTelephonyDialer => 410,
7540 Consumer::ALLogon => 411,
7541 Consumer::ALLogoff => 412,
7542 Consumer::ALLogonLogoff => 413,
7543 Consumer::ALTerminalLockScreensaver => 414,
7544 Consumer::ALControlPanel => 415,
7545 Consumer::ALCommandLineProcessorRun => 416,
7546 Consumer::ALProcessTaskManager => 417,
7547 Consumer::ALSelectTaskApplication => 418,
7548 Consumer::ALNextTaskApplication => 419,
7549 Consumer::ALPreviousTaskApplication => 420,
7550 Consumer::ALPreemptiveHaltTaskApplication => 421,
7551 Consumer::ALIntegratedHelpCenter => 422,
7552 Consumer::ALDocuments => 423,
7553 Consumer::ALThesaurus => 424,
7554 Consumer::ALDictionary => 425,
7555 Consumer::ALDesktop => 426,
7556 Consumer::ALSpellCheck => 427,
7557 Consumer::ALGrammarCheck => 428,
7558 Consumer::ALWirelessStatus => 429,
7559 Consumer::ALKeyboardLayout => 430,
7560 Consumer::ALVirusProtection => 431,
7561 Consumer::ALEncryption => 432,
7562 Consumer::ALScreenSaver => 433,
7563 Consumer::ALAlarms => 434,
7564 Consumer::ALClock => 435,
7565 Consumer::ALFileBrowser => 436,
7566 Consumer::ALPowerStatus => 437,
7567 Consumer::ALImageBrowser => 438,
7568 Consumer::ALAudioBrowser => 439,
7569 Consumer::ALMovieBrowser => 440,
7570 Consumer::ALDigitalRightsManager => 441,
7571 Consumer::ALDigitalWallet => 442,
7572 Consumer::ALInstantMessaging => 444,
7573 Consumer::ALOEMFeaturesTipsTutorialBrowser => 445,
7574 Consumer::ALOEMHelp => 446,
7575 Consumer::ALOnlineCommunity => 447,
7576 Consumer::ALEntertainmentContentBrowser => 448,
7577 Consumer::ALOnlineShoppingBrowser => 449,
7578 Consumer::ALSmartCardInformationHelp => 450,
7579 Consumer::ALMarketMonitorFinanceBrowser => 451,
7580 Consumer::ALCustomizedCorporateNewsBrowser => 452,
7581 Consumer::ALOnlineActivityBrowser => 453,
7582 Consumer::ALResearchSearchBrowser => 454,
7583 Consumer::ALAudioPlayer => 455,
7584 Consumer::ALMessageStatus => 456,
7585 Consumer::ALContactSync => 457,
7586 Consumer::ALNavigation => 458,
7587 Consumer::ALContextawareDesktopAssistant => 459,
7588 Consumer::GenericGUIApplicationControls => 512,
7589 Consumer::ACNew => 513,
7590 Consumer::ACOpen => 514,
7591 Consumer::ACClose => 515,
7592 Consumer::ACExit => 516,
7593 Consumer::ACMaximize => 517,
7594 Consumer::ACMinimize => 518,
7595 Consumer::ACSave => 519,
7596 Consumer::ACPrint => 520,
7597 Consumer::ACProperties => 521,
7598 Consumer::ACUndo => 538,
7599 Consumer::ACCopy => 539,
7600 Consumer::ACCut => 540,
7601 Consumer::ACPaste => 541,
7602 Consumer::ACSelectAll => 542,
7603 Consumer::ACFind => 543,
7604 Consumer::ACFindandReplace => 544,
7605 Consumer::ACSearch => 545,
7606 Consumer::ACGoTo => 546,
7607 Consumer::ACHome => 547,
7608 Consumer::ACBack => 548,
7609 Consumer::ACForward => 549,
7610 Consumer::ACStop => 550,
7611 Consumer::ACRefresh => 551,
7612 Consumer::ACPreviousLink => 552,
7613 Consumer::ACNextLink => 553,
7614 Consumer::ACBookmarks => 554,
7615 Consumer::ACHistory => 555,
7616 Consumer::ACSubscriptions => 556,
7617 Consumer::ACZoomIn => 557,
7618 Consumer::ACZoomOut => 558,
7619 Consumer::ACZoom => 559,
7620 Consumer::ACFullScreenView => 560,
7621 Consumer::ACNormalView => 561,
7622 Consumer::ACViewToggle => 562,
7623 Consumer::ACScrollUp => 563,
7624 Consumer::ACScrollDown => 564,
7625 Consumer::ACScroll => 565,
7626 Consumer::ACPanLeft => 566,
7627 Consumer::ACPanRight => 567,
7628 Consumer::ACPan => 568,
7629 Consumer::ACNewWindow => 569,
7630 Consumer::ACTileHorizontally => 570,
7631 Consumer::ACTileVertically => 571,
7632 Consumer::ACFormat => 572,
7633 Consumer::ACEdit => 573,
7634 Consumer::ACBold => 574,
7635 Consumer::ACItalics => 575,
7636 Consumer::ACUnderline => 576,
7637 Consumer::ACStrikethrough => 577,
7638 Consumer::ACSubscript => 578,
7639 Consumer::ACSuperscript => 579,
7640 Consumer::ACAllCaps => 580,
7641 Consumer::ACRotate => 581,
7642 Consumer::ACResize => 582,
7643 Consumer::ACFlipHorizontal => 583,
7644 Consumer::ACFlipVertical => 584,
7645 Consumer::ACMirrorHorizontal => 585,
7646 Consumer::ACMirrorVertical => 586,
7647 Consumer::ACFontSelect => 587,
7648 Consumer::ACFontColor => 588,
7649 Consumer::ACFontSize => 589,
7650 Consumer::ACJustifyLeft => 590,
7651 Consumer::ACJustifyCenterH => 591,
7652 Consumer::ACJustifyRight => 592,
7653 Consumer::ACJustifyBlockH => 593,
7654 Consumer::ACJustifyTop => 594,
7655 Consumer::ACJustifyCenterV => 595,
7656 Consumer::ACJustifyBottom => 596,
7657 Consumer::ACJustifyBlockV => 597,
7658 Consumer::ACIndentDecrease => 598,
7659 Consumer::ACIndentIncrease => 599,
7660 Consumer::ACNumberedList => 600,
7661 Consumer::ACRestartNumbering => 601,
7662 Consumer::ACBulletedList => 602,
7663 Consumer::ACPromote => 603,
7664 Consumer::ACDemote => 604,
7665 Consumer::ACYes => 605,
7666 Consumer::ACNo => 606,
7667 Consumer::ACCancel => 607,
7668 Consumer::ACCatalog => 608,
7669 Consumer::ACBuyCheckout => 609,
7670 Consumer::ACAddtoCart => 610,
7671 Consumer::ACExpand => 611,
7672 Consumer::ACExpandAll => 612,
7673 Consumer::ACCollapse => 613,
7674 Consumer::ACCollapseAll => 614,
7675 Consumer::ACPrintPreview => 615,
7676 Consumer::ACPasteSpecial => 616,
7677 Consumer::ACInsertMode => 617,
7678 Consumer::ACDelete => 618,
7679 Consumer::ACLock => 619,
7680 Consumer::ACUnlock => 620,
7681 Consumer::ACProtect => 621,
7682 Consumer::ACUnprotect => 622,
7683 Consumer::ACAttachComment => 623,
7684 Consumer::ACDeleteComment => 624,
7685 Consumer::ACViewComment => 625,
7686 Consumer::ACSelectWord => 626,
7687 Consumer::ACSelectSentence => 627,
7688 Consumer::ACSelectParagraph => 628,
7689 Consumer::ACSelectColumn => 629,
7690 Consumer::ACSelectRow => 630,
7691 Consumer::ACSelectTable => 631,
7692 Consumer::ACSelectObject => 632,
7693 Consumer::ACRedoRepeat => 633,
7694 Consumer::ACSort => 634,
7695 Consumer::ACSortAscending => 635,
7696 Consumer::ACSortDescending => 636,
7697 Consumer::ACFilter => 637,
7698 Consumer::ACSetClock => 638,
7699 Consumer::ACViewClock => 639,
7700 Consumer::ACSelectTimeZone => 640,
7701 Consumer::ACEditTimeZones => 641,
7702 Consumer::ACSetAlarm => 642,
7703 Consumer::ACClearAlarm => 643,
7704 Consumer::ACSnoozeAlarm => 644,
7705 Consumer::ACResetAlarm => 645,
7706 Consumer::ACSynchronize => 646,
7707 Consumer::ACSendReceive => 647,
7708 Consumer::ACSendTo => 648,
7709 Consumer::ACReply => 649,
7710 Consumer::ACReplyAll => 650,
7711 Consumer::ACForwardMsg => 651,
7712 Consumer::ACSend => 652,
7713 Consumer::ACAttachFile => 653,
7714 Consumer::ACUpload => 654,
7715 Consumer::ACDownloadSaveTargetAs => 655,
7716 Consumer::ACSetBorders => 656,
7717 Consumer::ACInsertRow => 657,
7718 Consumer::ACInsertColumn => 658,
7719 Consumer::ACInsertFile => 659,
7720 Consumer::ACInsertPicture => 660,
7721 Consumer::ACInsertObject => 661,
7722 Consumer::ACInsertSymbol => 662,
7723 Consumer::ACSaveandClose => 663,
7724 Consumer::ACRename => 664,
7725 Consumer::ACMerge => 665,
7726 Consumer::ACSplit => 666,
7727 Consumer::ACDisributeHorizontally => 667,
7728 Consumer::ACDistributeVertically => 668,
7729 Consumer::ACNextKeyboardLayoutSelect => 669,
7730 Consumer::ACNavigationGuidance => 670,
7731 Consumer::ACDesktopShowAllWindows => 671,
7732 Consumer::ACSoftKeyLeft => 672,
7733 Consumer::ACSoftKeyRight => 673,
7734 Consumer::ACDesktopShowAllApplications => 674,
7735 Consumer::ACIdleKeepAlive => 688,
7736 Consumer::ExtendedKeyboardAttributesCollection => 704,
7737 Consumer::KeyboardFormFactor => 705,
7738 Consumer::KeyboardKeyType => 706,
7739 Consumer::KeyboardPhysicalLayout => 707,
7740 Consumer::VendorSpecificKeyboardPhysicalLayout => 708,
7741 Consumer::KeyboardIETFLanguageTagIndex => 709,
7742 Consumer::ImplementedKeyboardInputAssistControls => 710,
7743 Consumer::KeyboardInputAssistPrevious => 711,
7744 Consumer::KeyboardInputAssistNext => 712,
7745 Consumer::KeyboardInputAssistPreviousGroup => 713,
7746 Consumer::KeyboardInputAssistNextGroup => 714,
7747 Consumer::KeyboardInputAssistAccept => 715,
7748 Consumer::KeyboardInputAssistCancel => 716,
7749 Consumer::PrivacyScreenToggle => 720,
7750 Consumer::PrivacyScreenLevelDecrement => 721,
7751 Consumer::PrivacyScreenLevelIncrement => 722,
7752 Consumer::PrivacyScreenLevelMinimum => 723,
7753 Consumer::PrivacyScreenLevelMaximum => 724,
7754 Consumer::ContactEdited => 1280,
7755 Consumer::ContactAdded => 1281,
7756 Consumer::ContactRecordActive => 1282,
7757 Consumer::ContactIndex => 1283,
7758 Consumer::ContactNickname => 1284,
7759 Consumer::ContactFirstName => 1285,
7760 Consumer::ContactLastName => 1286,
7761 Consumer::ContactFullName => 1287,
7762 Consumer::ContactPhoneNumberPersonal => 1288,
7763 Consumer::ContactPhoneNumberBusiness => 1289,
7764 Consumer::ContactPhoneNumberMobile => 1290,
7765 Consumer::ContactPhoneNumberPager => 1291,
7766 Consumer::ContactPhoneNumberFax => 1292,
7767 Consumer::ContactPhoneNumberOther => 1293,
7768 Consumer::ContactEmailPersonal => 1294,
7769 Consumer::ContactEmailBusiness => 1295,
7770 Consumer::ContactEmailOther => 1296,
7771 Consumer::ContactEmailMain => 1297,
7772 Consumer::ContactSpeedDialNumber => 1298,
7773 Consumer::ContactStatusFlag => 1299,
7774 Consumer::ContactMisc => 1300,
7775 }
7776 }
7777}
7778
7779impl From<Consumer> for u16 {
7780 fn from(consumer: Consumer) -> u16 {
7783 u16::from(&consumer)
7784 }
7785}
7786
7787impl From<&Consumer> for u32 {
7788 fn from(consumer: &Consumer) -> u32 {
7791 let up = UsagePage::from(consumer);
7792 let up = (u16::from(&up) as u32) << 16;
7793 let id = u16::from(consumer) as u32;
7794 up | id
7795 }
7796}
7797
7798impl From<&Consumer> for UsagePage {
7799 fn from(_: &Consumer) -> UsagePage {
7802 UsagePage::Consumer
7803 }
7804}
7805
7806impl From<Consumer> for UsagePage {
7807 fn from(_: Consumer) -> UsagePage {
7810 UsagePage::Consumer
7811 }
7812}
7813
7814impl From<&Consumer> for Usage {
7815 fn from(consumer: &Consumer) -> Usage {
7816 Usage::try_from(u32::from(consumer)).unwrap()
7817 }
7818}
7819
7820impl From<Consumer> for Usage {
7821 fn from(consumer: Consumer) -> Usage {
7822 Usage::from(&consumer)
7823 }
7824}
7825
7826impl TryFrom<u16> for Consumer {
7827 type Error = HutError;
7828
7829 fn try_from(usage_id: u16) -> Result<Consumer> {
7830 match usage_id {
7831 1 => Ok(Consumer::ConsumerControl),
7832 2 => Ok(Consumer::NumericKeyPad),
7833 3 => Ok(Consumer::ProgrammableButtons),
7834 4 => Ok(Consumer::Microphone),
7835 5 => Ok(Consumer::Headphone),
7836 6 => Ok(Consumer::GraphicEqualizer),
7837 32 => Ok(Consumer::Plus10),
7838 33 => Ok(Consumer::Plus100),
7839 34 => Ok(Consumer::AMPM),
7840 48 => Ok(Consumer::Power),
7841 49 => Ok(Consumer::Reset),
7842 50 => Ok(Consumer::Sleep),
7843 51 => Ok(Consumer::SleepAfter),
7844 52 => Ok(Consumer::SleepMode),
7845 53 => Ok(Consumer::Illumination),
7846 54 => Ok(Consumer::FunctionButtons),
7847 64 => Ok(Consumer::Menu),
7848 65 => Ok(Consumer::MenuPick),
7849 66 => Ok(Consumer::MenuUp),
7850 67 => Ok(Consumer::MenuDown),
7851 68 => Ok(Consumer::MenuLeft),
7852 69 => Ok(Consumer::MenuRight),
7853 70 => Ok(Consumer::MenuEscape),
7854 71 => Ok(Consumer::MenuValueIncrease),
7855 72 => Ok(Consumer::MenuValueDecrease),
7856 96 => Ok(Consumer::DataOnScreen),
7857 97 => Ok(Consumer::ClosedCaption),
7858 98 => Ok(Consumer::ClosedCaptionSelect),
7859 99 => Ok(Consumer::VCRTV),
7860 100 => Ok(Consumer::BroadcastMode),
7861 101 => Ok(Consumer::Snapshot),
7862 102 => Ok(Consumer::Still),
7863 103 => Ok(Consumer::PictureinPictureToggle),
7864 104 => Ok(Consumer::PictureinPictureSwap),
7865 105 => Ok(Consumer::RedMenuButton),
7866 106 => Ok(Consumer::GreenMenuButton),
7867 107 => Ok(Consumer::BlueMenuButton),
7868 108 => Ok(Consumer::YellowMenuButton),
7869 109 => Ok(Consumer::Aspect),
7870 110 => Ok(Consumer::ThreeDModeSelect),
7871 111 => Ok(Consumer::DisplayBrightnessIncrement),
7872 112 => Ok(Consumer::DisplayBrightnessDecrement),
7873 113 => Ok(Consumer::DisplayBrightness),
7874 114 => Ok(Consumer::DisplayBacklightToggle),
7875 115 => Ok(Consumer::DisplaySetBrightnesstoMinimum),
7876 116 => Ok(Consumer::DisplaySetBrightnesstoMaximum),
7877 117 => Ok(Consumer::DisplaySetAutoBrightness),
7878 118 => Ok(Consumer::CameraAccessEnabled),
7879 119 => Ok(Consumer::CameraAccessDisabled),
7880 120 => Ok(Consumer::CameraAccessToggle),
7881 121 => Ok(Consumer::KeyboardBrightnessIncrement),
7882 122 => Ok(Consumer::KeyboardBrightnessDecrement),
7883 123 => Ok(Consumer::KeyboardBacklightSetLevel),
7884 124 => Ok(Consumer::KeyboardBacklightOOC),
7885 125 => Ok(Consumer::KeyboardBacklightSetMinimum),
7886 126 => Ok(Consumer::KeyboardBacklightSetMaximum),
7887 127 => Ok(Consumer::KeyboardBacklightAuto),
7888 128 => Ok(Consumer::Selection),
7889 129 => Ok(Consumer::AssignSelection),
7890 130 => Ok(Consumer::ModeStep),
7891 131 => Ok(Consumer::RecallLast),
7892 132 => Ok(Consumer::EnterChannel),
7893 133 => Ok(Consumer::OrderMovie),
7894 134 => Ok(Consumer::Channel),
7895 135 => Ok(Consumer::MediaSelection),
7896 136 => Ok(Consumer::MediaSelectComputer),
7897 137 => Ok(Consumer::MediaSelectTV),
7898 138 => Ok(Consumer::MediaSelectWWW),
7899 139 => Ok(Consumer::MediaSelectDVD),
7900 140 => Ok(Consumer::MediaSelectTelephone),
7901 141 => Ok(Consumer::MediaSelectProgramGuide),
7902 142 => Ok(Consumer::MediaSelectVideoPhone),
7903 143 => Ok(Consumer::MediaSelectGames),
7904 144 => Ok(Consumer::MediaSelectMessages),
7905 145 => Ok(Consumer::MediaSelectCD),
7906 146 => Ok(Consumer::MediaSelectVCR),
7907 147 => Ok(Consumer::MediaSelectTuner),
7908 148 => Ok(Consumer::Quit),
7909 149 => Ok(Consumer::Help),
7910 150 => Ok(Consumer::MediaSelectTape),
7911 151 => Ok(Consumer::MediaSelectCable),
7912 152 => Ok(Consumer::MediaSelectSatellite),
7913 153 => Ok(Consumer::MediaSelectSecurity),
7914 154 => Ok(Consumer::MediaSelectHome),
7915 155 => Ok(Consumer::MediaSelectCall),
7916 156 => Ok(Consumer::ChannelIncrement),
7917 157 => Ok(Consumer::ChannelDecrement),
7918 158 => Ok(Consumer::MediaSelectSAP),
7919 160 => Ok(Consumer::VCRPlus),
7920 161 => Ok(Consumer::Once),
7921 162 => Ok(Consumer::Daily),
7922 163 => Ok(Consumer::Weekly),
7923 164 => Ok(Consumer::Monthly),
7924 176 => Ok(Consumer::Play),
7925 177 => Ok(Consumer::Pause),
7926 178 => Ok(Consumer::Record),
7927 179 => Ok(Consumer::FastForward),
7928 180 => Ok(Consumer::Rewind),
7929 181 => Ok(Consumer::ScanNextTrack),
7930 182 => Ok(Consumer::ScanPreviousTrack),
7931 183 => Ok(Consumer::Stop),
7932 184 => Ok(Consumer::Eject),
7933 185 => Ok(Consumer::RandomPlay),
7934 186 => Ok(Consumer::SelectDisc),
7935 187 => Ok(Consumer::EnterDisc),
7936 188 => Ok(Consumer::Repeat),
7937 189 => Ok(Consumer::Tracking),
7938 190 => Ok(Consumer::TrackNormal),
7939 191 => Ok(Consumer::SlowTracking),
7940 192 => Ok(Consumer::FrameForward),
7941 193 => Ok(Consumer::FrameBack),
7942 194 => Ok(Consumer::Mark),
7943 195 => Ok(Consumer::ClearMark),
7944 196 => Ok(Consumer::RepeatFromMark),
7945 197 => Ok(Consumer::ReturnToMark),
7946 198 => Ok(Consumer::SearchMarkForward),
7947 199 => Ok(Consumer::SearchMarkBackwards),
7948 200 => Ok(Consumer::CounterReset),
7949 201 => Ok(Consumer::ShowCounter),
7950 202 => Ok(Consumer::TrackingIncrement),
7951 203 => Ok(Consumer::TrackingDecrement),
7952 204 => Ok(Consumer::StopEject),
7953 205 => Ok(Consumer::PlayPause),
7954 206 => Ok(Consumer::PlaySkip),
7955 207 => Ok(Consumer::VoiceCommand),
7956 208 => Ok(Consumer::InvokeCaptureInterface),
7957 209 => Ok(Consumer::StartorStopGameRecording),
7958 210 => Ok(Consumer::HistoricalGameCapture),
7959 211 => Ok(Consumer::CaptureGameScreenshot),
7960 212 => Ok(Consumer::ShoworHideRecordingIndicator),
7961 213 => Ok(Consumer::StartorStopMicrophoneCapture),
7962 214 => Ok(Consumer::StartorStopCameraCapture),
7963 215 => Ok(Consumer::StartorStopGameBroadcast),
7964 216 => Ok(Consumer::StartorStopVoiceDictationSession),
7965 217 => Ok(Consumer::InvokeDismissEmojiPicker),
7966 224 => Ok(Consumer::Volume),
7967 225 => Ok(Consumer::Balance),
7968 226 => Ok(Consumer::Mute),
7969 227 => Ok(Consumer::Bass),
7970 228 => Ok(Consumer::Treble),
7971 229 => Ok(Consumer::BassBoost),
7972 230 => Ok(Consumer::SurroundMode),
7973 231 => Ok(Consumer::Loudness),
7974 232 => Ok(Consumer::MPX),
7975 233 => Ok(Consumer::VolumeIncrement),
7976 234 => Ok(Consumer::VolumeDecrement),
7977 240 => Ok(Consumer::SpeedSelect),
7978 241 => Ok(Consumer::PlaybackSpeed),
7979 242 => Ok(Consumer::StandardPlay),
7980 243 => Ok(Consumer::LongPlay),
7981 244 => Ok(Consumer::ExtendedPlay),
7982 245 => Ok(Consumer::Slow),
7983 256 => Ok(Consumer::FanEnable),
7984 257 => Ok(Consumer::FanSpeed),
7985 258 => Ok(Consumer::LightEnable),
7986 259 => Ok(Consumer::LightIlluminationLevel),
7987 260 => Ok(Consumer::ClimateControlEnable),
7988 261 => Ok(Consumer::RoomTemperature),
7989 262 => Ok(Consumer::SecurityEnable),
7990 263 => Ok(Consumer::FireAlarm),
7991 264 => Ok(Consumer::PoliceAlarm),
7992 265 => Ok(Consumer::Proximity),
7993 266 => Ok(Consumer::Motion),
7994 267 => Ok(Consumer::DuressAlarm),
7995 268 => Ok(Consumer::HoldupAlarm),
7996 269 => Ok(Consumer::MedicalAlarm),
7997 336 => Ok(Consumer::BalanceRight),
7998 337 => Ok(Consumer::BalanceLeft),
7999 338 => Ok(Consumer::BassIncrement),
8000 339 => Ok(Consumer::BassDecrement),
8001 340 => Ok(Consumer::TrebleIncrement),
8002 341 => Ok(Consumer::TrebleDecrement),
8003 352 => Ok(Consumer::SpeakerSystem),
8004 353 => Ok(Consumer::ChannelLeft),
8005 354 => Ok(Consumer::ChannelRight),
8006 355 => Ok(Consumer::ChannelCenter),
8007 356 => Ok(Consumer::ChannelFront),
8008 357 => Ok(Consumer::ChannelCenterFront),
8009 358 => Ok(Consumer::ChannelSide),
8010 359 => Ok(Consumer::ChannelSurround),
8011 360 => Ok(Consumer::ChannelLowFrequencyEnhancement),
8012 361 => Ok(Consumer::ChannelTop),
8013 362 => Ok(Consumer::ChannelUnknown),
8014 368 => Ok(Consumer::Subchannel),
8015 369 => Ok(Consumer::SubchannelIncrement),
8016 370 => Ok(Consumer::SubchannelDecrement),
8017 371 => Ok(Consumer::AlternateAudioIncrement),
8018 372 => Ok(Consumer::AlternateAudioDecrement),
8019 384 => Ok(Consumer::ApplicationLaunchButtons),
8020 385 => Ok(Consumer::ALLaunchButtonConfigurationTool),
8021 386 => Ok(Consumer::ALProgrammableButtonConfiguration),
8022 387 => Ok(Consumer::ALConsumerControlConfiguration),
8023 388 => Ok(Consumer::ALWordProcessor),
8024 389 => Ok(Consumer::ALTextEditor),
8025 390 => Ok(Consumer::ALSpreadsheet),
8026 391 => Ok(Consumer::ALGraphicsEditor),
8027 392 => Ok(Consumer::ALPresentationApp),
8028 393 => Ok(Consumer::ALDatabaseApp),
8029 394 => Ok(Consumer::ALEmailReader),
8030 395 => Ok(Consumer::ALNewsreader),
8031 396 => Ok(Consumer::ALVoicemail),
8032 397 => Ok(Consumer::ALContactsAddressBook),
8033 398 => Ok(Consumer::ALCalendarSchedule),
8034 399 => Ok(Consumer::ALTaskProjectManager),
8035 400 => Ok(Consumer::ALLogJournalTimecard),
8036 401 => Ok(Consumer::ALCheckbookFinance),
8037 402 => Ok(Consumer::ALCalculator),
8038 403 => Ok(Consumer::ALAVCapturePlayback),
8039 404 => Ok(Consumer::ALLocalMachineBrowser),
8040 405 => Ok(Consumer::ALLANWANBrowser),
8041 406 => Ok(Consumer::ALInternetBrowser),
8042 407 => Ok(Consumer::ALRemoteNetworkingISPConnect),
8043 408 => Ok(Consumer::ALNetworkConference),
8044 409 => Ok(Consumer::ALNetworkChat),
8045 410 => Ok(Consumer::ALTelephonyDialer),
8046 411 => Ok(Consumer::ALLogon),
8047 412 => Ok(Consumer::ALLogoff),
8048 413 => Ok(Consumer::ALLogonLogoff),
8049 414 => Ok(Consumer::ALTerminalLockScreensaver),
8050 415 => Ok(Consumer::ALControlPanel),
8051 416 => Ok(Consumer::ALCommandLineProcessorRun),
8052 417 => Ok(Consumer::ALProcessTaskManager),
8053 418 => Ok(Consumer::ALSelectTaskApplication),
8054 419 => Ok(Consumer::ALNextTaskApplication),
8055 420 => Ok(Consumer::ALPreviousTaskApplication),
8056 421 => Ok(Consumer::ALPreemptiveHaltTaskApplication),
8057 422 => Ok(Consumer::ALIntegratedHelpCenter),
8058 423 => Ok(Consumer::ALDocuments),
8059 424 => Ok(Consumer::ALThesaurus),
8060 425 => Ok(Consumer::ALDictionary),
8061 426 => Ok(Consumer::ALDesktop),
8062 427 => Ok(Consumer::ALSpellCheck),
8063 428 => Ok(Consumer::ALGrammarCheck),
8064 429 => Ok(Consumer::ALWirelessStatus),
8065 430 => Ok(Consumer::ALKeyboardLayout),
8066 431 => Ok(Consumer::ALVirusProtection),
8067 432 => Ok(Consumer::ALEncryption),
8068 433 => Ok(Consumer::ALScreenSaver),
8069 434 => Ok(Consumer::ALAlarms),
8070 435 => Ok(Consumer::ALClock),
8071 436 => Ok(Consumer::ALFileBrowser),
8072 437 => Ok(Consumer::ALPowerStatus),
8073 438 => Ok(Consumer::ALImageBrowser),
8074 439 => Ok(Consumer::ALAudioBrowser),
8075 440 => Ok(Consumer::ALMovieBrowser),
8076 441 => Ok(Consumer::ALDigitalRightsManager),
8077 442 => Ok(Consumer::ALDigitalWallet),
8078 444 => Ok(Consumer::ALInstantMessaging),
8079 445 => Ok(Consumer::ALOEMFeaturesTipsTutorialBrowser),
8080 446 => Ok(Consumer::ALOEMHelp),
8081 447 => Ok(Consumer::ALOnlineCommunity),
8082 448 => Ok(Consumer::ALEntertainmentContentBrowser),
8083 449 => Ok(Consumer::ALOnlineShoppingBrowser),
8084 450 => Ok(Consumer::ALSmartCardInformationHelp),
8085 451 => Ok(Consumer::ALMarketMonitorFinanceBrowser),
8086 452 => Ok(Consumer::ALCustomizedCorporateNewsBrowser),
8087 453 => Ok(Consumer::ALOnlineActivityBrowser),
8088 454 => Ok(Consumer::ALResearchSearchBrowser),
8089 455 => Ok(Consumer::ALAudioPlayer),
8090 456 => Ok(Consumer::ALMessageStatus),
8091 457 => Ok(Consumer::ALContactSync),
8092 458 => Ok(Consumer::ALNavigation),
8093 459 => Ok(Consumer::ALContextawareDesktopAssistant),
8094 512 => Ok(Consumer::GenericGUIApplicationControls),
8095 513 => Ok(Consumer::ACNew),
8096 514 => Ok(Consumer::ACOpen),
8097 515 => Ok(Consumer::ACClose),
8098 516 => Ok(Consumer::ACExit),
8099 517 => Ok(Consumer::ACMaximize),
8100 518 => Ok(Consumer::ACMinimize),
8101 519 => Ok(Consumer::ACSave),
8102 520 => Ok(Consumer::ACPrint),
8103 521 => Ok(Consumer::ACProperties),
8104 538 => Ok(Consumer::ACUndo),
8105 539 => Ok(Consumer::ACCopy),
8106 540 => Ok(Consumer::ACCut),
8107 541 => Ok(Consumer::ACPaste),
8108 542 => Ok(Consumer::ACSelectAll),
8109 543 => Ok(Consumer::ACFind),
8110 544 => Ok(Consumer::ACFindandReplace),
8111 545 => Ok(Consumer::ACSearch),
8112 546 => Ok(Consumer::ACGoTo),
8113 547 => Ok(Consumer::ACHome),
8114 548 => Ok(Consumer::ACBack),
8115 549 => Ok(Consumer::ACForward),
8116 550 => Ok(Consumer::ACStop),
8117 551 => Ok(Consumer::ACRefresh),
8118 552 => Ok(Consumer::ACPreviousLink),
8119 553 => Ok(Consumer::ACNextLink),
8120 554 => Ok(Consumer::ACBookmarks),
8121 555 => Ok(Consumer::ACHistory),
8122 556 => Ok(Consumer::ACSubscriptions),
8123 557 => Ok(Consumer::ACZoomIn),
8124 558 => Ok(Consumer::ACZoomOut),
8125 559 => Ok(Consumer::ACZoom),
8126 560 => Ok(Consumer::ACFullScreenView),
8127 561 => Ok(Consumer::ACNormalView),
8128 562 => Ok(Consumer::ACViewToggle),
8129 563 => Ok(Consumer::ACScrollUp),
8130 564 => Ok(Consumer::ACScrollDown),
8131 565 => Ok(Consumer::ACScroll),
8132 566 => Ok(Consumer::ACPanLeft),
8133 567 => Ok(Consumer::ACPanRight),
8134 568 => Ok(Consumer::ACPan),
8135 569 => Ok(Consumer::ACNewWindow),
8136 570 => Ok(Consumer::ACTileHorizontally),
8137 571 => Ok(Consumer::ACTileVertically),
8138 572 => Ok(Consumer::ACFormat),
8139 573 => Ok(Consumer::ACEdit),
8140 574 => Ok(Consumer::ACBold),
8141 575 => Ok(Consumer::ACItalics),
8142 576 => Ok(Consumer::ACUnderline),
8143 577 => Ok(Consumer::ACStrikethrough),
8144 578 => Ok(Consumer::ACSubscript),
8145 579 => Ok(Consumer::ACSuperscript),
8146 580 => Ok(Consumer::ACAllCaps),
8147 581 => Ok(Consumer::ACRotate),
8148 582 => Ok(Consumer::ACResize),
8149 583 => Ok(Consumer::ACFlipHorizontal),
8150 584 => Ok(Consumer::ACFlipVertical),
8151 585 => Ok(Consumer::ACMirrorHorizontal),
8152 586 => Ok(Consumer::ACMirrorVertical),
8153 587 => Ok(Consumer::ACFontSelect),
8154 588 => Ok(Consumer::ACFontColor),
8155 589 => Ok(Consumer::ACFontSize),
8156 590 => Ok(Consumer::ACJustifyLeft),
8157 591 => Ok(Consumer::ACJustifyCenterH),
8158 592 => Ok(Consumer::ACJustifyRight),
8159 593 => Ok(Consumer::ACJustifyBlockH),
8160 594 => Ok(Consumer::ACJustifyTop),
8161 595 => Ok(Consumer::ACJustifyCenterV),
8162 596 => Ok(Consumer::ACJustifyBottom),
8163 597 => Ok(Consumer::ACJustifyBlockV),
8164 598 => Ok(Consumer::ACIndentDecrease),
8165 599 => Ok(Consumer::ACIndentIncrease),
8166 600 => Ok(Consumer::ACNumberedList),
8167 601 => Ok(Consumer::ACRestartNumbering),
8168 602 => Ok(Consumer::ACBulletedList),
8169 603 => Ok(Consumer::ACPromote),
8170 604 => Ok(Consumer::ACDemote),
8171 605 => Ok(Consumer::ACYes),
8172 606 => Ok(Consumer::ACNo),
8173 607 => Ok(Consumer::ACCancel),
8174 608 => Ok(Consumer::ACCatalog),
8175 609 => Ok(Consumer::ACBuyCheckout),
8176 610 => Ok(Consumer::ACAddtoCart),
8177 611 => Ok(Consumer::ACExpand),
8178 612 => Ok(Consumer::ACExpandAll),
8179 613 => Ok(Consumer::ACCollapse),
8180 614 => Ok(Consumer::ACCollapseAll),
8181 615 => Ok(Consumer::ACPrintPreview),
8182 616 => Ok(Consumer::ACPasteSpecial),
8183 617 => Ok(Consumer::ACInsertMode),
8184 618 => Ok(Consumer::ACDelete),
8185 619 => Ok(Consumer::ACLock),
8186 620 => Ok(Consumer::ACUnlock),
8187 621 => Ok(Consumer::ACProtect),
8188 622 => Ok(Consumer::ACUnprotect),
8189 623 => Ok(Consumer::ACAttachComment),
8190 624 => Ok(Consumer::ACDeleteComment),
8191 625 => Ok(Consumer::ACViewComment),
8192 626 => Ok(Consumer::ACSelectWord),
8193 627 => Ok(Consumer::ACSelectSentence),
8194 628 => Ok(Consumer::ACSelectParagraph),
8195 629 => Ok(Consumer::ACSelectColumn),
8196 630 => Ok(Consumer::ACSelectRow),
8197 631 => Ok(Consumer::ACSelectTable),
8198 632 => Ok(Consumer::ACSelectObject),
8199 633 => Ok(Consumer::ACRedoRepeat),
8200 634 => Ok(Consumer::ACSort),
8201 635 => Ok(Consumer::ACSortAscending),
8202 636 => Ok(Consumer::ACSortDescending),
8203 637 => Ok(Consumer::ACFilter),
8204 638 => Ok(Consumer::ACSetClock),
8205 639 => Ok(Consumer::ACViewClock),
8206 640 => Ok(Consumer::ACSelectTimeZone),
8207 641 => Ok(Consumer::ACEditTimeZones),
8208 642 => Ok(Consumer::ACSetAlarm),
8209 643 => Ok(Consumer::ACClearAlarm),
8210 644 => Ok(Consumer::ACSnoozeAlarm),
8211 645 => Ok(Consumer::ACResetAlarm),
8212 646 => Ok(Consumer::ACSynchronize),
8213 647 => Ok(Consumer::ACSendReceive),
8214 648 => Ok(Consumer::ACSendTo),
8215 649 => Ok(Consumer::ACReply),
8216 650 => Ok(Consumer::ACReplyAll),
8217 651 => Ok(Consumer::ACForwardMsg),
8218 652 => Ok(Consumer::ACSend),
8219 653 => Ok(Consumer::ACAttachFile),
8220 654 => Ok(Consumer::ACUpload),
8221 655 => Ok(Consumer::ACDownloadSaveTargetAs),
8222 656 => Ok(Consumer::ACSetBorders),
8223 657 => Ok(Consumer::ACInsertRow),
8224 658 => Ok(Consumer::ACInsertColumn),
8225 659 => Ok(Consumer::ACInsertFile),
8226 660 => Ok(Consumer::ACInsertPicture),
8227 661 => Ok(Consumer::ACInsertObject),
8228 662 => Ok(Consumer::ACInsertSymbol),
8229 663 => Ok(Consumer::ACSaveandClose),
8230 664 => Ok(Consumer::ACRename),
8231 665 => Ok(Consumer::ACMerge),
8232 666 => Ok(Consumer::ACSplit),
8233 667 => Ok(Consumer::ACDisributeHorizontally),
8234 668 => Ok(Consumer::ACDistributeVertically),
8235 669 => Ok(Consumer::ACNextKeyboardLayoutSelect),
8236 670 => Ok(Consumer::ACNavigationGuidance),
8237 671 => Ok(Consumer::ACDesktopShowAllWindows),
8238 672 => Ok(Consumer::ACSoftKeyLeft),
8239 673 => Ok(Consumer::ACSoftKeyRight),
8240 674 => Ok(Consumer::ACDesktopShowAllApplications),
8241 688 => Ok(Consumer::ACIdleKeepAlive),
8242 704 => Ok(Consumer::ExtendedKeyboardAttributesCollection),
8243 705 => Ok(Consumer::KeyboardFormFactor),
8244 706 => Ok(Consumer::KeyboardKeyType),
8245 707 => Ok(Consumer::KeyboardPhysicalLayout),
8246 708 => Ok(Consumer::VendorSpecificKeyboardPhysicalLayout),
8247 709 => Ok(Consumer::KeyboardIETFLanguageTagIndex),
8248 710 => Ok(Consumer::ImplementedKeyboardInputAssistControls),
8249 711 => Ok(Consumer::KeyboardInputAssistPrevious),
8250 712 => Ok(Consumer::KeyboardInputAssistNext),
8251 713 => Ok(Consumer::KeyboardInputAssistPreviousGroup),
8252 714 => Ok(Consumer::KeyboardInputAssistNextGroup),
8253 715 => Ok(Consumer::KeyboardInputAssistAccept),
8254 716 => Ok(Consumer::KeyboardInputAssistCancel),
8255 720 => Ok(Consumer::PrivacyScreenToggle),
8256 721 => Ok(Consumer::PrivacyScreenLevelDecrement),
8257 722 => Ok(Consumer::PrivacyScreenLevelIncrement),
8258 723 => Ok(Consumer::PrivacyScreenLevelMinimum),
8259 724 => Ok(Consumer::PrivacyScreenLevelMaximum),
8260 1280 => Ok(Consumer::ContactEdited),
8261 1281 => Ok(Consumer::ContactAdded),
8262 1282 => Ok(Consumer::ContactRecordActive),
8263 1283 => Ok(Consumer::ContactIndex),
8264 1284 => Ok(Consumer::ContactNickname),
8265 1285 => Ok(Consumer::ContactFirstName),
8266 1286 => Ok(Consumer::ContactLastName),
8267 1287 => Ok(Consumer::ContactFullName),
8268 1288 => Ok(Consumer::ContactPhoneNumberPersonal),
8269 1289 => Ok(Consumer::ContactPhoneNumberBusiness),
8270 1290 => Ok(Consumer::ContactPhoneNumberMobile),
8271 1291 => Ok(Consumer::ContactPhoneNumberPager),
8272 1292 => Ok(Consumer::ContactPhoneNumberFax),
8273 1293 => Ok(Consumer::ContactPhoneNumberOther),
8274 1294 => Ok(Consumer::ContactEmailPersonal),
8275 1295 => Ok(Consumer::ContactEmailBusiness),
8276 1296 => Ok(Consumer::ContactEmailOther),
8277 1297 => Ok(Consumer::ContactEmailMain),
8278 1298 => Ok(Consumer::ContactSpeedDialNumber),
8279 1299 => Ok(Consumer::ContactStatusFlag),
8280 1300 => Ok(Consumer::ContactMisc),
8281 n => Err(HutError::UnknownUsageId { usage_id: n }),
8282 }
8283 }
8284}
8285
8286impl BitOr<u16> for Consumer {
8287 type Output = Usage;
8288
8289 fn bitor(self, usage: u16) -> Usage {
8296 let up = u16::from(self) as u32;
8297 let u = usage as u32;
8298 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
8299 }
8300}
8301
8302#[allow(non_camel_case_types)]
8323#[derive(Debug)]
8324#[non_exhaustive]
8325pub enum Digitizers {
8326 Digitizer,
8328 Pen,
8330 LightPen,
8332 TouchScreen,
8334 TouchPad,
8336 Whiteboard,
8338 CoordinateMeasuringMachine,
8340 ThreeDDigitizer,
8342 StereoPlotter,
8344 ArticulatedArm,
8346 Armature,
8348 MultiplePointDigitizer,
8350 FreeSpaceWand,
8352 DeviceConfiguration,
8354 CapacitiveHeatMapDigitizer,
8356 Stylus,
8358 Puck,
8360 Finger,
8362 Devicesettings,
8364 CharacterGesture,
8366 TipPressure,
8368 BarrelPressure,
8370 InRange,
8372 Touch,
8374 Untouch,
8376 Tap,
8378 Quality,
8380 DataValid,
8382 TransducerIndex,
8384 TabletFunctionKeys,
8386 ProgramChangeKeys,
8388 BatteryStrength,
8390 Invert,
8392 XTilt,
8394 YTilt,
8396 Azimuth,
8398 Altitude,
8400 Twist,
8402 TipSwitch,
8404 SecondaryTipSwitch,
8406 BarrelSwitch,
8408 Eraser,
8410 TabletPick,
8412 TouchValid,
8414 Width,
8416 Height,
8418 ContactIdentifier,
8420 DeviceMode,
8422 DeviceIdentifier,
8424 ContactCount,
8426 ContactCountMaximum,
8428 ScanTime,
8430 SurfaceSwitch,
8432 ButtonSwitch,
8434 PadType,
8436 SecondaryBarrelSwitch,
8438 TransducerSerialNumber,
8440 PreferredColor,
8442 PreferredColorisLocked,
8444 PreferredLineWidth,
8446 PreferredLineWidthisLocked,
8448 LatencyMode,
8450 GestureCharacterQuality,
8452 CharacterGestureDataLength,
8454 CharacterGestureData,
8456 GestureCharacterEncoding,
8458 UTF8CharacterGestureEncoding,
8460 UTF16LittleEndianCharacterGestureEncoding,
8462 UTF16BigEndianCharacterGestureEncoding,
8464 UTF32LittleEndianCharacterGestureEncoding,
8466 UTF32BigEndianCharacterGestureEncoding,
8468 CapacitiveHeatMapProtocolVendorID,
8470 CapacitiveHeatMapProtocolVersion,
8472 CapacitiveHeatMapFrameData,
8474 GestureCharacterEnable,
8476 TransducerSerialNumberPart2,
8478 NoPreferredColor,
8480 PreferredLineStyle,
8482 PreferredLineStyleisLocked,
8484 Ink,
8486 Pencil,
8488 Highlighter,
8490 ChiselMarker,
8492 Brush,
8494 NoPreference,
8496 DigitizerDiagnostic,
8498 DigitizerError,
8500 ErrNormalStatus,
8502 ErrTransducersExceeded,
8504 ErrFullTransFeaturesUnavailable,
8506 ErrChargeLow,
8508 TransducerSoftwareInfo,
8510 TransducerVendorId,
8512 TransducerProductId,
8514 DeviceSupportedProtocols,
8516 TransducerSupportedProtocols,
8518 NoProtocol,
8520 WacomAESProtocol,
8522 USIProtocol,
8524 MicrosoftPenProtocol,
8526 SupportedReportRates,
8528 ReportRate,
8530 TransducerConnected,
8532 SwitchDisabled,
8534 SwitchUnimplemented,
8536 TransducerSwitches,
8538 TransducerIndexSelector,
8540 ButtonPressThreshold,
8542}
8543
8544impl Digitizers {
8545 #[cfg(feature = "std")]
8546 pub fn name(&self) -> String {
8547 match self {
8548 Digitizers::Digitizer => "Digitizer",
8549 Digitizers::Pen => "Pen",
8550 Digitizers::LightPen => "Light Pen",
8551 Digitizers::TouchScreen => "Touch Screen",
8552 Digitizers::TouchPad => "Touch Pad",
8553 Digitizers::Whiteboard => "Whiteboard",
8554 Digitizers::CoordinateMeasuringMachine => "Coordinate Measuring Machine",
8555 Digitizers::ThreeDDigitizer => "3D Digitizer",
8556 Digitizers::StereoPlotter => "Stereo Plotter",
8557 Digitizers::ArticulatedArm => "Articulated Arm",
8558 Digitizers::Armature => "Armature",
8559 Digitizers::MultiplePointDigitizer => "Multiple Point Digitizer",
8560 Digitizers::FreeSpaceWand => "Free Space Wand",
8561 Digitizers::DeviceConfiguration => "Device Configuration",
8562 Digitizers::CapacitiveHeatMapDigitizer => "Capacitive Heat Map Digitizer",
8563 Digitizers::Stylus => "Stylus",
8564 Digitizers::Puck => "Puck",
8565 Digitizers::Finger => "Finger",
8566 Digitizers::Devicesettings => "Device settings",
8567 Digitizers::CharacterGesture => "Character Gesture",
8568 Digitizers::TipPressure => "Tip Pressure",
8569 Digitizers::BarrelPressure => "Barrel Pressure",
8570 Digitizers::InRange => "In Range",
8571 Digitizers::Touch => "Touch",
8572 Digitizers::Untouch => "Untouch",
8573 Digitizers::Tap => "Tap",
8574 Digitizers::Quality => "Quality",
8575 Digitizers::DataValid => "Data Valid",
8576 Digitizers::TransducerIndex => "Transducer Index",
8577 Digitizers::TabletFunctionKeys => "Tablet Function Keys",
8578 Digitizers::ProgramChangeKeys => "Program Change Keys",
8579 Digitizers::BatteryStrength => "Battery Strength",
8580 Digitizers::Invert => "Invert",
8581 Digitizers::XTilt => "X Tilt",
8582 Digitizers::YTilt => "Y Tilt",
8583 Digitizers::Azimuth => "Azimuth",
8584 Digitizers::Altitude => "Altitude",
8585 Digitizers::Twist => "Twist",
8586 Digitizers::TipSwitch => "Tip Switch",
8587 Digitizers::SecondaryTipSwitch => "Secondary Tip Switch",
8588 Digitizers::BarrelSwitch => "Barrel Switch",
8589 Digitizers::Eraser => "Eraser",
8590 Digitizers::TabletPick => "Tablet Pick",
8591 Digitizers::TouchValid => "Touch Valid",
8592 Digitizers::Width => "Width",
8593 Digitizers::Height => "Height",
8594 Digitizers::ContactIdentifier => "Contact Identifier",
8595 Digitizers::DeviceMode => "Device Mode",
8596 Digitizers::DeviceIdentifier => "Device Identifier",
8597 Digitizers::ContactCount => "Contact Count",
8598 Digitizers::ContactCountMaximum => "Contact Count Maximum",
8599 Digitizers::ScanTime => "Scan Time",
8600 Digitizers::SurfaceSwitch => "Surface Switch",
8601 Digitizers::ButtonSwitch => "Button Switch",
8602 Digitizers::PadType => "Pad Type",
8603 Digitizers::SecondaryBarrelSwitch => "Secondary Barrel Switch",
8604 Digitizers::TransducerSerialNumber => "Transducer Serial Number",
8605 Digitizers::PreferredColor => "Preferred Color",
8606 Digitizers::PreferredColorisLocked => "Preferred Color is Locked",
8607 Digitizers::PreferredLineWidth => "Preferred Line Width",
8608 Digitizers::PreferredLineWidthisLocked => "Preferred Line Width is Locked",
8609 Digitizers::LatencyMode => "Latency Mode",
8610 Digitizers::GestureCharacterQuality => "Gesture Character Quality",
8611 Digitizers::CharacterGestureDataLength => "Character Gesture Data Length",
8612 Digitizers::CharacterGestureData => "Character Gesture Data",
8613 Digitizers::GestureCharacterEncoding => "Gesture Character Encoding",
8614 Digitizers::UTF8CharacterGestureEncoding => "UTF8 Character Gesture Encoding",
8615 Digitizers::UTF16LittleEndianCharacterGestureEncoding => {
8616 "UTF16 Little Endian Character Gesture Encoding"
8617 }
8618 Digitizers::UTF16BigEndianCharacterGestureEncoding => {
8619 "UTF16 Big Endian Character Gesture Encoding"
8620 }
8621 Digitizers::UTF32LittleEndianCharacterGestureEncoding => {
8622 "UTF32 Little Endian Character Gesture Encoding"
8623 }
8624 Digitizers::UTF32BigEndianCharacterGestureEncoding => {
8625 "UTF32 Big Endian Character Gesture Encoding"
8626 }
8627 Digitizers::CapacitiveHeatMapProtocolVendorID => {
8628 "Capacitive Heat Map Protocol Vendor ID"
8629 }
8630 Digitizers::CapacitiveHeatMapProtocolVersion => "Capacitive Heat Map Protocol Version",
8631 Digitizers::CapacitiveHeatMapFrameData => "Capacitive Heat Map Frame Data",
8632 Digitizers::GestureCharacterEnable => "Gesture Character Enable",
8633 Digitizers::TransducerSerialNumberPart2 => "Transducer Serial Number Part 2",
8634 Digitizers::NoPreferredColor => "No Preferred Color",
8635 Digitizers::PreferredLineStyle => "Preferred Line Style",
8636 Digitizers::PreferredLineStyleisLocked => "Preferred Line Style is Locked",
8637 Digitizers::Ink => "Ink",
8638 Digitizers::Pencil => "Pencil",
8639 Digitizers::Highlighter => "Highlighter",
8640 Digitizers::ChiselMarker => "Chisel Marker",
8641 Digitizers::Brush => "Brush",
8642 Digitizers::NoPreference => "No Preference",
8643 Digitizers::DigitizerDiagnostic => "Digitizer Diagnostic",
8644 Digitizers::DigitizerError => "Digitizer Error",
8645 Digitizers::ErrNormalStatus => "Err Normal Status",
8646 Digitizers::ErrTransducersExceeded => "Err Transducers Exceeded",
8647 Digitizers::ErrFullTransFeaturesUnavailable => "Err Full Trans Features Unavailable",
8648 Digitizers::ErrChargeLow => "Err Charge Low",
8649 Digitizers::TransducerSoftwareInfo => "Transducer Software Info",
8650 Digitizers::TransducerVendorId => "Transducer Vendor Id",
8651 Digitizers::TransducerProductId => "Transducer Product Id",
8652 Digitizers::DeviceSupportedProtocols => "Device Supported Protocols",
8653 Digitizers::TransducerSupportedProtocols => "Transducer Supported Protocols",
8654 Digitizers::NoProtocol => "No Protocol",
8655 Digitizers::WacomAESProtocol => "Wacom AES Protocol",
8656 Digitizers::USIProtocol => "USI Protocol",
8657 Digitizers::MicrosoftPenProtocol => "Microsoft Pen Protocol",
8658 Digitizers::SupportedReportRates => "Supported Report Rates",
8659 Digitizers::ReportRate => "Report Rate",
8660 Digitizers::TransducerConnected => "Transducer Connected",
8661 Digitizers::SwitchDisabled => "Switch Disabled",
8662 Digitizers::SwitchUnimplemented => "Switch Unimplemented",
8663 Digitizers::TransducerSwitches => "Transducer Switches",
8664 Digitizers::TransducerIndexSelector => "Transducer Index Selector",
8665 Digitizers::ButtonPressThreshold => "Button Press Threshold",
8666 }
8667 .into()
8668 }
8669}
8670
8671#[cfg(feature = "std")]
8672impl fmt::Display for Digitizers {
8673 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
8674 write!(f, "{}", self.name())
8675 }
8676}
8677
8678impl AsUsage for Digitizers {
8679 fn usage_value(&self) -> u32 {
8681 u32::from(self)
8682 }
8683
8684 fn usage_id_value(&self) -> u16 {
8686 u16::from(self)
8687 }
8688
8689 fn usage(&self) -> Usage {
8700 Usage::from(self)
8701 }
8702}
8703
8704impl AsUsagePage for Digitizers {
8705 fn usage_page_value(&self) -> u16 {
8709 let up = UsagePage::from(self);
8710 u16::from(up)
8711 }
8712
8713 fn usage_page(&self) -> UsagePage {
8715 UsagePage::from(self)
8716 }
8717}
8718
8719impl From<&Digitizers> for u16 {
8720 fn from(digitizers: &Digitizers) -> u16 {
8721 match *digitizers {
8722 Digitizers::Digitizer => 1,
8723 Digitizers::Pen => 2,
8724 Digitizers::LightPen => 3,
8725 Digitizers::TouchScreen => 4,
8726 Digitizers::TouchPad => 5,
8727 Digitizers::Whiteboard => 6,
8728 Digitizers::CoordinateMeasuringMachine => 7,
8729 Digitizers::ThreeDDigitizer => 8,
8730 Digitizers::StereoPlotter => 9,
8731 Digitizers::ArticulatedArm => 10,
8732 Digitizers::Armature => 11,
8733 Digitizers::MultiplePointDigitizer => 12,
8734 Digitizers::FreeSpaceWand => 13,
8735 Digitizers::DeviceConfiguration => 14,
8736 Digitizers::CapacitiveHeatMapDigitizer => 15,
8737 Digitizers::Stylus => 32,
8738 Digitizers::Puck => 33,
8739 Digitizers::Finger => 34,
8740 Digitizers::Devicesettings => 35,
8741 Digitizers::CharacterGesture => 36,
8742 Digitizers::TipPressure => 48,
8743 Digitizers::BarrelPressure => 49,
8744 Digitizers::InRange => 50,
8745 Digitizers::Touch => 51,
8746 Digitizers::Untouch => 52,
8747 Digitizers::Tap => 53,
8748 Digitizers::Quality => 54,
8749 Digitizers::DataValid => 55,
8750 Digitizers::TransducerIndex => 56,
8751 Digitizers::TabletFunctionKeys => 57,
8752 Digitizers::ProgramChangeKeys => 58,
8753 Digitizers::BatteryStrength => 59,
8754 Digitizers::Invert => 60,
8755 Digitizers::XTilt => 61,
8756 Digitizers::YTilt => 62,
8757 Digitizers::Azimuth => 63,
8758 Digitizers::Altitude => 64,
8759 Digitizers::Twist => 65,
8760 Digitizers::TipSwitch => 66,
8761 Digitizers::SecondaryTipSwitch => 67,
8762 Digitizers::BarrelSwitch => 68,
8763 Digitizers::Eraser => 69,
8764 Digitizers::TabletPick => 70,
8765 Digitizers::TouchValid => 71,
8766 Digitizers::Width => 72,
8767 Digitizers::Height => 73,
8768 Digitizers::ContactIdentifier => 81,
8769 Digitizers::DeviceMode => 82,
8770 Digitizers::DeviceIdentifier => 83,
8771 Digitizers::ContactCount => 84,
8772 Digitizers::ContactCountMaximum => 85,
8773 Digitizers::ScanTime => 86,
8774 Digitizers::SurfaceSwitch => 87,
8775 Digitizers::ButtonSwitch => 88,
8776 Digitizers::PadType => 89,
8777 Digitizers::SecondaryBarrelSwitch => 90,
8778 Digitizers::TransducerSerialNumber => 91,
8779 Digitizers::PreferredColor => 92,
8780 Digitizers::PreferredColorisLocked => 93,
8781 Digitizers::PreferredLineWidth => 94,
8782 Digitizers::PreferredLineWidthisLocked => 95,
8783 Digitizers::LatencyMode => 96,
8784 Digitizers::GestureCharacterQuality => 97,
8785 Digitizers::CharacterGestureDataLength => 98,
8786 Digitizers::CharacterGestureData => 99,
8787 Digitizers::GestureCharacterEncoding => 100,
8788 Digitizers::UTF8CharacterGestureEncoding => 101,
8789 Digitizers::UTF16LittleEndianCharacterGestureEncoding => 102,
8790 Digitizers::UTF16BigEndianCharacterGestureEncoding => 103,
8791 Digitizers::UTF32LittleEndianCharacterGestureEncoding => 104,
8792 Digitizers::UTF32BigEndianCharacterGestureEncoding => 105,
8793 Digitizers::CapacitiveHeatMapProtocolVendorID => 106,
8794 Digitizers::CapacitiveHeatMapProtocolVersion => 107,
8795 Digitizers::CapacitiveHeatMapFrameData => 108,
8796 Digitizers::GestureCharacterEnable => 109,
8797 Digitizers::TransducerSerialNumberPart2 => 110,
8798 Digitizers::NoPreferredColor => 111,
8799 Digitizers::PreferredLineStyle => 112,
8800 Digitizers::PreferredLineStyleisLocked => 113,
8801 Digitizers::Ink => 114,
8802 Digitizers::Pencil => 115,
8803 Digitizers::Highlighter => 116,
8804 Digitizers::ChiselMarker => 117,
8805 Digitizers::Brush => 118,
8806 Digitizers::NoPreference => 119,
8807 Digitizers::DigitizerDiagnostic => 128,
8808 Digitizers::DigitizerError => 129,
8809 Digitizers::ErrNormalStatus => 130,
8810 Digitizers::ErrTransducersExceeded => 131,
8811 Digitizers::ErrFullTransFeaturesUnavailable => 132,
8812 Digitizers::ErrChargeLow => 133,
8813 Digitizers::TransducerSoftwareInfo => 144,
8814 Digitizers::TransducerVendorId => 145,
8815 Digitizers::TransducerProductId => 146,
8816 Digitizers::DeviceSupportedProtocols => 147,
8817 Digitizers::TransducerSupportedProtocols => 148,
8818 Digitizers::NoProtocol => 149,
8819 Digitizers::WacomAESProtocol => 150,
8820 Digitizers::USIProtocol => 151,
8821 Digitizers::MicrosoftPenProtocol => 152,
8822 Digitizers::SupportedReportRates => 160,
8823 Digitizers::ReportRate => 161,
8824 Digitizers::TransducerConnected => 162,
8825 Digitizers::SwitchDisabled => 163,
8826 Digitizers::SwitchUnimplemented => 164,
8827 Digitizers::TransducerSwitches => 165,
8828 Digitizers::TransducerIndexSelector => 166,
8829 Digitizers::ButtonPressThreshold => 176,
8830 }
8831 }
8832}
8833
8834impl From<Digitizers> for u16 {
8835 fn from(digitizers: Digitizers) -> u16 {
8838 u16::from(&digitizers)
8839 }
8840}
8841
8842impl From<&Digitizers> for u32 {
8843 fn from(digitizers: &Digitizers) -> u32 {
8846 let up = UsagePage::from(digitizers);
8847 let up = (u16::from(&up) as u32) << 16;
8848 let id = u16::from(digitizers) as u32;
8849 up | id
8850 }
8851}
8852
8853impl From<&Digitizers> for UsagePage {
8854 fn from(_: &Digitizers) -> UsagePage {
8857 UsagePage::Digitizers
8858 }
8859}
8860
8861impl From<Digitizers> for UsagePage {
8862 fn from(_: Digitizers) -> UsagePage {
8865 UsagePage::Digitizers
8866 }
8867}
8868
8869impl From<&Digitizers> for Usage {
8870 fn from(digitizers: &Digitizers) -> Usage {
8871 Usage::try_from(u32::from(digitizers)).unwrap()
8872 }
8873}
8874
8875impl From<Digitizers> for Usage {
8876 fn from(digitizers: Digitizers) -> Usage {
8877 Usage::from(&digitizers)
8878 }
8879}
8880
8881impl TryFrom<u16> for Digitizers {
8882 type Error = HutError;
8883
8884 fn try_from(usage_id: u16) -> Result<Digitizers> {
8885 match usage_id {
8886 1 => Ok(Digitizers::Digitizer),
8887 2 => Ok(Digitizers::Pen),
8888 3 => Ok(Digitizers::LightPen),
8889 4 => Ok(Digitizers::TouchScreen),
8890 5 => Ok(Digitizers::TouchPad),
8891 6 => Ok(Digitizers::Whiteboard),
8892 7 => Ok(Digitizers::CoordinateMeasuringMachine),
8893 8 => Ok(Digitizers::ThreeDDigitizer),
8894 9 => Ok(Digitizers::StereoPlotter),
8895 10 => Ok(Digitizers::ArticulatedArm),
8896 11 => Ok(Digitizers::Armature),
8897 12 => Ok(Digitizers::MultiplePointDigitizer),
8898 13 => Ok(Digitizers::FreeSpaceWand),
8899 14 => Ok(Digitizers::DeviceConfiguration),
8900 15 => Ok(Digitizers::CapacitiveHeatMapDigitizer),
8901 32 => Ok(Digitizers::Stylus),
8902 33 => Ok(Digitizers::Puck),
8903 34 => Ok(Digitizers::Finger),
8904 35 => Ok(Digitizers::Devicesettings),
8905 36 => Ok(Digitizers::CharacterGesture),
8906 48 => Ok(Digitizers::TipPressure),
8907 49 => Ok(Digitizers::BarrelPressure),
8908 50 => Ok(Digitizers::InRange),
8909 51 => Ok(Digitizers::Touch),
8910 52 => Ok(Digitizers::Untouch),
8911 53 => Ok(Digitizers::Tap),
8912 54 => Ok(Digitizers::Quality),
8913 55 => Ok(Digitizers::DataValid),
8914 56 => Ok(Digitizers::TransducerIndex),
8915 57 => Ok(Digitizers::TabletFunctionKeys),
8916 58 => Ok(Digitizers::ProgramChangeKeys),
8917 59 => Ok(Digitizers::BatteryStrength),
8918 60 => Ok(Digitizers::Invert),
8919 61 => Ok(Digitizers::XTilt),
8920 62 => Ok(Digitizers::YTilt),
8921 63 => Ok(Digitizers::Azimuth),
8922 64 => Ok(Digitizers::Altitude),
8923 65 => Ok(Digitizers::Twist),
8924 66 => Ok(Digitizers::TipSwitch),
8925 67 => Ok(Digitizers::SecondaryTipSwitch),
8926 68 => Ok(Digitizers::BarrelSwitch),
8927 69 => Ok(Digitizers::Eraser),
8928 70 => Ok(Digitizers::TabletPick),
8929 71 => Ok(Digitizers::TouchValid),
8930 72 => Ok(Digitizers::Width),
8931 73 => Ok(Digitizers::Height),
8932 81 => Ok(Digitizers::ContactIdentifier),
8933 82 => Ok(Digitizers::DeviceMode),
8934 83 => Ok(Digitizers::DeviceIdentifier),
8935 84 => Ok(Digitizers::ContactCount),
8936 85 => Ok(Digitizers::ContactCountMaximum),
8937 86 => Ok(Digitizers::ScanTime),
8938 87 => Ok(Digitizers::SurfaceSwitch),
8939 88 => Ok(Digitizers::ButtonSwitch),
8940 89 => Ok(Digitizers::PadType),
8941 90 => Ok(Digitizers::SecondaryBarrelSwitch),
8942 91 => Ok(Digitizers::TransducerSerialNumber),
8943 92 => Ok(Digitizers::PreferredColor),
8944 93 => Ok(Digitizers::PreferredColorisLocked),
8945 94 => Ok(Digitizers::PreferredLineWidth),
8946 95 => Ok(Digitizers::PreferredLineWidthisLocked),
8947 96 => Ok(Digitizers::LatencyMode),
8948 97 => Ok(Digitizers::GestureCharacterQuality),
8949 98 => Ok(Digitizers::CharacterGestureDataLength),
8950 99 => Ok(Digitizers::CharacterGestureData),
8951 100 => Ok(Digitizers::GestureCharacterEncoding),
8952 101 => Ok(Digitizers::UTF8CharacterGestureEncoding),
8953 102 => Ok(Digitizers::UTF16LittleEndianCharacterGestureEncoding),
8954 103 => Ok(Digitizers::UTF16BigEndianCharacterGestureEncoding),
8955 104 => Ok(Digitizers::UTF32LittleEndianCharacterGestureEncoding),
8956 105 => Ok(Digitizers::UTF32BigEndianCharacterGestureEncoding),
8957 106 => Ok(Digitizers::CapacitiveHeatMapProtocolVendorID),
8958 107 => Ok(Digitizers::CapacitiveHeatMapProtocolVersion),
8959 108 => Ok(Digitizers::CapacitiveHeatMapFrameData),
8960 109 => Ok(Digitizers::GestureCharacterEnable),
8961 110 => Ok(Digitizers::TransducerSerialNumberPart2),
8962 111 => Ok(Digitizers::NoPreferredColor),
8963 112 => Ok(Digitizers::PreferredLineStyle),
8964 113 => Ok(Digitizers::PreferredLineStyleisLocked),
8965 114 => Ok(Digitizers::Ink),
8966 115 => Ok(Digitizers::Pencil),
8967 116 => Ok(Digitizers::Highlighter),
8968 117 => Ok(Digitizers::ChiselMarker),
8969 118 => Ok(Digitizers::Brush),
8970 119 => Ok(Digitizers::NoPreference),
8971 128 => Ok(Digitizers::DigitizerDiagnostic),
8972 129 => Ok(Digitizers::DigitizerError),
8973 130 => Ok(Digitizers::ErrNormalStatus),
8974 131 => Ok(Digitizers::ErrTransducersExceeded),
8975 132 => Ok(Digitizers::ErrFullTransFeaturesUnavailable),
8976 133 => Ok(Digitizers::ErrChargeLow),
8977 144 => Ok(Digitizers::TransducerSoftwareInfo),
8978 145 => Ok(Digitizers::TransducerVendorId),
8979 146 => Ok(Digitizers::TransducerProductId),
8980 147 => Ok(Digitizers::DeviceSupportedProtocols),
8981 148 => Ok(Digitizers::TransducerSupportedProtocols),
8982 149 => Ok(Digitizers::NoProtocol),
8983 150 => Ok(Digitizers::WacomAESProtocol),
8984 151 => Ok(Digitizers::USIProtocol),
8985 152 => Ok(Digitizers::MicrosoftPenProtocol),
8986 160 => Ok(Digitizers::SupportedReportRates),
8987 161 => Ok(Digitizers::ReportRate),
8988 162 => Ok(Digitizers::TransducerConnected),
8989 163 => Ok(Digitizers::SwitchDisabled),
8990 164 => Ok(Digitizers::SwitchUnimplemented),
8991 165 => Ok(Digitizers::TransducerSwitches),
8992 166 => Ok(Digitizers::TransducerIndexSelector),
8993 176 => Ok(Digitizers::ButtonPressThreshold),
8994 n => Err(HutError::UnknownUsageId { usage_id: n }),
8995 }
8996 }
8997}
8998
8999impl BitOr<u16> for Digitizers {
9000 type Output = Usage;
9001
9002 fn bitor(self, usage: u16) -> Usage {
9009 let up = u16::from(self) as u32;
9010 let u = usage as u32;
9011 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
9012 }
9013}
9014
9015#[allow(non_camel_case_types)]
9036#[derive(Debug)]
9037#[non_exhaustive]
9038pub enum Haptics {
9039 SimpleHapticController,
9041 WaveformList,
9043 DurationList,
9045 AutoTrigger,
9047 ManualTrigger,
9049 AutoTriggerAssociatedControl,
9051 Intensity,
9053 RepeatCount,
9055 RetriggerPeriod,
9057 WaveformVendorPage,
9059 WaveformVendorID,
9061 WaveformCutoffTime,
9063 WaveformNone,
9065 WaveformStop,
9067 WaveformClick,
9069 WaveformBuzzContinuous,
9071 WaveformRumbleContinuous,
9073 WaveformPress,
9075 WaveformRelease,
9077 WaveformHover,
9079 WaveformSuccess,
9081 WaveformError,
9083 WaveformInkContinuous,
9085 WaveformPencilContinuous,
9087 WaveformMarkerContinuous,
9089 WaveformChiselMarkerContinuous,
9091 WaveformBrushContinuous,
9093 WaveformEraserContinuous,
9095 WaveformSparkleContinuous,
9097}
9098
9099impl Haptics {
9100 #[cfg(feature = "std")]
9101 pub fn name(&self) -> String {
9102 match self {
9103 Haptics::SimpleHapticController => "Simple Haptic Controller",
9104 Haptics::WaveformList => "Waveform List",
9105 Haptics::DurationList => "Duration List",
9106 Haptics::AutoTrigger => "Auto Trigger",
9107 Haptics::ManualTrigger => "Manual Trigger",
9108 Haptics::AutoTriggerAssociatedControl => "Auto Trigger Associated Control",
9109 Haptics::Intensity => "Intensity",
9110 Haptics::RepeatCount => "Repeat Count",
9111 Haptics::RetriggerPeriod => "Retrigger Period",
9112 Haptics::WaveformVendorPage => "Waveform Vendor Page",
9113 Haptics::WaveformVendorID => "Waveform Vendor ID",
9114 Haptics::WaveformCutoffTime => "Waveform Cutoff Time",
9115 Haptics::WaveformNone => "Waveform None",
9116 Haptics::WaveformStop => "Waveform Stop",
9117 Haptics::WaveformClick => "Waveform Click",
9118 Haptics::WaveformBuzzContinuous => "Waveform Buzz Continuous",
9119 Haptics::WaveformRumbleContinuous => "Waveform Rumble Continuous",
9120 Haptics::WaveformPress => "Waveform Press",
9121 Haptics::WaveformRelease => "Waveform Release",
9122 Haptics::WaveformHover => "Waveform Hover",
9123 Haptics::WaveformSuccess => "Waveform Success",
9124 Haptics::WaveformError => "Waveform Error",
9125 Haptics::WaveformInkContinuous => "Waveform Ink Continuous",
9126 Haptics::WaveformPencilContinuous => "Waveform Pencil Continuous",
9127 Haptics::WaveformMarkerContinuous => "Waveform Marker Continuous",
9128 Haptics::WaveformChiselMarkerContinuous => "Waveform Chisel Marker Continuous",
9129 Haptics::WaveformBrushContinuous => "Waveform Brush Continuous",
9130 Haptics::WaveformEraserContinuous => "Waveform Eraser Continuous",
9131 Haptics::WaveformSparkleContinuous => "Waveform Sparkle Continuous",
9132 }
9133 .into()
9134 }
9135}
9136
9137#[cfg(feature = "std")]
9138impl fmt::Display for Haptics {
9139 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
9140 write!(f, "{}", self.name())
9141 }
9142}
9143
9144impl AsUsage for Haptics {
9145 fn usage_value(&self) -> u32 {
9147 u32::from(self)
9148 }
9149
9150 fn usage_id_value(&self) -> u16 {
9152 u16::from(self)
9153 }
9154
9155 fn usage(&self) -> Usage {
9166 Usage::from(self)
9167 }
9168}
9169
9170impl AsUsagePage for Haptics {
9171 fn usage_page_value(&self) -> u16 {
9175 let up = UsagePage::from(self);
9176 u16::from(up)
9177 }
9178
9179 fn usage_page(&self) -> UsagePage {
9181 UsagePage::from(self)
9182 }
9183}
9184
9185impl From<&Haptics> for u16 {
9186 fn from(haptics: &Haptics) -> u16 {
9187 match *haptics {
9188 Haptics::SimpleHapticController => 1,
9189 Haptics::WaveformList => 16,
9190 Haptics::DurationList => 17,
9191 Haptics::AutoTrigger => 32,
9192 Haptics::ManualTrigger => 33,
9193 Haptics::AutoTriggerAssociatedControl => 34,
9194 Haptics::Intensity => 35,
9195 Haptics::RepeatCount => 36,
9196 Haptics::RetriggerPeriod => 37,
9197 Haptics::WaveformVendorPage => 38,
9198 Haptics::WaveformVendorID => 39,
9199 Haptics::WaveformCutoffTime => 40,
9200 Haptics::WaveformNone => 4097,
9201 Haptics::WaveformStop => 4098,
9202 Haptics::WaveformClick => 4099,
9203 Haptics::WaveformBuzzContinuous => 4100,
9204 Haptics::WaveformRumbleContinuous => 4101,
9205 Haptics::WaveformPress => 4102,
9206 Haptics::WaveformRelease => 4103,
9207 Haptics::WaveformHover => 4104,
9208 Haptics::WaveformSuccess => 4105,
9209 Haptics::WaveformError => 4106,
9210 Haptics::WaveformInkContinuous => 4107,
9211 Haptics::WaveformPencilContinuous => 4108,
9212 Haptics::WaveformMarkerContinuous => 4109,
9213 Haptics::WaveformChiselMarkerContinuous => 4110,
9214 Haptics::WaveformBrushContinuous => 4111,
9215 Haptics::WaveformEraserContinuous => 4112,
9216 Haptics::WaveformSparkleContinuous => 4113,
9217 }
9218 }
9219}
9220
9221impl From<Haptics> for u16 {
9222 fn from(haptics: Haptics) -> u16 {
9225 u16::from(&haptics)
9226 }
9227}
9228
9229impl From<&Haptics> for u32 {
9230 fn from(haptics: &Haptics) -> u32 {
9233 let up = UsagePage::from(haptics);
9234 let up = (u16::from(&up) as u32) << 16;
9235 let id = u16::from(haptics) as u32;
9236 up | id
9237 }
9238}
9239
9240impl From<&Haptics> for UsagePage {
9241 fn from(_: &Haptics) -> UsagePage {
9244 UsagePage::Haptics
9245 }
9246}
9247
9248impl From<Haptics> for UsagePage {
9249 fn from(_: Haptics) -> UsagePage {
9252 UsagePage::Haptics
9253 }
9254}
9255
9256impl From<&Haptics> for Usage {
9257 fn from(haptics: &Haptics) -> Usage {
9258 Usage::try_from(u32::from(haptics)).unwrap()
9259 }
9260}
9261
9262impl From<Haptics> for Usage {
9263 fn from(haptics: Haptics) -> Usage {
9264 Usage::from(&haptics)
9265 }
9266}
9267
9268impl TryFrom<u16> for Haptics {
9269 type Error = HutError;
9270
9271 fn try_from(usage_id: u16) -> Result<Haptics> {
9272 match usage_id {
9273 1 => Ok(Haptics::SimpleHapticController),
9274 16 => Ok(Haptics::WaveformList),
9275 17 => Ok(Haptics::DurationList),
9276 32 => Ok(Haptics::AutoTrigger),
9277 33 => Ok(Haptics::ManualTrigger),
9278 34 => Ok(Haptics::AutoTriggerAssociatedControl),
9279 35 => Ok(Haptics::Intensity),
9280 36 => Ok(Haptics::RepeatCount),
9281 37 => Ok(Haptics::RetriggerPeriod),
9282 38 => Ok(Haptics::WaveformVendorPage),
9283 39 => Ok(Haptics::WaveformVendorID),
9284 40 => Ok(Haptics::WaveformCutoffTime),
9285 4097 => Ok(Haptics::WaveformNone),
9286 4098 => Ok(Haptics::WaveformStop),
9287 4099 => Ok(Haptics::WaveformClick),
9288 4100 => Ok(Haptics::WaveformBuzzContinuous),
9289 4101 => Ok(Haptics::WaveformRumbleContinuous),
9290 4102 => Ok(Haptics::WaveformPress),
9291 4103 => Ok(Haptics::WaveformRelease),
9292 4104 => Ok(Haptics::WaveformHover),
9293 4105 => Ok(Haptics::WaveformSuccess),
9294 4106 => Ok(Haptics::WaveformError),
9295 4107 => Ok(Haptics::WaveformInkContinuous),
9296 4108 => Ok(Haptics::WaveformPencilContinuous),
9297 4109 => Ok(Haptics::WaveformMarkerContinuous),
9298 4110 => Ok(Haptics::WaveformChiselMarkerContinuous),
9299 4111 => Ok(Haptics::WaveformBrushContinuous),
9300 4112 => Ok(Haptics::WaveformEraserContinuous),
9301 4113 => Ok(Haptics::WaveformSparkleContinuous),
9302 n => Err(HutError::UnknownUsageId { usage_id: n }),
9303 }
9304 }
9305}
9306
9307impl BitOr<u16> for Haptics {
9308 type Output = Usage;
9309
9310 fn bitor(self, usage: u16) -> Usage {
9317 let up = u16::from(self) as u32;
9318 let u = usage as u32;
9319 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
9320 }
9321}
9322
9323#[allow(non_camel_case_types)]
9344#[derive(Debug)]
9345#[non_exhaustive]
9346pub enum PhysicalInputDevice {
9347 PhysicalInputDevice,
9349 Normal,
9351 SetEffectReport,
9353 EffectParameterBlockIndex,
9355 ParameterBlockOffset,
9357 ROMFlag,
9359 EffectType,
9361 ETConstantForce,
9363 ETRamp,
9365 ETCustomForce,
9367 ETSquare,
9369 ETSine,
9371 ETTriangle,
9373 ETSawtoothUp,
9375 ETSawtoothDown,
9377 ETSpring,
9379 ETDamper,
9381 ETInertia,
9383 ETFriction,
9385 Duration,
9387 SamplePeriod,
9389 Gain,
9391 TriggerButton,
9393 TriggerRepeatInterval,
9395 AxesEnable,
9397 DirectionEnable,
9399 Direction,
9401 TypeSpecificBlockOffset,
9403 BlockType,
9405 SetEnvelopeReport,
9407 AttackLevel,
9409 AttackTime,
9411 FadeLevel,
9413 FadeTime,
9415 SetConditionReport,
9417 CenterPointOffset,
9419 PositiveCoefficient,
9421 NegativeCoefficient,
9423 PositiveSaturation,
9425 NegativeSaturation,
9427 DeadBand,
9429 DownloadForceSample,
9431 IsochCustomForceEnable,
9433 CustomForceDataReport,
9435 CustomForceData,
9437 CustomForceVendorDefinedData,
9439 SetCustomForceReport,
9441 CustomForceDataOffset,
9443 SampleCount,
9445 SetPeriodicReport,
9447 Offset,
9449 Magnitude,
9451 Phase,
9453 Period,
9455 SetConstantForceReport,
9457 SetRampForceReport,
9459 RampStart,
9461 RampEnd,
9463 EffectOperationReport,
9465 EffectOperation,
9467 OpEffectStart,
9469 OpEffectStartSolo,
9471 OpEffectStop,
9473 LoopCount,
9475 DeviceGainReport,
9477 DeviceGain,
9479 ParameterBlockPoolsReport,
9481 RAMPoolSize,
9483 ROMPoolSize,
9485 ROMEffectBlockCount,
9487 SimultaneousEffectsMax,
9489 PoolAlignment,
9491 ParameterBlockMoveReport,
9493 MoveSource,
9495 MoveDestination,
9497 MoveLength,
9499 EffectParameterBlockLoadReport,
9501 EffectParameterBlockLoadStatus,
9503 BlockLoadSuccess,
9505 BlockLoadFull,
9507 BlockLoadError,
9509 BlockHandle,
9511 EffectParameterBlockFreeReport,
9513 TypeSpecificBlockHandle,
9515 PIDStateReport,
9517 EffectPlaying,
9519 PIDDeviceControlReport,
9521 PIDDeviceControl,
9523 DCEnableActuators,
9525 DCDisableActuators,
9527 DCStopAllEffects,
9529 DCReset,
9531 DCPause,
9533 DCContinue,
9535 DevicePaused,
9537 ActuatorsEnabled,
9539 SafetySwitch,
9541 ActuatorOverrideSwitch,
9543 ActuatorPower,
9545 StartDelay,
9547 ParameterBlockSize,
9549 DeviceManagedPool,
9551 SharedParameterBlocks,
9553 CreateNewEffectParameterBlockReport,
9555 RAMPoolAvailable,
9557}
9558
9559impl PhysicalInputDevice {
9560 #[cfg(feature = "std")]
9561 pub fn name(&self) -> String {
9562 match self {
9563 PhysicalInputDevice::PhysicalInputDevice => "Physical Input Device",
9564 PhysicalInputDevice::Normal => "Normal",
9565 PhysicalInputDevice::SetEffectReport => "Set Effect Report",
9566 PhysicalInputDevice::EffectParameterBlockIndex => "Effect Parameter Block Index",
9567 PhysicalInputDevice::ParameterBlockOffset => "Parameter Block Offset",
9568 PhysicalInputDevice::ROMFlag => "ROM Flag",
9569 PhysicalInputDevice::EffectType => "Effect Type",
9570 PhysicalInputDevice::ETConstantForce => "ET Constant-Force",
9571 PhysicalInputDevice::ETRamp => "ET Ramp",
9572 PhysicalInputDevice::ETCustomForce => "ET Custom-Force",
9573 PhysicalInputDevice::ETSquare => "ET Square",
9574 PhysicalInputDevice::ETSine => "ET Sine",
9575 PhysicalInputDevice::ETTriangle => "ET Triangle",
9576 PhysicalInputDevice::ETSawtoothUp => "ET Sawtooth Up",
9577 PhysicalInputDevice::ETSawtoothDown => "ET Sawtooth Down",
9578 PhysicalInputDevice::ETSpring => "ET Spring",
9579 PhysicalInputDevice::ETDamper => "ET Damper",
9580 PhysicalInputDevice::ETInertia => "ET Inertia",
9581 PhysicalInputDevice::ETFriction => "ET Friction",
9582 PhysicalInputDevice::Duration => "Duration",
9583 PhysicalInputDevice::SamplePeriod => "Sample Period",
9584 PhysicalInputDevice::Gain => "Gain",
9585 PhysicalInputDevice::TriggerButton => "Trigger Button",
9586 PhysicalInputDevice::TriggerRepeatInterval => "Trigger Repeat Interval",
9587 PhysicalInputDevice::AxesEnable => "Axes Enable",
9588 PhysicalInputDevice::DirectionEnable => "Direction Enable",
9589 PhysicalInputDevice::Direction => "Direction",
9590 PhysicalInputDevice::TypeSpecificBlockOffset => "Type Specific Block Offset",
9591 PhysicalInputDevice::BlockType => "Block Type",
9592 PhysicalInputDevice::SetEnvelopeReport => "Set Envelope Report",
9593 PhysicalInputDevice::AttackLevel => "Attack Level",
9594 PhysicalInputDevice::AttackTime => "Attack Time",
9595 PhysicalInputDevice::FadeLevel => "Fade Level",
9596 PhysicalInputDevice::FadeTime => "Fade Time",
9597 PhysicalInputDevice::SetConditionReport => "Set Condition Report",
9598 PhysicalInputDevice::CenterPointOffset => "Center-Point Offset",
9599 PhysicalInputDevice::PositiveCoefficient => "Positive Coefficient",
9600 PhysicalInputDevice::NegativeCoefficient => "Negative Coefficient",
9601 PhysicalInputDevice::PositiveSaturation => "Positive Saturation",
9602 PhysicalInputDevice::NegativeSaturation => "Negative Saturation",
9603 PhysicalInputDevice::DeadBand => "Dead Band",
9604 PhysicalInputDevice::DownloadForceSample => "Download Force Sample",
9605 PhysicalInputDevice::IsochCustomForceEnable => "Isoch Custom-Force Enable",
9606 PhysicalInputDevice::CustomForceDataReport => "Custom-Force Data Report",
9607 PhysicalInputDevice::CustomForceData => "Custom-Force Data",
9608 PhysicalInputDevice::CustomForceVendorDefinedData => "Custom-Force Vendor Defined Data",
9609 PhysicalInputDevice::SetCustomForceReport => "Set Custom-Force Report",
9610 PhysicalInputDevice::CustomForceDataOffset => "Custom-Force Data Offset",
9611 PhysicalInputDevice::SampleCount => "Sample Count",
9612 PhysicalInputDevice::SetPeriodicReport => "Set Periodic Report",
9613 PhysicalInputDevice::Offset => "Offset",
9614 PhysicalInputDevice::Magnitude => "Magnitude",
9615 PhysicalInputDevice::Phase => "Phase",
9616 PhysicalInputDevice::Period => "Period",
9617 PhysicalInputDevice::SetConstantForceReport => "Set Constant-Force Report",
9618 PhysicalInputDevice::SetRampForceReport => "Set Ramp-Force Report",
9619 PhysicalInputDevice::RampStart => "Ramp Start",
9620 PhysicalInputDevice::RampEnd => "Ramp End",
9621 PhysicalInputDevice::EffectOperationReport => "Effect Operation Report",
9622 PhysicalInputDevice::EffectOperation => "Effect Operation",
9623 PhysicalInputDevice::OpEffectStart => "Op Effect Start",
9624 PhysicalInputDevice::OpEffectStartSolo => "Op Effect Start Solo",
9625 PhysicalInputDevice::OpEffectStop => "Op Effect Stop",
9626 PhysicalInputDevice::LoopCount => "Loop Count",
9627 PhysicalInputDevice::DeviceGainReport => "Device Gain Report",
9628 PhysicalInputDevice::DeviceGain => "Device Gain",
9629 PhysicalInputDevice::ParameterBlockPoolsReport => "Parameter Block Pools Report",
9630 PhysicalInputDevice::RAMPoolSize => "RAM Pool Size",
9631 PhysicalInputDevice::ROMPoolSize => "ROM Pool Size",
9632 PhysicalInputDevice::ROMEffectBlockCount => "ROM Effect Block Count",
9633 PhysicalInputDevice::SimultaneousEffectsMax => "Simultaneous Effects Max",
9634 PhysicalInputDevice::PoolAlignment => "Pool Alignment",
9635 PhysicalInputDevice::ParameterBlockMoveReport => "Parameter Block Move Report",
9636 PhysicalInputDevice::MoveSource => "Move Source",
9637 PhysicalInputDevice::MoveDestination => "Move Destination",
9638 PhysicalInputDevice::MoveLength => "Move Length",
9639 PhysicalInputDevice::EffectParameterBlockLoadReport => {
9640 "Effect Parameter Block Load Report"
9641 }
9642 PhysicalInputDevice::EffectParameterBlockLoadStatus => {
9643 "Effect Parameter Block Load Status"
9644 }
9645 PhysicalInputDevice::BlockLoadSuccess => "Block Load Success",
9646 PhysicalInputDevice::BlockLoadFull => "Block Load Full",
9647 PhysicalInputDevice::BlockLoadError => "Block Load Error",
9648 PhysicalInputDevice::BlockHandle => "Block Handle",
9649 PhysicalInputDevice::EffectParameterBlockFreeReport => {
9650 "Effect Parameter Block Free Report"
9651 }
9652 PhysicalInputDevice::TypeSpecificBlockHandle => "Type Specific Block Handle",
9653 PhysicalInputDevice::PIDStateReport => "PID State Report",
9654 PhysicalInputDevice::EffectPlaying => "Effect Playing",
9655 PhysicalInputDevice::PIDDeviceControlReport => "PID Device Control Report",
9656 PhysicalInputDevice::PIDDeviceControl => "PID Device Control",
9657 PhysicalInputDevice::DCEnableActuators => "DC Enable Actuators",
9658 PhysicalInputDevice::DCDisableActuators => "DC Disable Actuators",
9659 PhysicalInputDevice::DCStopAllEffects => "DC Stop All Effects",
9660 PhysicalInputDevice::DCReset => "DC Reset",
9661 PhysicalInputDevice::DCPause => "DC Pause",
9662 PhysicalInputDevice::DCContinue => "DC Continue",
9663 PhysicalInputDevice::DevicePaused => "Device Paused",
9664 PhysicalInputDevice::ActuatorsEnabled => "Actuators Enabled",
9665 PhysicalInputDevice::SafetySwitch => "Safety Switch",
9666 PhysicalInputDevice::ActuatorOverrideSwitch => "Actuator Override Switch",
9667 PhysicalInputDevice::ActuatorPower => "Actuator Power",
9668 PhysicalInputDevice::StartDelay => "Start Delay",
9669 PhysicalInputDevice::ParameterBlockSize => "Parameter Block Size",
9670 PhysicalInputDevice::DeviceManagedPool => "Device-Managed Pool",
9671 PhysicalInputDevice::SharedParameterBlocks => "Shared Parameter Blocks",
9672 PhysicalInputDevice::CreateNewEffectParameterBlockReport => {
9673 "Create New Effect Parameter Block Report"
9674 }
9675 PhysicalInputDevice::RAMPoolAvailable => "RAM Pool Available",
9676 }
9677 .into()
9678 }
9679}
9680
9681#[cfg(feature = "std")]
9682impl fmt::Display for PhysicalInputDevice {
9683 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
9684 write!(f, "{}", self.name())
9685 }
9686}
9687
9688impl AsUsage for PhysicalInputDevice {
9689 fn usage_value(&self) -> u32 {
9691 u32::from(self)
9692 }
9693
9694 fn usage_id_value(&self) -> u16 {
9696 u16::from(self)
9697 }
9698
9699 fn usage(&self) -> Usage {
9710 Usage::from(self)
9711 }
9712}
9713
9714impl AsUsagePage for PhysicalInputDevice {
9715 fn usage_page_value(&self) -> u16 {
9719 let up = UsagePage::from(self);
9720 u16::from(up)
9721 }
9722
9723 fn usage_page(&self) -> UsagePage {
9725 UsagePage::from(self)
9726 }
9727}
9728
9729impl From<&PhysicalInputDevice> for u16 {
9730 fn from(physicalinputdevice: &PhysicalInputDevice) -> u16 {
9731 match *physicalinputdevice {
9732 PhysicalInputDevice::PhysicalInputDevice => 1,
9733 PhysicalInputDevice::Normal => 32,
9734 PhysicalInputDevice::SetEffectReport => 33,
9735 PhysicalInputDevice::EffectParameterBlockIndex => 34,
9736 PhysicalInputDevice::ParameterBlockOffset => 35,
9737 PhysicalInputDevice::ROMFlag => 36,
9738 PhysicalInputDevice::EffectType => 37,
9739 PhysicalInputDevice::ETConstantForce => 38,
9740 PhysicalInputDevice::ETRamp => 39,
9741 PhysicalInputDevice::ETCustomForce => 40,
9742 PhysicalInputDevice::ETSquare => 48,
9743 PhysicalInputDevice::ETSine => 49,
9744 PhysicalInputDevice::ETTriangle => 50,
9745 PhysicalInputDevice::ETSawtoothUp => 51,
9746 PhysicalInputDevice::ETSawtoothDown => 52,
9747 PhysicalInputDevice::ETSpring => 64,
9748 PhysicalInputDevice::ETDamper => 65,
9749 PhysicalInputDevice::ETInertia => 66,
9750 PhysicalInputDevice::ETFriction => 67,
9751 PhysicalInputDevice::Duration => 80,
9752 PhysicalInputDevice::SamplePeriod => 81,
9753 PhysicalInputDevice::Gain => 82,
9754 PhysicalInputDevice::TriggerButton => 83,
9755 PhysicalInputDevice::TriggerRepeatInterval => 84,
9756 PhysicalInputDevice::AxesEnable => 85,
9757 PhysicalInputDevice::DirectionEnable => 86,
9758 PhysicalInputDevice::Direction => 87,
9759 PhysicalInputDevice::TypeSpecificBlockOffset => 88,
9760 PhysicalInputDevice::BlockType => 89,
9761 PhysicalInputDevice::SetEnvelopeReport => 90,
9762 PhysicalInputDevice::AttackLevel => 91,
9763 PhysicalInputDevice::AttackTime => 92,
9764 PhysicalInputDevice::FadeLevel => 93,
9765 PhysicalInputDevice::FadeTime => 94,
9766 PhysicalInputDevice::SetConditionReport => 95,
9767 PhysicalInputDevice::CenterPointOffset => 96,
9768 PhysicalInputDevice::PositiveCoefficient => 97,
9769 PhysicalInputDevice::NegativeCoefficient => 98,
9770 PhysicalInputDevice::PositiveSaturation => 99,
9771 PhysicalInputDevice::NegativeSaturation => 100,
9772 PhysicalInputDevice::DeadBand => 101,
9773 PhysicalInputDevice::DownloadForceSample => 102,
9774 PhysicalInputDevice::IsochCustomForceEnable => 103,
9775 PhysicalInputDevice::CustomForceDataReport => 104,
9776 PhysicalInputDevice::CustomForceData => 105,
9777 PhysicalInputDevice::CustomForceVendorDefinedData => 106,
9778 PhysicalInputDevice::SetCustomForceReport => 107,
9779 PhysicalInputDevice::CustomForceDataOffset => 108,
9780 PhysicalInputDevice::SampleCount => 109,
9781 PhysicalInputDevice::SetPeriodicReport => 110,
9782 PhysicalInputDevice::Offset => 111,
9783 PhysicalInputDevice::Magnitude => 112,
9784 PhysicalInputDevice::Phase => 113,
9785 PhysicalInputDevice::Period => 114,
9786 PhysicalInputDevice::SetConstantForceReport => 115,
9787 PhysicalInputDevice::SetRampForceReport => 116,
9788 PhysicalInputDevice::RampStart => 117,
9789 PhysicalInputDevice::RampEnd => 118,
9790 PhysicalInputDevice::EffectOperationReport => 119,
9791 PhysicalInputDevice::EffectOperation => 120,
9792 PhysicalInputDevice::OpEffectStart => 121,
9793 PhysicalInputDevice::OpEffectStartSolo => 122,
9794 PhysicalInputDevice::OpEffectStop => 123,
9795 PhysicalInputDevice::LoopCount => 124,
9796 PhysicalInputDevice::DeviceGainReport => 125,
9797 PhysicalInputDevice::DeviceGain => 126,
9798 PhysicalInputDevice::ParameterBlockPoolsReport => 127,
9799 PhysicalInputDevice::RAMPoolSize => 128,
9800 PhysicalInputDevice::ROMPoolSize => 129,
9801 PhysicalInputDevice::ROMEffectBlockCount => 130,
9802 PhysicalInputDevice::SimultaneousEffectsMax => 131,
9803 PhysicalInputDevice::PoolAlignment => 132,
9804 PhysicalInputDevice::ParameterBlockMoveReport => 133,
9805 PhysicalInputDevice::MoveSource => 134,
9806 PhysicalInputDevice::MoveDestination => 135,
9807 PhysicalInputDevice::MoveLength => 136,
9808 PhysicalInputDevice::EffectParameterBlockLoadReport => 137,
9809 PhysicalInputDevice::EffectParameterBlockLoadStatus => 139,
9810 PhysicalInputDevice::BlockLoadSuccess => 140,
9811 PhysicalInputDevice::BlockLoadFull => 141,
9812 PhysicalInputDevice::BlockLoadError => 142,
9813 PhysicalInputDevice::BlockHandle => 143,
9814 PhysicalInputDevice::EffectParameterBlockFreeReport => 144,
9815 PhysicalInputDevice::TypeSpecificBlockHandle => 145,
9816 PhysicalInputDevice::PIDStateReport => 146,
9817 PhysicalInputDevice::EffectPlaying => 148,
9818 PhysicalInputDevice::PIDDeviceControlReport => 149,
9819 PhysicalInputDevice::PIDDeviceControl => 150,
9820 PhysicalInputDevice::DCEnableActuators => 151,
9821 PhysicalInputDevice::DCDisableActuators => 152,
9822 PhysicalInputDevice::DCStopAllEffects => 153,
9823 PhysicalInputDevice::DCReset => 154,
9824 PhysicalInputDevice::DCPause => 155,
9825 PhysicalInputDevice::DCContinue => 156,
9826 PhysicalInputDevice::DevicePaused => 159,
9827 PhysicalInputDevice::ActuatorsEnabled => 160,
9828 PhysicalInputDevice::SafetySwitch => 164,
9829 PhysicalInputDevice::ActuatorOverrideSwitch => 165,
9830 PhysicalInputDevice::ActuatorPower => 166,
9831 PhysicalInputDevice::StartDelay => 167,
9832 PhysicalInputDevice::ParameterBlockSize => 168,
9833 PhysicalInputDevice::DeviceManagedPool => 169,
9834 PhysicalInputDevice::SharedParameterBlocks => 170,
9835 PhysicalInputDevice::CreateNewEffectParameterBlockReport => 171,
9836 PhysicalInputDevice::RAMPoolAvailable => 172,
9837 }
9838 }
9839}
9840
9841impl From<PhysicalInputDevice> for u16 {
9842 fn from(physicalinputdevice: PhysicalInputDevice) -> u16 {
9845 u16::from(&physicalinputdevice)
9846 }
9847}
9848
9849impl From<&PhysicalInputDevice> for u32 {
9850 fn from(physicalinputdevice: &PhysicalInputDevice) -> u32 {
9853 let up = UsagePage::from(physicalinputdevice);
9854 let up = (u16::from(&up) as u32) << 16;
9855 let id = u16::from(physicalinputdevice) as u32;
9856 up | id
9857 }
9858}
9859
9860impl From<&PhysicalInputDevice> for UsagePage {
9861 fn from(_: &PhysicalInputDevice) -> UsagePage {
9864 UsagePage::PhysicalInputDevice
9865 }
9866}
9867
9868impl From<PhysicalInputDevice> for UsagePage {
9869 fn from(_: PhysicalInputDevice) -> UsagePage {
9872 UsagePage::PhysicalInputDevice
9873 }
9874}
9875
9876impl From<&PhysicalInputDevice> for Usage {
9877 fn from(physicalinputdevice: &PhysicalInputDevice) -> Usage {
9878 Usage::try_from(u32::from(physicalinputdevice)).unwrap()
9879 }
9880}
9881
9882impl From<PhysicalInputDevice> for Usage {
9883 fn from(physicalinputdevice: PhysicalInputDevice) -> Usage {
9884 Usage::from(&physicalinputdevice)
9885 }
9886}
9887
9888impl TryFrom<u16> for PhysicalInputDevice {
9889 type Error = HutError;
9890
9891 fn try_from(usage_id: u16) -> Result<PhysicalInputDevice> {
9892 match usage_id {
9893 1 => Ok(PhysicalInputDevice::PhysicalInputDevice),
9894 32 => Ok(PhysicalInputDevice::Normal),
9895 33 => Ok(PhysicalInputDevice::SetEffectReport),
9896 34 => Ok(PhysicalInputDevice::EffectParameterBlockIndex),
9897 35 => Ok(PhysicalInputDevice::ParameterBlockOffset),
9898 36 => Ok(PhysicalInputDevice::ROMFlag),
9899 37 => Ok(PhysicalInputDevice::EffectType),
9900 38 => Ok(PhysicalInputDevice::ETConstantForce),
9901 39 => Ok(PhysicalInputDevice::ETRamp),
9902 40 => Ok(PhysicalInputDevice::ETCustomForce),
9903 48 => Ok(PhysicalInputDevice::ETSquare),
9904 49 => Ok(PhysicalInputDevice::ETSine),
9905 50 => Ok(PhysicalInputDevice::ETTriangle),
9906 51 => Ok(PhysicalInputDevice::ETSawtoothUp),
9907 52 => Ok(PhysicalInputDevice::ETSawtoothDown),
9908 64 => Ok(PhysicalInputDevice::ETSpring),
9909 65 => Ok(PhysicalInputDevice::ETDamper),
9910 66 => Ok(PhysicalInputDevice::ETInertia),
9911 67 => Ok(PhysicalInputDevice::ETFriction),
9912 80 => Ok(PhysicalInputDevice::Duration),
9913 81 => Ok(PhysicalInputDevice::SamplePeriod),
9914 82 => Ok(PhysicalInputDevice::Gain),
9915 83 => Ok(PhysicalInputDevice::TriggerButton),
9916 84 => Ok(PhysicalInputDevice::TriggerRepeatInterval),
9917 85 => Ok(PhysicalInputDevice::AxesEnable),
9918 86 => Ok(PhysicalInputDevice::DirectionEnable),
9919 87 => Ok(PhysicalInputDevice::Direction),
9920 88 => Ok(PhysicalInputDevice::TypeSpecificBlockOffset),
9921 89 => Ok(PhysicalInputDevice::BlockType),
9922 90 => Ok(PhysicalInputDevice::SetEnvelopeReport),
9923 91 => Ok(PhysicalInputDevice::AttackLevel),
9924 92 => Ok(PhysicalInputDevice::AttackTime),
9925 93 => Ok(PhysicalInputDevice::FadeLevel),
9926 94 => Ok(PhysicalInputDevice::FadeTime),
9927 95 => Ok(PhysicalInputDevice::SetConditionReport),
9928 96 => Ok(PhysicalInputDevice::CenterPointOffset),
9929 97 => Ok(PhysicalInputDevice::PositiveCoefficient),
9930 98 => Ok(PhysicalInputDevice::NegativeCoefficient),
9931 99 => Ok(PhysicalInputDevice::PositiveSaturation),
9932 100 => Ok(PhysicalInputDevice::NegativeSaturation),
9933 101 => Ok(PhysicalInputDevice::DeadBand),
9934 102 => Ok(PhysicalInputDevice::DownloadForceSample),
9935 103 => Ok(PhysicalInputDevice::IsochCustomForceEnable),
9936 104 => Ok(PhysicalInputDevice::CustomForceDataReport),
9937 105 => Ok(PhysicalInputDevice::CustomForceData),
9938 106 => Ok(PhysicalInputDevice::CustomForceVendorDefinedData),
9939 107 => Ok(PhysicalInputDevice::SetCustomForceReport),
9940 108 => Ok(PhysicalInputDevice::CustomForceDataOffset),
9941 109 => Ok(PhysicalInputDevice::SampleCount),
9942 110 => Ok(PhysicalInputDevice::SetPeriodicReport),
9943 111 => Ok(PhysicalInputDevice::Offset),
9944 112 => Ok(PhysicalInputDevice::Magnitude),
9945 113 => Ok(PhysicalInputDevice::Phase),
9946 114 => Ok(PhysicalInputDevice::Period),
9947 115 => Ok(PhysicalInputDevice::SetConstantForceReport),
9948 116 => Ok(PhysicalInputDevice::SetRampForceReport),
9949 117 => Ok(PhysicalInputDevice::RampStart),
9950 118 => Ok(PhysicalInputDevice::RampEnd),
9951 119 => Ok(PhysicalInputDevice::EffectOperationReport),
9952 120 => Ok(PhysicalInputDevice::EffectOperation),
9953 121 => Ok(PhysicalInputDevice::OpEffectStart),
9954 122 => Ok(PhysicalInputDevice::OpEffectStartSolo),
9955 123 => Ok(PhysicalInputDevice::OpEffectStop),
9956 124 => Ok(PhysicalInputDevice::LoopCount),
9957 125 => Ok(PhysicalInputDevice::DeviceGainReport),
9958 126 => Ok(PhysicalInputDevice::DeviceGain),
9959 127 => Ok(PhysicalInputDevice::ParameterBlockPoolsReport),
9960 128 => Ok(PhysicalInputDevice::RAMPoolSize),
9961 129 => Ok(PhysicalInputDevice::ROMPoolSize),
9962 130 => Ok(PhysicalInputDevice::ROMEffectBlockCount),
9963 131 => Ok(PhysicalInputDevice::SimultaneousEffectsMax),
9964 132 => Ok(PhysicalInputDevice::PoolAlignment),
9965 133 => Ok(PhysicalInputDevice::ParameterBlockMoveReport),
9966 134 => Ok(PhysicalInputDevice::MoveSource),
9967 135 => Ok(PhysicalInputDevice::MoveDestination),
9968 136 => Ok(PhysicalInputDevice::MoveLength),
9969 137 => Ok(PhysicalInputDevice::EffectParameterBlockLoadReport),
9970 139 => Ok(PhysicalInputDevice::EffectParameterBlockLoadStatus),
9971 140 => Ok(PhysicalInputDevice::BlockLoadSuccess),
9972 141 => Ok(PhysicalInputDevice::BlockLoadFull),
9973 142 => Ok(PhysicalInputDevice::BlockLoadError),
9974 143 => Ok(PhysicalInputDevice::BlockHandle),
9975 144 => Ok(PhysicalInputDevice::EffectParameterBlockFreeReport),
9976 145 => Ok(PhysicalInputDevice::TypeSpecificBlockHandle),
9977 146 => Ok(PhysicalInputDevice::PIDStateReport),
9978 148 => Ok(PhysicalInputDevice::EffectPlaying),
9979 149 => Ok(PhysicalInputDevice::PIDDeviceControlReport),
9980 150 => Ok(PhysicalInputDevice::PIDDeviceControl),
9981 151 => Ok(PhysicalInputDevice::DCEnableActuators),
9982 152 => Ok(PhysicalInputDevice::DCDisableActuators),
9983 153 => Ok(PhysicalInputDevice::DCStopAllEffects),
9984 154 => Ok(PhysicalInputDevice::DCReset),
9985 155 => Ok(PhysicalInputDevice::DCPause),
9986 156 => Ok(PhysicalInputDevice::DCContinue),
9987 159 => Ok(PhysicalInputDevice::DevicePaused),
9988 160 => Ok(PhysicalInputDevice::ActuatorsEnabled),
9989 164 => Ok(PhysicalInputDevice::SafetySwitch),
9990 165 => Ok(PhysicalInputDevice::ActuatorOverrideSwitch),
9991 166 => Ok(PhysicalInputDevice::ActuatorPower),
9992 167 => Ok(PhysicalInputDevice::StartDelay),
9993 168 => Ok(PhysicalInputDevice::ParameterBlockSize),
9994 169 => Ok(PhysicalInputDevice::DeviceManagedPool),
9995 170 => Ok(PhysicalInputDevice::SharedParameterBlocks),
9996 171 => Ok(PhysicalInputDevice::CreateNewEffectParameterBlockReport),
9997 172 => Ok(PhysicalInputDevice::RAMPoolAvailable),
9998 n => Err(HutError::UnknownUsageId { usage_id: n }),
9999 }
10000 }
10001}
10002
10003impl BitOr<u16> for PhysicalInputDevice {
10004 type Output = Usage;
10005
10006 fn bitor(self, usage: u16) -> Usage {
10013 let up = u16::from(self) as u32;
10014 let u = usage as u32;
10015 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
10016 }
10017}
10018
10019#[allow(non_camel_case_types)]
10043#[derive(Debug)]
10044#[non_exhaustive]
10045pub enum Unicode {
10046 Unicode(u16),
10047}
10048
10049impl Unicode {
10050 #[cfg(feature = "std")]
10051 pub fn name(&self) -> String {
10052 match self {
10053 Unicode::Unicode(codepoint) => format!("codepoint {codepoint}"),
10054 }
10055 }
10056}
10057
10058#[cfg(feature = "std")]
10059impl fmt::Display for Unicode {
10060 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10061 write!(f, "{}", self.name())
10062 }
10063}
10064
10065impl AsUsage for Unicode {
10066 fn usage_value(&self) -> u32 {
10068 u32::from(self)
10069 }
10070
10071 fn usage_id_value(&self) -> u16 {
10073 u16::from(self)
10074 }
10075
10076 fn usage(&self) -> Usage {
10087 Usage::from(self)
10088 }
10089}
10090
10091impl AsUsagePage for Unicode {
10092 fn usage_page_value(&self) -> u16 {
10096 let up = UsagePage::from(self);
10097 u16::from(up)
10098 }
10099
10100 fn usage_page(&self) -> UsagePage {
10102 UsagePage::from(self)
10103 }
10104}
10105
10106impl From<&Unicode> for u16 {
10107 fn from(unicode: &Unicode) -> u16 {
10108 match *unicode {
10109 Unicode::Unicode(codepoint) => codepoint,
10110 }
10111 }
10112}
10113
10114impl From<Unicode> for u16 {
10115 fn from(unicode: Unicode) -> u16 {
10118 u16::from(&unicode)
10119 }
10120}
10121
10122impl From<&Unicode> for u32 {
10123 fn from(unicode: &Unicode) -> u32 {
10126 let up = UsagePage::from(unicode);
10127 let up = (u16::from(&up) as u32) << 16;
10128 let id = u16::from(unicode) as u32;
10129 up | id
10130 }
10131}
10132
10133impl From<&Unicode> for UsagePage {
10134 fn from(_: &Unicode) -> UsagePage {
10137 UsagePage::Unicode
10138 }
10139}
10140
10141impl From<Unicode> for UsagePage {
10142 fn from(_: Unicode) -> UsagePage {
10145 UsagePage::Unicode
10146 }
10147}
10148
10149impl From<&Unicode> for Usage {
10150 fn from(unicode: &Unicode) -> Usage {
10151 Usage::try_from(u32::from(unicode)).unwrap()
10152 }
10153}
10154
10155impl From<Unicode> for Usage {
10156 fn from(unicode: Unicode) -> Usage {
10157 Usage::from(&unicode)
10158 }
10159}
10160
10161impl TryFrom<u16> for Unicode {
10162 type Error = HutError;
10163
10164 fn try_from(usage_id: u16) -> Result<Unicode> {
10165 match usage_id {
10166 n => Ok(Unicode::Unicode(n)),
10167 }
10168 }
10169}
10170
10171impl BitOr<u16> for Unicode {
10172 type Output = Usage;
10173
10174 fn bitor(self, usage: u16) -> Usage {
10181 let up = u16::from(self) as u32;
10182 let u = usage as u32;
10183 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
10184 }
10185}
10186
10187#[allow(non_camel_case_types)]
10208#[derive(Debug)]
10209#[non_exhaustive]
10210pub enum SoC {
10211 SocControl,
10213 FirmwareTransfer,
10215 FirmwareFileId,
10217 FileOffsetInBytes,
10219 FileTransferSizeMaxInBytes,
10221 FilePayload,
10223 FilePayloadSizeInBytes,
10225 FilePayloadContainsLastBytes,
10227 FileTransferStop,
10229 FileTransferTillEnd,
10231}
10232
10233impl SoC {
10234 #[cfg(feature = "std")]
10235 pub fn name(&self) -> String {
10236 match self {
10237 SoC::SocControl => "SocControl",
10238 SoC::FirmwareTransfer => "FirmwareTransfer",
10239 SoC::FirmwareFileId => "FirmwareFileId",
10240 SoC::FileOffsetInBytes => "FileOffsetInBytes",
10241 SoC::FileTransferSizeMaxInBytes => "FileTransferSizeMaxInBytes",
10242 SoC::FilePayload => "FilePayload",
10243 SoC::FilePayloadSizeInBytes => "FilePayloadSizeInBytes",
10244 SoC::FilePayloadContainsLastBytes => "FilePayloadContainsLastBytes",
10245 SoC::FileTransferStop => "FileTransferStop",
10246 SoC::FileTransferTillEnd => "FileTransferTillEnd",
10247 }
10248 .into()
10249 }
10250}
10251
10252#[cfg(feature = "std")]
10253impl fmt::Display for SoC {
10254 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10255 write!(f, "{}", self.name())
10256 }
10257}
10258
10259impl AsUsage for SoC {
10260 fn usage_value(&self) -> u32 {
10262 u32::from(self)
10263 }
10264
10265 fn usage_id_value(&self) -> u16 {
10267 u16::from(self)
10268 }
10269
10270 fn usage(&self) -> Usage {
10281 Usage::from(self)
10282 }
10283}
10284
10285impl AsUsagePage for SoC {
10286 fn usage_page_value(&self) -> u16 {
10290 let up = UsagePage::from(self);
10291 u16::from(up)
10292 }
10293
10294 fn usage_page(&self) -> UsagePage {
10296 UsagePage::from(self)
10297 }
10298}
10299
10300impl From<&SoC> for u16 {
10301 fn from(soc: &SoC) -> u16 {
10302 match *soc {
10303 SoC::SocControl => 1,
10304 SoC::FirmwareTransfer => 2,
10305 SoC::FirmwareFileId => 3,
10306 SoC::FileOffsetInBytes => 4,
10307 SoC::FileTransferSizeMaxInBytes => 5,
10308 SoC::FilePayload => 6,
10309 SoC::FilePayloadSizeInBytes => 7,
10310 SoC::FilePayloadContainsLastBytes => 8,
10311 SoC::FileTransferStop => 9,
10312 SoC::FileTransferTillEnd => 10,
10313 }
10314 }
10315}
10316
10317impl From<SoC> for u16 {
10318 fn from(soc: SoC) -> u16 {
10321 u16::from(&soc)
10322 }
10323}
10324
10325impl From<&SoC> for u32 {
10326 fn from(soc: &SoC) -> u32 {
10329 let up = UsagePage::from(soc);
10330 let up = (u16::from(&up) as u32) << 16;
10331 let id = u16::from(soc) as u32;
10332 up | id
10333 }
10334}
10335
10336impl From<&SoC> for UsagePage {
10337 fn from(_: &SoC) -> UsagePage {
10340 UsagePage::SoC
10341 }
10342}
10343
10344impl From<SoC> for UsagePage {
10345 fn from(_: SoC) -> UsagePage {
10348 UsagePage::SoC
10349 }
10350}
10351
10352impl From<&SoC> for Usage {
10353 fn from(soc: &SoC) -> Usage {
10354 Usage::try_from(u32::from(soc)).unwrap()
10355 }
10356}
10357
10358impl From<SoC> for Usage {
10359 fn from(soc: SoC) -> Usage {
10360 Usage::from(&soc)
10361 }
10362}
10363
10364impl TryFrom<u16> for SoC {
10365 type Error = HutError;
10366
10367 fn try_from(usage_id: u16) -> Result<SoC> {
10368 match usage_id {
10369 1 => Ok(SoC::SocControl),
10370 2 => Ok(SoC::FirmwareTransfer),
10371 3 => Ok(SoC::FirmwareFileId),
10372 4 => Ok(SoC::FileOffsetInBytes),
10373 5 => Ok(SoC::FileTransferSizeMaxInBytes),
10374 6 => Ok(SoC::FilePayload),
10375 7 => Ok(SoC::FilePayloadSizeInBytes),
10376 8 => Ok(SoC::FilePayloadContainsLastBytes),
10377 9 => Ok(SoC::FileTransferStop),
10378 10 => Ok(SoC::FileTransferTillEnd),
10379 n => Err(HutError::UnknownUsageId { usage_id: n }),
10380 }
10381 }
10382}
10383
10384impl BitOr<u16> for SoC {
10385 type Output = Usage;
10386
10387 fn bitor(self, usage: u16) -> Usage {
10394 let up = u16::from(self) as u32;
10395 let u = usage as u32;
10396 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
10397 }
10398}
10399
10400#[allow(non_camel_case_types)]
10421#[derive(Debug)]
10422#[non_exhaustive]
10423pub enum EyeandHeadTrackers {
10424 EyeTracker,
10426 HeadTracker,
10428 TrackingData,
10430 Capabilities,
10432 Configuration,
10434 Status,
10436 Control,
10438 SensorTimestamp,
10440 PositionX,
10442 PositionY,
10444 PositionZ,
10446 GazePoint,
10448 LeftEyePosition,
10450 RightEyePosition,
10452 HeadPosition,
10454 HeadDirectionPoint,
10456 RotationaboutXaxis,
10458 RotationaboutYaxis,
10460 RotationaboutZaxis,
10462 TrackerQuality,
10464 MinimumTrackingDistance,
10466 OptimumTrackingDistance,
10468 MaximumTrackingDistance,
10470 MaximumScreenPlaneWidth,
10472 MaximumScreenPlaneHeight,
10474 DisplayManufacturerID,
10476 DisplayProductID,
10478 DisplaySerialNumber,
10480 DisplayManufacturerDate,
10482 CalibratedScreenWidth,
10484 CalibratedScreenHeight,
10486 SamplingFrequency,
10488 ConfigurationStatus,
10490 DeviceModeRequest,
10492}
10493
10494impl EyeandHeadTrackers {
10495 #[cfg(feature = "std")]
10496 pub fn name(&self) -> String {
10497 match self {
10498 EyeandHeadTrackers::EyeTracker => "Eye Tracker",
10499 EyeandHeadTrackers::HeadTracker => "Head Tracker",
10500 EyeandHeadTrackers::TrackingData => "Tracking Data",
10501 EyeandHeadTrackers::Capabilities => "Capabilities",
10502 EyeandHeadTrackers::Configuration => "Configuration",
10503 EyeandHeadTrackers::Status => "Status",
10504 EyeandHeadTrackers::Control => "Control",
10505 EyeandHeadTrackers::SensorTimestamp => "Sensor Timestamp",
10506 EyeandHeadTrackers::PositionX => "Position X",
10507 EyeandHeadTrackers::PositionY => "Position Y",
10508 EyeandHeadTrackers::PositionZ => "Position Z",
10509 EyeandHeadTrackers::GazePoint => "Gaze Point",
10510 EyeandHeadTrackers::LeftEyePosition => "Left Eye Position",
10511 EyeandHeadTrackers::RightEyePosition => "Right Eye Position",
10512 EyeandHeadTrackers::HeadPosition => "Head Position",
10513 EyeandHeadTrackers::HeadDirectionPoint => "Head Direction Point",
10514 EyeandHeadTrackers::RotationaboutXaxis => "Rotation about X axis",
10515 EyeandHeadTrackers::RotationaboutYaxis => "Rotation about Y axis",
10516 EyeandHeadTrackers::RotationaboutZaxis => "Rotation about Z axis",
10517 EyeandHeadTrackers::TrackerQuality => "Tracker Quality",
10518 EyeandHeadTrackers::MinimumTrackingDistance => "Minimum Tracking Distance",
10519 EyeandHeadTrackers::OptimumTrackingDistance => "Optimum Tracking Distance",
10520 EyeandHeadTrackers::MaximumTrackingDistance => "Maximum Tracking Distance",
10521 EyeandHeadTrackers::MaximumScreenPlaneWidth => "Maximum Screen Plane Width",
10522 EyeandHeadTrackers::MaximumScreenPlaneHeight => "Maximum Screen Plane Height",
10523 EyeandHeadTrackers::DisplayManufacturerID => "Display Manufacturer ID",
10524 EyeandHeadTrackers::DisplayProductID => "Display Product ID",
10525 EyeandHeadTrackers::DisplaySerialNumber => "Display Serial Number",
10526 EyeandHeadTrackers::DisplayManufacturerDate => "Display Manufacturer Date",
10527 EyeandHeadTrackers::CalibratedScreenWidth => "Calibrated Screen Width",
10528 EyeandHeadTrackers::CalibratedScreenHeight => "Calibrated Screen Height",
10529 EyeandHeadTrackers::SamplingFrequency => "Sampling Frequency",
10530 EyeandHeadTrackers::ConfigurationStatus => "Configuration Status",
10531 EyeandHeadTrackers::DeviceModeRequest => "Device Mode Request",
10532 }
10533 .into()
10534 }
10535}
10536
10537#[cfg(feature = "std")]
10538impl fmt::Display for EyeandHeadTrackers {
10539 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10540 write!(f, "{}", self.name())
10541 }
10542}
10543
10544impl AsUsage for EyeandHeadTrackers {
10545 fn usage_value(&self) -> u32 {
10547 u32::from(self)
10548 }
10549
10550 fn usage_id_value(&self) -> u16 {
10552 u16::from(self)
10553 }
10554
10555 fn usage(&self) -> Usage {
10566 Usage::from(self)
10567 }
10568}
10569
10570impl AsUsagePage for EyeandHeadTrackers {
10571 fn usage_page_value(&self) -> u16 {
10575 let up = UsagePage::from(self);
10576 u16::from(up)
10577 }
10578
10579 fn usage_page(&self) -> UsagePage {
10581 UsagePage::from(self)
10582 }
10583}
10584
10585impl From<&EyeandHeadTrackers> for u16 {
10586 fn from(eyeandheadtrackers: &EyeandHeadTrackers) -> u16 {
10587 match *eyeandheadtrackers {
10588 EyeandHeadTrackers::EyeTracker => 1,
10589 EyeandHeadTrackers::HeadTracker => 2,
10590 EyeandHeadTrackers::TrackingData => 16,
10591 EyeandHeadTrackers::Capabilities => 17,
10592 EyeandHeadTrackers::Configuration => 18,
10593 EyeandHeadTrackers::Status => 19,
10594 EyeandHeadTrackers::Control => 20,
10595 EyeandHeadTrackers::SensorTimestamp => 32,
10596 EyeandHeadTrackers::PositionX => 33,
10597 EyeandHeadTrackers::PositionY => 34,
10598 EyeandHeadTrackers::PositionZ => 35,
10599 EyeandHeadTrackers::GazePoint => 36,
10600 EyeandHeadTrackers::LeftEyePosition => 37,
10601 EyeandHeadTrackers::RightEyePosition => 38,
10602 EyeandHeadTrackers::HeadPosition => 39,
10603 EyeandHeadTrackers::HeadDirectionPoint => 40,
10604 EyeandHeadTrackers::RotationaboutXaxis => 41,
10605 EyeandHeadTrackers::RotationaboutYaxis => 42,
10606 EyeandHeadTrackers::RotationaboutZaxis => 43,
10607 EyeandHeadTrackers::TrackerQuality => 256,
10608 EyeandHeadTrackers::MinimumTrackingDistance => 257,
10609 EyeandHeadTrackers::OptimumTrackingDistance => 258,
10610 EyeandHeadTrackers::MaximumTrackingDistance => 259,
10611 EyeandHeadTrackers::MaximumScreenPlaneWidth => 260,
10612 EyeandHeadTrackers::MaximumScreenPlaneHeight => 261,
10613 EyeandHeadTrackers::DisplayManufacturerID => 512,
10614 EyeandHeadTrackers::DisplayProductID => 513,
10615 EyeandHeadTrackers::DisplaySerialNumber => 514,
10616 EyeandHeadTrackers::DisplayManufacturerDate => 515,
10617 EyeandHeadTrackers::CalibratedScreenWidth => 516,
10618 EyeandHeadTrackers::CalibratedScreenHeight => 517,
10619 EyeandHeadTrackers::SamplingFrequency => 768,
10620 EyeandHeadTrackers::ConfigurationStatus => 769,
10621 EyeandHeadTrackers::DeviceModeRequest => 1024,
10622 }
10623 }
10624}
10625
10626impl From<EyeandHeadTrackers> for u16 {
10627 fn from(eyeandheadtrackers: EyeandHeadTrackers) -> u16 {
10630 u16::from(&eyeandheadtrackers)
10631 }
10632}
10633
10634impl From<&EyeandHeadTrackers> for u32 {
10635 fn from(eyeandheadtrackers: &EyeandHeadTrackers) -> u32 {
10638 let up = UsagePage::from(eyeandheadtrackers);
10639 let up = (u16::from(&up) as u32) << 16;
10640 let id = u16::from(eyeandheadtrackers) as u32;
10641 up | id
10642 }
10643}
10644
10645impl From<&EyeandHeadTrackers> for UsagePage {
10646 fn from(_: &EyeandHeadTrackers) -> UsagePage {
10649 UsagePage::EyeandHeadTrackers
10650 }
10651}
10652
10653impl From<EyeandHeadTrackers> for UsagePage {
10654 fn from(_: EyeandHeadTrackers) -> UsagePage {
10657 UsagePage::EyeandHeadTrackers
10658 }
10659}
10660
10661impl From<&EyeandHeadTrackers> for Usage {
10662 fn from(eyeandheadtrackers: &EyeandHeadTrackers) -> Usage {
10663 Usage::try_from(u32::from(eyeandheadtrackers)).unwrap()
10664 }
10665}
10666
10667impl From<EyeandHeadTrackers> for Usage {
10668 fn from(eyeandheadtrackers: EyeandHeadTrackers) -> Usage {
10669 Usage::from(&eyeandheadtrackers)
10670 }
10671}
10672
10673impl TryFrom<u16> for EyeandHeadTrackers {
10674 type Error = HutError;
10675
10676 fn try_from(usage_id: u16) -> Result<EyeandHeadTrackers> {
10677 match usage_id {
10678 1 => Ok(EyeandHeadTrackers::EyeTracker),
10679 2 => Ok(EyeandHeadTrackers::HeadTracker),
10680 16 => Ok(EyeandHeadTrackers::TrackingData),
10681 17 => Ok(EyeandHeadTrackers::Capabilities),
10682 18 => Ok(EyeandHeadTrackers::Configuration),
10683 19 => Ok(EyeandHeadTrackers::Status),
10684 20 => Ok(EyeandHeadTrackers::Control),
10685 32 => Ok(EyeandHeadTrackers::SensorTimestamp),
10686 33 => Ok(EyeandHeadTrackers::PositionX),
10687 34 => Ok(EyeandHeadTrackers::PositionY),
10688 35 => Ok(EyeandHeadTrackers::PositionZ),
10689 36 => Ok(EyeandHeadTrackers::GazePoint),
10690 37 => Ok(EyeandHeadTrackers::LeftEyePosition),
10691 38 => Ok(EyeandHeadTrackers::RightEyePosition),
10692 39 => Ok(EyeandHeadTrackers::HeadPosition),
10693 40 => Ok(EyeandHeadTrackers::HeadDirectionPoint),
10694 41 => Ok(EyeandHeadTrackers::RotationaboutXaxis),
10695 42 => Ok(EyeandHeadTrackers::RotationaboutYaxis),
10696 43 => Ok(EyeandHeadTrackers::RotationaboutZaxis),
10697 256 => Ok(EyeandHeadTrackers::TrackerQuality),
10698 257 => Ok(EyeandHeadTrackers::MinimumTrackingDistance),
10699 258 => Ok(EyeandHeadTrackers::OptimumTrackingDistance),
10700 259 => Ok(EyeandHeadTrackers::MaximumTrackingDistance),
10701 260 => Ok(EyeandHeadTrackers::MaximumScreenPlaneWidth),
10702 261 => Ok(EyeandHeadTrackers::MaximumScreenPlaneHeight),
10703 512 => Ok(EyeandHeadTrackers::DisplayManufacturerID),
10704 513 => Ok(EyeandHeadTrackers::DisplayProductID),
10705 514 => Ok(EyeandHeadTrackers::DisplaySerialNumber),
10706 515 => Ok(EyeandHeadTrackers::DisplayManufacturerDate),
10707 516 => Ok(EyeandHeadTrackers::CalibratedScreenWidth),
10708 517 => Ok(EyeandHeadTrackers::CalibratedScreenHeight),
10709 768 => Ok(EyeandHeadTrackers::SamplingFrequency),
10710 769 => Ok(EyeandHeadTrackers::ConfigurationStatus),
10711 1024 => Ok(EyeandHeadTrackers::DeviceModeRequest),
10712 n => Err(HutError::UnknownUsageId { usage_id: n }),
10713 }
10714 }
10715}
10716
10717impl BitOr<u16> for EyeandHeadTrackers {
10718 type Output = Usage;
10719
10720 fn bitor(self, usage: u16) -> Usage {
10727 let up = u16::from(self) as u32;
10728 let u = usage as u32;
10729 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
10730 }
10731}
10732
10733#[allow(non_camel_case_types)]
10754#[derive(Debug)]
10755#[non_exhaustive]
10756pub enum AuxiliaryDisplay {
10757 AlphanumericDisplay,
10759 AuxiliaryDisplay,
10761 DisplayAttributesReport,
10763 ASCIICharacterSet,
10765 DataReadBack,
10767 FontReadBack,
10769 DisplayControlReport,
10771 ClearDisplay,
10773 DisplayEnable,
10775 ScreenSaverDelay,
10777 ScreenSaverEnable,
10779 VerticalScroll,
10781 HorizontalScroll,
10783 CharacterReport,
10785 DisplayData,
10787 DisplayStatus,
10789 StatNotReady,
10791 StatReady,
10793 ErrNotaloadablecharacter,
10795 ErrFontdatacannotberead,
10797 CursorPositionReport,
10799 Row,
10801 Column,
10803 Rows,
10805 Columns,
10807 CursorPixelPositioning,
10809 CursorMode,
10811 CursorEnable,
10813 CursorBlink,
10815 FontReport,
10817 FontData,
10819 CharacterWidth,
10821 CharacterHeight,
10823 CharacterSpacingHorizontal,
10825 CharacterSpacingVertical,
10827 UnicodeCharacterSet,
10829 Font7Segment,
10831 SevenSegmentDirectMap,
10833 Font14Segment,
10835 One4SegmentDirectMap,
10837 DisplayBrightness,
10839 DisplayContrast,
10841 CharacterAttribute,
10843 AttributeReadback,
10845 AttributeData,
10847 CharAttrEnhance,
10849 CharAttrUnderline,
10851 CharAttrBlink,
10853 BitmapSizeX,
10855 BitmapSizeY,
10857 MaxBlitSize,
10859 BitDepthFormat,
10861 DisplayOrientation,
10863 PaletteReport,
10865 PaletteDataSize,
10867 PaletteDataOffset,
10869 PaletteData,
10871 BlitReport,
10873 BlitRectangleX1,
10875 BlitRectangleY1,
10877 BlitRectangleX2,
10879 BlitRectangleY2,
10881 BlitData,
10883 SoftButton,
10885 SoftButtonID,
10887 SoftButtonSide,
10889 SoftButtonOffset1,
10891 SoftButtonOffset2,
10893 SoftButtonReport,
10895 SoftKeys,
10897 DisplayDataExtensions,
10899 CharacterMapping,
10901 UnicodeEquivalent,
10903 CharacterPageMapping,
10905 RequestReport,
10907}
10908
10909impl AuxiliaryDisplay {
10910 #[cfg(feature = "std")]
10911 pub fn name(&self) -> String {
10912 match self {
10913 AuxiliaryDisplay::AlphanumericDisplay => "Alphanumeric Display",
10914 AuxiliaryDisplay::AuxiliaryDisplay => "Auxiliary Display",
10915 AuxiliaryDisplay::DisplayAttributesReport => "Display Attributes Report",
10916 AuxiliaryDisplay::ASCIICharacterSet => "ASCII Character Set",
10917 AuxiliaryDisplay::DataReadBack => "Data Read Back",
10918 AuxiliaryDisplay::FontReadBack => "Font Read Back",
10919 AuxiliaryDisplay::DisplayControlReport => "Display Control Report",
10920 AuxiliaryDisplay::ClearDisplay => "Clear Display",
10921 AuxiliaryDisplay::DisplayEnable => "Display Enable",
10922 AuxiliaryDisplay::ScreenSaverDelay => "Screen Saver Delay",
10923 AuxiliaryDisplay::ScreenSaverEnable => "Screen Saver Enable",
10924 AuxiliaryDisplay::VerticalScroll => "Vertical Scroll",
10925 AuxiliaryDisplay::HorizontalScroll => "Horizontal Scroll",
10926 AuxiliaryDisplay::CharacterReport => "Character Report",
10927 AuxiliaryDisplay::DisplayData => "Display Data",
10928 AuxiliaryDisplay::DisplayStatus => "Display Status",
10929 AuxiliaryDisplay::StatNotReady => "Stat Not Ready",
10930 AuxiliaryDisplay::StatReady => "Stat Ready",
10931 AuxiliaryDisplay::ErrNotaloadablecharacter => "Err Not a loadable character",
10932 AuxiliaryDisplay::ErrFontdatacannotberead => "Err Font data cannot be read",
10933 AuxiliaryDisplay::CursorPositionReport => "Cursor Position Report",
10934 AuxiliaryDisplay::Row => "Row",
10935 AuxiliaryDisplay::Column => "Column",
10936 AuxiliaryDisplay::Rows => "Rows",
10937 AuxiliaryDisplay::Columns => "Columns",
10938 AuxiliaryDisplay::CursorPixelPositioning => "Cursor Pixel Positioning",
10939 AuxiliaryDisplay::CursorMode => "Cursor Mode",
10940 AuxiliaryDisplay::CursorEnable => "Cursor Enable",
10941 AuxiliaryDisplay::CursorBlink => "Cursor Blink",
10942 AuxiliaryDisplay::FontReport => "Font Report",
10943 AuxiliaryDisplay::FontData => "Font Data",
10944 AuxiliaryDisplay::CharacterWidth => "Character Width",
10945 AuxiliaryDisplay::CharacterHeight => "Character Height",
10946 AuxiliaryDisplay::CharacterSpacingHorizontal => "Character Spacing Horizontal",
10947 AuxiliaryDisplay::CharacterSpacingVertical => "Character Spacing Vertical",
10948 AuxiliaryDisplay::UnicodeCharacterSet => "Unicode Character Set",
10949 AuxiliaryDisplay::Font7Segment => "Font 7-Segment",
10950 AuxiliaryDisplay::SevenSegmentDirectMap => "7-Segment Direct Map",
10951 AuxiliaryDisplay::Font14Segment => "Font 14-Segment",
10952 AuxiliaryDisplay::One4SegmentDirectMap => "14-Segment Direct Map",
10953 AuxiliaryDisplay::DisplayBrightness => "Display Brightness",
10954 AuxiliaryDisplay::DisplayContrast => "Display Contrast",
10955 AuxiliaryDisplay::CharacterAttribute => "Character Attribute",
10956 AuxiliaryDisplay::AttributeReadback => "Attribute Readback",
10957 AuxiliaryDisplay::AttributeData => "Attribute Data",
10958 AuxiliaryDisplay::CharAttrEnhance => "Char Attr Enhance",
10959 AuxiliaryDisplay::CharAttrUnderline => "Char Attr Underline",
10960 AuxiliaryDisplay::CharAttrBlink => "Char Attr Blink",
10961 AuxiliaryDisplay::BitmapSizeX => "Bitmap Size X",
10962 AuxiliaryDisplay::BitmapSizeY => "Bitmap Size Y",
10963 AuxiliaryDisplay::MaxBlitSize => "Max Blit Size",
10964 AuxiliaryDisplay::BitDepthFormat => "Bit Depth Format",
10965 AuxiliaryDisplay::DisplayOrientation => "Display Orientation",
10966 AuxiliaryDisplay::PaletteReport => "Palette Report",
10967 AuxiliaryDisplay::PaletteDataSize => "Palette Data Size",
10968 AuxiliaryDisplay::PaletteDataOffset => "Palette Data Offset",
10969 AuxiliaryDisplay::PaletteData => "Palette Data",
10970 AuxiliaryDisplay::BlitReport => "Blit Report",
10971 AuxiliaryDisplay::BlitRectangleX1 => "Blit Rectangle X1",
10972 AuxiliaryDisplay::BlitRectangleY1 => "Blit Rectangle Y1",
10973 AuxiliaryDisplay::BlitRectangleX2 => "Blit Rectangle X2",
10974 AuxiliaryDisplay::BlitRectangleY2 => "Blit Rectangle Y2",
10975 AuxiliaryDisplay::BlitData => "Blit Data",
10976 AuxiliaryDisplay::SoftButton => "Soft Button",
10977 AuxiliaryDisplay::SoftButtonID => "Soft Button ID",
10978 AuxiliaryDisplay::SoftButtonSide => "Soft Button Side",
10979 AuxiliaryDisplay::SoftButtonOffset1 => "Soft Button Offset 1",
10980 AuxiliaryDisplay::SoftButtonOffset2 => "Soft Button Offset 2",
10981 AuxiliaryDisplay::SoftButtonReport => "Soft Button Report",
10982 AuxiliaryDisplay::SoftKeys => "Soft Keys",
10983 AuxiliaryDisplay::DisplayDataExtensions => "Display Data Extensions",
10984 AuxiliaryDisplay::CharacterMapping => "Character Mapping",
10985 AuxiliaryDisplay::UnicodeEquivalent => "Unicode Equivalent",
10986 AuxiliaryDisplay::CharacterPageMapping => "Character Page Mapping",
10987 AuxiliaryDisplay::RequestReport => "Request Report",
10988 }
10989 .into()
10990 }
10991}
10992
10993#[cfg(feature = "std")]
10994impl fmt::Display for AuxiliaryDisplay {
10995 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10996 write!(f, "{}", self.name())
10997 }
10998}
10999
11000impl AsUsage for AuxiliaryDisplay {
11001 fn usage_value(&self) -> u32 {
11003 u32::from(self)
11004 }
11005
11006 fn usage_id_value(&self) -> u16 {
11008 u16::from(self)
11009 }
11010
11011 fn usage(&self) -> Usage {
11022 Usage::from(self)
11023 }
11024}
11025
11026impl AsUsagePage for AuxiliaryDisplay {
11027 fn usage_page_value(&self) -> u16 {
11031 let up = UsagePage::from(self);
11032 u16::from(up)
11033 }
11034
11035 fn usage_page(&self) -> UsagePage {
11037 UsagePage::from(self)
11038 }
11039}
11040
11041impl From<&AuxiliaryDisplay> for u16 {
11042 fn from(auxiliarydisplay: &AuxiliaryDisplay) -> u16 {
11043 match *auxiliarydisplay {
11044 AuxiliaryDisplay::AlphanumericDisplay => 1,
11045 AuxiliaryDisplay::AuxiliaryDisplay => 2,
11046 AuxiliaryDisplay::DisplayAttributesReport => 32,
11047 AuxiliaryDisplay::ASCIICharacterSet => 33,
11048 AuxiliaryDisplay::DataReadBack => 34,
11049 AuxiliaryDisplay::FontReadBack => 35,
11050 AuxiliaryDisplay::DisplayControlReport => 36,
11051 AuxiliaryDisplay::ClearDisplay => 37,
11052 AuxiliaryDisplay::DisplayEnable => 38,
11053 AuxiliaryDisplay::ScreenSaverDelay => 39,
11054 AuxiliaryDisplay::ScreenSaverEnable => 40,
11055 AuxiliaryDisplay::VerticalScroll => 41,
11056 AuxiliaryDisplay::HorizontalScroll => 42,
11057 AuxiliaryDisplay::CharacterReport => 43,
11058 AuxiliaryDisplay::DisplayData => 44,
11059 AuxiliaryDisplay::DisplayStatus => 45,
11060 AuxiliaryDisplay::StatNotReady => 46,
11061 AuxiliaryDisplay::StatReady => 47,
11062 AuxiliaryDisplay::ErrNotaloadablecharacter => 48,
11063 AuxiliaryDisplay::ErrFontdatacannotberead => 49,
11064 AuxiliaryDisplay::CursorPositionReport => 50,
11065 AuxiliaryDisplay::Row => 51,
11066 AuxiliaryDisplay::Column => 52,
11067 AuxiliaryDisplay::Rows => 53,
11068 AuxiliaryDisplay::Columns => 54,
11069 AuxiliaryDisplay::CursorPixelPositioning => 55,
11070 AuxiliaryDisplay::CursorMode => 56,
11071 AuxiliaryDisplay::CursorEnable => 57,
11072 AuxiliaryDisplay::CursorBlink => 58,
11073 AuxiliaryDisplay::FontReport => 59,
11074 AuxiliaryDisplay::FontData => 60,
11075 AuxiliaryDisplay::CharacterWidth => 61,
11076 AuxiliaryDisplay::CharacterHeight => 62,
11077 AuxiliaryDisplay::CharacterSpacingHorizontal => 63,
11078 AuxiliaryDisplay::CharacterSpacingVertical => 64,
11079 AuxiliaryDisplay::UnicodeCharacterSet => 65,
11080 AuxiliaryDisplay::Font7Segment => 66,
11081 AuxiliaryDisplay::SevenSegmentDirectMap => 67,
11082 AuxiliaryDisplay::Font14Segment => 68,
11083 AuxiliaryDisplay::One4SegmentDirectMap => 69,
11084 AuxiliaryDisplay::DisplayBrightness => 70,
11085 AuxiliaryDisplay::DisplayContrast => 71,
11086 AuxiliaryDisplay::CharacterAttribute => 72,
11087 AuxiliaryDisplay::AttributeReadback => 73,
11088 AuxiliaryDisplay::AttributeData => 74,
11089 AuxiliaryDisplay::CharAttrEnhance => 75,
11090 AuxiliaryDisplay::CharAttrUnderline => 76,
11091 AuxiliaryDisplay::CharAttrBlink => 77,
11092 AuxiliaryDisplay::BitmapSizeX => 128,
11093 AuxiliaryDisplay::BitmapSizeY => 129,
11094 AuxiliaryDisplay::MaxBlitSize => 130,
11095 AuxiliaryDisplay::BitDepthFormat => 131,
11096 AuxiliaryDisplay::DisplayOrientation => 132,
11097 AuxiliaryDisplay::PaletteReport => 133,
11098 AuxiliaryDisplay::PaletteDataSize => 134,
11099 AuxiliaryDisplay::PaletteDataOffset => 135,
11100 AuxiliaryDisplay::PaletteData => 136,
11101 AuxiliaryDisplay::BlitReport => 138,
11102 AuxiliaryDisplay::BlitRectangleX1 => 139,
11103 AuxiliaryDisplay::BlitRectangleY1 => 140,
11104 AuxiliaryDisplay::BlitRectangleX2 => 141,
11105 AuxiliaryDisplay::BlitRectangleY2 => 142,
11106 AuxiliaryDisplay::BlitData => 143,
11107 AuxiliaryDisplay::SoftButton => 144,
11108 AuxiliaryDisplay::SoftButtonID => 145,
11109 AuxiliaryDisplay::SoftButtonSide => 146,
11110 AuxiliaryDisplay::SoftButtonOffset1 => 147,
11111 AuxiliaryDisplay::SoftButtonOffset2 => 148,
11112 AuxiliaryDisplay::SoftButtonReport => 149,
11113 AuxiliaryDisplay::SoftKeys => 194,
11114 AuxiliaryDisplay::DisplayDataExtensions => 204,
11115 AuxiliaryDisplay::CharacterMapping => 207,
11116 AuxiliaryDisplay::UnicodeEquivalent => 221,
11117 AuxiliaryDisplay::CharacterPageMapping => 223,
11118 AuxiliaryDisplay::RequestReport => 255,
11119 }
11120 }
11121}
11122
11123impl From<AuxiliaryDisplay> for u16 {
11124 fn from(auxiliarydisplay: AuxiliaryDisplay) -> u16 {
11127 u16::from(&auxiliarydisplay)
11128 }
11129}
11130
11131impl From<&AuxiliaryDisplay> for u32 {
11132 fn from(auxiliarydisplay: &AuxiliaryDisplay) -> u32 {
11135 let up = UsagePage::from(auxiliarydisplay);
11136 let up = (u16::from(&up) as u32) << 16;
11137 let id = u16::from(auxiliarydisplay) as u32;
11138 up | id
11139 }
11140}
11141
11142impl From<&AuxiliaryDisplay> for UsagePage {
11143 fn from(_: &AuxiliaryDisplay) -> UsagePage {
11146 UsagePage::AuxiliaryDisplay
11147 }
11148}
11149
11150impl From<AuxiliaryDisplay> for UsagePage {
11151 fn from(_: AuxiliaryDisplay) -> UsagePage {
11154 UsagePage::AuxiliaryDisplay
11155 }
11156}
11157
11158impl From<&AuxiliaryDisplay> for Usage {
11159 fn from(auxiliarydisplay: &AuxiliaryDisplay) -> Usage {
11160 Usage::try_from(u32::from(auxiliarydisplay)).unwrap()
11161 }
11162}
11163
11164impl From<AuxiliaryDisplay> for Usage {
11165 fn from(auxiliarydisplay: AuxiliaryDisplay) -> Usage {
11166 Usage::from(&auxiliarydisplay)
11167 }
11168}
11169
11170impl TryFrom<u16> for AuxiliaryDisplay {
11171 type Error = HutError;
11172
11173 fn try_from(usage_id: u16) -> Result<AuxiliaryDisplay> {
11174 match usage_id {
11175 1 => Ok(AuxiliaryDisplay::AlphanumericDisplay),
11176 2 => Ok(AuxiliaryDisplay::AuxiliaryDisplay),
11177 32 => Ok(AuxiliaryDisplay::DisplayAttributesReport),
11178 33 => Ok(AuxiliaryDisplay::ASCIICharacterSet),
11179 34 => Ok(AuxiliaryDisplay::DataReadBack),
11180 35 => Ok(AuxiliaryDisplay::FontReadBack),
11181 36 => Ok(AuxiliaryDisplay::DisplayControlReport),
11182 37 => Ok(AuxiliaryDisplay::ClearDisplay),
11183 38 => Ok(AuxiliaryDisplay::DisplayEnable),
11184 39 => Ok(AuxiliaryDisplay::ScreenSaverDelay),
11185 40 => Ok(AuxiliaryDisplay::ScreenSaverEnable),
11186 41 => Ok(AuxiliaryDisplay::VerticalScroll),
11187 42 => Ok(AuxiliaryDisplay::HorizontalScroll),
11188 43 => Ok(AuxiliaryDisplay::CharacterReport),
11189 44 => Ok(AuxiliaryDisplay::DisplayData),
11190 45 => Ok(AuxiliaryDisplay::DisplayStatus),
11191 46 => Ok(AuxiliaryDisplay::StatNotReady),
11192 47 => Ok(AuxiliaryDisplay::StatReady),
11193 48 => Ok(AuxiliaryDisplay::ErrNotaloadablecharacter),
11194 49 => Ok(AuxiliaryDisplay::ErrFontdatacannotberead),
11195 50 => Ok(AuxiliaryDisplay::CursorPositionReport),
11196 51 => Ok(AuxiliaryDisplay::Row),
11197 52 => Ok(AuxiliaryDisplay::Column),
11198 53 => Ok(AuxiliaryDisplay::Rows),
11199 54 => Ok(AuxiliaryDisplay::Columns),
11200 55 => Ok(AuxiliaryDisplay::CursorPixelPositioning),
11201 56 => Ok(AuxiliaryDisplay::CursorMode),
11202 57 => Ok(AuxiliaryDisplay::CursorEnable),
11203 58 => Ok(AuxiliaryDisplay::CursorBlink),
11204 59 => Ok(AuxiliaryDisplay::FontReport),
11205 60 => Ok(AuxiliaryDisplay::FontData),
11206 61 => Ok(AuxiliaryDisplay::CharacterWidth),
11207 62 => Ok(AuxiliaryDisplay::CharacterHeight),
11208 63 => Ok(AuxiliaryDisplay::CharacterSpacingHorizontal),
11209 64 => Ok(AuxiliaryDisplay::CharacterSpacingVertical),
11210 65 => Ok(AuxiliaryDisplay::UnicodeCharacterSet),
11211 66 => Ok(AuxiliaryDisplay::Font7Segment),
11212 67 => Ok(AuxiliaryDisplay::SevenSegmentDirectMap),
11213 68 => Ok(AuxiliaryDisplay::Font14Segment),
11214 69 => Ok(AuxiliaryDisplay::One4SegmentDirectMap),
11215 70 => Ok(AuxiliaryDisplay::DisplayBrightness),
11216 71 => Ok(AuxiliaryDisplay::DisplayContrast),
11217 72 => Ok(AuxiliaryDisplay::CharacterAttribute),
11218 73 => Ok(AuxiliaryDisplay::AttributeReadback),
11219 74 => Ok(AuxiliaryDisplay::AttributeData),
11220 75 => Ok(AuxiliaryDisplay::CharAttrEnhance),
11221 76 => Ok(AuxiliaryDisplay::CharAttrUnderline),
11222 77 => Ok(AuxiliaryDisplay::CharAttrBlink),
11223 128 => Ok(AuxiliaryDisplay::BitmapSizeX),
11224 129 => Ok(AuxiliaryDisplay::BitmapSizeY),
11225 130 => Ok(AuxiliaryDisplay::MaxBlitSize),
11226 131 => Ok(AuxiliaryDisplay::BitDepthFormat),
11227 132 => Ok(AuxiliaryDisplay::DisplayOrientation),
11228 133 => Ok(AuxiliaryDisplay::PaletteReport),
11229 134 => Ok(AuxiliaryDisplay::PaletteDataSize),
11230 135 => Ok(AuxiliaryDisplay::PaletteDataOffset),
11231 136 => Ok(AuxiliaryDisplay::PaletteData),
11232 138 => Ok(AuxiliaryDisplay::BlitReport),
11233 139 => Ok(AuxiliaryDisplay::BlitRectangleX1),
11234 140 => Ok(AuxiliaryDisplay::BlitRectangleY1),
11235 141 => Ok(AuxiliaryDisplay::BlitRectangleX2),
11236 142 => Ok(AuxiliaryDisplay::BlitRectangleY2),
11237 143 => Ok(AuxiliaryDisplay::BlitData),
11238 144 => Ok(AuxiliaryDisplay::SoftButton),
11239 145 => Ok(AuxiliaryDisplay::SoftButtonID),
11240 146 => Ok(AuxiliaryDisplay::SoftButtonSide),
11241 147 => Ok(AuxiliaryDisplay::SoftButtonOffset1),
11242 148 => Ok(AuxiliaryDisplay::SoftButtonOffset2),
11243 149 => Ok(AuxiliaryDisplay::SoftButtonReport),
11244 194 => Ok(AuxiliaryDisplay::SoftKeys),
11245 204 => Ok(AuxiliaryDisplay::DisplayDataExtensions),
11246 207 => Ok(AuxiliaryDisplay::CharacterMapping),
11247 221 => Ok(AuxiliaryDisplay::UnicodeEquivalent),
11248 223 => Ok(AuxiliaryDisplay::CharacterPageMapping),
11249 255 => Ok(AuxiliaryDisplay::RequestReport),
11250 n => Err(HutError::UnknownUsageId { usage_id: n }),
11251 }
11252 }
11253}
11254
11255impl BitOr<u16> for AuxiliaryDisplay {
11256 type Output = Usage;
11257
11258 fn bitor(self, usage: u16) -> Usage {
11265 let up = u16::from(self) as u32;
11266 let u = usage as u32;
11267 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
11268 }
11269}
11270
11271#[allow(non_camel_case_types)]
11292#[derive(Debug)]
11293#[non_exhaustive]
11294pub enum Sensors {
11295 Sensor,
11297 Biometric,
11299 BiometricHumanPresence,
11301 BiometricHumanProximity,
11303 BiometricHumanTouch,
11305 BiometricBloodPressure,
11307 BiometricBodyTemperature,
11309 BiometricHeartRate,
11311 BiometricHeartRateVariability,
11313 BiometricPeripheralOxygenSaturation,
11315 BiometricRespiratoryRate,
11317 Electrical,
11319 ElectricalCapacitance,
11321 ElectricalCurrent,
11323 ElectricalPower,
11325 ElectricalInductance,
11327 ElectricalResistance,
11329 ElectricalVoltage,
11331 ElectricalPotentiometer,
11333 ElectricalFrequency,
11335 ElectricalPeriod,
11337 Environmental,
11339 EnvironmentalAtmosphericPressure,
11341 EnvironmentalHumidity,
11343 EnvironmentalTemperature,
11345 EnvironmentalWindDirection,
11347 EnvironmentalWindSpeed,
11349 EnvironmentalAirQuality,
11351 EnvironmentalHeatIndex,
11353 EnvironmentalSurfaceTemperature,
11355 EnvironmentalVolatileOrganicCompounds,
11357 EnvironmentalObjectPresence,
11359 EnvironmentalObjectProximity,
11361 Light,
11363 LightAmbientLight,
11365 LightConsumerInfrared,
11367 LightInfraredLight,
11369 LightVisibleLight,
11371 LightUltravioletLight,
11373 Location,
11375 LocationBroadcast,
11377 LocationDeadReckoning,
11379 LocationGPSGlobalPositioningSystem,
11381 LocationLookup,
11383 LocationOther,
11385 LocationStatic,
11387 LocationTriangulation,
11389 Mechanical,
11391 MechanicalBooleanSwitch,
11393 MechanicalBooleanSwitchArray,
11395 MechanicalMultivalueSwitch,
11397 MechanicalForce,
11399 MechanicalPressure,
11401 MechanicalStrain,
11403 MechanicalWeight,
11405 MechanicalHapticVibrator,
11407 MechanicalHallEffectSwitch,
11409 Motion,
11411 MotionAccelerometer1D,
11413 MotionAccelerometer2D,
11415 MotionAccelerometer3D,
11417 MotionGyrometer1D,
11419 MotionGyrometer2D,
11421 MotionGyrometer3D,
11423 MotionMotionDetector,
11425 MotionSpeedometer,
11427 MotionAccelerometer,
11429 MotionGyrometer,
11431 MotionGravityVector,
11433 MotionLinearAccelerometer,
11435 Orientation,
11437 OrientationCompass1D,
11439 OrientationCompass2D,
11441 OrientationCompass3D,
11443 OrientationInclinometer1D,
11445 OrientationInclinometer2D,
11447 OrientationInclinometer3D,
11449 OrientationDistance1D,
11451 OrientationDistance2D,
11453 OrientationDistance3D,
11455 OrientationDeviceOrientation,
11457 OrientationCompass,
11459 OrientationInclinometer,
11461 OrientationDistance,
11463 OrientationRelativeOrientation,
11465 OrientationSimpleOrientation,
11467 Scanner,
11469 ScannerBarcode,
11471 ScannerRFID,
11473 ScannerNFC,
11475 Time,
11477 TimeAlarmTimer,
11479 TimeRealTimeClock,
11481 PersonalActivity,
11483 PersonalActivityActivityDetection,
11485 PersonalActivityDevicePosition,
11487 PersonalActivityFloorTracker,
11489 PersonalActivityPedometer,
11491 PersonalActivityStepDetection,
11493 OrientationExtended,
11495 OrientationExtendedGeomagneticOrientation,
11497 OrientationExtendedMagnetometer,
11499 Gesture,
11501 GestureChassisFlipGesture,
11503 GestureHingeFoldGesture,
11505 Other,
11507 OtherCustom,
11509 OtherGeneric,
11511 OtherGenericEnumerator,
11513 OtherHingeAngle,
11515 VendorReserved1,
11517 VendorReserved2,
11519 VendorReserved3,
11521 VendorReserved4,
11523 VendorReserved5,
11525 VendorReserved6,
11527 VendorReserved7,
11529 VendorReserved8,
11531 VendorReserved9,
11533 VendorReserved10,
11535 VendorReserved11,
11537 VendorReserved12,
11539 VendorReserved13,
11541 VendorReserved14,
11543 VendorReserved15,
11545 VendorReserved16,
11547 Event,
11549 EventSensorState,
11551 EventSensorEvent,
11553 Property,
11555 PropertyFriendlyName,
11557 PropertyPersistentUniqueID,
11559 PropertySensorStatus,
11561 PropertyMinimumReportInterval,
11563 PropertySensorManufacturer,
11565 PropertySensorModel,
11567 PropertySensorSerialNumber,
11569 PropertySensorDescription,
11571 PropertySensorConnectionType,
11573 PropertySensorDevicePath,
11575 PropertyHardwareRevision,
11577 PropertyFirmwareVersion,
11579 PropertyReleaseDate,
11581 PropertyReportInterval,
11583 PropertyChangeSensitivityAbsolute,
11585 PropertyChangeSensitivityPercentofRange,
11587 PropertyChangeSensitivityPercentRelative,
11589 PropertyAccuracy,
11591 PropertyResolution,
11593 PropertyMaximum,
11595 PropertyMinimum,
11597 PropertyReportingState,
11599 PropertySamplingRate,
11601 PropertyResponseCurve,
11603 PropertyPowerState,
11605 PropertyMaximumFIFOEvents,
11607 PropertyReportLatency,
11609 PropertyFlushFIFOEvents,
11611 PropertyMaximumPowerConsumption,
11613 PropertyIsPrimary,
11615 PropertyHumanPresenceDetectionType,
11617 DataFieldLocation,
11619 DataFieldAltitudeAntennaSeaLevel,
11621 DataFieldDifferentialReferenceStationID,
11623 DataFieldAltitudeEllipsoidError,
11625 DataFieldAltitudeEllipsoid,
11627 DataFieldAltitudeSeaLevelError,
11629 DataFieldAltitudeSeaLevel,
11631 DataFieldDifferentialGPSDataAge,
11633 DataFieldErrorRadius,
11635 DataFieldFixQuality,
11637 DataFieldFixType,
11639 DataFieldGeoidalSeparation,
11641 DataFieldGPSOperationMode,
11643 DataFieldGPSSelectionMode,
11645 DataFieldGPSStatus,
11647 DataFieldPositionDilutionofPrecision,
11649 DataFieldHorizontalDilutionofPrecision,
11651 DataFieldVerticalDilutionofPrecision,
11653 DataFieldLatitude,
11655 DataFieldLongitude,
11657 DataFieldTrueHeading,
11659 DataFieldMagneticHeading,
11661 DataFieldMagneticVariation,
11663 DataFieldSpeed,
11665 DataFieldSatellitesinView,
11667 DataFieldSatellitesinViewAzimuth,
11669 DataFieldSatellitesinViewElevation,
11671 DataFieldSatellitesinViewIDs,
11673 DataFieldSatellitesinViewPRNs,
11675 DataFieldSatellitesinViewSNRatios,
11677 DataFieldSatellitesUsedCount,
11679 DataFieldSatellitesUsedPRNs,
11681 DataFieldNMEASentence,
11683 DataFieldAddressLine1,
11685 DataFieldAddressLine2,
11687 DataFieldCity,
11689 DataFieldStateorProvince,
11691 DataFieldCountryorRegion,
11693 DataFieldPostalCode,
11695 PropertyLocation,
11697 PropertyLocationDesiredAccuracy,
11699 DataFieldEnvironmental,
11701 DataFieldAtmosphericPressure,
11703 DataFieldRelativeHumidity,
11705 DataFieldTemperature,
11707 DataFieldWindDirection,
11709 DataFieldWindSpeed,
11711 DataFieldAirQualityIndex,
11713 DataFieldEquivalentCO2,
11715 DataFieldVolatileOrganicCompoundConcentration,
11717 DataFieldObjectPresence,
11719 DataFieldObjectProximityRange,
11721 DataFieldObjectProximityOutofRange,
11723 PropertyEnvironmental,
11725 PropertyReferencePressure,
11727 DataFieldMotion,
11729 DataFieldMotionState,
11731 DataFieldAcceleration,
11733 DataFieldAccelerationAxisX,
11735 DataFieldAccelerationAxisY,
11737 DataFieldAccelerationAxisZ,
11739 DataFieldAngularVelocity,
11741 DataFieldAngularVelocityaboutXAxis,
11743 DataFieldAngularVelocityaboutYAxis,
11745 DataFieldAngularVelocityaboutZAxis,
11747 DataFieldAngularPosition,
11749 DataFieldAngularPositionaboutXAxis,
11751 DataFieldAngularPositionaboutYAxis,
11753 DataFieldAngularPositionaboutZAxis,
11755 DataFieldMotionSpeed,
11757 DataFieldMotionIntensity,
11759 DataFieldOrientation,
11761 DataFieldHeading,
11763 DataFieldHeadingXAxis,
11765 DataFieldHeadingYAxis,
11767 DataFieldHeadingZAxis,
11769 DataFieldHeadingCompensatedMagneticNorth,
11771 DataFieldHeadingCompensatedTrueNorth,
11773 DataFieldHeadingMagneticNorth,
11775 DataFieldHeadingTrueNorth,
11777 DataFieldDistance,
11779 DataFieldDistanceXAxis,
11781 DataFieldDistanceYAxis,
11783 DataFieldDistanceZAxis,
11785 DataFieldDistanceOutofRange,
11787 DataFieldTilt,
11789 DataFieldTiltXAxis,
11791 DataFieldTiltYAxis,
11793 DataFieldTiltZAxis,
11795 DataFieldRotationMatrix,
11797 DataFieldQuaternion,
11799 DataFieldMagneticFlux,
11801 DataFieldMagneticFluxXAxis,
11803 DataFieldMagneticFluxYAxis,
11805 DataFieldMagneticFluxZAxis,
11807 DataFieldMagnetometerAccuracy,
11809 DataFieldSimpleOrientationDirection,
11811 DataFieldMechanical,
11813 DataFieldBooleanSwitchState,
11815 DataFieldBooleanSwitchArrayStates,
11817 DataFieldMultivalueSwitchValue,
11819 DataFieldForce,
11821 DataFieldAbsolutePressure,
11823 DataFieldGaugePressure,
11825 DataFieldStrain,
11827 DataFieldWeight,
11829 PropertyMechanical,
11831 PropertyVibrationState,
11833 PropertyForwardVibrationSpeed,
11835 PropertyBackwardVibrationSpeed,
11837 DataFieldBiometric,
11839 DataFieldHumanPresence,
11841 DataFieldHumanProximityRange,
11843 DataFieldHumanProximityOutofRange,
11845 DataFieldHumanTouchState,
11847 DataFieldBloodPressure,
11849 DataFieldBloodPressureDiastolic,
11851 DataFieldBloodPressureSystolic,
11853 DataFieldHeartRate,
11855 DataFieldRestingHeartRate,
11857 DataFieldHeartbeatInterval,
11859 DataFieldRespiratoryRate,
11861 DataFieldSpO2,
11863 DataFieldHumanAttentionDetected,
11865 DataFieldHumanHeadAzimuth,
11867 DataFieldHumanHeadAltitude,
11869 DataFieldHumanHeadRoll,
11871 DataFieldHumanHeadPitch,
11873 DataFieldHumanHeadYaw,
11875 DataFieldHumanCorrelationId,
11877 DataFieldLight,
11879 DataFieldIlluminance,
11881 DataFieldColorTemperature,
11883 DataFieldChromaticity,
11885 DataFieldChromaticityX,
11887 DataFieldChromaticityY,
11889 DataFieldConsumerIRSentenceReceive,
11891 DataFieldInfraredLight,
11893 DataFieldRedLight,
11895 DataFieldGreenLight,
11897 DataFieldBlueLight,
11899 DataFieldUltravioletALight,
11901 DataFieldUltravioletBLight,
11903 DataFieldUltravioletIndex,
11905 DataFieldNearInfraredLight,
11907 PropertyLight,
11909 PropertyConsumerIRSentenceSend,
11911 PropertyAutoBrightnessPreferred,
11913 PropertyAutoColorPreferred,
11915 DataFieldScanner,
11917 DataFieldRFIDTag40Bit,
11919 DataFieldNFCSentenceReceive,
11921 PropertyScanner,
11923 PropertyNFCSentenceSend,
11925 DataFieldElectrical,
11927 DataFieldCapacitance,
11929 DataFieldCurrent,
11931 DataFieldElectricalPower,
11933 DataFieldInductance,
11935 DataFieldResistance,
11937 DataFieldVoltage,
11939 DataFieldFrequency,
11941 DataFieldPeriod,
11943 DataFieldPercentofRange,
11945 DataFieldTime,
11947 DataFieldYear,
11949 DataFieldMonth,
11951 DataFieldDay,
11953 DataFieldDayofWeek,
11955 DataFieldHour,
11957 DataFieldMinute,
11959 DataFieldSecond,
11961 DataFieldMillisecond,
11963 DataFieldTimestamp,
11965 DataFieldJulianDayofYear,
11967 DataFieldTimeSinceSystemBoot,
11969 PropertyTime,
11971 PropertyTimeZoneOffsetfromUTC,
11973 PropertyTimeZoneName,
11975 PropertyDaylightSavingsTimeObserved,
11977 PropertyTimeTrimAdjustment,
11979 PropertyArmAlarm,
11981 DataFieldCustom,
11983 DataFieldCustomUsage,
11985 DataFieldCustomBooleanArray,
11987 DataFieldCustomValue,
11989 DataFieldCustomValue1,
11991 DataFieldCustomValue2,
11993 DataFieldCustomValue3,
11995 DataFieldCustomValue4,
11997 DataFieldCustomValue5,
11999 DataFieldCustomValue6,
12001 DataFieldCustomValue7,
12003 DataFieldCustomValue8,
12005 DataFieldCustomValue9,
12007 DataFieldCustomValue10,
12009 DataFieldCustomValue11,
12011 DataFieldCustomValue12,
12013 DataFieldCustomValue13,
12015 DataFieldCustomValue14,
12017 DataFieldCustomValue15,
12019 DataFieldCustomValue16,
12021 DataFieldCustomValue17,
12023 DataFieldCustomValue18,
12025 DataFieldCustomValue19,
12027 DataFieldCustomValue20,
12029 DataFieldCustomValue21,
12031 DataFieldCustomValue22,
12033 DataFieldCustomValue23,
12035 DataFieldCustomValue24,
12037 DataFieldCustomValue25,
12039 DataFieldCustomValue26,
12041 DataFieldCustomValue27,
12043 DataFieldCustomValue28,
12045 DataFieldGeneric,
12047 DataFieldGenericGUIDorPROPERTYKEY,
12049 DataFieldGenericCategoryGUID,
12051 DataFieldGenericTypeGUID,
12053 DataFieldGenericEventPROPERTYKEY,
12055 DataFieldGenericPropertyPROPERTYKEY,
12057 DataFieldGenericDataFieldPROPERTYKEY,
12059 DataFieldGenericEvent,
12061 DataFieldGenericProperty,
12063 DataFieldGenericDataField,
12065 DataFieldEnumeratorTableRowIndex,
12067 DataFieldEnumeratorTableRowCount,
12069 DataFieldGenericGUIDorPROPERTYKEYkind,
12071 DataFieldGenericGUID,
12073 DataFieldGenericPROPERTYKEY,
12075 DataFieldGenericTopLevelCollectionID,
12077 DataFieldGenericReportID,
12079 DataFieldGenericReportItemPositionIndex,
12081 DataFieldGenericFirmwareVARTYPE,
12083 DataFieldGenericUnitofMeasure,
12085 DataFieldGenericUnitExponent,
12087 DataFieldGenericReportSize,
12089 DataFieldGenericReportCount,
12091 PropertyGeneric,
12093 PropertyEnumeratorTableRowIndex,
12095 PropertyEnumeratorTableRowCount,
12097 DataFieldPersonalActivity,
12099 DataFieldActivityType,
12101 DataFieldActivityState,
12103 DataFieldDevicePosition,
12105 DataFieldStepCount,
12107 DataFieldStepCountReset,
12109 DataFieldStepDuration,
12111 DataFieldStepType,
12113 PropertyMinimumActivityDetectionInterval,
12115 PropertySupportedActivityTypes,
12117 PropertySubscribedActivityTypes,
12119 PropertySupportedStepTypes,
12121 PropertySubscribedStepTypes,
12123 PropertyFloorHeight,
12125 DataFieldCustomTypeID,
12127 PropertyCustom,
12129 PropertyCustomValue1,
12131 PropertyCustomValue2,
12133 PropertyCustomValue3,
12135 PropertyCustomValue4,
12137 PropertyCustomValue5,
12139 PropertyCustomValue6,
12141 PropertyCustomValue7,
12143 PropertyCustomValue8,
12145 PropertyCustomValue9,
12147 PropertyCustomValue10,
12149 PropertyCustomValue11,
12151 PropertyCustomValue12,
12153 PropertyCustomValue13,
12155 PropertyCustomValue14,
12157 PropertyCustomValue15,
12159 PropertyCustomValue16,
12161 DataFieldHinge,
12163 DataFieldHingeAngle,
12165 DataFieldGestureSensor,
12167 DataFieldGestureState,
12169 DataFieldHingeFoldInitialAngle,
12171 DataFieldHingeFoldFinalAngle,
12173 DataFieldHingeFoldContributingPanel,
12175 DataFieldHingeFoldType,
12177 SensorStateUndefined,
12179 SensorStateReady,
12181 SensorStateNotAvailable,
12183 SensorStateNoData,
12185 SensorStateInitializing,
12187 SensorStateAccessDenied,
12189 SensorStateError,
12191 SensorEventUnknown,
12193 SensorEventStateChanged,
12195 SensorEventPropertyChanged,
12197 SensorEventDataUpdated,
12199 SensorEventPollResponse,
12201 SensorEventChangeSensitivity,
12203 SensorEventRangeMaximumReached,
12205 SensorEventRangeMinimumReached,
12207 SensorEventHighThresholdCrossUpward,
12209 SensorEventHighThresholdCrossDownward,
12211 SensorEventLowThresholdCrossUpward,
12213 SensorEventLowThresholdCrossDownward,
12215 SensorEventZeroThresholdCrossUpward,
12217 SensorEventZeroThresholdCrossDownward,
12219 SensorEventPeriodExceeded,
12221 SensorEventFrequencyExceeded,
12223 SensorEventComplexTrigger,
12225 ConnectionTypePCIntegrated,
12227 ConnectionTypePCAttached,
12229 ConnectionTypePCExternal,
12231 ReportingStateReportNoEvents,
12233 ReportingStateReportAllEvents,
12235 ReportingStateReportThresholdEvents,
12237 ReportingStateWakeOnNoEvents,
12239 ReportingStateWakeOnAllEvents,
12241 ReportingStateWakeOnThresholdEvents,
12243 ReportingStateAnytime,
12245 PowerStateUndefined,
12247 PowerStateD0FullPower,
12249 PowerStateD1LowPower,
12251 PowerStateD2StandbyPowerwithWakeup,
12253 PowerStateD3SleepwithWakeup,
12255 PowerStateD4PowerOff,
12257 AccuracyDefault,
12259 AccuracyHigh,
12261 AccuracyMedium,
12263 AccuracyLow,
12265 FixQualityNoFix,
12267 FixQualityGPS,
12269 FixQualityDGPS,
12271 FixTypeNoFix,
12273 FixTypeGPSSPSModeFixValid,
12275 FixTypeDGPSSPSModeFixValid,
12277 FixTypeGPSPPSModeFixValid,
12279 FixTypeRealTimeKinematic,
12281 FixTypeFloatRTK,
12283 FixTypeEstimateddeadreckoned,
12285 FixTypeManualInputMode,
12287 FixTypeSimulatorMode,
12289 GPSOperationModeManual,
12291 GPSOperationModeAutomatic,
12293 GPSSelectionModeAutonomous,
12295 GPSSelectionModeDGPS,
12297 GPSSelectionModeEstimateddeadreckoned,
12299 GPSSelectionModeManualInput,
12301 GPSSelectionModeSimulator,
12303 GPSSelectionModeDataNotValid,
12305 GPSStatusDataValid,
12307 GPSStatusDataNotValid,
12309 DayofWeekSunday,
12311 DayofWeekMonday,
12313 DayofWeekTuesday,
12315 DayofWeekWednesday,
12317 DayofWeekThursday,
12319 DayofWeekFriday,
12321 DayofWeekSaturday,
12323 KindCategory,
12325 KindType,
12327 KindEvent,
12329 KindProperty,
12331 KindDataField,
12333 MagnetometerAccuracyLow,
12335 MagnetometerAccuracyMedium,
12337 MagnetometerAccuracyHigh,
12339 SimpleOrientationDirectionNotRotated,
12341 SimpleOrientationDirectionRotated90DegreesCCW,
12343 SimpleOrientationDirectionRotated180DegreesCCW,
12345 SimpleOrientationDirectionRotated270DegreesCCW,
12347 SimpleOrientationDirectionFaceUp,
12349 SimpleOrientationDirectionFaceDown,
12351 VT_NULL,
12353 VT_BOOL,
12355 VT_UI1,
12357 VT_I1,
12359 VT_UI2,
12361 VT_I2,
12363 VT_UI4,
12365 VT_I4,
12367 VT_UI8,
12369 VT_I8,
12371 VT_R4,
12373 VT_R8,
12375 VT_WSTR,
12377 VT_STR,
12379 VT_CLSID,
12381 VT_VECTORVT_UI1,
12383 VT_F16E0,
12385 VT_F16E1,
12387 VT_F16E2,
12389 VT_F16E3,
12391 VT_F16E4,
12393 VT_F16E5,
12395 VT_F16E6,
12397 VT_F16E7,
12399 VT_F16E8,
12401 VT_F16E9,
12403 VT_F16EA,
12405 VT_F16EB,
12407 VT_F16EC,
12409 VT_F16ED,
12411 VT_F16EE,
12413 VT_F16EF,
12415 VT_F32E0,
12417 VT_F32E1,
12419 VT_F32E2,
12421 VT_F32E3,
12423 VT_F32E4,
12425 VT_F32E5,
12427 VT_F32E6,
12429 VT_F32E7,
12431 VT_F32E8,
12433 VT_F32E9,
12435 VT_F32EA,
12437 VT_F32EB,
12439 VT_F32EC,
12441 VT_F32ED,
12443 VT_F32EE,
12445 VT_F32EF,
12447 ActivityTypeUnknown,
12449 ActivityTypeStationary,
12451 ActivityTypeFidgeting,
12453 ActivityTypeWalking,
12455 ActivityTypeRunning,
12457 ActivityTypeInVehicle,
12459 ActivityTypeBiking,
12461 ActivityTypeIdle,
12463 UnitNotSpecified,
12465 UnitLux,
12467 UnitDegreesKelvin,
12469 UnitDegreesCelsius,
12471 UnitPascal,
12473 UnitNewton,
12475 UnitMetersSecond,
12477 UnitKilogram,
12479 UnitMeter,
12481 UnitMetersSecondSecond,
12483 UnitFarad,
12485 UnitAmpere,
12487 UnitWatt,
12489 UnitHenry,
12491 UnitOhm,
12493 UnitVolt,
12495 UnitHertz,
12497 UnitBar,
12499 UnitDegreesAnticlockwise,
12501 UnitDegreesClockwise,
12503 UnitDegrees,
12505 UnitDegreesSecond,
12507 UnitDegreesSecondSecond,
12509 UnitKnot,
12511 UnitPercent,
12513 UnitSecond,
12515 UnitMillisecond,
12517 UnitG,
12519 UnitBytes,
12521 UnitMilligauss,
12523 UnitBits,
12525 ActivityStateNoStateChange,
12527 ActivityStateStartActivity,
12529 ActivityStateEndActivity,
12531 Exponent0,
12533 Exponent1,
12535 Exponent2,
12537 Exponent3,
12539 Exponent4,
12541 Exponent5,
12543 Exponent6,
12545 Exponent7,
12547 Exponent8,
12549 Exponent9,
12551 ExponentA,
12553 ExponentB,
12555 ExponentC,
12557 ExponentD,
12559 ExponentE,
12561 ExponentF,
12563 DevicePositionUnknown,
12565 DevicePositionUnchanged,
12567 DevicePositionOnDesk,
12569 DevicePositionInHand,
12571 DevicePositionMovinginBag,
12573 DevicePositionStationaryinBag,
12575 StepTypeUnknown,
12577 StepTypeWalking,
12579 StepTypeRunning,
12581 GestureStateUnknown,
12583 GestureStateStarted,
12585 GestureStateCompleted,
12587 GestureStateCancelled,
12589 HingeFoldContributingPanelUnknown,
12591 HingeFoldContributingPanelPanel1,
12593 HingeFoldContributingPanelPanel2,
12595 HingeFoldContributingPanelBoth,
12597 HingeFoldTypeUnknown,
12599 HingeFoldTypeIncreasing,
12601 HingeFoldTypeDecreasing,
12603 HumanPresenceDetectionTypeVendorDefinedNonBiometric,
12605 HumanPresenceDetectionTypeVendorDefinedBiometric,
12607 HumanPresenceDetectionTypeFacialBiometric,
12609 HumanPresenceDetectionTypeAudioBiometric,
12611 ModifierChangeSensitivityAbsolute,
12613 ModifierMaximum,
12615 ModifierMinimum,
12617 ModifierAccuracy,
12619 ModifierResolution,
12621 ModifierThresholdHigh,
12623 ModifierThresholdLow,
12625 ModifierCalibrationOffset,
12627 ModifierCalibrationMultiplier,
12629 ModifierReportInterval,
12631 ModifierFrequencyMax,
12633 ModifierPeriodMax,
12635 ModifierChangeSensitivityPercentofRange,
12637 ModifierChangeSensitivityPercentRelative,
12639 ModifierVendorReserved,
12641}
12642
12643impl Sensors {
12644 #[cfg(feature = "std")]
12645 pub fn name(&self) -> String {
12646 match self {
12647 Sensors::Sensor => "Sensor",
12648 Sensors::Biometric => "Biometric",
12649 Sensors::BiometricHumanPresence => "Biometric: Human Presence",
12650 Sensors::BiometricHumanProximity => "Biometric: Human Proximity",
12651 Sensors::BiometricHumanTouch => "Biometric: Human Touch",
12652 Sensors::BiometricBloodPressure => "Biometric: Blood Pressure",
12653 Sensors::BiometricBodyTemperature => "Biometric: Body Temperature",
12654 Sensors::BiometricHeartRate => "Biometric: Heart Rate",
12655 Sensors::BiometricHeartRateVariability => "Biometric: Heart Rate Variability",
12656 Sensors::BiometricPeripheralOxygenSaturation => {
12657 "Biometric: Peripheral Oxygen Saturation"
12658 }
12659 Sensors::BiometricRespiratoryRate => "Biometric: Respiratory Rate",
12660 Sensors::Electrical => "Electrical",
12661 Sensors::ElectricalCapacitance => "Electrical: Capacitance",
12662 Sensors::ElectricalCurrent => "Electrical: Current",
12663 Sensors::ElectricalPower => "Electrical: Power",
12664 Sensors::ElectricalInductance => "Electrical: Inductance",
12665 Sensors::ElectricalResistance => "Electrical: Resistance",
12666 Sensors::ElectricalVoltage => "Electrical: Voltage",
12667 Sensors::ElectricalPotentiometer => "Electrical: Potentiometer",
12668 Sensors::ElectricalFrequency => "Electrical: Frequency",
12669 Sensors::ElectricalPeriod => "Electrical: Period",
12670 Sensors::Environmental => "Environmental",
12671 Sensors::EnvironmentalAtmosphericPressure => "Environmental: Atmospheric Pressure",
12672 Sensors::EnvironmentalHumidity => "Environmental: Humidity",
12673 Sensors::EnvironmentalTemperature => "Environmental: Temperature",
12674 Sensors::EnvironmentalWindDirection => "Environmental: Wind Direction",
12675 Sensors::EnvironmentalWindSpeed => "Environmental: Wind Speed",
12676 Sensors::EnvironmentalAirQuality => "Environmental: Air Quality",
12677 Sensors::EnvironmentalHeatIndex => "Environmental: Heat Index",
12678 Sensors::EnvironmentalSurfaceTemperature => "Environmental: Surface Temperature",
12679 Sensors::EnvironmentalVolatileOrganicCompounds => {
12680 "Environmental: Volatile Organic Compounds"
12681 }
12682 Sensors::EnvironmentalObjectPresence => "Environmental: Object Presence",
12683 Sensors::EnvironmentalObjectProximity => "Environmental: Object Proximity",
12684 Sensors::Light => "Light",
12685 Sensors::LightAmbientLight => "Light: Ambient Light",
12686 Sensors::LightConsumerInfrared => "Light: Consumer Infrared",
12687 Sensors::LightInfraredLight => "Light: Infrared Light",
12688 Sensors::LightVisibleLight => "Light: Visible Light",
12689 Sensors::LightUltravioletLight => "Light: Ultraviolet Light",
12690 Sensors::Location => "Location",
12691 Sensors::LocationBroadcast => "Location: Broadcast",
12692 Sensors::LocationDeadReckoning => "Location: Dead Reckoning",
12693 Sensors::LocationGPSGlobalPositioningSystem => {
12694 "Location: GPS (Global Positioning System)"
12695 }
12696 Sensors::LocationLookup => "Location: Lookup",
12697 Sensors::LocationOther => "Location: Other",
12698 Sensors::LocationStatic => "Location: Static",
12699 Sensors::LocationTriangulation => "Location: Triangulation",
12700 Sensors::Mechanical => "Mechanical",
12701 Sensors::MechanicalBooleanSwitch => "Mechanical: Boolean Switch",
12702 Sensors::MechanicalBooleanSwitchArray => "Mechanical: Boolean Switch Array",
12703 Sensors::MechanicalMultivalueSwitch => "Mechanical: Multivalue Switch",
12704 Sensors::MechanicalForce => "Mechanical: Force",
12705 Sensors::MechanicalPressure => "Mechanical: Pressure",
12706 Sensors::MechanicalStrain => "Mechanical: Strain",
12707 Sensors::MechanicalWeight => "Mechanical: Weight",
12708 Sensors::MechanicalHapticVibrator => "Mechanical: Haptic Vibrator",
12709 Sensors::MechanicalHallEffectSwitch => "Mechanical: Hall Effect Switch",
12710 Sensors::Motion => "Motion",
12711 Sensors::MotionAccelerometer1D => "Motion: Accelerometer 1D",
12712 Sensors::MotionAccelerometer2D => "Motion: Accelerometer 2D",
12713 Sensors::MotionAccelerometer3D => "Motion: Accelerometer 3D",
12714 Sensors::MotionGyrometer1D => "Motion: Gyrometer 1D",
12715 Sensors::MotionGyrometer2D => "Motion: Gyrometer 2D",
12716 Sensors::MotionGyrometer3D => "Motion: Gyrometer 3D",
12717 Sensors::MotionMotionDetector => "Motion: Motion Detector",
12718 Sensors::MotionSpeedometer => "Motion: Speedometer",
12719 Sensors::MotionAccelerometer => "Motion: Accelerometer",
12720 Sensors::MotionGyrometer => "Motion: Gyrometer",
12721 Sensors::MotionGravityVector => "Motion: Gravity Vector",
12722 Sensors::MotionLinearAccelerometer => "Motion: Linear Accelerometer",
12723 Sensors::Orientation => "Orientation",
12724 Sensors::OrientationCompass1D => "Orientation: Compass 1D",
12725 Sensors::OrientationCompass2D => "Orientation: Compass 2D",
12726 Sensors::OrientationCompass3D => "Orientation: Compass 3D",
12727 Sensors::OrientationInclinometer1D => "Orientation: Inclinometer 1D",
12728 Sensors::OrientationInclinometer2D => "Orientation: Inclinometer 2D",
12729 Sensors::OrientationInclinometer3D => "Orientation: Inclinometer 3D",
12730 Sensors::OrientationDistance1D => "Orientation: Distance 1D",
12731 Sensors::OrientationDistance2D => "Orientation: Distance 2D",
12732 Sensors::OrientationDistance3D => "Orientation: Distance 3D",
12733 Sensors::OrientationDeviceOrientation => "Orientation: Device Orientation",
12734 Sensors::OrientationCompass => "Orientation: Compass",
12735 Sensors::OrientationInclinometer => "Orientation: Inclinometer",
12736 Sensors::OrientationDistance => "Orientation: Distance",
12737 Sensors::OrientationRelativeOrientation => "Orientation: Relative Orientation",
12738 Sensors::OrientationSimpleOrientation => "Orientation: Simple Orientation",
12739 Sensors::Scanner => "Scanner",
12740 Sensors::ScannerBarcode => "Scanner: Barcode",
12741 Sensors::ScannerRFID => "Scanner: RFID",
12742 Sensors::ScannerNFC => "Scanner: NFC",
12743 Sensors::Time => "Time",
12744 Sensors::TimeAlarmTimer => "Time: Alarm Timer",
12745 Sensors::TimeRealTimeClock => "Time: Real Time Clock",
12746 Sensors::PersonalActivity => "Personal Activity",
12747 Sensors::PersonalActivityActivityDetection => "Personal Activity: Activity Detection",
12748 Sensors::PersonalActivityDevicePosition => "Personal Activity: Device Position",
12749 Sensors::PersonalActivityFloorTracker => "Personal Activity: Floor Tracker",
12750 Sensors::PersonalActivityPedometer => "Personal Activity: Pedometer",
12751 Sensors::PersonalActivityStepDetection => "Personal Activity: Step Detection",
12752 Sensors::OrientationExtended => "Orientation Extended",
12753 Sensors::OrientationExtendedGeomagneticOrientation => {
12754 "Orientation Extended: Geomagnetic Orientation"
12755 }
12756 Sensors::OrientationExtendedMagnetometer => "Orientation Extended: Magnetometer",
12757 Sensors::Gesture => "Gesture",
12758 Sensors::GestureChassisFlipGesture => "Gesture: Chassis Flip Gesture",
12759 Sensors::GestureHingeFoldGesture => "Gesture: Hinge Fold Gesture",
12760 Sensors::Other => "Other",
12761 Sensors::OtherCustom => "Other: Custom",
12762 Sensors::OtherGeneric => "Other: Generic",
12763 Sensors::OtherGenericEnumerator => "Other: Generic Enumerator",
12764 Sensors::OtherHingeAngle => "Other: Hinge Angle",
12765 Sensors::VendorReserved1 => "Vendor Reserved 1",
12766 Sensors::VendorReserved2 => "Vendor Reserved 2",
12767 Sensors::VendorReserved3 => "Vendor Reserved 3",
12768 Sensors::VendorReserved4 => "Vendor Reserved 4",
12769 Sensors::VendorReserved5 => "Vendor Reserved 5",
12770 Sensors::VendorReserved6 => "Vendor Reserved 6",
12771 Sensors::VendorReserved7 => "Vendor Reserved 7",
12772 Sensors::VendorReserved8 => "Vendor Reserved 8",
12773 Sensors::VendorReserved9 => "Vendor Reserved 9",
12774 Sensors::VendorReserved10 => "Vendor Reserved 10",
12775 Sensors::VendorReserved11 => "Vendor Reserved 11",
12776 Sensors::VendorReserved12 => "Vendor Reserved 12",
12777 Sensors::VendorReserved13 => "Vendor Reserved 13",
12778 Sensors::VendorReserved14 => "Vendor Reserved 14",
12779 Sensors::VendorReserved15 => "Vendor Reserved 15",
12780 Sensors::VendorReserved16 => "Vendor Reserved 16",
12781 Sensors::Event => "Event",
12782 Sensors::EventSensorState => "Event: Sensor State",
12783 Sensors::EventSensorEvent => "Event: Sensor Event",
12784 Sensors::Property => "Property",
12785 Sensors::PropertyFriendlyName => "Property: Friendly Name",
12786 Sensors::PropertyPersistentUniqueID => "Property: Persistent Unique ID",
12787 Sensors::PropertySensorStatus => "Property: Sensor Status",
12788 Sensors::PropertyMinimumReportInterval => "Property: Minimum Report Interval",
12789 Sensors::PropertySensorManufacturer => "Property: Sensor Manufacturer",
12790 Sensors::PropertySensorModel => "Property: Sensor Model",
12791 Sensors::PropertySensorSerialNumber => "Property: Sensor Serial Number",
12792 Sensors::PropertySensorDescription => "Property: Sensor Description",
12793 Sensors::PropertySensorConnectionType => "Property: Sensor Connection Type",
12794 Sensors::PropertySensorDevicePath => "Property: Sensor Device Path",
12795 Sensors::PropertyHardwareRevision => "Property: Hardware Revision",
12796 Sensors::PropertyFirmwareVersion => "Property: Firmware Version",
12797 Sensors::PropertyReleaseDate => "Property: Release Date",
12798 Sensors::PropertyReportInterval => "Property: Report Interval",
12799 Sensors::PropertyChangeSensitivityAbsolute => "Property: Change Sensitivity Absolute",
12800 Sensors::PropertyChangeSensitivityPercentofRange => {
12801 "Property: Change Sensitivity Percent of Range"
12802 }
12803 Sensors::PropertyChangeSensitivityPercentRelative => {
12804 "Property: Change Sensitivity Percent Relative"
12805 }
12806 Sensors::PropertyAccuracy => "Property: Accuracy",
12807 Sensors::PropertyResolution => "Property: Resolution",
12808 Sensors::PropertyMaximum => "Property: Maximum",
12809 Sensors::PropertyMinimum => "Property: Minimum",
12810 Sensors::PropertyReportingState => "Property: Reporting State",
12811 Sensors::PropertySamplingRate => "Property: Sampling Rate",
12812 Sensors::PropertyResponseCurve => "Property: Response Curve",
12813 Sensors::PropertyPowerState => "Property: Power State",
12814 Sensors::PropertyMaximumFIFOEvents => "Property: Maximum FIFO Events",
12815 Sensors::PropertyReportLatency => "Property: Report Latency",
12816 Sensors::PropertyFlushFIFOEvents => "Property: Flush FIFO Events",
12817 Sensors::PropertyMaximumPowerConsumption => "Property: Maximum Power Consumption",
12818 Sensors::PropertyIsPrimary => "Property: Is Primary",
12819 Sensors::PropertyHumanPresenceDetectionType => {
12820 "Property: Human Presence Detection Type"
12821 }
12822 Sensors::DataFieldLocation => "Data Field: Location",
12823 Sensors::DataFieldAltitudeAntennaSeaLevel => "Data Field: Altitude Antenna Sea Level",
12824 Sensors::DataFieldDifferentialReferenceStationID => {
12825 "Data Field: Differential Reference Station ID"
12826 }
12827 Sensors::DataFieldAltitudeEllipsoidError => "Data Field: Altitude Ellipsoid Error",
12828 Sensors::DataFieldAltitudeEllipsoid => "Data Field: Altitude Ellipsoid",
12829 Sensors::DataFieldAltitudeSeaLevelError => "Data Field: Altitude Sea Level Error",
12830 Sensors::DataFieldAltitudeSeaLevel => "Data Field: Altitude Sea Level",
12831 Sensors::DataFieldDifferentialGPSDataAge => "Data Field: Differential GPS Data Age",
12832 Sensors::DataFieldErrorRadius => "Data Field: Error Radius",
12833 Sensors::DataFieldFixQuality => "Data Field: Fix Quality",
12834 Sensors::DataFieldFixType => "Data Field: Fix Type",
12835 Sensors::DataFieldGeoidalSeparation => "Data Field: Geoidal Separation",
12836 Sensors::DataFieldGPSOperationMode => "Data Field: GPS Operation Mode",
12837 Sensors::DataFieldGPSSelectionMode => "Data Field: GPS Selection Mode",
12838 Sensors::DataFieldGPSStatus => "Data Field: GPS Status",
12839 Sensors::DataFieldPositionDilutionofPrecision => {
12840 "Data Field: Position Dilution of Precision"
12841 }
12842 Sensors::DataFieldHorizontalDilutionofPrecision => {
12843 "Data Field: Horizontal Dilution of Precision"
12844 }
12845 Sensors::DataFieldVerticalDilutionofPrecision => {
12846 "Data Field: Vertical Dilution of Precision"
12847 }
12848 Sensors::DataFieldLatitude => "Data Field: Latitude",
12849 Sensors::DataFieldLongitude => "Data Field: Longitude",
12850 Sensors::DataFieldTrueHeading => "Data Field: True Heading",
12851 Sensors::DataFieldMagneticHeading => "Data Field: Magnetic Heading",
12852 Sensors::DataFieldMagneticVariation => "Data Field: Magnetic Variation",
12853 Sensors::DataFieldSpeed => "Data Field: Speed",
12854 Sensors::DataFieldSatellitesinView => "Data Field: Satellites in View",
12855 Sensors::DataFieldSatellitesinViewAzimuth => "Data Field: Satellites in View Azimuth",
12856 Sensors::DataFieldSatellitesinViewElevation => {
12857 "Data Field: Satellites in View Elevation"
12858 }
12859 Sensors::DataFieldSatellitesinViewIDs => "Data Field: Satellites in View IDs",
12860 Sensors::DataFieldSatellitesinViewPRNs => "Data Field: Satellites in View PRNs",
12861 Sensors::DataFieldSatellitesinViewSNRatios => {
12862 "Data Field: Satellites in View S/N Ratios"
12863 }
12864 Sensors::DataFieldSatellitesUsedCount => "Data Field: Satellites Used Count",
12865 Sensors::DataFieldSatellitesUsedPRNs => "Data Field: Satellites Used PRNs",
12866 Sensors::DataFieldNMEASentence => "Data Field: NMEA Sentence",
12867 Sensors::DataFieldAddressLine1 => "Data Field: Address Line 1",
12868 Sensors::DataFieldAddressLine2 => "Data Field: Address Line 2",
12869 Sensors::DataFieldCity => "Data Field: City",
12870 Sensors::DataFieldStateorProvince => "Data Field: State or Province",
12871 Sensors::DataFieldCountryorRegion => "Data Field: Country or Region",
12872 Sensors::DataFieldPostalCode => "Data Field: Postal Code",
12873 Sensors::PropertyLocation => "Property: Location",
12874 Sensors::PropertyLocationDesiredAccuracy => "Property: Location Desired Accuracy",
12875 Sensors::DataFieldEnvironmental => "Data Field: Environmental",
12876 Sensors::DataFieldAtmosphericPressure => "Data Field: Atmospheric Pressure",
12877 Sensors::DataFieldRelativeHumidity => "Data Field: Relative Humidity",
12878 Sensors::DataFieldTemperature => "Data Field: Temperature",
12879 Sensors::DataFieldWindDirection => "Data Field: Wind Direction",
12880 Sensors::DataFieldWindSpeed => "Data Field: Wind Speed",
12881 Sensors::DataFieldAirQualityIndex => "Data Field: Air Quality Index",
12882 Sensors::DataFieldEquivalentCO2 => "Data Field: Equivalent CO2",
12883 Sensors::DataFieldVolatileOrganicCompoundConcentration => {
12884 "Data Field: Volatile Organic Compound Concentration"
12885 }
12886 Sensors::DataFieldObjectPresence => "Data Field: Object Presence",
12887 Sensors::DataFieldObjectProximityRange => "Data Field: Object Proximity Range",
12888 Sensors::DataFieldObjectProximityOutofRange => {
12889 "Data Field: Object Proximity Out of Range"
12890 }
12891 Sensors::PropertyEnvironmental => "Property: Environmental",
12892 Sensors::PropertyReferencePressure => "Property: Reference Pressure",
12893 Sensors::DataFieldMotion => "Data Field: Motion",
12894 Sensors::DataFieldMotionState => "Data Field: Motion State",
12895 Sensors::DataFieldAcceleration => "Data Field: Acceleration",
12896 Sensors::DataFieldAccelerationAxisX => "Data Field: Acceleration Axis X",
12897 Sensors::DataFieldAccelerationAxisY => "Data Field: Acceleration Axis Y",
12898 Sensors::DataFieldAccelerationAxisZ => "Data Field: Acceleration Axis Z",
12899 Sensors::DataFieldAngularVelocity => "Data Field: Angular Velocity",
12900 Sensors::DataFieldAngularVelocityaboutXAxis => {
12901 "Data Field: Angular Velocity about X Axis"
12902 }
12903 Sensors::DataFieldAngularVelocityaboutYAxis => {
12904 "Data Field: Angular Velocity about Y Axis"
12905 }
12906 Sensors::DataFieldAngularVelocityaboutZAxis => {
12907 "Data Field: Angular Velocity about Z Axis"
12908 }
12909 Sensors::DataFieldAngularPosition => "Data Field: Angular Position",
12910 Sensors::DataFieldAngularPositionaboutXAxis => {
12911 "Data Field: Angular Position about X Axis"
12912 }
12913 Sensors::DataFieldAngularPositionaboutYAxis => {
12914 "Data Field: Angular Position about Y Axis"
12915 }
12916 Sensors::DataFieldAngularPositionaboutZAxis => {
12917 "Data Field: Angular Position about Z Axis"
12918 }
12919 Sensors::DataFieldMotionSpeed => "Data Field: Motion Speed",
12920 Sensors::DataFieldMotionIntensity => "Data Field: Motion Intensity",
12921 Sensors::DataFieldOrientation => "Data Field: Orientation",
12922 Sensors::DataFieldHeading => "Data Field: Heading",
12923 Sensors::DataFieldHeadingXAxis => "Data Field: Heading X Axis",
12924 Sensors::DataFieldHeadingYAxis => "Data Field: Heading Y Axis",
12925 Sensors::DataFieldHeadingZAxis => "Data Field: Heading Z Axis",
12926 Sensors::DataFieldHeadingCompensatedMagneticNorth => {
12927 "Data Field: Heading Compensated Magnetic North"
12928 }
12929 Sensors::DataFieldHeadingCompensatedTrueNorth => {
12930 "Data Field: Heading Compensated True North"
12931 }
12932 Sensors::DataFieldHeadingMagneticNorth => "Data Field: Heading Magnetic North",
12933 Sensors::DataFieldHeadingTrueNorth => "Data Field: Heading True North",
12934 Sensors::DataFieldDistance => "Data Field: Distance",
12935 Sensors::DataFieldDistanceXAxis => "Data Field: Distance X Axis",
12936 Sensors::DataFieldDistanceYAxis => "Data Field: Distance Y Axis",
12937 Sensors::DataFieldDistanceZAxis => "Data Field: Distance Z Axis",
12938 Sensors::DataFieldDistanceOutofRange => "Data Field: Distance Out-of-Range",
12939 Sensors::DataFieldTilt => "Data Field: Tilt",
12940 Sensors::DataFieldTiltXAxis => "Data Field: Tilt X Axis",
12941 Sensors::DataFieldTiltYAxis => "Data Field: Tilt Y Axis",
12942 Sensors::DataFieldTiltZAxis => "Data Field: Tilt Z Axis",
12943 Sensors::DataFieldRotationMatrix => "Data Field: Rotation Matrix",
12944 Sensors::DataFieldQuaternion => "Data Field: Quaternion",
12945 Sensors::DataFieldMagneticFlux => "Data Field: Magnetic Flux",
12946 Sensors::DataFieldMagneticFluxXAxis => "Data Field: Magnetic Flux X Axis",
12947 Sensors::DataFieldMagneticFluxYAxis => "Data Field: Magnetic Flux Y Axis",
12948 Sensors::DataFieldMagneticFluxZAxis => "Data Field: Magnetic Flux Z Axis",
12949 Sensors::DataFieldMagnetometerAccuracy => "Data Field: Magnetometer Accuracy",
12950 Sensors::DataFieldSimpleOrientationDirection => {
12951 "Data Field: Simple Orientation Direction"
12952 }
12953 Sensors::DataFieldMechanical => "Data Field: Mechanical",
12954 Sensors::DataFieldBooleanSwitchState => "Data Field: Boolean Switch State",
12955 Sensors::DataFieldBooleanSwitchArrayStates => "Data Field: Boolean Switch Array States",
12956 Sensors::DataFieldMultivalueSwitchValue => "Data Field: Multivalue Switch Value",
12957 Sensors::DataFieldForce => "Data Field: Force",
12958 Sensors::DataFieldAbsolutePressure => "Data Field: Absolute Pressure",
12959 Sensors::DataFieldGaugePressure => "Data Field: Gauge Pressure",
12960 Sensors::DataFieldStrain => "Data Field: Strain",
12961 Sensors::DataFieldWeight => "Data Field: Weight",
12962 Sensors::PropertyMechanical => "Property: Mechanical",
12963 Sensors::PropertyVibrationState => "Property: Vibration State",
12964 Sensors::PropertyForwardVibrationSpeed => "Property: Forward Vibration Speed",
12965 Sensors::PropertyBackwardVibrationSpeed => "Property: Backward Vibration Speed",
12966 Sensors::DataFieldBiometric => "Data Field: Biometric",
12967 Sensors::DataFieldHumanPresence => "Data Field: Human Presence",
12968 Sensors::DataFieldHumanProximityRange => "Data Field: Human Proximity Range",
12969 Sensors::DataFieldHumanProximityOutofRange => {
12970 "Data Field: Human Proximity Out of Range"
12971 }
12972 Sensors::DataFieldHumanTouchState => "Data Field: Human Touch State",
12973 Sensors::DataFieldBloodPressure => "Data Field: Blood Pressure",
12974 Sensors::DataFieldBloodPressureDiastolic => "Data Field: Blood Pressure Diastolic",
12975 Sensors::DataFieldBloodPressureSystolic => "Data Field: Blood Pressure Systolic",
12976 Sensors::DataFieldHeartRate => "Data Field: Heart Rate",
12977 Sensors::DataFieldRestingHeartRate => "Data Field: Resting Heart Rate",
12978 Sensors::DataFieldHeartbeatInterval => "Data Field: Heartbeat Interval",
12979 Sensors::DataFieldRespiratoryRate => "Data Field: Respiratory Rate",
12980 Sensors::DataFieldSpO2 => "Data Field: SpO2",
12981 Sensors::DataFieldHumanAttentionDetected => "Data Field: Human Attention Detected",
12982 Sensors::DataFieldHumanHeadAzimuth => "Data Field: Human Head Azimuth",
12983 Sensors::DataFieldHumanHeadAltitude => "Data Field: Human Head Altitude",
12984 Sensors::DataFieldHumanHeadRoll => "Data Field: Human Head Roll",
12985 Sensors::DataFieldHumanHeadPitch => "Data Field: Human Head Pitch",
12986 Sensors::DataFieldHumanHeadYaw => "Data Field: Human Head Yaw",
12987 Sensors::DataFieldHumanCorrelationId => "Data Field: Human Correlation Id",
12988 Sensors::DataFieldLight => "Data Field: Light",
12989 Sensors::DataFieldIlluminance => "Data Field: Illuminance",
12990 Sensors::DataFieldColorTemperature => "Data Field: Color Temperature",
12991 Sensors::DataFieldChromaticity => "Data Field: Chromaticity",
12992 Sensors::DataFieldChromaticityX => "Data Field: Chromaticity X",
12993 Sensors::DataFieldChromaticityY => "Data Field: Chromaticity Y",
12994 Sensors::DataFieldConsumerIRSentenceReceive => {
12995 "Data Field: Consumer IR Sentence Receive"
12996 }
12997 Sensors::DataFieldInfraredLight => "Data Field: Infrared Light",
12998 Sensors::DataFieldRedLight => "Data Field: Red Light",
12999 Sensors::DataFieldGreenLight => "Data Field: Green Light",
13000 Sensors::DataFieldBlueLight => "Data Field: Blue Light",
13001 Sensors::DataFieldUltravioletALight => "Data Field: Ultraviolet A Light",
13002 Sensors::DataFieldUltravioletBLight => "Data Field: Ultraviolet B Light",
13003 Sensors::DataFieldUltravioletIndex => "Data Field: Ultraviolet Index",
13004 Sensors::DataFieldNearInfraredLight => "Data Field: Near Infrared Light",
13005 Sensors::PropertyLight => "Property: Light",
13006 Sensors::PropertyConsumerIRSentenceSend => "Property: Consumer IR Sentence Send",
13007 Sensors::PropertyAutoBrightnessPreferred => "Property: Auto Brightness Preferred",
13008 Sensors::PropertyAutoColorPreferred => "Property: Auto Color Preferred",
13009 Sensors::DataFieldScanner => "Data Field: Scanner",
13010 Sensors::DataFieldRFIDTag40Bit => "Data Field: RFID Tag 40 Bit",
13011 Sensors::DataFieldNFCSentenceReceive => "Data Field: NFC Sentence Receive",
13012 Sensors::PropertyScanner => "Property: Scanner",
13013 Sensors::PropertyNFCSentenceSend => "Property: NFC Sentence Send",
13014 Sensors::DataFieldElectrical => "Data Field: Electrical",
13015 Sensors::DataFieldCapacitance => "Data Field: Capacitance",
13016 Sensors::DataFieldCurrent => "Data Field: Current",
13017 Sensors::DataFieldElectricalPower => "Data Field: Electrical Power",
13018 Sensors::DataFieldInductance => "Data Field: Inductance",
13019 Sensors::DataFieldResistance => "Data Field: Resistance",
13020 Sensors::DataFieldVoltage => "Data Field: Voltage",
13021 Sensors::DataFieldFrequency => "Data Field: Frequency",
13022 Sensors::DataFieldPeriod => "Data Field: Period",
13023 Sensors::DataFieldPercentofRange => "Data Field: Percent of Range",
13024 Sensors::DataFieldTime => "Data Field: Time",
13025 Sensors::DataFieldYear => "Data Field: Year",
13026 Sensors::DataFieldMonth => "Data Field: Month",
13027 Sensors::DataFieldDay => "Data Field: Day",
13028 Sensors::DataFieldDayofWeek => "Data Field: Day of Week",
13029 Sensors::DataFieldHour => "Data Field: Hour",
13030 Sensors::DataFieldMinute => "Data Field: Minute",
13031 Sensors::DataFieldSecond => "Data Field: Second",
13032 Sensors::DataFieldMillisecond => "Data Field: Millisecond",
13033 Sensors::DataFieldTimestamp => "Data Field: Timestamp",
13034 Sensors::DataFieldJulianDayofYear => "Data Field: Julian Day of Year",
13035 Sensors::DataFieldTimeSinceSystemBoot => "Data Field: Time Since System Boot",
13036 Sensors::PropertyTime => "Property: Time",
13037 Sensors::PropertyTimeZoneOffsetfromUTC => "Property: Time Zone Offset from UTC",
13038 Sensors::PropertyTimeZoneName => "Property: Time Zone Name",
13039 Sensors::PropertyDaylightSavingsTimeObserved => {
13040 "Property: Daylight Savings Time Observed"
13041 }
13042 Sensors::PropertyTimeTrimAdjustment => "Property: Time Trim Adjustment",
13043 Sensors::PropertyArmAlarm => "Property: Arm Alarm",
13044 Sensors::DataFieldCustom => "Data Field: Custom",
13045 Sensors::DataFieldCustomUsage => "Data Field: Custom Usage",
13046 Sensors::DataFieldCustomBooleanArray => "Data Field: Custom Boolean Array",
13047 Sensors::DataFieldCustomValue => "Data Field: Custom Value",
13048 Sensors::DataFieldCustomValue1 => "Data Field: Custom Value 1",
13049 Sensors::DataFieldCustomValue2 => "Data Field: Custom Value 2",
13050 Sensors::DataFieldCustomValue3 => "Data Field: Custom Value 3",
13051 Sensors::DataFieldCustomValue4 => "Data Field: Custom Value 4",
13052 Sensors::DataFieldCustomValue5 => "Data Field: Custom Value 5",
13053 Sensors::DataFieldCustomValue6 => "Data Field: Custom Value 6",
13054 Sensors::DataFieldCustomValue7 => "Data Field: Custom Value 7",
13055 Sensors::DataFieldCustomValue8 => "Data Field: Custom Value 8",
13056 Sensors::DataFieldCustomValue9 => "Data Field: Custom Value 9",
13057 Sensors::DataFieldCustomValue10 => "Data Field: Custom Value 10",
13058 Sensors::DataFieldCustomValue11 => "Data Field: Custom Value 11",
13059 Sensors::DataFieldCustomValue12 => "Data Field: Custom Value 12",
13060 Sensors::DataFieldCustomValue13 => "Data Field: Custom Value 13",
13061 Sensors::DataFieldCustomValue14 => "Data Field: Custom Value 14",
13062 Sensors::DataFieldCustomValue15 => "Data Field: Custom Value 15",
13063 Sensors::DataFieldCustomValue16 => "Data Field: Custom Value 16",
13064 Sensors::DataFieldCustomValue17 => "Data Field: Custom Value 17",
13065 Sensors::DataFieldCustomValue18 => "Data Field: Custom Value 18",
13066 Sensors::DataFieldCustomValue19 => "Data Field: Custom Value 19",
13067 Sensors::DataFieldCustomValue20 => "Data Field: Custom Value 20",
13068 Sensors::DataFieldCustomValue21 => "Data Field: Custom Value 21",
13069 Sensors::DataFieldCustomValue22 => "Data Field: Custom Value 22",
13070 Sensors::DataFieldCustomValue23 => "Data Field: Custom Value 23",
13071 Sensors::DataFieldCustomValue24 => "Data Field: Custom Value 24",
13072 Sensors::DataFieldCustomValue25 => "Data Field: Custom Value 25",
13073 Sensors::DataFieldCustomValue26 => "Data Field: Custom Value 26",
13074 Sensors::DataFieldCustomValue27 => "Data Field: Custom Value 27",
13075 Sensors::DataFieldCustomValue28 => "Data Field: Custom Value 28",
13076 Sensors::DataFieldGeneric => "Data Field: Generic",
13077 Sensors::DataFieldGenericGUIDorPROPERTYKEY => "Data Field: Generic GUID or PROPERTYKEY",
13078 Sensors::DataFieldGenericCategoryGUID => "Data Field: Generic Category GUID",
13079 Sensors::DataFieldGenericTypeGUID => "Data Field: Generic Type GUID",
13080 Sensors::DataFieldGenericEventPROPERTYKEY => "Data Field: Generic Event PROPERTYKEY",
13081 Sensors::DataFieldGenericPropertyPROPERTYKEY => {
13082 "Data Field: Generic Property PROPERTYKEY"
13083 }
13084 Sensors::DataFieldGenericDataFieldPROPERTYKEY => {
13085 "Data Field: Generic Data Field PROPERTYKEY"
13086 }
13087 Sensors::DataFieldGenericEvent => "Data Field: Generic Event",
13088 Sensors::DataFieldGenericProperty => "Data Field: Generic Property",
13089 Sensors::DataFieldGenericDataField => "Data Field: Generic Data Field",
13090 Sensors::DataFieldEnumeratorTableRowIndex => "Data Field: Enumerator Table Row Index",
13091 Sensors::DataFieldEnumeratorTableRowCount => "Data Field: Enumerator Table Row Count",
13092 Sensors::DataFieldGenericGUIDorPROPERTYKEYkind => {
13093 "Data Field: Generic GUID or PROPERTYKEY kind"
13094 }
13095 Sensors::DataFieldGenericGUID => "Data Field: Generic GUID",
13096 Sensors::DataFieldGenericPROPERTYKEY => "Data Field: Generic PROPERTYKEY",
13097 Sensors::DataFieldGenericTopLevelCollectionID => {
13098 "Data Field: Generic Top Level Collection ID"
13099 }
13100 Sensors::DataFieldGenericReportID => "Data Field: Generic Report ID",
13101 Sensors::DataFieldGenericReportItemPositionIndex => {
13102 "Data Field: Generic Report Item Position Index"
13103 }
13104 Sensors::DataFieldGenericFirmwareVARTYPE => "Data Field: Generic Firmware VARTYPE",
13105 Sensors::DataFieldGenericUnitofMeasure => "Data Field: Generic Unit of Measure",
13106 Sensors::DataFieldGenericUnitExponent => "Data Field: Generic Unit Exponent",
13107 Sensors::DataFieldGenericReportSize => "Data Field: Generic Report Size",
13108 Sensors::DataFieldGenericReportCount => "Data Field: Generic Report Count",
13109 Sensors::PropertyGeneric => "Property: Generic",
13110 Sensors::PropertyEnumeratorTableRowIndex => "Property: Enumerator Table Row Index",
13111 Sensors::PropertyEnumeratorTableRowCount => "Property: Enumerator Table Row Count",
13112 Sensors::DataFieldPersonalActivity => "Data Field: Personal Activity",
13113 Sensors::DataFieldActivityType => "Data Field: Activity Type",
13114 Sensors::DataFieldActivityState => "Data Field: Activity State",
13115 Sensors::DataFieldDevicePosition => "Data Field: Device Position",
13116 Sensors::DataFieldStepCount => "Data Field: Step Count",
13117 Sensors::DataFieldStepCountReset => "Data Field: Step Count Reset",
13118 Sensors::DataFieldStepDuration => "Data Field: Step Duration",
13119 Sensors::DataFieldStepType => "Data Field: Step Type",
13120 Sensors::PropertyMinimumActivityDetectionInterval => {
13121 "Property: Minimum Activity Detection Interval"
13122 }
13123 Sensors::PropertySupportedActivityTypes => "Property: Supported Activity Types",
13124 Sensors::PropertySubscribedActivityTypes => "Property: Subscribed Activity Types",
13125 Sensors::PropertySupportedStepTypes => "Property: Supported Step Types",
13126 Sensors::PropertySubscribedStepTypes => "Property: Subscribed Step Types",
13127 Sensors::PropertyFloorHeight => "Property: Floor Height",
13128 Sensors::DataFieldCustomTypeID => "Data Field: Custom Type ID",
13129 Sensors::PropertyCustom => "Property: Custom",
13130 Sensors::PropertyCustomValue1 => "Property: Custom Value 1",
13131 Sensors::PropertyCustomValue2 => "Property: Custom Value 2",
13132 Sensors::PropertyCustomValue3 => "Property: Custom Value 3",
13133 Sensors::PropertyCustomValue4 => "Property: Custom Value 4",
13134 Sensors::PropertyCustomValue5 => "Property: Custom Value 5",
13135 Sensors::PropertyCustomValue6 => "Property: Custom Value 6",
13136 Sensors::PropertyCustomValue7 => "Property: Custom Value 7",
13137 Sensors::PropertyCustomValue8 => "Property: Custom Value 8",
13138 Sensors::PropertyCustomValue9 => "Property: Custom Value 9",
13139 Sensors::PropertyCustomValue10 => "Property: Custom Value 10",
13140 Sensors::PropertyCustomValue11 => "Property: Custom Value 11",
13141 Sensors::PropertyCustomValue12 => "Property: Custom Value 12",
13142 Sensors::PropertyCustomValue13 => "Property: Custom Value 13",
13143 Sensors::PropertyCustomValue14 => "Property: Custom Value 14",
13144 Sensors::PropertyCustomValue15 => "Property: Custom Value 15",
13145 Sensors::PropertyCustomValue16 => "Property: Custom Value 16",
13146 Sensors::DataFieldHinge => "Data Field: Hinge",
13147 Sensors::DataFieldHingeAngle => "Data Field: Hinge Angle",
13148 Sensors::DataFieldGestureSensor => "Data Field: Gesture Sensor",
13149 Sensors::DataFieldGestureState => "Data Field: Gesture State",
13150 Sensors::DataFieldHingeFoldInitialAngle => "Data Field: Hinge Fold Initial Angle",
13151 Sensors::DataFieldHingeFoldFinalAngle => "Data Field: Hinge Fold Final Angle",
13152 Sensors::DataFieldHingeFoldContributingPanel => {
13153 "Data Field: Hinge Fold Contributing Panel"
13154 }
13155 Sensors::DataFieldHingeFoldType => "Data Field: Hinge Fold Type",
13156 Sensors::SensorStateUndefined => "Sensor State: Undefined",
13157 Sensors::SensorStateReady => "Sensor State: Ready",
13158 Sensors::SensorStateNotAvailable => "Sensor State: Not Available",
13159 Sensors::SensorStateNoData => "Sensor State: No Data",
13160 Sensors::SensorStateInitializing => "Sensor State: Initializing",
13161 Sensors::SensorStateAccessDenied => "Sensor State: Access Denied",
13162 Sensors::SensorStateError => "Sensor State: Error",
13163 Sensors::SensorEventUnknown => "Sensor Event: Unknown",
13164 Sensors::SensorEventStateChanged => "Sensor Event: State Changed",
13165 Sensors::SensorEventPropertyChanged => "Sensor Event: Property Changed",
13166 Sensors::SensorEventDataUpdated => "Sensor Event: Data Updated",
13167 Sensors::SensorEventPollResponse => "Sensor Event: Poll Response",
13168 Sensors::SensorEventChangeSensitivity => "Sensor Event: Change Sensitivity",
13169 Sensors::SensorEventRangeMaximumReached => "Sensor Event: Range Maximum Reached",
13170 Sensors::SensorEventRangeMinimumReached => "Sensor Event: Range Minimum Reached",
13171 Sensors::SensorEventHighThresholdCrossUpward => {
13172 "Sensor Event: High Threshold Cross Upward"
13173 }
13174 Sensors::SensorEventHighThresholdCrossDownward => {
13175 "Sensor Event: High Threshold Cross Downward"
13176 }
13177 Sensors::SensorEventLowThresholdCrossUpward => {
13178 "Sensor Event: Low Threshold Cross Upward"
13179 }
13180 Sensors::SensorEventLowThresholdCrossDownward => {
13181 "Sensor Event: Low Threshold Cross Downward"
13182 }
13183 Sensors::SensorEventZeroThresholdCrossUpward => {
13184 "Sensor Event: Zero Threshold Cross Upward"
13185 }
13186 Sensors::SensorEventZeroThresholdCrossDownward => {
13187 "Sensor Event: Zero Threshold Cross Downward"
13188 }
13189 Sensors::SensorEventPeriodExceeded => "Sensor Event: Period Exceeded",
13190 Sensors::SensorEventFrequencyExceeded => "Sensor Event: Frequency Exceeded",
13191 Sensors::SensorEventComplexTrigger => "Sensor Event: Complex Trigger",
13192 Sensors::ConnectionTypePCIntegrated => "Connection Type: PC Integrated",
13193 Sensors::ConnectionTypePCAttached => "Connection Type: PC Attached",
13194 Sensors::ConnectionTypePCExternal => "Connection Type: PC External",
13195 Sensors::ReportingStateReportNoEvents => "Reporting State: Report No Events",
13196 Sensors::ReportingStateReportAllEvents => "Reporting State: Report All Events",
13197 Sensors::ReportingStateReportThresholdEvents => {
13198 "Reporting State: Report Threshold Events"
13199 }
13200 Sensors::ReportingStateWakeOnNoEvents => "Reporting State: Wake On No Events",
13201 Sensors::ReportingStateWakeOnAllEvents => "Reporting State: Wake On All Events",
13202 Sensors::ReportingStateWakeOnThresholdEvents => {
13203 "Reporting State: Wake On Threshold Events"
13204 }
13205 Sensors::ReportingStateAnytime => "Reporting State: Anytime",
13206 Sensors::PowerStateUndefined => "Power State: Undefined",
13207 Sensors::PowerStateD0FullPower => "Power State: D0 Full Power",
13208 Sensors::PowerStateD1LowPower => "Power State: D1 Low Power",
13209 Sensors::PowerStateD2StandbyPowerwithWakeup => {
13210 "Power State: D2 Standby Power with Wakeup"
13211 }
13212 Sensors::PowerStateD3SleepwithWakeup => "Power State: D3 Sleep with Wakeup",
13213 Sensors::PowerStateD4PowerOff => "Power State: D4 Power Off",
13214 Sensors::AccuracyDefault => "Accuracy: Default",
13215 Sensors::AccuracyHigh => "Accuracy: High",
13216 Sensors::AccuracyMedium => "Accuracy: Medium",
13217 Sensors::AccuracyLow => "Accuracy: Low",
13218 Sensors::FixQualityNoFix => "Fix Quality: No Fix",
13219 Sensors::FixQualityGPS => "Fix Quality: GPS",
13220 Sensors::FixQualityDGPS => "Fix Quality: DGPS",
13221 Sensors::FixTypeNoFix => "Fix Type: No Fix",
13222 Sensors::FixTypeGPSSPSModeFixValid => "Fix Type: GPS SPS Mode, Fix Valid",
13223 Sensors::FixTypeDGPSSPSModeFixValid => "Fix Type: DGPS SPS Mode, Fix Valid",
13224 Sensors::FixTypeGPSPPSModeFixValid => "Fix Type: GPS PPS Mode, Fix Valid",
13225 Sensors::FixTypeRealTimeKinematic => "Fix Type: Real Time Kinematic",
13226 Sensors::FixTypeFloatRTK => "Fix Type: Float RTK",
13227 Sensors::FixTypeEstimateddeadreckoned => "Fix Type: Estimated (dead reckoned)",
13228 Sensors::FixTypeManualInputMode => "Fix Type: Manual Input Mode",
13229 Sensors::FixTypeSimulatorMode => "Fix Type: Simulator Mode",
13230 Sensors::GPSOperationModeManual => "GPS Operation Mode: Manual",
13231 Sensors::GPSOperationModeAutomatic => "GPS Operation Mode: Automatic",
13232 Sensors::GPSSelectionModeAutonomous => "GPS Selection Mode: Autonomous",
13233 Sensors::GPSSelectionModeDGPS => "GPS Selection Mode: DGPS",
13234 Sensors::GPSSelectionModeEstimateddeadreckoned => {
13235 "GPS Selection Mode: Estimated (dead reckoned)"
13236 }
13237 Sensors::GPSSelectionModeManualInput => "GPS Selection Mode: Manual Input",
13238 Sensors::GPSSelectionModeSimulator => "GPS Selection Mode: Simulator",
13239 Sensors::GPSSelectionModeDataNotValid => "GPS Selection Mode: Data Not Valid",
13240 Sensors::GPSStatusDataValid => "GPS Status Data: Valid",
13241 Sensors::GPSStatusDataNotValid => "GPS Status Data: Not Valid",
13242 Sensors::DayofWeekSunday => "Day of Week: Sunday",
13243 Sensors::DayofWeekMonday => "Day of Week: Monday",
13244 Sensors::DayofWeekTuesday => "Day of Week: Tuesday",
13245 Sensors::DayofWeekWednesday => "Day of Week: Wednesday",
13246 Sensors::DayofWeekThursday => "Day of Week: Thursday",
13247 Sensors::DayofWeekFriday => "Day of Week: Friday",
13248 Sensors::DayofWeekSaturday => "Day of Week: Saturday",
13249 Sensors::KindCategory => "Kind: Category",
13250 Sensors::KindType => "Kind: Type",
13251 Sensors::KindEvent => "Kind: Event",
13252 Sensors::KindProperty => "Kind: Property",
13253 Sensors::KindDataField => "Kind: Data Field",
13254 Sensors::MagnetometerAccuracyLow => "Magnetometer Accuracy: Low",
13255 Sensors::MagnetometerAccuracyMedium => "Magnetometer Accuracy: Medium",
13256 Sensors::MagnetometerAccuracyHigh => "Magnetometer Accuracy: High",
13257 Sensors::SimpleOrientationDirectionNotRotated => {
13258 "Simple Orientation Direction: Not Rotated"
13259 }
13260 Sensors::SimpleOrientationDirectionRotated90DegreesCCW => {
13261 "Simple Orientation Direction: Rotated 90 Degrees CCW"
13262 }
13263 Sensors::SimpleOrientationDirectionRotated180DegreesCCW => {
13264 "Simple Orientation Direction: Rotated 180 Degrees CCW"
13265 }
13266 Sensors::SimpleOrientationDirectionRotated270DegreesCCW => {
13267 "Simple Orientation Direction: Rotated 270 Degrees CCW"
13268 }
13269 Sensors::SimpleOrientationDirectionFaceUp => "Simple Orientation Direction: Face Up",
13270 Sensors::SimpleOrientationDirectionFaceDown => {
13271 "Simple Orientation Direction: Face Down"
13272 }
13273 Sensors::VT_NULL => "VT_NULL",
13274 Sensors::VT_BOOL => "VT_BOOL",
13275 Sensors::VT_UI1 => "VT_UI1",
13276 Sensors::VT_I1 => "VT_I1",
13277 Sensors::VT_UI2 => "VT_UI2",
13278 Sensors::VT_I2 => "VT_I2",
13279 Sensors::VT_UI4 => "VT_UI4",
13280 Sensors::VT_I4 => "VT_I4",
13281 Sensors::VT_UI8 => "VT_UI8",
13282 Sensors::VT_I8 => "VT_I8",
13283 Sensors::VT_R4 => "VT_R4",
13284 Sensors::VT_R8 => "VT_R8",
13285 Sensors::VT_WSTR => "VT_WSTR",
13286 Sensors::VT_STR => "VT_STR",
13287 Sensors::VT_CLSID => "VT_CLSID",
13288 Sensors::VT_VECTORVT_UI1 => "VT_VECTOR VT_UI1",
13289 Sensors::VT_F16E0 => "VT_F16E0",
13290 Sensors::VT_F16E1 => "VT_F16E1",
13291 Sensors::VT_F16E2 => "VT_F16E2",
13292 Sensors::VT_F16E3 => "VT_F16E3",
13293 Sensors::VT_F16E4 => "VT_F16E4",
13294 Sensors::VT_F16E5 => "VT_F16E5",
13295 Sensors::VT_F16E6 => "VT_F16E6",
13296 Sensors::VT_F16E7 => "VT_F16E7",
13297 Sensors::VT_F16E8 => "VT_F16E8",
13298 Sensors::VT_F16E9 => "VT_F16E9",
13299 Sensors::VT_F16EA => "VT_F16EA",
13300 Sensors::VT_F16EB => "VT_F16EB",
13301 Sensors::VT_F16EC => "VT_F16EC",
13302 Sensors::VT_F16ED => "VT_F16ED",
13303 Sensors::VT_F16EE => "VT_F16EE",
13304 Sensors::VT_F16EF => "VT_F16EF",
13305 Sensors::VT_F32E0 => "VT_F32E0",
13306 Sensors::VT_F32E1 => "VT_F32E1",
13307 Sensors::VT_F32E2 => "VT_F32E2",
13308 Sensors::VT_F32E3 => "VT_F32E3",
13309 Sensors::VT_F32E4 => "VT_F32E4",
13310 Sensors::VT_F32E5 => "VT_F32E5",
13311 Sensors::VT_F32E6 => "VT_F32E6",
13312 Sensors::VT_F32E7 => "VT_F32E7",
13313 Sensors::VT_F32E8 => "VT_F32E8",
13314 Sensors::VT_F32E9 => "VT_F32E9",
13315 Sensors::VT_F32EA => "VT_F32EA",
13316 Sensors::VT_F32EB => "VT_F32EB",
13317 Sensors::VT_F32EC => "VT_F32EC",
13318 Sensors::VT_F32ED => "VT_F32ED",
13319 Sensors::VT_F32EE => "VT_F32EE",
13320 Sensors::VT_F32EF => "VT_F32EF",
13321 Sensors::ActivityTypeUnknown => "Activity Type: Unknown",
13322 Sensors::ActivityTypeStationary => "Activity Type: Stationary",
13323 Sensors::ActivityTypeFidgeting => "Activity Type: Fidgeting",
13324 Sensors::ActivityTypeWalking => "Activity Type: Walking",
13325 Sensors::ActivityTypeRunning => "Activity Type: Running",
13326 Sensors::ActivityTypeInVehicle => "Activity Type: In Vehicle",
13327 Sensors::ActivityTypeBiking => "Activity Type: Biking",
13328 Sensors::ActivityTypeIdle => "Activity Type: Idle",
13329 Sensors::UnitNotSpecified => "Unit: Not Specified",
13330 Sensors::UnitLux => "Unit: Lux",
13331 Sensors::UnitDegreesKelvin => "Unit: Degrees Kelvin",
13332 Sensors::UnitDegreesCelsius => "Unit: Degrees Celsius",
13333 Sensors::UnitPascal => "Unit: Pascal",
13334 Sensors::UnitNewton => "Unit: Newton",
13335 Sensors::UnitMetersSecond => "Unit: Meters/Second",
13336 Sensors::UnitKilogram => "Unit: Kilogram",
13337 Sensors::UnitMeter => "Unit: Meter",
13338 Sensors::UnitMetersSecondSecond => "Unit: Meters/Second/Second",
13339 Sensors::UnitFarad => "Unit: Farad",
13340 Sensors::UnitAmpere => "Unit: Ampere",
13341 Sensors::UnitWatt => "Unit: Watt",
13342 Sensors::UnitHenry => "Unit: Henry",
13343 Sensors::UnitOhm => "Unit: Ohm",
13344 Sensors::UnitVolt => "Unit: Volt",
13345 Sensors::UnitHertz => "Unit: Hertz",
13346 Sensors::UnitBar => "Unit: Bar",
13347 Sensors::UnitDegreesAnticlockwise => "Unit: Degrees Anti-clockwise",
13348 Sensors::UnitDegreesClockwise => "Unit: Degrees Clockwise",
13349 Sensors::UnitDegrees => "Unit: Degrees",
13350 Sensors::UnitDegreesSecond => "Unit: Degrees/Second",
13351 Sensors::UnitDegreesSecondSecond => "Unit: Degrees/Second/Second",
13352 Sensors::UnitKnot => "Unit: Knot",
13353 Sensors::UnitPercent => "Unit: Percent",
13354 Sensors::UnitSecond => "Unit: Second",
13355 Sensors::UnitMillisecond => "Unit: Millisecond",
13356 Sensors::UnitG => "Unit: G",
13357 Sensors::UnitBytes => "Unit: Bytes",
13358 Sensors::UnitMilligauss => "Unit: Milligauss",
13359 Sensors::UnitBits => "Unit: Bits",
13360 Sensors::ActivityStateNoStateChange => "Activity State: No State Change",
13361 Sensors::ActivityStateStartActivity => "Activity State: Start Activity",
13362 Sensors::ActivityStateEndActivity => "Activity State: End Activity",
13363 Sensors::Exponent0 => "Exponent 0",
13364 Sensors::Exponent1 => "Exponent 1",
13365 Sensors::Exponent2 => "Exponent 2",
13366 Sensors::Exponent3 => "Exponent 3",
13367 Sensors::Exponent4 => "Exponent 4",
13368 Sensors::Exponent5 => "Exponent 5",
13369 Sensors::Exponent6 => "Exponent 6",
13370 Sensors::Exponent7 => "Exponent 7",
13371 Sensors::Exponent8 => "Exponent 8",
13372 Sensors::Exponent9 => "Exponent 9",
13373 Sensors::ExponentA => "Exponent A",
13374 Sensors::ExponentB => "Exponent B",
13375 Sensors::ExponentC => "Exponent C",
13376 Sensors::ExponentD => "Exponent D",
13377 Sensors::ExponentE => "Exponent E",
13378 Sensors::ExponentF => "Exponent F",
13379 Sensors::DevicePositionUnknown => "Device Position: Unknown",
13380 Sensors::DevicePositionUnchanged => "Device Position: Unchanged",
13381 Sensors::DevicePositionOnDesk => "Device Position: On Desk",
13382 Sensors::DevicePositionInHand => "Device Position: In Hand",
13383 Sensors::DevicePositionMovinginBag => "Device Position: Moving in Bag",
13384 Sensors::DevicePositionStationaryinBag => "Device Position: Stationary in Bag",
13385 Sensors::StepTypeUnknown => "Step Type: Unknown",
13386 Sensors::StepTypeWalking => "Step Type: Walking",
13387 Sensors::StepTypeRunning => "Step Type: Running",
13388 Sensors::GestureStateUnknown => "Gesture State: Unknown",
13389 Sensors::GestureStateStarted => "Gesture State: Started",
13390 Sensors::GestureStateCompleted => "Gesture State: Completed",
13391 Sensors::GestureStateCancelled => "Gesture State: Cancelled",
13392 Sensors::HingeFoldContributingPanelUnknown => "Hinge Fold Contributing Panel: Unknown",
13393 Sensors::HingeFoldContributingPanelPanel1 => "Hinge Fold Contributing Panel: Panel 1",
13394 Sensors::HingeFoldContributingPanelPanel2 => "Hinge Fold Contributing Panel: Panel 2",
13395 Sensors::HingeFoldContributingPanelBoth => "Hinge Fold Contributing Panel: Both",
13396 Sensors::HingeFoldTypeUnknown => "Hinge Fold Type: Unknown",
13397 Sensors::HingeFoldTypeIncreasing => "Hinge Fold Type: Increasing",
13398 Sensors::HingeFoldTypeDecreasing => "Hinge Fold Type: Decreasing",
13399 Sensors::HumanPresenceDetectionTypeVendorDefinedNonBiometric => {
13400 "Human Presence Detection Type: Vendor-Defined Non-Biometric"
13401 }
13402 Sensors::HumanPresenceDetectionTypeVendorDefinedBiometric => {
13403 "Human Presence Detection Type: Vendor-Defined Biometric"
13404 }
13405 Sensors::HumanPresenceDetectionTypeFacialBiometric => {
13406 "Human Presence Detection Type: Facial Biometric"
13407 }
13408 Sensors::HumanPresenceDetectionTypeAudioBiometric => {
13409 "Human Presence Detection Type: Audio Biometric"
13410 }
13411 Sensors::ModifierChangeSensitivityAbsolute => "Modifier: Change Sensitivity Absolute",
13412 Sensors::ModifierMaximum => "Modifier: Maximum",
13413 Sensors::ModifierMinimum => "Modifier: Minimum",
13414 Sensors::ModifierAccuracy => "Modifier: Accuracy",
13415 Sensors::ModifierResolution => "Modifier: Resolution",
13416 Sensors::ModifierThresholdHigh => "Modifier: Threshold High",
13417 Sensors::ModifierThresholdLow => "Modifier: Threshold Low",
13418 Sensors::ModifierCalibrationOffset => "Modifier: Calibration Offset",
13419 Sensors::ModifierCalibrationMultiplier => "Modifier: Calibration Multiplier",
13420 Sensors::ModifierReportInterval => "Modifier: Report Interval",
13421 Sensors::ModifierFrequencyMax => "Modifier: Frequency Max",
13422 Sensors::ModifierPeriodMax => "Modifier: Period Max",
13423 Sensors::ModifierChangeSensitivityPercentofRange => {
13424 "Modifier: Change Sensitivity Percent of Range"
13425 }
13426 Sensors::ModifierChangeSensitivityPercentRelative => {
13427 "Modifier: Change Sensitivity Percent Relative"
13428 }
13429 Sensors::ModifierVendorReserved => "Modifier: Vendor Reserved",
13430 }
13431 .into()
13432 }
13433}
13434
13435#[cfg(feature = "std")]
13436impl fmt::Display for Sensors {
13437 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
13438 write!(f, "{}", self.name())
13439 }
13440}
13441
13442impl AsUsage for Sensors {
13443 fn usage_value(&self) -> u32 {
13445 u32::from(self)
13446 }
13447
13448 fn usage_id_value(&self) -> u16 {
13450 u16::from(self)
13451 }
13452
13453 fn usage(&self) -> Usage {
13464 Usage::from(self)
13465 }
13466}
13467
13468impl AsUsagePage for Sensors {
13469 fn usage_page_value(&self) -> u16 {
13473 let up = UsagePage::from(self);
13474 u16::from(up)
13475 }
13476
13477 fn usage_page(&self) -> UsagePage {
13479 UsagePage::from(self)
13480 }
13481}
13482
13483impl From<&Sensors> for u16 {
13484 fn from(sensors: &Sensors) -> u16 {
13485 match *sensors {
13486 Sensors::Sensor => 1,
13487 Sensors::Biometric => 16,
13488 Sensors::BiometricHumanPresence => 17,
13489 Sensors::BiometricHumanProximity => 18,
13490 Sensors::BiometricHumanTouch => 19,
13491 Sensors::BiometricBloodPressure => 20,
13492 Sensors::BiometricBodyTemperature => 21,
13493 Sensors::BiometricHeartRate => 22,
13494 Sensors::BiometricHeartRateVariability => 23,
13495 Sensors::BiometricPeripheralOxygenSaturation => 24,
13496 Sensors::BiometricRespiratoryRate => 25,
13497 Sensors::Electrical => 32,
13498 Sensors::ElectricalCapacitance => 33,
13499 Sensors::ElectricalCurrent => 34,
13500 Sensors::ElectricalPower => 35,
13501 Sensors::ElectricalInductance => 36,
13502 Sensors::ElectricalResistance => 37,
13503 Sensors::ElectricalVoltage => 38,
13504 Sensors::ElectricalPotentiometer => 39,
13505 Sensors::ElectricalFrequency => 40,
13506 Sensors::ElectricalPeriod => 41,
13507 Sensors::Environmental => 48,
13508 Sensors::EnvironmentalAtmosphericPressure => 49,
13509 Sensors::EnvironmentalHumidity => 50,
13510 Sensors::EnvironmentalTemperature => 51,
13511 Sensors::EnvironmentalWindDirection => 52,
13512 Sensors::EnvironmentalWindSpeed => 53,
13513 Sensors::EnvironmentalAirQuality => 54,
13514 Sensors::EnvironmentalHeatIndex => 55,
13515 Sensors::EnvironmentalSurfaceTemperature => 56,
13516 Sensors::EnvironmentalVolatileOrganicCompounds => 57,
13517 Sensors::EnvironmentalObjectPresence => 58,
13518 Sensors::EnvironmentalObjectProximity => 59,
13519 Sensors::Light => 64,
13520 Sensors::LightAmbientLight => 65,
13521 Sensors::LightConsumerInfrared => 66,
13522 Sensors::LightInfraredLight => 67,
13523 Sensors::LightVisibleLight => 68,
13524 Sensors::LightUltravioletLight => 69,
13525 Sensors::Location => 80,
13526 Sensors::LocationBroadcast => 81,
13527 Sensors::LocationDeadReckoning => 82,
13528 Sensors::LocationGPSGlobalPositioningSystem => 83,
13529 Sensors::LocationLookup => 84,
13530 Sensors::LocationOther => 85,
13531 Sensors::LocationStatic => 86,
13532 Sensors::LocationTriangulation => 87,
13533 Sensors::Mechanical => 96,
13534 Sensors::MechanicalBooleanSwitch => 97,
13535 Sensors::MechanicalBooleanSwitchArray => 98,
13536 Sensors::MechanicalMultivalueSwitch => 99,
13537 Sensors::MechanicalForce => 100,
13538 Sensors::MechanicalPressure => 101,
13539 Sensors::MechanicalStrain => 102,
13540 Sensors::MechanicalWeight => 103,
13541 Sensors::MechanicalHapticVibrator => 104,
13542 Sensors::MechanicalHallEffectSwitch => 105,
13543 Sensors::Motion => 112,
13544 Sensors::MotionAccelerometer1D => 113,
13545 Sensors::MotionAccelerometer2D => 114,
13546 Sensors::MotionAccelerometer3D => 115,
13547 Sensors::MotionGyrometer1D => 116,
13548 Sensors::MotionGyrometer2D => 117,
13549 Sensors::MotionGyrometer3D => 118,
13550 Sensors::MotionMotionDetector => 119,
13551 Sensors::MotionSpeedometer => 120,
13552 Sensors::MotionAccelerometer => 121,
13553 Sensors::MotionGyrometer => 122,
13554 Sensors::MotionGravityVector => 123,
13555 Sensors::MotionLinearAccelerometer => 124,
13556 Sensors::Orientation => 128,
13557 Sensors::OrientationCompass1D => 129,
13558 Sensors::OrientationCompass2D => 130,
13559 Sensors::OrientationCompass3D => 131,
13560 Sensors::OrientationInclinometer1D => 132,
13561 Sensors::OrientationInclinometer2D => 133,
13562 Sensors::OrientationInclinometer3D => 134,
13563 Sensors::OrientationDistance1D => 135,
13564 Sensors::OrientationDistance2D => 136,
13565 Sensors::OrientationDistance3D => 137,
13566 Sensors::OrientationDeviceOrientation => 138,
13567 Sensors::OrientationCompass => 139,
13568 Sensors::OrientationInclinometer => 140,
13569 Sensors::OrientationDistance => 141,
13570 Sensors::OrientationRelativeOrientation => 142,
13571 Sensors::OrientationSimpleOrientation => 143,
13572 Sensors::Scanner => 144,
13573 Sensors::ScannerBarcode => 145,
13574 Sensors::ScannerRFID => 146,
13575 Sensors::ScannerNFC => 147,
13576 Sensors::Time => 160,
13577 Sensors::TimeAlarmTimer => 161,
13578 Sensors::TimeRealTimeClock => 162,
13579 Sensors::PersonalActivity => 176,
13580 Sensors::PersonalActivityActivityDetection => 177,
13581 Sensors::PersonalActivityDevicePosition => 178,
13582 Sensors::PersonalActivityFloorTracker => 179,
13583 Sensors::PersonalActivityPedometer => 180,
13584 Sensors::PersonalActivityStepDetection => 181,
13585 Sensors::OrientationExtended => 192,
13586 Sensors::OrientationExtendedGeomagneticOrientation => 193,
13587 Sensors::OrientationExtendedMagnetometer => 194,
13588 Sensors::Gesture => 208,
13589 Sensors::GestureChassisFlipGesture => 209,
13590 Sensors::GestureHingeFoldGesture => 210,
13591 Sensors::Other => 224,
13592 Sensors::OtherCustom => 225,
13593 Sensors::OtherGeneric => 226,
13594 Sensors::OtherGenericEnumerator => 227,
13595 Sensors::OtherHingeAngle => 228,
13596 Sensors::VendorReserved1 => 240,
13597 Sensors::VendorReserved2 => 241,
13598 Sensors::VendorReserved3 => 242,
13599 Sensors::VendorReserved4 => 243,
13600 Sensors::VendorReserved5 => 244,
13601 Sensors::VendorReserved6 => 245,
13602 Sensors::VendorReserved7 => 246,
13603 Sensors::VendorReserved8 => 247,
13604 Sensors::VendorReserved9 => 248,
13605 Sensors::VendorReserved10 => 249,
13606 Sensors::VendorReserved11 => 250,
13607 Sensors::VendorReserved12 => 251,
13608 Sensors::VendorReserved13 => 252,
13609 Sensors::VendorReserved14 => 253,
13610 Sensors::VendorReserved15 => 254,
13611 Sensors::VendorReserved16 => 255,
13612 Sensors::Event => 512,
13613 Sensors::EventSensorState => 513,
13614 Sensors::EventSensorEvent => 514,
13615 Sensors::Property => 768,
13616 Sensors::PropertyFriendlyName => 769,
13617 Sensors::PropertyPersistentUniqueID => 770,
13618 Sensors::PropertySensorStatus => 771,
13619 Sensors::PropertyMinimumReportInterval => 772,
13620 Sensors::PropertySensorManufacturer => 773,
13621 Sensors::PropertySensorModel => 774,
13622 Sensors::PropertySensorSerialNumber => 775,
13623 Sensors::PropertySensorDescription => 776,
13624 Sensors::PropertySensorConnectionType => 777,
13625 Sensors::PropertySensorDevicePath => 778,
13626 Sensors::PropertyHardwareRevision => 779,
13627 Sensors::PropertyFirmwareVersion => 780,
13628 Sensors::PropertyReleaseDate => 781,
13629 Sensors::PropertyReportInterval => 782,
13630 Sensors::PropertyChangeSensitivityAbsolute => 783,
13631 Sensors::PropertyChangeSensitivityPercentofRange => 784,
13632 Sensors::PropertyChangeSensitivityPercentRelative => 785,
13633 Sensors::PropertyAccuracy => 786,
13634 Sensors::PropertyResolution => 787,
13635 Sensors::PropertyMaximum => 788,
13636 Sensors::PropertyMinimum => 789,
13637 Sensors::PropertyReportingState => 790,
13638 Sensors::PropertySamplingRate => 791,
13639 Sensors::PropertyResponseCurve => 792,
13640 Sensors::PropertyPowerState => 793,
13641 Sensors::PropertyMaximumFIFOEvents => 794,
13642 Sensors::PropertyReportLatency => 795,
13643 Sensors::PropertyFlushFIFOEvents => 796,
13644 Sensors::PropertyMaximumPowerConsumption => 797,
13645 Sensors::PropertyIsPrimary => 798,
13646 Sensors::PropertyHumanPresenceDetectionType => 799,
13647 Sensors::DataFieldLocation => 1024,
13648 Sensors::DataFieldAltitudeAntennaSeaLevel => 1026,
13649 Sensors::DataFieldDifferentialReferenceStationID => 1027,
13650 Sensors::DataFieldAltitudeEllipsoidError => 1028,
13651 Sensors::DataFieldAltitudeEllipsoid => 1029,
13652 Sensors::DataFieldAltitudeSeaLevelError => 1030,
13653 Sensors::DataFieldAltitudeSeaLevel => 1031,
13654 Sensors::DataFieldDifferentialGPSDataAge => 1032,
13655 Sensors::DataFieldErrorRadius => 1033,
13656 Sensors::DataFieldFixQuality => 1034,
13657 Sensors::DataFieldFixType => 1035,
13658 Sensors::DataFieldGeoidalSeparation => 1036,
13659 Sensors::DataFieldGPSOperationMode => 1037,
13660 Sensors::DataFieldGPSSelectionMode => 1038,
13661 Sensors::DataFieldGPSStatus => 1039,
13662 Sensors::DataFieldPositionDilutionofPrecision => 1040,
13663 Sensors::DataFieldHorizontalDilutionofPrecision => 1041,
13664 Sensors::DataFieldVerticalDilutionofPrecision => 1042,
13665 Sensors::DataFieldLatitude => 1043,
13666 Sensors::DataFieldLongitude => 1044,
13667 Sensors::DataFieldTrueHeading => 1045,
13668 Sensors::DataFieldMagneticHeading => 1046,
13669 Sensors::DataFieldMagneticVariation => 1047,
13670 Sensors::DataFieldSpeed => 1048,
13671 Sensors::DataFieldSatellitesinView => 1049,
13672 Sensors::DataFieldSatellitesinViewAzimuth => 1050,
13673 Sensors::DataFieldSatellitesinViewElevation => 1051,
13674 Sensors::DataFieldSatellitesinViewIDs => 1052,
13675 Sensors::DataFieldSatellitesinViewPRNs => 1053,
13676 Sensors::DataFieldSatellitesinViewSNRatios => 1054,
13677 Sensors::DataFieldSatellitesUsedCount => 1055,
13678 Sensors::DataFieldSatellitesUsedPRNs => 1056,
13679 Sensors::DataFieldNMEASentence => 1057,
13680 Sensors::DataFieldAddressLine1 => 1058,
13681 Sensors::DataFieldAddressLine2 => 1059,
13682 Sensors::DataFieldCity => 1060,
13683 Sensors::DataFieldStateorProvince => 1061,
13684 Sensors::DataFieldCountryorRegion => 1062,
13685 Sensors::DataFieldPostalCode => 1063,
13686 Sensors::PropertyLocation => 1066,
13687 Sensors::PropertyLocationDesiredAccuracy => 1067,
13688 Sensors::DataFieldEnvironmental => 1072,
13689 Sensors::DataFieldAtmosphericPressure => 1073,
13690 Sensors::DataFieldRelativeHumidity => 1075,
13691 Sensors::DataFieldTemperature => 1076,
13692 Sensors::DataFieldWindDirection => 1077,
13693 Sensors::DataFieldWindSpeed => 1078,
13694 Sensors::DataFieldAirQualityIndex => 1079,
13695 Sensors::DataFieldEquivalentCO2 => 1080,
13696 Sensors::DataFieldVolatileOrganicCompoundConcentration => 1081,
13697 Sensors::DataFieldObjectPresence => 1082,
13698 Sensors::DataFieldObjectProximityRange => 1083,
13699 Sensors::DataFieldObjectProximityOutofRange => 1084,
13700 Sensors::PropertyEnvironmental => 1088,
13701 Sensors::PropertyReferencePressure => 1089,
13702 Sensors::DataFieldMotion => 1104,
13703 Sensors::DataFieldMotionState => 1105,
13704 Sensors::DataFieldAcceleration => 1106,
13705 Sensors::DataFieldAccelerationAxisX => 1107,
13706 Sensors::DataFieldAccelerationAxisY => 1108,
13707 Sensors::DataFieldAccelerationAxisZ => 1109,
13708 Sensors::DataFieldAngularVelocity => 1110,
13709 Sensors::DataFieldAngularVelocityaboutXAxis => 1111,
13710 Sensors::DataFieldAngularVelocityaboutYAxis => 1112,
13711 Sensors::DataFieldAngularVelocityaboutZAxis => 1113,
13712 Sensors::DataFieldAngularPosition => 1114,
13713 Sensors::DataFieldAngularPositionaboutXAxis => 1115,
13714 Sensors::DataFieldAngularPositionaboutYAxis => 1116,
13715 Sensors::DataFieldAngularPositionaboutZAxis => 1117,
13716 Sensors::DataFieldMotionSpeed => 1118,
13717 Sensors::DataFieldMotionIntensity => 1119,
13718 Sensors::DataFieldOrientation => 1136,
13719 Sensors::DataFieldHeading => 1137,
13720 Sensors::DataFieldHeadingXAxis => 1138,
13721 Sensors::DataFieldHeadingYAxis => 1139,
13722 Sensors::DataFieldHeadingZAxis => 1140,
13723 Sensors::DataFieldHeadingCompensatedMagneticNorth => 1141,
13724 Sensors::DataFieldHeadingCompensatedTrueNorth => 1142,
13725 Sensors::DataFieldHeadingMagneticNorth => 1143,
13726 Sensors::DataFieldHeadingTrueNorth => 1144,
13727 Sensors::DataFieldDistance => 1145,
13728 Sensors::DataFieldDistanceXAxis => 1146,
13729 Sensors::DataFieldDistanceYAxis => 1147,
13730 Sensors::DataFieldDistanceZAxis => 1148,
13731 Sensors::DataFieldDistanceOutofRange => 1149,
13732 Sensors::DataFieldTilt => 1150,
13733 Sensors::DataFieldTiltXAxis => 1151,
13734 Sensors::DataFieldTiltYAxis => 1152,
13735 Sensors::DataFieldTiltZAxis => 1153,
13736 Sensors::DataFieldRotationMatrix => 1154,
13737 Sensors::DataFieldQuaternion => 1155,
13738 Sensors::DataFieldMagneticFlux => 1156,
13739 Sensors::DataFieldMagneticFluxXAxis => 1157,
13740 Sensors::DataFieldMagneticFluxYAxis => 1158,
13741 Sensors::DataFieldMagneticFluxZAxis => 1159,
13742 Sensors::DataFieldMagnetometerAccuracy => 1160,
13743 Sensors::DataFieldSimpleOrientationDirection => 1161,
13744 Sensors::DataFieldMechanical => 1168,
13745 Sensors::DataFieldBooleanSwitchState => 1169,
13746 Sensors::DataFieldBooleanSwitchArrayStates => 1170,
13747 Sensors::DataFieldMultivalueSwitchValue => 1171,
13748 Sensors::DataFieldForce => 1172,
13749 Sensors::DataFieldAbsolutePressure => 1173,
13750 Sensors::DataFieldGaugePressure => 1174,
13751 Sensors::DataFieldStrain => 1175,
13752 Sensors::DataFieldWeight => 1176,
13753 Sensors::PropertyMechanical => 1184,
13754 Sensors::PropertyVibrationState => 1185,
13755 Sensors::PropertyForwardVibrationSpeed => 1186,
13756 Sensors::PropertyBackwardVibrationSpeed => 1187,
13757 Sensors::DataFieldBiometric => 1200,
13758 Sensors::DataFieldHumanPresence => 1201,
13759 Sensors::DataFieldHumanProximityRange => 1202,
13760 Sensors::DataFieldHumanProximityOutofRange => 1203,
13761 Sensors::DataFieldHumanTouchState => 1204,
13762 Sensors::DataFieldBloodPressure => 1205,
13763 Sensors::DataFieldBloodPressureDiastolic => 1206,
13764 Sensors::DataFieldBloodPressureSystolic => 1207,
13765 Sensors::DataFieldHeartRate => 1208,
13766 Sensors::DataFieldRestingHeartRate => 1209,
13767 Sensors::DataFieldHeartbeatInterval => 1210,
13768 Sensors::DataFieldRespiratoryRate => 1211,
13769 Sensors::DataFieldSpO2 => 1212,
13770 Sensors::DataFieldHumanAttentionDetected => 1213,
13771 Sensors::DataFieldHumanHeadAzimuth => 1214,
13772 Sensors::DataFieldHumanHeadAltitude => 1215,
13773 Sensors::DataFieldHumanHeadRoll => 1216,
13774 Sensors::DataFieldHumanHeadPitch => 1217,
13775 Sensors::DataFieldHumanHeadYaw => 1218,
13776 Sensors::DataFieldHumanCorrelationId => 1219,
13777 Sensors::DataFieldLight => 1232,
13778 Sensors::DataFieldIlluminance => 1233,
13779 Sensors::DataFieldColorTemperature => 1234,
13780 Sensors::DataFieldChromaticity => 1235,
13781 Sensors::DataFieldChromaticityX => 1236,
13782 Sensors::DataFieldChromaticityY => 1237,
13783 Sensors::DataFieldConsumerIRSentenceReceive => 1238,
13784 Sensors::DataFieldInfraredLight => 1239,
13785 Sensors::DataFieldRedLight => 1240,
13786 Sensors::DataFieldGreenLight => 1241,
13787 Sensors::DataFieldBlueLight => 1242,
13788 Sensors::DataFieldUltravioletALight => 1243,
13789 Sensors::DataFieldUltravioletBLight => 1244,
13790 Sensors::DataFieldUltravioletIndex => 1245,
13791 Sensors::DataFieldNearInfraredLight => 1246,
13792 Sensors::PropertyLight => 1247,
13793 Sensors::PropertyConsumerIRSentenceSend => 1248,
13794 Sensors::PropertyAutoBrightnessPreferred => 1250,
13795 Sensors::PropertyAutoColorPreferred => 1251,
13796 Sensors::DataFieldScanner => 1264,
13797 Sensors::DataFieldRFIDTag40Bit => 1265,
13798 Sensors::DataFieldNFCSentenceReceive => 1266,
13799 Sensors::PropertyScanner => 1272,
13800 Sensors::PropertyNFCSentenceSend => 1273,
13801 Sensors::DataFieldElectrical => 1280,
13802 Sensors::DataFieldCapacitance => 1281,
13803 Sensors::DataFieldCurrent => 1282,
13804 Sensors::DataFieldElectricalPower => 1283,
13805 Sensors::DataFieldInductance => 1284,
13806 Sensors::DataFieldResistance => 1285,
13807 Sensors::DataFieldVoltage => 1286,
13808 Sensors::DataFieldFrequency => 1287,
13809 Sensors::DataFieldPeriod => 1288,
13810 Sensors::DataFieldPercentofRange => 1289,
13811 Sensors::DataFieldTime => 1312,
13812 Sensors::DataFieldYear => 1313,
13813 Sensors::DataFieldMonth => 1314,
13814 Sensors::DataFieldDay => 1315,
13815 Sensors::DataFieldDayofWeek => 1316,
13816 Sensors::DataFieldHour => 1317,
13817 Sensors::DataFieldMinute => 1318,
13818 Sensors::DataFieldSecond => 1319,
13819 Sensors::DataFieldMillisecond => 1320,
13820 Sensors::DataFieldTimestamp => 1321,
13821 Sensors::DataFieldJulianDayofYear => 1322,
13822 Sensors::DataFieldTimeSinceSystemBoot => 1323,
13823 Sensors::PropertyTime => 1328,
13824 Sensors::PropertyTimeZoneOffsetfromUTC => 1329,
13825 Sensors::PropertyTimeZoneName => 1330,
13826 Sensors::PropertyDaylightSavingsTimeObserved => 1331,
13827 Sensors::PropertyTimeTrimAdjustment => 1332,
13828 Sensors::PropertyArmAlarm => 1333,
13829 Sensors::DataFieldCustom => 1344,
13830 Sensors::DataFieldCustomUsage => 1345,
13831 Sensors::DataFieldCustomBooleanArray => 1346,
13832 Sensors::DataFieldCustomValue => 1347,
13833 Sensors::DataFieldCustomValue1 => 1348,
13834 Sensors::DataFieldCustomValue2 => 1349,
13835 Sensors::DataFieldCustomValue3 => 1350,
13836 Sensors::DataFieldCustomValue4 => 1351,
13837 Sensors::DataFieldCustomValue5 => 1352,
13838 Sensors::DataFieldCustomValue6 => 1353,
13839 Sensors::DataFieldCustomValue7 => 1354,
13840 Sensors::DataFieldCustomValue8 => 1355,
13841 Sensors::DataFieldCustomValue9 => 1356,
13842 Sensors::DataFieldCustomValue10 => 1357,
13843 Sensors::DataFieldCustomValue11 => 1358,
13844 Sensors::DataFieldCustomValue12 => 1359,
13845 Sensors::DataFieldCustomValue13 => 1360,
13846 Sensors::DataFieldCustomValue14 => 1361,
13847 Sensors::DataFieldCustomValue15 => 1362,
13848 Sensors::DataFieldCustomValue16 => 1363,
13849 Sensors::DataFieldCustomValue17 => 1364,
13850 Sensors::DataFieldCustomValue18 => 1365,
13851 Sensors::DataFieldCustomValue19 => 1366,
13852 Sensors::DataFieldCustomValue20 => 1367,
13853 Sensors::DataFieldCustomValue21 => 1368,
13854 Sensors::DataFieldCustomValue22 => 1369,
13855 Sensors::DataFieldCustomValue23 => 1370,
13856 Sensors::DataFieldCustomValue24 => 1371,
13857 Sensors::DataFieldCustomValue25 => 1372,
13858 Sensors::DataFieldCustomValue26 => 1373,
13859 Sensors::DataFieldCustomValue27 => 1374,
13860 Sensors::DataFieldCustomValue28 => 1375,
13861 Sensors::DataFieldGeneric => 1376,
13862 Sensors::DataFieldGenericGUIDorPROPERTYKEY => 1377,
13863 Sensors::DataFieldGenericCategoryGUID => 1378,
13864 Sensors::DataFieldGenericTypeGUID => 1379,
13865 Sensors::DataFieldGenericEventPROPERTYKEY => 1380,
13866 Sensors::DataFieldGenericPropertyPROPERTYKEY => 1381,
13867 Sensors::DataFieldGenericDataFieldPROPERTYKEY => 1382,
13868 Sensors::DataFieldGenericEvent => 1383,
13869 Sensors::DataFieldGenericProperty => 1384,
13870 Sensors::DataFieldGenericDataField => 1385,
13871 Sensors::DataFieldEnumeratorTableRowIndex => 1386,
13872 Sensors::DataFieldEnumeratorTableRowCount => 1387,
13873 Sensors::DataFieldGenericGUIDorPROPERTYKEYkind => 1388,
13874 Sensors::DataFieldGenericGUID => 1389,
13875 Sensors::DataFieldGenericPROPERTYKEY => 1390,
13876 Sensors::DataFieldGenericTopLevelCollectionID => 1391,
13877 Sensors::DataFieldGenericReportID => 1392,
13878 Sensors::DataFieldGenericReportItemPositionIndex => 1393,
13879 Sensors::DataFieldGenericFirmwareVARTYPE => 1394,
13880 Sensors::DataFieldGenericUnitofMeasure => 1395,
13881 Sensors::DataFieldGenericUnitExponent => 1396,
13882 Sensors::DataFieldGenericReportSize => 1397,
13883 Sensors::DataFieldGenericReportCount => 1398,
13884 Sensors::PropertyGeneric => 1408,
13885 Sensors::PropertyEnumeratorTableRowIndex => 1409,
13886 Sensors::PropertyEnumeratorTableRowCount => 1410,
13887 Sensors::DataFieldPersonalActivity => 1424,
13888 Sensors::DataFieldActivityType => 1425,
13889 Sensors::DataFieldActivityState => 1426,
13890 Sensors::DataFieldDevicePosition => 1427,
13891 Sensors::DataFieldStepCount => 1428,
13892 Sensors::DataFieldStepCountReset => 1429,
13893 Sensors::DataFieldStepDuration => 1430,
13894 Sensors::DataFieldStepType => 1431,
13895 Sensors::PropertyMinimumActivityDetectionInterval => 1440,
13896 Sensors::PropertySupportedActivityTypes => 1441,
13897 Sensors::PropertySubscribedActivityTypes => 1442,
13898 Sensors::PropertySupportedStepTypes => 1443,
13899 Sensors::PropertySubscribedStepTypes => 1444,
13900 Sensors::PropertyFloorHeight => 1445,
13901 Sensors::DataFieldCustomTypeID => 1456,
13902 Sensors::PropertyCustom => 1472,
13903 Sensors::PropertyCustomValue1 => 1473,
13904 Sensors::PropertyCustomValue2 => 1474,
13905 Sensors::PropertyCustomValue3 => 1475,
13906 Sensors::PropertyCustomValue4 => 1476,
13907 Sensors::PropertyCustomValue5 => 1477,
13908 Sensors::PropertyCustomValue6 => 1478,
13909 Sensors::PropertyCustomValue7 => 1479,
13910 Sensors::PropertyCustomValue8 => 1480,
13911 Sensors::PropertyCustomValue9 => 1481,
13912 Sensors::PropertyCustomValue10 => 1482,
13913 Sensors::PropertyCustomValue11 => 1483,
13914 Sensors::PropertyCustomValue12 => 1484,
13915 Sensors::PropertyCustomValue13 => 1485,
13916 Sensors::PropertyCustomValue14 => 1486,
13917 Sensors::PropertyCustomValue15 => 1487,
13918 Sensors::PropertyCustomValue16 => 1488,
13919 Sensors::DataFieldHinge => 1504,
13920 Sensors::DataFieldHingeAngle => 1505,
13921 Sensors::DataFieldGestureSensor => 1520,
13922 Sensors::DataFieldGestureState => 1521,
13923 Sensors::DataFieldHingeFoldInitialAngle => 1522,
13924 Sensors::DataFieldHingeFoldFinalAngle => 1523,
13925 Sensors::DataFieldHingeFoldContributingPanel => 1524,
13926 Sensors::DataFieldHingeFoldType => 1525,
13927 Sensors::SensorStateUndefined => 2048,
13928 Sensors::SensorStateReady => 2049,
13929 Sensors::SensorStateNotAvailable => 2050,
13930 Sensors::SensorStateNoData => 2051,
13931 Sensors::SensorStateInitializing => 2052,
13932 Sensors::SensorStateAccessDenied => 2053,
13933 Sensors::SensorStateError => 2054,
13934 Sensors::SensorEventUnknown => 2064,
13935 Sensors::SensorEventStateChanged => 2065,
13936 Sensors::SensorEventPropertyChanged => 2066,
13937 Sensors::SensorEventDataUpdated => 2067,
13938 Sensors::SensorEventPollResponse => 2068,
13939 Sensors::SensorEventChangeSensitivity => 2069,
13940 Sensors::SensorEventRangeMaximumReached => 2070,
13941 Sensors::SensorEventRangeMinimumReached => 2071,
13942 Sensors::SensorEventHighThresholdCrossUpward => 2072,
13943 Sensors::SensorEventHighThresholdCrossDownward => 2073,
13944 Sensors::SensorEventLowThresholdCrossUpward => 2074,
13945 Sensors::SensorEventLowThresholdCrossDownward => 2075,
13946 Sensors::SensorEventZeroThresholdCrossUpward => 2076,
13947 Sensors::SensorEventZeroThresholdCrossDownward => 2077,
13948 Sensors::SensorEventPeriodExceeded => 2078,
13949 Sensors::SensorEventFrequencyExceeded => 2079,
13950 Sensors::SensorEventComplexTrigger => 2080,
13951 Sensors::ConnectionTypePCIntegrated => 2096,
13952 Sensors::ConnectionTypePCAttached => 2097,
13953 Sensors::ConnectionTypePCExternal => 2098,
13954 Sensors::ReportingStateReportNoEvents => 2112,
13955 Sensors::ReportingStateReportAllEvents => 2113,
13956 Sensors::ReportingStateReportThresholdEvents => 2114,
13957 Sensors::ReportingStateWakeOnNoEvents => 2115,
13958 Sensors::ReportingStateWakeOnAllEvents => 2116,
13959 Sensors::ReportingStateWakeOnThresholdEvents => 2117,
13960 Sensors::ReportingStateAnytime => 2118,
13961 Sensors::PowerStateUndefined => 2128,
13962 Sensors::PowerStateD0FullPower => 2129,
13963 Sensors::PowerStateD1LowPower => 2130,
13964 Sensors::PowerStateD2StandbyPowerwithWakeup => 2131,
13965 Sensors::PowerStateD3SleepwithWakeup => 2132,
13966 Sensors::PowerStateD4PowerOff => 2133,
13967 Sensors::AccuracyDefault => 2144,
13968 Sensors::AccuracyHigh => 2145,
13969 Sensors::AccuracyMedium => 2146,
13970 Sensors::AccuracyLow => 2147,
13971 Sensors::FixQualityNoFix => 2160,
13972 Sensors::FixQualityGPS => 2161,
13973 Sensors::FixQualityDGPS => 2162,
13974 Sensors::FixTypeNoFix => 2176,
13975 Sensors::FixTypeGPSSPSModeFixValid => 2177,
13976 Sensors::FixTypeDGPSSPSModeFixValid => 2178,
13977 Sensors::FixTypeGPSPPSModeFixValid => 2179,
13978 Sensors::FixTypeRealTimeKinematic => 2180,
13979 Sensors::FixTypeFloatRTK => 2181,
13980 Sensors::FixTypeEstimateddeadreckoned => 2182,
13981 Sensors::FixTypeManualInputMode => 2183,
13982 Sensors::FixTypeSimulatorMode => 2184,
13983 Sensors::GPSOperationModeManual => 2192,
13984 Sensors::GPSOperationModeAutomatic => 2193,
13985 Sensors::GPSSelectionModeAutonomous => 2208,
13986 Sensors::GPSSelectionModeDGPS => 2209,
13987 Sensors::GPSSelectionModeEstimateddeadreckoned => 2210,
13988 Sensors::GPSSelectionModeManualInput => 2211,
13989 Sensors::GPSSelectionModeSimulator => 2212,
13990 Sensors::GPSSelectionModeDataNotValid => 2213,
13991 Sensors::GPSStatusDataValid => 2224,
13992 Sensors::GPSStatusDataNotValid => 2225,
13993 Sensors::DayofWeekSunday => 2240,
13994 Sensors::DayofWeekMonday => 2241,
13995 Sensors::DayofWeekTuesday => 2242,
13996 Sensors::DayofWeekWednesday => 2243,
13997 Sensors::DayofWeekThursday => 2244,
13998 Sensors::DayofWeekFriday => 2245,
13999 Sensors::DayofWeekSaturday => 2246,
14000 Sensors::KindCategory => 2256,
14001 Sensors::KindType => 2257,
14002 Sensors::KindEvent => 2258,
14003 Sensors::KindProperty => 2259,
14004 Sensors::KindDataField => 2260,
14005 Sensors::MagnetometerAccuracyLow => 2272,
14006 Sensors::MagnetometerAccuracyMedium => 2273,
14007 Sensors::MagnetometerAccuracyHigh => 2274,
14008 Sensors::SimpleOrientationDirectionNotRotated => 2288,
14009 Sensors::SimpleOrientationDirectionRotated90DegreesCCW => 2289,
14010 Sensors::SimpleOrientationDirectionRotated180DegreesCCW => 2290,
14011 Sensors::SimpleOrientationDirectionRotated270DegreesCCW => 2291,
14012 Sensors::SimpleOrientationDirectionFaceUp => 2292,
14013 Sensors::SimpleOrientationDirectionFaceDown => 2293,
14014 Sensors::VT_NULL => 2304,
14015 Sensors::VT_BOOL => 2305,
14016 Sensors::VT_UI1 => 2306,
14017 Sensors::VT_I1 => 2307,
14018 Sensors::VT_UI2 => 2308,
14019 Sensors::VT_I2 => 2309,
14020 Sensors::VT_UI4 => 2310,
14021 Sensors::VT_I4 => 2311,
14022 Sensors::VT_UI8 => 2312,
14023 Sensors::VT_I8 => 2313,
14024 Sensors::VT_R4 => 2314,
14025 Sensors::VT_R8 => 2315,
14026 Sensors::VT_WSTR => 2316,
14027 Sensors::VT_STR => 2317,
14028 Sensors::VT_CLSID => 2318,
14029 Sensors::VT_VECTORVT_UI1 => 2319,
14030 Sensors::VT_F16E0 => 2320,
14031 Sensors::VT_F16E1 => 2321,
14032 Sensors::VT_F16E2 => 2322,
14033 Sensors::VT_F16E3 => 2323,
14034 Sensors::VT_F16E4 => 2324,
14035 Sensors::VT_F16E5 => 2325,
14036 Sensors::VT_F16E6 => 2326,
14037 Sensors::VT_F16E7 => 2327,
14038 Sensors::VT_F16E8 => 2328,
14039 Sensors::VT_F16E9 => 2329,
14040 Sensors::VT_F16EA => 2330,
14041 Sensors::VT_F16EB => 2331,
14042 Sensors::VT_F16EC => 2332,
14043 Sensors::VT_F16ED => 2333,
14044 Sensors::VT_F16EE => 2334,
14045 Sensors::VT_F16EF => 2335,
14046 Sensors::VT_F32E0 => 2336,
14047 Sensors::VT_F32E1 => 2337,
14048 Sensors::VT_F32E2 => 2338,
14049 Sensors::VT_F32E3 => 2339,
14050 Sensors::VT_F32E4 => 2340,
14051 Sensors::VT_F32E5 => 2341,
14052 Sensors::VT_F32E6 => 2342,
14053 Sensors::VT_F32E7 => 2343,
14054 Sensors::VT_F32E8 => 2344,
14055 Sensors::VT_F32E9 => 2345,
14056 Sensors::VT_F32EA => 2346,
14057 Sensors::VT_F32EB => 2347,
14058 Sensors::VT_F32EC => 2348,
14059 Sensors::VT_F32ED => 2349,
14060 Sensors::VT_F32EE => 2350,
14061 Sensors::VT_F32EF => 2351,
14062 Sensors::ActivityTypeUnknown => 2352,
14063 Sensors::ActivityTypeStationary => 2353,
14064 Sensors::ActivityTypeFidgeting => 2354,
14065 Sensors::ActivityTypeWalking => 2355,
14066 Sensors::ActivityTypeRunning => 2356,
14067 Sensors::ActivityTypeInVehicle => 2357,
14068 Sensors::ActivityTypeBiking => 2358,
14069 Sensors::ActivityTypeIdle => 2359,
14070 Sensors::UnitNotSpecified => 2368,
14071 Sensors::UnitLux => 2369,
14072 Sensors::UnitDegreesKelvin => 2370,
14073 Sensors::UnitDegreesCelsius => 2371,
14074 Sensors::UnitPascal => 2372,
14075 Sensors::UnitNewton => 2373,
14076 Sensors::UnitMetersSecond => 2374,
14077 Sensors::UnitKilogram => 2375,
14078 Sensors::UnitMeter => 2376,
14079 Sensors::UnitMetersSecondSecond => 2377,
14080 Sensors::UnitFarad => 2378,
14081 Sensors::UnitAmpere => 2379,
14082 Sensors::UnitWatt => 2380,
14083 Sensors::UnitHenry => 2381,
14084 Sensors::UnitOhm => 2382,
14085 Sensors::UnitVolt => 2383,
14086 Sensors::UnitHertz => 2384,
14087 Sensors::UnitBar => 2385,
14088 Sensors::UnitDegreesAnticlockwise => 2386,
14089 Sensors::UnitDegreesClockwise => 2387,
14090 Sensors::UnitDegrees => 2388,
14091 Sensors::UnitDegreesSecond => 2389,
14092 Sensors::UnitDegreesSecondSecond => 2390,
14093 Sensors::UnitKnot => 2391,
14094 Sensors::UnitPercent => 2392,
14095 Sensors::UnitSecond => 2393,
14096 Sensors::UnitMillisecond => 2394,
14097 Sensors::UnitG => 2395,
14098 Sensors::UnitBytes => 2396,
14099 Sensors::UnitMilligauss => 2397,
14100 Sensors::UnitBits => 2398,
14101 Sensors::ActivityStateNoStateChange => 2400,
14102 Sensors::ActivityStateStartActivity => 2401,
14103 Sensors::ActivityStateEndActivity => 2402,
14104 Sensors::Exponent0 => 2416,
14105 Sensors::Exponent1 => 2417,
14106 Sensors::Exponent2 => 2418,
14107 Sensors::Exponent3 => 2419,
14108 Sensors::Exponent4 => 2420,
14109 Sensors::Exponent5 => 2421,
14110 Sensors::Exponent6 => 2422,
14111 Sensors::Exponent7 => 2423,
14112 Sensors::Exponent8 => 2424,
14113 Sensors::Exponent9 => 2425,
14114 Sensors::ExponentA => 2426,
14115 Sensors::ExponentB => 2427,
14116 Sensors::ExponentC => 2428,
14117 Sensors::ExponentD => 2429,
14118 Sensors::ExponentE => 2430,
14119 Sensors::ExponentF => 2431,
14120 Sensors::DevicePositionUnknown => 2432,
14121 Sensors::DevicePositionUnchanged => 2433,
14122 Sensors::DevicePositionOnDesk => 2434,
14123 Sensors::DevicePositionInHand => 2435,
14124 Sensors::DevicePositionMovinginBag => 2436,
14125 Sensors::DevicePositionStationaryinBag => 2437,
14126 Sensors::StepTypeUnknown => 2448,
14127 Sensors::StepTypeWalking => 2449,
14128 Sensors::StepTypeRunning => 2450,
14129 Sensors::GestureStateUnknown => 2464,
14130 Sensors::GestureStateStarted => 2465,
14131 Sensors::GestureStateCompleted => 2466,
14132 Sensors::GestureStateCancelled => 2467,
14133 Sensors::HingeFoldContributingPanelUnknown => 2480,
14134 Sensors::HingeFoldContributingPanelPanel1 => 2481,
14135 Sensors::HingeFoldContributingPanelPanel2 => 2482,
14136 Sensors::HingeFoldContributingPanelBoth => 2483,
14137 Sensors::HingeFoldTypeUnknown => 2484,
14138 Sensors::HingeFoldTypeIncreasing => 2485,
14139 Sensors::HingeFoldTypeDecreasing => 2486,
14140 Sensors::HumanPresenceDetectionTypeVendorDefinedNonBiometric => 2496,
14141 Sensors::HumanPresenceDetectionTypeVendorDefinedBiometric => 2497,
14142 Sensors::HumanPresenceDetectionTypeFacialBiometric => 2498,
14143 Sensors::HumanPresenceDetectionTypeAudioBiometric => 2499,
14144 Sensors::ModifierChangeSensitivityAbsolute => 4096,
14145 Sensors::ModifierMaximum => 8192,
14146 Sensors::ModifierMinimum => 12288,
14147 Sensors::ModifierAccuracy => 16384,
14148 Sensors::ModifierResolution => 20480,
14149 Sensors::ModifierThresholdHigh => 24576,
14150 Sensors::ModifierThresholdLow => 28672,
14151 Sensors::ModifierCalibrationOffset => 32768,
14152 Sensors::ModifierCalibrationMultiplier => 36864,
14153 Sensors::ModifierReportInterval => 40960,
14154 Sensors::ModifierFrequencyMax => 45056,
14155 Sensors::ModifierPeriodMax => 49152,
14156 Sensors::ModifierChangeSensitivityPercentofRange => 53248,
14157 Sensors::ModifierChangeSensitivityPercentRelative => 57344,
14158 Sensors::ModifierVendorReserved => 61440,
14159 }
14160 }
14161}
14162
14163impl From<Sensors> for u16 {
14164 fn from(sensors: Sensors) -> u16 {
14167 u16::from(&sensors)
14168 }
14169}
14170
14171impl From<&Sensors> for u32 {
14172 fn from(sensors: &Sensors) -> u32 {
14175 let up = UsagePage::from(sensors);
14176 let up = (u16::from(&up) as u32) << 16;
14177 let id = u16::from(sensors) as u32;
14178 up | id
14179 }
14180}
14181
14182impl From<&Sensors> for UsagePage {
14183 fn from(_: &Sensors) -> UsagePage {
14186 UsagePage::Sensors
14187 }
14188}
14189
14190impl From<Sensors> for UsagePage {
14191 fn from(_: Sensors) -> UsagePage {
14194 UsagePage::Sensors
14195 }
14196}
14197
14198impl From<&Sensors> for Usage {
14199 fn from(sensors: &Sensors) -> Usage {
14200 Usage::try_from(u32::from(sensors)).unwrap()
14201 }
14202}
14203
14204impl From<Sensors> for Usage {
14205 fn from(sensors: Sensors) -> Usage {
14206 Usage::from(&sensors)
14207 }
14208}
14209
14210impl TryFrom<u16> for Sensors {
14211 type Error = HutError;
14212
14213 fn try_from(usage_id: u16) -> Result<Sensors> {
14214 match usage_id {
14215 1 => Ok(Sensors::Sensor),
14216 16 => Ok(Sensors::Biometric),
14217 17 => Ok(Sensors::BiometricHumanPresence),
14218 18 => Ok(Sensors::BiometricHumanProximity),
14219 19 => Ok(Sensors::BiometricHumanTouch),
14220 20 => Ok(Sensors::BiometricBloodPressure),
14221 21 => Ok(Sensors::BiometricBodyTemperature),
14222 22 => Ok(Sensors::BiometricHeartRate),
14223 23 => Ok(Sensors::BiometricHeartRateVariability),
14224 24 => Ok(Sensors::BiometricPeripheralOxygenSaturation),
14225 25 => Ok(Sensors::BiometricRespiratoryRate),
14226 32 => Ok(Sensors::Electrical),
14227 33 => Ok(Sensors::ElectricalCapacitance),
14228 34 => Ok(Sensors::ElectricalCurrent),
14229 35 => Ok(Sensors::ElectricalPower),
14230 36 => Ok(Sensors::ElectricalInductance),
14231 37 => Ok(Sensors::ElectricalResistance),
14232 38 => Ok(Sensors::ElectricalVoltage),
14233 39 => Ok(Sensors::ElectricalPotentiometer),
14234 40 => Ok(Sensors::ElectricalFrequency),
14235 41 => Ok(Sensors::ElectricalPeriod),
14236 48 => Ok(Sensors::Environmental),
14237 49 => Ok(Sensors::EnvironmentalAtmosphericPressure),
14238 50 => Ok(Sensors::EnvironmentalHumidity),
14239 51 => Ok(Sensors::EnvironmentalTemperature),
14240 52 => Ok(Sensors::EnvironmentalWindDirection),
14241 53 => Ok(Sensors::EnvironmentalWindSpeed),
14242 54 => Ok(Sensors::EnvironmentalAirQuality),
14243 55 => Ok(Sensors::EnvironmentalHeatIndex),
14244 56 => Ok(Sensors::EnvironmentalSurfaceTemperature),
14245 57 => Ok(Sensors::EnvironmentalVolatileOrganicCompounds),
14246 58 => Ok(Sensors::EnvironmentalObjectPresence),
14247 59 => Ok(Sensors::EnvironmentalObjectProximity),
14248 64 => Ok(Sensors::Light),
14249 65 => Ok(Sensors::LightAmbientLight),
14250 66 => Ok(Sensors::LightConsumerInfrared),
14251 67 => Ok(Sensors::LightInfraredLight),
14252 68 => Ok(Sensors::LightVisibleLight),
14253 69 => Ok(Sensors::LightUltravioletLight),
14254 80 => Ok(Sensors::Location),
14255 81 => Ok(Sensors::LocationBroadcast),
14256 82 => Ok(Sensors::LocationDeadReckoning),
14257 83 => Ok(Sensors::LocationGPSGlobalPositioningSystem),
14258 84 => Ok(Sensors::LocationLookup),
14259 85 => Ok(Sensors::LocationOther),
14260 86 => Ok(Sensors::LocationStatic),
14261 87 => Ok(Sensors::LocationTriangulation),
14262 96 => Ok(Sensors::Mechanical),
14263 97 => Ok(Sensors::MechanicalBooleanSwitch),
14264 98 => Ok(Sensors::MechanicalBooleanSwitchArray),
14265 99 => Ok(Sensors::MechanicalMultivalueSwitch),
14266 100 => Ok(Sensors::MechanicalForce),
14267 101 => Ok(Sensors::MechanicalPressure),
14268 102 => Ok(Sensors::MechanicalStrain),
14269 103 => Ok(Sensors::MechanicalWeight),
14270 104 => Ok(Sensors::MechanicalHapticVibrator),
14271 105 => Ok(Sensors::MechanicalHallEffectSwitch),
14272 112 => Ok(Sensors::Motion),
14273 113 => Ok(Sensors::MotionAccelerometer1D),
14274 114 => Ok(Sensors::MotionAccelerometer2D),
14275 115 => Ok(Sensors::MotionAccelerometer3D),
14276 116 => Ok(Sensors::MotionGyrometer1D),
14277 117 => Ok(Sensors::MotionGyrometer2D),
14278 118 => Ok(Sensors::MotionGyrometer3D),
14279 119 => Ok(Sensors::MotionMotionDetector),
14280 120 => Ok(Sensors::MotionSpeedometer),
14281 121 => Ok(Sensors::MotionAccelerometer),
14282 122 => Ok(Sensors::MotionGyrometer),
14283 123 => Ok(Sensors::MotionGravityVector),
14284 124 => Ok(Sensors::MotionLinearAccelerometer),
14285 128 => Ok(Sensors::Orientation),
14286 129 => Ok(Sensors::OrientationCompass1D),
14287 130 => Ok(Sensors::OrientationCompass2D),
14288 131 => Ok(Sensors::OrientationCompass3D),
14289 132 => Ok(Sensors::OrientationInclinometer1D),
14290 133 => Ok(Sensors::OrientationInclinometer2D),
14291 134 => Ok(Sensors::OrientationInclinometer3D),
14292 135 => Ok(Sensors::OrientationDistance1D),
14293 136 => Ok(Sensors::OrientationDistance2D),
14294 137 => Ok(Sensors::OrientationDistance3D),
14295 138 => Ok(Sensors::OrientationDeviceOrientation),
14296 139 => Ok(Sensors::OrientationCompass),
14297 140 => Ok(Sensors::OrientationInclinometer),
14298 141 => Ok(Sensors::OrientationDistance),
14299 142 => Ok(Sensors::OrientationRelativeOrientation),
14300 143 => Ok(Sensors::OrientationSimpleOrientation),
14301 144 => Ok(Sensors::Scanner),
14302 145 => Ok(Sensors::ScannerBarcode),
14303 146 => Ok(Sensors::ScannerRFID),
14304 147 => Ok(Sensors::ScannerNFC),
14305 160 => Ok(Sensors::Time),
14306 161 => Ok(Sensors::TimeAlarmTimer),
14307 162 => Ok(Sensors::TimeRealTimeClock),
14308 176 => Ok(Sensors::PersonalActivity),
14309 177 => Ok(Sensors::PersonalActivityActivityDetection),
14310 178 => Ok(Sensors::PersonalActivityDevicePosition),
14311 179 => Ok(Sensors::PersonalActivityFloorTracker),
14312 180 => Ok(Sensors::PersonalActivityPedometer),
14313 181 => Ok(Sensors::PersonalActivityStepDetection),
14314 192 => Ok(Sensors::OrientationExtended),
14315 193 => Ok(Sensors::OrientationExtendedGeomagneticOrientation),
14316 194 => Ok(Sensors::OrientationExtendedMagnetometer),
14317 208 => Ok(Sensors::Gesture),
14318 209 => Ok(Sensors::GestureChassisFlipGesture),
14319 210 => Ok(Sensors::GestureHingeFoldGesture),
14320 224 => Ok(Sensors::Other),
14321 225 => Ok(Sensors::OtherCustom),
14322 226 => Ok(Sensors::OtherGeneric),
14323 227 => Ok(Sensors::OtherGenericEnumerator),
14324 228 => Ok(Sensors::OtherHingeAngle),
14325 240 => Ok(Sensors::VendorReserved1),
14326 241 => Ok(Sensors::VendorReserved2),
14327 242 => Ok(Sensors::VendorReserved3),
14328 243 => Ok(Sensors::VendorReserved4),
14329 244 => Ok(Sensors::VendorReserved5),
14330 245 => Ok(Sensors::VendorReserved6),
14331 246 => Ok(Sensors::VendorReserved7),
14332 247 => Ok(Sensors::VendorReserved8),
14333 248 => Ok(Sensors::VendorReserved9),
14334 249 => Ok(Sensors::VendorReserved10),
14335 250 => Ok(Sensors::VendorReserved11),
14336 251 => Ok(Sensors::VendorReserved12),
14337 252 => Ok(Sensors::VendorReserved13),
14338 253 => Ok(Sensors::VendorReserved14),
14339 254 => Ok(Sensors::VendorReserved15),
14340 255 => Ok(Sensors::VendorReserved16),
14341 512 => Ok(Sensors::Event),
14342 513 => Ok(Sensors::EventSensorState),
14343 514 => Ok(Sensors::EventSensorEvent),
14344 768 => Ok(Sensors::Property),
14345 769 => Ok(Sensors::PropertyFriendlyName),
14346 770 => Ok(Sensors::PropertyPersistentUniqueID),
14347 771 => Ok(Sensors::PropertySensorStatus),
14348 772 => Ok(Sensors::PropertyMinimumReportInterval),
14349 773 => Ok(Sensors::PropertySensorManufacturer),
14350 774 => Ok(Sensors::PropertySensorModel),
14351 775 => Ok(Sensors::PropertySensorSerialNumber),
14352 776 => Ok(Sensors::PropertySensorDescription),
14353 777 => Ok(Sensors::PropertySensorConnectionType),
14354 778 => Ok(Sensors::PropertySensorDevicePath),
14355 779 => Ok(Sensors::PropertyHardwareRevision),
14356 780 => Ok(Sensors::PropertyFirmwareVersion),
14357 781 => Ok(Sensors::PropertyReleaseDate),
14358 782 => Ok(Sensors::PropertyReportInterval),
14359 783 => Ok(Sensors::PropertyChangeSensitivityAbsolute),
14360 784 => Ok(Sensors::PropertyChangeSensitivityPercentofRange),
14361 785 => Ok(Sensors::PropertyChangeSensitivityPercentRelative),
14362 786 => Ok(Sensors::PropertyAccuracy),
14363 787 => Ok(Sensors::PropertyResolution),
14364 788 => Ok(Sensors::PropertyMaximum),
14365 789 => Ok(Sensors::PropertyMinimum),
14366 790 => Ok(Sensors::PropertyReportingState),
14367 791 => Ok(Sensors::PropertySamplingRate),
14368 792 => Ok(Sensors::PropertyResponseCurve),
14369 793 => Ok(Sensors::PropertyPowerState),
14370 794 => Ok(Sensors::PropertyMaximumFIFOEvents),
14371 795 => Ok(Sensors::PropertyReportLatency),
14372 796 => Ok(Sensors::PropertyFlushFIFOEvents),
14373 797 => Ok(Sensors::PropertyMaximumPowerConsumption),
14374 798 => Ok(Sensors::PropertyIsPrimary),
14375 799 => Ok(Sensors::PropertyHumanPresenceDetectionType),
14376 1024 => Ok(Sensors::DataFieldLocation),
14377 1026 => Ok(Sensors::DataFieldAltitudeAntennaSeaLevel),
14378 1027 => Ok(Sensors::DataFieldDifferentialReferenceStationID),
14379 1028 => Ok(Sensors::DataFieldAltitudeEllipsoidError),
14380 1029 => Ok(Sensors::DataFieldAltitudeEllipsoid),
14381 1030 => Ok(Sensors::DataFieldAltitudeSeaLevelError),
14382 1031 => Ok(Sensors::DataFieldAltitudeSeaLevel),
14383 1032 => Ok(Sensors::DataFieldDifferentialGPSDataAge),
14384 1033 => Ok(Sensors::DataFieldErrorRadius),
14385 1034 => Ok(Sensors::DataFieldFixQuality),
14386 1035 => Ok(Sensors::DataFieldFixType),
14387 1036 => Ok(Sensors::DataFieldGeoidalSeparation),
14388 1037 => Ok(Sensors::DataFieldGPSOperationMode),
14389 1038 => Ok(Sensors::DataFieldGPSSelectionMode),
14390 1039 => Ok(Sensors::DataFieldGPSStatus),
14391 1040 => Ok(Sensors::DataFieldPositionDilutionofPrecision),
14392 1041 => Ok(Sensors::DataFieldHorizontalDilutionofPrecision),
14393 1042 => Ok(Sensors::DataFieldVerticalDilutionofPrecision),
14394 1043 => Ok(Sensors::DataFieldLatitude),
14395 1044 => Ok(Sensors::DataFieldLongitude),
14396 1045 => Ok(Sensors::DataFieldTrueHeading),
14397 1046 => Ok(Sensors::DataFieldMagneticHeading),
14398 1047 => Ok(Sensors::DataFieldMagneticVariation),
14399 1048 => Ok(Sensors::DataFieldSpeed),
14400 1049 => Ok(Sensors::DataFieldSatellitesinView),
14401 1050 => Ok(Sensors::DataFieldSatellitesinViewAzimuth),
14402 1051 => Ok(Sensors::DataFieldSatellitesinViewElevation),
14403 1052 => Ok(Sensors::DataFieldSatellitesinViewIDs),
14404 1053 => Ok(Sensors::DataFieldSatellitesinViewPRNs),
14405 1054 => Ok(Sensors::DataFieldSatellitesinViewSNRatios),
14406 1055 => Ok(Sensors::DataFieldSatellitesUsedCount),
14407 1056 => Ok(Sensors::DataFieldSatellitesUsedPRNs),
14408 1057 => Ok(Sensors::DataFieldNMEASentence),
14409 1058 => Ok(Sensors::DataFieldAddressLine1),
14410 1059 => Ok(Sensors::DataFieldAddressLine2),
14411 1060 => Ok(Sensors::DataFieldCity),
14412 1061 => Ok(Sensors::DataFieldStateorProvince),
14413 1062 => Ok(Sensors::DataFieldCountryorRegion),
14414 1063 => Ok(Sensors::DataFieldPostalCode),
14415 1066 => Ok(Sensors::PropertyLocation),
14416 1067 => Ok(Sensors::PropertyLocationDesiredAccuracy),
14417 1072 => Ok(Sensors::DataFieldEnvironmental),
14418 1073 => Ok(Sensors::DataFieldAtmosphericPressure),
14419 1075 => Ok(Sensors::DataFieldRelativeHumidity),
14420 1076 => Ok(Sensors::DataFieldTemperature),
14421 1077 => Ok(Sensors::DataFieldWindDirection),
14422 1078 => Ok(Sensors::DataFieldWindSpeed),
14423 1079 => Ok(Sensors::DataFieldAirQualityIndex),
14424 1080 => Ok(Sensors::DataFieldEquivalentCO2),
14425 1081 => Ok(Sensors::DataFieldVolatileOrganicCompoundConcentration),
14426 1082 => Ok(Sensors::DataFieldObjectPresence),
14427 1083 => Ok(Sensors::DataFieldObjectProximityRange),
14428 1084 => Ok(Sensors::DataFieldObjectProximityOutofRange),
14429 1088 => Ok(Sensors::PropertyEnvironmental),
14430 1089 => Ok(Sensors::PropertyReferencePressure),
14431 1104 => Ok(Sensors::DataFieldMotion),
14432 1105 => Ok(Sensors::DataFieldMotionState),
14433 1106 => Ok(Sensors::DataFieldAcceleration),
14434 1107 => Ok(Sensors::DataFieldAccelerationAxisX),
14435 1108 => Ok(Sensors::DataFieldAccelerationAxisY),
14436 1109 => Ok(Sensors::DataFieldAccelerationAxisZ),
14437 1110 => Ok(Sensors::DataFieldAngularVelocity),
14438 1111 => Ok(Sensors::DataFieldAngularVelocityaboutXAxis),
14439 1112 => Ok(Sensors::DataFieldAngularVelocityaboutYAxis),
14440 1113 => Ok(Sensors::DataFieldAngularVelocityaboutZAxis),
14441 1114 => Ok(Sensors::DataFieldAngularPosition),
14442 1115 => Ok(Sensors::DataFieldAngularPositionaboutXAxis),
14443 1116 => Ok(Sensors::DataFieldAngularPositionaboutYAxis),
14444 1117 => Ok(Sensors::DataFieldAngularPositionaboutZAxis),
14445 1118 => Ok(Sensors::DataFieldMotionSpeed),
14446 1119 => Ok(Sensors::DataFieldMotionIntensity),
14447 1136 => Ok(Sensors::DataFieldOrientation),
14448 1137 => Ok(Sensors::DataFieldHeading),
14449 1138 => Ok(Sensors::DataFieldHeadingXAxis),
14450 1139 => Ok(Sensors::DataFieldHeadingYAxis),
14451 1140 => Ok(Sensors::DataFieldHeadingZAxis),
14452 1141 => Ok(Sensors::DataFieldHeadingCompensatedMagneticNorth),
14453 1142 => Ok(Sensors::DataFieldHeadingCompensatedTrueNorth),
14454 1143 => Ok(Sensors::DataFieldHeadingMagneticNorth),
14455 1144 => Ok(Sensors::DataFieldHeadingTrueNorth),
14456 1145 => Ok(Sensors::DataFieldDistance),
14457 1146 => Ok(Sensors::DataFieldDistanceXAxis),
14458 1147 => Ok(Sensors::DataFieldDistanceYAxis),
14459 1148 => Ok(Sensors::DataFieldDistanceZAxis),
14460 1149 => Ok(Sensors::DataFieldDistanceOutofRange),
14461 1150 => Ok(Sensors::DataFieldTilt),
14462 1151 => Ok(Sensors::DataFieldTiltXAxis),
14463 1152 => Ok(Sensors::DataFieldTiltYAxis),
14464 1153 => Ok(Sensors::DataFieldTiltZAxis),
14465 1154 => Ok(Sensors::DataFieldRotationMatrix),
14466 1155 => Ok(Sensors::DataFieldQuaternion),
14467 1156 => Ok(Sensors::DataFieldMagneticFlux),
14468 1157 => Ok(Sensors::DataFieldMagneticFluxXAxis),
14469 1158 => Ok(Sensors::DataFieldMagneticFluxYAxis),
14470 1159 => Ok(Sensors::DataFieldMagneticFluxZAxis),
14471 1160 => Ok(Sensors::DataFieldMagnetometerAccuracy),
14472 1161 => Ok(Sensors::DataFieldSimpleOrientationDirection),
14473 1168 => Ok(Sensors::DataFieldMechanical),
14474 1169 => Ok(Sensors::DataFieldBooleanSwitchState),
14475 1170 => Ok(Sensors::DataFieldBooleanSwitchArrayStates),
14476 1171 => Ok(Sensors::DataFieldMultivalueSwitchValue),
14477 1172 => Ok(Sensors::DataFieldForce),
14478 1173 => Ok(Sensors::DataFieldAbsolutePressure),
14479 1174 => Ok(Sensors::DataFieldGaugePressure),
14480 1175 => Ok(Sensors::DataFieldStrain),
14481 1176 => Ok(Sensors::DataFieldWeight),
14482 1184 => Ok(Sensors::PropertyMechanical),
14483 1185 => Ok(Sensors::PropertyVibrationState),
14484 1186 => Ok(Sensors::PropertyForwardVibrationSpeed),
14485 1187 => Ok(Sensors::PropertyBackwardVibrationSpeed),
14486 1200 => Ok(Sensors::DataFieldBiometric),
14487 1201 => Ok(Sensors::DataFieldHumanPresence),
14488 1202 => Ok(Sensors::DataFieldHumanProximityRange),
14489 1203 => Ok(Sensors::DataFieldHumanProximityOutofRange),
14490 1204 => Ok(Sensors::DataFieldHumanTouchState),
14491 1205 => Ok(Sensors::DataFieldBloodPressure),
14492 1206 => Ok(Sensors::DataFieldBloodPressureDiastolic),
14493 1207 => Ok(Sensors::DataFieldBloodPressureSystolic),
14494 1208 => Ok(Sensors::DataFieldHeartRate),
14495 1209 => Ok(Sensors::DataFieldRestingHeartRate),
14496 1210 => Ok(Sensors::DataFieldHeartbeatInterval),
14497 1211 => Ok(Sensors::DataFieldRespiratoryRate),
14498 1212 => Ok(Sensors::DataFieldSpO2),
14499 1213 => Ok(Sensors::DataFieldHumanAttentionDetected),
14500 1214 => Ok(Sensors::DataFieldHumanHeadAzimuth),
14501 1215 => Ok(Sensors::DataFieldHumanHeadAltitude),
14502 1216 => Ok(Sensors::DataFieldHumanHeadRoll),
14503 1217 => Ok(Sensors::DataFieldHumanHeadPitch),
14504 1218 => Ok(Sensors::DataFieldHumanHeadYaw),
14505 1219 => Ok(Sensors::DataFieldHumanCorrelationId),
14506 1232 => Ok(Sensors::DataFieldLight),
14507 1233 => Ok(Sensors::DataFieldIlluminance),
14508 1234 => Ok(Sensors::DataFieldColorTemperature),
14509 1235 => Ok(Sensors::DataFieldChromaticity),
14510 1236 => Ok(Sensors::DataFieldChromaticityX),
14511 1237 => Ok(Sensors::DataFieldChromaticityY),
14512 1238 => Ok(Sensors::DataFieldConsumerIRSentenceReceive),
14513 1239 => Ok(Sensors::DataFieldInfraredLight),
14514 1240 => Ok(Sensors::DataFieldRedLight),
14515 1241 => Ok(Sensors::DataFieldGreenLight),
14516 1242 => Ok(Sensors::DataFieldBlueLight),
14517 1243 => Ok(Sensors::DataFieldUltravioletALight),
14518 1244 => Ok(Sensors::DataFieldUltravioletBLight),
14519 1245 => Ok(Sensors::DataFieldUltravioletIndex),
14520 1246 => Ok(Sensors::DataFieldNearInfraredLight),
14521 1247 => Ok(Sensors::PropertyLight),
14522 1248 => Ok(Sensors::PropertyConsumerIRSentenceSend),
14523 1250 => Ok(Sensors::PropertyAutoBrightnessPreferred),
14524 1251 => Ok(Sensors::PropertyAutoColorPreferred),
14525 1264 => Ok(Sensors::DataFieldScanner),
14526 1265 => Ok(Sensors::DataFieldRFIDTag40Bit),
14527 1266 => Ok(Sensors::DataFieldNFCSentenceReceive),
14528 1272 => Ok(Sensors::PropertyScanner),
14529 1273 => Ok(Sensors::PropertyNFCSentenceSend),
14530 1280 => Ok(Sensors::DataFieldElectrical),
14531 1281 => Ok(Sensors::DataFieldCapacitance),
14532 1282 => Ok(Sensors::DataFieldCurrent),
14533 1283 => Ok(Sensors::DataFieldElectricalPower),
14534 1284 => Ok(Sensors::DataFieldInductance),
14535 1285 => Ok(Sensors::DataFieldResistance),
14536 1286 => Ok(Sensors::DataFieldVoltage),
14537 1287 => Ok(Sensors::DataFieldFrequency),
14538 1288 => Ok(Sensors::DataFieldPeriod),
14539 1289 => Ok(Sensors::DataFieldPercentofRange),
14540 1312 => Ok(Sensors::DataFieldTime),
14541 1313 => Ok(Sensors::DataFieldYear),
14542 1314 => Ok(Sensors::DataFieldMonth),
14543 1315 => Ok(Sensors::DataFieldDay),
14544 1316 => Ok(Sensors::DataFieldDayofWeek),
14545 1317 => Ok(Sensors::DataFieldHour),
14546 1318 => Ok(Sensors::DataFieldMinute),
14547 1319 => Ok(Sensors::DataFieldSecond),
14548 1320 => Ok(Sensors::DataFieldMillisecond),
14549 1321 => Ok(Sensors::DataFieldTimestamp),
14550 1322 => Ok(Sensors::DataFieldJulianDayofYear),
14551 1323 => Ok(Sensors::DataFieldTimeSinceSystemBoot),
14552 1328 => Ok(Sensors::PropertyTime),
14553 1329 => Ok(Sensors::PropertyTimeZoneOffsetfromUTC),
14554 1330 => Ok(Sensors::PropertyTimeZoneName),
14555 1331 => Ok(Sensors::PropertyDaylightSavingsTimeObserved),
14556 1332 => Ok(Sensors::PropertyTimeTrimAdjustment),
14557 1333 => Ok(Sensors::PropertyArmAlarm),
14558 1344 => Ok(Sensors::DataFieldCustom),
14559 1345 => Ok(Sensors::DataFieldCustomUsage),
14560 1346 => Ok(Sensors::DataFieldCustomBooleanArray),
14561 1347 => Ok(Sensors::DataFieldCustomValue),
14562 1348 => Ok(Sensors::DataFieldCustomValue1),
14563 1349 => Ok(Sensors::DataFieldCustomValue2),
14564 1350 => Ok(Sensors::DataFieldCustomValue3),
14565 1351 => Ok(Sensors::DataFieldCustomValue4),
14566 1352 => Ok(Sensors::DataFieldCustomValue5),
14567 1353 => Ok(Sensors::DataFieldCustomValue6),
14568 1354 => Ok(Sensors::DataFieldCustomValue7),
14569 1355 => Ok(Sensors::DataFieldCustomValue8),
14570 1356 => Ok(Sensors::DataFieldCustomValue9),
14571 1357 => Ok(Sensors::DataFieldCustomValue10),
14572 1358 => Ok(Sensors::DataFieldCustomValue11),
14573 1359 => Ok(Sensors::DataFieldCustomValue12),
14574 1360 => Ok(Sensors::DataFieldCustomValue13),
14575 1361 => Ok(Sensors::DataFieldCustomValue14),
14576 1362 => Ok(Sensors::DataFieldCustomValue15),
14577 1363 => Ok(Sensors::DataFieldCustomValue16),
14578 1364 => Ok(Sensors::DataFieldCustomValue17),
14579 1365 => Ok(Sensors::DataFieldCustomValue18),
14580 1366 => Ok(Sensors::DataFieldCustomValue19),
14581 1367 => Ok(Sensors::DataFieldCustomValue20),
14582 1368 => Ok(Sensors::DataFieldCustomValue21),
14583 1369 => Ok(Sensors::DataFieldCustomValue22),
14584 1370 => Ok(Sensors::DataFieldCustomValue23),
14585 1371 => Ok(Sensors::DataFieldCustomValue24),
14586 1372 => Ok(Sensors::DataFieldCustomValue25),
14587 1373 => Ok(Sensors::DataFieldCustomValue26),
14588 1374 => Ok(Sensors::DataFieldCustomValue27),
14589 1375 => Ok(Sensors::DataFieldCustomValue28),
14590 1376 => Ok(Sensors::DataFieldGeneric),
14591 1377 => Ok(Sensors::DataFieldGenericGUIDorPROPERTYKEY),
14592 1378 => Ok(Sensors::DataFieldGenericCategoryGUID),
14593 1379 => Ok(Sensors::DataFieldGenericTypeGUID),
14594 1380 => Ok(Sensors::DataFieldGenericEventPROPERTYKEY),
14595 1381 => Ok(Sensors::DataFieldGenericPropertyPROPERTYKEY),
14596 1382 => Ok(Sensors::DataFieldGenericDataFieldPROPERTYKEY),
14597 1383 => Ok(Sensors::DataFieldGenericEvent),
14598 1384 => Ok(Sensors::DataFieldGenericProperty),
14599 1385 => Ok(Sensors::DataFieldGenericDataField),
14600 1386 => Ok(Sensors::DataFieldEnumeratorTableRowIndex),
14601 1387 => Ok(Sensors::DataFieldEnumeratorTableRowCount),
14602 1388 => Ok(Sensors::DataFieldGenericGUIDorPROPERTYKEYkind),
14603 1389 => Ok(Sensors::DataFieldGenericGUID),
14604 1390 => Ok(Sensors::DataFieldGenericPROPERTYKEY),
14605 1391 => Ok(Sensors::DataFieldGenericTopLevelCollectionID),
14606 1392 => Ok(Sensors::DataFieldGenericReportID),
14607 1393 => Ok(Sensors::DataFieldGenericReportItemPositionIndex),
14608 1394 => Ok(Sensors::DataFieldGenericFirmwareVARTYPE),
14609 1395 => Ok(Sensors::DataFieldGenericUnitofMeasure),
14610 1396 => Ok(Sensors::DataFieldGenericUnitExponent),
14611 1397 => Ok(Sensors::DataFieldGenericReportSize),
14612 1398 => Ok(Sensors::DataFieldGenericReportCount),
14613 1408 => Ok(Sensors::PropertyGeneric),
14614 1409 => Ok(Sensors::PropertyEnumeratorTableRowIndex),
14615 1410 => Ok(Sensors::PropertyEnumeratorTableRowCount),
14616 1424 => Ok(Sensors::DataFieldPersonalActivity),
14617 1425 => Ok(Sensors::DataFieldActivityType),
14618 1426 => Ok(Sensors::DataFieldActivityState),
14619 1427 => Ok(Sensors::DataFieldDevicePosition),
14620 1428 => Ok(Sensors::DataFieldStepCount),
14621 1429 => Ok(Sensors::DataFieldStepCountReset),
14622 1430 => Ok(Sensors::DataFieldStepDuration),
14623 1431 => Ok(Sensors::DataFieldStepType),
14624 1440 => Ok(Sensors::PropertyMinimumActivityDetectionInterval),
14625 1441 => Ok(Sensors::PropertySupportedActivityTypes),
14626 1442 => Ok(Sensors::PropertySubscribedActivityTypes),
14627 1443 => Ok(Sensors::PropertySupportedStepTypes),
14628 1444 => Ok(Sensors::PropertySubscribedStepTypes),
14629 1445 => Ok(Sensors::PropertyFloorHeight),
14630 1456 => Ok(Sensors::DataFieldCustomTypeID),
14631 1472 => Ok(Sensors::PropertyCustom),
14632 1473 => Ok(Sensors::PropertyCustomValue1),
14633 1474 => Ok(Sensors::PropertyCustomValue2),
14634 1475 => Ok(Sensors::PropertyCustomValue3),
14635 1476 => Ok(Sensors::PropertyCustomValue4),
14636 1477 => Ok(Sensors::PropertyCustomValue5),
14637 1478 => Ok(Sensors::PropertyCustomValue6),
14638 1479 => Ok(Sensors::PropertyCustomValue7),
14639 1480 => Ok(Sensors::PropertyCustomValue8),
14640 1481 => Ok(Sensors::PropertyCustomValue9),
14641 1482 => Ok(Sensors::PropertyCustomValue10),
14642 1483 => Ok(Sensors::PropertyCustomValue11),
14643 1484 => Ok(Sensors::PropertyCustomValue12),
14644 1485 => Ok(Sensors::PropertyCustomValue13),
14645 1486 => Ok(Sensors::PropertyCustomValue14),
14646 1487 => Ok(Sensors::PropertyCustomValue15),
14647 1488 => Ok(Sensors::PropertyCustomValue16),
14648 1504 => Ok(Sensors::DataFieldHinge),
14649 1505 => Ok(Sensors::DataFieldHingeAngle),
14650 1520 => Ok(Sensors::DataFieldGestureSensor),
14651 1521 => Ok(Sensors::DataFieldGestureState),
14652 1522 => Ok(Sensors::DataFieldHingeFoldInitialAngle),
14653 1523 => Ok(Sensors::DataFieldHingeFoldFinalAngle),
14654 1524 => Ok(Sensors::DataFieldHingeFoldContributingPanel),
14655 1525 => Ok(Sensors::DataFieldHingeFoldType),
14656 2048 => Ok(Sensors::SensorStateUndefined),
14657 2049 => Ok(Sensors::SensorStateReady),
14658 2050 => Ok(Sensors::SensorStateNotAvailable),
14659 2051 => Ok(Sensors::SensorStateNoData),
14660 2052 => Ok(Sensors::SensorStateInitializing),
14661 2053 => Ok(Sensors::SensorStateAccessDenied),
14662 2054 => Ok(Sensors::SensorStateError),
14663 2064 => Ok(Sensors::SensorEventUnknown),
14664 2065 => Ok(Sensors::SensorEventStateChanged),
14665 2066 => Ok(Sensors::SensorEventPropertyChanged),
14666 2067 => Ok(Sensors::SensorEventDataUpdated),
14667 2068 => Ok(Sensors::SensorEventPollResponse),
14668 2069 => Ok(Sensors::SensorEventChangeSensitivity),
14669 2070 => Ok(Sensors::SensorEventRangeMaximumReached),
14670 2071 => Ok(Sensors::SensorEventRangeMinimumReached),
14671 2072 => Ok(Sensors::SensorEventHighThresholdCrossUpward),
14672 2073 => Ok(Sensors::SensorEventHighThresholdCrossDownward),
14673 2074 => Ok(Sensors::SensorEventLowThresholdCrossUpward),
14674 2075 => Ok(Sensors::SensorEventLowThresholdCrossDownward),
14675 2076 => Ok(Sensors::SensorEventZeroThresholdCrossUpward),
14676 2077 => Ok(Sensors::SensorEventZeroThresholdCrossDownward),
14677 2078 => Ok(Sensors::SensorEventPeriodExceeded),
14678 2079 => Ok(Sensors::SensorEventFrequencyExceeded),
14679 2080 => Ok(Sensors::SensorEventComplexTrigger),
14680 2096 => Ok(Sensors::ConnectionTypePCIntegrated),
14681 2097 => Ok(Sensors::ConnectionTypePCAttached),
14682 2098 => Ok(Sensors::ConnectionTypePCExternal),
14683 2112 => Ok(Sensors::ReportingStateReportNoEvents),
14684 2113 => Ok(Sensors::ReportingStateReportAllEvents),
14685 2114 => Ok(Sensors::ReportingStateReportThresholdEvents),
14686 2115 => Ok(Sensors::ReportingStateWakeOnNoEvents),
14687 2116 => Ok(Sensors::ReportingStateWakeOnAllEvents),
14688 2117 => Ok(Sensors::ReportingStateWakeOnThresholdEvents),
14689 2118 => Ok(Sensors::ReportingStateAnytime),
14690 2128 => Ok(Sensors::PowerStateUndefined),
14691 2129 => Ok(Sensors::PowerStateD0FullPower),
14692 2130 => Ok(Sensors::PowerStateD1LowPower),
14693 2131 => Ok(Sensors::PowerStateD2StandbyPowerwithWakeup),
14694 2132 => Ok(Sensors::PowerStateD3SleepwithWakeup),
14695 2133 => Ok(Sensors::PowerStateD4PowerOff),
14696 2144 => Ok(Sensors::AccuracyDefault),
14697 2145 => Ok(Sensors::AccuracyHigh),
14698 2146 => Ok(Sensors::AccuracyMedium),
14699 2147 => Ok(Sensors::AccuracyLow),
14700 2160 => Ok(Sensors::FixQualityNoFix),
14701 2161 => Ok(Sensors::FixQualityGPS),
14702 2162 => Ok(Sensors::FixQualityDGPS),
14703 2176 => Ok(Sensors::FixTypeNoFix),
14704 2177 => Ok(Sensors::FixTypeGPSSPSModeFixValid),
14705 2178 => Ok(Sensors::FixTypeDGPSSPSModeFixValid),
14706 2179 => Ok(Sensors::FixTypeGPSPPSModeFixValid),
14707 2180 => Ok(Sensors::FixTypeRealTimeKinematic),
14708 2181 => Ok(Sensors::FixTypeFloatRTK),
14709 2182 => Ok(Sensors::FixTypeEstimateddeadreckoned),
14710 2183 => Ok(Sensors::FixTypeManualInputMode),
14711 2184 => Ok(Sensors::FixTypeSimulatorMode),
14712 2192 => Ok(Sensors::GPSOperationModeManual),
14713 2193 => Ok(Sensors::GPSOperationModeAutomatic),
14714 2208 => Ok(Sensors::GPSSelectionModeAutonomous),
14715 2209 => Ok(Sensors::GPSSelectionModeDGPS),
14716 2210 => Ok(Sensors::GPSSelectionModeEstimateddeadreckoned),
14717 2211 => Ok(Sensors::GPSSelectionModeManualInput),
14718 2212 => Ok(Sensors::GPSSelectionModeSimulator),
14719 2213 => Ok(Sensors::GPSSelectionModeDataNotValid),
14720 2224 => Ok(Sensors::GPSStatusDataValid),
14721 2225 => Ok(Sensors::GPSStatusDataNotValid),
14722 2240 => Ok(Sensors::DayofWeekSunday),
14723 2241 => Ok(Sensors::DayofWeekMonday),
14724 2242 => Ok(Sensors::DayofWeekTuesday),
14725 2243 => Ok(Sensors::DayofWeekWednesday),
14726 2244 => Ok(Sensors::DayofWeekThursday),
14727 2245 => Ok(Sensors::DayofWeekFriday),
14728 2246 => Ok(Sensors::DayofWeekSaturday),
14729 2256 => Ok(Sensors::KindCategory),
14730 2257 => Ok(Sensors::KindType),
14731 2258 => Ok(Sensors::KindEvent),
14732 2259 => Ok(Sensors::KindProperty),
14733 2260 => Ok(Sensors::KindDataField),
14734 2272 => Ok(Sensors::MagnetometerAccuracyLow),
14735 2273 => Ok(Sensors::MagnetometerAccuracyMedium),
14736 2274 => Ok(Sensors::MagnetometerAccuracyHigh),
14737 2288 => Ok(Sensors::SimpleOrientationDirectionNotRotated),
14738 2289 => Ok(Sensors::SimpleOrientationDirectionRotated90DegreesCCW),
14739 2290 => Ok(Sensors::SimpleOrientationDirectionRotated180DegreesCCW),
14740 2291 => Ok(Sensors::SimpleOrientationDirectionRotated270DegreesCCW),
14741 2292 => Ok(Sensors::SimpleOrientationDirectionFaceUp),
14742 2293 => Ok(Sensors::SimpleOrientationDirectionFaceDown),
14743 2304 => Ok(Sensors::VT_NULL),
14744 2305 => Ok(Sensors::VT_BOOL),
14745 2306 => Ok(Sensors::VT_UI1),
14746 2307 => Ok(Sensors::VT_I1),
14747 2308 => Ok(Sensors::VT_UI2),
14748 2309 => Ok(Sensors::VT_I2),
14749 2310 => Ok(Sensors::VT_UI4),
14750 2311 => Ok(Sensors::VT_I4),
14751 2312 => Ok(Sensors::VT_UI8),
14752 2313 => Ok(Sensors::VT_I8),
14753 2314 => Ok(Sensors::VT_R4),
14754 2315 => Ok(Sensors::VT_R8),
14755 2316 => Ok(Sensors::VT_WSTR),
14756 2317 => Ok(Sensors::VT_STR),
14757 2318 => Ok(Sensors::VT_CLSID),
14758 2319 => Ok(Sensors::VT_VECTORVT_UI1),
14759 2320 => Ok(Sensors::VT_F16E0),
14760 2321 => Ok(Sensors::VT_F16E1),
14761 2322 => Ok(Sensors::VT_F16E2),
14762 2323 => Ok(Sensors::VT_F16E3),
14763 2324 => Ok(Sensors::VT_F16E4),
14764 2325 => Ok(Sensors::VT_F16E5),
14765 2326 => Ok(Sensors::VT_F16E6),
14766 2327 => Ok(Sensors::VT_F16E7),
14767 2328 => Ok(Sensors::VT_F16E8),
14768 2329 => Ok(Sensors::VT_F16E9),
14769 2330 => Ok(Sensors::VT_F16EA),
14770 2331 => Ok(Sensors::VT_F16EB),
14771 2332 => Ok(Sensors::VT_F16EC),
14772 2333 => Ok(Sensors::VT_F16ED),
14773 2334 => Ok(Sensors::VT_F16EE),
14774 2335 => Ok(Sensors::VT_F16EF),
14775 2336 => Ok(Sensors::VT_F32E0),
14776 2337 => Ok(Sensors::VT_F32E1),
14777 2338 => Ok(Sensors::VT_F32E2),
14778 2339 => Ok(Sensors::VT_F32E3),
14779 2340 => Ok(Sensors::VT_F32E4),
14780 2341 => Ok(Sensors::VT_F32E5),
14781 2342 => Ok(Sensors::VT_F32E6),
14782 2343 => Ok(Sensors::VT_F32E7),
14783 2344 => Ok(Sensors::VT_F32E8),
14784 2345 => Ok(Sensors::VT_F32E9),
14785 2346 => Ok(Sensors::VT_F32EA),
14786 2347 => Ok(Sensors::VT_F32EB),
14787 2348 => Ok(Sensors::VT_F32EC),
14788 2349 => Ok(Sensors::VT_F32ED),
14789 2350 => Ok(Sensors::VT_F32EE),
14790 2351 => Ok(Sensors::VT_F32EF),
14791 2352 => Ok(Sensors::ActivityTypeUnknown),
14792 2353 => Ok(Sensors::ActivityTypeStationary),
14793 2354 => Ok(Sensors::ActivityTypeFidgeting),
14794 2355 => Ok(Sensors::ActivityTypeWalking),
14795 2356 => Ok(Sensors::ActivityTypeRunning),
14796 2357 => Ok(Sensors::ActivityTypeInVehicle),
14797 2358 => Ok(Sensors::ActivityTypeBiking),
14798 2359 => Ok(Sensors::ActivityTypeIdle),
14799 2368 => Ok(Sensors::UnitNotSpecified),
14800 2369 => Ok(Sensors::UnitLux),
14801 2370 => Ok(Sensors::UnitDegreesKelvin),
14802 2371 => Ok(Sensors::UnitDegreesCelsius),
14803 2372 => Ok(Sensors::UnitPascal),
14804 2373 => Ok(Sensors::UnitNewton),
14805 2374 => Ok(Sensors::UnitMetersSecond),
14806 2375 => Ok(Sensors::UnitKilogram),
14807 2376 => Ok(Sensors::UnitMeter),
14808 2377 => Ok(Sensors::UnitMetersSecondSecond),
14809 2378 => Ok(Sensors::UnitFarad),
14810 2379 => Ok(Sensors::UnitAmpere),
14811 2380 => Ok(Sensors::UnitWatt),
14812 2381 => Ok(Sensors::UnitHenry),
14813 2382 => Ok(Sensors::UnitOhm),
14814 2383 => Ok(Sensors::UnitVolt),
14815 2384 => Ok(Sensors::UnitHertz),
14816 2385 => Ok(Sensors::UnitBar),
14817 2386 => Ok(Sensors::UnitDegreesAnticlockwise),
14818 2387 => Ok(Sensors::UnitDegreesClockwise),
14819 2388 => Ok(Sensors::UnitDegrees),
14820 2389 => Ok(Sensors::UnitDegreesSecond),
14821 2390 => Ok(Sensors::UnitDegreesSecondSecond),
14822 2391 => Ok(Sensors::UnitKnot),
14823 2392 => Ok(Sensors::UnitPercent),
14824 2393 => Ok(Sensors::UnitSecond),
14825 2394 => Ok(Sensors::UnitMillisecond),
14826 2395 => Ok(Sensors::UnitG),
14827 2396 => Ok(Sensors::UnitBytes),
14828 2397 => Ok(Sensors::UnitMilligauss),
14829 2398 => Ok(Sensors::UnitBits),
14830 2400 => Ok(Sensors::ActivityStateNoStateChange),
14831 2401 => Ok(Sensors::ActivityStateStartActivity),
14832 2402 => Ok(Sensors::ActivityStateEndActivity),
14833 2416 => Ok(Sensors::Exponent0),
14834 2417 => Ok(Sensors::Exponent1),
14835 2418 => Ok(Sensors::Exponent2),
14836 2419 => Ok(Sensors::Exponent3),
14837 2420 => Ok(Sensors::Exponent4),
14838 2421 => Ok(Sensors::Exponent5),
14839 2422 => Ok(Sensors::Exponent6),
14840 2423 => Ok(Sensors::Exponent7),
14841 2424 => Ok(Sensors::Exponent8),
14842 2425 => Ok(Sensors::Exponent9),
14843 2426 => Ok(Sensors::ExponentA),
14844 2427 => Ok(Sensors::ExponentB),
14845 2428 => Ok(Sensors::ExponentC),
14846 2429 => Ok(Sensors::ExponentD),
14847 2430 => Ok(Sensors::ExponentE),
14848 2431 => Ok(Sensors::ExponentF),
14849 2432 => Ok(Sensors::DevicePositionUnknown),
14850 2433 => Ok(Sensors::DevicePositionUnchanged),
14851 2434 => Ok(Sensors::DevicePositionOnDesk),
14852 2435 => Ok(Sensors::DevicePositionInHand),
14853 2436 => Ok(Sensors::DevicePositionMovinginBag),
14854 2437 => Ok(Sensors::DevicePositionStationaryinBag),
14855 2448 => Ok(Sensors::StepTypeUnknown),
14856 2449 => Ok(Sensors::StepTypeWalking),
14857 2450 => Ok(Sensors::StepTypeRunning),
14858 2464 => Ok(Sensors::GestureStateUnknown),
14859 2465 => Ok(Sensors::GestureStateStarted),
14860 2466 => Ok(Sensors::GestureStateCompleted),
14861 2467 => Ok(Sensors::GestureStateCancelled),
14862 2480 => Ok(Sensors::HingeFoldContributingPanelUnknown),
14863 2481 => Ok(Sensors::HingeFoldContributingPanelPanel1),
14864 2482 => Ok(Sensors::HingeFoldContributingPanelPanel2),
14865 2483 => Ok(Sensors::HingeFoldContributingPanelBoth),
14866 2484 => Ok(Sensors::HingeFoldTypeUnknown),
14867 2485 => Ok(Sensors::HingeFoldTypeIncreasing),
14868 2486 => Ok(Sensors::HingeFoldTypeDecreasing),
14869 2496 => Ok(Sensors::HumanPresenceDetectionTypeVendorDefinedNonBiometric),
14870 2497 => Ok(Sensors::HumanPresenceDetectionTypeVendorDefinedBiometric),
14871 2498 => Ok(Sensors::HumanPresenceDetectionTypeFacialBiometric),
14872 2499 => Ok(Sensors::HumanPresenceDetectionTypeAudioBiometric),
14873 4096 => Ok(Sensors::ModifierChangeSensitivityAbsolute),
14874 8192 => Ok(Sensors::ModifierMaximum),
14875 12288 => Ok(Sensors::ModifierMinimum),
14876 16384 => Ok(Sensors::ModifierAccuracy),
14877 20480 => Ok(Sensors::ModifierResolution),
14878 24576 => Ok(Sensors::ModifierThresholdHigh),
14879 28672 => Ok(Sensors::ModifierThresholdLow),
14880 32768 => Ok(Sensors::ModifierCalibrationOffset),
14881 36864 => Ok(Sensors::ModifierCalibrationMultiplier),
14882 40960 => Ok(Sensors::ModifierReportInterval),
14883 45056 => Ok(Sensors::ModifierFrequencyMax),
14884 49152 => Ok(Sensors::ModifierPeriodMax),
14885 53248 => Ok(Sensors::ModifierChangeSensitivityPercentofRange),
14886 57344 => Ok(Sensors::ModifierChangeSensitivityPercentRelative),
14887 61440 => Ok(Sensors::ModifierVendorReserved),
14888 n => Err(HutError::UnknownUsageId { usage_id: n }),
14889 }
14890 }
14891}
14892
14893impl BitOr<u16> for Sensors {
14894 type Output = Usage;
14895
14896 fn bitor(self, usage: u16) -> Usage {
14903 let up = u16::from(self) as u32;
14904 let u = usage as u32;
14905 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
14906 }
14907}
14908
14909#[allow(non_camel_case_types)]
14930#[derive(Debug)]
14931#[non_exhaustive]
14932pub enum MedicalInstrument {
14933 MedicalUltrasound,
14935 VCRAcquisition,
14937 FreezeThaw,
14939 ClipStore,
14941 Update,
14943 Next,
14945 Save,
14947 Print,
14949 MicrophoneEnable,
14951 Cine,
14953 TransmitPower,
14955 Volume,
14957 Focus,
14959 Depth,
14961 SoftStepPrimary,
14963 SoftStepSecondary,
14965 DepthGainCompensation,
14967 ZoomSelect,
14969 ZoomAdjust,
14971 SpectralDopplerModeSelect,
14973 SpectralDopplerAdjust,
14975 ColorDopplerModeSelect,
14977 ColorDopplerAdjust,
14979 MotionModeSelect,
14981 MotionModeAdjust,
14983 TwoDModeSelect,
14985 TwoDModeAdjust,
14987 SoftControlSelect,
14989 SoftControlAdjust,
14991}
14992
14993impl MedicalInstrument {
14994 #[cfg(feature = "std")]
14995 pub fn name(&self) -> String {
14996 match self {
14997 MedicalInstrument::MedicalUltrasound => "Medical Ultrasound",
14998 MedicalInstrument::VCRAcquisition => "VCR/Acquisition",
14999 MedicalInstrument::FreezeThaw => "Freeze/Thaw",
15000 MedicalInstrument::ClipStore => "Clip Store",
15001 MedicalInstrument::Update => "Update",
15002 MedicalInstrument::Next => "Next",
15003 MedicalInstrument::Save => "Save",
15004 MedicalInstrument::Print => "Print",
15005 MedicalInstrument::MicrophoneEnable => "Microphone Enable",
15006 MedicalInstrument::Cine => "Cine",
15007 MedicalInstrument::TransmitPower => "Transmit Power",
15008 MedicalInstrument::Volume => "Volume",
15009 MedicalInstrument::Focus => "Focus",
15010 MedicalInstrument::Depth => "Depth",
15011 MedicalInstrument::SoftStepPrimary => "Soft Step - Primary",
15012 MedicalInstrument::SoftStepSecondary => "Soft Step - Secondary",
15013 MedicalInstrument::DepthGainCompensation => "Depth Gain Compensation",
15014 MedicalInstrument::ZoomSelect => "Zoom Select",
15015 MedicalInstrument::ZoomAdjust => "Zoom Adjust",
15016 MedicalInstrument::SpectralDopplerModeSelect => "Spectral Doppler Mode Select",
15017 MedicalInstrument::SpectralDopplerAdjust => "Spectral Doppler Adjust",
15018 MedicalInstrument::ColorDopplerModeSelect => "Color Doppler Mode Select",
15019 MedicalInstrument::ColorDopplerAdjust => "Color Doppler Adjust",
15020 MedicalInstrument::MotionModeSelect => "Motion Mode Select",
15021 MedicalInstrument::MotionModeAdjust => "Motion Mode Adjust",
15022 MedicalInstrument::TwoDModeSelect => "2-D Mode Select",
15023 MedicalInstrument::TwoDModeAdjust => "2-D Mode Adjust",
15024 MedicalInstrument::SoftControlSelect => "Soft Control Select",
15025 MedicalInstrument::SoftControlAdjust => "Soft Control Adjust",
15026 }
15027 .into()
15028 }
15029}
15030
15031#[cfg(feature = "std")]
15032impl fmt::Display for MedicalInstrument {
15033 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15034 write!(f, "{}", self.name())
15035 }
15036}
15037
15038impl AsUsage for MedicalInstrument {
15039 fn usage_value(&self) -> u32 {
15041 u32::from(self)
15042 }
15043
15044 fn usage_id_value(&self) -> u16 {
15046 u16::from(self)
15047 }
15048
15049 fn usage(&self) -> Usage {
15060 Usage::from(self)
15061 }
15062}
15063
15064impl AsUsagePage for MedicalInstrument {
15065 fn usage_page_value(&self) -> u16 {
15069 let up = UsagePage::from(self);
15070 u16::from(up)
15071 }
15072
15073 fn usage_page(&self) -> UsagePage {
15075 UsagePage::from(self)
15076 }
15077}
15078
15079impl From<&MedicalInstrument> for u16 {
15080 fn from(medicalinstrument: &MedicalInstrument) -> u16 {
15081 match *medicalinstrument {
15082 MedicalInstrument::MedicalUltrasound => 1,
15083 MedicalInstrument::VCRAcquisition => 32,
15084 MedicalInstrument::FreezeThaw => 33,
15085 MedicalInstrument::ClipStore => 34,
15086 MedicalInstrument::Update => 35,
15087 MedicalInstrument::Next => 36,
15088 MedicalInstrument::Save => 37,
15089 MedicalInstrument::Print => 38,
15090 MedicalInstrument::MicrophoneEnable => 39,
15091 MedicalInstrument::Cine => 64,
15092 MedicalInstrument::TransmitPower => 65,
15093 MedicalInstrument::Volume => 66,
15094 MedicalInstrument::Focus => 67,
15095 MedicalInstrument::Depth => 68,
15096 MedicalInstrument::SoftStepPrimary => 96,
15097 MedicalInstrument::SoftStepSecondary => 97,
15098 MedicalInstrument::DepthGainCompensation => 112,
15099 MedicalInstrument::ZoomSelect => 128,
15100 MedicalInstrument::ZoomAdjust => 129,
15101 MedicalInstrument::SpectralDopplerModeSelect => 130,
15102 MedicalInstrument::SpectralDopplerAdjust => 131,
15103 MedicalInstrument::ColorDopplerModeSelect => 132,
15104 MedicalInstrument::ColorDopplerAdjust => 133,
15105 MedicalInstrument::MotionModeSelect => 134,
15106 MedicalInstrument::MotionModeAdjust => 135,
15107 MedicalInstrument::TwoDModeSelect => 136,
15108 MedicalInstrument::TwoDModeAdjust => 137,
15109 MedicalInstrument::SoftControlSelect => 160,
15110 MedicalInstrument::SoftControlAdjust => 161,
15111 }
15112 }
15113}
15114
15115impl From<MedicalInstrument> for u16 {
15116 fn from(medicalinstrument: MedicalInstrument) -> u16 {
15119 u16::from(&medicalinstrument)
15120 }
15121}
15122
15123impl From<&MedicalInstrument> for u32 {
15124 fn from(medicalinstrument: &MedicalInstrument) -> u32 {
15127 let up = UsagePage::from(medicalinstrument);
15128 let up = (u16::from(&up) as u32) << 16;
15129 let id = u16::from(medicalinstrument) as u32;
15130 up | id
15131 }
15132}
15133
15134impl From<&MedicalInstrument> for UsagePage {
15135 fn from(_: &MedicalInstrument) -> UsagePage {
15138 UsagePage::MedicalInstrument
15139 }
15140}
15141
15142impl From<MedicalInstrument> for UsagePage {
15143 fn from(_: MedicalInstrument) -> UsagePage {
15146 UsagePage::MedicalInstrument
15147 }
15148}
15149
15150impl From<&MedicalInstrument> for Usage {
15151 fn from(medicalinstrument: &MedicalInstrument) -> Usage {
15152 Usage::try_from(u32::from(medicalinstrument)).unwrap()
15153 }
15154}
15155
15156impl From<MedicalInstrument> for Usage {
15157 fn from(medicalinstrument: MedicalInstrument) -> Usage {
15158 Usage::from(&medicalinstrument)
15159 }
15160}
15161
15162impl TryFrom<u16> for MedicalInstrument {
15163 type Error = HutError;
15164
15165 fn try_from(usage_id: u16) -> Result<MedicalInstrument> {
15166 match usage_id {
15167 1 => Ok(MedicalInstrument::MedicalUltrasound),
15168 32 => Ok(MedicalInstrument::VCRAcquisition),
15169 33 => Ok(MedicalInstrument::FreezeThaw),
15170 34 => Ok(MedicalInstrument::ClipStore),
15171 35 => Ok(MedicalInstrument::Update),
15172 36 => Ok(MedicalInstrument::Next),
15173 37 => Ok(MedicalInstrument::Save),
15174 38 => Ok(MedicalInstrument::Print),
15175 39 => Ok(MedicalInstrument::MicrophoneEnable),
15176 64 => Ok(MedicalInstrument::Cine),
15177 65 => Ok(MedicalInstrument::TransmitPower),
15178 66 => Ok(MedicalInstrument::Volume),
15179 67 => Ok(MedicalInstrument::Focus),
15180 68 => Ok(MedicalInstrument::Depth),
15181 96 => Ok(MedicalInstrument::SoftStepPrimary),
15182 97 => Ok(MedicalInstrument::SoftStepSecondary),
15183 112 => Ok(MedicalInstrument::DepthGainCompensation),
15184 128 => Ok(MedicalInstrument::ZoomSelect),
15185 129 => Ok(MedicalInstrument::ZoomAdjust),
15186 130 => Ok(MedicalInstrument::SpectralDopplerModeSelect),
15187 131 => Ok(MedicalInstrument::SpectralDopplerAdjust),
15188 132 => Ok(MedicalInstrument::ColorDopplerModeSelect),
15189 133 => Ok(MedicalInstrument::ColorDopplerAdjust),
15190 134 => Ok(MedicalInstrument::MotionModeSelect),
15191 135 => Ok(MedicalInstrument::MotionModeAdjust),
15192 136 => Ok(MedicalInstrument::TwoDModeSelect),
15193 137 => Ok(MedicalInstrument::TwoDModeAdjust),
15194 160 => Ok(MedicalInstrument::SoftControlSelect),
15195 161 => Ok(MedicalInstrument::SoftControlAdjust),
15196 n => Err(HutError::UnknownUsageId { usage_id: n }),
15197 }
15198 }
15199}
15200
15201impl BitOr<u16> for MedicalInstrument {
15202 type Output = Usage;
15203
15204 fn bitor(self, usage: u16) -> Usage {
15211 let up = u16::from(self) as u32;
15212 let u = usage as u32;
15213 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
15214 }
15215}
15216
15217#[allow(non_camel_case_types)]
15238#[derive(Debug)]
15239#[non_exhaustive]
15240pub enum BrailleDisplay {
15241 BrailleDisplay,
15243 BrailleRow,
15245 EightDotBrailleCell,
15247 SixDotBrailleCell,
15249 NumberofBrailleCells,
15251 ScreenReaderControl,
15253 ScreenReaderIdentifier,
15255 RouterSet1,
15257 RouterSet2,
15259 RouterSet3,
15261 RouterKey,
15263 RowRouterKey,
15265 BrailleButtons,
15267 BrailleKeyboardDot1,
15269 BrailleKeyboardDot2,
15271 BrailleKeyboardDot3,
15273 BrailleKeyboardDot4,
15275 BrailleKeyboardDot5,
15277 BrailleKeyboardDot6,
15279 BrailleKeyboardDot7,
15281 BrailleKeyboardDot8,
15283 BrailleKeyboardSpace,
15285 BrailleKeyboardLeftSpace,
15287 BrailleKeyboardRightSpace,
15289 BrailleFaceControls,
15291 BrailleLeftControls,
15293 BrailleRightControls,
15295 BrailleTopControls,
15297 BrailleJoystickCenter,
15299 BrailleJoystickUp,
15301 BrailleJoystickDown,
15303 BrailleJoystickLeft,
15305 BrailleJoystickRight,
15307 BrailleDPadCenter,
15309 BrailleDPadUp,
15311 BrailleDPadDown,
15313 BrailleDPadLeft,
15315 BrailleDPadRight,
15317 BraillePanLeft,
15319 BraillePanRight,
15321 BrailleRockerUp,
15323 BrailleRockerDown,
15325 BrailleRockerPress,
15327}
15328
15329impl BrailleDisplay {
15330 #[cfg(feature = "std")]
15331 pub fn name(&self) -> String {
15332 match self {
15333 BrailleDisplay::BrailleDisplay => "Braille Display",
15334 BrailleDisplay::BrailleRow => "Braille Row",
15335 BrailleDisplay::EightDotBrailleCell => "8 Dot Braille Cell",
15336 BrailleDisplay::SixDotBrailleCell => "6 Dot Braille Cell",
15337 BrailleDisplay::NumberofBrailleCells => "Number of Braille Cells",
15338 BrailleDisplay::ScreenReaderControl => "Screen Reader Control",
15339 BrailleDisplay::ScreenReaderIdentifier => "Screen Reader Identifier",
15340 BrailleDisplay::RouterSet1 => "Router Set 1",
15341 BrailleDisplay::RouterSet2 => "Router Set 2",
15342 BrailleDisplay::RouterSet3 => "Router Set 3",
15343 BrailleDisplay::RouterKey => "Router Key",
15344 BrailleDisplay::RowRouterKey => "Row Router Key",
15345 BrailleDisplay::BrailleButtons => "Braille Buttons",
15346 BrailleDisplay::BrailleKeyboardDot1 => "Braille Keyboard Dot 1",
15347 BrailleDisplay::BrailleKeyboardDot2 => "Braille Keyboard Dot 2",
15348 BrailleDisplay::BrailleKeyboardDot3 => "Braille Keyboard Dot 3",
15349 BrailleDisplay::BrailleKeyboardDot4 => "Braille Keyboard Dot 4",
15350 BrailleDisplay::BrailleKeyboardDot5 => "Braille Keyboard Dot 5",
15351 BrailleDisplay::BrailleKeyboardDot6 => "Braille Keyboard Dot 6",
15352 BrailleDisplay::BrailleKeyboardDot7 => "Braille Keyboard Dot 7",
15353 BrailleDisplay::BrailleKeyboardDot8 => "Braille Keyboard Dot 8",
15354 BrailleDisplay::BrailleKeyboardSpace => "Braille Keyboard Space",
15355 BrailleDisplay::BrailleKeyboardLeftSpace => "Braille Keyboard Left Space",
15356 BrailleDisplay::BrailleKeyboardRightSpace => "Braille Keyboard Right Space",
15357 BrailleDisplay::BrailleFaceControls => "Braille Face Controls",
15358 BrailleDisplay::BrailleLeftControls => "Braille Left Controls",
15359 BrailleDisplay::BrailleRightControls => "Braille Right Controls",
15360 BrailleDisplay::BrailleTopControls => "Braille Top Controls",
15361 BrailleDisplay::BrailleJoystickCenter => "Braille Joystick Center",
15362 BrailleDisplay::BrailleJoystickUp => "Braille Joystick Up",
15363 BrailleDisplay::BrailleJoystickDown => "Braille Joystick Down",
15364 BrailleDisplay::BrailleJoystickLeft => "Braille Joystick Left",
15365 BrailleDisplay::BrailleJoystickRight => "Braille Joystick Right",
15366 BrailleDisplay::BrailleDPadCenter => "Braille D-Pad Center",
15367 BrailleDisplay::BrailleDPadUp => "Braille D-Pad Up",
15368 BrailleDisplay::BrailleDPadDown => "Braille D-Pad Down",
15369 BrailleDisplay::BrailleDPadLeft => "Braille D-Pad Left",
15370 BrailleDisplay::BrailleDPadRight => "Braille D-Pad Right",
15371 BrailleDisplay::BraillePanLeft => "Braille Pan Left",
15372 BrailleDisplay::BraillePanRight => "Braille Pan Right",
15373 BrailleDisplay::BrailleRockerUp => "Braille Rocker Up",
15374 BrailleDisplay::BrailleRockerDown => "Braille Rocker Down",
15375 BrailleDisplay::BrailleRockerPress => "Braille Rocker Press",
15376 }
15377 .into()
15378 }
15379}
15380
15381#[cfg(feature = "std")]
15382impl fmt::Display for BrailleDisplay {
15383 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15384 write!(f, "{}", self.name())
15385 }
15386}
15387
15388impl AsUsage for BrailleDisplay {
15389 fn usage_value(&self) -> u32 {
15391 u32::from(self)
15392 }
15393
15394 fn usage_id_value(&self) -> u16 {
15396 u16::from(self)
15397 }
15398
15399 fn usage(&self) -> Usage {
15410 Usage::from(self)
15411 }
15412}
15413
15414impl AsUsagePage for BrailleDisplay {
15415 fn usage_page_value(&self) -> u16 {
15419 let up = UsagePage::from(self);
15420 u16::from(up)
15421 }
15422
15423 fn usage_page(&self) -> UsagePage {
15425 UsagePage::from(self)
15426 }
15427}
15428
15429impl From<&BrailleDisplay> for u16 {
15430 fn from(brailledisplay: &BrailleDisplay) -> u16 {
15431 match *brailledisplay {
15432 BrailleDisplay::BrailleDisplay => 1,
15433 BrailleDisplay::BrailleRow => 2,
15434 BrailleDisplay::EightDotBrailleCell => 3,
15435 BrailleDisplay::SixDotBrailleCell => 4,
15436 BrailleDisplay::NumberofBrailleCells => 5,
15437 BrailleDisplay::ScreenReaderControl => 6,
15438 BrailleDisplay::ScreenReaderIdentifier => 7,
15439 BrailleDisplay::RouterSet1 => 250,
15440 BrailleDisplay::RouterSet2 => 251,
15441 BrailleDisplay::RouterSet3 => 252,
15442 BrailleDisplay::RouterKey => 256,
15443 BrailleDisplay::RowRouterKey => 257,
15444 BrailleDisplay::BrailleButtons => 512,
15445 BrailleDisplay::BrailleKeyboardDot1 => 513,
15446 BrailleDisplay::BrailleKeyboardDot2 => 514,
15447 BrailleDisplay::BrailleKeyboardDot3 => 515,
15448 BrailleDisplay::BrailleKeyboardDot4 => 516,
15449 BrailleDisplay::BrailleKeyboardDot5 => 517,
15450 BrailleDisplay::BrailleKeyboardDot6 => 518,
15451 BrailleDisplay::BrailleKeyboardDot7 => 519,
15452 BrailleDisplay::BrailleKeyboardDot8 => 520,
15453 BrailleDisplay::BrailleKeyboardSpace => 521,
15454 BrailleDisplay::BrailleKeyboardLeftSpace => 522,
15455 BrailleDisplay::BrailleKeyboardRightSpace => 523,
15456 BrailleDisplay::BrailleFaceControls => 524,
15457 BrailleDisplay::BrailleLeftControls => 525,
15458 BrailleDisplay::BrailleRightControls => 526,
15459 BrailleDisplay::BrailleTopControls => 527,
15460 BrailleDisplay::BrailleJoystickCenter => 528,
15461 BrailleDisplay::BrailleJoystickUp => 529,
15462 BrailleDisplay::BrailleJoystickDown => 530,
15463 BrailleDisplay::BrailleJoystickLeft => 531,
15464 BrailleDisplay::BrailleJoystickRight => 532,
15465 BrailleDisplay::BrailleDPadCenter => 533,
15466 BrailleDisplay::BrailleDPadUp => 534,
15467 BrailleDisplay::BrailleDPadDown => 535,
15468 BrailleDisplay::BrailleDPadLeft => 536,
15469 BrailleDisplay::BrailleDPadRight => 537,
15470 BrailleDisplay::BraillePanLeft => 538,
15471 BrailleDisplay::BraillePanRight => 539,
15472 BrailleDisplay::BrailleRockerUp => 540,
15473 BrailleDisplay::BrailleRockerDown => 541,
15474 BrailleDisplay::BrailleRockerPress => 542,
15475 }
15476 }
15477}
15478
15479impl From<BrailleDisplay> for u16 {
15480 fn from(brailledisplay: BrailleDisplay) -> u16 {
15483 u16::from(&brailledisplay)
15484 }
15485}
15486
15487impl From<&BrailleDisplay> for u32 {
15488 fn from(brailledisplay: &BrailleDisplay) -> u32 {
15491 let up = UsagePage::from(brailledisplay);
15492 let up = (u16::from(&up) as u32) << 16;
15493 let id = u16::from(brailledisplay) as u32;
15494 up | id
15495 }
15496}
15497
15498impl From<&BrailleDisplay> for UsagePage {
15499 fn from(_: &BrailleDisplay) -> UsagePage {
15502 UsagePage::BrailleDisplay
15503 }
15504}
15505
15506impl From<BrailleDisplay> for UsagePage {
15507 fn from(_: BrailleDisplay) -> UsagePage {
15510 UsagePage::BrailleDisplay
15511 }
15512}
15513
15514impl From<&BrailleDisplay> for Usage {
15515 fn from(brailledisplay: &BrailleDisplay) -> Usage {
15516 Usage::try_from(u32::from(brailledisplay)).unwrap()
15517 }
15518}
15519
15520impl From<BrailleDisplay> for Usage {
15521 fn from(brailledisplay: BrailleDisplay) -> Usage {
15522 Usage::from(&brailledisplay)
15523 }
15524}
15525
15526impl TryFrom<u16> for BrailleDisplay {
15527 type Error = HutError;
15528
15529 fn try_from(usage_id: u16) -> Result<BrailleDisplay> {
15530 match usage_id {
15531 1 => Ok(BrailleDisplay::BrailleDisplay),
15532 2 => Ok(BrailleDisplay::BrailleRow),
15533 3 => Ok(BrailleDisplay::EightDotBrailleCell),
15534 4 => Ok(BrailleDisplay::SixDotBrailleCell),
15535 5 => Ok(BrailleDisplay::NumberofBrailleCells),
15536 6 => Ok(BrailleDisplay::ScreenReaderControl),
15537 7 => Ok(BrailleDisplay::ScreenReaderIdentifier),
15538 250 => Ok(BrailleDisplay::RouterSet1),
15539 251 => Ok(BrailleDisplay::RouterSet2),
15540 252 => Ok(BrailleDisplay::RouterSet3),
15541 256 => Ok(BrailleDisplay::RouterKey),
15542 257 => Ok(BrailleDisplay::RowRouterKey),
15543 512 => Ok(BrailleDisplay::BrailleButtons),
15544 513 => Ok(BrailleDisplay::BrailleKeyboardDot1),
15545 514 => Ok(BrailleDisplay::BrailleKeyboardDot2),
15546 515 => Ok(BrailleDisplay::BrailleKeyboardDot3),
15547 516 => Ok(BrailleDisplay::BrailleKeyboardDot4),
15548 517 => Ok(BrailleDisplay::BrailleKeyboardDot5),
15549 518 => Ok(BrailleDisplay::BrailleKeyboardDot6),
15550 519 => Ok(BrailleDisplay::BrailleKeyboardDot7),
15551 520 => Ok(BrailleDisplay::BrailleKeyboardDot8),
15552 521 => Ok(BrailleDisplay::BrailleKeyboardSpace),
15553 522 => Ok(BrailleDisplay::BrailleKeyboardLeftSpace),
15554 523 => Ok(BrailleDisplay::BrailleKeyboardRightSpace),
15555 524 => Ok(BrailleDisplay::BrailleFaceControls),
15556 525 => Ok(BrailleDisplay::BrailleLeftControls),
15557 526 => Ok(BrailleDisplay::BrailleRightControls),
15558 527 => Ok(BrailleDisplay::BrailleTopControls),
15559 528 => Ok(BrailleDisplay::BrailleJoystickCenter),
15560 529 => Ok(BrailleDisplay::BrailleJoystickUp),
15561 530 => Ok(BrailleDisplay::BrailleJoystickDown),
15562 531 => Ok(BrailleDisplay::BrailleJoystickLeft),
15563 532 => Ok(BrailleDisplay::BrailleJoystickRight),
15564 533 => Ok(BrailleDisplay::BrailleDPadCenter),
15565 534 => Ok(BrailleDisplay::BrailleDPadUp),
15566 535 => Ok(BrailleDisplay::BrailleDPadDown),
15567 536 => Ok(BrailleDisplay::BrailleDPadLeft),
15568 537 => Ok(BrailleDisplay::BrailleDPadRight),
15569 538 => Ok(BrailleDisplay::BraillePanLeft),
15570 539 => Ok(BrailleDisplay::BraillePanRight),
15571 540 => Ok(BrailleDisplay::BrailleRockerUp),
15572 541 => Ok(BrailleDisplay::BrailleRockerDown),
15573 542 => Ok(BrailleDisplay::BrailleRockerPress),
15574 n => Err(HutError::UnknownUsageId { usage_id: n }),
15575 }
15576 }
15577}
15578
15579impl BitOr<u16> for BrailleDisplay {
15580 type Output = Usage;
15581
15582 fn bitor(self, usage: u16) -> Usage {
15589 let up = u16::from(self) as u32;
15590 let u = usage as u32;
15591 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
15592 }
15593}
15594
15595#[allow(non_camel_case_types)]
15616#[derive(Debug)]
15617#[non_exhaustive]
15618pub enum LightingAndIllumination {
15619 LampArray,
15621 LampArrayAttributesReport,
15623 LampCount,
15625 BoundingBoxWidthInMicrometers,
15627 BoundingBoxHeightInMicrometers,
15629 BoundingBoxDepthInMicrometers,
15631 LampArrayKind,
15633 MinUpdateIntervalInMicroseconds,
15635 LampAttributesRequestReport,
15637 LampId,
15639 LampAttributesResponseReport,
15641 PositionXInMicrometers,
15643 PositionYInMicrometers,
15645 PositionZInMicrometers,
15647 LampPurposes,
15649 UpdateLatencyInMicroseconds,
15651 RedLevelCount,
15653 GreenLevelCount,
15655 BlueLevelCount,
15657 IntensityLevelCount,
15659 IsProgrammable,
15661 InputBinding,
15663 LampMultiUpdateReport,
15665 RedUpdateChannel,
15667 GreenUpdateChannel,
15669 BlueUpdateChannel,
15671 IntensityUpdateChannel,
15673 LampUpdateFlags,
15675 LampRangeUpdateReport,
15677 LampIdStart,
15679 LampIdEnd,
15681 LampArrayControlReport,
15683 AutonomousMode,
15685}
15686
15687impl LightingAndIllumination {
15688 #[cfg(feature = "std")]
15689 pub fn name(&self) -> String {
15690 match self {
15691 LightingAndIllumination::LampArray => "LampArray",
15692 LightingAndIllumination::LampArrayAttributesReport => "LampArrayAttributesReport",
15693 LightingAndIllumination::LampCount => "LampCount",
15694 LightingAndIllumination::BoundingBoxWidthInMicrometers => {
15695 "BoundingBoxWidthInMicrometers"
15696 }
15697 LightingAndIllumination::BoundingBoxHeightInMicrometers => {
15698 "BoundingBoxHeightInMicrometers"
15699 }
15700 LightingAndIllumination::BoundingBoxDepthInMicrometers => {
15701 "BoundingBoxDepthInMicrometers"
15702 }
15703 LightingAndIllumination::LampArrayKind => "LampArrayKind",
15704 LightingAndIllumination::MinUpdateIntervalInMicroseconds => {
15705 "MinUpdateIntervalInMicroseconds"
15706 }
15707 LightingAndIllumination::LampAttributesRequestReport => "LampAttributesRequestReport",
15708 LightingAndIllumination::LampId => "LampId",
15709 LightingAndIllumination::LampAttributesResponseReport => "LampAttributesResponseReport",
15710 LightingAndIllumination::PositionXInMicrometers => "PositionXInMicrometers",
15711 LightingAndIllumination::PositionYInMicrometers => "PositionYInMicrometers",
15712 LightingAndIllumination::PositionZInMicrometers => "PositionZInMicrometers",
15713 LightingAndIllumination::LampPurposes => "LampPurposes",
15714 LightingAndIllumination::UpdateLatencyInMicroseconds => "UpdateLatencyInMicroseconds",
15715 LightingAndIllumination::RedLevelCount => "RedLevelCount",
15716 LightingAndIllumination::GreenLevelCount => "GreenLevelCount",
15717 LightingAndIllumination::BlueLevelCount => "BlueLevelCount",
15718 LightingAndIllumination::IntensityLevelCount => "IntensityLevelCount",
15719 LightingAndIllumination::IsProgrammable => "IsProgrammable",
15720 LightingAndIllumination::InputBinding => "InputBinding",
15721 LightingAndIllumination::LampMultiUpdateReport => "LampMultiUpdateReport",
15722 LightingAndIllumination::RedUpdateChannel => "RedUpdateChannel",
15723 LightingAndIllumination::GreenUpdateChannel => "GreenUpdateChannel",
15724 LightingAndIllumination::BlueUpdateChannel => "BlueUpdateChannel",
15725 LightingAndIllumination::IntensityUpdateChannel => "IntensityUpdateChannel",
15726 LightingAndIllumination::LampUpdateFlags => "LampUpdateFlags",
15727 LightingAndIllumination::LampRangeUpdateReport => "LampRangeUpdateReport",
15728 LightingAndIllumination::LampIdStart => "LampIdStart",
15729 LightingAndIllumination::LampIdEnd => "LampIdEnd",
15730 LightingAndIllumination::LampArrayControlReport => "LampArrayControlReport",
15731 LightingAndIllumination::AutonomousMode => "AutonomousMode",
15732 }
15733 .into()
15734 }
15735}
15736
15737#[cfg(feature = "std")]
15738impl fmt::Display for LightingAndIllumination {
15739 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15740 write!(f, "{}", self.name())
15741 }
15742}
15743
15744impl AsUsage for LightingAndIllumination {
15745 fn usage_value(&self) -> u32 {
15747 u32::from(self)
15748 }
15749
15750 fn usage_id_value(&self) -> u16 {
15752 u16::from(self)
15753 }
15754
15755 fn usage(&self) -> Usage {
15766 Usage::from(self)
15767 }
15768}
15769
15770impl AsUsagePage for LightingAndIllumination {
15771 fn usage_page_value(&self) -> u16 {
15775 let up = UsagePage::from(self);
15776 u16::from(up)
15777 }
15778
15779 fn usage_page(&self) -> UsagePage {
15781 UsagePage::from(self)
15782 }
15783}
15784
15785impl From<&LightingAndIllumination> for u16 {
15786 fn from(lightingandillumination: &LightingAndIllumination) -> u16 {
15787 match *lightingandillumination {
15788 LightingAndIllumination::LampArray => 1,
15789 LightingAndIllumination::LampArrayAttributesReport => 2,
15790 LightingAndIllumination::LampCount => 3,
15791 LightingAndIllumination::BoundingBoxWidthInMicrometers => 4,
15792 LightingAndIllumination::BoundingBoxHeightInMicrometers => 5,
15793 LightingAndIllumination::BoundingBoxDepthInMicrometers => 6,
15794 LightingAndIllumination::LampArrayKind => 7,
15795 LightingAndIllumination::MinUpdateIntervalInMicroseconds => 8,
15796 LightingAndIllumination::LampAttributesRequestReport => 32,
15797 LightingAndIllumination::LampId => 33,
15798 LightingAndIllumination::LampAttributesResponseReport => 34,
15799 LightingAndIllumination::PositionXInMicrometers => 35,
15800 LightingAndIllumination::PositionYInMicrometers => 36,
15801 LightingAndIllumination::PositionZInMicrometers => 37,
15802 LightingAndIllumination::LampPurposes => 38,
15803 LightingAndIllumination::UpdateLatencyInMicroseconds => 39,
15804 LightingAndIllumination::RedLevelCount => 40,
15805 LightingAndIllumination::GreenLevelCount => 41,
15806 LightingAndIllumination::BlueLevelCount => 42,
15807 LightingAndIllumination::IntensityLevelCount => 43,
15808 LightingAndIllumination::IsProgrammable => 44,
15809 LightingAndIllumination::InputBinding => 45,
15810 LightingAndIllumination::LampMultiUpdateReport => 80,
15811 LightingAndIllumination::RedUpdateChannel => 81,
15812 LightingAndIllumination::GreenUpdateChannel => 82,
15813 LightingAndIllumination::BlueUpdateChannel => 83,
15814 LightingAndIllumination::IntensityUpdateChannel => 84,
15815 LightingAndIllumination::LampUpdateFlags => 85,
15816 LightingAndIllumination::LampRangeUpdateReport => 96,
15817 LightingAndIllumination::LampIdStart => 97,
15818 LightingAndIllumination::LampIdEnd => 98,
15819 LightingAndIllumination::LampArrayControlReport => 112,
15820 LightingAndIllumination::AutonomousMode => 113,
15821 }
15822 }
15823}
15824
15825impl From<LightingAndIllumination> for u16 {
15826 fn from(lightingandillumination: LightingAndIllumination) -> u16 {
15829 u16::from(&lightingandillumination)
15830 }
15831}
15832
15833impl From<&LightingAndIllumination> for u32 {
15834 fn from(lightingandillumination: &LightingAndIllumination) -> u32 {
15837 let up = UsagePage::from(lightingandillumination);
15838 let up = (u16::from(&up) as u32) << 16;
15839 let id = u16::from(lightingandillumination) as u32;
15840 up | id
15841 }
15842}
15843
15844impl From<&LightingAndIllumination> for UsagePage {
15845 fn from(_: &LightingAndIllumination) -> UsagePage {
15848 UsagePage::LightingAndIllumination
15849 }
15850}
15851
15852impl From<LightingAndIllumination> for UsagePage {
15853 fn from(_: LightingAndIllumination) -> UsagePage {
15856 UsagePage::LightingAndIllumination
15857 }
15858}
15859
15860impl From<&LightingAndIllumination> for Usage {
15861 fn from(lightingandillumination: &LightingAndIllumination) -> Usage {
15862 Usage::try_from(u32::from(lightingandillumination)).unwrap()
15863 }
15864}
15865
15866impl From<LightingAndIllumination> for Usage {
15867 fn from(lightingandillumination: LightingAndIllumination) -> Usage {
15868 Usage::from(&lightingandillumination)
15869 }
15870}
15871
15872impl TryFrom<u16> for LightingAndIllumination {
15873 type Error = HutError;
15874
15875 fn try_from(usage_id: u16) -> Result<LightingAndIllumination> {
15876 match usage_id {
15877 1 => Ok(LightingAndIllumination::LampArray),
15878 2 => Ok(LightingAndIllumination::LampArrayAttributesReport),
15879 3 => Ok(LightingAndIllumination::LampCount),
15880 4 => Ok(LightingAndIllumination::BoundingBoxWidthInMicrometers),
15881 5 => Ok(LightingAndIllumination::BoundingBoxHeightInMicrometers),
15882 6 => Ok(LightingAndIllumination::BoundingBoxDepthInMicrometers),
15883 7 => Ok(LightingAndIllumination::LampArrayKind),
15884 8 => Ok(LightingAndIllumination::MinUpdateIntervalInMicroseconds),
15885 32 => Ok(LightingAndIllumination::LampAttributesRequestReport),
15886 33 => Ok(LightingAndIllumination::LampId),
15887 34 => Ok(LightingAndIllumination::LampAttributesResponseReport),
15888 35 => Ok(LightingAndIllumination::PositionXInMicrometers),
15889 36 => Ok(LightingAndIllumination::PositionYInMicrometers),
15890 37 => Ok(LightingAndIllumination::PositionZInMicrometers),
15891 38 => Ok(LightingAndIllumination::LampPurposes),
15892 39 => Ok(LightingAndIllumination::UpdateLatencyInMicroseconds),
15893 40 => Ok(LightingAndIllumination::RedLevelCount),
15894 41 => Ok(LightingAndIllumination::GreenLevelCount),
15895 42 => Ok(LightingAndIllumination::BlueLevelCount),
15896 43 => Ok(LightingAndIllumination::IntensityLevelCount),
15897 44 => Ok(LightingAndIllumination::IsProgrammable),
15898 45 => Ok(LightingAndIllumination::InputBinding),
15899 80 => Ok(LightingAndIllumination::LampMultiUpdateReport),
15900 81 => Ok(LightingAndIllumination::RedUpdateChannel),
15901 82 => Ok(LightingAndIllumination::GreenUpdateChannel),
15902 83 => Ok(LightingAndIllumination::BlueUpdateChannel),
15903 84 => Ok(LightingAndIllumination::IntensityUpdateChannel),
15904 85 => Ok(LightingAndIllumination::LampUpdateFlags),
15905 96 => Ok(LightingAndIllumination::LampRangeUpdateReport),
15906 97 => Ok(LightingAndIllumination::LampIdStart),
15907 98 => Ok(LightingAndIllumination::LampIdEnd),
15908 112 => Ok(LightingAndIllumination::LampArrayControlReport),
15909 113 => Ok(LightingAndIllumination::AutonomousMode),
15910 n => Err(HutError::UnknownUsageId { usage_id: n }),
15911 }
15912 }
15913}
15914
15915impl BitOr<u16> for LightingAndIllumination {
15916 type Output = Usage;
15917
15918 fn bitor(self, usage: u16) -> Usage {
15925 let up = u16::from(self) as u32;
15926 let u = usage as u32;
15927 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
15928 }
15929}
15930
15931#[allow(non_camel_case_types)]
15952#[derive(Debug)]
15953#[non_exhaustive]
15954pub enum Monitor {
15955 MonitorControl,
15957 EDIDInformation,
15959 VDIFInformation,
15961 VESAVersion,
15963}
15964
15965impl Monitor {
15966 #[cfg(feature = "std")]
15967 pub fn name(&self) -> String {
15968 match self {
15969 Monitor::MonitorControl => "Monitor Control",
15970 Monitor::EDIDInformation => "EDID Information",
15971 Monitor::VDIFInformation => "VDIF Information",
15972 Monitor::VESAVersion => "VESA Version",
15973 }
15974 .into()
15975 }
15976}
15977
15978#[cfg(feature = "std")]
15979impl fmt::Display for Monitor {
15980 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15981 write!(f, "{}", self.name())
15982 }
15983}
15984
15985impl AsUsage for Monitor {
15986 fn usage_value(&self) -> u32 {
15988 u32::from(self)
15989 }
15990
15991 fn usage_id_value(&self) -> u16 {
15993 u16::from(self)
15994 }
15995
15996 fn usage(&self) -> Usage {
16007 Usage::from(self)
16008 }
16009}
16010
16011impl AsUsagePage for Monitor {
16012 fn usage_page_value(&self) -> u16 {
16016 let up = UsagePage::from(self);
16017 u16::from(up)
16018 }
16019
16020 fn usage_page(&self) -> UsagePage {
16022 UsagePage::from(self)
16023 }
16024}
16025
16026impl From<&Monitor> for u16 {
16027 fn from(monitor: &Monitor) -> u16 {
16028 match *monitor {
16029 Monitor::MonitorControl => 1,
16030 Monitor::EDIDInformation => 2,
16031 Monitor::VDIFInformation => 3,
16032 Monitor::VESAVersion => 4,
16033 }
16034 }
16035}
16036
16037impl From<Monitor> for u16 {
16038 fn from(monitor: Monitor) -> u16 {
16041 u16::from(&monitor)
16042 }
16043}
16044
16045impl From<&Monitor> for u32 {
16046 fn from(monitor: &Monitor) -> u32 {
16049 let up = UsagePage::from(monitor);
16050 let up = (u16::from(&up) as u32) << 16;
16051 let id = u16::from(monitor) as u32;
16052 up | id
16053 }
16054}
16055
16056impl From<&Monitor> for UsagePage {
16057 fn from(_: &Monitor) -> UsagePage {
16060 UsagePage::Monitor
16061 }
16062}
16063
16064impl From<Monitor> for UsagePage {
16065 fn from(_: Monitor) -> UsagePage {
16068 UsagePage::Monitor
16069 }
16070}
16071
16072impl From<&Monitor> for Usage {
16073 fn from(monitor: &Monitor) -> Usage {
16074 Usage::try_from(u32::from(monitor)).unwrap()
16075 }
16076}
16077
16078impl From<Monitor> for Usage {
16079 fn from(monitor: Monitor) -> Usage {
16080 Usage::from(&monitor)
16081 }
16082}
16083
16084impl TryFrom<u16> for Monitor {
16085 type Error = HutError;
16086
16087 fn try_from(usage_id: u16) -> Result<Monitor> {
16088 match usage_id {
16089 1 => Ok(Monitor::MonitorControl),
16090 2 => Ok(Monitor::EDIDInformation),
16091 3 => Ok(Monitor::VDIFInformation),
16092 4 => Ok(Monitor::VESAVersion),
16093 n => Err(HutError::UnknownUsageId { usage_id: n }),
16094 }
16095 }
16096}
16097
16098impl BitOr<u16> for Monitor {
16099 type Output = Usage;
16100
16101 fn bitor(self, usage: u16) -> Usage {
16108 let up = u16::from(self) as u32;
16109 let u = usage as u32;
16110 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
16111 }
16112}
16113
16114#[allow(non_camel_case_types)]
16138#[derive(Debug)]
16139#[non_exhaustive]
16140pub enum MonitorEnumerated {
16141 MonitorEnumerated(u16),
16142}
16143
16144impl MonitorEnumerated {
16145 #[cfg(feature = "std")]
16146 pub fn name(&self) -> String {
16147 match self {
16148 MonitorEnumerated::MonitorEnumerated(enumerate) => format!("Enumerate {enumerate}"),
16149 }
16150 }
16151}
16152
16153#[cfg(feature = "std")]
16154impl fmt::Display for MonitorEnumerated {
16155 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16156 write!(f, "{}", self.name())
16157 }
16158}
16159
16160impl AsUsage for MonitorEnumerated {
16161 fn usage_value(&self) -> u32 {
16163 u32::from(self)
16164 }
16165
16166 fn usage_id_value(&self) -> u16 {
16168 u16::from(self)
16169 }
16170
16171 fn usage(&self) -> Usage {
16182 Usage::from(self)
16183 }
16184}
16185
16186impl AsUsagePage for MonitorEnumerated {
16187 fn usage_page_value(&self) -> u16 {
16191 let up = UsagePage::from(self);
16192 u16::from(up)
16193 }
16194
16195 fn usage_page(&self) -> UsagePage {
16197 UsagePage::from(self)
16198 }
16199}
16200
16201impl From<&MonitorEnumerated> for u16 {
16202 fn from(monitorenumerated: &MonitorEnumerated) -> u16 {
16203 match *monitorenumerated {
16204 MonitorEnumerated::MonitorEnumerated(enumerate) => enumerate,
16205 }
16206 }
16207}
16208
16209impl From<MonitorEnumerated> for u16 {
16210 fn from(monitorenumerated: MonitorEnumerated) -> u16 {
16213 u16::from(&monitorenumerated)
16214 }
16215}
16216
16217impl From<&MonitorEnumerated> for u32 {
16218 fn from(monitorenumerated: &MonitorEnumerated) -> u32 {
16221 let up = UsagePage::from(monitorenumerated);
16222 let up = (u16::from(&up) as u32) << 16;
16223 let id = u16::from(monitorenumerated) as u32;
16224 up | id
16225 }
16226}
16227
16228impl From<&MonitorEnumerated> for UsagePage {
16229 fn from(_: &MonitorEnumerated) -> UsagePage {
16232 UsagePage::MonitorEnumerated
16233 }
16234}
16235
16236impl From<MonitorEnumerated> for UsagePage {
16237 fn from(_: MonitorEnumerated) -> UsagePage {
16240 UsagePage::MonitorEnumerated
16241 }
16242}
16243
16244impl From<&MonitorEnumerated> for Usage {
16245 fn from(monitorenumerated: &MonitorEnumerated) -> Usage {
16246 Usage::try_from(u32::from(monitorenumerated)).unwrap()
16247 }
16248}
16249
16250impl From<MonitorEnumerated> for Usage {
16251 fn from(monitorenumerated: MonitorEnumerated) -> Usage {
16252 Usage::from(&monitorenumerated)
16253 }
16254}
16255
16256impl TryFrom<u16> for MonitorEnumerated {
16257 type Error = HutError;
16258
16259 fn try_from(usage_id: u16) -> Result<MonitorEnumerated> {
16260 match usage_id {
16261 n => Ok(MonitorEnumerated::MonitorEnumerated(n)),
16262 }
16263 }
16264}
16265
16266impl BitOr<u16> for MonitorEnumerated {
16267 type Output = Usage;
16268
16269 fn bitor(self, usage: u16) -> Usage {
16276 let up = u16::from(self) as u32;
16277 let u = usage as u32;
16278 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
16279 }
16280}
16281
16282#[allow(non_camel_case_types)]
16303#[derive(Debug)]
16304#[non_exhaustive]
16305pub enum VESAVirtualControls {
16306 Degauss,
16308 Brightness,
16310 Contrast,
16312 RedVideoGain,
16314 GreenVideoGain,
16316 BlueVideoGain,
16318 Focus,
16320 HorizontalPosition,
16322 HorizontalSize,
16324 HorizontalPincushion,
16326 HorizontalPincushionBalance,
16328 HorizontalMisconvergence,
16330 HorizontalLinearity,
16332 HorizontalLinearityBalance,
16334 VerticalPosition,
16336 VerticalSize,
16338 VerticalPincushion,
16340 VerticalPincushionBalance,
16342 VerticalMisconvergence,
16344 VerticalLinearity,
16346 VerticalLinearityBalance,
16348 ParallelogramDistortionKeyBalance,
16350 TrapezoidalDistortionKey,
16352 TiltRotation,
16354 TopCornerDistortionControl,
16356 TopCornerDistortionBalance,
16358 BottomCornerDistortionControl,
16360 BottomCornerDistortionBalance,
16362 HorizontalMoiré,
16364 VerticalMoiré,
16366 InputLevelSelect,
16368 InputSourceSelect,
16370 RedVideoBlackLevel,
16372 GreenVideoBlackLevel,
16374 BlueVideoBlackLevel,
16376 AutoSizeCenter,
16378 PolarityHorizontalSynchronization,
16380 PolarityVerticalSynchronization,
16382 SynchronizationType,
16384 ScreenOrientation,
16386 HorizontalFrequency,
16388 VerticalFrequency,
16390 Settings,
16392 OnScreenDisplay,
16394 StereoMode,
16396}
16397
16398impl VESAVirtualControls {
16399 #[cfg(feature = "std")]
16400 pub fn name(&self) -> String {
16401 match self {
16402 VESAVirtualControls::Degauss => "Degauss",
16403 VESAVirtualControls::Brightness => "Brightness",
16404 VESAVirtualControls::Contrast => "Contrast",
16405 VESAVirtualControls::RedVideoGain => "Red Video Gain",
16406 VESAVirtualControls::GreenVideoGain => "Green Video Gain",
16407 VESAVirtualControls::BlueVideoGain => "Blue Video Gain",
16408 VESAVirtualControls::Focus => "Focus",
16409 VESAVirtualControls::HorizontalPosition => "Horizontal Position",
16410 VESAVirtualControls::HorizontalSize => "Horizontal Size",
16411 VESAVirtualControls::HorizontalPincushion => "Horizontal Pincushion",
16412 VESAVirtualControls::HorizontalPincushionBalance => "Horizontal Pincushion Balance",
16413 VESAVirtualControls::HorizontalMisconvergence => "Horizontal Misconvergence",
16414 VESAVirtualControls::HorizontalLinearity => "Horizontal Linearity",
16415 VESAVirtualControls::HorizontalLinearityBalance => "Horizontal Linearity Balance",
16416 VESAVirtualControls::VerticalPosition => "Vertical Position",
16417 VESAVirtualControls::VerticalSize => "Vertical Size",
16418 VESAVirtualControls::VerticalPincushion => "Vertical Pincushion",
16419 VESAVirtualControls::VerticalPincushionBalance => "Vertical Pincushion Balance",
16420 VESAVirtualControls::VerticalMisconvergence => "Vertical Misconvergence",
16421 VESAVirtualControls::VerticalLinearity => "Vertical Linearity",
16422 VESAVirtualControls::VerticalLinearityBalance => "Vertical Linearity Balance",
16423 VESAVirtualControls::ParallelogramDistortionKeyBalance => {
16424 "Parallelogram Distortion (Key Balance)"
16425 }
16426 VESAVirtualControls::TrapezoidalDistortionKey => "Trapezoidal Distortion (Key)",
16427 VESAVirtualControls::TiltRotation => "Tilt (Rotation)",
16428 VESAVirtualControls::TopCornerDistortionControl => "Top Corner Distortion Control",
16429 VESAVirtualControls::TopCornerDistortionBalance => "Top Corner Distortion Balance",
16430 VESAVirtualControls::BottomCornerDistortionControl => {
16431 "Bottom Corner Distortion Control"
16432 }
16433 VESAVirtualControls::BottomCornerDistortionBalance => {
16434 "Bottom Corner Distortion Balance"
16435 }
16436 VESAVirtualControls::HorizontalMoiré => "Horizontal Moiré",
16437 VESAVirtualControls::VerticalMoiré => "Vertical Moiré",
16438 VESAVirtualControls::InputLevelSelect => "Input Level Select",
16439 VESAVirtualControls::InputSourceSelect => "Input Source Select",
16440 VESAVirtualControls::RedVideoBlackLevel => "Red Video Black Level",
16441 VESAVirtualControls::GreenVideoBlackLevel => "Green Video Black Level",
16442 VESAVirtualControls::BlueVideoBlackLevel => "Blue Video Black Level",
16443 VESAVirtualControls::AutoSizeCenter => "Auto Size Center",
16444 VESAVirtualControls::PolarityHorizontalSynchronization => {
16445 "Polarity Horizontal Synchronization"
16446 }
16447 VESAVirtualControls::PolarityVerticalSynchronization => {
16448 "Polarity Vertical Synchronization"
16449 }
16450 VESAVirtualControls::SynchronizationType => "Synchronization Type",
16451 VESAVirtualControls::ScreenOrientation => "Screen Orientation",
16452 VESAVirtualControls::HorizontalFrequency => "Horizontal Frequency",
16453 VESAVirtualControls::VerticalFrequency => "Vertical Frequency",
16454 VESAVirtualControls::Settings => "Settings",
16455 VESAVirtualControls::OnScreenDisplay => "On Screen Display",
16456 VESAVirtualControls::StereoMode => "Stereo Mode",
16457 }
16458 .into()
16459 }
16460}
16461
16462#[cfg(feature = "std")]
16463impl fmt::Display for VESAVirtualControls {
16464 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16465 write!(f, "{}", self.name())
16466 }
16467}
16468
16469impl AsUsage for VESAVirtualControls {
16470 fn usage_value(&self) -> u32 {
16472 u32::from(self)
16473 }
16474
16475 fn usage_id_value(&self) -> u16 {
16477 u16::from(self)
16478 }
16479
16480 fn usage(&self) -> Usage {
16491 Usage::from(self)
16492 }
16493}
16494
16495impl AsUsagePage for VESAVirtualControls {
16496 fn usage_page_value(&self) -> u16 {
16500 let up = UsagePage::from(self);
16501 u16::from(up)
16502 }
16503
16504 fn usage_page(&self) -> UsagePage {
16506 UsagePage::from(self)
16507 }
16508}
16509
16510impl From<&VESAVirtualControls> for u16 {
16511 fn from(vesavirtualcontrols: &VESAVirtualControls) -> u16 {
16512 match *vesavirtualcontrols {
16513 VESAVirtualControls::Degauss => 1,
16514 VESAVirtualControls::Brightness => 16,
16515 VESAVirtualControls::Contrast => 18,
16516 VESAVirtualControls::RedVideoGain => 22,
16517 VESAVirtualControls::GreenVideoGain => 24,
16518 VESAVirtualControls::BlueVideoGain => 26,
16519 VESAVirtualControls::Focus => 28,
16520 VESAVirtualControls::HorizontalPosition => 32,
16521 VESAVirtualControls::HorizontalSize => 34,
16522 VESAVirtualControls::HorizontalPincushion => 36,
16523 VESAVirtualControls::HorizontalPincushionBalance => 38,
16524 VESAVirtualControls::HorizontalMisconvergence => 40,
16525 VESAVirtualControls::HorizontalLinearity => 42,
16526 VESAVirtualControls::HorizontalLinearityBalance => 44,
16527 VESAVirtualControls::VerticalPosition => 48,
16528 VESAVirtualControls::VerticalSize => 50,
16529 VESAVirtualControls::VerticalPincushion => 52,
16530 VESAVirtualControls::VerticalPincushionBalance => 54,
16531 VESAVirtualControls::VerticalMisconvergence => 56,
16532 VESAVirtualControls::VerticalLinearity => 58,
16533 VESAVirtualControls::VerticalLinearityBalance => 60,
16534 VESAVirtualControls::ParallelogramDistortionKeyBalance => 64,
16535 VESAVirtualControls::TrapezoidalDistortionKey => 66,
16536 VESAVirtualControls::TiltRotation => 68,
16537 VESAVirtualControls::TopCornerDistortionControl => 70,
16538 VESAVirtualControls::TopCornerDistortionBalance => 72,
16539 VESAVirtualControls::BottomCornerDistortionControl => 74,
16540 VESAVirtualControls::BottomCornerDistortionBalance => 76,
16541 VESAVirtualControls::HorizontalMoiré => 86,
16542 VESAVirtualControls::VerticalMoiré => 88,
16543 VESAVirtualControls::InputLevelSelect => 94,
16544 VESAVirtualControls::InputSourceSelect => 96,
16545 VESAVirtualControls::RedVideoBlackLevel => 108,
16546 VESAVirtualControls::GreenVideoBlackLevel => 110,
16547 VESAVirtualControls::BlueVideoBlackLevel => 112,
16548 VESAVirtualControls::AutoSizeCenter => 162,
16549 VESAVirtualControls::PolarityHorizontalSynchronization => 164,
16550 VESAVirtualControls::PolarityVerticalSynchronization => 166,
16551 VESAVirtualControls::SynchronizationType => 168,
16552 VESAVirtualControls::ScreenOrientation => 170,
16553 VESAVirtualControls::HorizontalFrequency => 172,
16554 VESAVirtualControls::VerticalFrequency => 174,
16555 VESAVirtualControls::Settings => 176,
16556 VESAVirtualControls::OnScreenDisplay => 202,
16557 VESAVirtualControls::StereoMode => 212,
16558 }
16559 }
16560}
16561
16562impl From<VESAVirtualControls> for u16 {
16563 fn from(vesavirtualcontrols: VESAVirtualControls) -> u16 {
16566 u16::from(&vesavirtualcontrols)
16567 }
16568}
16569
16570impl From<&VESAVirtualControls> for u32 {
16571 fn from(vesavirtualcontrols: &VESAVirtualControls) -> u32 {
16574 let up = UsagePage::from(vesavirtualcontrols);
16575 let up = (u16::from(&up) as u32) << 16;
16576 let id = u16::from(vesavirtualcontrols) as u32;
16577 up | id
16578 }
16579}
16580
16581impl From<&VESAVirtualControls> for UsagePage {
16582 fn from(_: &VESAVirtualControls) -> UsagePage {
16585 UsagePage::VESAVirtualControls
16586 }
16587}
16588
16589impl From<VESAVirtualControls> for UsagePage {
16590 fn from(_: VESAVirtualControls) -> UsagePage {
16593 UsagePage::VESAVirtualControls
16594 }
16595}
16596
16597impl From<&VESAVirtualControls> for Usage {
16598 fn from(vesavirtualcontrols: &VESAVirtualControls) -> Usage {
16599 Usage::try_from(u32::from(vesavirtualcontrols)).unwrap()
16600 }
16601}
16602
16603impl From<VESAVirtualControls> for Usage {
16604 fn from(vesavirtualcontrols: VESAVirtualControls) -> Usage {
16605 Usage::from(&vesavirtualcontrols)
16606 }
16607}
16608
16609impl TryFrom<u16> for VESAVirtualControls {
16610 type Error = HutError;
16611
16612 fn try_from(usage_id: u16) -> Result<VESAVirtualControls> {
16613 match usage_id {
16614 1 => Ok(VESAVirtualControls::Degauss),
16615 16 => Ok(VESAVirtualControls::Brightness),
16616 18 => Ok(VESAVirtualControls::Contrast),
16617 22 => Ok(VESAVirtualControls::RedVideoGain),
16618 24 => Ok(VESAVirtualControls::GreenVideoGain),
16619 26 => Ok(VESAVirtualControls::BlueVideoGain),
16620 28 => Ok(VESAVirtualControls::Focus),
16621 32 => Ok(VESAVirtualControls::HorizontalPosition),
16622 34 => Ok(VESAVirtualControls::HorizontalSize),
16623 36 => Ok(VESAVirtualControls::HorizontalPincushion),
16624 38 => Ok(VESAVirtualControls::HorizontalPincushionBalance),
16625 40 => Ok(VESAVirtualControls::HorizontalMisconvergence),
16626 42 => Ok(VESAVirtualControls::HorizontalLinearity),
16627 44 => Ok(VESAVirtualControls::HorizontalLinearityBalance),
16628 48 => Ok(VESAVirtualControls::VerticalPosition),
16629 50 => Ok(VESAVirtualControls::VerticalSize),
16630 52 => Ok(VESAVirtualControls::VerticalPincushion),
16631 54 => Ok(VESAVirtualControls::VerticalPincushionBalance),
16632 56 => Ok(VESAVirtualControls::VerticalMisconvergence),
16633 58 => Ok(VESAVirtualControls::VerticalLinearity),
16634 60 => Ok(VESAVirtualControls::VerticalLinearityBalance),
16635 64 => Ok(VESAVirtualControls::ParallelogramDistortionKeyBalance),
16636 66 => Ok(VESAVirtualControls::TrapezoidalDistortionKey),
16637 68 => Ok(VESAVirtualControls::TiltRotation),
16638 70 => Ok(VESAVirtualControls::TopCornerDistortionControl),
16639 72 => Ok(VESAVirtualControls::TopCornerDistortionBalance),
16640 74 => Ok(VESAVirtualControls::BottomCornerDistortionControl),
16641 76 => Ok(VESAVirtualControls::BottomCornerDistortionBalance),
16642 86 => Ok(VESAVirtualControls::HorizontalMoiré),
16643 88 => Ok(VESAVirtualControls::VerticalMoiré),
16644 94 => Ok(VESAVirtualControls::InputLevelSelect),
16645 96 => Ok(VESAVirtualControls::InputSourceSelect),
16646 108 => Ok(VESAVirtualControls::RedVideoBlackLevel),
16647 110 => Ok(VESAVirtualControls::GreenVideoBlackLevel),
16648 112 => Ok(VESAVirtualControls::BlueVideoBlackLevel),
16649 162 => Ok(VESAVirtualControls::AutoSizeCenter),
16650 164 => Ok(VESAVirtualControls::PolarityHorizontalSynchronization),
16651 166 => Ok(VESAVirtualControls::PolarityVerticalSynchronization),
16652 168 => Ok(VESAVirtualControls::SynchronizationType),
16653 170 => Ok(VESAVirtualControls::ScreenOrientation),
16654 172 => Ok(VESAVirtualControls::HorizontalFrequency),
16655 174 => Ok(VESAVirtualControls::VerticalFrequency),
16656 176 => Ok(VESAVirtualControls::Settings),
16657 202 => Ok(VESAVirtualControls::OnScreenDisplay),
16658 212 => Ok(VESAVirtualControls::StereoMode),
16659 n => Err(HutError::UnknownUsageId { usage_id: n }),
16660 }
16661 }
16662}
16663
16664impl BitOr<u16> for VESAVirtualControls {
16665 type Output = Usage;
16666
16667 fn bitor(self, usage: u16) -> Usage {
16674 let up = u16::from(self) as u32;
16675 let u = usage as u32;
16676 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
16677 }
16678}
16679
16680#[allow(non_camel_case_types)]
16701#[derive(Debug)]
16702#[non_exhaustive]
16703pub enum Power {
16704 iName,
16706 PresentStatus,
16708 ChangedStatus,
16710 UPS,
16712 PowerSupply,
16714 BatterySystem,
16716 BatterySystemId,
16718 Battery,
16720 BatteryId,
16722 Charger,
16724 ChargerId,
16726 PowerConverter,
16728 PowerConverterId,
16730 OutletSystem,
16732 OutletSystemId,
16734 Input,
16736 InputId,
16738 Output,
16740 OutputId,
16742 Flow,
16744 FlowId,
16746 Outlet,
16748 OutletId,
16750 Gang,
16752 GangId,
16754 PowerSummary,
16756 PowerSummaryId,
16758 Voltage,
16760 Current,
16762 Frequency,
16764 ApparentPower,
16766 ActivePower,
16768 PercentLoad,
16770 Temperature,
16772 Humidity,
16774 BadCount,
16776 ConfigVoltage,
16778 ConfigCurrent,
16780 ConfigFrequency,
16782 ConfigApparentPower,
16784 ConfigActivePower,
16786 ConfigPercentLoad,
16788 ConfigTemperature,
16790 ConfigHumidity,
16792 SwitchOnControl,
16794 SwitchOffControl,
16796 ToggleControl,
16798 LowVoltageTransfer,
16800 HighVoltageTransfer,
16802 DelayBeforeReboot,
16804 DelayBeforeStartup,
16806 DelayBeforeShutdown,
16808 Test,
16810 ModuleReset,
16812 AudibleAlarmControl,
16814 Present,
16816 Good,
16818 InternalFailure,
16820 VoltagOutOfRange,
16822 FrequencyOutOfRange,
16824 Overload,
16826 OverCharged,
16828 OverTemperature,
16830 ShutdownRequested,
16832 ShutdownImminent,
16834 SwitchOnOff,
16836 Switchable,
16838 Used,
16840 Boost,
16842 Buck,
16844 Initialized,
16846 Tested,
16848 AwaitingPower,
16850 CommunicationLost,
16852 iManufacturer,
16854 iProduct,
16856 iSerialNumber,
16858}
16859
16860impl Power {
16861 #[cfg(feature = "std")]
16862 pub fn name(&self) -> String {
16863 match self {
16864 Power::iName => "iName",
16865 Power::PresentStatus => "Present Status",
16866 Power::ChangedStatus => "Changed Status",
16867 Power::UPS => "UPS",
16868 Power::PowerSupply => "Power Supply",
16869 Power::BatterySystem => "Battery System",
16870 Power::BatterySystemId => "Battery System Id",
16871 Power::Battery => "Battery",
16872 Power::BatteryId => "Battery Id",
16873 Power::Charger => "Charger",
16874 Power::ChargerId => "Charger Id",
16875 Power::PowerConverter => "Power Converter",
16876 Power::PowerConverterId => "Power Converter Id",
16877 Power::OutletSystem => "Outlet System",
16878 Power::OutletSystemId => "Outlet System Id",
16879 Power::Input => "Input",
16880 Power::InputId => "Input Id",
16881 Power::Output => "Output",
16882 Power::OutputId => "Output Id",
16883 Power::Flow => "Flow",
16884 Power::FlowId => "Flow Id",
16885 Power::Outlet => "Outlet",
16886 Power::OutletId => "Outlet Id",
16887 Power::Gang => "Gang",
16888 Power::GangId => "Gang Id",
16889 Power::PowerSummary => "Power Summary",
16890 Power::PowerSummaryId => "Power Summary Id",
16891 Power::Voltage => "Voltage",
16892 Power::Current => "Current",
16893 Power::Frequency => "Frequency",
16894 Power::ApparentPower => "Apparent Power",
16895 Power::ActivePower => "Active Power",
16896 Power::PercentLoad => "Percent Load",
16897 Power::Temperature => "Temperature",
16898 Power::Humidity => "Humidity",
16899 Power::BadCount => "Bad Count",
16900 Power::ConfigVoltage => "Config Voltage",
16901 Power::ConfigCurrent => "Config Current",
16902 Power::ConfigFrequency => "Config Frequency",
16903 Power::ConfigApparentPower => "Config Apparent Power",
16904 Power::ConfigActivePower => "Config Active Power",
16905 Power::ConfigPercentLoad => "Config Percent Load",
16906 Power::ConfigTemperature => "Config Temperature",
16907 Power::ConfigHumidity => "Config Humidity",
16908 Power::SwitchOnControl => "Switch On Control",
16909 Power::SwitchOffControl => "Switch Off Control",
16910 Power::ToggleControl => "Toggle Control",
16911 Power::LowVoltageTransfer => "Low Voltage Transfer",
16912 Power::HighVoltageTransfer => "High Voltage Transfer",
16913 Power::DelayBeforeReboot => "Delay Before Reboot",
16914 Power::DelayBeforeStartup => "Delay Before Startup",
16915 Power::DelayBeforeShutdown => "Delay Before Shutdown",
16916 Power::Test => "Test",
16917 Power::ModuleReset => "Module Reset",
16918 Power::AudibleAlarmControl => "Audible Alarm Control",
16919 Power::Present => "Present",
16920 Power::Good => "Good",
16921 Power::InternalFailure => "Internal Failure",
16922 Power::VoltagOutOfRange => "Voltag Out Of Range",
16923 Power::FrequencyOutOfRange => "Frequency Out Of Range",
16924 Power::Overload => "Overload",
16925 Power::OverCharged => "Over Charged",
16926 Power::OverTemperature => "Over Temperature",
16927 Power::ShutdownRequested => "Shutdown Requested",
16928 Power::ShutdownImminent => "Shutdown Imminent",
16929 Power::SwitchOnOff => "Switch On/Off",
16930 Power::Switchable => "Switchable",
16931 Power::Used => "Used",
16932 Power::Boost => "Boost",
16933 Power::Buck => "Buck",
16934 Power::Initialized => "Initialized",
16935 Power::Tested => "Tested",
16936 Power::AwaitingPower => "Awaiting Power",
16937 Power::CommunicationLost => "Communication Lost",
16938 Power::iManufacturer => "iManufacturer",
16939 Power::iProduct => "iProduct",
16940 Power::iSerialNumber => "iSerialNumber",
16941 }
16942 .into()
16943 }
16944}
16945
16946#[cfg(feature = "std")]
16947impl fmt::Display for Power {
16948 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16949 write!(f, "{}", self.name())
16950 }
16951}
16952
16953impl AsUsage for Power {
16954 fn usage_value(&self) -> u32 {
16956 u32::from(self)
16957 }
16958
16959 fn usage_id_value(&self) -> u16 {
16961 u16::from(self)
16962 }
16963
16964 fn usage(&self) -> Usage {
16975 Usage::from(self)
16976 }
16977}
16978
16979impl AsUsagePage for Power {
16980 fn usage_page_value(&self) -> u16 {
16984 let up = UsagePage::from(self);
16985 u16::from(up)
16986 }
16987
16988 fn usage_page(&self) -> UsagePage {
16990 UsagePage::from(self)
16991 }
16992}
16993
16994impl From<&Power> for u16 {
16995 fn from(power: &Power) -> u16 {
16996 match *power {
16997 Power::iName => 1,
16998 Power::PresentStatus => 2,
16999 Power::ChangedStatus => 3,
17000 Power::UPS => 4,
17001 Power::PowerSupply => 5,
17002 Power::BatterySystem => 16,
17003 Power::BatterySystemId => 17,
17004 Power::Battery => 18,
17005 Power::BatteryId => 19,
17006 Power::Charger => 20,
17007 Power::ChargerId => 21,
17008 Power::PowerConverter => 22,
17009 Power::PowerConverterId => 23,
17010 Power::OutletSystem => 24,
17011 Power::OutletSystemId => 25,
17012 Power::Input => 26,
17013 Power::InputId => 27,
17014 Power::Output => 28,
17015 Power::OutputId => 29,
17016 Power::Flow => 30,
17017 Power::FlowId => 31,
17018 Power::Outlet => 32,
17019 Power::OutletId => 33,
17020 Power::Gang => 34,
17021 Power::GangId => 35,
17022 Power::PowerSummary => 36,
17023 Power::PowerSummaryId => 37,
17024 Power::Voltage => 48,
17025 Power::Current => 49,
17026 Power::Frequency => 50,
17027 Power::ApparentPower => 51,
17028 Power::ActivePower => 52,
17029 Power::PercentLoad => 53,
17030 Power::Temperature => 54,
17031 Power::Humidity => 55,
17032 Power::BadCount => 56,
17033 Power::ConfigVoltage => 64,
17034 Power::ConfigCurrent => 65,
17035 Power::ConfigFrequency => 66,
17036 Power::ConfigApparentPower => 67,
17037 Power::ConfigActivePower => 68,
17038 Power::ConfigPercentLoad => 69,
17039 Power::ConfigTemperature => 70,
17040 Power::ConfigHumidity => 71,
17041 Power::SwitchOnControl => 80,
17042 Power::SwitchOffControl => 81,
17043 Power::ToggleControl => 82,
17044 Power::LowVoltageTransfer => 83,
17045 Power::HighVoltageTransfer => 84,
17046 Power::DelayBeforeReboot => 85,
17047 Power::DelayBeforeStartup => 86,
17048 Power::DelayBeforeShutdown => 87,
17049 Power::Test => 88,
17050 Power::ModuleReset => 89,
17051 Power::AudibleAlarmControl => 90,
17052 Power::Present => 96,
17053 Power::Good => 97,
17054 Power::InternalFailure => 98,
17055 Power::VoltagOutOfRange => 99,
17056 Power::FrequencyOutOfRange => 100,
17057 Power::Overload => 101,
17058 Power::OverCharged => 102,
17059 Power::OverTemperature => 103,
17060 Power::ShutdownRequested => 104,
17061 Power::ShutdownImminent => 105,
17062 Power::SwitchOnOff => 107,
17063 Power::Switchable => 108,
17064 Power::Used => 109,
17065 Power::Boost => 110,
17066 Power::Buck => 111,
17067 Power::Initialized => 112,
17068 Power::Tested => 113,
17069 Power::AwaitingPower => 114,
17070 Power::CommunicationLost => 115,
17071 Power::iManufacturer => 253,
17072 Power::iProduct => 254,
17073 Power::iSerialNumber => 255,
17074 }
17075 }
17076}
17077
17078impl From<Power> for u16 {
17079 fn from(power: Power) -> u16 {
17082 u16::from(&power)
17083 }
17084}
17085
17086impl From<&Power> for u32 {
17087 fn from(power: &Power) -> u32 {
17090 let up = UsagePage::from(power);
17091 let up = (u16::from(&up) as u32) << 16;
17092 let id = u16::from(power) as u32;
17093 up | id
17094 }
17095}
17096
17097impl From<&Power> for UsagePage {
17098 fn from(_: &Power) -> UsagePage {
17101 UsagePage::Power
17102 }
17103}
17104
17105impl From<Power> for UsagePage {
17106 fn from(_: Power) -> UsagePage {
17109 UsagePage::Power
17110 }
17111}
17112
17113impl From<&Power> for Usage {
17114 fn from(power: &Power) -> Usage {
17115 Usage::try_from(u32::from(power)).unwrap()
17116 }
17117}
17118
17119impl From<Power> for Usage {
17120 fn from(power: Power) -> Usage {
17121 Usage::from(&power)
17122 }
17123}
17124
17125impl TryFrom<u16> for Power {
17126 type Error = HutError;
17127
17128 fn try_from(usage_id: u16) -> Result<Power> {
17129 match usage_id {
17130 1 => Ok(Power::iName),
17131 2 => Ok(Power::PresentStatus),
17132 3 => Ok(Power::ChangedStatus),
17133 4 => Ok(Power::UPS),
17134 5 => Ok(Power::PowerSupply),
17135 16 => Ok(Power::BatterySystem),
17136 17 => Ok(Power::BatterySystemId),
17137 18 => Ok(Power::Battery),
17138 19 => Ok(Power::BatteryId),
17139 20 => Ok(Power::Charger),
17140 21 => Ok(Power::ChargerId),
17141 22 => Ok(Power::PowerConverter),
17142 23 => Ok(Power::PowerConverterId),
17143 24 => Ok(Power::OutletSystem),
17144 25 => Ok(Power::OutletSystemId),
17145 26 => Ok(Power::Input),
17146 27 => Ok(Power::InputId),
17147 28 => Ok(Power::Output),
17148 29 => Ok(Power::OutputId),
17149 30 => Ok(Power::Flow),
17150 31 => Ok(Power::FlowId),
17151 32 => Ok(Power::Outlet),
17152 33 => Ok(Power::OutletId),
17153 34 => Ok(Power::Gang),
17154 35 => Ok(Power::GangId),
17155 36 => Ok(Power::PowerSummary),
17156 37 => Ok(Power::PowerSummaryId),
17157 48 => Ok(Power::Voltage),
17158 49 => Ok(Power::Current),
17159 50 => Ok(Power::Frequency),
17160 51 => Ok(Power::ApparentPower),
17161 52 => Ok(Power::ActivePower),
17162 53 => Ok(Power::PercentLoad),
17163 54 => Ok(Power::Temperature),
17164 55 => Ok(Power::Humidity),
17165 56 => Ok(Power::BadCount),
17166 64 => Ok(Power::ConfigVoltage),
17167 65 => Ok(Power::ConfigCurrent),
17168 66 => Ok(Power::ConfigFrequency),
17169 67 => Ok(Power::ConfigApparentPower),
17170 68 => Ok(Power::ConfigActivePower),
17171 69 => Ok(Power::ConfigPercentLoad),
17172 70 => Ok(Power::ConfigTemperature),
17173 71 => Ok(Power::ConfigHumidity),
17174 80 => Ok(Power::SwitchOnControl),
17175 81 => Ok(Power::SwitchOffControl),
17176 82 => Ok(Power::ToggleControl),
17177 83 => Ok(Power::LowVoltageTransfer),
17178 84 => Ok(Power::HighVoltageTransfer),
17179 85 => Ok(Power::DelayBeforeReboot),
17180 86 => Ok(Power::DelayBeforeStartup),
17181 87 => Ok(Power::DelayBeforeShutdown),
17182 88 => Ok(Power::Test),
17183 89 => Ok(Power::ModuleReset),
17184 90 => Ok(Power::AudibleAlarmControl),
17185 96 => Ok(Power::Present),
17186 97 => Ok(Power::Good),
17187 98 => Ok(Power::InternalFailure),
17188 99 => Ok(Power::VoltagOutOfRange),
17189 100 => Ok(Power::FrequencyOutOfRange),
17190 101 => Ok(Power::Overload),
17191 102 => Ok(Power::OverCharged),
17192 103 => Ok(Power::OverTemperature),
17193 104 => Ok(Power::ShutdownRequested),
17194 105 => Ok(Power::ShutdownImminent),
17195 107 => Ok(Power::SwitchOnOff),
17196 108 => Ok(Power::Switchable),
17197 109 => Ok(Power::Used),
17198 110 => Ok(Power::Boost),
17199 111 => Ok(Power::Buck),
17200 112 => Ok(Power::Initialized),
17201 113 => Ok(Power::Tested),
17202 114 => Ok(Power::AwaitingPower),
17203 115 => Ok(Power::CommunicationLost),
17204 253 => Ok(Power::iManufacturer),
17205 254 => Ok(Power::iProduct),
17206 255 => Ok(Power::iSerialNumber),
17207 n => Err(HutError::UnknownUsageId { usage_id: n }),
17208 }
17209 }
17210}
17211
17212impl BitOr<u16> for Power {
17213 type Output = Usage;
17214
17215 fn bitor(self, usage: u16) -> Usage {
17222 let up = u16::from(self) as u32;
17223 let u = usage as u32;
17224 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
17225 }
17226}
17227
17228#[allow(non_camel_case_types)]
17249#[derive(Debug)]
17250#[non_exhaustive]
17251pub enum BatterySystem {
17252 SmartBatteryBatteryMode,
17254 SmartBatteryBatteryStatus,
17256 SmartBatteryAlarmWarning,
17258 SmartBatteryChargerMode,
17260 SmartBatteryChargerStatus,
17262 SmartBatteryChargerSpecInfo,
17264 SmartBatterySelectorState,
17266 SmartBatterySelectorPresets,
17268 SmartBatterySelectorInfo,
17270 OptionalMfgFunction1,
17272 OptionalMfgFunction2,
17274 OptionalMfgFunction3,
17276 OptionalMfgFunction4,
17278 OptionalMfgFunction5,
17280 ConnectionToSMBus,
17282 OutputConnection,
17284 ChargerConnection,
17286 BatteryInsertion,
17288 UseNext,
17290 OKToUse,
17292 BatterySupported,
17294 SelectorRevision,
17296 ChargingIndicator,
17298 ManufacturerAccess,
17300 RemainingCapacityLimit,
17302 RemainingTimeLimit,
17304 AtRate,
17306 CapacityMode,
17308 BroadcastToCharger,
17310 PrimaryBattery,
17312 ChargeController,
17314 TerminateCharge,
17316 TerminateDischarge,
17318 BelowRemainingCapacityLimit,
17320 RemainingTimeLimitExpired,
17322 Charging,
17324 Discharging,
17326 FullyCharged,
17328 FullyDischarged,
17330 ConditioningFlag,
17332 AtRateOK,
17334 SmartBatteryErrorCode,
17336 NeedReplacement,
17338 AtRateTimeToFull,
17340 AtRateTimeToEmpty,
17342 AverageCurrent,
17344 MaxError,
17346 RelativeStateOfCharge,
17348 AbsoluteStateOfCharge,
17350 RemainingCapacity,
17352 FullChargeCapacity,
17354 RunTimeToEmpty,
17356 AverageTimeToEmpty,
17358 AverageTimeToFull,
17360 CycleCount,
17362 BatteryPackModelLevel,
17364 InternalChargeController,
17366 PrimaryBatterySupport,
17368 DesignCapacity,
17370 SpecificationInfo,
17372 ManufactureDate,
17374 SerialNumber,
17376 iManufacturerName,
17378 iDeviceName,
17380 iDeviceChemistry,
17382 ManufacturerData,
17384 Rechargable,
17386 WarningCapacityLimit,
17388 CapacityGranularity1,
17390 CapacityGranularity2,
17392 iOEMInformation,
17394 InhibitCharge,
17396 EnablePolling,
17398 ResetToZero,
17400 ACPresent,
17402 BatteryPresent,
17404 PowerFail,
17406 AlarmInhibited,
17408 ThermistorUnderRange,
17410 ThermistorHot,
17412 ThermistorCold,
17414 ThermistorOverRange,
17416 VoltageOutOfRange,
17418 CurrentOutOfRange,
17420 CurrentNotRegulated,
17422 VoltageNotRegulated,
17424 MasterMode,
17426 ChargerSelectorSupport,
17428 ChargerSpec,
17430 Level2,
17432 Level3,
17434}
17435
17436impl BatterySystem {
17437 #[cfg(feature = "std")]
17438 pub fn name(&self) -> String {
17439 match self {
17440 BatterySystem::SmartBatteryBatteryMode => "Smart Battery Battery Mode",
17441 BatterySystem::SmartBatteryBatteryStatus => "Smart Battery Battery Status",
17442 BatterySystem::SmartBatteryAlarmWarning => "Smart Battery Alarm Warning",
17443 BatterySystem::SmartBatteryChargerMode => "Smart Battery Charger Mode",
17444 BatterySystem::SmartBatteryChargerStatus => "Smart Battery Charger Status",
17445 BatterySystem::SmartBatteryChargerSpecInfo => "Smart Battery Charger Spec Info",
17446 BatterySystem::SmartBatterySelectorState => "Smart Battery Selector State",
17447 BatterySystem::SmartBatterySelectorPresets => "Smart Battery Selector Presets",
17448 BatterySystem::SmartBatterySelectorInfo => "Smart Battery Selector Info",
17449 BatterySystem::OptionalMfgFunction1 => "Optional Mfg Function 1",
17450 BatterySystem::OptionalMfgFunction2 => "Optional Mfg Function 2",
17451 BatterySystem::OptionalMfgFunction3 => "Optional Mfg Function 3",
17452 BatterySystem::OptionalMfgFunction4 => "Optional Mfg Function 4",
17453 BatterySystem::OptionalMfgFunction5 => "Optional Mfg Function 5",
17454 BatterySystem::ConnectionToSMBus => "Connection To SM Bus",
17455 BatterySystem::OutputConnection => "Output Connection",
17456 BatterySystem::ChargerConnection => "Charger Connection",
17457 BatterySystem::BatteryInsertion => "Battery Insertion",
17458 BatterySystem::UseNext => "Use Next",
17459 BatterySystem::OKToUse => "OK To Use",
17460 BatterySystem::BatterySupported => "Battery Supported",
17461 BatterySystem::SelectorRevision => "Selector Revision",
17462 BatterySystem::ChargingIndicator => "Charging Indicator",
17463 BatterySystem::ManufacturerAccess => "Manufacturer Access",
17464 BatterySystem::RemainingCapacityLimit => "Remaining Capacity Limit",
17465 BatterySystem::RemainingTimeLimit => "Remaining Time Limit",
17466 BatterySystem::AtRate => "At Rate",
17467 BatterySystem::CapacityMode => "Capacity Mode",
17468 BatterySystem::BroadcastToCharger => "Broadcast To Charger",
17469 BatterySystem::PrimaryBattery => "Primary Battery",
17470 BatterySystem::ChargeController => "Charge Controller",
17471 BatterySystem::TerminateCharge => "Terminate Charge",
17472 BatterySystem::TerminateDischarge => "Terminate Discharge",
17473 BatterySystem::BelowRemainingCapacityLimit => "Below Remaining Capacity Limit",
17474 BatterySystem::RemainingTimeLimitExpired => "Remaining Time Limit Expired",
17475 BatterySystem::Charging => "Charging",
17476 BatterySystem::Discharging => "Discharging",
17477 BatterySystem::FullyCharged => "Fully Charged",
17478 BatterySystem::FullyDischarged => "Fully Discharged",
17479 BatterySystem::ConditioningFlag => "Conditioning Flag",
17480 BatterySystem::AtRateOK => "At Rate OK",
17481 BatterySystem::SmartBatteryErrorCode => "Smart Battery Error Code",
17482 BatterySystem::NeedReplacement => "Need Replacement",
17483 BatterySystem::AtRateTimeToFull => "At Rate Time To Full",
17484 BatterySystem::AtRateTimeToEmpty => "At Rate Time To Empty",
17485 BatterySystem::AverageCurrent => "Average Current",
17486 BatterySystem::MaxError => "Max Error",
17487 BatterySystem::RelativeStateOfCharge => "Relative State Of Charge",
17488 BatterySystem::AbsoluteStateOfCharge => "Absolute State Of Charge",
17489 BatterySystem::RemainingCapacity => "Remaining Capacity",
17490 BatterySystem::FullChargeCapacity => "Full Charge Capacity",
17491 BatterySystem::RunTimeToEmpty => "Run Time To Empty",
17492 BatterySystem::AverageTimeToEmpty => "Average Time To Empty",
17493 BatterySystem::AverageTimeToFull => "Average Time To Full",
17494 BatterySystem::CycleCount => "Cycle Count",
17495 BatterySystem::BatteryPackModelLevel => "Battery Pack Model Level",
17496 BatterySystem::InternalChargeController => "Internal Charge Controller",
17497 BatterySystem::PrimaryBatterySupport => "Primary Battery Support",
17498 BatterySystem::DesignCapacity => "Design Capacity",
17499 BatterySystem::SpecificationInfo => "Specification Info",
17500 BatterySystem::ManufactureDate => "Manufacture Date",
17501 BatterySystem::SerialNumber => "Serial Number",
17502 BatterySystem::iManufacturerName => "iManufacturer Name",
17503 BatterySystem::iDeviceName => "iDevice Name",
17504 BatterySystem::iDeviceChemistry => "iDevice Chemistry",
17505 BatterySystem::ManufacturerData => "Manufacturer Data",
17506 BatterySystem::Rechargable => "Rechargable",
17507 BatterySystem::WarningCapacityLimit => "Warning Capacity Limit",
17508 BatterySystem::CapacityGranularity1 => "Capacity Granularity 1",
17509 BatterySystem::CapacityGranularity2 => "Capacity Granularity 2",
17510 BatterySystem::iOEMInformation => "iOEM Information",
17511 BatterySystem::InhibitCharge => "Inhibit Charge",
17512 BatterySystem::EnablePolling => "Enable Polling",
17513 BatterySystem::ResetToZero => "Reset To Zero",
17514 BatterySystem::ACPresent => "AC Present",
17515 BatterySystem::BatteryPresent => "Battery Present",
17516 BatterySystem::PowerFail => "Power Fail",
17517 BatterySystem::AlarmInhibited => "Alarm Inhibited",
17518 BatterySystem::ThermistorUnderRange => "Thermistor Under Range",
17519 BatterySystem::ThermistorHot => "Thermistor Hot",
17520 BatterySystem::ThermistorCold => "Thermistor Cold",
17521 BatterySystem::ThermistorOverRange => "Thermistor Over Range",
17522 BatterySystem::VoltageOutOfRange => "Voltage Out Of Range",
17523 BatterySystem::CurrentOutOfRange => "Current Out Of Range",
17524 BatterySystem::CurrentNotRegulated => "Current Not Regulated",
17525 BatterySystem::VoltageNotRegulated => "Voltage Not Regulated",
17526 BatterySystem::MasterMode => "Master Mode",
17527 BatterySystem::ChargerSelectorSupport => "Charger Selector Support",
17528 BatterySystem::ChargerSpec => "Charger Spec",
17529 BatterySystem::Level2 => "Level 2",
17530 BatterySystem::Level3 => "Level 3",
17531 }
17532 .into()
17533 }
17534}
17535
17536#[cfg(feature = "std")]
17537impl fmt::Display for BatterySystem {
17538 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
17539 write!(f, "{}", self.name())
17540 }
17541}
17542
17543impl AsUsage for BatterySystem {
17544 fn usage_value(&self) -> u32 {
17546 u32::from(self)
17547 }
17548
17549 fn usage_id_value(&self) -> u16 {
17551 u16::from(self)
17552 }
17553
17554 fn usage(&self) -> Usage {
17565 Usage::from(self)
17566 }
17567}
17568
17569impl AsUsagePage for BatterySystem {
17570 fn usage_page_value(&self) -> u16 {
17574 let up = UsagePage::from(self);
17575 u16::from(up)
17576 }
17577
17578 fn usage_page(&self) -> UsagePage {
17580 UsagePage::from(self)
17581 }
17582}
17583
17584impl From<&BatterySystem> for u16 {
17585 fn from(batterysystem: &BatterySystem) -> u16 {
17586 match *batterysystem {
17587 BatterySystem::SmartBatteryBatteryMode => 1,
17588 BatterySystem::SmartBatteryBatteryStatus => 2,
17589 BatterySystem::SmartBatteryAlarmWarning => 3,
17590 BatterySystem::SmartBatteryChargerMode => 4,
17591 BatterySystem::SmartBatteryChargerStatus => 5,
17592 BatterySystem::SmartBatteryChargerSpecInfo => 6,
17593 BatterySystem::SmartBatterySelectorState => 7,
17594 BatterySystem::SmartBatterySelectorPresets => 8,
17595 BatterySystem::SmartBatterySelectorInfo => 9,
17596 BatterySystem::OptionalMfgFunction1 => 16,
17597 BatterySystem::OptionalMfgFunction2 => 17,
17598 BatterySystem::OptionalMfgFunction3 => 18,
17599 BatterySystem::OptionalMfgFunction4 => 19,
17600 BatterySystem::OptionalMfgFunction5 => 20,
17601 BatterySystem::ConnectionToSMBus => 21,
17602 BatterySystem::OutputConnection => 22,
17603 BatterySystem::ChargerConnection => 23,
17604 BatterySystem::BatteryInsertion => 24,
17605 BatterySystem::UseNext => 25,
17606 BatterySystem::OKToUse => 26,
17607 BatterySystem::BatterySupported => 27,
17608 BatterySystem::SelectorRevision => 28,
17609 BatterySystem::ChargingIndicator => 29,
17610 BatterySystem::ManufacturerAccess => 40,
17611 BatterySystem::RemainingCapacityLimit => 41,
17612 BatterySystem::RemainingTimeLimit => 42,
17613 BatterySystem::AtRate => 43,
17614 BatterySystem::CapacityMode => 44,
17615 BatterySystem::BroadcastToCharger => 45,
17616 BatterySystem::PrimaryBattery => 46,
17617 BatterySystem::ChargeController => 47,
17618 BatterySystem::TerminateCharge => 64,
17619 BatterySystem::TerminateDischarge => 65,
17620 BatterySystem::BelowRemainingCapacityLimit => 66,
17621 BatterySystem::RemainingTimeLimitExpired => 67,
17622 BatterySystem::Charging => 68,
17623 BatterySystem::Discharging => 69,
17624 BatterySystem::FullyCharged => 70,
17625 BatterySystem::FullyDischarged => 71,
17626 BatterySystem::ConditioningFlag => 72,
17627 BatterySystem::AtRateOK => 73,
17628 BatterySystem::SmartBatteryErrorCode => 74,
17629 BatterySystem::NeedReplacement => 75,
17630 BatterySystem::AtRateTimeToFull => 96,
17631 BatterySystem::AtRateTimeToEmpty => 97,
17632 BatterySystem::AverageCurrent => 98,
17633 BatterySystem::MaxError => 99,
17634 BatterySystem::RelativeStateOfCharge => 100,
17635 BatterySystem::AbsoluteStateOfCharge => 101,
17636 BatterySystem::RemainingCapacity => 102,
17637 BatterySystem::FullChargeCapacity => 103,
17638 BatterySystem::RunTimeToEmpty => 104,
17639 BatterySystem::AverageTimeToEmpty => 105,
17640 BatterySystem::AverageTimeToFull => 106,
17641 BatterySystem::CycleCount => 107,
17642 BatterySystem::BatteryPackModelLevel => 128,
17643 BatterySystem::InternalChargeController => 129,
17644 BatterySystem::PrimaryBatterySupport => 130,
17645 BatterySystem::DesignCapacity => 131,
17646 BatterySystem::SpecificationInfo => 132,
17647 BatterySystem::ManufactureDate => 133,
17648 BatterySystem::SerialNumber => 134,
17649 BatterySystem::iManufacturerName => 135,
17650 BatterySystem::iDeviceName => 136,
17651 BatterySystem::iDeviceChemistry => 137,
17652 BatterySystem::ManufacturerData => 138,
17653 BatterySystem::Rechargable => 139,
17654 BatterySystem::WarningCapacityLimit => 140,
17655 BatterySystem::CapacityGranularity1 => 141,
17656 BatterySystem::CapacityGranularity2 => 142,
17657 BatterySystem::iOEMInformation => 143,
17658 BatterySystem::InhibitCharge => 192,
17659 BatterySystem::EnablePolling => 193,
17660 BatterySystem::ResetToZero => 194,
17661 BatterySystem::ACPresent => 208,
17662 BatterySystem::BatteryPresent => 209,
17663 BatterySystem::PowerFail => 210,
17664 BatterySystem::AlarmInhibited => 211,
17665 BatterySystem::ThermistorUnderRange => 212,
17666 BatterySystem::ThermistorHot => 213,
17667 BatterySystem::ThermistorCold => 214,
17668 BatterySystem::ThermistorOverRange => 215,
17669 BatterySystem::VoltageOutOfRange => 216,
17670 BatterySystem::CurrentOutOfRange => 217,
17671 BatterySystem::CurrentNotRegulated => 218,
17672 BatterySystem::VoltageNotRegulated => 219,
17673 BatterySystem::MasterMode => 220,
17674 BatterySystem::ChargerSelectorSupport => 240,
17675 BatterySystem::ChargerSpec => 241,
17676 BatterySystem::Level2 => 242,
17677 BatterySystem::Level3 => 243,
17678 }
17679 }
17680}
17681
17682impl From<BatterySystem> for u16 {
17683 fn from(batterysystem: BatterySystem) -> u16 {
17686 u16::from(&batterysystem)
17687 }
17688}
17689
17690impl From<&BatterySystem> for u32 {
17691 fn from(batterysystem: &BatterySystem) -> u32 {
17694 let up = UsagePage::from(batterysystem);
17695 let up = (u16::from(&up) as u32) << 16;
17696 let id = u16::from(batterysystem) as u32;
17697 up | id
17698 }
17699}
17700
17701impl From<&BatterySystem> for UsagePage {
17702 fn from(_: &BatterySystem) -> UsagePage {
17705 UsagePage::BatterySystem
17706 }
17707}
17708
17709impl From<BatterySystem> for UsagePage {
17710 fn from(_: BatterySystem) -> UsagePage {
17713 UsagePage::BatterySystem
17714 }
17715}
17716
17717impl From<&BatterySystem> for Usage {
17718 fn from(batterysystem: &BatterySystem) -> Usage {
17719 Usage::try_from(u32::from(batterysystem)).unwrap()
17720 }
17721}
17722
17723impl From<BatterySystem> for Usage {
17724 fn from(batterysystem: BatterySystem) -> Usage {
17725 Usage::from(&batterysystem)
17726 }
17727}
17728
17729impl TryFrom<u16> for BatterySystem {
17730 type Error = HutError;
17731
17732 fn try_from(usage_id: u16) -> Result<BatterySystem> {
17733 match usage_id {
17734 1 => Ok(BatterySystem::SmartBatteryBatteryMode),
17735 2 => Ok(BatterySystem::SmartBatteryBatteryStatus),
17736 3 => Ok(BatterySystem::SmartBatteryAlarmWarning),
17737 4 => Ok(BatterySystem::SmartBatteryChargerMode),
17738 5 => Ok(BatterySystem::SmartBatteryChargerStatus),
17739 6 => Ok(BatterySystem::SmartBatteryChargerSpecInfo),
17740 7 => Ok(BatterySystem::SmartBatterySelectorState),
17741 8 => Ok(BatterySystem::SmartBatterySelectorPresets),
17742 9 => Ok(BatterySystem::SmartBatterySelectorInfo),
17743 16 => Ok(BatterySystem::OptionalMfgFunction1),
17744 17 => Ok(BatterySystem::OptionalMfgFunction2),
17745 18 => Ok(BatterySystem::OptionalMfgFunction3),
17746 19 => Ok(BatterySystem::OptionalMfgFunction4),
17747 20 => Ok(BatterySystem::OptionalMfgFunction5),
17748 21 => Ok(BatterySystem::ConnectionToSMBus),
17749 22 => Ok(BatterySystem::OutputConnection),
17750 23 => Ok(BatterySystem::ChargerConnection),
17751 24 => Ok(BatterySystem::BatteryInsertion),
17752 25 => Ok(BatterySystem::UseNext),
17753 26 => Ok(BatterySystem::OKToUse),
17754 27 => Ok(BatterySystem::BatterySupported),
17755 28 => Ok(BatterySystem::SelectorRevision),
17756 29 => Ok(BatterySystem::ChargingIndicator),
17757 40 => Ok(BatterySystem::ManufacturerAccess),
17758 41 => Ok(BatterySystem::RemainingCapacityLimit),
17759 42 => Ok(BatterySystem::RemainingTimeLimit),
17760 43 => Ok(BatterySystem::AtRate),
17761 44 => Ok(BatterySystem::CapacityMode),
17762 45 => Ok(BatterySystem::BroadcastToCharger),
17763 46 => Ok(BatterySystem::PrimaryBattery),
17764 47 => Ok(BatterySystem::ChargeController),
17765 64 => Ok(BatterySystem::TerminateCharge),
17766 65 => Ok(BatterySystem::TerminateDischarge),
17767 66 => Ok(BatterySystem::BelowRemainingCapacityLimit),
17768 67 => Ok(BatterySystem::RemainingTimeLimitExpired),
17769 68 => Ok(BatterySystem::Charging),
17770 69 => Ok(BatterySystem::Discharging),
17771 70 => Ok(BatterySystem::FullyCharged),
17772 71 => Ok(BatterySystem::FullyDischarged),
17773 72 => Ok(BatterySystem::ConditioningFlag),
17774 73 => Ok(BatterySystem::AtRateOK),
17775 74 => Ok(BatterySystem::SmartBatteryErrorCode),
17776 75 => Ok(BatterySystem::NeedReplacement),
17777 96 => Ok(BatterySystem::AtRateTimeToFull),
17778 97 => Ok(BatterySystem::AtRateTimeToEmpty),
17779 98 => Ok(BatterySystem::AverageCurrent),
17780 99 => Ok(BatterySystem::MaxError),
17781 100 => Ok(BatterySystem::RelativeStateOfCharge),
17782 101 => Ok(BatterySystem::AbsoluteStateOfCharge),
17783 102 => Ok(BatterySystem::RemainingCapacity),
17784 103 => Ok(BatterySystem::FullChargeCapacity),
17785 104 => Ok(BatterySystem::RunTimeToEmpty),
17786 105 => Ok(BatterySystem::AverageTimeToEmpty),
17787 106 => Ok(BatterySystem::AverageTimeToFull),
17788 107 => Ok(BatterySystem::CycleCount),
17789 128 => Ok(BatterySystem::BatteryPackModelLevel),
17790 129 => Ok(BatterySystem::InternalChargeController),
17791 130 => Ok(BatterySystem::PrimaryBatterySupport),
17792 131 => Ok(BatterySystem::DesignCapacity),
17793 132 => Ok(BatterySystem::SpecificationInfo),
17794 133 => Ok(BatterySystem::ManufactureDate),
17795 134 => Ok(BatterySystem::SerialNumber),
17796 135 => Ok(BatterySystem::iManufacturerName),
17797 136 => Ok(BatterySystem::iDeviceName),
17798 137 => Ok(BatterySystem::iDeviceChemistry),
17799 138 => Ok(BatterySystem::ManufacturerData),
17800 139 => Ok(BatterySystem::Rechargable),
17801 140 => Ok(BatterySystem::WarningCapacityLimit),
17802 141 => Ok(BatterySystem::CapacityGranularity1),
17803 142 => Ok(BatterySystem::CapacityGranularity2),
17804 143 => Ok(BatterySystem::iOEMInformation),
17805 192 => Ok(BatterySystem::InhibitCharge),
17806 193 => Ok(BatterySystem::EnablePolling),
17807 194 => Ok(BatterySystem::ResetToZero),
17808 208 => Ok(BatterySystem::ACPresent),
17809 209 => Ok(BatterySystem::BatteryPresent),
17810 210 => Ok(BatterySystem::PowerFail),
17811 211 => Ok(BatterySystem::AlarmInhibited),
17812 212 => Ok(BatterySystem::ThermistorUnderRange),
17813 213 => Ok(BatterySystem::ThermistorHot),
17814 214 => Ok(BatterySystem::ThermistorCold),
17815 215 => Ok(BatterySystem::ThermistorOverRange),
17816 216 => Ok(BatterySystem::VoltageOutOfRange),
17817 217 => Ok(BatterySystem::CurrentOutOfRange),
17818 218 => Ok(BatterySystem::CurrentNotRegulated),
17819 219 => Ok(BatterySystem::VoltageNotRegulated),
17820 220 => Ok(BatterySystem::MasterMode),
17821 240 => Ok(BatterySystem::ChargerSelectorSupport),
17822 241 => Ok(BatterySystem::ChargerSpec),
17823 242 => Ok(BatterySystem::Level2),
17824 243 => Ok(BatterySystem::Level3),
17825 n => Err(HutError::UnknownUsageId { usage_id: n }),
17826 }
17827 }
17828}
17829
17830impl BitOr<u16> for BatterySystem {
17831 type Output = Usage;
17832
17833 fn bitor(self, usage: u16) -> Usage {
17840 let up = u16::from(self) as u32;
17841 let u = usage as u32;
17842 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
17843 }
17844}
17845
17846#[allow(non_camel_case_types)]
17867#[derive(Debug)]
17868#[non_exhaustive]
17869pub enum BarcodeScanner {
17870 BarcodeBadgeReader,
17872 BarcodeScanner,
17874 DumbBarCodeScanner,
17876 CordlessScannerBase,
17878 BarCodeScannerCradle,
17880 AttributeReport,
17882 SettingsReport,
17884 ScannedDataReport,
17886 RawScannedDataReport,
17888 TriggerReport,
17890 StatusReport,
17892 UPCEANControlReport,
17894 EAN23LabelControlReport,
17896 Code39ControlReport,
17898 Interleaved2of5ControlReport,
17900 Standard2of5ControlReport,
17902 MSIPlesseyControlReport,
17904 CodabarControlReport,
17906 Code128ControlReport,
17908 Misc1DControlReport,
17910 TwoDControlReport,
17912 AimingPointerMode,
17914 BarCodePresentSensor,
17916 Class1ALaser,
17918 Class2Laser,
17920 HeaterPresent,
17922 ContactScanner,
17924 ElectronicArticleSurveillanceNotification,
17926 ConstantElectronicArticleSurveillance,
17928 ErrorIndication,
17930 FixedBeeper,
17932 GoodDecodeIndication,
17934 HandsFreeScanning,
17936 IntrinsicallySafe,
17938 KlasseEinsLaser,
17940 LongRangeScanner,
17942 MirrorSpeedControl,
17944 NotOnFileIndication,
17946 ProgrammableBeeper,
17948 Triggerless,
17950 Wand,
17952 WaterResistant,
17954 MultiRangeScanner,
17956 ProximitySensor,
17958 FragmentDecoding,
17960 ScannerReadConfidence,
17962 DataPrefix,
17964 PrefixAIMI,
17966 PrefixNone,
17968 PrefixProprietary,
17970 ActiveTime,
17972 AimingLaserPattern,
17974 BarCodePresent,
17976 BeeperState,
17978 LaserOnTime,
17980 LaserState,
17982 LockoutTime,
17984 MotorState,
17986 MotorTimeout,
17988 PowerOnResetScanner,
17990 PreventReadofBarcodes,
17992 InitiateBarcodeRead,
17994 TriggerState,
17996 TriggerMode,
17998 TriggerModeBlinkingLaserOn,
18000 TriggerModeContinuousLaserOn,
18002 TriggerModeLaseronwhilePulled,
18004 TriggerModeLaserstaysonafterrelease,
18006 CommitParameterstoNVM,
18008 ParameterScanning,
18010 ParametersChanged,
18012 Setparameterdefaultvalues,
18014 ScannerInCradle,
18016 ScannerInRange,
18018 AimDuration,
18020 GoodReadLampDuration,
18022 GoodReadLampIntensity,
18024 GoodReadLED,
18026 GoodReadToneFrequency,
18028 GoodReadToneLength,
18030 GoodReadToneVolume,
18032 NoReadMessage,
18034 NotonFileVolume,
18036 PowerupBeep,
18038 SoundErrorBeep,
18040 SoundGoodReadBeep,
18042 SoundNotOnFileBeep,
18044 GoodReadWhentoWrite,
18046 GRWTIAfterDecode,
18048 GRWTIBeepLampaftertransmit,
18050 GRWTINoBeepLampuseatall,
18052 BooklandEAN,
18054 ConvertEAN8to13Type,
18056 ConvertUPCAtoEAN13,
18058 ConvertUPCEtoA,
18060 EAN13,
18062 EAN8,
18064 EAN99128Mandatory,
18066 EAN99P5128Optional,
18068 EnableEANTwoLabel,
18070 UPCEAN,
18072 UPCEANCouponCode,
18074 UPCEANPeriodicals,
18076 UPCA,
18078 UPCAwith128Mandatory,
18080 UPCAwith128Optional,
18082 UPCAwithP5Optional,
18084 UPCE,
18086 UPCE1,
18088 Periodical,
18090 PeriodicalAutoDiscriminatePlus2,
18092 PeriodicalOnlyDecodewithPlus2,
18094 PeriodicalIgnorePlus2,
18096 PeriodicalAutoDiscriminatePlus5,
18098 PeriodicalOnlyDecodewithPlus5,
18100 PeriodicalIgnorePlus5,
18102 Check,
18104 CheckDisablePrice,
18106 CheckEnable4digitPrice,
18108 CheckEnable5digitPrice,
18110 CheckEnableEuropean4digitPrice,
18112 CheckEnableEuropean5digitPrice,
18114 EANTwoLabel,
18116 EANThreeLabel,
18118 EAN8FlagDigit1,
18120 EAN8FlagDigit2,
18122 EAN8FlagDigit3,
18124 EAN13FlagDigit1,
18126 EAN13FlagDigit2,
18128 EAN13FlagDigit3,
18130 AddEAN23LabelDefinition,
18132 ClearallEAN23LabelDefinitions,
18134 Codabar,
18136 Code128,
18138 Code39,
18140 Code93,
18142 FullASCIIConversion,
18144 Interleaved2of5,
18146 ItalianPharmacyCode,
18148 MSIPlessey,
18150 Standard2of5IATA,
18152 Standard2of5,
18154 TransmitStartStop,
18156 TriOptic,
18158 UCCEAN128,
18160 CheckDigit,
18162 CheckDigitDisable,
18164 CheckDigitEnableInterleaved2of5OPCC,
18166 CheckDigitEnableInterleaved2of5USS,
18168 CheckDigitEnableStandard2of5OPCC,
18170 CheckDigitEnableStandard2of5USS,
18172 CheckDigitEnableOneMSIPlessey,
18174 CheckDigitEnableTwoMSIPlessey,
18176 CheckDigitCodabarEnable,
18178 CheckDigitCode39Enable,
18180 TransmitCheckDigit,
18182 DisableCheckDigitTransmit,
18184 EnableCheckDigitTransmit,
18186 SymbologyIdentifier1,
18188 SymbologyIdentifier2,
18190 SymbologyIdentifier3,
18192 DecodedData,
18194 DecodeDataContinued,
18196 BarSpaceData,
18198 ScannerDataAccuracy,
18200 RawDataPolarity,
18202 PolarityInvertedBarCode,
18204 PolarityNormalBarCode,
18206 MinimumLengthtoDecode,
18208 MaximumLengthtoDecode,
18210 DiscreteLengthtoDecode1,
18212 DiscreteLengthtoDecode2,
18214 DataLengthMethod,
18216 DLMethodReadany,
18218 DLMethodCheckinRange,
18220 DLMethodCheckforDiscrete,
18222 AztecCode,
18224 BC412,
18226 ChannelCode,
18228 Code16,
18230 Code32,
18232 Code49,
18234 CodeOne,
18236 Colorcode,
18238 DataMatrix,
18240 MaxiCode,
18242 MicroPDF,
18244 PDF417,
18246 PosiCode,
18248 QRCode,
18250 SuperCode,
18252 UltraCode,
18254 USD5SlugCode,
18256 VeriCode,
18258}
18259
18260impl BarcodeScanner {
18261 #[cfg(feature = "std")]
18262 pub fn name(&self) -> String {
18263 match self {
18264 BarcodeScanner::BarcodeBadgeReader => "Barcode Badge Reader",
18265 BarcodeScanner::BarcodeScanner => "Barcode Scanner",
18266 BarcodeScanner::DumbBarCodeScanner => "Dumb Bar Code Scanner",
18267 BarcodeScanner::CordlessScannerBase => "Cordless Scanner Base",
18268 BarcodeScanner::BarCodeScannerCradle => "Bar Code Scanner Cradle",
18269 BarcodeScanner::AttributeReport => "Attribute Report",
18270 BarcodeScanner::SettingsReport => "Settings Report",
18271 BarcodeScanner::ScannedDataReport => "Scanned Data Report",
18272 BarcodeScanner::RawScannedDataReport => "Raw Scanned Data Report",
18273 BarcodeScanner::TriggerReport => "Trigger Report",
18274 BarcodeScanner::StatusReport => "Status Report",
18275 BarcodeScanner::UPCEANControlReport => "UPC/EAN Control Report",
18276 BarcodeScanner::EAN23LabelControlReport => "EAN 2/3 Label Control Report",
18277 BarcodeScanner::Code39ControlReport => "Code 39 Control Report",
18278 BarcodeScanner::Interleaved2of5ControlReport => "Interleaved 2 of 5 Control Report",
18279 BarcodeScanner::Standard2of5ControlReport => "Standard 2 of 5 Control Report",
18280 BarcodeScanner::MSIPlesseyControlReport => "MSI Plessey Control Report",
18281 BarcodeScanner::CodabarControlReport => "Codabar Control Report",
18282 BarcodeScanner::Code128ControlReport => "Code 128 Control Report",
18283 BarcodeScanner::Misc1DControlReport => "Misc 1D Control Report",
18284 BarcodeScanner::TwoDControlReport => "2D Control Report",
18285 BarcodeScanner::AimingPointerMode => "Aiming/Pointer Mode",
18286 BarcodeScanner::BarCodePresentSensor => "Bar Code Present Sensor",
18287 BarcodeScanner::Class1ALaser => "Class 1A Laser",
18288 BarcodeScanner::Class2Laser => "Class 2 Laser",
18289 BarcodeScanner::HeaterPresent => "Heater Present",
18290 BarcodeScanner::ContactScanner => "Contact Scanner",
18291 BarcodeScanner::ElectronicArticleSurveillanceNotification => {
18292 "Electronic Article Surveillance Notification"
18293 }
18294 BarcodeScanner::ConstantElectronicArticleSurveillance => {
18295 "Constant Electronic Article Surveillance"
18296 }
18297 BarcodeScanner::ErrorIndication => "Error Indication",
18298 BarcodeScanner::FixedBeeper => "Fixed Beeper",
18299 BarcodeScanner::GoodDecodeIndication => "Good Decode Indication",
18300 BarcodeScanner::HandsFreeScanning => "Hands Free Scanning",
18301 BarcodeScanner::IntrinsicallySafe => "Intrinsically Safe",
18302 BarcodeScanner::KlasseEinsLaser => "Klasse Eins Laser",
18303 BarcodeScanner::LongRangeScanner => "Long Range Scanner",
18304 BarcodeScanner::MirrorSpeedControl => "Mirror Speed Control",
18305 BarcodeScanner::NotOnFileIndication => "Not On File Indication",
18306 BarcodeScanner::ProgrammableBeeper => "Programmable Beeper",
18307 BarcodeScanner::Triggerless => "Triggerless",
18308 BarcodeScanner::Wand => "Wand",
18309 BarcodeScanner::WaterResistant => "Water Resistant",
18310 BarcodeScanner::MultiRangeScanner => "Multi-Range Scanner",
18311 BarcodeScanner::ProximitySensor => "Proximity Sensor",
18312 BarcodeScanner::FragmentDecoding => "Fragment Decoding",
18313 BarcodeScanner::ScannerReadConfidence => "Scanner Read Confidence",
18314 BarcodeScanner::DataPrefix => "Data Prefix",
18315 BarcodeScanner::PrefixAIMI => "Prefix AIMI",
18316 BarcodeScanner::PrefixNone => "Prefix None",
18317 BarcodeScanner::PrefixProprietary => "Prefix Proprietary",
18318 BarcodeScanner::ActiveTime => "Active Time",
18319 BarcodeScanner::AimingLaserPattern => "Aiming Laser Pattern",
18320 BarcodeScanner::BarCodePresent => "Bar Code Present",
18321 BarcodeScanner::BeeperState => "Beeper State",
18322 BarcodeScanner::LaserOnTime => "Laser On Time",
18323 BarcodeScanner::LaserState => "Laser State",
18324 BarcodeScanner::LockoutTime => "Lockout Time",
18325 BarcodeScanner::MotorState => "Motor State",
18326 BarcodeScanner::MotorTimeout => "Motor Timeout",
18327 BarcodeScanner::PowerOnResetScanner => "Power On Reset Scanner",
18328 BarcodeScanner::PreventReadofBarcodes => "Prevent Read of Barcodes",
18329 BarcodeScanner::InitiateBarcodeRead => "Initiate Barcode Read",
18330 BarcodeScanner::TriggerState => "Trigger State",
18331 BarcodeScanner::TriggerMode => "Trigger Mode",
18332 BarcodeScanner::TriggerModeBlinkingLaserOn => "Trigger Mode Blinking Laser On",
18333 BarcodeScanner::TriggerModeContinuousLaserOn => "Trigger Mode Continuous Laser On",
18334 BarcodeScanner::TriggerModeLaseronwhilePulled => "Trigger Mode Laser on while Pulled",
18335 BarcodeScanner::TriggerModeLaserstaysonafterrelease => {
18336 "Trigger Mode Laser stays on after release"
18337 }
18338 BarcodeScanner::CommitParameterstoNVM => "Commit Parameters to NVM",
18339 BarcodeScanner::ParameterScanning => "Parameter Scanning",
18340 BarcodeScanner::ParametersChanged => "Parameters Changed",
18341 BarcodeScanner::Setparameterdefaultvalues => "Set parameter default values",
18342 BarcodeScanner::ScannerInCradle => "Scanner In Cradle",
18343 BarcodeScanner::ScannerInRange => "Scanner In Range",
18344 BarcodeScanner::AimDuration => "Aim Duration",
18345 BarcodeScanner::GoodReadLampDuration => "Good Read Lamp Duration",
18346 BarcodeScanner::GoodReadLampIntensity => "Good Read Lamp Intensity",
18347 BarcodeScanner::GoodReadLED => "Good Read LED",
18348 BarcodeScanner::GoodReadToneFrequency => "Good Read Tone Frequency",
18349 BarcodeScanner::GoodReadToneLength => "Good Read Tone Length",
18350 BarcodeScanner::GoodReadToneVolume => "Good Read Tone Volume",
18351 BarcodeScanner::NoReadMessage => "No Read Message",
18352 BarcodeScanner::NotonFileVolume => "Not on File Volume",
18353 BarcodeScanner::PowerupBeep => "Powerup Beep",
18354 BarcodeScanner::SoundErrorBeep => "Sound Error Beep",
18355 BarcodeScanner::SoundGoodReadBeep => "Sound Good Read Beep",
18356 BarcodeScanner::SoundNotOnFileBeep => "Sound Not On File Beep",
18357 BarcodeScanner::GoodReadWhentoWrite => "Good Read When to Write",
18358 BarcodeScanner::GRWTIAfterDecode => "GRWTI After Decode",
18359 BarcodeScanner::GRWTIBeepLampaftertransmit => "GRWTI Beep/Lamp after transmit",
18360 BarcodeScanner::GRWTINoBeepLampuseatall => "GRWTI No Beep/Lamp use at all",
18361 BarcodeScanner::BooklandEAN => "Bookland EAN",
18362 BarcodeScanner::ConvertEAN8to13Type => "Convert EAN 8 to 13 Type",
18363 BarcodeScanner::ConvertUPCAtoEAN13 => "Convert UPC A to EAN-13",
18364 BarcodeScanner::ConvertUPCEtoA => "Convert UPC-E to A",
18365 BarcodeScanner::EAN13 => "EAN-13",
18366 BarcodeScanner::EAN8 => "EAN-8",
18367 BarcodeScanner::EAN99128Mandatory => "EAN-99 128 Mandatory",
18368 BarcodeScanner::EAN99P5128Optional => "EAN-99 P5/128 Optional",
18369 BarcodeScanner::EnableEANTwoLabel => "Enable EAN Two Label",
18370 BarcodeScanner::UPCEAN => "UPC/EAN",
18371 BarcodeScanner::UPCEANCouponCode => "UPC/EAN Coupon Code",
18372 BarcodeScanner::UPCEANPeriodicals => "UPC/EAN Periodicals",
18373 BarcodeScanner::UPCA => "UPC-A",
18374 BarcodeScanner::UPCAwith128Mandatory => "UPC-A with 128 Mandatory",
18375 BarcodeScanner::UPCAwith128Optional => "UPC-A with 128 Optional",
18376 BarcodeScanner::UPCAwithP5Optional => "UPC-A with P5 Optional",
18377 BarcodeScanner::UPCE => "UPC-E",
18378 BarcodeScanner::UPCE1 => "UPC-E1",
18379 BarcodeScanner::Periodical => "Periodical",
18380 BarcodeScanner::PeriodicalAutoDiscriminatePlus2 => "Periodical Auto-Discriminate +2",
18381 BarcodeScanner::PeriodicalOnlyDecodewithPlus2 => "Periodical Only Decode with +2",
18382 BarcodeScanner::PeriodicalIgnorePlus2 => "Periodical Ignore +2",
18383 BarcodeScanner::PeriodicalAutoDiscriminatePlus5 => "Periodical Auto-Discriminate +5",
18384 BarcodeScanner::PeriodicalOnlyDecodewithPlus5 => "Periodical Only Decode with +5",
18385 BarcodeScanner::PeriodicalIgnorePlus5 => "Periodical Ignore +5",
18386 BarcodeScanner::Check => "Check",
18387 BarcodeScanner::CheckDisablePrice => "Check Disable Price",
18388 BarcodeScanner::CheckEnable4digitPrice => "Check Enable 4 digit Price",
18389 BarcodeScanner::CheckEnable5digitPrice => "Check Enable 5 digit Price",
18390 BarcodeScanner::CheckEnableEuropean4digitPrice => "Check Enable European 4 digit Price",
18391 BarcodeScanner::CheckEnableEuropean5digitPrice => "Check Enable European 5 digit Price",
18392 BarcodeScanner::EANTwoLabel => "EAN Two Label",
18393 BarcodeScanner::EANThreeLabel => "EAN Three Label",
18394 BarcodeScanner::EAN8FlagDigit1 => "EAN 8 Flag Digit 1",
18395 BarcodeScanner::EAN8FlagDigit2 => "EAN 8 Flag Digit 2",
18396 BarcodeScanner::EAN8FlagDigit3 => "EAN 8 Flag Digit 3",
18397 BarcodeScanner::EAN13FlagDigit1 => "EAN 13 Flag Digit 1",
18398 BarcodeScanner::EAN13FlagDigit2 => "EAN 13 Flag Digit 2",
18399 BarcodeScanner::EAN13FlagDigit3 => "EAN 13 Flag Digit 3",
18400 BarcodeScanner::AddEAN23LabelDefinition => "Add EAN 2/3 Label Definition",
18401 BarcodeScanner::ClearallEAN23LabelDefinitions => "Clear all EAN 2/3 Label Definitions",
18402 BarcodeScanner::Codabar => "Codabar",
18403 BarcodeScanner::Code128 => "Code 128",
18404 BarcodeScanner::Code39 => "Code 39",
18405 BarcodeScanner::Code93 => "Code 93",
18406 BarcodeScanner::FullASCIIConversion => "Full ASCII Conversion",
18407 BarcodeScanner::Interleaved2of5 => "Interleaved 2 of 5",
18408 BarcodeScanner::ItalianPharmacyCode => "Italian Pharmacy Code",
18409 BarcodeScanner::MSIPlessey => "MSI/Plessey",
18410 BarcodeScanner::Standard2of5IATA => "Standard 2 of 5 IATA",
18411 BarcodeScanner::Standard2of5 => "Standard 2 of 5",
18412 BarcodeScanner::TransmitStartStop => "Transmit Start/Stop",
18413 BarcodeScanner::TriOptic => "Tri-Optic",
18414 BarcodeScanner::UCCEAN128 => "UCC/EAN-128",
18415 BarcodeScanner::CheckDigit => "Check Digit",
18416 BarcodeScanner::CheckDigitDisable => "Check Digit Disable",
18417 BarcodeScanner::CheckDigitEnableInterleaved2of5OPCC => {
18418 "Check Digit Enable Interleaved 2 of 5 OPCC"
18419 }
18420 BarcodeScanner::CheckDigitEnableInterleaved2of5USS => {
18421 "Check Digit Enable Interleaved 2 of 5 USS"
18422 }
18423 BarcodeScanner::CheckDigitEnableStandard2of5OPCC => {
18424 "Check Digit Enable Standard 2 of 5 OPCC"
18425 }
18426 BarcodeScanner::CheckDigitEnableStandard2of5USS => {
18427 "Check Digit Enable Standard 2 of 5 USS"
18428 }
18429 BarcodeScanner::CheckDigitEnableOneMSIPlessey => "Check Digit Enable One MSI Plessey",
18430 BarcodeScanner::CheckDigitEnableTwoMSIPlessey => "Check Digit Enable Two MSI Plessey",
18431 BarcodeScanner::CheckDigitCodabarEnable => "Check Digit Codabar Enable",
18432 BarcodeScanner::CheckDigitCode39Enable => "Check Digit Code 39 Enable",
18433 BarcodeScanner::TransmitCheckDigit => "Transmit Check Digit",
18434 BarcodeScanner::DisableCheckDigitTransmit => "Disable Check Digit Transmit",
18435 BarcodeScanner::EnableCheckDigitTransmit => "Enable Check Digit Transmit",
18436 BarcodeScanner::SymbologyIdentifier1 => "Symbology Identifier 1",
18437 BarcodeScanner::SymbologyIdentifier2 => "Symbology Identifier 2",
18438 BarcodeScanner::SymbologyIdentifier3 => "Symbology Identifier 3",
18439 BarcodeScanner::DecodedData => "Decoded Data",
18440 BarcodeScanner::DecodeDataContinued => "Decode Data Continued",
18441 BarcodeScanner::BarSpaceData => "Bar Space Data",
18442 BarcodeScanner::ScannerDataAccuracy => "Scanner Data Accuracy",
18443 BarcodeScanner::RawDataPolarity => "Raw Data Polarity",
18444 BarcodeScanner::PolarityInvertedBarCode => "Polarity Inverted Bar Code",
18445 BarcodeScanner::PolarityNormalBarCode => "Polarity Normal Bar Code",
18446 BarcodeScanner::MinimumLengthtoDecode => "Minimum Length to Decode",
18447 BarcodeScanner::MaximumLengthtoDecode => "Maximum Length to Decode",
18448 BarcodeScanner::DiscreteLengthtoDecode1 => "Discrete Length to Decode 1",
18449 BarcodeScanner::DiscreteLengthtoDecode2 => "Discrete Length to Decode 2",
18450 BarcodeScanner::DataLengthMethod => "Data Length Method",
18451 BarcodeScanner::DLMethodReadany => "DL Method Read any",
18452 BarcodeScanner::DLMethodCheckinRange => "DL Method Check in Range",
18453 BarcodeScanner::DLMethodCheckforDiscrete => "DL Method Check for Discrete",
18454 BarcodeScanner::AztecCode => "Aztec Code",
18455 BarcodeScanner::BC412 => "BC412",
18456 BarcodeScanner::ChannelCode => "Channel Code",
18457 BarcodeScanner::Code16 => "Code 16",
18458 BarcodeScanner::Code32 => "Code 32",
18459 BarcodeScanner::Code49 => "Code 49",
18460 BarcodeScanner::CodeOne => "Code One",
18461 BarcodeScanner::Colorcode => "Colorcode",
18462 BarcodeScanner::DataMatrix => "Data Matrix",
18463 BarcodeScanner::MaxiCode => "MaxiCode",
18464 BarcodeScanner::MicroPDF => "MicroPDF",
18465 BarcodeScanner::PDF417 => "PDF-417",
18466 BarcodeScanner::PosiCode => "PosiCode",
18467 BarcodeScanner::QRCode => "QR Code",
18468 BarcodeScanner::SuperCode => "SuperCode",
18469 BarcodeScanner::UltraCode => "UltraCode",
18470 BarcodeScanner::USD5SlugCode => "USD-5 (Slug Code)",
18471 BarcodeScanner::VeriCode => "VeriCode",
18472 }
18473 .into()
18474 }
18475}
18476
18477#[cfg(feature = "std")]
18478impl fmt::Display for BarcodeScanner {
18479 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18480 write!(f, "{}", self.name())
18481 }
18482}
18483
18484impl AsUsage for BarcodeScanner {
18485 fn usage_value(&self) -> u32 {
18487 u32::from(self)
18488 }
18489
18490 fn usage_id_value(&self) -> u16 {
18492 u16::from(self)
18493 }
18494
18495 fn usage(&self) -> Usage {
18506 Usage::from(self)
18507 }
18508}
18509
18510impl AsUsagePage for BarcodeScanner {
18511 fn usage_page_value(&self) -> u16 {
18515 let up = UsagePage::from(self);
18516 u16::from(up)
18517 }
18518
18519 fn usage_page(&self) -> UsagePage {
18521 UsagePage::from(self)
18522 }
18523}
18524
18525impl From<&BarcodeScanner> for u16 {
18526 fn from(barcodescanner: &BarcodeScanner) -> u16 {
18527 match *barcodescanner {
18528 BarcodeScanner::BarcodeBadgeReader => 1,
18529 BarcodeScanner::BarcodeScanner => 2,
18530 BarcodeScanner::DumbBarCodeScanner => 3,
18531 BarcodeScanner::CordlessScannerBase => 4,
18532 BarcodeScanner::BarCodeScannerCradle => 5,
18533 BarcodeScanner::AttributeReport => 16,
18534 BarcodeScanner::SettingsReport => 17,
18535 BarcodeScanner::ScannedDataReport => 18,
18536 BarcodeScanner::RawScannedDataReport => 19,
18537 BarcodeScanner::TriggerReport => 20,
18538 BarcodeScanner::StatusReport => 21,
18539 BarcodeScanner::UPCEANControlReport => 22,
18540 BarcodeScanner::EAN23LabelControlReport => 23,
18541 BarcodeScanner::Code39ControlReport => 24,
18542 BarcodeScanner::Interleaved2of5ControlReport => 25,
18543 BarcodeScanner::Standard2of5ControlReport => 26,
18544 BarcodeScanner::MSIPlesseyControlReport => 27,
18545 BarcodeScanner::CodabarControlReport => 28,
18546 BarcodeScanner::Code128ControlReport => 29,
18547 BarcodeScanner::Misc1DControlReport => 30,
18548 BarcodeScanner::TwoDControlReport => 31,
18549 BarcodeScanner::AimingPointerMode => 48,
18550 BarcodeScanner::BarCodePresentSensor => 49,
18551 BarcodeScanner::Class1ALaser => 50,
18552 BarcodeScanner::Class2Laser => 51,
18553 BarcodeScanner::HeaterPresent => 52,
18554 BarcodeScanner::ContactScanner => 53,
18555 BarcodeScanner::ElectronicArticleSurveillanceNotification => 54,
18556 BarcodeScanner::ConstantElectronicArticleSurveillance => 55,
18557 BarcodeScanner::ErrorIndication => 56,
18558 BarcodeScanner::FixedBeeper => 57,
18559 BarcodeScanner::GoodDecodeIndication => 58,
18560 BarcodeScanner::HandsFreeScanning => 59,
18561 BarcodeScanner::IntrinsicallySafe => 60,
18562 BarcodeScanner::KlasseEinsLaser => 61,
18563 BarcodeScanner::LongRangeScanner => 62,
18564 BarcodeScanner::MirrorSpeedControl => 63,
18565 BarcodeScanner::NotOnFileIndication => 64,
18566 BarcodeScanner::ProgrammableBeeper => 65,
18567 BarcodeScanner::Triggerless => 66,
18568 BarcodeScanner::Wand => 67,
18569 BarcodeScanner::WaterResistant => 68,
18570 BarcodeScanner::MultiRangeScanner => 69,
18571 BarcodeScanner::ProximitySensor => 70,
18572 BarcodeScanner::FragmentDecoding => 77,
18573 BarcodeScanner::ScannerReadConfidence => 78,
18574 BarcodeScanner::DataPrefix => 79,
18575 BarcodeScanner::PrefixAIMI => 80,
18576 BarcodeScanner::PrefixNone => 81,
18577 BarcodeScanner::PrefixProprietary => 82,
18578 BarcodeScanner::ActiveTime => 85,
18579 BarcodeScanner::AimingLaserPattern => 86,
18580 BarcodeScanner::BarCodePresent => 87,
18581 BarcodeScanner::BeeperState => 88,
18582 BarcodeScanner::LaserOnTime => 89,
18583 BarcodeScanner::LaserState => 90,
18584 BarcodeScanner::LockoutTime => 91,
18585 BarcodeScanner::MotorState => 92,
18586 BarcodeScanner::MotorTimeout => 93,
18587 BarcodeScanner::PowerOnResetScanner => 94,
18588 BarcodeScanner::PreventReadofBarcodes => 95,
18589 BarcodeScanner::InitiateBarcodeRead => 96,
18590 BarcodeScanner::TriggerState => 97,
18591 BarcodeScanner::TriggerMode => 98,
18592 BarcodeScanner::TriggerModeBlinkingLaserOn => 99,
18593 BarcodeScanner::TriggerModeContinuousLaserOn => 100,
18594 BarcodeScanner::TriggerModeLaseronwhilePulled => 101,
18595 BarcodeScanner::TriggerModeLaserstaysonafterrelease => 102,
18596 BarcodeScanner::CommitParameterstoNVM => 109,
18597 BarcodeScanner::ParameterScanning => 110,
18598 BarcodeScanner::ParametersChanged => 111,
18599 BarcodeScanner::Setparameterdefaultvalues => 112,
18600 BarcodeScanner::ScannerInCradle => 117,
18601 BarcodeScanner::ScannerInRange => 118,
18602 BarcodeScanner::AimDuration => 122,
18603 BarcodeScanner::GoodReadLampDuration => 123,
18604 BarcodeScanner::GoodReadLampIntensity => 124,
18605 BarcodeScanner::GoodReadLED => 125,
18606 BarcodeScanner::GoodReadToneFrequency => 126,
18607 BarcodeScanner::GoodReadToneLength => 127,
18608 BarcodeScanner::GoodReadToneVolume => 128,
18609 BarcodeScanner::NoReadMessage => 130,
18610 BarcodeScanner::NotonFileVolume => 131,
18611 BarcodeScanner::PowerupBeep => 132,
18612 BarcodeScanner::SoundErrorBeep => 133,
18613 BarcodeScanner::SoundGoodReadBeep => 134,
18614 BarcodeScanner::SoundNotOnFileBeep => 135,
18615 BarcodeScanner::GoodReadWhentoWrite => 136,
18616 BarcodeScanner::GRWTIAfterDecode => 137,
18617 BarcodeScanner::GRWTIBeepLampaftertransmit => 138,
18618 BarcodeScanner::GRWTINoBeepLampuseatall => 139,
18619 BarcodeScanner::BooklandEAN => 145,
18620 BarcodeScanner::ConvertEAN8to13Type => 146,
18621 BarcodeScanner::ConvertUPCAtoEAN13 => 147,
18622 BarcodeScanner::ConvertUPCEtoA => 148,
18623 BarcodeScanner::EAN13 => 149,
18624 BarcodeScanner::EAN8 => 150,
18625 BarcodeScanner::EAN99128Mandatory => 151,
18626 BarcodeScanner::EAN99P5128Optional => 152,
18627 BarcodeScanner::EnableEANTwoLabel => 153,
18628 BarcodeScanner::UPCEAN => 154,
18629 BarcodeScanner::UPCEANCouponCode => 155,
18630 BarcodeScanner::UPCEANPeriodicals => 156,
18631 BarcodeScanner::UPCA => 157,
18632 BarcodeScanner::UPCAwith128Mandatory => 158,
18633 BarcodeScanner::UPCAwith128Optional => 159,
18634 BarcodeScanner::UPCAwithP5Optional => 160,
18635 BarcodeScanner::UPCE => 161,
18636 BarcodeScanner::UPCE1 => 162,
18637 BarcodeScanner::Periodical => 169,
18638 BarcodeScanner::PeriodicalAutoDiscriminatePlus2 => 170,
18639 BarcodeScanner::PeriodicalOnlyDecodewithPlus2 => 171,
18640 BarcodeScanner::PeriodicalIgnorePlus2 => 172,
18641 BarcodeScanner::PeriodicalAutoDiscriminatePlus5 => 173,
18642 BarcodeScanner::PeriodicalOnlyDecodewithPlus5 => 174,
18643 BarcodeScanner::PeriodicalIgnorePlus5 => 175,
18644 BarcodeScanner::Check => 176,
18645 BarcodeScanner::CheckDisablePrice => 177,
18646 BarcodeScanner::CheckEnable4digitPrice => 178,
18647 BarcodeScanner::CheckEnable5digitPrice => 179,
18648 BarcodeScanner::CheckEnableEuropean4digitPrice => 180,
18649 BarcodeScanner::CheckEnableEuropean5digitPrice => 181,
18650 BarcodeScanner::EANTwoLabel => 183,
18651 BarcodeScanner::EANThreeLabel => 184,
18652 BarcodeScanner::EAN8FlagDigit1 => 185,
18653 BarcodeScanner::EAN8FlagDigit2 => 186,
18654 BarcodeScanner::EAN8FlagDigit3 => 187,
18655 BarcodeScanner::EAN13FlagDigit1 => 188,
18656 BarcodeScanner::EAN13FlagDigit2 => 189,
18657 BarcodeScanner::EAN13FlagDigit3 => 190,
18658 BarcodeScanner::AddEAN23LabelDefinition => 191,
18659 BarcodeScanner::ClearallEAN23LabelDefinitions => 192,
18660 BarcodeScanner::Codabar => 195,
18661 BarcodeScanner::Code128 => 196,
18662 BarcodeScanner::Code39 => 199,
18663 BarcodeScanner::Code93 => 200,
18664 BarcodeScanner::FullASCIIConversion => 201,
18665 BarcodeScanner::Interleaved2of5 => 202,
18666 BarcodeScanner::ItalianPharmacyCode => 203,
18667 BarcodeScanner::MSIPlessey => 204,
18668 BarcodeScanner::Standard2of5IATA => 205,
18669 BarcodeScanner::Standard2of5 => 206,
18670 BarcodeScanner::TransmitStartStop => 211,
18671 BarcodeScanner::TriOptic => 212,
18672 BarcodeScanner::UCCEAN128 => 213,
18673 BarcodeScanner::CheckDigit => 214,
18674 BarcodeScanner::CheckDigitDisable => 215,
18675 BarcodeScanner::CheckDigitEnableInterleaved2of5OPCC => 216,
18676 BarcodeScanner::CheckDigitEnableInterleaved2of5USS => 217,
18677 BarcodeScanner::CheckDigitEnableStandard2of5OPCC => 218,
18678 BarcodeScanner::CheckDigitEnableStandard2of5USS => 219,
18679 BarcodeScanner::CheckDigitEnableOneMSIPlessey => 220,
18680 BarcodeScanner::CheckDigitEnableTwoMSIPlessey => 221,
18681 BarcodeScanner::CheckDigitCodabarEnable => 222,
18682 BarcodeScanner::CheckDigitCode39Enable => 223,
18683 BarcodeScanner::TransmitCheckDigit => 240,
18684 BarcodeScanner::DisableCheckDigitTransmit => 241,
18685 BarcodeScanner::EnableCheckDigitTransmit => 242,
18686 BarcodeScanner::SymbologyIdentifier1 => 251,
18687 BarcodeScanner::SymbologyIdentifier2 => 252,
18688 BarcodeScanner::SymbologyIdentifier3 => 253,
18689 BarcodeScanner::DecodedData => 254,
18690 BarcodeScanner::DecodeDataContinued => 255,
18691 BarcodeScanner::BarSpaceData => 256,
18692 BarcodeScanner::ScannerDataAccuracy => 257,
18693 BarcodeScanner::RawDataPolarity => 258,
18694 BarcodeScanner::PolarityInvertedBarCode => 259,
18695 BarcodeScanner::PolarityNormalBarCode => 260,
18696 BarcodeScanner::MinimumLengthtoDecode => 262,
18697 BarcodeScanner::MaximumLengthtoDecode => 263,
18698 BarcodeScanner::DiscreteLengthtoDecode1 => 264,
18699 BarcodeScanner::DiscreteLengthtoDecode2 => 265,
18700 BarcodeScanner::DataLengthMethod => 266,
18701 BarcodeScanner::DLMethodReadany => 267,
18702 BarcodeScanner::DLMethodCheckinRange => 268,
18703 BarcodeScanner::DLMethodCheckforDiscrete => 269,
18704 BarcodeScanner::AztecCode => 272,
18705 BarcodeScanner::BC412 => 273,
18706 BarcodeScanner::ChannelCode => 274,
18707 BarcodeScanner::Code16 => 275,
18708 BarcodeScanner::Code32 => 276,
18709 BarcodeScanner::Code49 => 277,
18710 BarcodeScanner::CodeOne => 278,
18711 BarcodeScanner::Colorcode => 279,
18712 BarcodeScanner::DataMatrix => 280,
18713 BarcodeScanner::MaxiCode => 281,
18714 BarcodeScanner::MicroPDF => 282,
18715 BarcodeScanner::PDF417 => 283,
18716 BarcodeScanner::PosiCode => 284,
18717 BarcodeScanner::QRCode => 285,
18718 BarcodeScanner::SuperCode => 286,
18719 BarcodeScanner::UltraCode => 287,
18720 BarcodeScanner::USD5SlugCode => 288,
18721 BarcodeScanner::VeriCode => 289,
18722 }
18723 }
18724}
18725
18726impl From<BarcodeScanner> for u16 {
18727 fn from(barcodescanner: BarcodeScanner) -> u16 {
18730 u16::from(&barcodescanner)
18731 }
18732}
18733
18734impl From<&BarcodeScanner> for u32 {
18735 fn from(barcodescanner: &BarcodeScanner) -> u32 {
18738 let up = UsagePage::from(barcodescanner);
18739 let up = (u16::from(&up) as u32) << 16;
18740 let id = u16::from(barcodescanner) as u32;
18741 up | id
18742 }
18743}
18744
18745impl From<&BarcodeScanner> for UsagePage {
18746 fn from(_: &BarcodeScanner) -> UsagePage {
18749 UsagePage::BarcodeScanner
18750 }
18751}
18752
18753impl From<BarcodeScanner> for UsagePage {
18754 fn from(_: BarcodeScanner) -> UsagePage {
18757 UsagePage::BarcodeScanner
18758 }
18759}
18760
18761impl From<&BarcodeScanner> for Usage {
18762 fn from(barcodescanner: &BarcodeScanner) -> Usage {
18763 Usage::try_from(u32::from(barcodescanner)).unwrap()
18764 }
18765}
18766
18767impl From<BarcodeScanner> for Usage {
18768 fn from(barcodescanner: BarcodeScanner) -> Usage {
18769 Usage::from(&barcodescanner)
18770 }
18771}
18772
18773impl TryFrom<u16> for BarcodeScanner {
18774 type Error = HutError;
18775
18776 fn try_from(usage_id: u16) -> Result<BarcodeScanner> {
18777 match usage_id {
18778 1 => Ok(BarcodeScanner::BarcodeBadgeReader),
18779 2 => Ok(BarcodeScanner::BarcodeScanner),
18780 3 => Ok(BarcodeScanner::DumbBarCodeScanner),
18781 4 => Ok(BarcodeScanner::CordlessScannerBase),
18782 5 => Ok(BarcodeScanner::BarCodeScannerCradle),
18783 16 => Ok(BarcodeScanner::AttributeReport),
18784 17 => Ok(BarcodeScanner::SettingsReport),
18785 18 => Ok(BarcodeScanner::ScannedDataReport),
18786 19 => Ok(BarcodeScanner::RawScannedDataReport),
18787 20 => Ok(BarcodeScanner::TriggerReport),
18788 21 => Ok(BarcodeScanner::StatusReport),
18789 22 => Ok(BarcodeScanner::UPCEANControlReport),
18790 23 => Ok(BarcodeScanner::EAN23LabelControlReport),
18791 24 => Ok(BarcodeScanner::Code39ControlReport),
18792 25 => Ok(BarcodeScanner::Interleaved2of5ControlReport),
18793 26 => Ok(BarcodeScanner::Standard2of5ControlReport),
18794 27 => Ok(BarcodeScanner::MSIPlesseyControlReport),
18795 28 => Ok(BarcodeScanner::CodabarControlReport),
18796 29 => Ok(BarcodeScanner::Code128ControlReport),
18797 30 => Ok(BarcodeScanner::Misc1DControlReport),
18798 31 => Ok(BarcodeScanner::TwoDControlReport),
18799 48 => Ok(BarcodeScanner::AimingPointerMode),
18800 49 => Ok(BarcodeScanner::BarCodePresentSensor),
18801 50 => Ok(BarcodeScanner::Class1ALaser),
18802 51 => Ok(BarcodeScanner::Class2Laser),
18803 52 => Ok(BarcodeScanner::HeaterPresent),
18804 53 => Ok(BarcodeScanner::ContactScanner),
18805 54 => Ok(BarcodeScanner::ElectronicArticleSurveillanceNotification),
18806 55 => Ok(BarcodeScanner::ConstantElectronicArticleSurveillance),
18807 56 => Ok(BarcodeScanner::ErrorIndication),
18808 57 => Ok(BarcodeScanner::FixedBeeper),
18809 58 => Ok(BarcodeScanner::GoodDecodeIndication),
18810 59 => Ok(BarcodeScanner::HandsFreeScanning),
18811 60 => Ok(BarcodeScanner::IntrinsicallySafe),
18812 61 => Ok(BarcodeScanner::KlasseEinsLaser),
18813 62 => Ok(BarcodeScanner::LongRangeScanner),
18814 63 => Ok(BarcodeScanner::MirrorSpeedControl),
18815 64 => Ok(BarcodeScanner::NotOnFileIndication),
18816 65 => Ok(BarcodeScanner::ProgrammableBeeper),
18817 66 => Ok(BarcodeScanner::Triggerless),
18818 67 => Ok(BarcodeScanner::Wand),
18819 68 => Ok(BarcodeScanner::WaterResistant),
18820 69 => Ok(BarcodeScanner::MultiRangeScanner),
18821 70 => Ok(BarcodeScanner::ProximitySensor),
18822 77 => Ok(BarcodeScanner::FragmentDecoding),
18823 78 => Ok(BarcodeScanner::ScannerReadConfidence),
18824 79 => Ok(BarcodeScanner::DataPrefix),
18825 80 => Ok(BarcodeScanner::PrefixAIMI),
18826 81 => Ok(BarcodeScanner::PrefixNone),
18827 82 => Ok(BarcodeScanner::PrefixProprietary),
18828 85 => Ok(BarcodeScanner::ActiveTime),
18829 86 => Ok(BarcodeScanner::AimingLaserPattern),
18830 87 => Ok(BarcodeScanner::BarCodePresent),
18831 88 => Ok(BarcodeScanner::BeeperState),
18832 89 => Ok(BarcodeScanner::LaserOnTime),
18833 90 => Ok(BarcodeScanner::LaserState),
18834 91 => Ok(BarcodeScanner::LockoutTime),
18835 92 => Ok(BarcodeScanner::MotorState),
18836 93 => Ok(BarcodeScanner::MotorTimeout),
18837 94 => Ok(BarcodeScanner::PowerOnResetScanner),
18838 95 => Ok(BarcodeScanner::PreventReadofBarcodes),
18839 96 => Ok(BarcodeScanner::InitiateBarcodeRead),
18840 97 => Ok(BarcodeScanner::TriggerState),
18841 98 => Ok(BarcodeScanner::TriggerMode),
18842 99 => Ok(BarcodeScanner::TriggerModeBlinkingLaserOn),
18843 100 => Ok(BarcodeScanner::TriggerModeContinuousLaserOn),
18844 101 => Ok(BarcodeScanner::TriggerModeLaseronwhilePulled),
18845 102 => Ok(BarcodeScanner::TriggerModeLaserstaysonafterrelease),
18846 109 => Ok(BarcodeScanner::CommitParameterstoNVM),
18847 110 => Ok(BarcodeScanner::ParameterScanning),
18848 111 => Ok(BarcodeScanner::ParametersChanged),
18849 112 => Ok(BarcodeScanner::Setparameterdefaultvalues),
18850 117 => Ok(BarcodeScanner::ScannerInCradle),
18851 118 => Ok(BarcodeScanner::ScannerInRange),
18852 122 => Ok(BarcodeScanner::AimDuration),
18853 123 => Ok(BarcodeScanner::GoodReadLampDuration),
18854 124 => Ok(BarcodeScanner::GoodReadLampIntensity),
18855 125 => Ok(BarcodeScanner::GoodReadLED),
18856 126 => Ok(BarcodeScanner::GoodReadToneFrequency),
18857 127 => Ok(BarcodeScanner::GoodReadToneLength),
18858 128 => Ok(BarcodeScanner::GoodReadToneVolume),
18859 130 => Ok(BarcodeScanner::NoReadMessage),
18860 131 => Ok(BarcodeScanner::NotonFileVolume),
18861 132 => Ok(BarcodeScanner::PowerupBeep),
18862 133 => Ok(BarcodeScanner::SoundErrorBeep),
18863 134 => Ok(BarcodeScanner::SoundGoodReadBeep),
18864 135 => Ok(BarcodeScanner::SoundNotOnFileBeep),
18865 136 => Ok(BarcodeScanner::GoodReadWhentoWrite),
18866 137 => Ok(BarcodeScanner::GRWTIAfterDecode),
18867 138 => Ok(BarcodeScanner::GRWTIBeepLampaftertransmit),
18868 139 => Ok(BarcodeScanner::GRWTINoBeepLampuseatall),
18869 145 => Ok(BarcodeScanner::BooklandEAN),
18870 146 => Ok(BarcodeScanner::ConvertEAN8to13Type),
18871 147 => Ok(BarcodeScanner::ConvertUPCAtoEAN13),
18872 148 => Ok(BarcodeScanner::ConvertUPCEtoA),
18873 149 => Ok(BarcodeScanner::EAN13),
18874 150 => Ok(BarcodeScanner::EAN8),
18875 151 => Ok(BarcodeScanner::EAN99128Mandatory),
18876 152 => Ok(BarcodeScanner::EAN99P5128Optional),
18877 153 => Ok(BarcodeScanner::EnableEANTwoLabel),
18878 154 => Ok(BarcodeScanner::UPCEAN),
18879 155 => Ok(BarcodeScanner::UPCEANCouponCode),
18880 156 => Ok(BarcodeScanner::UPCEANPeriodicals),
18881 157 => Ok(BarcodeScanner::UPCA),
18882 158 => Ok(BarcodeScanner::UPCAwith128Mandatory),
18883 159 => Ok(BarcodeScanner::UPCAwith128Optional),
18884 160 => Ok(BarcodeScanner::UPCAwithP5Optional),
18885 161 => Ok(BarcodeScanner::UPCE),
18886 162 => Ok(BarcodeScanner::UPCE1),
18887 169 => Ok(BarcodeScanner::Periodical),
18888 170 => Ok(BarcodeScanner::PeriodicalAutoDiscriminatePlus2),
18889 171 => Ok(BarcodeScanner::PeriodicalOnlyDecodewithPlus2),
18890 172 => Ok(BarcodeScanner::PeriodicalIgnorePlus2),
18891 173 => Ok(BarcodeScanner::PeriodicalAutoDiscriminatePlus5),
18892 174 => Ok(BarcodeScanner::PeriodicalOnlyDecodewithPlus5),
18893 175 => Ok(BarcodeScanner::PeriodicalIgnorePlus5),
18894 176 => Ok(BarcodeScanner::Check),
18895 177 => Ok(BarcodeScanner::CheckDisablePrice),
18896 178 => Ok(BarcodeScanner::CheckEnable4digitPrice),
18897 179 => Ok(BarcodeScanner::CheckEnable5digitPrice),
18898 180 => Ok(BarcodeScanner::CheckEnableEuropean4digitPrice),
18899 181 => Ok(BarcodeScanner::CheckEnableEuropean5digitPrice),
18900 183 => Ok(BarcodeScanner::EANTwoLabel),
18901 184 => Ok(BarcodeScanner::EANThreeLabel),
18902 185 => Ok(BarcodeScanner::EAN8FlagDigit1),
18903 186 => Ok(BarcodeScanner::EAN8FlagDigit2),
18904 187 => Ok(BarcodeScanner::EAN8FlagDigit3),
18905 188 => Ok(BarcodeScanner::EAN13FlagDigit1),
18906 189 => Ok(BarcodeScanner::EAN13FlagDigit2),
18907 190 => Ok(BarcodeScanner::EAN13FlagDigit3),
18908 191 => Ok(BarcodeScanner::AddEAN23LabelDefinition),
18909 192 => Ok(BarcodeScanner::ClearallEAN23LabelDefinitions),
18910 195 => Ok(BarcodeScanner::Codabar),
18911 196 => Ok(BarcodeScanner::Code128),
18912 199 => Ok(BarcodeScanner::Code39),
18913 200 => Ok(BarcodeScanner::Code93),
18914 201 => Ok(BarcodeScanner::FullASCIIConversion),
18915 202 => Ok(BarcodeScanner::Interleaved2of5),
18916 203 => Ok(BarcodeScanner::ItalianPharmacyCode),
18917 204 => Ok(BarcodeScanner::MSIPlessey),
18918 205 => Ok(BarcodeScanner::Standard2of5IATA),
18919 206 => Ok(BarcodeScanner::Standard2of5),
18920 211 => Ok(BarcodeScanner::TransmitStartStop),
18921 212 => Ok(BarcodeScanner::TriOptic),
18922 213 => Ok(BarcodeScanner::UCCEAN128),
18923 214 => Ok(BarcodeScanner::CheckDigit),
18924 215 => Ok(BarcodeScanner::CheckDigitDisable),
18925 216 => Ok(BarcodeScanner::CheckDigitEnableInterleaved2of5OPCC),
18926 217 => Ok(BarcodeScanner::CheckDigitEnableInterleaved2of5USS),
18927 218 => Ok(BarcodeScanner::CheckDigitEnableStandard2of5OPCC),
18928 219 => Ok(BarcodeScanner::CheckDigitEnableStandard2of5USS),
18929 220 => Ok(BarcodeScanner::CheckDigitEnableOneMSIPlessey),
18930 221 => Ok(BarcodeScanner::CheckDigitEnableTwoMSIPlessey),
18931 222 => Ok(BarcodeScanner::CheckDigitCodabarEnable),
18932 223 => Ok(BarcodeScanner::CheckDigitCode39Enable),
18933 240 => Ok(BarcodeScanner::TransmitCheckDigit),
18934 241 => Ok(BarcodeScanner::DisableCheckDigitTransmit),
18935 242 => Ok(BarcodeScanner::EnableCheckDigitTransmit),
18936 251 => Ok(BarcodeScanner::SymbologyIdentifier1),
18937 252 => Ok(BarcodeScanner::SymbologyIdentifier2),
18938 253 => Ok(BarcodeScanner::SymbologyIdentifier3),
18939 254 => Ok(BarcodeScanner::DecodedData),
18940 255 => Ok(BarcodeScanner::DecodeDataContinued),
18941 256 => Ok(BarcodeScanner::BarSpaceData),
18942 257 => Ok(BarcodeScanner::ScannerDataAccuracy),
18943 258 => Ok(BarcodeScanner::RawDataPolarity),
18944 259 => Ok(BarcodeScanner::PolarityInvertedBarCode),
18945 260 => Ok(BarcodeScanner::PolarityNormalBarCode),
18946 262 => Ok(BarcodeScanner::MinimumLengthtoDecode),
18947 263 => Ok(BarcodeScanner::MaximumLengthtoDecode),
18948 264 => Ok(BarcodeScanner::DiscreteLengthtoDecode1),
18949 265 => Ok(BarcodeScanner::DiscreteLengthtoDecode2),
18950 266 => Ok(BarcodeScanner::DataLengthMethod),
18951 267 => Ok(BarcodeScanner::DLMethodReadany),
18952 268 => Ok(BarcodeScanner::DLMethodCheckinRange),
18953 269 => Ok(BarcodeScanner::DLMethodCheckforDiscrete),
18954 272 => Ok(BarcodeScanner::AztecCode),
18955 273 => Ok(BarcodeScanner::BC412),
18956 274 => Ok(BarcodeScanner::ChannelCode),
18957 275 => Ok(BarcodeScanner::Code16),
18958 276 => Ok(BarcodeScanner::Code32),
18959 277 => Ok(BarcodeScanner::Code49),
18960 278 => Ok(BarcodeScanner::CodeOne),
18961 279 => Ok(BarcodeScanner::Colorcode),
18962 280 => Ok(BarcodeScanner::DataMatrix),
18963 281 => Ok(BarcodeScanner::MaxiCode),
18964 282 => Ok(BarcodeScanner::MicroPDF),
18965 283 => Ok(BarcodeScanner::PDF417),
18966 284 => Ok(BarcodeScanner::PosiCode),
18967 285 => Ok(BarcodeScanner::QRCode),
18968 286 => Ok(BarcodeScanner::SuperCode),
18969 287 => Ok(BarcodeScanner::UltraCode),
18970 288 => Ok(BarcodeScanner::USD5SlugCode),
18971 289 => Ok(BarcodeScanner::VeriCode),
18972 n => Err(HutError::UnknownUsageId { usage_id: n }),
18973 }
18974 }
18975}
18976
18977impl BitOr<u16> for BarcodeScanner {
18978 type Output = Usage;
18979
18980 fn bitor(self, usage: u16) -> Usage {
18987 let up = u16::from(self) as u32;
18988 let u = usage as u32;
18989 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
18990 }
18991}
18992
18993#[allow(non_camel_case_types)]
19014#[derive(Debug)]
19015#[non_exhaustive]
19016pub enum Scales {
19017 Scales,
19019 ScaleDevice,
19021 ScaleClass,
19023 ScaleClassIMetric,
19025 ScaleClassIIMetric,
19027 ScaleClassIIIMetric,
19029 ScaleClassIIILMetric,
19031 ScaleClassIVMetric,
19033 ScaleClassIIIEnglish,
19035 ScaleClassIIILEnglish,
19037 ScaleClassIVEnglish,
19039 ScaleClassGeneric,
19041 ScaleAttributeReport,
19043 ScaleControlReport,
19045 ScaleDataReport,
19047 ScaleStatusReport,
19049 ScaleWeightLimitReport,
19051 ScaleStatisticsReport,
19053 DataWeight,
19055 DataScaling,
19057 WeightUnit,
19059 WeightUnitMilligram,
19061 WeightUnitGram,
19063 WeightUnitKilogram,
19065 WeightUnitCarats,
19067 WeightUnitTaels,
19069 WeightUnitGrains,
19071 WeightUnitPennyweights,
19073 WeightUnitMetricTon,
19075 WeightUnitAvoirTon,
19077 WeightUnitTroyOunce,
19079 WeightUnitOunce,
19081 WeightUnitPound,
19083 CalibrationCount,
19085 ReZeroCount,
19087 ScaleStatus,
19089 ScaleStatusFault,
19091 ScaleStatusStableatCenterofZero,
19093 ScaleStatusInMotion,
19095 ScaleStatusWeightStable,
19097 ScaleStatusUnderZero,
19099 ScaleStatusOverWeightLimit,
19101 ScaleStatusRequiresCalibration,
19103 ScaleStatusRequiresRezeroing,
19105 ZeroScale,
19107 EnforcedZeroReturn,
19109}
19110
19111impl Scales {
19112 #[cfg(feature = "std")]
19113 pub fn name(&self) -> String {
19114 match self {
19115 Scales::Scales => "Scales",
19116 Scales::ScaleDevice => "Scale Device",
19117 Scales::ScaleClass => "Scale Class",
19118 Scales::ScaleClassIMetric => "Scale Class I Metric",
19119 Scales::ScaleClassIIMetric => "Scale Class II Metric",
19120 Scales::ScaleClassIIIMetric => "Scale Class III Metric",
19121 Scales::ScaleClassIIILMetric => "Scale Class IIIL Metric",
19122 Scales::ScaleClassIVMetric => "Scale Class IV Metric",
19123 Scales::ScaleClassIIIEnglish => "Scale Class III English",
19124 Scales::ScaleClassIIILEnglish => "Scale Class IIIL English",
19125 Scales::ScaleClassIVEnglish => "Scale Class IV English",
19126 Scales::ScaleClassGeneric => "Scale Class Generic",
19127 Scales::ScaleAttributeReport => "Scale Attribute Report",
19128 Scales::ScaleControlReport => "Scale Control Report",
19129 Scales::ScaleDataReport => "Scale Data Report",
19130 Scales::ScaleStatusReport => "Scale Status Report",
19131 Scales::ScaleWeightLimitReport => "Scale Weight Limit Report",
19132 Scales::ScaleStatisticsReport => "Scale Statistics Report",
19133 Scales::DataWeight => "Data Weight",
19134 Scales::DataScaling => "Data Scaling",
19135 Scales::WeightUnit => "Weight Unit",
19136 Scales::WeightUnitMilligram => "Weight Unit Milligram",
19137 Scales::WeightUnitGram => "Weight Unit Gram",
19138 Scales::WeightUnitKilogram => "Weight Unit Kilogram",
19139 Scales::WeightUnitCarats => "Weight Unit Carats",
19140 Scales::WeightUnitTaels => "Weight Unit Taels",
19141 Scales::WeightUnitGrains => "Weight Unit Grains",
19142 Scales::WeightUnitPennyweights => "Weight Unit Pennyweights",
19143 Scales::WeightUnitMetricTon => "Weight Unit Metric Ton",
19144 Scales::WeightUnitAvoirTon => "Weight Unit Avoir Ton",
19145 Scales::WeightUnitTroyOunce => "Weight Unit Troy Ounce",
19146 Scales::WeightUnitOunce => "Weight Unit Ounce",
19147 Scales::WeightUnitPound => "Weight Unit Pound",
19148 Scales::CalibrationCount => "Calibration Count",
19149 Scales::ReZeroCount => "Re-Zero Count",
19150 Scales::ScaleStatus => "Scale Status",
19151 Scales::ScaleStatusFault => "Scale Status Fault",
19152 Scales::ScaleStatusStableatCenterofZero => "Scale Status Stable at Center of Zero",
19153 Scales::ScaleStatusInMotion => "Scale Status In Motion",
19154 Scales::ScaleStatusWeightStable => "Scale Status Weight Stable",
19155 Scales::ScaleStatusUnderZero => "Scale Status Under Zero",
19156 Scales::ScaleStatusOverWeightLimit => "Scale Status Over Weight Limit",
19157 Scales::ScaleStatusRequiresCalibration => "Scale Status Requires Calibration",
19158 Scales::ScaleStatusRequiresRezeroing => "Scale Status Requires Rezeroing",
19159 Scales::ZeroScale => "Zero Scale",
19160 Scales::EnforcedZeroReturn => "Enforced Zero Return",
19161 }
19162 .into()
19163 }
19164}
19165
19166#[cfg(feature = "std")]
19167impl fmt::Display for Scales {
19168 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19169 write!(f, "{}", self.name())
19170 }
19171}
19172
19173impl AsUsage for Scales {
19174 fn usage_value(&self) -> u32 {
19176 u32::from(self)
19177 }
19178
19179 fn usage_id_value(&self) -> u16 {
19181 u16::from(self)
19182 }
19183
19184 fn usage(&self) -> Usage {
19195 Usage::from(self)
19196 }
19197}
19198
19199impl AsUsagePage for Scales {
19200 fn usage_page_value(&self) -> u16 {
19204 let up = UsagePage::from(self);
19205 u16::from(up)
19206 }
19207
19208 fn usage_page(&self) -> UsagePage {
19210 UsagePage::from(self)
19211 }
19212}
19213
19214impl From<&Scales> for u16 {
19215 fn from(scales: &Scales) -> u16 {
19216 match *scales {
19217 Scales::Scales => 1,
19218 Scales::ScaleDevice => 32,
19219 Scales::ScaleClass => 33,
19220 Scales::ScaleClassIMetric => 34,
19221 Scales::ScaleClassIIMetric => 35,
19222 Scales::ScaleClassIIIMetric => 36,
19223 Scales::ScaleClassIIILMetric => 37,
19224 Scales::ScaleClassIVMetric => 38,
19225 Scales::ScaleClassIIIEnglish => 39,
19226 Scales::ScaleClassIIILEnglish => 40,
19227 Scales::ScaleClassIVEnglish => 41,
19228 Scales::ScaleClassGeneric => 42,
19229 Scales::ScaleAttributeReport => 48,
19230 Scales::ScaleControlReport => 49,
19231 Scales::ScaleDataReport => 50,
19232 Scales::ScaleStatusReport => 51,
19233 Scales::ScaleWeightLimitReport => 52,
19234 Scales::ScaleStatisticsReport => 53,
19235 Scales::DataWeight => 64,
19236 Scales::DataScaling => 65,
19237 Scales::WeightUnit => 80,
19238 Scales::WeightUnitMilligram => 81,
19239 Scales::WeightUnitGram => 82,
19240 Scales::WeightUnitKilogram => 83,
19241 Scales::WeightUnitCarats => 84,
19242 Scales::WeightUnitTaels => 85,
19243 Scales::WeightUnitGrains => 86,
19244 Scales::WeightUnitPennyweights => 87,
19245 Scales::WeightUnitMetricTon => 88,
19246 Scales::WeightUnitAvoirTon => 89,
19247 Scales::WeightUnitTroyOunce => 90,
19248 Scales::WeightUnitOunce => 91,
19249 Scales::WeightUnitPound => 92,
19250 Scales::CalibrationCount => 96,
19251 Scales::ReZeroCount => 97,
19252 Scales::ScaleStatus => 112,
19253 Scales::ScaleStatusFault => 113,
19254 Scales::ScaleStatusStableatCenterofZero => 114,
19255 Scales::ScaleStatusInMotion => 115,
19256 Scales::ScaleStatusWeightStable => 116,
19257 Scales::ScaleStatusUnderZero => 117,
19258 Scales::ScaleStatusOverWeightLimit => 118,
19259 Scales::ScaleStatusRequiresCalibration => 119,
19260 Scales::ScaleStatusRequiresRezeroing => 120,
19261 Scales::ZeroScale => 128,
19262 Scales::EnforcedZeroReturn => 129,
19263 }
19264 }
19265}
19266
19267impl From<Scales> for u16 {
19268 fn from(scales: Scales) -> u16 {
19271 u16::from(&scales)
19272 }
19273}
19274
19275impl From<&Scales> for u32 {
19276 fn from(scales: &Scales) -> u32 {
19279 let up = UsagePage::from(scales);
19280 let up = (u16::from(&up) as u32) << 16;
19281 let id = u16::from(scales) as u32;
19282 up | id
19283 }
19284}
19285
19286impl From<&Scales> for UsagePage {
19287 fn from(_: &Scales) -> UsagePage {
19290 UsagePage::Scales
19291 }
19292}
19293
19294impl From<Scales> for UsagePage {
19295 fn from(_: Scales) -> UsagePage {
19298 UsagePage::Scales
19299 }
19300}
19301
19302impl From<&Scales> for Usage {
19303 fn from(scales: &Scales) -> Usage {
19304 Usage::try_from(u32::from(scales)).unwrap()
19305 }
19306}
19307
19308impl From<Scales> for Usage {
19309 fn from(scales: Scales) -> Usage {
19310 Usage::from(&scales)
19311 }
19312}
19313
19314impl TryFrom<u16> for Scales {
19315 type Error = HutError;
19316
19317 fn try_from(usage_id: u16) -> Result<Scales> {
19318 match usage_id {
19319 1 => Ok(Scales::Scales),
19320 32 => Ok(Scales::ScaleDevice),
19321 33 => Ok(Scales::ScaleClass),
19322 34 => Ok(Scales::ScaleClassIMetric),
19323 35 => Ok(Scales::ScaleClassIIMetric),
19324 36 => Ok(Scales::ScaleClassIIIMetric),
19325 37 => Ok(Scales::ScaleClassIIILMetric),
19326 38 => Ok(Scales::ScaleClassIVMetric),
19327 39 => Ok(Scales::ScaleClassIIIEnglish),
19328 40 => Ok(Scales::ScaleClassIIILEnglish),
19329 41 => Ok(Scales::ScaleClassIVEnglish),
19330 42 => Ok(Scales::ScaleClassGeneric),
19331 48 => Ok(Scales::ScaleAttributeReport),
19332 49 => Ok(Scales::ScaleControlReport),
19333 50 => Ok(Scales::ScaleDataReport),
19334 51 => Ok(Scales::ScaleStatusReport),
19335 52 => Ok(Scales::ScaleWeightLimitReport),
19336 53 => Ok(Scales::ScaleStatisticsReport),
19337 64 => Ok(Scales::DataWeight),
19338 65 => Ok(Scales::DataScaling),
19339 80 => Ok(Scales::WeightUnit),
19340 81 => Ok(Scales::WeightUnitMilligram),
19341 82 => Ok(Scales::WeightUnitGram),
19342 83 => Ok(Scales::WeightUnitKilogram),
19343 84 => Ok(Scales::WeightUnitCarats),
19344 85 => Ok(Scales::WeightUnitTaels),
19345 86 => Ok(Scales::WeightUnitGrains),
19346 87 => Ok(Scales::WeightUnitPennyweights),
19347 88 => Ok(Scales::WeightUnitMetricTon),
19348 89 => Ok(Scales::WeightUnitAvoirTon),
19349 90 => Ok(Scales::WeightUnitTroyOunce),
19350 91 => Ok(Scales::WeightUnitOunce),
19351 92 => Ok(Scales::WeightUnitPound),
19352 96 => Ok(Scales::CalibrationCount),
19353 97 => Ok(Scales::ReZeroCount),
19354 112 => Ok(Scales::ScaleStatus),
19355 113 => Ok(Scales::ScaleStatusFault),
19356 114 => Ok(Scales::ScaleStatusStableatCenterofZero),
19357 115 => Ok(Scales::ScaleStatusInMotion),
19358 116 => Ok(Scales::ScaleStatusWeightStable),
19359 117 => Ok(Scales::ScaleStatusUnderZero),
19360 118 => Ok(Scales::ScaleStatusOverWeightLimit),
19361 119 => Ok(Scales::ScaleStatusRequiresCalibration),
19362 120 => Ok(Scales::ScaleStatusRequiresRezeroing),
19363 128 => Ok(Scales::ZeroScale),
19364 129 => Ok(Scales::EnforcedZeroReturn),
19365 n => Err(HutError::UnknownUsageId { usage_id: n }),
19366 }
19367 }
19368}
19369
19370impl BitOr<u16> for Scales {
19371 type Output = Usage;
19372
19373 fn bitor(self, usage: u16) -> Usage {
19380 let up = u16::from(self) as u32;
19381 let u = usage as u32;
19382 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
19383 }
19384}
19385
19386#[allow(non_camel_case_types)]
19407#[derive(Debug)]
19408#[non_exhaustive]
19409pub enum MagneticStripeReader {
19410 MSRDeviceReadOnly,
19412 Track1Length,
19414 Track2Length,
19416 Track3Length,
19418 TrackJISLength,
19420 TrackData,
19422 Track1Data,
19424 Track2Data,
19426 Track3Data,
19428 TrackJISData,
19430}
19431
19432impl MagneticStripeReader {
19433 #[cfg(feature = "std")]
19434 pub fn name(&self) -> String {
19435 match self {
19436 MagneticStripeReader::MSRDeviceReadOnly => "MSR Device Read-Only",
19437 MagneticStripeReader::Track1Length => "Track 1 Length",
19438 MagneticStripeReader::Track2Length => "Track 2 Length",
19439 MagneticStripeReader::Track3Length => "Track 3 Length",
19440 MagneticStripeReader::TrackJISLength => "Track JIS Length",
19441 MagneticStripeReader::TrackData => "Track Data",
19442 MagneticStripeReader::Track1Data => "Track 1 Data",
19443 MagneticStripeReader::Track2Data => "Track 2 Data",
19444 MagneticStripeReader::Track3Data => "Track 3 Data",
19445 MagneticStripeReader::TrackJISData => "Track JIS Data",
19446 }
19447 .into()
19448 }
19449}
19450
19451#[cfg(feature = "std")]
19452impl fmt::Display for MagneticStripeReader {
19453 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19454 write!(f, "{}", self.name())
19455 }
19456}
19457
19458impl AsUsage for MagneticStripeReader {
19459 fn usage_value(&self) -> u32 {
19461 u32::from(self)
19462 }
19463
19464 fn usage_id_value(&self) -> u16 {
19466 u16::from(self)
19467 }
19468
19469 fn usage(&self) -> Usage {
19480 Usage::from(self)
19481 }
19482}
19483
19484impl AsUsagePage for MagneticStripeReader {
19485 fn usage_page_value(&self) -> u16 {
19489 let up = UsagePage::from(self);
19490 u16::from(up)
19491 }
19492
19493 fn usage_page(&self) -> UsagePage {
19495 UsagePage::from(self)
19496 }
19497}
19498
19499impl From<&MagneticStripeReader> for u16 {
19500 fn from(magneticstripereader: &MagneticStripeReader) -> u16 {
19501 match *magneticstripereader {
19502 MagneticStripeReader::MSRDeviceReadOnly => 1,
19503 MagneticStripeReader::Track1Length => 17,
19504 MagneticStripeReader::Track2Length => 18,
19505 MagneticStripeReader::Track3Length => 19,
19506 MagneticStripeReader::TrackJISLength => 20,
19507 MagneticStripeReader::TrackData => 32,
19508 MagneticStripeReader::Track1Data => 33,
19509 MagneticStripeReader::Track2Data => 34,
19510 MagneticStripeReader::Track3Data => 35,
19511 MagneticStripeReader::TrackJISData => 36,
19512 }
19513 }
19514}
19515
19516impl From<MagneticStripeReader> for u16 {
19517 fn from(magneticstripereader: MagneticStripeReader) -> u16 {
19520 u16::from(&magneticstripereader)
19521 }
19522}
19523
19524impl From<&MagneticStripeReader> for u32 {
19525 fn from(magneticstripereader: &MagneticStripeReader) -> u32 {
19528 let up = UsagePage::from(magneticstripereader);
19529 let up = (u16::from(&up) as u32) << 16;
19530 let id = u16::from(magneticstripereader) as u32;
19531 up | id
19532 }
19533}
19534
19535impl From<&MagneticStripeReader> for UsagePage {
19536 fn from(_: &MagneticStripeReader) -> UsagePage {
19539 UsagePage::MagneticStripeReader
19540 }
19541}
19542
19543impl From<MagneticStripeReader> for UsagePage {
19544 fn from(_: MagneticStripeReader) -> UsagePage {
19547 UsagePage::MagneticStripeReader
19548 }
19549}
19550
19551impl From<&MagneticStripeReader> for Usage {
19552 fn from(magneticstripereader: &MagneticStripeReader) -> Usage {
19553 Usage::try_from(u32::from(magneticstripereader)).unwrap()
19554 }
19555}
19556
19557impl From<MagneticStripeReader> for Usage {
19558 fn from(magneticstripereader: MagneticStripeReader) -> Usage {
19559 Usage::from(&magneticstripereader)
19560 }
19561}
19562
19563impl TryFrom<u16> for MagneticStripeReader {
19564 type Error = HutError;
19565
19566 fn try_from(usage_id: u16) -> Result<MagneticStripeReader> {
19567 match usage_id {
19568 1 => Ok(MagneticStripeReader::MSRDeviceReadOnly),
19569 17 => Ok(MagneticStripeReader::Track1Length),
19570 18 => Ok(MagneticStripeReader::Track2Length),
19571 19 => Ok(MagneticStripeReader::Track3Length),
19572 20 => Ok(MagneticStripeReader::TrackJISLength),
19573 32 => Ok(MagneticStripeReader::TrackData),
19574 33 => Ok(MagneticStripeReader::Track1Data),
19575 34 => Ok(MagneticStripeReader::Track2Data),
19576 35 => Ok(MagneticStripeReader::Track3Data),
19577 36 => Ok(MagneticStripeReader::TrackJISData),
19578 n => Err(HutError::UnknownUsageId { usage_id: n }),
19579 }
19580 }
19581}
19582
19583impl BitOr<u16> for MagneticStripeReader {
19584 type Output = Usage;
19585
19586 fn bitor(self, usage: u16) -> Usage {
19593 let up = u16::from(self) as u32;
19594 let u = usage as u32;
19595 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
19596 }
19597}
19598
19599#[allow(non_camel_case_types)]
19620#[derive(Debug)]
19621#[non_exhaustive]
19622pub enum CameraControl {
19623 CameraAutofocus,
19625 CameraShutter,
19627}
19628
19629impl CameraControl {
19630 #[cfg(feature = "std")]
19631 pub fn name(&self) -> String {
19632 match self {
19633 CameraControl::CameraAutofocus => "Camera Auto-focus",
19634 CameraControl::CameraShutter => "Camera Shutter",
19635 }
19636 .into()
19637 }
19638}
19639
19640#[cfg(feature = "std")]
19641impl fmt::Display for CameraControl {
19642 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19643 write!(f, "{}", self.name())
19644 }
19645}
19646
19647impl AsUsage for CameraControl {
19648 fn usage_value(&self) -> u32 {
19650 u32::from(self)
19651 }
19652
19653 fn usage_id_value(&self) -> u16 {
19655 u16::from(self)
19656 }
19657
19658 fn usage(&self) -> Usage {
19669 Usage::from(self)
19670 }
19671}
19672
19673impl AsUsagePage for CameraControl {
19674 fn usage_page_value(&self) -> u16 {
19678 let up = UsagePage::from(self);
19679 u16::from(up)
19680 }
19681
19682 fn usage_page(&self) -> UsagePage {
19684 UsagePage::from(self)
19685 }
19686}
19687
19688impl From<&CameraControl> for u16 {
19689 fn from(cameracontrol: &CameraControl) -> u16 {
19690 match *cameracontrol {
19691 CameraControl::CameraAutofocus => 32,
19692 CameraControl::CameraShutter => 33,
19693 }
19694 }
19695}
19696
19697impl From<CameraControl> for u16 {
19698 fn from(cameracontrol: CameraControl) -> u16 {
19701 u16::from(&cameracontrol)
19702 }
19703}
19704
19705impl From<&CameraControl> for u32 {
19706 fn from(cameracontrol: &CameraControl) -> u32 {
19709 let up = UsagePage::from(cameracontrol);
19710 let up = (u16::from(&up) as u32) << 16;
19711 let id = u16::from(cameracontrol) as u32;
19712 up | id
19713 }
19714}
19715
19716impl From<&CameraControl> for UsagePage {
19717 fn from(_: &CameraControl) -> UsagePage {
19720 UsagePage::CameraControl
19721 }
19722}
19723
19724impl From<CameraControl> for UsagePage {
19725 fn from(_: CameraControl) -> UsagePage {
19728 UsagePage::CameraControl
19729 }
19730}
19731
19732impl From<&CameraControl> for Usage {
19733 fn from(cameracontrol: &CameraControl) -> Usage {
19734 Usage::try_from(u32::from(cameracontrol)).unwrap()
19735 }
19736}
19737
19738impl From<CameraControl> for Usage {
19739 fn from(cameracontrol: CameraControl) -> Usage {
19740 Usage::from(&cameracontrol)
19741 }
19742}
19743
19744impl TryFrom<u16> for CameraControl {
19745 type Error = HutError;
19746
19747 fn try_from(usage_id: u16) -> Result<CameraControl> {
19748 match usage_id {
19749 32 => Ok(CameraControl::CameraAutofocus),
19750 33 => Ok(CameraControl::CameraShutter),
19751 n => Err(HutError::UnknownUsageId { usage_id: n }),
19752 }
19753 }
19754}
19755
19756impl BitOr<u16> for CameraControl {
19757 type Output = Usage;
19758
19759 fn bitor(self, usage: u16) -> Usage {
19766 let up = u16::from(self) as u32;
19767 let u = usage as u32;
19768 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
19769 }
19770}
19771
19772#[allow(non_camel_case_types)]
19793#[derive(Debug)]
19794#[non_exhaustive]
19795pub enum Arcade {
19796 GeneralPurposeIOCard,
19798 CoinDoor,
19800 WatchdogTimer,
19802 GeneralPurposeAnalogInputState,
19804 GeneralPurposeDigitalInputState,
19806 GeneralPurposeOpticalInputState,
19808 GeneralPurposeDigitalOutputState,
19810 NumberofCoinDoors,
19812 CoinDrawerDropCount,
19814 CoinDrawerStart,
19816 CoinDrawerService,
19818 CoinDrawerTilt,
19820 CoinDoorTest,
19822 CoinDoorLockout,
19824 WatchdogTimeout,
19826 WatchdogAction,
19828 WatchdogReboot,
19830 WatchdogRestart,
19832 AlarmInput,
19834 CoinDoorCounter,
19836 IODirectionMapping,
19838 SetIODirectionMapping,
19840 ExtendedOpticalInputState,
19842 PinPadInputState,
19844 PinPadStatus,
19846 PinPadOutput,
19848 PinPadCommand,
19850}
19851
19852impl Arcade {
19853 #[cfg(feature = "std")]
19854 pub fn name(&self) -> String {
19855 match self {
19856 Arcade::GeneralPurposeIOCard => "General Purpose IO Card",
19857 Arcade::CoinDoor => "Coin Door",
19858 Arcade::WatchdogTimer => "Watchdog Timer",
19859 Arcade::GeneralPurposeAnalogInputState => "General Purpose Analog Input State",
19860 Arcade::GeneralPurposeDigitalInputState => "General Purpose Digital Input State",
19861 Arcade::GeneralPurposeOpticalInputState => "General Purpose Optical Input State",
19862 Arcade::GeneralPurposeDigitalOutputState => "General Purpose Digital Output State",
19863 Arcade::NumberofCoinDoors => "Number of Coin Doors",
19864 Arcade::CoinDrawerDropCount => "Coin Drawer Drop Count",
19865 Arcade::CoinDrawerStart => "Coin Drawer Start",
19866 Arcade::CoinDrawerService => "Coin Drawer Service",
19867 Arcade::CoinDrawerTilt => "Coin Drawer Tilt",
19868 Arcade::CoinDoorTest => "Coin Door Test",
19869 Arcade::CoinDoorLockout => "Coin Door Lockout",
19870 Arcade::WatchdogTimeout => "Watchdog Timeout",
19871 Arcade::WatchdogAction => "Watchdog Action",
19872 Arcade::WatchdogReboot => "Watchdog Reboot",
19873 Arcade::WatchdogRestart => "Watchdog Restart",
19874 Arcade::AlarmInput => "Alarm Input",
19875 Arcade::CoinDoorCounter => "Coin Door Counter",
19876 Arcade::IODirectionMapping => "I/O Direction Mapping",
19877 Arcade::SetIODirectionMapping => "Set I/O Direction Mapping",
19878 Arcade::ExtendedOpticalInputState => "Extended Optical Input State",
19879 Arcade::PinPadInputState => "Pin Pad Input State",
19880 Arcade::PinPadStatus => "Pin Pad Status",
19881 Arcade::PinPadOutput => "Pin Pad Output",
19882 Arcade::PinPadCommand => "Pin Pad Command",
19883 }
19884 .into()
19885 }
19886}
19887
19888#[cfg(feature = "std")]
19889impl fmt::Display for Arcade {
19890 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19891 write!(f, "{}", self.name())
19892 }
19893}
19894
19895impl AsUsage for Arcade {
19896 fn usage_value(&self) -> u32 {
19898 u32::from(self)
19899 }
19900
19901 fn usage_id_value(&self) -> u16 {
19903 u16::from(self)
19904 }
19905
19906 fn usage(&self) -> Usage {
19917 Usage::from(self)
19918 }
19919}
19920
19921impl AsUsagePage for Arcade {
19922 fn usage_page_value(&self) -> u16 {
19926 let up = UsagePage::from(self);
19927 u16::from(up)
19928 }
19929
19930 fn usage_page(&self) -> UsagePage {
19932 UsagePage::from(self)
19933 }
19934}
19935
19936impl From<&Arcade> for u16 {
19937 fn from(arcade: &Arcade) -> u16 {
19938 match *arcade {
19939 Arcade::GeneralPurposeIOCard => 1,
19940 Arcade::CoinDoor => 2,
19941 Arcade::WatchdogTimer => 3,
19942 Arcade::GeneralPurposeAnalogInputState => 48,
19943 Arcade::GeneralPurposeDigitalInputState => 49,
19944 Arcade::GeneralPurposeOpticalInputState => 50,
19945 Arcade::GeneralPurposeDigitalOutputState => 51,
19946 Arcade::NumberofCoinDoors => 52,
19947 Arcade::CoinDrawerDropCount => 53,
19948 Arcade::CoinDrawerStart => 54,
19949 Arcade::CoinDrawerService => 55,
19950 Arcade::CoinDrawerTilt => 56,
19951 Arcade::CoinDoorTest => 57,
19952 Arcade::CoinDoorLockout => 64,
19953 Arcade::WatchdogTimeout => 65,
19954 Arcade::WatchdogAction => 66,
19955 Arcade::WatchdogReboot => 67,
19956 Arcade::WatchdogRestart => 68,
19957 Arcade::AlarmInput => 69,
19958 Arcade::CoinDoorCounter => 70,
19959 Arcade::IODirectionMapping => 71,
19960 Arcade::SetIODirectionMapping => 72,
19961 Arcade::ExtendedOpticalInputState => 73,
19962 Arcade::PinPadInputState => 74,
19963 Arcade::PinPadStatus => 75,
19964 Arcade::PinPadOutput => 76,
19965 Arcade::PinPadCommand => 77,
19966 }
19967 }
19968}
19969
19970impl From<Arcade> for u16 {
19971 fn from(arcade: Arcade) -> u16 {
19974 u16::from(&arcade)
19975 }
19976}
19977
19978impl From<&Arcade> for u32 {
19979 fn from(arcade: &Arcade) -> u32 {
19982 let up = UsagePage::from(arcade);
19983 let up = (u16::from(&up) as u32) << 16;
19984 let id = u16::from(arcade) as u32;
19985 up | id
19986 }
19987}
19988
19989impl From<&Arcade> for UsagePage {
19990 fn from(_: &Arcade) -> UsagePage {
19993 UsagePage::Arcade
19994 }
19995}
19996
19997impl From<Arcade> for UsagePage {
19998 fn from(_: Arcade) -> UsagePage {
20001 UsagePage::Arcade
20002 }
20003}
20004
20005impl From<&Arcade> for Usage {
20006 fn from(arcade: &Arcade) -> Usage {
20007 Usage::try_from(u32::from(arcade)).unwrap()
20008 }
20009}
20010
20011impl From<Arcade> for Usage {
20012 fn from(arcade: Arcade) -> Usage {
20013 Usage::from(&arcade)
20014 }
20015}
20016
20017impl TryFrom<u16> for Arcade {
20018 type Error = HutError;
20019
20020 fn try_from(usage_id: u16) -> Result<Arcade> {
20021 match usage_id {
20022 1 => Ok(Arcade::GeneralPurposeIOCard),
20023 2 => Ok(Arcade::CoinDoor),
20024 3 => Ok(Arcade::WatchdogTimer),
20025 48 => Ok(Arcade::GeneralPurposeAnalogInputState),
20026 49 => Ok(Arcade::GeneralPurposeDigitalInputState),
20027 50 => Ok(Arcade::GeneralPurposeOpticalInputState),
20028 51 => Ok(Arcade::GeneralPurposeDigitalOutputState),
20029 52 => Ok(Arcade::NumberofCoinDoors),
20030 53 => Ok(Arcade::CoinDrawerDropCount),
20031 54 => Ok(Arcade::CoinDrawerStart),
20032 55 => Ok(Arcade::CoinDrawerService),
20033 56 => Ok(Arcade::CoinDrawerTilt),
20034 57 => Ok(Arcade::CoinDoorTest),
20035 64 => Ok(Arcade::CoinDoorLockout),
20036 65 => Ok(Arcade::WatchdogTimeout),
20037 66 => Ok(Arcade::WatchdogAction),
20038 67 => Ok(Arcade::WatchdogReboot),
20039 68 => Ok(Arcade::WatchdogRestart),
20040 69 => Ok(Arcade::AlarmInput),
20041 70 => Ok(Arcade::CoinDoorCounter),
20042 71 => Ok(Arcade::IODirectionMapping),
20043 72 => Ok(Arcade::SetIODirectionMapping),
20044 73 => Ok(Arcade::ExtendedOpticalInputState),
20045 74 => Ok(Arcade::PinPadInputState),
20046 75 => Ok(Arcade::PinPadStatus),
20047 76 => Ok(Arcade::PinPadOutput),
20048 77 => Ok(Arcade::PinPadCommand),
20049 n => Err(HutError::UnknownUsageId { usage_id: n }),
20050 }
20051 }
20052}
20053
20054impl BitOr<u16> for Arcade {
20055 type Output = Usage;
20056
20057 fn bitor(self, usage: u16) -> Usage {
20064 let up = u16::from(self) as u32;
20065 let u = usage as u32;
20066 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
20067 }
20068}
20069
20070#[allow(non_camel_case_types)]
20091#[derive(Debug)]
20092#[non_exhaustive]
20093pub enum FIDOAlliance {
20094 U2FAuthenticatorDevice,
20096 InputReportData,
20098 OutputReportData,
20100}
20101
20102impl FIDOAlliance {
20103 #[cfg(feature = "std")]
20104 pub fn name(&self) -> String {
20105 match self {
20106 FIDOAlliance::U2FAuthenticatorDevice => "U2F Authenticator Device",
20107 FIDOAlliance::InputReportData => "Input Report Data",
20108 FIDOAlliance::OutputReportData => "Output Report Data",
20109 }
20110 .into()
20111 }
20112}
20113
20114#[cfg(feature = "std")]
20115impl fmt::Display for FIDOAlliance {
20116 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
20117 write!(f, "{}", self.name())
20118 }
20119}
20120
20121impl AsUsage for FIDOAlliance {
20122 fn usage_value(&self) -> u32 {
20124 u32::from(self)
20125 }
20126
20127 fn usage_id_value(&self) -> u16 {
20129 u16::from(self)
20130 }
20131
20132 fn usage(&self) -> Usage {
20143 Usage::from(self)
20144 }
20145}
20146
20147impl AsUsagePage for FIDOAlliance {
20148 fn usage_page_value(&self) -> u16 {
20152 let up = UsagePage::from(self);
20153 u16::from(up)
20154 }
20155
20156 fn usage_page(&self) -> UsagePage {
20158 UsagePage::from(self)
20159 }
20160}
20161
20162impl From<&FIDOAlliance> for u16 {
20163 fn from(fidoalliance: &FIDOAlliance) -> u16 {
20164 match *fidoalliance {
20165 FIDOAlliance::U2FAuthenticatorDevice => 1,
20166 FIDOAlliance::InputReportData => 32,
20167 FIDOAlliance::OutputReportData => 33,
20168 }
20169 }
20170}
20171
20172impl From<FIDOAlliance> for u16 {
20173 fn from(fidoalliance: FIDOAlliance) -> u16 {
20176 u16::from(&fidoalliance)
20177 }
20178}
20179
20180impl From<&FIDOAlliance> for u32 {
20181 fn from(fidoalliance: &FIDOAlliance) -> u32 {
20184 let up = UsagePage::from(fidoalliance);
20185 let up = (u16::from(&up) as u32) << 16;
20186 let id = u16::from(fidoalliance) as u32;
20187 up | id
20188 }
20189}
20190
20191impl From<&FIDOAlliance> for UsagePage {
20192 fn from(_: &FIDOAlliance) -> UsagePage {
20195 UsagePage::FIDOAlliance
20196 }
20197}
20198
20199impl From<FIDOAlliance> for UsagePage {
20200 fn from(_: FIDOAlliance) -> UsagePage {
20203 UsagePage::FIDOAlliance
20204 }
20205}
20206
20207impl From<&FIDOAlliance> for Usage {
20208 fn from(fidoalliance: &FIDOAlliance) -> Usage {
20209 Usage::try_from(u32::from(fidoalliance)).unwrap()
20210 }
20211}
20212
20213impl From<FIDOAlliance> for Usage {
20214 fn from(fidoalliance: FIDOAlliance) -> Usage {
20215 Usage::from(&fidoalliance)
20216 }
20217}
20218
20219impl TryFrom<u16> for FIDOAlliance {
20220 type Error = HutError;
20221
20222 fn try_from(usage_id: u16) -> Result<FIDOAlliance> {
20223 match usage_id {
20224 1 => Ok(FIDOAlliance::U2FAuthenticatorDevice),
20225 32 => Ok(FIDOAlliance::InputReportData),
20226 33 => Ok(FIDOAlliance::OutputReportData),
20227 n => Err(HutError::UnknownUsageId { usage_id: n }),
20228 }
20229 }
20230}
20231
20232impl BitOr<u16> for FIDOAlliance {
20233 type Output = Usage;
20234
20235 fn bitor(self, usage: u16) -> Usage {
20242 let up = u16::from(self) as u32;
20243 let u = usage as u32;
20244 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
20245 }
20246}
20247
20248#[allow(non_camel_case_types)]
20269#[derive(Debug)]
20270#[non_exhaustive]
20271pub enum Wacom {
20272 WacomDigitizer,
20274 WacomPen,
20276 LightPen,
20278 TouchScreen,
20280 TouchPad,
20282 WhiteBoard,
20284 CoordinateMeasuringMachine,
20286 ThreeDDigitizer,
20288 StereoPlotter,
20290 ArticulatedArm,
20292 Armature,
20294 MultiplePointDigitizer,
20296 FreeSpaceWand,
20298 DeviceConfiguration,
20300 Stylus,
20302 Puck,
20304 Finger,
20306 DeviceSettings,
20308 TipPressure,
20310 BarrelPressure,
20312 InRange,
20314 Touch,
20316 Untouch,
20318 Tap,
20320 WacomSense,
20322 DataValid,
20324 TransducerIndex,
20326 WacomDigitizerFnKeys,
20328 ProgramChangeKeys,
20330 BatteryStrength,
20332 Invert,
20334 XTilt,
20336 YTilt,
20338 Azimuth,
20340 Altitude,
20342 Twist,
20344 TipSwitch,
20346 SecondaryTipSwitch,
20348 BarrelSwitch,
20350 Eraser,
20352 TabletPick,
20354 Confidence,
20356 Width,
20358 Height,
20360 ContactId,
20362 Inputmode,
20364 DeviceIndex,
20366 ContactCount,
20368 ContactMax,
20370 ScanTime,
20372 SurfaceSwitch,
20374 ButtonSwitch,
20376 ButtonType,
20378 SecondaryBarrelSwitch,
20380 TransducerSerialNumber,
20382 WacomSerialHi,
20384 PreferredColorisLocked,
20386 PreferredLineWidth,
20388 PreferredLineWidthisLocked,
20390 PreferredLineStyle,
20392 PreferredLineStyleisLocked,
20394 Ink,
20396 Pencil,
20398 Highlighter,
20400 ChiselMarker,
20402 Brush,
20404 WacomToolType,
20406 DigitizerDiagnostic,
20408 DigitizerError,
20410 ErrNormalStatus,
20412 ErrTransducersExceeded,
20414 ErrFullTransFeaturesUnavail,
20416 ErrChargeLow,
20418 X,
20420 Y,
20422 WacomDistance,
20424 WacomTouchStrip,
20426 WacomTouchStrip2,
20428 WacomTouchRing,
20430 WacomTouchRingStatus,
20432 WacomAccelerometerX,
20434 WacomAccelerometerY,
20436 WacomAccelerometerZ,
20438 WacomBatteryCharging,
20440 WacomBatteryLevel,
20442 WacomTouchOnOff,
20444 WacomExpressKey00,
20446 WacomExpressKeyCap00,
20448 WacomModeChange,
20450 WacomButtonDesktopCenter,
20452 WacomButtonOnScreenKeyboard,
20454 WacomButtonDisplaySetting,
20456 WacomButtonTouchOnOff,
20458 WacomButtonHome,
20460 WacomButtonUp,
20462 WacomButtonDown,
20464 WacomButtonLeft,
20466 WacomButtonRight,
20468 WacomButtonCenter,
20470 WacomFingerWheel,
20472 WacomOffsetLeft,
20474 WacomOffsetTop,
20476 WacomOffsetRight,
20478 WacomOffsetBottom,
20480 WacomDataMode,
20482 WacomDigitizerInfo,
20484}
20485
20486impl Wacom {
20487 #[cfg(feature = "std")]
20488 pub fn name(&self) -> String {
20489 match self {
20490 Wacom::WacomDigitizer => "Wacom Digitizer",
20491 Wacom::WacomPen => "Wacom Pen",
20492 Wacom::LightPen => "Light Pen",
20493 Wacom::TouchScreen => "Touch Screen",
20494 Wacom::TouchPad => "Touch Pad",
20495 Wacom::WhiteBoard => "White Board",
20496 Wacom::CoordinateMeasuringMachine => "Coordinate Measuring Machine",
20497 Wacom::ThreeDDigitizer => "3-D Digitizer",
20498 Wacom::StereoPlotter => "Stereo Plotter",
20499 Wacom::ArticulatedArm => "Articulated Arm",
20500 Wacom::Armature => "Armature",
20501 Wacom::MultiplePointDigitizer => "Multiple Point Digitizer",
20502 Wacom::FreeSpaceWand => "Free Space Wand",
20503 Wacom::DeviceConfiguration => "Device Configuration",
20504 Wacom::Stylus => "Stylus",
20505 Wacom::Puck => "Puck",
20506 Wacom::Finger => "Finger",
20507 Wacom::DeviceSettings => "Device Settings",
20508 Wacom::TipPressure => "Tip Pressure",
20509 Wacom::BarrelPressure => "Barrel Pressure",
20510 Wacom::InRange => "In Range",
20511 Wacom::Touch => "Touch",
20512 Wacom::Untouch => "Untouch",
20513 Wacom::Tap => "Tap",
20514 Wacom::WacomSense => "Wacom Sense",
20515 Wacom::DataValid => "Data Valid",
20516 Wacom::TransducerIndex => "Transducer Index",
20517 Wacom::WacomDigitizerFnKeys => "Wacom DigitizerFnKeys",
20518 Wacom::ProgramChangeKeys => "Program Change Keys",
20519 Wacom::BatteryStrength => "Battery Strength",
20520 Wacom::Invert => "Invert",
20521 Wacom::XTilt => "X Tilt",
20522 Wacom::YTilt => "Y Tilt",
20523 Wacom::Azimuth => "Azimuth",
20524 Wacom::Altitude => "Altitude",
20525 Wacom::Twist => "Twist",
20526 Wacom::TipSwitch => "Tip Switch",
20527 Wacom::SecondaryTipSwitch => "Secondary Tip Switch",
20528 Wacom::BarrelSwitch => "Barrel Switch",
20529 Wacom::Eraser => "Eraser",
20530 Wacom::TabletPick => "Tablet Pick",
20531 Wacom::Confidence => "Confidence",
20532 Wacom::Width => "Width",
20533 Wacom::Height => "Height",
20534 Wacom::ContactId => "Contact Id",
20535 Wacom::Inputmode => "Inputmode",
20536 Wacom::DeviceIndex => "Device Index",
20537 Wacom::ContactCount => "Contact Count",
20538 Wacom::ContactMax => "Contact Max",
20539 Wacom::ScanTime => "Scan Time",
20540 Wacom::SurfaceSwitch => "Surface Switch",
20541 Wacom::ButtonSwitch => "Button Switch",
20542 Wacom::ButtonType => "Button Type",
20543 Wacom::SecondaryBarrelSwitch => "Secondary Barrel Switch",
20544 Wacom::TransducerSerialNumber => "Transducer Serial Number",
20545 Wacom::WacomSerialHi => "Wacom SerialHi",
20546 Wacom::PreferredColorisLocked => "Preferred Color is Locked",
20547 Wacom::PreferredLineWidth => "Preferred Line Width",
20548 Wacom::PreferredLineWidthisLocked => "Preferred Line Width is Locked",
20549 Wacom::PreferredLineStyle => "Preferred Line Style",
20550 Wacom::PreferredLineStyleisLocked => "Preferred Line Style is Locked",
20551 Wacom::Ink => "Ink",
20552 Wacom::Pencil => "Pencil",
20553 Wacom::Highlighter => "Highlighter",
20554 Wacom::ChiselMarker => "Chisel Marker",
20555 Wacom::Brush => "Brush",
20556 Wacom::WacomToolType => "Wacom ToolType",
20557 Wacom::DigitizerDiagnostic => "Digitizer Diagnostic",
20558 Wacom::DigitizerError => "Digitizer Error",
20559 Wacom::ErrNormalStatus => "Err Normal Status",
20560 Wacom::ErrTransducersExceeded => "Err Transducers Exceeded",
20561 Wacom::ErrFullTransFeaturesUnavail => "Err Full Trans Features Unavail",
20562 Wacom::ErrChargeLow => "Err Charge Low",
20563 Wacom::X => "X",
20564 Wacom::Y => "Y",
20565 Wacom::WacomDistance => "Wacom Distance",
20566 Wacom::WacomTouchStrip => "Wacom TouchStrip",
20567 Wacom::WacomTouchStrip2 => "Wacom TouchStrip2",
20568 Wacom::WacomTouchRing => "Wacom TouchRing",
20569 Wacom::WacomTouchRingStatus => "Wacom TouchRingStatus",
20570 Wacom::WacomAccelerometerX => "Wacom Accelerometer X",
20571 Wacom::WacomAccelerometerY => "Wacom Accelerometer Y",
20572 Wacom::WacomAccelerometerZ => "Wacom Accelerometer Z",
20573 Wacom::WacomBatteryCharging => "Wacom Battery Charging",
20574 Wacom::WacomBatteryLevel => "Wacom Battery Level",
20575 Wacom::WacomTouchOnOff => "Wacom TouchOnOff",
20576 Wacom::WacomExpressKey00 => "Wacom ExpressKey00",
20577 Wacom::WacomExpressKeyCap00 => "Wacom ExpressKeyCap00",
20578 Wacom::WacomModeChange => "Wacom Mode Change",
20579 Wacom::WacomButtonDesktopCenter => "Wacom Button Desktop Center",
20580 Wacom::WacomButtonOnScreenKeyboard => "Wacom Button On Screen Keyboard",
20581 Wacom::WacomButtonDisplaySetting => "Wacom Button Display Setting",
20582 Wacom::WacomButtonTouchOnOff => "Wacom Button Touch On/Off",
20583 Wacom::WacomButtonHome => "Wacom Button Home",
20584 Wacom::WacomButtonUp => "Wacom Button Up",
20585 Wacom::WacomButtonDown => "Wacom Button Down",
20586 Wacom::WacomButtonLeft => "Wacom Button Left",
20587 Wacom::WacomButtonRight => "Wacom Button Right",
20588 Wacom::WacomButtonCenter => "Wacom Button Center",
20589 Wacom::WacomFingerWheel => "Wacom FingerWheel",
20590 Wacom::WacomOffsetLeft => "Wacom Offset Left",
20591 Wacom::WacomOffsetTop => "Wacom Offset Top",
20592 Wacom::WacomOffsetRight => "Wacom Offset Right",
20593 Wacom::WacomOffsetBottom => "Wacom Offset Bottom",
20594 Wacom::WacomDataMode => "Wacom DataMode",
20595 Wacom::WacomDigitizerInfo => "Wacom Digitizer Info",
20596 }
20597 .into()
20598 }
20599}
20600
20601#[cfg(feature = "std")]
20602impl fmt::Display for Wacom {
20603 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
20604 write!(f, "{}", self.name())
20605 }
20606}
20607
20608impl AsUsage for Wacom {
20609 fn usage_value(&self) -> u32 {
20611 u32::from(self)
20612 }
20613
20614 fn usage_id_value(&self) -> u16 {
20616 u16::from(self)
20617 }
20618
20619 fn usage(&self) -> Usage {
20630 Usage::from(self)
20631 }
20632}
20633
20634impl AsUsagePage for Wacom {
20635 fn usage_page_value(&self) -> u16 {
20639 let up = UsagePage::from(self);
20640 u16::from(up)
20641 }
20642
20643 fn usage_page(&self) -> UsagePage {
20645 UsagePage::from(self)
20646 }
20647}
20648
20649impl From<&Wacom> for u16 {
20650 fn from(wacom: &Wacom) -> u16 {
20651 match *wacom {
20652 Wacom::WacomDigitizer => 1,
20653 Wacom::WacomPen => 2,
20654 Wacom::LightPen => 3,
20655 Wacom::TouchScreen => 4,
20656 Wacom::TouchPad => 5,
20657 Wacom::WhiteBoard => 6,
20658 Wacom::CoordinateMeasuringMachine => 7,
20659 Wacom::ThreeDDigitizer => 8,
20660 Wacom::StereoPlotter => 9,
20661 Wacom::ArticulatedArm => 10,
20662 Wacom::Armature => 11,
20663 Wacom::MultiplePointDigitizer => 12,
20664 Wacom::FreeSpaceWand => 13,
20665 Wacom::DeviceConfiguration => 14,
20666 Wacom::Stylus => 32,
20667 Wacom::Puck => 33,
20668 Wacom::Finger => 34,
20669 Wacom::DeviceSettings => 35,
20670 Wacom::TipPressure => 48,
20671 Wacom::BarrelPressure => 49,
20672 Wacom::InRange => 50,
20673 Wacom::Touch => 51,
20674 Wacom::Untouch => 52,
20675 Wacom::Tap => 53,
20676 Wacom::WacomSense => 54,
20677 Wacom::DataValid => 55,
20678 Wacom::TransducerIndex => 56,
20679 Wacom::WacomDigitizerFnKeys => 57,
20680 Wacom::ProgramChangeKeys => 58,
20681 Wacom::BatteryStrength => 59,
20682 Wacom::Invert => 60,
20683 Wacom::XTilt => 61,
20684 Wacom::YTilt => 62,
20685 Wacom::Azimuth => 63,
20686 Wacom::Altitude => 64,
20687 Wacom::Twist => 65,
20688 Wacom::TipSwitch => 66,
20689 Wacom::SecondaryTipSwitch => 67,
20690 Wacom::BarrelSwitch => 68,
20691 Wacom::Eraser => 69,
20692 Wacom::TabletPick => 70,
20693 Wacom::Confidence => 71,
20694 Wacom::Width => 72,
20695 Wacom::Height => 73,
20696 Wacom::ContactId => 81,
20697 Wacom::Inputmode => 82,
20698 Wacom::DeviceIndex => 83,
20699 Wacom::ContactCount => 84,
20700 Wacom::ContactMax => 85,
20701 Wacom::ScanTime => 86,
20702 Wacom::SurfaceSwitch => 87,
20703 Wacom::ButtonSwitch => 88,
20704 Wacom::ButtonType => 89,
20705 Wacom::SecondaryBarrelSwitch => 90,
20706 Wacom::TransducerSerialNumber => 91,
20707 Wacom::WacomSerialHi => 92,
20708 Wacom::PreferredColorisLocked => 93,
20709 Wacom::PreferredLineWidth => 94,
20710 Wacom::PreferredLineWidthisLocked => 95,
20711 Wacom::PreferredLineStyle => 112,
20712 Wacom::PreferredLineStyleisLocked => 113,
20713 Wacom::Ink => 114,
20714 Wacom::Pencil => 115,
20715 Wacom::Highlighter => 116,
20716 Wacom::ChiselMarker => 117,
20717 Wacom::Brush => 118,
20718 Wacom::WacomToolType => 119,
20719 Wacom::DigitizerDiagnostic => 128,
20720 Wacom::DigitizerError => 129,
20721 Wacom::ErrNormalStatus => 130,
20722 Wacom::ErrTransducersExceeded => 131,
20723 Wacom::ErrFullTransFeaturesUnavail => 132,
20724 Wacom::ErrChargeLow => 133,
20725 Wacom::X => 304,
20726 Wacom::Y => 305,
20727 Wacom::WacomDistance => 306,
20728 Wacom::WacomTouchStrip => 310,
20729 Wacom::WacomTouchStrip2 => 311,
20730 Wacom::WacomTouchRing => 312,
20731 Wacom::WacomTouchRingStatus => 313,
20732 Wacom::WacomAccelerometerX => 1025,
20733 Wacom::WacomAccelerometerY => 1026,
20734 Wacom::WacomAccelerometerZ => 1027,
20735 Wacom::WacomBatteryCharging => 1028,
20736 Wacom::WacomBatteryLevel => 1083,
20737 Wacom::WacomTouchOnOff => 1108,
20738 Wacom::WacomExpressKey00 => 2320,
20739 Wacom::WacomExpressKeyCap00 => 2384,
20740 Wacom::WacomModeChange => 2432,
20741 Wacom::WacomButtonDesktopCenter => 2433,
20742 Wacom::WacomButtonOnScreenKeyboard => 2434,
20743 Wacom::WacomButtonDisplaySetting => 2435,
20744 Wacom::WacomButtonTouchOnOff => 2438,
20745 Wacom::WacomButtonHome => 2448,
20746 Wacom::WacomButtonUp => 2449,
20747 Wacom::WacomButtonDown => 2450,
20748 Wacom::WacomButtonLeft => 2451,
20749 Wacom::WacomButtonRight => 2452,
20750 Wacom::WacomButtonCenter => 2453,
20751 Wacom::WacomFingerWheel => 3331,
20752 Wacom::WacomOffsetLeft => 3376,
20753 Wacom::WacomOffsetTop => 3377,
20754 Wacom::WacomOffsetRight => 3378,
20755 Wacom::WacomOffsetBottom => 3379,
20756 Wacom::WacomDataMode => 4098,
20757 Wacom::WacomDigitizerInfo => 4115,
20758 }
20759 }
20760}
20761
20762impl From<Wacom> for u16 {
20763 fn from(wacom: Wacom) -> u16 {
20766 u16::from(&wacom)
20767 }
20768}
20769
20770impl From<&Wacom> for u32 {
20771 fn from(wacom: &Wacom) -> u32 {
20774 let up = UsagePage::from(wacom);
20775 let up = (u16::from(&up) as u32) << 16;
20776 let id = u16::from(wacom) as u32;
20777 up | id
20778 }
20779}
20780
20781impl From<&Wacom> for UsagePage {
20782 fn from(_: &Wacom) -> UsagePage {
20785 UsagePage::Wacom
20786 }
20787}
20788
20789impl From<Wacom> for UsagePage {
20790 fn from(_: Wacom) -> UsagePage {
20793 UsagePage::Wacom
20794 }
20795}
20796
20797impl From<&Wacom> for Usage {
20798 fn from(wacom: &Wacom) -> Usage {
20799 Usage::try_from(u32::from(wacom)).unwrap()
20800 }
20801}
20802
20803impl From<Wacom> for Usage {
20804 fn from(wacom: Wacom) -> Usage {
20805 Usage::from(&wacom)
20806 }
20807}
20808
20809impl TryFrom<u16> for Wacom {
20810 type Error = HutError;
20811
20812 fn try_from(usage_id: u16) -> Result<Wacom> {
20813 match usage_id {
20814 1 => Ok(Wacom::WacomDigitizer),
20815 2 => Ok(Wacom::WacomPen),
20816 3 => Ok(Wacom::LightPen),
20817 4 => Ok(Wacom::TouchScreen),
20818 5 => Ok(Wacom::TouchPad),
20819 6 => Ok(Wacom::WhiteBoard),
20820 7 => Ok(Wacom::CoordinateMeasuringMachine),
20821 8 => Ok(Wacom::ThreeDDigitizer),
20822 9 => Ok(Wacom::StereoPlotter),
20823 10 => Ok(Wacom::ArticulatedArm),
20824 11 => Ok(Wacom::Armature),
20825 12 => Ok(Wacom::MultiplePointDigitizer),
20826 13 => Ok(Wacom::FreeSpaceWand),
20827 14 => Ok(Wacom::DeviceConfiguration),
20828 32 => Ok(Wacom::Stylus),
20829 33 => Ok(Wacom::Puck),
20830 34 => Ok(Wacom::Finger),
20831 35 => Ok(Wacom::DeviceSettings),
20832 48 => Ok(Wacom::TipPressure),
20833 49 => Ok(Wacom::BarrelPressure),
20834 50 => Ok(Wacom::InRange),
20835 51 => Ok(Wacom::Touch),
20836 52 => Ok(Wacom::Untouch),
20837 53 => Ok(Wacom::Tap),
20838 54 => Ok(Wacom::WacomSense),
20839 55 => Ok(Wacom::DataValid),
20840 56 => Ok(Wacom::TransducerIndex),
20841 57 => Ok(Wacom::WacomDigitizerFnKeys),
20842 58 => Ok(Wacom::ProgramChangeKeys),
20843 59 => Ok(Wacom::BatteryStrength),
20844 60 => Ok(Wacom::Invert),
20845 61 => Ok(Wacom::XTilt),
20846 62 => Ok(Wacom::YTilt),
20847 63 => Ok(Wacom::Azimuth),
20848 64 => Ok(Wacom::Altitude),
20849 65 => Ok(Wacom::Twist),
20850 66 => Ok(Wacom::TipSwitch),
20851 67 => Ok(Wacom::SecondaryTipSwitch),
20852 68 => Ok(Wacom::BarrelSwitch),
20853 69 => Ok(Wacom::Eraser),
20854 70 => Ok(Wacom::TabletPick),
20855 71 => Ok(Wacom::Confidence),
20856 72 => Ok(Wacom::Width),
20857 73 => Ok(Wacom::Height),
20858 81 => Ok(Wacom::ContactId),
20859 82 => Ok(Wacom::Inputmode),
20860 83 => Ok(Wacom::DeviceIndex),
20861 84 => Ok(Wacom::ContactCount),
20862 85 => Ok(Wacom::ContactMax),
20863 86 => Ok(Wacom::ScanTime),
20864 87 => Ok(Wacom::SurfaceSwitch),
20865 88 => Ok(Wacom::ButtonSwitch),
20866 89 => Ok(Wacom::ButtonType),
20867 90 => Ok(Wacom::SecondaryBarrelSwitch),
20868 91 => Ok(Wacom::TransducerSerialNumber),
20869 92 => Ok(Wacom::WacomSerialHi),
20870 93 => Ok(Wacom::PreferredColorisLocked),
20871 94 => Ok(Wacom::PreferredLineWidth),
20872 95 => Ok(Wacom::PreferredLineWidthisLocked),
20873 112 => Ok(Wacom::PreferredLineStyle),
20874 113 => Ok(Wacom::PreferredLineStyleisLocked),
20875 114 => Ok(Wacom::Ink),
20876 115 => Ok(Wacom::Pencil),
20877 116 => Ok(Wacom::Highlighter),
20878 117 => Ok(Wacom::ChiselMarker),
20879 118 => Ok(Wacom::Brush),
20880 119 => Ok(Wacom::WacomToolType),
20881 128 => Ok(Wacom::DigitizerDiagnostic),
20882 129 => Ok(Wacom::DigitizerError),
20883 130 => Ok(Wacom::ErrNormalStatus),
20884 131 => Ok(Wacom::ErrTransducersExceeded),
20885 132 => Ok(Wacom::ErrFullTransFeaturesUnavail),
20886 133 => Ok(Wacom::ErrChargeLow),
20887 304 => Ok(Wacom::X),
20888 305 => Ok(Wacom::Y),
20889 306 => Ok(Wacom::WacomDistance),
20890 310 => Ok(Wacom::WacomTouchStrip),
20891 311 => Ok(Wacom::WacomTouchStrip2),
20892 312 => Ok(Wacom::WacomTouchRing),
20893 313 => Ok(Wacom::WacomTouchRingStatus),
20894 1025 => Ok(Wacom::WacomAccelerometerX),
20895 1026 => Ok(Wacom::WacomAccelerometerY),
20896 1027 => Ok(Wacom::WacomAccelerometerZ),
20897 1028 => Ok(Wacom::WacomBatteryCharging),
20898 1083 => Ok(Wacom::WacomBatteryLevel),
20899 1108 => Ok(Wacom::WacomTouchOnOff),
20900 2320 => Ok(Wacom::WacomExpressKey00),
20901 2384 => Ok(Wacom::WacomExpressKeyCap00),
20902 2432 => Ok(Wacom::WacomModeChange),
20903 2433 => Ok(Wacom::WacomButtonDesktopCenter),
20904 2434 => Ok(Wacom::WacomButtonOnScreenKeyboard),
20905 2435 => Ok(Wacom::WacomButtonDisplaySetting),
20906 2438 => Ok(Wacom::WacomButtonTouchOnOff),
20907 2448 => Ok(Wacom::WacomButtonHome),
20908 2449 => Ok(Wacom::WacomButtonUp),
20909 2450 => Ok(Wacom::WacomButtonDown),
20910 2451 => Ok(Wacom::WacomButtonLeft),
20911 2452 => Ok(Wacom::WacomButtonRight),
20912 2453 => Ok(Wacom::WacomButtonCenter),
20913 3331 => Ok(Wacom::WacomFingerWheel),
20914 3376 => Ok(Wacom::WacomOffsetLeft),
20915 3377 => Ok(Wacom::WacomOffsetTop),
20916 3378 => Ok(Wacom::WacomOffsetRight),
20917 3379 => Ok(Wacom::WacomOffsetBottom),
20918 4098 => Ok(Wacom::WacomDataMode),
20919 4115 => Ok(Wacom::WacomDigitizerInfo),
20920 n => Err(HutError::UnknownUsageId { usage_id: n }),
20921 }
20922 }
20923}
20924
20925impl BitOr<u16> for Wacom {
20926 type Output = Usage;
20927
20928 fn bitor(self, usage: u16) -> Usage {
20935 let up = u16::from(self) as u32;
20936 let u = usage as u32;
20937 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
20938 }
20939}
20940
20941#[allow(non_camel_case_types)]
20947#[derive(Debug)]
20948#[non_exhaustive]
20949pub enum ReservedUsagePage {
20950 Undefined,
20951 ReservedUsage { usage_id: u16 },
20952}
20953
20954impl ReservedUsagePage {
20955 #[cfg(feature = "std")]
20956 fn name(&self) -> String {
20957 match self {
20958 ReservedUsagePage::Undefined => "Reserved Usage Undefined".to_string(),
20959 ReservedUsagePage::ReservedUsage { usage_id } => {
20960 format!("Reserved Usage 0x{usage_id:02x}")
20961 }
20962 }
20963 }
20964}
20965
20966#[cfg(feature = "std")]
20967impl fmt::Display for ReservedUsagePage {
20968 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
20969 write!(f, "{}", self.name())
20970 }
20971}
20972
20973impl From<&ReservedUsagePage> for u16 {
20974 fn from(v: &ReservedUsagePage) -> u16 {
20975 match v {
20976 ReservedUsagePage::Undefined => 0x00,
20977 ReservedUsagePage::ReservedUsage { usage_id } => *usage_id,
20978 }
20979 }
20980}
20981
20982#[allow(non_camel_case_types)]
20987#[derive(Debug)]
20988#[non_exhaustive]
20989pub enum VendorDefinedPage {
20990 Undefined,
20991 VendorUsage { usage_id: u16 },
20992}
20993
20994impl VendorDefinedPage {
20995 #[cfg(feature = "std")]
20996 fn name(&self) -> String {
20997 match self {
20998 VendorDefinedPage::Undefined => "Vendor Usage Undefined".to_string(),
20999 VendorDefinedPage::VendorUsage { usage_id } => {
21000 format!("Vendor Usage 0x{usage_id:02x}")
21001 }
21002 }
21003 }
21004}
21005
21006#[cfg(feature = "std")]
21007impl fmt::Display for VendorDefinedPage {
21008 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
21009 write!(f, "{}", self.name())
21010 }
21011}
21012
21013impl From<&VendorDefinedPage> for u16 {
21014 fn from(v: &VendorDefinedPage) -> u16 {
21015 match v {
21016 VendorDefinedPage::Undefined => 0x00,
21017 VendorDefinedPage::VendorUsage { usage_id } => *usage_id,
21018 }
21019 }
21020}
21021
21022impl From<&Usage> for UsagePage {
21023 fn from(usage: &Usage) -> UsagePage {
21024 match usage {
21025 Usage::GenericDesktop { .. } => UsagePage::GenericDesktop,
21026 Usage::SimulationControls { .. } => UsagePage::SimulationControls,
21027 Usage::VRControls { .. } => UsagePage::VRControls,
21028 Usage::SportControls { .. } => UsagePage::SportControls,
21029 Usage::GameControls { .. } => UsagePage::GameControls,
21030 Usage::GenericDeviceControls { .. } => UsagePage::GenericDeviceControls,
21031 Usage::KeyboardKeypad { .. } => UsagePage::KeyboardKeypad,
21032 Usage::LED { .. } => UsagePage::LED,
21033 Usage::Button { .. } => UsagePage::Button,
21034 Usage::Ordinal { .. } => UsagePage::Ordinal,
21035 Usage::TelephonyDevice { .. } => UsagePage::TelephonyDevice,
21036 Usage::Consumer { .. } => UsagePage::Consumer,
21037 Usage::Digitizers { .. } => UsagePage::Digitizers,
21038 Usage::Haptics { .. } => UsagePage::Haptics,
21039 Usage::PhysicalInputDevice { .. } => UsagePage::PhysicalInputDevice,
21040 Usage::Unicode { .. } => UsagePage::Unicode,
21041 Usage::SoC { .. } => UsagePage::SoC,
21042 Usage::EyeandHeadTrackers { .. } => UsagePage::EyeandHeadTrackers,
21043 Usage::AuxiliaryDisplay { .. } => UsagePage::AuxiliaryDisplay,
21044 Usage::Sensors { .. } => UsagePage::Sensors,
21045 Usage::MedicalInstrument { .. } => UsagePage::MedicalInstrument,
21046 Usage::BrailleDisplay { .. } => UsagePage::BrailleDisplay,
21047 Usage::LightingAndIllumination { .. } => UsagePage::LightingAndIllumination,
21048 Usage::Monitor { .. } => UsagePage::Monitor,
21049 Usage::MonitorEnumerated { .. } => UsagePage::MonitorEnumerated,
21050 Usage::VESAVirtualControls { .. } => UsagePage::VESAVirtualControls,
21051 Usage::Power { .. } => UsagePage::Power,
21052 Usage::BatterySystem { .. } => UsagePage::BatterySystem,
21053 Usage::BarcodeScanner { .. } => UsagePage::BarcodeScanner,
21054 Usage::Scales { .. } => UsagePage::Scales,
21055 Usage::MagneticStripeReader { .. } => UsagePage::MagneticStripeReader,
21056 Usage::CameraControl { .. } => UsagePage::CameraControl,
21057 Usage::Arcade { .. } => UsagePage::Arcade,
21058 Usage::FIDOAlliance { .. } => UsagePage::FIDOAlliance,
21059 Usage::Wacom { .. } => UsagePage::Wacom,
21060 Usage::ReservedUsagePage { reserved_page, .. } => {
21061 UsagePage::ReservedUsagePage(*reserved_page)
21062 }
21063 Usage::VendorDefinedPage { vendor_page, .. } => {
21064 UsagePage::VendorDefinedPage(*vendor_page)
21065 }
21066 }
21067 }
21068}
21069
21070impl From<&UsagePage> for u16 {
21071 fn from(usage_page: &UsagePage) -> u16 {
21074 match usage_page {
21075 UsagePage::GenericDesktop { .. } => 1,
21076 UsagePage::SimulationControls { .. } => 2,
21077 UsagePage::VRControls { .. } => 3,
21078 UsagePage::SportControls { .. } => 4,
21079 UsagePage::GameControls { .. } => 5,
21080 UsagePage::GenericDeviceControls { .. } => 6,
21081 UsagePage::KeyboardKeypad { .. } => 7,
21082 UsagePage::LED { .. } => 8,
21083 UsagePage::Button { .. } => 9,
21084 UsagePage::Ordinal { .. } => 10,
21085 UsagePage::TelephonyDevice { .. } => 11,
21086 UsagePage::Consumer { .. } => 12,
21087 UsagePage::Digitizers { .. } => 13,
21088 UsagePage::Haptics { .. } => 14,
21089 UsagePage::PhysicalInputDevice { .. } => 15,
21090 UsagePage::Unicode { .. } => 16,
21091 UsagePage::SoC { .. } => 17,
21092 UsagePage::EyeandHeadTrackers { .. } => 18,
21093 UsagePage::AuxiliaryDisplay { .. } => 20,
21094 UsagePage::Sensors { .. } => 32,
21095 UsagePage::MedicalInstrument { .. } => 64,
21096 UsagePage::BrailleDisplay { .. } => 65,
21097 UsagePage::LightingAndIllumination { .. } => 89,
21098 UsagePage::Monitor { .. } => 128,
21099 UsagePage::MonitorEnumerated { .. } => 129,
21100 UsagePage::VESAVirtualControls { .. } => 130,
21101 UsagePage::Power { .. } => 132,
21102 UsagePage::BatterySystem { .. } => 133,
21103 UsagePage::BarcodeScanner { .. } => 140,
21104 UsagePage::Scales { .. } => 141,
21105 UsagePage::MagneticStripeReader { .. } => 142,
21106 UsagePage::CameraControl { .. } => 144,
21107 UsagePage::Arcade { .. } => 145,
21108 UsagePage::FIDOAlliance { .. } => 61904,
21109 UsagePage::Wacom { .. } => 65293,
21110 UsagePage::ReservedUsagePage(reserved_page) => u16::from(reserved_page),
21111 UsagePage::VendorDefinedPage(vendor_page) => u16::from(vendor_page),
21112 }
21113 }
21114}
21115
21116impl From<UsagePage> for u16 {
21117 fn from(usage_page: UsagePage) -> u16 {
21118 u16::from(&usage_page)
21119 }
21120}
21121
21122impl TryFrom<u16> for UsagePage {
21123 type Error = HutError;
21124
21125 fn try_from(usage_page: u16) -> Result<UsagePage> {
21126 match usage_page {
21127 1 => Ok(UsagePage::GenericDesktop),
21128 2 => Ok(UsagePage::SimulationControls),
21129 3 => Ok(UsagePage::VRControls),
21130 4 => Ok(UsagePage::SportControls),
21131 5 => Ok(UsagePage::GameControls),
21132 6 => Ok(UsagePage::GenericDeviceControls),
21133 7 => Ok(UsagePage::KeyboardKeypad),
21134 8 => Ok(UsagePage::LED),
21135 9 => Ok(UsagePage::Button),
21136 10 => Ok(UsagePage::Ordinal),
21137 11 => Ok(UsagePage::TelephonyDevice),
21138 12 => Ok(UsagePage::Consumer),
21139 13 => Ok(UsagePage::Digitizers),
21140 14 => Ok(UsagePage::Haptics),
21141 15 => Ok(UsagePage::PhysicalInputDevice),
21142 16 => Ok(UsagePage::Unicode),
21143 17 => Ok(UsagePage::SoC),
21144 18 => Ok(UsagePage::EyeandHeadTrackers),
21145 20 => Ok(UsagePage::AuxiliaryDisplay),
21146 32 => Ok(UsagePage::Sensors),
21147 64 => Ok(UsagePage::MedicalInstrument),
21148 65 => Ok(UsagePage::BrailleDisplay),
21149 89 => Ok(UsagePage::LightingAndIllumination),
21150 128 => Ok(UsagePage::Monitor),
21151 129 => Ok(UsagePage::MonitorEnumerated),
21152 130 => Ok(UsagePage::VESAVirtualControls),
21153 132 => Ok(UsagePage::Power),
21154 133 => Ok(UsagePage::BatterySystem),
21155 140 => Ok(UsagePage::BarcodeScanner),
21156 141 => Ok(UsagePage::Scales),
21157 142 => Ok(UsagePage::MagneticStripeReader),
21158 144 => Ok(UsagePage::CameraControl),
21159 145 => Ok(UsagePage::Arcade),
21160 61904 => Ok(UsagePage::FIDOAlliance),
21161 65293 => Ok(UsagePage::Wacom),
21162 page @ 0xff00..=0xffff => Ok(UsagePage::VendorDefinedPage(VendorPage(page))),
21163 n => match ReservedPage::try_from(n) {
21164 Ok(r) => Ok(UsagePage::ReservedUsagePage(r)),
21165 Err(_) => Err(HutError::UnknownUsagePage { usage_page: n }),
21166 },
21167 }
21168 }
21169}
21170
21171impl TryFrom<u32> for UsagePage {
21172 type Error = HutError;
21173
21174 fn try_from(usage_page: u32) -> Result<UsagePage> {
21175 UsagePage::try_from((usage_page >> 16) as u16)
21176 }
21177}
21178
21179#[cfg(feature = "std")]
21180impl fmt::Display for UsagePage {
21181 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
21182 write!(f, "{}", self.name())
21183 }
21184}
21185
21186#[allow(non_camel_case_types)]
21201#[derive(Debug)]
21202#[non_exhaustive]
21203pub enum Usage {
21204 GenericDesktop(GenericDesktop),
21206 SimulationControls(SimulationControls),
21208 VRControls(VRControls),
21210 SportControls(SportControls),
21212 GameControls(GameControls),
21214 GenericDeviceControls(GenericDeviceControls),
21216 KeyboardKeypad(KeyboardKeypad),
21218 LED(LED),
21220 Button(Button),
21222 Ordinal(Ordinal),
21224 TelephonyDevice(TelephonyDevice),
21226 Consumer(Consumer),
21228 Digitizers(Digitizers),
21230 Haptics(Haptics),
21232 PhysicalInputDevice(PhysicalInputDevice),
21234 Unicode(Unicode),
21236 SoC(SoC),
21238 EyeandHeadTrackers(EyeandHeadTrackers),
21240 AuxiliaryDisplay(AuxiliaryDisplay),
21242 Sensors(Sensors),
21244 MedicalInstrument(MedicalInstrument),
21246 BrailleDisplay(BrailleDisplay),
21248 LightingAndIllumination(LightingAndIllumination),
21250 Monitor(Monitor),
21252 MonitorEnumerated(MonitorEnumerated),
21254 VESAVirtualControls(VESAVirtualControls),
21256 Power(Power),
21258 BatterySystem(BatterySystem),
21260 BarcodeScanner(BarcodeScanner),
21262 Scales(Scales),
21264 MagneticStripeReader(MagneticStripeReader),
21266 CameraControl(CameraControl),
21268 Arcade(Arcade),
21270 FIDOAlliance(FIDOAlliance),
21272 Wacom(Wacom),
21274 ReservedUsagePage {
21275 reserved_page: ReservedPage,
21276 usage: ReservedUsagePage,
21277 },
21278 VendorDefinedPage {
21279 vendor_page: VendorPage,
21280 usage: VendorDefinedPage,
21281 },
21282}
21283
21284impl Usage {
21285 #[cfg(feature = "std")]
21286 pub fn new_from_page_and_id(usage_page: u16, usage_id: u16) -> Result<Usage> {
21287 Usage::try_from(((usage_page as u32) << 16) | usage_id as u32)
21288 }
21289
21290 #[cfg(feature = "std")]
21291 pub fn name(&self) -> String {
21292 match self {
21293 Usage::GenericDesktop(usage) => usage.name(),
21294 Usage::SimulationControls(usage) => usage.name(),
21295 Usage::VRControls(usage) => usage.name(),
21296 Usage::SportControls(usage) => usage.name(),
21297 Usage::GameControls(usage) => usage.name(),
21298 Usage::GenericDeviceControls(usage) => usage.name(),
21299 Usage::KeyboardKeypad(usage) => usage.name(),
21300 Usage::LED(usage) => usage.name(),
21301 Usage::Button(usage) => usage.name(),
21302 Usage::Ordinal(usage) => usage.name(),
21303 Usage::TelephonyDevice(usage) => usage.name(),
21304 Usage::Consumer(usage) => usage.name(),
21305 Usage::Digitizers(usage) => usage.name(),
21306 Usage::Haptics(usage) => usage.name(),
21307 Usage::PhysicalInputDevice(usage) => usage.name(),
21308 Usage::Unicode(usage) => usage.name(),
21309 Usage::SoC(usage) => usage.name(),
21310 Usage::EyeandHeadTrackers(usage) => usage.name(),
21311 Usage::AuxiliaryDisplay(usage) => usage.name(),
21312 Usage::Sensors(usage) => usage.name(),
21313 Usage::MedicalInstrument(usage) => usage.name(),
21314 Usage::BrailleDisplay(usage) => usage.name(),
21315 Usage::LightingAndIllumination(usage) => usage.name(),
21316 Usage::Monitor(usage) => usage.name(),
21317 Usage::MonitorEnumerated(usage) => usage.name(),
21318 Usage::VESAVirtualControls(usage) => usage.name(),
21319 Usage::Power(usage) => usage.name(),
21320 Usage::BatterySystem(usage) => usage.name(),
21321 Usage::BarcodeScanner(usage) => usage.name(),
21322 Usage::Scales(usage) => usage.name(),
21323 Usage::MagneticStripeReader(usage) => usage.name(),
21324 Usage::CameraControl(usage) => usage.name(),
21325 Usage::Arcade(usage) => usage.name(),
21326 Usage::FIDOAlliance(usage) => usage.name(),
21327 Usage::Wacom(usage) => usage.name(),
21328 Usage::ReservedUsagePage { usage, .. } => usage.name(),
21329 Usage::VendorDefinedPage { usage, .. } => usage.name(),
21330 }
21331 }
21332}
21333
21334impl AsUsage for Usage {
21335 fn usage_value(&self) -> u32 {
21337 self.into()
21338 }
21339
21340 fn usage_id_value(&self) -> u16 {
21342 self.into()
21343 }
21344
21345 fn usage(&self) -> Usage {
21347 Usage::try_from(self.usage_value()).unwrap()
21348 }
21349}
21350
21351impl PartialEq for Usage {
21352 fn eq(&self, other: &Self) -> bool {
21353 u32::from(self) == u32::from(other)
21354 }
21355}
21356
21357impl AsUsagePage for Usage {
21358 fn usage_page_value(&self) -> u16 {
21359 UsagePage::from(self).into()
21360 }
21361
21362 fn usage_page(&self) -> UsagePage {
21363 match self {
21364 Usage::GenericDesktop(_) => UsagePage::GenericDesktop,
21365 Usage::SimulationControls(_) => UsagePage::SimulationControls,
21366 Usage::VRControls(_) => UsagePage::VRControls,
21367 Usage::SportControls(_) => UsagePage::SportControls,
21368 Usage::GameControls(_) => UsagePage::GameControls,
21369 Usage::GenericDeviceControls(_) => UsagePage::GenericDeviceControls,
21370 Usage::KeyboardKeypad(_) => UsagePage::KeyboardKeypad,
21371 Usage::LED(_) => UsagePage::LED,
21372 Usage::Button(_) => UsagePage::Button,
21373 Usage::Ordinal(_) => UsagePage::Ordinal,
21374 Usage::TelephonyDevice(_) => UsagePage::TelephonyDevice,
21375 Usage::Consumer(_) => UsagePage::Consumer,
21376 Usage::Digitizers(_) => UsagePage::Digitizers,
21377 Usage::Haptics(_) => UsagePage::Haptics,
21378 Usage::PhysicalInputDevice(_) => UsagePage::PhysicalInputDevice,
21379 Usage::Unicode(_) => UsagePage::Unicode,
21380 Usage::SoC(_) => UsagePage::SoC,
21381 Usage::EyeandHeadTrackers(_) => UsagePage::EyeandHeadTrackers,
21382 Usage::AuxiliaryDisplay(_) => UsagePage::AuxiliaryDisplay,
21383 Usage::Sensors(_) => UsagePage::Sensors,
21384 Usage::MedicalInstrument(_) => UsagePage::MedicalInstrument,
21385 Usage::BrailleDisplay(_) => UsagePage::BrailleDisplay,
21386 Usage::LightingAndIllumination(_) => UsagePage::LightingAndIllumination,
21387 Usage::Monitor(_) => UsagePage::Monitor,
21388 Usage::MonitorEnumerated(_) => UsagePage::MonitorEnumerated,
21389 Usage::VESAVirtualControls(_) => UsagePage::VESAVirtualControls,
21390 Usage::Power(_) => UsagePage::Power,
21391 Usage::BatterySystem(_) => UsagePage::BatterySystem,
21392 Usage::BarcodeScanner(_) => UsagePage::BarcodeScanner,
21393 Usage::Scales(_) => UsagePage::Scales,
21394 Usage::MagneticStripeReader(_) => UsagePage::MagneticStripeReader,
21395 Usage::CameraControl(_) => UsagePage::CameraControl,
21396 Usage::Arcade(_) => UsagePage::Arcade,
21397 Usage::FIDOAlliance(_) => UsagePage::FIDOAlliance,
21398 Usage::Wacom(_) => UsagePage::Wacom,
21399 Usage::ReservedUsagePage { reserved_page, .. } => {
21400 UsagePage::ReservedUsagePage(*reserved_page)
21401 }
21402 Usage::VendorDefinedPage { vendor_page, .. } => {
21403 UsagePage::VendorDefinedPage(*vendor_page)
21404 }
21405 }
21406 }
21407}
21408
21409#[cfg(feature = "std")]
21410impl fmt::Display for Usage {
21411 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
21412 write!(f, "{}", self.name())
21413 }
21414}
21415
21416impl From<&Usage> for u16 {
21417 fn from(usage: &Usage) -> u16 {
21418 let u: u32 = u32::from(usage);
21419 (u & 0xFFFF) as u16
21420 }
21421}
21422
21423impl From<Usage> for u16 {
21424 fn from(usage: Usage) -> u16 {
21425 u16::from(&usage)
21426 }
21427}
21428
21429impl From<&Usage> for u32 {
21430 fn from(usage: &Usage) -> u32 {
21431 match usage {
21432 Usage::GenericDesktop(usage) => (1 << 16) | u16::from(usage) as u32,
21433 Usage::SimulationControls(usage) => (2 << 16) | u16::from(usage) as u32,
21434 Usage::VRControls(usage) => (3 << 16) | u16::from(usage) as u32,
21435 Usage::SportControls(usage) => (4 << 16) | u16::from(usage) as u32,
21436 Usage::GameControls(usage) => (5 << 16) | u16::from(usage) as u32,
21437 Usage::GenericDeviceControls(usage) => (6 << 16) | u16::from(usage) as u32,
21438 Usage::KeyboardKeypad(usage) => (7 << 16) | u16::from(usage) as u32,
21439 Usage::LED(usage) => (8 << 16) | u16::from(usage) as u32,
21440 Usage::Button(usage) => (9 << 16) | u16::from(usage) as u32,
21441 Usage::Ordinal(usage) => (10 << 16) | u16::from(usage) as u32,
21442 Usage::TelephonyDevice(usage) => (11 << 16) | u16::from(usage) as u32,
21443 Usage::Consumer(usage) => (12 << 16) | u16::from(usage) as u32,
21444 Usage::Digitizers(usage) => (13 << 16) | u16::from(usage) as u32,
21445 Usage::Haptics(usage) => (14 << 16) | u16::from(usage) as u32,
21446 Usage::PhysicalInputDevice(usage) => (15 << 16) | u16::from(usage) as u32,
21447 Usage::Unicode(usage) => (16 << 16) | u16::from(usage) as u32,
21448 Usage::SoC(usage) => (17 << 16) | u16::from(usage) as u32,
21449 Usage::EyeandHeadTrackers(usage) => (18 << 16) | u16::from(usage) as u32,
21450 Usage::AuxiliaryDisplay(usage) => (20 << 16) | u16::from(usage) as u32,
21451 Usage::Sensors(usage) => (32 << 16) | u16::from(usage) as u32,
21452 Usage::MedicalInstrument(usage) => (64 << 16) | u16::from(usage) as u32,
21453 Usage::BrailleDisplay(usage) => (65 << 16) | u16::from(usage) as u32,
21454 Usage::LightingAndIllumination(usage) => (89 << 16) | u16::from(usage) as u32,
21455 Usage::Monitor(usage) => (128 << 16) | u16::from(usage) as u32,
21456 Usage::MonitorEnumerated(usage) => (129 << 16) | u16::from(usage) as u32,
21457 Usage::VESAVirtualControls(usage) => (130 << 16) | u16::from(usage) as u32,
21458 Usage::Power(usage) => (132 << 16) | u16::from(usage) as u32,
21459 Usage::BatterySystem(usage) => (133 << 16) | u16::from(usage) as u32,
21460 Usage::BarcodeScanner(usage) => (140 << 16) | u16::from(usage) as u32,
21461 Usage::Scales(usage) => (141 << 16) | u16::from(usage) as u32,
21462 Usage::MagneticStripeReader(usage) => (142 << 16) | u16::from(usage) as u32,
21463 Usage::CameraControl(usage) => (144 << 16) | u16::from(usage) as u32,
21464 Usage::Arcade(usage) => (145 << 16) | u16::from(usage) as u32,
21465 Usage::FIDOAlliance(usage) => (61904 << 16) | u16::from(usage) as u32,
21466 Usage::Wacom(usage) => (65293 << 16) | u16::from(usage) as u32,
21467 Usage::ReservedUsagePage {
21468 reserved_page,
21469 usage,
21470 } => ((u16::from(reserved_page) as u32) << 16) | u16::from(usage) as u32,
21471 Usage::VendorDefinedPage { vendor_page, usage } => {
21472 ((u16::from(vendor_page) as u32) << 16) | u16::from(usage) as u32
21473 }
21474 }
21475 }
21476}
21477
21478impl TryFrom<u32> for Usage {
21479 type Error = HutError;
21480
21481 fn try_from(up: u32) -> Result<Usage> {
21482 match (up >> 16, up & 0xFFFF) {
21483 (1, n) => Ok(Usage::GenericDesktop(GenericDesktop::try_from(n as u16)?)),
21484 (2, n) => Ok(Usage::SimulationControls(SimulationControls::try_from(
21485 n as u16,
21486 )?)),
21487 (3, n) => Ok(Usage::VRControls(VRControls::try_from(n as u16)?)),
21488 (4, n) => Ok(Usage::SportControls(SportControls::try_from(n as u16)?)),
21489 (5, n) => Ok(Usage::GameControls(GameControls::try_from(n as u16)?)),
21490 (6, n) => Ok(Usage::GenericDeviceControls(
21491 GenericDeviceControls::try_from(n as u16)?,
21492 )),
21493 (7, n) => Ok(Usage::KeyboardKeypad(KeyboardKeypad::try_from(n as u16)?)),
21494 (8, n) => Ok(Usage::LED(LED::try_from(n as u16)?)),
21495 (9, n) => Ok(Usage::Button(Button::try_from(n as u16)?)),
21496 (10, n) => Ok(Usage::Ordinal(Ordinal::try_from(n as u16)?)),
21497 (11, n) => Ok(Usage::TelephonyDevice(TelephonyDevice::try_from(n as u16)?)),
21498 (12, n) => Ok(Usage::Consumer(Consumer::try_from(n as u16)?)),
21499 (13, n) => Ok(Usage::Digitizers(Digitizers::try_from(n as u16)?)),
21500 (14, n) => Ok(Usage::Haptics(Haptics::try_from(n as u16)?)),
21501 (15, n) => Ok(Usage::PhysicalInputDevice(PhysicalInputDevice::try_from(
21502 n as u16,
21503 )?)),
21504 (16, n) => Ok(Usage::Unicode(Unicode::try_from(n as u16)?)),
21505 (17, n) => Ok(Usage::SoC(SoC::try_from(n as u16)?)),
21506 (18, n) => Ok(Usage::EyeandHeadTrackers(EyeandHeadTrackers::try_from(
21507 n as u16,
21508 )?)),
21509 (20, n) => Ok(Usage::AuxiliaryDisplay(AuxiliaryDisplay::try_from(
21510 n as u16,
21511 )?)),
21512 (32, n) => Ok(Usage::Sensors(Sensors::try_from(n as u16)?)),
21513 (64, n) => Ok(Usage::MedicalInstrument(MedicalInstrument::try_from(
21514 n as u16,
21515 )?)),
21516 (65, n) => Ok(Usage::BrailleDisplay(BrailleDisplay::try_from(n as u16)?)),
21517 (89, n) => Ok(Usage::LightingAndIllumination(
21518 LightingAndIllumination::try_from(n as u16)?,
21519 )),
21520 (128, n) => Ok(Usage::Monitor(Monitor::try_from(n as u16)?)),
21521 (129, n) => Ok(Usage::MonitorEnumerated(MonitorEnumerated::try_from(
21522 n as u16,
21523 )?)),
21524 (130, n) => Ok(Usage::VESAVirtualControls(VESAVirtualControls::try_from(
21525 n as u16,
21526 )?)),
21527 (132, n) => Ok(Usage::Power(Power::try_from(n as u16)?)),
21528 (133, n) => Ok(Usage::BatterySystem(BatterySystem::try_from(n as u16)?)),
21529 (140, n) => Ok(Usage::BarcodeScanner(BarcodeScanner::try_from(n as u16)?)),
21530 (141, n) => Ok(Usage::Scales(Scales::try_from(n as u16)?)),
21531 (142, n) => Ok(Usage::MagneticStripeReader(MagneticStripeReader::try_from(
21532 n as u16,
21533 )?)),
21534 (144, n) => Ok(Usage::CameraControl(CameraControl::try_from(n as u16)?)),
21535 (145, n) => Ok(Usage::Arcade(Arcade::try_from(n as u16)?)),
21536 (61904, n) => Ok(Usage::FIDOAlliance(FIDOAlliance::try_from(n as u16)?)),
21537 (65293, n) => Ok(Usage::Wacom(Wacom::try_from(n as u16)?)),
21538 (p @ 0xff00..=0xffff, n) => Ok(Usage::VendorDefinedPage {
21539 vendor_page: VendorPage(p as u16),
21540 usage: VendorDefinedPage::VendorUsage { usage_id: n as u16 },
21541 }),
21542 (p, n) => match ReservedPage::try_from(p as u16) {
21543 Ok(r) => Ok(Usage::ReservedUsagePage {
21544 reserved_page: r,
21545 usage: ReservedUsagePage::ReservedUsage { usage_id: n as u16 },
21546 }),
21547 _ => Err(HutError::UnknownUsage),
21548 },
21549 }
21550 }
21551}
21552
21553#[cfg(test)]
21554mod tests {
21555 use super::*;
21556
21557 #[test]
21558 fn conversions() {
21559 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;
21562
21563 let u = GenericDesktop::Mouse;
21564 assert!(matches!(
21566 Usage::try_from(hid_usage).unwrap(),
21567 Usage::GenericDesktop(_)
21568 ));
21569
21570 assert_eq!(u32::from(&u), hid_usage);
21572 assert_eq!(u.usage_value(), hid_usage);
21573
21574 assert_eq!(hid_usage_id, u16::from(&u));
21576 assert_eq!(hid_usage_id, u.usage_id_value());
21577
21578 assert!(matches!(UsagePage::from(&u), UsagePage::GenericDesktop));
21580
21581 let up = UsagePage::from(&u);
21583 assert_eq!(hid_usage_page, u16::from(&up));
21584
21585 assert_eq!(hid_usage_page, up.usage_page_value());
21587 }
21588
21589 #[test]
21590 fn buttons() {
21591 let hid_usage_page: u16 = 0x9;
21592 let hid_usage_id: u16 = 0x5;
21593 let hid_usage: u32 = ((hid_usage_page as u32) << 16) | hid_usage_id as u32;
21594
21595 let u = Button::Button(5);
21596 assert!(matches!(
21597 Usage::try_from(hid_usage).unwrap(),
21598 Usage::Button(_)
21599 ));
21600
21601 assert_eq!(u32::from(&u), hid_usage);
21603 assert_eq!(u.usage_value(), hid_usage);
21604
21605 assert_eq!(hid_usage_id, u16::from(&u));
21607 assert_eq!(hid_usage_id, u.usage_id_value());
21608
21609 assert!(matches!(UsagePage::from(&u), UsagePage::Button));
21611
21612 let up = UsagePage::from(&u);
21614 assert_eq!(hid_usage_page, u16::from(&up));
21615
21616 assert_eq!(hid_usage_page, up.usage_page_value());
21618 }
21619
21620 #[test]
21621 fn ordinals() {
21622 let hid_usage_page: u16 = 0xA;
21623 let hid_usage_id: u16 = 0x8;
21624 let hid_usage: u32 = ((hid_usage_page as u32) << 16) | hid_usage_id as u32;
21625
21626 let u = Ordinal::Ordinal(8);
21627 assert!(matches!(
21628 Usage::try_from(hid_usage).unwrap(),
21629 Usage::Ordinal(_)
21630 ));
21631
21632 assert_eq!(u32::from(&u), hid_usage);
21634 assert_eq!(u.usage_value(), hid_usage);
21635
21636 assert_eq!(hid_usage_id, u16::from(&u));
21638 assert_eq!(hid_usage_id, u.usage_id_value());
21639
21640 assert!(matches!(UsagePage::from(&u), UsagePage::Ordinal));
21642
21643 let up = UsagePage::from(&u);
21645 assert_eq!(hid_usage_page, u16::from(&up));
21646
21647 assert_eq!(hid_usage_page, up.usage_page_value());
21649 }
21650
21651 #[cfg(feature = "std")]
21652 #[test]
21653 fn names() {
21654 assert_eq!(UsagePage::GenericDesktop.name().as_str(), "Generic Desktop");
21655 assert_eq!(
21656 UsagePage::PhysicalInputDevice.name().as_str(),
21657 "Physical Input Device"
21658 );
21659 assert_eq!(GenericDesktop::CallMuteLED.name().as_str(), "Call Mute LED");
21660 assert_eq!(VRControls::HeadTracker.name().as_str(), "Head Tracker");
21661 }
21662
21663 #[test]
21664 fn usages() {
21665 let mouse = GenericDesktop::Mouse;
21666 let usage = Usage::GenericDesktop(GenericDesktop::Mouse);
21667 assert_eq!(mouse.usage(), usage);
21668 }
21669}