Debian Codegraph @

src/lib.rs

raw symbols SCIP
1 // THIS FILE IS GENERATED, DO NOT EDIT
2
3 //! A wrapper around the [HID Usage Tables (HUT)](https://usb.org/document-library/hid-usage-tables-15).
4 //!
5 //! In this document and unless stated otherwise, a reference to
6 //! - **"HID Section a.b.c"** refers to the [HID Device Class Definition for HID 1.11](https://www.usb.org/document-library/device-class-definition-hid-111)
7 //! - **"HUT Section a.b.c"** refers to the
8 //! [HID Usage Tables (HUT) version 1.5](https://usb.org/document-library/hid-usage-tables-15)
9 //!
10 //! This module is created through code generation from the HID Usage Tables.
11 //!
12 //! # Terminology
13 //!
14 //! See HID Section 5.5: a HID Usage is a 32 bit value comprising of a 16-bit Usage
15 //! Page (MSB) and a 16-bit Usage ID (LSB) so that:
16 //!
17 //! ```
18 //! # let usage_page: u32 = 0;
19 //! # let usage_id: u32 = 0;
20 //! let usage: u32 = (usage_page << 16) | usage_id;
21 //! ```
22 //! Note that the HID encoding requires little endian byte order on the wire.
23 //!
24 //! In this module:
25 //!
26 //! - **"Usage Page"** refers to the 16-bit value. Where the Usage Page is converted
27 //! to or from a 32-bit value the Usage Page is in the upper 16 bits of that value and
28 //! the lower 16 bits are ignored or set to zero.
29 //! ```
30 //! # let usage: u32 = 0;
31 //! let usage_page: u16 = (usage >> 16) as u16 & 0xffff;
32 //! ```
33 //! - **"Usage ID"** refers to the 16-bit value. Where the Usage ID is converted to
34 //! or from a 32-bit value the Usage is in the lower 16 bits of that value and
35 //! the upper 16 bits are ignored or set to zero.
36 //! ```
37 //! # let usage: u32 = 0;
38 //! let usage_id: u16 = (usage & 0xffff) as u16;
39 //! ```
40 //! - **"Usage"** refers to the 32-bit value comprising a Usage Page and a Usage.
41 //!
42 //! # Converting between types
43 //!
44 //! All defined [Usages](Usage) and [UsagePages](UsagePage) implement [AsUsagePage] and (if applicable) [AsUsage] as
45 //! well as the [`From<u16>`](From), [`From<u32>`](From), [`TryFrom<u16>`](TryFrom), and [`TryFrom<u32>`](TryFrom)
46 //! conversions so that:
47 //! ```
48 //! # use hut::*;
49 //! let usage_page_value: u16 = 0x01; // Generic Desktop
50 //! let usage_id_value: u16 = 0x02; // Mouse
51 //! let usage_value: u32 = ((usage_page_value as u32) << 16) | usage_id_value as u32;
52 //!
53 //! // Create a known Usage from a 32-bit value
54 //! let u: Usage = Usage::try_from(usage_value).unwrap();
55 //! assert!(matches!(u, Usage::GenericDesktop(GenericDesktop::Mouse)));
56 //!
57 //! // Create a known Usage from the Usage Page and Usage ID values
58 //! let u2 = Usage::new_from_page_and_id(usage_page_value, usage_id_value).unwrap();
59 //! assert_eq!(u, u2);
60 //!
61 //! // Create a known Usage from an individual Usage Page enum item
62 //! let u3 = Usage::from(GenericDesktop::Mouse);
63 //! assert_eq!(u, u3);
64 //!
65 //! // Create a known Usage from an known Usage Page enum item
66 //! let gd_mouse = GenericDesktop::try_from(usage_id_value).unwrap();
67 //! let u4 = Usage::from(gd_mouse);
68 //! assert_eq!(u, u4);
69 //!
70 //! // Convert to and fro the Usage either via u32 or the AsUsage trait
71 //! let u = GenericDesktop::Mouse;
72 //! assert_eq!(u32::from(&u), usage_value);
73 //! assert_eq!(u.usage_value(), usage_value);
74 //!
75 //! // Extract the 16-bit Usage ID either via u16 or the AsUsage trait
76 //! assert_eq!(u16::from(&u), usage_id_value);
77 //! assert_eq!(u.usage_id_value(), usage_id_value);
78 //!
79 //! // Extract the Usage Page from the Usage enum value
80 //! let up = u.usage_page();
81 //! assert!(matches!(up, UsagePage::GenericDesktop));
82 //! let up: UsagePage = UsagePage::from(&u);
83 //! assert!(matches!(up, UsagePage::GenericDesktop));
84 //!
85 //! // Get the Usage Page numeric value is via the AsUsagePage
86 //! assert_eq!(u16::from(&up), usage_page_value);
87 //! assert_eq!(up.usage_page_value(), usage_page_value);
88 //! ```
89 //!
90 //! Naming Usages (e.g. [`GenericDesktop::Mouse`]) above works for Defined Usage
91 //! Pages, Generated Usage Pages (see below) need to be destructured via their
92 //! individual elements:
93 //! ```
94 //! # use hut::*;
95 //! let usage_page_value: u16 = 0x09; // Button
96 //! let usage_id_value: u16 = 8; // Button number 8
97 //! let usage_value: u32 = ((usage_page_value as u32) << 16) | usage_id_value as u32;
98 //!
99 //! let u = Usage::try_from(usage_value).unwrap();
100 //! let button = Usage::Button(Button::Button(8));
101 //! assert!(matches!(Usage::try_from(usage_value).unwrap(), button));
102 //! // or via from() or into()
103 //! let button: Usage = Button::Button(8).into();
104 //! assert!(matches!(Usage::try_from(usage_value).unwrap(), button));
105 //! ```
106 //! Once a Usage is created, the [AsUsagePage] and [AsUsage] traits and conversion to and from
107 //! [u16] and [u32] work the same as for a Defined Usage Page.
108 //!
109 //! # Names of Usage Pages and Usage IDs
110 //!
111 //! All defined [Usages](Usage) and [UsagePages](UsagePage) implement `name()` to return a string
112 //! representing that page or usage:
113 //!
114 //! ```
115 //! # use hut::*;
116 //! let up = UsagePage::GenericDesktop;
117 //! assert_eq!(up.name(), "Generic Desktop");
118 //! let up = UsagePage::SimulationControls;
119 //! assert_eq!(up.name(), "Simulation Controls");
120 //!
121 //! let usage = GenericDesktop::Mouse;
122 //! assert_eq!(usage.name(), "Mouse");
123 //! let usage = SimulationControls::CyclicControl;
124 //! assert_eq!(usage.name(), "Cyclic Control");
125 //! ```
126 //!
127 //! # Generated Usage Pages
128 //!
129 //! The HUT differ between "Defined" and "Generated" Usage Pages. The former define Usage ID values
130 //! and their meanings, the latter define a Usage ID range, with the actual Usage ID simply
131 //! referring to "nth thing in this usage page". One example for this is the Button Usage Page
132 //! (0x09) where a Usage ID of 3 means "Button 3".
133 //!
134 //! ```
135 //! # use hut::*;
136 //! let b = Button::Button(3);
137 //! let o = Ordinal::Ordinal(23);
138 //! ```
139 //!
140 //! Unlike Defined Usage Pages these Generated Usage Pages need to be destructured in `match`
141 //! statements:
142 //!
143 //! ```
144 //! # use hut::*;
145 //! let b = Button::Button(3);
146 //! match b {
147 //! Button::Button(b) => println!("Button {b}"),
148 //! _ => {},
149 //! }
150 //! ```
151 //!
152 //! The following usage pages are Generated:
153 //! - Usage Page 0x9 - [Button]
154 //! - Usage Page 0xA - [Ordinal]
155 //! - Usage Page 0x10 - [Unicode]
156 //! - Usage Page 0x81 - [MonitorEnumerated]
157 //!
158 //! A further special case of this is the [Unicode] usage page which is not in the HUT
159 //! document and was inserted during code generation.
160 //!
161 //! # Vendor Defined Usage Pages (0xFF00 to 0xFFFF)
162 //!
163 //! [Vendor Defined Usage Pages](VendorDefinedPage) and [VendorUsages](VendorDefinedPage::VendorUsage) are not autogenerated and thus
164 //! follow a different approach: the Usage inside the Usage Page is a simple
165 //! numeric usage that needs to be destructured in `match` statements.
166 //!
167 //! ```
168 //! # use hut::*;
169 //! let v = Usage::VendorDefinedPage {
170 //! vendor_page: VendorPage::try_from(0xff00 as u16).unwrap(),
171 //! usage: VendorDefinedPage::VendorUsage { usage_id: 0x01 },
172 //! };
173 //! match v {
174 //! Usage::VendorDefinedPage {
175 //! vendor_page,
176 //! usage,
177 //! } => println!("Vendor Usage ID {usage}"),
178 //! _ => {},
179 //! }
180 //! ```
181 //!
182 //! A notable exception is the [Wacom] (`0xFF0D`) which is technically a
183 //! Vendor-defined page but with defined Usages. Converting from a [UsagePage]
184 //! or [Usage] numeric value will produce the correct or [Wacom] Usage, not a [VendorDefinedPage::VendorUsage].
185 //!
186 //! # Reserved Usage Pages
187 //!
188 //! [Reserved Usage Pages](ReservedUsagePage) and [ReservedUsages](ReservedUsagePage::ReservedUsage) are
189 //! not autogenerated and thus follow a different approach: the Usage inside the Usage Page is a simple
190 //! numeric usage that needs to be destructured in `match` statements.
191 //!
192 //! Unlike the [Vendor Defined Usage Pages](VendorDefinedPage) a [Reserved Usage Page](ReservedPage) may become
193 //! a defined page in a later version of the HUT standard and thus in a future version of this crate.
194 //! A caller must not rely on a Reserved Usage Page or Reserved Usage to remain so.
195 //!
196 //! The following Usage Pages are reserved as of HUT 1.5 (see HUT Section 3, p15):
197 //! - `0x13`, `0x15-0x1F`
198 //! - `0x21-0x3F`
199 //! - `0x42-0x58`
200 //! - `0x5A-0x7F`
201 //! - `0x83-0x83`
202 //! - `0x86-0x8B`
203 //! - `0x8F-0x8F`
204 //! - `0x93-0xF1CF`
205 //! - `0xF1D1-0xFEFF`
206 //!
207 //! # Renames
208 //!
209 //! For technical reasons, spaces, (` `), dashes (`-`), and slashes (`/`) are
210 //! stripped out of Usage Page and Usage names. The string representation via
211 //! the `Display` trait will have the unmodified value.
212
213 #![allow(clippy::identity_op, clippy::eq_op, clippy::match_single_binding)]
214 #![no_std]
215
216 #[cfg(feature = "std")]
217 extern crate std;
218
219 use core::ops::BitOr;
220 #[cfg(feature = "std")]
221 use std::{fmt, format, string::String, string::ToString};
222
223 /// Error raised if conversion between HUT elements fails.
224 #[derive(Debug)]
225 pub enum HutError {
226 /// The usage page value is not known. Usage Pages
227 /// may get added in the future and a future version
228 /// of this crate may not raise this error for the same value.
229 UnknownUsagePage { usage_page: u16 },
230 /// The usage ID value is not known. Usage IDs
231 /// may get added in the future and a future version
232 /// of this crate may not raise this error for the same value.
233 UnknownUsageId { usage_id: u16 },
234 /// The value given for a [VendorDefinedPage] is outside the allowed range.
235 InvalidVendorPage { vendor_page: u16 },
236 /// The value given for a [ReservedUsagePage] is outside the allowed range.
237 InvalidReservedPage { reserved_page: u16 },
238 /// The 32-bit usage value given cannot be resolved. Usages
239 /// may get added in the future and a future version
240 /// of this crate may not raise this error for the same value.
241 UnknownUsage,
242 }
243
244 impl core::error::Error for HutError {}
245
246 impl 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
264 type Result<T> = core::result::Result<T, HutError>;
265
266 /// A trait to return the Usage and Usage ID as numeric value
267 pub trait AsUsage {
268 /// Returns the 32-bit Usage numeric value of this Usage
269 fn usage_value(&self) -> u32;
270
271 /// Returns the 16-bit Usage Id numeric value of this Usage
272 fn usage_id_value(&self) -> u16;
273
274 /// Returns this usage as [Usage]
275 fn usage(&self) -> Usage;
276 }
277
278 /// A trait to return the Usage Page as numeric value
279 pub trait AsUsagePage {
280 /// Returns the 16-bit Usage Page value
281 fn usage_page_value(&self) -> u16;
282
283 /// Returns the [UsagePage]
284 fn usage_page(&self) -> UsagePage;
285 }
286
287 /// A HID UsagePage, see HID Section 5.5. This represents the upper 16 bits in the
288 /// 32-bit Usage. Where a [UsagePage] is converted to or from 32 bit, the
289 /// [UsagePage] value are the upper 16 bits only and the lower 16 bits are
290 /// ignored or set to zero.
291 /// ```
292 /// # use hut::*;
293 /// let usage = Usage::from(GenericDesktop::Mouse);
294 /// let up: UsagePage = UsagePage::from(&usage);
295 /// assert!(matches!(up, UsagePage::GenericDesktop));
296 /// ```
297 /// Note: this enum is generated from the HUT specification.
298 #[allow(non_camel_case_types)]
299 #[derive(Debug)]
300 #[non_exhaustive]
301 pub enum UsagePage {
302 /// Usage Page `0x1`: "Generic Desktop",
303 /// see [GenericDesktop].
304 GenericDesktop,
305 /// Usage Page `0x2`: "Simulation Controls",
306 /// see [SimulationControls].
307 SimulationControls,
308 /// Usage Page `0x3`: "VR Controls",
309 /// see [VRControls].
310 VRControls,
311 /// Usage Page `0x4`: "Sport Controls",
312 /// see [SportControls].
313 SportControls,
314 /// Usage Page `0x5`: "Game Controls",
315 /// see [GameControls].
316 GameControls,
317 /// Usage Page `0x6`: "Generic Device Controls",
318 /// see [GenericDeviceControls].
319 GenericDeviceControls,
320 /// Usage Page `0x7`: "Keyboard/Keypad",
321 /// see [KeyboardKeypad].
322 KeyboardKeypad,
323 /// Usage Page `0x8`: "LED",
324 /// see [LED].
325 LED,
326 /// Usage Page `0x9`: "Button",
327 /// see [Button].
328 Button,
329 /// Usage Page `0xA`: "Ordinal",
330 /// see [Ordinal].
331 Ordinal,
332 /// Usage Page `0xB`: "Telephony Device",
333 /// see [TelephonyDevice].
334 TelephonyDevice,
335 /// Usage Page `0xC`: "Consumer",
336 /// see [Consumer].
337 Consumer,
338 /// Usage Page `0xD`: "Digitizers",
339 /// see [Digitizers].
340 Digitizers,
341 /// Usage Page `0xE`: "Haptics",
342 /// see [Haptics].
343 Haptics,
344 /// Usage Page `0xF`: "Physical Input Device",
345 /// see [PhysicalInputDevice].
346 PhysicalInputDevice,
347 /// Usage Page `0x10`: "Unicode",
348 /// see [Unicode].
349 Unicode,
350 /// Usage Page `0x11`: "SoC",
351 /// see [SoC].
352 SoC,
353 /// Usage Page `0x12`: "Eye and Head Trackers",
354 /// see [EyeandHeadTrackers].
355 EyeandHeadTrackers,
356 /// Usage Page `0x14`: "Auxiliary Display",
357 /// see [AuxiliaryDisplay].
358 AuxiliaryDisplay,
359 /// Usage Page `0x20`: "Sensors",
360 /// see [Sensors].
361 Sensors,
362 /// Usage Page `0x40`: "Medical Instrument",
363 /// see [MedicalInstrument].
364 MedicalInstrument,
365 /// Usage Page `0x41`: "Braille Display",
366 /// see [BrailleDisplay].
367 BrailleDisplay,
368 /// Usage Page `0x59`: "Lighting And Illumination",
369 /// see [LightingAndIllumination].
370 LightingAndIllumination,
371 /// Usage Page `0x80`: "Monitor",
372 /// see [Monitor].
373 Monitor,
374 /// Usage Page `0x81`: "Monitor Enumerated",
375 /// see [MonitorEnumerated].
376 MonitorEnumerated,
377 /// Usage Page `0x82`: "VESA Virtual Controls",
378 /// see [VESAVirtualControls].
379 VESAVirtualControls,
380 /// Usage Page `0x84`: "Power",
381 /// see [Power].
382 Power,
383 /// Usage Page `0x85`: "Battery System",
384 /// see [BatterySystem].
385 BatterySystem,
386 /// Usage Page `0x8C`: "Barcode Scanner",
387 /// see [BarcodeScanner].
388 BarcodeScanner,
389 /// Usage Page `0x8D`: "Scales",
390 /// see [Scales].
391 Scales,
392 /// Usage Page `0x8E`: "Magnetic Stripe Reader",
393 /// see [MagneticStripeReader].
394 MagneticStripeReader,
395 /// Usage Page `0x90`: "Camera Control",
396 /// see [CameraControl].
397 CameraControl,
398 /// Usage Page `0x91`: "Arcade",
399 /// see [Arcade].
400 Arcade,
401 /// Usage Page `0xF1D0`: "FIDO Alliance",
402 /// see [FIDOAlliance].
403 FIDOAlliance,
404 /// Usage Page `0xFF0D`: "Wacom",
405 /// see [Wacom].
406 Wacom,
407 /// The Reserved Usage Pages (range: various). See [ReservedUsagePage].
408 ReservedUsagePage(ReservedPage),
409 /// The Vendor Defined Pages, range `0xFF00 - 0xFFFF`. See [VendorDefinedPage].
410 VendorDefinedPage(VendorPage),
411 }
412
413 /// Represents a Reserved Page number value of in the current range of
414 /// reserved values. See [ReservedUsagePage].
415 ///
416 /// ```
417 /// # use hut::*;
418 /// // 0x3f is currently reserved
419 /// let vp: ReservedPage = ReservedPage::try_from(0x3f as u16).unwrap();
420 /// let vp: ReservedPage = ReservedPage::try_from(0x003f1234 as u32).unwrap();
421 ///
422 /// let usage = Usage::try_from(0x003f1234).unwrap();
423 /// let up = UsagePage::from(&usage);
424 /// assert!(matches!(up, UsagePage::ReservedUsagePage(_)));
425 /// ```
426 #[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
427 pub struct ReservedPage(u16);
428
429 impl From<&ReservedPage> for ReservedPage {
430 fn from(v: &ReservedPage) -> ReservedPage {
431 ReservedPage(v.0)
432 }
433 }
434
435 impl From<&ReservedPage> for u16 {
436 fn from(v: &ReservedPage) -> u16 {
437 v.0
438 }
439 }
440
441 impl From<ReservedPage> for u16 {
442 fn from(v: ReservedPage) -> u16 {
443 u16::from(&v)
444 }
445 }
446
447 impl From<&ReservedPage> for u32 {
448 fn from(v: &ReservedPage) -> u32 {
449 (v.0 as u32) << 16
450 }
451 }
452
453 impl From<ReservedPage> for u32 {
454 fn from(v: ReservedPage) -> u32 {
455 u32::from(&v)
456 }
457 }
458
459 impl 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
479 impl 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 /// Represents a Vendor Defined Page number value of in the range
488 /// `0xFF00..=0xFFFF`. See [VendorDefinedPage].
489 ///
490 /// ```
491 /// # use hut::*;
492 /// // The value has to be 0xff00..=0xffff
493 /// let vp: VendorPage = VendorPage::try_from(0xff00 as u16).unwrap();
494 /// let vp: VendorPage = VendorPage::try_from(0xff001234 as u32).unwrap();
495 ///
496 /// let usage = Usage::try_from(0xff001234).unwrap();
497 /// let up = UsagePage::from(&usage);
498 /// assert!(matches!(up, UsagePage::VendorDefinedPage(_)));
499 /// ```
500 #[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
501 pub struct VendorPage(u16);
502
503 impl From<&VendorPage> for VendorPage {
504 fn from(v: &VendorPage) -> VendorPage {
505 VendorPage(v.0)
506 }
507 }
508
509 impl From<&VendorPage> for u16 {
510 fn from(v: &VendorPage) -> u16 {
511 v.0
512 }
513 }
514
515 impl From<VendorPage> for u16 {
516 fn from(v: VendorPage) -> u16 {
517 u16::from(&v)
518 }
519 }
520
521 impl From<&VendorPage> for u32 {
522 fn from(v: &VendorPage) -> u32 {
523 (v.0 as u32) << 16
524 }
525 }
526
527 impl From<VendorPage> for u32 {
528 fn from(v: VendorPage) -> u32 {
529 u32::from(&v)
530 }
531 }
532
533 impl 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
544 impl 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
552 impl UsagePage {
553 /// Returns the Usage Page for the given Usage Page value. This is the
554 /// 16-bit Usage Page value only, not the full 32-bit Usage.
555 /// ```
556 /// # use hut::*;
557 /// let usage_value: u16 = 0x1; // GenericDesktop
558 /// let usage_page = UsagePage::from_usage_page_value(usage_value).unwrap();
559 /// assert!(matches!(UsagePage::GenericDesktop, usage_page));
560 /// ```
561 pub fn from_usage_page_value(usage_page: u16) -> Result<UsagePage> {
562 UsagePage::try_from(usage_page)
563 }
564
565 /// Returns the Usage Page for the given Usage numeric value. The Usage Page
566 /// must be in the upper 16 bits of the `usage` value and the lower 16 bits
567 /// are ignored.
568 /// ```
569 /// # use hut::*;
570 /// let usage_value: u32 = (0x1 << 16) | 0x2;
571 /// let usage = UsagePage::from_usage_value(usage_value).unwrap();
572 /// assert!(matches!(Usage::from(GenericDesktop::Mouse), usage));
573 /// ```
574 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 /// Returns the 32-bit Usage that is this Usage Page combined with
580 /// the 16 bits Usage ID.
581 ///
582 /// ```
583 /// # use hut::*;
584 /// let up = UsagePage::GenericDesktop;
585 /// let usage_id_value: u16 = 0x02; // Mouse
586 ///
587 /// let usage = up.to_usage_from_value(usage_id_value).unwrap();
588 /// assert!(matches!(Usage::from(GenericDesktop::Mouse), usage));
589 /// ```
590 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 /// Return a printable name for this usage page
597 /// ```
598 /// # use hut::*;
599 /// let up = UsagePage::GenericDesktop;
600 /// assert_eq!(up.name(), "Generic Desktop");
601 /// ```
602 #[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
650 impl AsUsagePage for UsagePage {
651 /// Returns the 16 bit Usage Page value of this Usage Page
652 /// ```
653 /// # use hut::*;
654 /// let usage_value: u16 = 0x1; // GenericDesktop
655 /// let usage_page = UsagePage::from_usage_page_value(usage_value).unwrap();
656 /// assert_eq!(usage_page.usage_page_value(), 0x1);
657 /// ```
658 fn usage_page_value(&self) -> u16 {
659 u16::from(self)
660 }
661
662 /// Returns our current [UsagePage]
663 /// ```
664 /// # use hut::*;
665 /// let usage_value: u16 = 0x1; // GenericDesktop
666 /// let usage_page = UsagePage::from_usage_page_value(usage_value).unwrap();
667 /// assert!(matches!(usage_page.usage_page(), UsagePage::GenericDesktop));
668 /// ```
669 /// There is seldom a need to invoke this function, it is merely
670 /// implemented to meet the [AsUsagePage] requirements.
671 fn usage_page(&self) -> UsagePage {
672 UsagePage::try_from(u16::from(self)).unwrap()
673 }
674 }
675
676 /// *Usage Page `0x1`: "Generic Desktop"*
677 ///
678 /// **This enum is autogenerated from the HID Usage Tables**.
679 /// ```
680 /// # use hut::*;
681 /// let u1 = Usage::GenericDesktop(GenericDesktop::Mouse);
682 /// let u2 = Usage::new_from_page_and_id(0x1, 0x2).unwrap();
683 /// let u3 = Usage::from(GenericDesktop::Mouse);
684 /// let u4: Usage = GenericDesktop::Mouse.into();
685 /// assert_eq!(u1, u2);
686 /// assert_eq!(u1, u3);
687 /// assert_eq!(u1, u4);
688 ///
689 /// assert!(matches!(u1.usage_page(), UsagePage::GenericDesktop));
690 /// assert_eq!(0x1, u1.usage_page_value());
691 /// assert_eq!(0x2, u1.usage_id_value());
692 /// assert_eq!((0x1 << 16) | 0x2, u1.usage_value());
693 /// assert_eq!("Mouse", u1.name());
694 /// ```
695 ///
696 #[allow(non_camel_case_types)]
697 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
698 #[non_exhaustive]
699 #[repr(u16)]
700 pub enum GenericDesktop {
701 /// Usage ID `0x1`: "Pointer"
702 Pointer = 0x1,
703 /// Usage ID `0x2`: "Mouse"
704 Mouse = 0x2,
705 /// Usage ID `0x4`: "Joystick"
706 Joystick = 0x4,
707 /// Usage ID `0x5`: "Gamepad"
708 Gamepad = 0x5,
709 /// Usage ID `0x6`: "Keyboard"
710 Keyboard = 0x6,
711 /// Usage ID `0x7`: "Keypad"
712 Keypad = 0x7,
713 /// Usage ID `0x8`: "Multi-axis Controller"
714 MultiaxisController = 0x8,
715 /// Usage ID `0x9`: "Tablet PC System Controls"
716 TabletPCSystemControls = 0x9,
717 /// Usage ID `0xA`: "Water Cooling Device"
718 WaterCoolingDevice = 0xA,
719 /// Usage ID `0xB`: "Computer Chassis Device"
720 ComputerChassisDevice = 0xB,
721 /// Usage ID `0xC`: "Wireless Radio Controls"
722 WirelessRadioControls = 0xC,
723 /// Usage ID `0xD`: "Portable Device Control"
724 PortableDeviceControl = 0xD,
725 /// Usage ID `0xE`: "System Multi-Axis Controller"
726 SystemMultiAxisController = 0xE,
727 /// Usage ID `0xF`: "Spatial Controller"
728 SpatialController = 0xF,
729 /// Usage ID `0x10`: "Assistive Control"
730 AssistiveControl = 0x10,
731 /// Usage ID `0x11`: "Device Dock"
732 DeviceDock = 0x11,
733 /// Usage ID `0x12`: "Dockable Device"
734 DockableDevice = 0x12,
735 /// Usage ID `0x13`: "Call State Management Control"
736 CallStateManagementControl = 0x13,
737 /// Usage ID `0x30`: "X"
738 X = 0x30,
739 /// Usage ID `0x31`: "Y"
740 Y = 0x31,
741 /// Usage ID `0x32`: "Z"
742 Z = 0x32,
743 /// Usage ID `0x33`: "Rx"
744 Rx = 0x33,
745 /// Usage ID `0x34`: "Ry"
746 Ry = 0x34,
747 /// Usage ID `0x35`: "Rz"
748 Rz = 0x35,
749 /// Usage ID `0x36`: "Slider"
750 Slider = 0x36,
751 /// Usage ID `0x37`: "Dial"
752 Dial = 0x37,
753 /// Usage ID `0x38`: "Wheel"
754 Wheel = 0x38,
755 /// Usage ID `0x39`: "Hat Switch"
756 HatSwitch = 0x39,
757 /// Usage ID `0x3A`: "Counted Buffer"
758 CountedBuffer = 0x3A,
759 /// Usage ID `0x3B`: "Byte Count"
760 ByteCount = 0x3B,
761 /// Usage ID `0x3C`: "Motion Wakeup"
762 MotionWakeup = 0x3C,
763 /// Usage ID `0x3D`: "Start"
764 Start = 0x3D,
765 /// Usage ID `0x3E`: "Select"
766 Select = 0x3E,
767 /// Usage ID `0x40`: "Vx"
768 Vx = 0x40,
769 /// Usage ID `0x41`: "Vy"
770 Vy = 0x41,
771 /// Usage ID `0x42`: "Vz"
772 Vz = 0x42,
773 /// Usage ID `0x43`: "Vbrx"
774 Vbrx = 0x43,
775 /// Usage ID `0x44`: "Vbry"
776 Vbry = 0x44,
777 /// Usage ID `0x45`: "Vbrz"
778 Vbrz = 0x45,
779 /// Usage ID `0x46`: "Vno"
780 Vno = 0x46,
781 /// Usage ID `0x47`: "Feature Notification"
782 FeatureNotification = 0x47,
783 /// Usage ID `0x48`: "Resolution Multiplier"
784 ResolutionMultiplier = 0x48,
785 /// Usage ID `0x49`: "Qx"
786 Qx = 0x49,
787 /// Usage ID `0x4A`: "Qy"
788 Qy = 0x4A,
789 /// Usage ID `0x4B`: "Qz"
790 Qz = 0x4B,
791 /// Usage ID `0x4C`: "Qw"
792 Qw = 0x4C,
793 /// Usage ID `0x80`: "System Control"
794 SystemControl = 0x80,
795 /// Usage ID `0x81`: "System Power Down"
796 SystemPowerDown = 0x81,
797 /// Usage ID `0x82`: "System Sleep"
798 SystemSleep = 0x82,
799 /// Usage ID `0x83`: "System Wake Up"
800 SystemWakeUp = 0x83,
801 /// Usage ID `0x84`: "System Context Menu"
802 SystemContextMenu = 0x84,
803 /// Usage ID `0x85`: "System Main Menu"
804 SystemMainMenu = 0x85,
805 /// Usage ID `0x86`: "System App Menu"
806 SystemAppMenu = 0x86,
807 /// Usage ID `0x87`: "System Menu Help"
808 SystemMenuHelp = 0x87,
809 /// Usage ID `0x88`: "System Menu Exit"
810 SystemMenuExit = 0x88,
811 /// Usage ID `0x89`: "System Menu Select"
812 SystemMenuSelect = 0x89,
813 /// Usage ID `0x8A`: "System Menu Right"
814 SystemMenuRight = 0x8A,
815 /// Usage ID `0x8B`: "System Menu Left"
816 SystemMenuLeft = 0x8B,
817 /// Usage ID `0x8C`: "System Menu Up"
818 SystemMenuUp = 0x8C,
819 /// Usage ID `0x8D`: "System Menu Down"
820 SystemMenuDown = 0x8D,
821 /// Usage ID `0x8E`: "System Cold Restart"
822 SystemColdRestart = 0x8E,
823 /// Usage ID `0x8F`: "System Warm Restart"
824 SystemWarmRestart = 0x8F,
825 /// Usage ID `0x90`: "D-pad Up"
826 DpadUp = 0x90,
827 /// Usage ID `0x91`: "D-pad Down"
828 DpadDown = 0x91,
829 /// Usage ID `0x92`: "D-pad Right"
830 DpadRight = 0x92,
831 /// Usage ID `0x93`: "D-pad Left"
832 DpadLeft = 0x93,
833 /// Usage ID `0x94`: "Index Trigger"
834 IndexTrigger = 0x94,
835 /// Usage ID `0x95`: "Palm Trigger"
836 PalmTrigger = 0x95,
837 /// Usage ID `0x96`: "Thumbstick"
838 Thumbstick = 0x96,
839 /// Usage ID `0x97`: "System Function Shift"
840 SystemFunctionShift = 0x97,
841 /// Usage ID `0x98`: "System Function Shift Lock"
842 SystemFunctionShiftLock = 0x98,
843 /// Usage ID `0x99`: "System Function Shift Lock Indicator"
844 SystemFunctionShiftLockIndicator = 0x99,
845 /// Usage ID `0x9A`: "System Dismiss Notification"
846 SystemDismissNotification = 0x9A,
847 /// Usage ID `0x9B`: "System Do Not Disturb"
848 SystemDoNotDisturb = 0x9B,
849 /// Usage ID `0xA0`: "System Dock"
850 SystemDock = 0xA0,
851 /// Usage ID `0xA1`: "System Undock"
852 SystemUndock = 0xA1,
853 /// Usage ID `0xA2`: "System Setup"
854 SystemSetup = 0xA2,
855 /// Usage ID `0xA3`: "System Break"
856 SystemBreak = 0xA3,
857 /// Usage ID `0xA4`: "System Debugger Break"
858 SystemDebuggerBreak = 0xA4,
859 /// Usage ID `0xA5`: "Application Break"
860 ApplicationBreak = 0xA5,
861 /// Usage ID `0xA6`: "Application Debugger Break"
862 ApplicationDebuggerBreak = 0xA6,
863 /// Usage ID `0xA7`: "System Speaker Mute"
864 SystemSpeakerMute = 0xA7,
865 /// Usage ID `0xA8`: "System Hibernate"
866 SystemHibernate = 0xA8,
867 /// Usage ID `0xA9`: "System Microphone Mute"
868 SystemMicrophoneMute = 0xA9,
869 /// Usage ID `0xAA`: "System Accessibility Binding"
870 SystemAccessibilityBinding = 0xAA,
871 /// Usage ID `0xB0`: "System Display Invert"
872 SystemDisplayInvert = 0xB0,
873 /// Usage ID `0xB1`: "System Display Internal"
874 SystemDisplayInternal = 0xB1,
875 /// Usage ID `0xB2`: "System Display External"
876 SystemDisplayExternal = 0xB2,
877 /// Usage ID `0xB3`: "System Display Both"
878 SystemDisplayBoth = 0xB3,
879 /// Usage ID `0xB4`: "System Display Dual"
880 SystemDisplayDual = 0xB4,
881 /// Usage ID `0xB5`: "System Display Toggle Int/Ext Mode"
882 SystemDisplayToggleIntExtMode = 0xB5,
883 /// Usage ID `0xB6`: "System Display Swap Primary/Secondary"
884 SystemDisplaySwapPrimarySecondary = 0xB6,
885 /// Usage ID `0xB7`: "System Display Toggle LCD Autoscale"
886 SystemDisplayToggleLCDAutoscale = 0xB7,
887 /// Usage ID `0xC0`: "Sensor Zone"
888 SensorZone = 0xC0,
889 /// Usage ID `0xC1`: "RPM"
890 RPM = 0xC1,
891 /// Usage ID `0xC2`: "Coolant Level"
892 CoolantLevel = 0xC2,
893 /// Usage ID `0xC3`: "Coolant Critical Level"
894 CoolantCriticalLevel = 0xC3,
895 /// Usage ID `0xC4`: "Coolant Pump"
896 CoolantPump = 0xC4,
897 /// Usage ID `0xC5`: "Chassis Enclosure"
898 ChassisEnclosure = 0xC5,
899 /// Usage ID `0xC6`: "Wireless Radio Button"
900 WirelessRadioButton = 0xC6,
901 /// Usage ID `0xC7`: "Wireless Radio LED"
902 WirelessRadioLED = 0xC7,
903 /// Usage ID `0xC8`: "Wireless Radio Slider Switch"
904 WirelessRadioSliderSwitch = 0xC8,
905 /// Usage ID `0xC9`: "System Display Rotation Lock Button"
906 SystemDisplayRotationLockButton = 0xC9,
907 /// Usage ID `0xCA`: "System Display Rotation Lock Slider Switch"
908 SystemDisplayRotationLockSliderSwitch = 0xCA,
909 /// Usage ID `0xCB`: "Control Enable"
910 ControlEnable = 0xCB,
911 /// Usage ID `0xD0`: "Dockable Device Unique ID"
912 DockableDeviceUniqueID = 0xD0,
913 /// Usage ID `0xD1`: "Dockable Device Vendor ID"
914 DockableDeviceVendorID = 0xD1,
915 /// Usage ID `0xD2`: "Dockable Device Primary Usage Page"
916 DockableDevicePrimaryUsagePage = 0xD2,
917 /// Usage ID `0xD3`: "Dockable Device Primary Usage ID"
918 DockableDevicePrimaryUsageID = 0xD3,
919 /// Usage ID `0xD4`: "Dockable Device Docking State"
920 DockableDeviceDockingState = 0xD4,
921 /// Usage ID `0xD5`: "Dockable Device Display Occlusion"
922 DockableDeviceDisplayOcclusion = 0xD5,
923 /// Usage ID `0xD6`: "Dockable Device Object Type"
924 DockableDeviceObjectType = 0xD6,
925 /// Usage ID `0xE0`: "Call Active LED"
926 CallActiveLED = 0xE0,
927 /// Usage ID `0xE1`: "Call Mute Toggle"
928 CallMuteToggle = 0xE1,
929 /// Usage ID `0xE2`: "Call Mute LED"
930 CallMuteLED = 0xE2,
931 }
932
933 impl GenericDesktop {
934 #[cfg(feature = "std")]
935 pub fn name(&self) -> String {
936 match self {
937 GenericDesktop::Pointer => "Pointer",
938 GenericDesktop::Mouse => "Mouse",
939 GenericDesktop::Joystick => "Joystick",
940 GenericDesktop::Gamepad => "Gamepad",
941 GenericDesktop::Keyboard => "Keyboard",
942 GenericDesktop::Keypad => "Keypad",
943 GenericDesktop::MultiaxisController => "Multi-axis Controller",
944 GenericDesktop::TabletPCSystemControls => "Tablet PC System Controls",
945 GenericDesktop::WaterCoolingDevice => "Water Cooling Device",
946 GenericDesktop::ComputerChassisDevice => "Computer Chassis Device",
947 GenericDesktop::WirelessRadioControls => "Wireless Radio Controls",
948 GenericDesktop::PortableDeviceControl => "Portable Device Control",
949 GenericDesktop::SystemMultiAxisController => "System Multi-Axis Controller",
950 GenericDesktop::SpatialController => "Spatial Controller",
951 GenericDesktop::AssistiveControl => "Assistive Control",
952 GenericDesktop::DeviceDock => "Device Dock",
953 GenericDesktop::DockableDevice => "Dockable Device",
954 GenericDesktop::CallStateManagementControl => "Call State Management Control",
955 GenericDesktop::X => "X",
956 GenericDesktop::Y => "Y",
957 GenericDesktop::Z => "Z",
958 GenericDesktop::Rx => "Rx",
959 GenericDesktop::Ry => "Ry",
960 GenericDesktop::Rz => "Rz",
961 GenericDesktop::Slider => "Slider",
962 GenericDesktop::Dial => "Dial",
963 GenericDesktop::Wheel => "Wheel",
964 GenericDesktop::HatSwitch => "Hat Switch",
965 GenericDesktop::CountedBuffer => "Counted Buffer",
966 GenericDesktop::ByteCount => "Byte Count",
967 GenericDesktop::MotionWakeup => "Motion Wakeup",
968 GenericDesktop::Start => "Start",
969 GenericDesktop::Select => "Select",
970 GenericDesktop::Vx => "Vx",
971 GenericDesktop::Vy => "Vy",
972 GenericDesktop::Vz => "Vz",
973 GenericDesktop::Vbrx => "Vbrx",
974 GenericDesktop::Vbry => "Vbry",
975 GenericDesktop::Vbrz => "Vbrz",
976 GenericDesktop::Vno => "Vno",
977 GenericDesktop::FeatureNotification => "Feature Notification",
978 GenericDesktop::ResolutionMultiplier => "Resolution Multiplier",
979 GenericDesktop::Qx => "Qx",
980 GenericDesktop::Qy => "Qy",
981 GenericDesktop::Qz => "Qz",
982 GenericDesktop::Qw => "Qw",
983 GenericDesktop::SystemControl => "System Control",
984 GenericDesktop::SystemPowerDown => "System Power Down",
985 GenericDesktop::SystemSleep => "System Sleep",
986 GenericDesktop::SystemWakeUp => "System Wake Up",
987 GenericDesktop::SystemContextMenu => "System Context Menu",
988 GenericDesktop::SystemMainMenu => "System Main Menu",
989 GenericDesktop::SystemAppMenu => "System App Menu",
990 GenericDesktop::SystemMenuHelp => "System Menu Help",
991 GenericDesktop::SystemMenuExit => "System Menu Exit",
992 GenericDesktop::SystemMenuSelect => "System Menu Select",
993 GenericDesktop::SystemMenuRight => "System Menu Right",
994 GenericDesktop::SystemMenuLeft => "System Menu Left",
995 GenericDesktop::SystemMenuUp => "System Menu Up",
996 GenericDesktop::SystemMenuDown => "System Menu Down",
997 GenericDesktop::SystemColdRestart => "System Cold Restart",
998 GenericDesktop::SystemWarmRestart => "System Warm Restart",
999 GenericDesktop::DpadUp => "D-pad Up",
1000 GenericDesktop::DpadDown => "D-pad Down",
1001 GenericDesktop::DpadRight => "D-pad Right",
1002 GenericDesktop::DpadLeft => "D-pad Left",
1003 GenericDesktop::IndexTrigger => "Index Trigger",
1004 GenericDesktop::PalmTrigger => "Palm Trigger",
1005 GenericDesktop::Thumbstick => "Thumbstick",
1006 GenericDesktop::SystemFunctionShift => "System Function Shift",
1007 GenericDesktop::SystemFunctionShiftLock => "System Function Shift Lock",
1008 GenericDesktop::SystemFunctionShiftLockIndicator => {
1009 "System Function Shift Lock Indicator"
1010 }
1011 GenericDesktop::SystemDismissNotification => "System Dismiss Notification",
1012 GenericDesktop::SystemDoNotDisturb => "System Do Not Disturb",
1013 GenericDesktop::SystemDock => "System Dock",
1014 GenericDesktop::SystemUndock => "System Undock",
1015 GenericDesktop::SystemSetup => "System Setup",
1016 GenericDesktop::SystemBreak => "System Break",
1017 GenericDesktop::SystemDebuggerBreak => "System Debugger Break",
1018 GenericDesktop::ApplicationBreak => "Application Break",
1019 GenericDesktop::ApplicationDebuggerBreak => "Application Debugger Break",
1020 GenericDesktop::SystemSpeakerMute => "System Speaker Mute",
1021 GenericDesktop::SystemHibernate => "System Hibernate",
1022 GenericDesktop::SystemMicrophoneMute => "System Microphone Mute",
1023 GenericDesktop::SystemAccessibilityBinding => "System Accessibility Binding",
1024 GenericDesktop::SystemDisplayInvert => "System Display Invert",
1025 GenericDesktop::SystemDisplayInternal => "System Display Internal",
1026 GenericDesktop::SystemDisplayExternal => "System Display External",
1027 GenericDesktop::SystemDisplayBoth => "System Display Both",
1028 GenericDesktop::SystemDisplayDual => "System Display Dual",
1029 GenericDesktop::SystemDisplayToggleIntExtMode => "System Display Toggle Int/Ext Mode",
1030 GenericDesktop::SystemDisplaySwapPrimarySecondary => {
1031 "System Display Swap Primary/Secondary"
1032 }
1033 GenericDesktop::SystemDisplayToggleLCDAutoscale => {
1034 "System Display Toggle LCD Autoscale"
1035 }
1036 GenericDesktop::SensorZone => "Sensor Zone",
1037 GenericDesktop::RPM => "RPM",
1038 GenericDesktop::CoolantLevel => "Coolant Level",
1039 GenericDesktop::CoolantCriticalLevel => "Coolant Critical Level",
1040 GenericDesktop::CoolantPump => "Coolant Pump",
1041 GenericDesktop::ChassisEnclosure => "Chassis Enclosure",
1042 GenericDesktop::WirelessRadioButton => "Wireless Radio Button",
1043 GenericDesktop::WirelessRadioLED => "Wireless Radio LED",
1044 GenericDesktop::WirelessRadioSliderSwitch => "Wireless Radio Slider Switch",
1045 GenericDesktop::SystemDisplayRotationLockButton => {
1046 "System Display Rotation Lock Button"
1047 }
1048 GenericDesktop::SystemDisplayRotationLockSliderSwitch => {
1049 "System Display Rotation Lock Slider Switch"
1050 }
1051 GenericDesktop::ControlEnable => "Control Enable",
1052 GenericDesktop::DockableDeviceUniqueID => "Dockable Device Unique ID",
1053 GenericDesktop::DockableDeviceVendorID => "Dockable Device Vendor ID",
1054 GenericDesktop::DockableDevicePrimaryUsagePage => "Dockable Device Primary Usage Page",
1055 GenericDesktop::DockableDevicePrimaryUsageID => "Dockable Device Primary Usage ID",
1056 GenericDesktop::DockableDeviceDockingState => "Dockable Device Docking State",
1057 GenericDesktop::DockableDeviceDisplayOcclusion => "Dockable Device Display Occlusion",
1058 GenericDesktop::DockableDeviceObjectType => "Dockable Device Object Type",
1059 GenericDesktop::CallActiveLED => "Call Active LED",
1060 GenericDesktop::CallMuteToggle => "Call Mute Toggle",
1061 GenericDesktop::CallMuteLED => "Call Mute LED",
1062 }
1063 .into()
1064 }
1065 }
1066
1067 #[cfg(feature = "std")]
1068 impl fmt::Display for GenericDesktop {
1069 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1070 write!(f, "{}", self.name())
1071 }
1072 }
1073
1074 impl AsUsage for GenericDesktop {
1075 /// Returns the 32 bit Usage value of this Usage
1076 fn usage_value(&self) -> u32 {
1077 u32::from(self)
1078 }
1079
1080 /// Returns the 16 bit Usage ID value of this Usage
1081 fn usage_id_value(&self) -> u16 {
1082 u16::from(self)
1083 }
1084
1085 /// Returns this usage as [Usage::GenericDesktop(self)](Usage::GenericDesktop)
1086 /// This is a convenience function to avoid having
1087 /// to implement `From` for every used type in the caller.
1088 ///
1089 /// ```
1090 /// # use hut::*;
1091 /// let gd_x = GenericDesktop::X;
1092 /// let usage = Usage::from(GenericDesktop::X);
1093 /// assert!(matches!(gd_x.usage(), usage));
1094 /// ```
1095 fn usage(&self) -> Usage {
1096 Usage::from(self)
1097 }
1098 }
1099
1100 impl AsUsagePage for GenericDesktop {
1101 /// Returns the 16 bit value of this UsagePage
1102 ///
1103 /// This value is `0x1` for [GenericDesktop]
1104 fn usage_page_value(&self) -> u16 {
1105 let up = UsagePage::from(self);
1106 u16::from(up)
1107 }
1108
1109 /// Returns [UsagePage::GenericDesktop]]
1110 fn usage_page(&self) -> UsagePage {
1111 UsagePage::from(self)
1112 }
1113 }
1114
1115 impl From<&GenericDesktop> for u16 {
1116 fn from(genericdesktop: &GenericDesktop) -> u16 {
1117 *genericdesktop as u16
1118 }
1119 }
1120
1121 impl From<GenericDesktop> for u16 {
1122 /// Returns the 16bit value of this usage. This is identical
1123 /// to [GenericDesktop::usage_page_value()].
1124 fn from(genericdesktop: GenericDesktop) -> u16 {
1125 u16::from(&genericdesktop)
1126 }
1127 }
1128
1129 impl From<&GenericDesktop> for u32 {
1130 /// Returns the 32 bit value of this usage. This is identical
1131 /// to [GenericDesktop::usage_value()].
1132 fn from(genericdesktop: &GenericDesktop) -> u32 {
1133 let up = UsagePage::from(genericdesktop);
1134 let up = (u16::from(&up) as u32) << 16;
1135 let id = u16::from(genericdesktop) as u32;
1136 up | id
1137 }
1138 }
1139
1140 impl From<&GenericDesktop> for UsagePage {
1141 /// Always returns [UsagePage::GenericDesktop] and is
1142 /// identical to [GenericDesktop::usage_page()].
1143 fn from(_: &GenericDesktop) -> UsagePage {
1144 UsagePage::GenericDesktop
1145 }
1146 }
1147
1148 impl From<GenericDesktop> for UsagePage {
1149 /// Always returns [UsagePage::GenericDesktop] and is
1150 /// identical to [GenericDesktop::usage_page()].
1151 fn from(_: GenericDesktop) -> UsagePage {
1152 UsagePage::GenericDesktop
1153 }
1154 }
1155
1156 impl From<&GenericDesktop> for Usage {
1157 fn from(genericdesktop: &GenericDesktop) -> Usage {
1158 Usage::try_from(u32::from(genericdesktop)).unwrap()
1159 }
1160 }
1161
1162 impl From<GenericDesktop> for Usage {
1163 fn from(genericdesktop: GenericDesktop) -> Usage {
1164 Usage::from(&genericdesktop)
1165 }
1166 }
1167
1168 impl TryFrom<u16> for GenericDesktop {
1169 type Error = HutError;
1170
1171 fn try_from(usage_id: u16) -> Result<GenericDesktop> {
1172 match usage_id {
1173 1 => Ok(GenericDesktop::Pointer),
1174 2 => Ok(GenericDesktop::Mouse),
1175 4 => Ok(GenericDesktop::Joystick),
1176 5 => Ok(GenericDesktop::Gamepad),
1177 6 => Ok(GenericDesktop::Keyboard),
1178 7 => Ok(GenericDesktop::Keypad),
1179 8 => Ok(GenericDesktop::MultiaxisController),
1180 9 => Ok(GenericDesktop::TabletPCSystemControls),
1181 10 => Ok(GenericDesktop::WaterCoolingDevice),
1182 11 => Ok(GenericDesktop::ComputerChassisDevice),
1183 12 => Ok(GenericDesktop::WirelessRadioControls),
1184 13 => Ok(GenericDesktop::PortableDeviceControl),
1185 14 => Ok(GenericDesktop::SystemMultiAxisController),
1186 15 => Ok(GenericDesktop::SpatialController),
1187 16 => Ok(GenericDesktop::AssistiveControl),
1188 17 => Ok(GenericDesktop::DeviceDock),
1189 18 => Ok(GenericDesktop::DockableDevice),
1190 19 => Ok(GenericDesktop::CallStateManagementControl),
1191 48 => Ok(GenericDesktop::X),
1192 49 => Ok(GenericDesktop::Y),
1193 50 => Ok(GenericDesktop::Z),
1194 51 => Ok(GenericDesktop::Rx),
1195 52 => Ok(GenericDesktop::Ry),
1196 53 => Ok(GenericDesktop::Rz),
1197 54 => Ok(GenericDesktop::Slider),
1198 55 => Ok(GenericDesktop::Dial),
1199 56 => Ok(GenericDesktop::Wheel),
1200 57 => Ok(GenericDesktop::HatSwitch),
1201 58 => Ok(GenericDesktop::CountedBuffer),
1202 59 => Ok(GenericDesktop::ByteCount),
1203 60 => Ok(GenericDesktop::MotionWakeup),
1204 61 => Ok(GenericDesktop::Start),
1205 62 => Ok(GenericDesktop::Select),
1206 64 => Ok(GenericDesktop::Vx),
1207 65 => Ok(GenericDesktop::Vy),
1208 66 => Ok(GenericDesktop::Vz),
1209 67 => Ok(GenericDesktop::Vbrx),
1210 68 => Ok(GenericDesktop::Vbry),
1211 69 => Ok(GenericDesktop::Vbrz),
1212 70 => Ok(GenericDesktop::Vno),
1213 71 => Ok(GenericDesktop::FeatureNotification),
1214 72 => Ok(GenericDesktop::ResolutionMultiplier),
1215 73 => Ok(GenericDesktop::Qx),
1216 74 => Ok(GenericDesktop::Qy),
1217 75 => Ok(GenericDesktop::Qz),
1218 76 => Ok(GenericDesktop::Qw),
1219 128 => Ok(GenericDesktop::SystemControl),
1220 129 => Ok(GenericDesktop::SystemPowerDown),
1221 130 => Ok(GenericDesktop::SystemSleep),
1222 131 => Ok(GenericDesktop::SystemWakeUp),
1223 132 => Ok(GenericDesktop::SystemContextMenu),
1224 133 => Ok(GenericDesktop::SystemMainMenu),
1225 134 => Ok(GenericDesktop::SystemAppMenu),
1226 135 => Ok(GenericDesktop::SystemMenuHelp),
1227 136 => Ok(GenericDesktop::SystemMenuExit),
1228 137 => Ok(GenericDesktop::SystemMenuSelect),
1229 138 => Ok(GenericDesktop::SystemMenuRight),
1230 139 => Ok(GenericDesktop::SystemMenuLeft),
1231 140 => Ok(GenericDesktop::SystemMenuUp),
1232 141 => Ok(GenericDesktop::SystemMenuDown),
1233 142 => Ok(GenericDesktop::SystemColdRestart),
1234 143 => Ok(GenericDesktop::SystemWarmRestart),
1235 144 => Ok(GenericDesktop::DpadUp),
1236 145 => Ok(GenericDesktop::DpadDown),
1237 146 => Ok(GenericDesktop::DpadRight),
1238 147 => Ok(GenericDesktop::DpadLeft),
1239 148 => Ok(GenericDesktop::IndexTrigger),
1240 149 => Ok(GenericDesktop::PalmTrigger),
1241 150 => Ok(GenericDesktop::Thumbstick),
1242 151 => Ok(GenericDesktop::SystemFunctionShift),
1243 152 => Ok(GenericDesktop::SystemFunctionShiftLock),
1244 153 => Ok(GenericDesktop::SystemFunctionShiftLockIndicator),
1245 154 => Ok(GenericDesktop::SystemDismissNotification),
1246 155 => Ok(GenericDesktop::SystemDoNotDisturb),
1247 160 => Ok(GenericDesktop::SystemDock),
1248 161 => Ok(GenericDesktop::SystemUndock),
1249 162 => Ok(GenericDesktop::SystemSetup),
1250 163 => Ok(GenericDesktop::SystemBreak),
1251 164 => Ok(GenericDesktop::SystemDebuggerBreak),
1252 165 => Ok(GenericDesktop::ApplicationBreak),
1253 166 => Ok(GenericDesktop::ApplicationDebuggerBreak),
1254 167 => Ok(GenericDesktop::SystemSpeakerMute),
1255 168 => Ok(GenericDesktop::SystemHibernate),
1256 169 => Ok(GenericDesktop::SystemMicrophoneMute),
1257 170 => Ok(GenericDesktop::SystemAccessibilityBinding),
1258 176 => Ok(GenericDesktop::SystemDisplayInvert),
1259 177 => Ok(GenericDesktop::SystemDisplayInternal),
1260 178 => Ok(GenericDesktop::SystemDisplayExternal),
1261 179 => Ok(GenericDesktop::SystemDisplayBoth),
1262 180 => Ok(GenericDesktop::SystemDisplayDual),
1263 181 => Ok(GenericDesktop::SystemDisplayToggleIntExtMode),
1264 182 => Ok(GenericDesktop::SystemDisplaySwapPrimarySecondary),
1265 183 => Ok(GenericDesktop::SystemDisplayToggleLCDAutoscale),
1266 192 => Ok(GenericDesktop::SensorZone),
1267 193 => Ok(GenericDesktop::RPM),
1268 194 => Ok(GenericDesktop::CoolantLevel),
1269 195 => Ok(GenericDesktop::CoolantCriticalLevel),
1270 196 => Ok(GenericDesktop::CoolantPump),
1271 197 => Ok(GenericDesktop::ChassisEnclosure),
1272 198 => Ok(GenericDesktop::WirelessRadioButton),
1273 199 => Ok(GenericDesktop::WirelessRadioLED),
1274 200 => Ok(GenericDesktop::WirelessRadioSliderSwitch),
1275 201 => Ok(GenericDesktop::SystemDisplayRotationLockButton),
1276 202 => Ok(GenericDesktop::SystemDisplayRotationLockSliderSwitch),
1277 203 => Ok(GenericDesktop::ControlEnable),
1278 208 => Ok(GenericDesktop::DockableDeviceUniqueID),
1279 209 => Ok(GenericDesktop::DockableDeviceVendorID),
1280 210 => Ok(GenericDesktop::DockableDevicePrimaryUsagePage),
1281 211 => Ok(GenericDesktop::DockableDevicePrimaryUsageID),
1282 212 => Ok(GenericDesktop::DockableDeviceDockingState),
1283 213 => Ok(GenericDesktop::DockableDeviceDisplayOcclusion),
1284 214 => Ok(GenericDesktop::DockableDeviceObjectType),
1285 224 => Ok(GenericDesktop::CallActiveLED),
1286 225 => Ok(GenericDesktop::CallMuteToggle),
1287 226 => Ok(GenericDesktop::CallMuteLED),
1288 n => Err(HutError::UnknownUsageId { usage_id: n }),
1289 }
1290 }
1291 }
1292
1293 impl BitOr<u16> for GenericDesktop {
1294 type Output = Usage;
1295
1296 /// A convenience function to combine a Usage Page with
1297 /// a value.
1298 ///
1299 /// This function panics if the Usage ID value results in
1300 /// an unknown Usage. Where error checking is required,
1301 /// use [UsagePage::to_usage_from_value].
1302 fn bitor(self, usage: u16) -> Usage {
1303 let up = u16::from(self) as u32;
1304 let u = usage as u32;
1305 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
1306 }
1307 }
1308
1309 /// *Usage Page `0x2`: "Simulation Controls"*
1310 ///
1311 /// **This enum is autogenerated from the HID Usage Tables**.
1312 /// ```
1313 /// # use hut::*;
1314 /// let u1 = Usage::SimulationControls(SimulationControls::AutomobileSimulationDevice);
1315 /// let u2 = Usage::new_from_page_and_id(0x2, 0x2).unwrap();
1316 /// let u3 = Usage::from(SimulationControls::AutomobileSimulationDevice);
1317 /// let u4: Usage = SimulationControls::AutomobileSimulationDevice.into();
1318 /// assert_eq!(u1, u2);
1319 /// assert_eq!(u1, u3);
1320 /// assert_eq!(u1, u4);
1321 ///
1322 /// assert!(matches!(u1.usage_page(), UsagePage::SimulationControls));
1323 /// assert_eq!(0x2, u1.usage_page_value());
1324 /// assert_eq!(0x2, u1.usage_id_value());
1325 /// assert_eq!((0x2 << 16) | 0x2, u1.usage_value());
1326 /// assert_eq!("Automobile Simulation Device", u1.name());
1327 /// ```
1328 ///
1329 #[allow(non_camel_case_types)]
1330 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1331 #[non_exhaustive]
1332 #[repr(u16)]
1333 pub enum SimulationControls {
1334 /// Usage ID `0x1`: "Flight Simulation Device"
1335 FlightSimulationDevice = 0x1,
1336 /// Usage ID `0x2`: "Automobile Simulation Device"
1337 AutomobileSimulationDevice = 0x2,
1338 /// Usage ID `0x3`: "Tank Simulation Device"
1339 TankSimulationDevice = 0x3,
1340 /// Usage ID `0x4`: "Spaceship Simulation Device"
1341 SpaceshipSimulationDevice = 0x4,
1342 /// Usage ID `0x5`: "Submarine Simulation Device"
1343 SubmarineSimulationDevice = 0x5,
1344 /// Usage ID `0x6`: "Sailing Simulation Device"
1345 SailingSimulationDevice = 0x6,
1346 /// Usage ID `0x7`: "Motorcycle Simulation Device"
1347 MotorcycleSimulationDevice = 0x7,
1348 /// Usage ID `0x8`: "Sports Simulation Device"
1349 SportsSimulationDevice = 0x8,
1350 /// Usage ID `0x9`: "Airplane Simulation Device"
1351 AirplaneSimulationDevice = 0x9,
1352 /// Usage ID `0xA`: "Helicopter Simulation Device"
1353 HelicopterSimulationDevice = 0xA,
1354 /// Usage ID `0xB`: "Magic Carpet Simulation Device"
1355 MagicCarpetSimulationDevice = 0xB,
1356 /// Usage ID `0xC`: "Bicycle Simulation Device"
1357 BicycleSimulationDevice = 0xC,
1358 /// Usage ID `0x20`: "Flight Control Stick"
1359 FlightControlStick = 0x20,
1360 /// Usage ID `0x21`: "Flight Stick"
1361 FlightStick = 0x21,
1362 /// Usage ID `0x22`: "Cyclic Control"
1363 CyclicControl = 0x22,
1364 /// Usage ID `0x23`: "Cyclic Trim"
1365 CyclicTrim = 0x23,
1366 /// Usage ID `0x24`: "Flight Yoke"
1367 FlightYoke = 0x24,
1368 /// Usage ID `0x25`: "Track Control"
1369 TrackControl = 0x25,
1370 /// Usage ID `0xB0`: "Aileron"
1371 Aileron = 0xB0,
1372 /// Usage ID `0xB1`: "Aileron Trim"
1373 AileronTrim = 0xB1,
1374 /// Usage ID `0xB2`: "Anti-Torque Control"
1375 AntiTorqueControl = 0xB2,
1376 /// Usage ID `0xB3`: "Autopilot Enable"
1377 AutopilotEnable = 0xB3,
1378 /// Usage ID `0xB4`: "Chaff Release"
1379 ChaffRelease = 0xB4,
1380 /// Usage ID `0xB5`: "Collective Control"
1381 CollectiveControl = 0xB5,
1382 /// Usage ID `0xB6`: "Dive Brake"
1383 DiveBrake = 0xB6,
1384 /// Usage ID `0xB7`: "Electronic Countermeasures"
1385 ElectronicCountermeasures = 0xB7,
1386 /// Usage ID `0xB8`: "Elevator"
1387 Elevator = 0xB8,
1388 /// Usage ID `0xB9`: "Elevator Trim"
1389 ElevatorTrim = 0xB9,
1390 /// Usage ID `0xBA`: "Rudder"
1391 Rudder = 0xBA,
1392 /// Usage ID `0xBB`: "Throttle"
1393 Throttle = 0xBB,
1394 /// Usage ID `0xBC`: "Flight Communications"
1395 FlightCommunications = 0xBC,
1396 /// Usage ID `0xBD`: "Flare Release"
1397 FlareRelease = 0xBD,
1398 /// Usage ID `0xBE`: "Landing Gear"
1399 LandingGear = 0xBE,
1400 /// Usage ID `0xBF`: "Toe Brake"
1401 ToeBrake = 0xBF,
1402 /// Usage ID `0xC0`: "Trigger"
1403 Trigger = 0xC0,
1404 /// Usage ID `0xC1`: "Weapons Arm"
1405 WeaponsArm = 0xC1,
1406 /// Usage ID `0xC2`: "Weapons Select"
1407 WeaponsSelect = 0xC2,
1408 /// Usage ID `0xC3`: "Wing Flaps"
1409 WingFlaps = 0xC3,
1410 /// Usage ID `0xC4`: "Accelerator"
1411 Accelerator = 0xC4,
1412 /// Usage ID `0xC5`: "Brake"
1413 Brake = 0xC5,
1414 /// Usage ID `0xC6`: "Clutch"
1415 Clutch = 0xC6,
1416 /// Usage ID `0xC7`: "Shifter"
1417 Shifter = 0xC7,
1418 /// Usage ID `0xC8`: "Steering"
1419 Steering = 0xC8,
1420 /// Usage ID `0xC9`: "Turret Direction"
1421 TurretDirection = 0xC9,
1422 /// Usage ID `0xCA`: "Barrel Elevation"
1423 BarrelElevation = 0xCA,
1424 /// Usage ID `0xCB`: "Dive Plane"
1425 DivePlane = 0xCB,
1426 /// Usage ID `0xCC`: "Ballast"
1427 Ballast = 0xCC,
1428 /// Usage ID `0xCD`: "Bicycle Crank"
1429 BicycleCrank = 0xCD,
1430 /// Usage ID `0xCE`: "Handle Bars"
1431 HandleBars = 0xCE,
1432 /// Usage ID `0xCF`: "Front Brake"
1433 FrontBrake = 0xCF,
1434 /// Usage ID `0xD0`: "Rear Brake"
1435 RearBrake = 0xD0,
1436 }
1437
1438 impl SimulationControls {
1439 #[cfg(feature = "std")]
1440 pub fn name(&self) -> String {
1441 match self {
1442 SimulationControls::FlightSimulationDevice => "Flight Simulation Device",
1443 SimulationControls::AutomobileSimulationDevice => "Automobile Simulation Device",
1444 SimulationControls::TankSimulationDevice => "Tank Simulation Device",
1445 SimulationControls::SpaceshipSimulationDevice => "Spaceship Simulation Device",
1446 SimulationControls::SubmarineSimulationDevice => "Submarine Simulation Device",
1447 SimulationControls::SailingSimulationDevice => "Sailing Simulation Device",
1448 SimulationControls::MotorcycleSimulationDevice => "Motorcycle Simulation Device",
1449 SimulationControls::SportsSimulationDevice => "Sports Simulation Device",
1450 SimulationControls::AirplaneSimulationDevice => "Airplane Simulation Device",
1451 SimulationControls::HelicopterSimulationDevice => "Helicopter Simulation Device",
1452 SimulationControls::MagicCarpetSimulationDevice => "Magic Carpet Simulation Device",
1453 SimulationControls::BicycleSimulationDevice => "Bicycle Simulation Device",
1454 SimulationControls::FlightControlStick => "Flight Control Stick",
1455 SimulationControls::FlightStick => "Flight Stick",
1456 SimulationControls::CyclicControl => "Cyclic Control",
1457 SimulationControls::CyclicTrim => "Cyclic Trim",
1458 SimulationControls::FlightYoke => "Flight Yoke",
1459 SimulationControls::TrackControl => "Track Control",
1460 SimulationControls::Aileron => "Aileron",
1461 SimulationControls::AileronTrim => "Aileron Trim",
1462 SimulationControls::AntiTorqueControl => "Anti-Torque Control",
1463 SimulationControls::AutopilotEnable => "Autopilot Enable",
1464 SimulationControls::ChaffRelease => "Chaff Release",
1465 SimulationControls::CollectiveControl => "Collective Control",
1466 SimulationControls::DiveBrake => "Dive Brake",
1467 SimulationControls::ElectronicCountermeasures => "Electronic Countermeasures",
1468 SimulationControls::Elevator => "Elevator",
1469 SimulationControls::ElevatorTrim => "Elevator Trim",
1470 SimulationControls::Rudder => "Rudder",
1471 SimulationControls::Throttle => "Throttle",
1472 SimulationControls::FlightCommunications => "Flight Communications",
1473 SimulationControls::FlareRelease => "Flare Release",
1474 SimulationControls::LandingGear => "Landing Gear",
1475 SimulationControls::ToeBrake => "Toe Brake",
1476 SimulationControls::Trigger => "Trigger",
1477 SimulationControls::WeaponsArm => "Weapons Arm",
1478 SimulationControls::WeaponsSelect => "Weapons Select",
1479 SimulationControls::WingFlaps => "Wing Flaps",
1480 SimulationControls::Accelerator => "Accelerator",
1481 SimulationControls::Brake => "Brake",
1482 SimulationControls::Clutch => "Clutch",
1483 SimulationControls::Shifter => "Shifter",
1484 SimulationControls::Steering => "Steering",
1485 SimulationControls::TurretDirection => "Turret Direction",
1486 SimulationControls::BarrelElevation => "Barrel Elevation",
1487 SimulationControls::DivePlane => "Dive Plane",
1488 SimulationControls::Ballast => "Ballast",
1489 SimulationControls::BicycleCrank => "Bicycle Crank",
1490 SimulationControls::HandleBars => "Handle Bars",
1491 SimulationControls::FrontBrake => "Front Brake",
1492 SimulationControls::RearBrake => "Rear Brake",
1493 }
1494 .into()
1495 }
1496 }
1497
1498 #[cfg(feature = "std")]
1499 impl fmt::Display for SimulationControls {
1500 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1501 write!(f, "{}", self.name())
1502 }
1503 }
1504
1505 impl AsUsage for SimulationControls {
1506 /// Returns the 32 bit Usage value of this Usage
1507 fn usage_value(&self) -> u32 {
1508 u32::from(self)
1509 }
1510
1511 /// Returns the 16 bit Usage ID value of this Usage
1512 fn usage_id_value(&self) -> u16 {
1513 u16::from(self)
1514 }
1515
1516 /// Returns this usage as [Usage::SimulationControls(self)](Usage::SimulationControls)
1517 /// This is a convenience function to avoid having
1518 /// to implement `From` for every used type in the caller.
1519 ///
1520 /// ```
1521 /// # use hut::*;
1522 /// let gd_x = GenericDesktop::X;
1523 /// let usage = Usage::from(GenericDesktop::X);
1524 /// assert!(matches!(gd_x.usage(), usage));
1525 /// ```
1526 fn usage(&self) -> Usage {
1527 Usage::from(self)
1528 }
1529 }
1530
1531 impl AsUsagePage for SimulationControls {
1532 /// Returns the 16 bit value of this UsagePage
1533 ///
1534 /// This value is `0x2` for [SimulationControls]
1535 fn usage_page_value(&self) -> u16 {
1536 let up = UsagePage::from(self);
1537 u16::from(up)
1538 }
1539
1540 /// Returns [UsagePage::SimulationControls]]
1541 fn usage_page(&self) -> UsagePage {
1542 UsagePage::from(self)
1543 }
1544 }
1545
1546 impl From<&SimulationControls> for u16 {
1547 fn from(simulationcontrols: &SimulationControls) -> u16 {
1548 *simulationcontrols as u16
1549 }
1550 }
1551
1552 impl From<SimulationControls> for u16 {
1553 /// Returns the 16bit value of this usage. This is identical
1554 /// to [SimulationControls::usage_page_value()].
1555 fn from(simulationcontrols: SimulationControls) -> u16 {
1556 u16::from(&simulationcontrols)
1557 }
1558 }
1559
1560 impl From<&SimulationControls> for u32 {
1561 /// Returns the 32 bit value of this usage. This is identical
1562 /// to [SimulationControls::usage_value()].
1563 fn from(simulationcontrols: &SimulationControls) -> u32 {
1564 let up = UsagePage::from(simulationcontrols);
1565 let up = (u16::from(&up) as u32) << 16;
1566 let id = u16::from(simulationcontrols) as u32;
1567 up | id
1568 }
1569 }
1570
1571 impl From<&SimulationControls> for UsagePage {
1572 /// Always returns [UsagePage::SimulationControls] and is
1573 /// identical to [SimulationControls::usage_page()].
1574 fn from(_: &SimulationControls) -> UsagePage {
1575 UsagePage::SimulationControls
1576 }
1577 }
1578
1579 impl From<SimulationControls> for UsagePage {
1580 /// Always returns [UsagePage::SimulationControls] and is
1581 /// identical to [SimulationControls::usage_page()].
1582 fn from(_: SimulationControls) -> UsagePage {
1583 UsagePage::SimulationControls
1584 }
1585 }
1586
1587 impl From<&SimulationControls> for Usage {
1588 fn from(simulationcontrols: &SimulationControls) -> Usage {
1589 Usage::try_from(u32::from(simulationcontrols)).unwrap()
1590 }
1591 }
1592
1593 impl From<SimulationControls> for Usage {
1594 fn from(simulationcontrols: SimulationControls) -> Usage {
1595 Usage::from(&simulationcontrols)
1596 }
1597 }
1598
1599 impl TryFrom<u16> for SimulationControls {
1600 type Error = HutError;
1601
1602 fn try_from(usage_id: u16) -> Result<SimulationControls> {
1603 match usage_id {
1604 1 => Ok(SimulationControls::FlightSimulationDevice),
1605 2 => Ok(SimulationControls::AutomobileSimulationDevice),
1606 3 => Ok(SimulationControls::TankSimulationDevice),
1607 4 => Ok(SimulationControls::SpaceshipSimulationDevice),
1608 5 => Ok(SimulationControls::SubmarineSimulationDevice),
1609 6 => Ok(SimulationControls::SailingSimulationDevice),
1610 7 => Ok(SimulationControls::MotorcycleSimulationDevice),
1611 8 => Ok(SimulationControls::SportsSimulationDevice),
1612 9 => Ok(SimulationControls::AirplaneSimulationDevice),
1613 10 => Ok(SimulationControls::HelicopterSimulationDevice),
1614 11 => Ok(SimulationControls::MagicCarpetSimulationDevice),
1615 12 => Ok(SimulationControls::BicycleSimulationDevice),
1616 32 => Ok(SimulationControls::FlightControlStick),
1617 33 => Ok(SimulationControls::FlightStick),
1618 34 => Ok(SimulationControls::CyclicControl),
1619 35 => Ok(SimulationControls::CyclicTrim),
1620 36 => Ok(SimulationControls::FlightYoke),
1621 37 => Ok(SimulationControls::TrackControl),
1622 176 => Ok(SimulationControls::Aileron),
1623 177 => Ok(SimulationControls::AileronTrim),
1624 178 => Ok(SimulationControls::AntiTorqueControl),
1625 179 => Ok(SimulationControls::AutopilotEnable),
1626 180 => Ok(SimulationControls::ChaffRelease),
1627 181 => Ok(SimulationControls::CollectiveControl),
1628 182 => Ok(SimulationControls::DiveBrake),
1629 183 => Ok(SimulationControls::ElectronicCountermeasures),
1630 184 => Ok(SimulationControls::Elevator),
1631 185 => Ok(SimulationControls::ElevatorTrim),
1632 186 => Ok(SimulationControls::Rudder),
1633 187 => Ok(SimulationControls::Throttle),
1634 188 => Ok(SimulationControls::FlightCommunications),
1635 189 => Ok(SimulationControls::FlareRelease),
1636 190 => Ok(SimulationControls::LandingGear),
1637 191 => Ok(SimulationControls::ToeBrake),
1638 192 => Ok(SimulationControls::Trigger),
1639 193 => Ok(SimulationControls::WeaponsArm),
1640 194 => Ok(SimulationControls::WeaponsSelect),
1641 195 => Ok(SimulationControls::WingFlaps),
1642 196 => Ok(SimulationControls::Accelerator),
1643 197 => Ok(SimulationControls::Brake),
1644 198 => Ok(SimulationControls::Clutch),
1645 199 => Ok(SimulationControls::Shifter),
1646 200 => Ok(SimulationControls::Steering),
1647 201 => Ok(SimulationControls::TurretDirection),
1648 202 => Ok(SimulationControls::BarrelElevation),
1649 203 => Ok(SimulationControls::DivePlane),
1650 204 => Ok(SimulationControls::Ballast),
1651 205 => Ok(SimulationControls::BicycleCrank),
1652 206 => Ok(SimulationControls::HandleBars),
1653 207 => Ok(SimulationControls::FrontBrake),
1654 208 => Ok(SimulationControls::RearBrake),
1655 n => Err(HutError::UnknownUsageId { usage_id: n }),
1656 }
1657 }
1658 }
1659
1660 impl BitOr<u16> for SimulationControls {
1661 type Output = Usage;
1662
1663 /// A convenience function to combine a Usage Page with
1664 /// a value.
1665 ///
1666 /// This function panics if the Usage ID value results in
1667 /// an unknown Usage. Where error checking is required,
1668 /// use [UsagePage::to_usage_from_value].
1669 fn bitor(self, usage: u16) -> Usage {
1670 let up = u16::from(self) as u32;
1671 let u = usage as u32;
1672 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
1673 }
1674 }
1675
1676 /// *Usage Page `0x3`: "VR Controls"*
1677 ///
1678 /// **This enum is autogenerated from the HID Usage Tables**.
1679 /// ```
1680 /// # use hut::*;
1681 /// let u1 = Usage::VRControls(VRControls::BodySuit);
1682 /// let u2 = Usage::new_from_page_and_id(0x3, 0x2).unwrap();
1683 /// let u3 = Usage::from(VRControls::BodySuit);
1684 /// let u4: Usage = VRControls::BodySuit.into();
1685 /// assert_eq!(u1, u2);
1686 /// assert_eq!(u1, u3);
1687 /// assert_eq!(u1, u4);
1688 ///
1689 /// assert!(matches!(u1.usage_page(), UsagePage::VRControls));
1690 /// assert_eq!(0x3, u1.usage_page_value());
1691 /// assert_eq!(0x2, u1.usage_id_value());
1692 /// assert_eq!((0x3 << 16) | 0x2, u1.usage_value());
1693 /// assert_eq!("Body Suit", u1.name());
1694 /// ```
1695 ///
1696 #[allow(non_camel_case_types)]
1697 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1698 #[non_exhaustive]
1699 #[repr(u16)]
1700 pub enum VRControls {
1701 /// Usage ID `0x1`: "Belt"
1702 Belt = 0x1,
1703 /// Usage ID `0x2`: "Body Suit"
1704 BodySuit = 0x2,
1705 /// Usage ID `0x3`: "Flexor"
1706 Flexor = 0x3,
1707 /// Usage ID `0x4`: "Glove"
1708 Glove = 0x4,
1709 /// Usage ID `0x5`: "Head Tracker"
1710 HeadTracker = 0x5,
1711 /// Usage ID `0x6`: "Head Mounted Display"
1712 HeadMountedDisplay = 0x6,
1713 /// Usage ID `0x7`: "Hand Tracker"
1714 HandTracker = 0x7,
1715 /// Usage ID `0x8`: "Oculometer"
1716 Oculometer = 0x8,
1717 /// Usage ID `0x9`: "Vest"
1718 Vest = 0x9,
1719 /// Usage ID `0xA`: "Animatronic Device"
1720 AnimatronicDevice = 0xA,
1721 /// Usage ID `0x20`: "Stereo Enable"
1722 StereoEnable = 0x20,
1723 /// Usage ID `0x21`: "Display Enable"
1724 DisplayEnable = 0x21,
1725 }
1726
1727 impl VRControls {
1728 #[cfg(feature = "std")]
1729 pub fn name(&self) -> String {
1730 match self {
1731 VRControls::Belt => "Belt",
1732 VRControls::BodySuit => "Body Suit",
1733 VRControls::Flexor => "Flexor",
1734 VRControls::Glove => "Glove",
1735 VRControls::HeadTracker => "Head Tracker",
1736 VRControls::HeadMountedDisplay => "Head Mounted Display",
1737 VRControls::HandTracker => "Hand Tracker",
1738 VRControls::Oculometer => "Oculometer",
1739 VRControls::Vest => "Vest",
1740 VRControls::AnimatronicDevice => "Animatronic Device",
1741 VRControls::StereoEnable => "Stereo Enable",
1742 VRControls::DisplayEnable => "Display Enable",
1743 }
1744 .into()
1745 }
1746 }
1747
1748 #[cfg(feature = "std")]
1749 impl fmt::Display for VRControls {
1750 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1751 write!(f, "{}", self.name())
1752 }
1753 }
1754
1755 impl AsUsage for VRControls {
1756 /// Returns the 32 bit Usage value of this Usage
1757 fn usage_value(&self) -> u32 {
1758 u32::from(self)
1759 }
1760
1761 /// Returns the 16 bit Usage ID value of this Usage
1762 fn usage_id_value(&self) -> u16 {
1763 u16::from(self)
1764 }
1765
1766 /// Returns this usage as [Usage::VRControls(self)](Usage::VRControls)
1767 /// This is a convenience function to avoid having
1768 /// to implement `From` for every used type in the caller.
1769 ///
1770 /// ```
1771 /// # use hut::*;
1772 /// let gd_x = GenericDesktop::X;
1773 /// let usage = Usage::from(GenericDesktop::X);
1774 /// assert!(matches!(gd_x.usage(), usage));
1775 /// ```
1776 fn usage(&self) -> Usage {
1777 Usage::from(self)
1778 }
1779 }
1780
1781 impl AsUsagePage for VRControls {
1782 /// Returns the 16 bit value of this UsagePage
1783 ///
1784 /// This value is `0x3` for [VRControls]
1785 fn usage_page_value(&self) -> u16 {
1786 let up = UsagePage::from(self);
1787 u16::from(up)
1788 }
1789
1790 /// Returns [UsagePage::VRControls]]
1791 fn usage_page(&self) -> UsagePage {
1792 UsagePage::from(self)
1793 }
1794 }
1795
1796 impl From<&VRControls> for u16 {
1797 fn from(vrcontrols: &VRControls) -> u16 {
1798 *vrcontrols as u16
1799 }
1800 }
1801
1802 impl From<VRControls> for u16 {
1803 /// Returns the 16bit value of this usage. This is identical
1804 /// to [VRControls::usage_page_value()].
1805 fn from(vrcontrols: VRControls) -> u16 {
1806 u16::from(&vrcontrols)
1807 }
1808 }
1809
1810 impl From<&VRControls> for u32 {
1811 /// Returns the 32 bit value of this usage. This is identical
1812 /// to [VRControls::usage_value()].
1813 fn from(vrcontrols: &VRControls) -> u32 {
1814 let up = UsagePage::from(vrcontrols);
1815 let up = (u16::from(&up) as u32) << 16;
1816 let id = u16::from(vrcontrols) as u32;
1817 up | id
1818 }
1819 }
1820
1821 impl From<&VRControls> for UsagePage {
1822 /// Always returns [UsagePage::VRControls] and is
1823 /// identical to [VRControls::usage_page()].
1824 fn from(_: &VRControls) -> UsagePage {
1825 UsagePage::VRControls
1826 }
1827 }
1828
1829 impl From<VRControls> for UsagePage {
1830 /// Always returns [UsagePage::VRControls] and is
1831 /// identical to [VRControls::usage_page()].
1832 fn from(_: VRControls) -> UsagePage {
1833 UsagePage::VRControls
1834 }
1835 }
1836
1837 impl From<&VRControls> for Usage {
1838 fn from(vrcontrols: &VRControls) -> Usage {
1839 Usage::try_from(u32::from(vrcontrols)).unwrap()
1840 }
1841 }
1842
1843 impl From<VRControls> for Usage {
1844 fn from(vrcontrols: VRControls) -> Usage {
1845 Usage::from(&vrcontrols)
1846 }
1847 }
1848
1849 impl TryFrom<u16> for VRControls {
1850 type Error = HutError;
1851
1852 fn try_from(usage_id: u16) -> Result<VRControls> {
1853 match usage_id {
1854 1 => Ok(VRControls::Belt),
1855 2 => Ok(VRControls::BodySuit),
1856 3 => Ok(VRControls::Flexor),
1857 4 => Ok(VRControls::Glove),
1858 5 => Ok(VRControls::HeadTracker),
1859 6 => Ok(VRControls::HeadMountedDisplay),
1860 7 => Ok(VRControls::HandTracker),
1861 8 => Ok(VRControls::Oculometer),
1862 9 => Ok(VRControls::Vest),
1863 10 => Ok(VRControls::AnimatronicDevice),
1864 32 => Ok(VRControls::StereoEnable),
1865 33 => Ok(VRControls::DisplayEnable),
1866 n => Err(HutError::UnknownUsageId { usage_id: n }),
1867 }
1868 }
1869 }
1870
1871 impl BitOr<u16> for VRControls {
1872 type Output = Usage;
1873
1874 /// A convenience function to combine a Usage Page with
1875 /// a value.
1876 ///
1877 /// This function panics if the Usage ID value results in
1878 /// an unknown Usage. Where error checking is required,
1879 /// use [UsagePage::to_usage_from_value].
1880 fn bitor(self, usage: u16) -> Usage {
1881 let up = u16::from(self) as u32;
1882 let u = usage as u32;
1883 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
1884 }
1885 }
1886
1887 /// *Usage Page `0x4`: "Sport Controls"*
1888 ///
1889 /// **This enum is autogenerated from the HID Usage Tables**.
1890 /// ```
1891 /// # use hut::*;
1892 /// let u1 = Usage::SportControls(SportControls::GolfClub);
1893 /// let u2 = Usage::new_from_page_and_id(0x4, 0x2).unwrap();
1894 /// let u3 = Usage::from(SportControls::GolfClub);
1895 /// let u4: Usage = SportControls::GolfClub.into();
1896 /// assert_eq!(u1, u2);
1897 /// assert_eq!(u1, u3);
1898 /// assert_eq!(u1, u4);
1899 ///
1900 /// assert!(matches!(u1.usage_page(), UsagePage::SportControls));
1901 /// assert_eq!(0x4, u1.usage_page_value());
1902 /// assert_eq!(0x2, u1.usage_id_value());
1903 /// assert_eq!((0x4 << 16) | 0x2, u1.usage_value());
1904 /// assert_eq!("Golf Club", u1.name());
1905 /// ```
1906 ///
1907 #[allow(non_camel_case_types)]
1908 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1909 #[non_exhaustive]
1910 #[repr(u16)]
1911 pub enum SportControls {
1912 /// Usage ID `0x1`: "Baseball Bat"
1913 BaseballBat = 0x1,
1914 /// Usage ID `0x2`: "Golf Club"
1915 GolfClub = 0x2,
1916 /// Usage ID `0x3`: "Rowing Machine"
1917 RowingMachine = 0x3,
1918 /// Usage ID `0x4`: "Treadmill"
1919 Treadmill = 0x4,
1920 /// Usage ID `0x30`: "Oar"
1921 Oar = 0x30,
1922 /// Usage ID `0x31`: "Slope"
1923 Slope = 0x31,
1924 /// Usage ID `0x32`: "Rate"
1925 Rate = 0x32,
1926 /// Usage ID `0x33`: "Stick Speed"
1927 StickSpeed = 0x33,
1928 /// Usage ID `0x34`: "Stick Face Angle"
1929 StickFaceAngle = 0x34,
1930 /// Usage ID `0x35`: "Stick Heel/Toe"
1931 StickHeelToe = 0x35,
1932 /// Usage ID `0x36`: "Stick Follow Through"
1933 StickFollowThrough = 0x36,
1934 /// Usage ID `0x37`: "Stick Tempo"
1935 StickTempo = 0x37,
1936 /// Usage ID `0x38`: "Stick Type"
1937 StickType = 0x38,
1938 /// Usage ID `0x39`: "Stick Height"
1939 StickHeight = 0x39,
1940 /// Usage ID `0x50`: "Putter"
1941 Putter = 0x50,
1942 /// Usage ID `0x51`: "1 Iron"
1943 OneIron = 0x51,
1944 /// Usage ID `0x52`: "2 Iron"
1945 TwoIron = 0x52,
1946 /// Usage ID `0x53`: "3 Iron"
1947 ThreeIron = 0x53,
1948 /// Usage ID `0x54`: "4 Iron"
1949 FourIron = 0x54,
1950 /// Usage ID `0x55`: "5 Iron"
1951 FiveIron = 0x55,
1952 /// Usage ID `0x56`: "6 Iron"
1953 SixIron = 0x56,
1954 /// Usage ID `0x57`: "7 Iron"
1955 SevenIron = 0x57,
1956 /// Usage ID `0x58`: "8 Iron"
1957 EightIron = 0x58,
1958 /// Usage ID `0x59`: "9 Iron"
1959 NineIron = 0x59,
1960 /// Usage ID `0x5A`: "10 Iron"
1961 One0Iron = 0x5A,
1962 /// Usage ID `0x5B`: "11 Iron"
1963 One1Iron = 0x5B,
1964 /// Usage ID `0x5C`: "Sand Wedge"
1965 SandWedge = 0x5C,
1966 /// Usage ID `0x5D`: "Loft Wedge"
1967 LoftWedge = 0x5D,
1968 /// Usage ID `0x5E`: "Power Wedge"
1969 PowerWedge = 0x5E,
1970 /// Usage ID `0x5F`: "1 Wood"
1971 OneWood = 0x5F,
1972 /// Usage ID `0x60`: "3 Wood"
1973 ThreeWood = 0x60,
1974 /// Usage ID `0x61`: "5 Wood"
1975 FiveWood = 0x61,
1976 /// Usage ID `0x62`: "7 Wood"
1977 SevenWood = 0x62,
1978 /// Usage ID `0x63`: "9 Wood"
1979 NineWood = 0x63,
1980 }
1981
1982 impl SportControls {
1983 #[cfg(feature = "std")]
1984 pub fn name(&self) -> String {
1985 match self {
1986 SportControls::BaseballBat => "Baseball Bat",
1987 SportControls::GolfClub => "Golf Club",
1988 SportControls::RowingMachine => "Rowing Machine",
1989 SportControls::Treadmill => "Treadmill",
1990 SportControls::Oar => "Oar",
1991 SportControls::Slope => "Slope",
1992 SportControls::Rate => "Rate",
1993 SportControls::StickSpeed => "Stick Speed",
1994 SportControls::StickFaceAngle => "Stick Face Angle",
1995 SportControls::StickHeelToe => "Stick Heel/Toe",
1996 SportControls::StickFollowThrough => "Stick Follow Through",
1997 SportControls::StickTempo => "Stick Tempo",
1998 SportControls::StickType => "Stick Type",
1999 SportControls::StickHeight => "Stick Height",
2000 SportControls::Putter => "Putter",
2001 SportControls::OneIron => "1 Iron",
2002 SportControls::TwoIron => "2 Iron",
2003 SportControls::ThreeIron => "3 Iron",
2004 SportControls::FourIron => "4 Iron",
2005 SportControls::FiveIron => "5 Iron",
2006 SportControls::SixIron => "6 Iron",
2007 SportControls::SevenIron => "7 Iron",
2008 SportControls::EightIron => "8 Iron",
2009 SportControls::NineIron => "9 Iron",
2010 SportControls::One0Iron => "10 Iron",
2011 SportControls::One1Iron => "11 Iron",
2012 SportControls::SandWedge => "Sand Wedge",
2013 SportControls::LoftWedge => "Loft Wedge",
2014 SportControls::PowerWedge => "Power Wedge",
2015 SportControls::OneWood => "1 Wood",
2016 SportControls::ThreeWood => "3 Wood",
2017 SportControls::FiveWood => "5 Wood",
2018 SportControls::SevenWood => "7 Wood",
2019 SportControls::NineWood => "9 Wood",
2020 }
2021 .into()
2022 }
2023 }
2024
2025 #[cfg(feature = "std")]
2026 impl fmt::Display for SportControls {
2027 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2028 write!(f, "{}", self.name())
2029 }
2030 }
2031
2032 impl AsUsage for SportControls {
2033 /// Returns the 32 bit Usage value of this Usage
2034 fn usage_value(&self) -> u32 {
2035 u32::from(self)
2036 }
2037
2038 /// Returns the 16 bit Usage ID value of this Usage
2039 fn usage_id_value(&self) -> u16 {
2040 u16::from(self)
2041 }
2042
2043 /// Returns this usage as [Usage::SportControls(self)](Usage::SportControls)
2044 /// This is a convenience function to avoid having
2045 /// to implement `From` for every used type in the caller.
2046 ///
2047 /// ```
2048 /// # use hut::*;
2049 /// let gd_x = GenericDesktop::X;
2050 /// let usage = Usage::from(GenericDesktop::X);
2051 /// assert!(matches!(gd_x.usage(), usage));
2052 /// ```
2053 fn usage(&self) -> Usage {
2054 Usage::from(self)
2055 }
2056 }
2057
2058 impl AsUsagePage for SportControls {
2059 /// Returns the 16 bit value of this UsagePage
2060 ///
2061 /// This value is `0x4` for [SportControls]
2062 fn usage_page_value(&self) -> u16 {
2063 let up = UsagePage::from(self);
2064 u16::from(up)
2065 }
2066
2067 /// Returns [UsagePage::SportControls]]
2068 fn usage_page(&self) -> UsagePage {
2069 UsagePage::from(self)
2070 }
2071 }
2072
2073 impl From<&SportControls> for u16 {
2074 fn from(sportcontrols: &SportControls) -> u16 {
2075 *sportcontrols as u16
2076 }
2077 }
2078
2079 impl From<SportControls> for u16 {
2080 /// Returns the 16bit value of this usage. This is identical
2081 /// to [SportControls::usage_page_value()].
2082 fn from(sportcontrols: SportControls) -> u16 {
2083 u16::from(&sportcontrols)
2084 }
2085 }
2086
2087 impl From<&SportControls> for u32 {
2088 /// Returns the 32 bit value of this usage. This is identical
2089 /// to [SportControls::usage_value()].
2090 fn from(sportcontrols: &SportControls) -> u32 {
2091 let up = UsagePage::from(sportcontrols);
2092 let up = (u16::from(&up) as u32) << 16;
2093 let id = u16::from(sportcontrols) as u32;
2094 up | id
2095 }
2096 }
2097
2098 impl From<&SportControls> for UsagePage {
2099 /// Always returns [UsagePage::SportControls] and is
2100 /// identical to [SportControls::usage_page()].
2101 fn from(_: &SportControls) -> UsagePage {
2102 UsagePage::SportControls
2103 }
2104 }
2105
2106 impl From<SportControls> for UsagePage {
2107 /// Always returns [UsagePage::SportControls] and is
2108 /// identical to [SportControls::usage_page()].
2109 fn from(_: SportControls) -> UsagePage {
2110 UsagePage::SportControls
2111 }
2112 }
2113
2114 impl From<&SportControls> for Usage {
2115 fn from(sportcontrols: &SportControls) -> Usage {
2116 Usage::try_from(u32::from(sportcontrols)).unwrap()
2117 }
2118 }
2119
2120 impl From<SportControls> for Usage {
2121 fn from(sportcontrols: SportControls) -> Usage {
2122 Usage::from(&sportcontrols)
2123 }
2124 }
2125
2126 impl TryFrom<u16> for SportControls {
2127 type Error = HutError;
2128
2129 fn try_from(usage_id: u16) -> Result<SportControls> {
2130 match usage_id {
2131 1 => Ok(SportControls::BaseballBat),
2132 2 => Ok(SportControls::GolfClub),
2133 3 => Ok(SportControls::RowingMachine),
2134 4 => Ok(SportControls::Treadmill),
2135 48 => Ok(SportControls::Oar),
2136 49 => Ok(SportControls::Slope),
2137 50 => Ok(SportControls::Rate),
2138 51 => Ok(SportControls::StickSpeed),
2139 52 => Ok(SportControls::StickFaceAngle),
2140 53 => Ok(SportControls::StickHeelToe),
2141 54 => Ok(SportControls::StickFollowThrough),
2142 55 => Ok(SportControls::StickTempo),
2143 56 => Ok(SportControls::StickType),
2144 57 => Ok(SportControls::StickHeight),
2145 80 => Ok(SportControls::Putter),
2146 81 => Ok(SportControls::OneIron),
2147 82 => Ok(SportControls::TwoIron),
2148 83 => Ok(SportControls::ThreeIron),
2149 84 => Ok(SportControls::FourIron),
2150 85 => Ok(SportControls::FiveIron),
2151 86 => Ok(SportControls::SixIron),
2152 87 => Ok(SportControls::SevenIron),
2153 88 => Ok(SportControls::EightIron),
2154 89 => Ok(SportControls::NineIron),
2155 90 => Ok(SportControls::One0Iron),
2156 91 => Ok(SportControls::One1Iron),
2157 92 => Ok(SportControls::SandWedge),
2158 93 => Ok(SportControls::LoftWedge),
2159 94 => Ok(SportControls::PowerWedge),
2160 95 => Ok(SportControls::OneWood),
2161 96 => Ok(SportControls::ThreeWood),
2162 97 => Ok(SportControls::FiveWood),
2163 98 => Ok(SportControls::SevenWood),
2164 99 => Ok(SportControls::NineWood),
2165 n => Err(HutError::UnknownUsageId { usage_id: n }),
2166 }
2167 }
2168 }
2169
2170 impl BitOr<u16> for SportControls {
2171 type Output = Usage;
2172
2173 /// A convenience function to combine a Usage Page with
2174 /// a value.
2175 ///
2176 /// This function panics if the Usage ID value results in
2177 /// an unknown Usage. Where error checking is required,
2178 /// use [UsagePage::to_usage_from_value].
2179 fn bitor(self, usage: u16) -> Usage {
2180 let up = u16::from(self) as u32;
2181 let u = usage as u32;
2182 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
2183 }
2184 }
2185
2186 /// *Usage Page `0x5`: "Game Controls"*
2187 ///
2188 /// **This enum is autogenerated from the HID Usage Tables**.
2189 /// ```
2190 /// # use hut::*;
2191 /// let u1 = Usage::GameControls(GameControls::PinballDevice);
2192 /// let u2 = Usage::new_from_page_and_id(0x5, 0x2).unwrap();
2193 /// let u3 = Usage::from(GameControls::PinballDevice);
2194 /// let u4: Usage = GameControls::PinballDevice.into();
2195 /// assert_eq!(u1, u2);
2196 /// assert_eq!(u1, u3);
2197 /// assert_eq!(u1, u4);
2198 ///
2199 /// assert!(matches!(u1.usage_page(), UsagePage::GameControls));
2200 /// assert_eq!(0x5, u1.usage_page_value());
2201 /// assert_eq!(0x2, u1.usage_id_value());
2202 /// assert_eq!((0x5 << 16) | 0x2, u1.usage_value());
2203 /// assert_eq!("Pinball Device", u1.name());
2204 /// ```
2205 ///
2206 #[allow(non_camel_case_types)]
2207 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2208 #[non_exhaustive]
2209 #[repr(u16)]
2210 pub enum GameControls {
2211 /// Usage ID `0x1`: "3D Game Controller"
2212 ThreeDGameController = 0x1,
2213 /// Usage ID `0x2`: "Pinball Device"
2214 PinballDevice = 0x2,
2215 /// Usage ID `0x3`: "Gun Device"
2216 GunDevice = 0x3,
2217 /// Usage ID `0x20`: "Point of View"
2218 PointofView = 0x20,
2219 /// Usage ID `0x21`: "Turn Right/Left"
2220 TurnRightLeft = 0x21,
2221 /// Usage ID `0x22`: "Pitch Forward/Backward"
2222 PitchForwardBackward = 0x22,
2223 /// Usage ID `0x23`: "Roll Right/Left"
2224 RollRightLeft = 0x23,
2225 /// Usage ID `0x24`: "Move Right/Left"
2226 MoveRightLeft = 0x24,
2227 /// Usage ID `0x25`: "Move Forward/Backward"
2228 MoveForwardBackward = 0x25,
2229 /// Usage ID `0x26`: "Move Up/Down"
2230 MoveUpDown = 0x26,
2231 /// Usage ID `0x27`: "Lean Right/Left"
2232 LeanRightLeft = 0x27,
2233 /// Usage ID `0x28`: "Lean Forward/Backward"
2234 LeanForwardBackward = 0x28,
2235 /// Usage ID `0x29`: "Height of POV"
2236 HeightofPOV = 0x29,
2237 /// Usage ID `0x2A`: "Flipper"
2238 Flipper = 0x2A,
2239 /// Usage ID `0x2B`: "Secondary Flipper"
2240 SecondaryFlipper = 0x2B,
2241 /// Usage ID `0x2C`: "Bump"
2242 Bump = 0x2C,
2243 /// Usage ID `0x2D`: "New Game"
2244 NewGame = 0x2D,
2245 /// Usage ID `0x2E`: "Shoot Ball"
2246 ShootBall = 0x2E,
2247 /// Usage ID `0x2F`: "Player"
2248 Player = 0x2F,
2249 /// Usage ID `0x30`: "Gun Bolt"
2250 GunBolt = 0x30,
2251 /// Usage ID `0x31`: "Gun Clip"
2252 GunClip = 0x31,
2253 /// Usage ID `0x32`: "Gun Selector"
2254 GunSelector = 0x32,
2255 /// Usage ID `0x33`: "Gun Single Shot"
2256 GunSingleShot = 0x33,
2257 /// Usage ID `0x34`: "Gun Burst"
2258 GunBurst = 0x34,
2259 /// Usage ID `0x35`: "Gun Automatic"
2260 GunAutomatic = 0x35,
2261 /// Usage ID `0x36`: "Gun Safety"
2262 GunSafety = 0x36,
2263 /// Usage ID `0x37`: "Gamepad Fire/Jump"
2264 GamepadFireJump = 0x37,
2265 /// Usage ID `0x39`: "Gamepad Trigger"
2266 GamepadTrigger = 0x39,
2267 /// Usage ID `0x3A`: "Form-fitting Gamepad"
2268 FormfittingGamepad = 0x3A,
2269 }
2270
2271 impl GameControls {
2272 #[cfg(feature = "std")]
2273 pub fn name(&self) -> String {
2274 match self {
2275 GameControls::ThreeDGameController => "3D Game Controller",
2276 GameControls::PinballDevice => "Pinball Device",
2277 GameControls::GunDevice => "Gun Device",
2278 GameControls::PointofView => "Point of View",
2279 GameControls::TurnRightLeft => "Turn Right/Left",
2280 GameControls::PitchForwardBackward => "Pitch Forward/Backward",
2281 GameControls::RollRightLeft => "Roll Right/Left",
2282 GameControls::MoveRightLeft => "Move Right/Left",
2283 GameControls::MoveForwardBackward => "Move Forward/Backward",
2284 GameControls::MoveUpDown => "Move Up/Down",
2285 GameControls::LeanRightLeft => "Lean Right/Left",
2286 GameControls::LeanForwardBackward => "Lean Forward/Backward",
2287 GameControls::HeightofPOV => "Height of POV",
2288 GameControls::Flipper => "Flipper",
2289 GameControls::SecondaryFlipper => "Secondary Flipper",
2290 GameControls::Bump => "Bump",
2291 GameControls::NewGame => "New Game",
2292 GameControls::ShootBall => "Shoot Ball",
2293 GameControls::Player => "Player",
2294 GameControls::GunBolt => "Gun Bolt",
2295 GameControls::GunClip => "Gun Clip",
2296 GameControls::GunSelector => "Gun Selector",
2297 GameControls::GunSingleShot => "Gun Single Shot",
2298 GameControls::GunBurst => "Gun Burst",
2299 GameControls::GunAutomatic => "Gun Automatic",
2300 GameControls::GunSafety => "Gun Safety",
2301 GameControls::GamepadFireJump => "Gamepad Fire/Jump",
2302 GameControls::GamepadTrigger => "Gamepad Trigger",
2303 GameControls::FormfittingGamepad => "Form-fitting Gamepad",
2304 }
2305 .into()
2306 }
2307 }
2308
2309 #[cfg(feature = "std")]
2310 impl fmt::Display for GameControls {
2311 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2312 write!(f, "{}", self.name())
2313 }
2314 }
2315
2316 impl AsUsage for GameControls {
2317 /// Returns the 32 bit Usage value of this Usage
2318 fn usage_value(&self) -> u32 {
2319 u32::from(self)
2320 }
2321
2322 /// Returns the 16 bit Usage ID value of this Usage
2323 fn usage_id_value(&self) -> u16 {
2324 u16::from(self)
2325 }
2326
2327 /// Returns this usage as [Usage::GameControls(self)](Usage::GameControls)
2328 /// This is a convenience function to avoid having
2329 /// to implement `From` for every used type in the caller.
2330 ///
2331 /// ```
2332 /// # use hut::*;
2333 /// let gd_x = GenericDesktop::X;
2334 /// let usage = Usage::from(GenericDesktop::X);
2335 /// assert!(matches!(gd_x.usage(), usage));
2336 /// ```
2337 fn usage(&self) -> Usage {
2338 Usage::from(self)
2339 }
2340 }
2341
2342 impl AsUsagePage for GameControls {
2343 /// Returns the 16 bit value of this UsagePage
2344 ///
2345 /// This value is `0x5` for [GameControls]
2346 fn usage_page_value(&self) -> u16 {
2347 let up = UsagePage::from(self);
2348 u16::from(up)
2349 }
2350
2351 /// Returns [UsagePage::GameControls]]
2352 fn usage_page(&self) -> UsagePage {
2353 UsagePage::from(self)
2354 }
2355 }
2356
2357 impl From<&GameControls> for u16 {
2358 fn from(gamecontrols: &GameControls) -> u16 {
2359 *gamecontrols as u16
2360 }
2361 }
2362
2363 impl From<GameControls> for u16 {
2364 /// Returns the 16bit value of this usage. This is identical
2365 /// to [GameControls::usage_page_value()].
2366 fn from(gamecontrols: GameControls) -> u16 {
2367 u16::from(&gamecontrols)
2368 }
2369 }
2370
2371 impl From<&GameControls> for u32 {
2372 /// Returns the 32 bit value of this usage. This is identical
2373 /// to [GameControls::usage_value()].
2374 fn from(gamecontrols: &GameControls) -> u32 {
2375 let up = UsagePage::from(gamecontrols);
2376 let up = (u16::from(&up) as u32) << 16;
2377 let id = u16::from(gamecontrols) as u32;
2378 up | id
2379 }
2380 }
2381
2382 impl From<&GameControls> for UsagePage {
2383 /// Always returns [UsagePage::GameControls] and is
2384 /// identical to [GameControls::usage_page()].
2385 fn from(_: &GameControls) -> UsagePage {
2386 UsagePage::GameControls
2387 }
2388 }
2389
2390 impl From<GameControls> for UsagePage {
2391 /// Always returns [UsagePage::GameControls] and is
2392 /// identical to [GameControls::usage_page()].
2393 fn from(_: GameControls) -> UsagePage {
2394 UsagePage::GameControls
2395 }
2396 }
2397
2398 impl From<&GameControls> for Usage {
2399 fn from(gamecontrols: &GameControls) -> Usage {
2400 Usage::try_from(u32::from(gamecontrols)).unwrap()
2401 }
2402 }
2403
2404 impl From<GameControls> for Usage {
2405 fn from(gamecontrols: GameControls) -> Usage {
2406 Usage::from(&gamecontrols)
2407 }
2408 }
2409
2410 impl TryFrom<u16> for GameControls {
2411 type Error = HutError;
2412
2413 fn try_from(usage_id: u16) -> Result<GameControls> {
2414 match usage_id {
2415 1 => Ok(GameControls::ThreeDGameController),
2416 2 => Ok(GameControls::PinballDevice),
2417 3 => Ok(GameControls::GunDevice),
2418 32 => Ok(GameControls::PointofView),
2419 33 => Ok(GameControls::TurnRightLeft),
2420 34 => Ok(GameControls::PitchForwardBackward),
2421 35 => Ok(GameControls::RollRightLeft),
2422 36 => Ok(GameControls::MoveRightLeft),
2423 37 => Ok(GameControls::MoveForwardBackward),
2424 38 => Ok(GameControls::MoveUpDown),
2425 39 => Ok(GameControls::LeanRightLeft),
2426 40 => Ok(GameControls::LeanForwardBackward),
2427 41 => Ok(GameControls::HeightofPOV),
2428 42 => Ok(GameControls::Flipper),
2429 43 => Ok(GameControls::SecondaryFlipper),
2430 44 => Ok(GameControls::Bump),
2431 45 => Ok(GameControls::NewGame),
2432 46 => Ok(GameControls::ShootBall),
2433 47 => Ok(GameControls::Player),
2434 48 => Ok(GameControls::GunBolt),
2435 49 => Ok(GameControls::GunClip),
2436 50 => Ok(GameControls::GunSelector),
2437 51 => Ok(GameControls::GunSingleShot),
2438 52 => Ok(GameControls::GunBurst),
2439 53 => Ok(GameControls::GunAutomatic),
2440 54 => Ok(GameControls::GunSafety),
2441 55 => Ok(GameControls::GamepadFireJump),
2442 57 => Ok(GameControls::GamepadTrigger),
2443 58 => Ok(GameControls::FormfittingGamepad),
2444 n => Err(HutError::UnknownUsageId { usage_id: n }),
2445 }
2446 }
2447 }
2448
2449 impl BitOr<u16> for GameControls {
2450 type Output = Usage;
2451
2452 /// A convenience function to combine a Usage Page with
2453 /// a value.
2454 ///
2455 /// This function panics if the Usage ID value results in
2456 /// an unknown Usage. Where error checking is required,
2457 /// use [UsagePage::to_usage_from_value].
2458 fn bitor(self, usage: u16) -> Usage {
2459 let up = u16::from(self) as u32;
2460 let u = usage as u32;
2461 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
2462 }
2463 }
2464
2465 /// *Usage Page `0x6`: "Generic Device Controls"*
2466 ///
2467 /// **This enum is autogenerated from the HID Usage Tables**.
2468 /// ```
2469 /// # use hut::*;
2470 /// let u1 = Usage::GenericDeviceControls(GenericDeviceControls::BatteryStrength);
2471 /// let u2 = Usage::new_from_page_and_id(0x6, 0x20).unwrap();
2472 /// let u3 = Usage::from(GenericDeviceControls::BatteryStrength);
2473 /// let u4: Usage = GenericDeviceControls::BatteryStrength.into();
2474 /// assert_eq!(u1, u2);
2475 /// assert_eq!(u1, u3);
2476 /// assert_eq!(u1, u4);
2477 ///
2478 /// assert!(matches!(u1.usage_page(), UsagePage::GenericDeviceControls));
2479 /// assert_eq!(0x6, u1.usage_page_value());
2480 /// assert_eq!(0x20, u1.usage_id_value());
2481 /// assert_eq!((0x6 << 16) | 0x20, u1.usage_value());
2482 /// assert_eq!("Battery Strength", u1.name());
2483 /// ```
2484 ///
2485 #[allow(non_camel_case_types)]
2486 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2487 #[non_exhaustive]
2488 #[repr(u16)]
2489 pub enum GenericDeviceControls {
2490 /// Usage ID `0x1`: "Background/Nonuser Controls"
2491 BackgroundNonuserControls = 0x1,
2492 /// Usage ID `0x20`: "Battery Strength"
2493 BatteryStrength = 0x20,
2494 /// Usage ID `0x21`: "Wireless Channel"
2495 WirelessChannel = 0x21,
2496 /// Usage ID `0x22`: "Wireless ID"
2497 WirelessID = 0x22,
2498 /// Usage ID `0x23`: "Discover Wireless Control"
2499 DiscoverWirelessControl = 0x23,
2500 /// Usage ID `0x24`: "Security Code Character Entered"
2501 SecurityCodeCharacterEntered = 0x24,
2502 /// Usage ID `0x25`: "Security Code Character Erased"
2503 SecurityCodeCharacterErased = 0x25,
2504 /// Usage ID `0x26`: "Security Code Cleared"
2505 SecurityCodeCleared = 0x26,
2506 /// Usage ID `0x27`: "Sequence ID"
2507 SequenceID = 0x27,
2508 /// Usage ID `0x28`: "Sequence ID Reset"
2509 SequenceIDReset = 0x28,
2510 /// Usage ID `0x29`: "RF Signal Strength"
2511 RFSignalStrength = 0x29,
2512 /// Usage ID `0x2A`: "Software Version"
2513 SoftwareVersion = 0x2A,
2514 /// Usage ID `0x2B`: "Protocol Version"
2515 ProtocolVersion = 0x2B,
2516 /// Usage ID `0x2C`: "Hardware Version"
2517 HardwareVersion = 0x2C,
2518 /// Usage ID `0x2D`: "Major"
2519 Major = 0x2D,
2520 /// Usage ID `0x2E`: "Minor"
2521 Minor = 0x2E,
2522 /// Usage ID `0x2F`: "Revision"
2523 Revision = 0x2F,
2524 /// Usage ID `0x30`: "Handedness"
2525 Handedness = 0x30,
2526 /// Usage ID `0x31`: "Either Hand"
2527 EitherHand = 0x31,
2528 /// Usage ID `0x32`: "Left Hand"
2529 LeftHand = 0x32,
2530 /// Usage ID `0x33`: "Right Hand"
2531 RightHand = 0x33,
2532 /// Usage ID `0x34`: "Both Hands"
2533 BothHands = 0x34,
2534 /// Usage ID `0x40`: "Grip Pose Offset"
2535 GripPoseOffset = 0x40,
2536 /// Usage ID `0x41`: "Pointer Pose Offset"
2537 PointerPoseOffset = 0x41,
2538 }
2539
2540 impl GenericDeviceControls {
2541 #[cfg(feature = "std")]
2542 pub fn name(&self) -> String {
2543 match self {
2544 GenericDeviceControls::BackgroundNonuserControls => "Background/Nonuser Controls",
2545 GenericDeviceControls::BatteryStrength => "Battery Strength",
2546 GenericDeviceControls::WirelessChannel => "Wireless Channel",
2547 GenericDeviceControls::WirelessID => "Wireless ID",
2548 GenericDeviceControls::DiscoverWirelessControl => "Discover Wireless Control",
2549 GenericDeviceControls::SecurityCodeCharacterEntered => {
2550 "Security Code Character Entered"
2551 }
2552 GenericDeviceControls::SecurityCodeCharacterErased => "Security Code Character Erased",
2553 GenericDeviceControls::SecurityCodeCleared => "Security Code Cleared",
2554 GenericDeviceControls::SequenceID => "Sequence ID",
2555 GenericDeviceControls::SequenceIDReset => "Sequence ID Reset",
2556 GenericDeviceControls::RFSignalStrength => "RF Signal Strength",
2557 GenericDeviceControls::SoftwareVersion => "Software Version",
2558 GenericDeviceControls::ProtocolVersion => "Protocol Version",
2559 GenericDeviceControls::HardwareVersion => "Hardware Version",
2560 GenericDeviceControls::Major => "Major",
2561 GenericDeviceControls::Minor => "Minor",
2562 GenericDeviceControls::Revision => "Revision",
2563 GenericDeviceControls::Handedness => "Handedness",
2564 GenericDeviceControls::EitherHand => "Either Hand",
2565 GenericDeviceControls::LeftHand => "Left Hand",
2566 GenericDeviceControls::RightHand => "Right Hand",
2567 GenericDeviceControls::BothHands => "Both Hands",
2568 GenericDeviceControls::GripPoseOffset => "Grip Pose Offset",
2569 GenericDeviceControls::PointerPoseOffset => "Pointer Pose Offset",
2570 }
2571 .into()
2572 }
2573 }
2574
2575 #[cfg(feature = "std")]
2576 impl fmt::Display for GenericDeviceControls {
2577 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2578 write!(f, "{}", self.name())
2579 }
2580 }
2581
2582 impl AsUsage for GenericDeviceControls {
2583 /// Returns the 32 bit Usage value of this Usage
2584 fn usage_value(&self) -> u32 {
2585 u32::from(self)
2586 }
2587
2588 /// Returns the 16 bit Usage ID value of this Usage
2589 fn usage_id_value(&self) -> u16 {
2590 u16::from(self)
2591 }
2592
2593 /// Returns this usage as [Usage::GenericDeviceControls(self)](Usage::GenericDeviceControls)
2594 /// This is a convenience function to avoid having
2595 /// to implement `From` for every used type in the caller.
2596 ///
2597 /// ```
2598 /// # use hut::*;
2599 /// let gd_x = GenericDesktop::X;
2600 /// let usage = Usage::from(GenericDesktop::X);
2601 /// assert!(matches!(gd_x.usage(), usage));
2602 /// ```
2603 fn usage(&self) -> Usage {
2604 Usage::from(self)
2605 }
2606 }
2607
2608 impl AsUsagePage for GenericDeviceControls {
2609 /// Returns the 16 bit value of this UsagePage
2610 ///
2611 /// This value is `0x6` for [GenericDeviceControls]
2612 fn usage_page_value(&self) -> u16 {
2613 let up = UsagePage::from(self);
2614 u16::from(up)
2615 }
2616
2617 /// Returns [UsagePage::GenericDeviceControls]]
2618 fn usage_page(&self) -> UsagePage {
2619 UsagePage::from(self)
2620 }
2621 }
2622
2623 impl From<&GenericDeviceControls> for u16 {
2624 fn from(genericdevicecontrols: &GenericDeviceControls) -> u16 {
2625 *genericdevicecontrols as u16
2626 }
2627 }
2628
2629 impl From<GenericDeviceControls> for u16 {
2630 /// Returns the 16bit value of this usage. This is identical
2631 /// to [GenericDeviceControls::usage_page_value()].
2632 fn from(genericdevicecontrols: GenericDeviceControls) -> u16 {
2633 u16::from(&genericdevicecontrols)
2634 }
2635 }
2636
2637 impl From<&GenericDeviceControls> for u32 {
2638 /// Returns the 32 bit value of this usage. This is identical
2639 /// to [GenericDeviceControls::usage_value()].
2640 fn from(genericdevicecontrols: &GenericDeviceControls) -> u32 {
2641 let up = UsagePage::from(genericdevicecontrols);
2642 let up = (u16::from(&up) as u32) << 16;
2643 let id = u16::from(genericdevicecontrols) as u32;
2644 up | id
2645 }
2646 }
2647
2648 impl From<&GenericDeviceControls> for UsagePage {
2649 /// Always returns [UsagePage::GenericDeviceControls] and is
2650 /// identical to [GenericDeviceControls::usage_page()].
2651 fn from(_: &GenericDeviceControls) -> UsagePage {
2652 UsagePage::GenericDeviceControls
2653 }
2654 }
2655
2656 impl From<GenericDeviceControls> for UsagePage {
2657 /// Always returns [UsagePage::GenericDeviceControls] and is
2658 /// identical to [GenericDeviceControls::usage_page()].
2659 fn from(_: GenericDeviceControls) -> UsagePage {
2660 UsagePage::GenericDeviceControls
2661 }
2662 }
2663
2664 impl From<&GenericDeviceControls> for Usage {
2665 fn from(genericdevicecontrols: &GenericDeviceControls) -> Usage {
2666 Usage::try_from(u32::from(genericdevicecontrols)).unwrap()
2667 }
2668 }
2669
2670 impl From<GenericDeviceControls> for Usage {
2671 fn from(genericdevicecontrols: GenericDeviceControls) -> Usage {
2672 Usage::from(&genericdevicecontrols)
2673 }
2674 }
2675
2676 impl TryFrom<u16> for GenericDeviceControls {
2677 type Error = HutError;
2678
2679 fn try_from(usage_id: u16) -> Result<GenericDeviceControls> {
2680 match usage_id {
2681 1 => Ok(GenericDeviceControls::BackgroundNonuserControls),
2682 32 => Ok(GenericDeviceControls::BatteryStrength),
2683 33 => Ok(GenericDeviceControls::WirelessChannel),
2684 34 => Ok(GenericDeviceControls::WirelessID),
2685 35 => Ok(GenericDeviceControls::DiscoverWirelessControl),
2686 36 => Ok(GenericDeviceControls::SecurityCodeCharacterEntered),
2687 37 => Ok(GenericDeviceControls::SecurityCodeCharacterErased),
2688 38 => Ok(GenericDeviceControls::SecurityCodeCleared),
2689 39 => Ok(GenericDeviceControls::SequenceID),
2690 40 => Ok(GenericDeviceControls::SequenceIDReset),
2691 41 => Ok(GenericDeviceControls::RFSignalStrength),
2692 42 => Ok(GenericDeviceControls::SoftwareVersion),
2693 43 => Ok(GenericDeviceControls::ProtocolVersion),
2694 44 => Ok(GenericDeviceControls::HardwareVersion),
2695 45 => Ok(GenericDeviceControls::Major),
2696 46 => Ok(GenericDeviceControls::Minor),
2697 47 => Ok(GenericDeviceControls::Revision),
2698 48 => Ok(GenericDeviceControls::Handedness),
2699 49 => Ok(GenericDeviceControls::EitherHand),
2700 50 => Ok(GenericDeviceControls::LeftHand),
2701 51 => Ok(GenericDeviceControls::RightHand),
2702 52 => Ok(GenericDeviceControls::BothHands),
2703 64 => Ok(GenericDeviceControls::GripPoseOffset),
2704 65 => Ok(GenericDeviceControls::PointerPoseOffset),
2705 n => Err(HutError::UnknownUsageId { usage_id: n }),
2706 }
2707 }
2708 }
2709
2710 impl BitOr<u16> for GenericDeviceControls {
2711 type Output = Usage;
2712
2713 /// A convenience function to combine a Usage Page with
2714 /// a value.
2715 ///
2716 /// This function panics if the Usage ID value results in
2717 /// an unknown Usage. Where error checking is required,
2718 /// use [UsagePage::to_usage_from_value].
2719 fn bitor(self, usage: u16) -> Usage {
2720 let up = u16::from(self) as u32;
2721 let u = usage as u32;
2722 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
2723 }
2724 }
2725
2726 /// *Usage Page `0x7`: "Keyboard/Keypad"*
2727 ///
2728 /// **This enum is autogenerated from the HID Usage Tables**.
2729 /// ```
2730 /// # use hut::*;
2731 /// let u1 = Usage::KeyboardKeypad(KeyboardKeypad::POSTFail);
2732 /// let u2 = Usage::new_from_page_and_id(0x7, 0x2).unwrap();
2733 /// let u3 = Usage::from(KeyboardKeypad::POSTFail);
2734 /// let u4: Usage = KeyboardKeypad::POSTFail.into();
2735 /// assert_eq!(u1, u2);
2736 /// assert_eq!(u1, u3);
2737 /// assert_eq!(u1, u4);
2738 ///
2739 /// assert!(matches!(u1.usage_page(), UsagePage::KeyboardKeypad));
2740 /// assert_eq!(0x7, u1.usage_page_value());
2741 /// assert_eq!(0x2, u1.usage_id_value());
2742 /// assert_eq!((0x7 << 16) | 0x2, u1.usage_value());
2743 /// assert_eq!("POSTFail", u1.name());
2744 /// ```
2745 ///
2746 #[allow(non_camel_case_types)]
2747 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2748 #[non_exhaustive]
2749 #[repr(u16)]
2750 pub enum KeyboardKeypad {
2751 /// Usage ID `0x1`: "ErrorRollOver"
2752 ErrorRollOver = 0x1,
2753 /// Usage ID `0x2`: "POSTFail"
2754 POSTFail = 0x2,
2755 /// Usage ID `0x3`: "ErrorUndefined"
2756 ErrorUndefined = 0x3,
2757 /// Usage ID `0x4`: "Keyboard A"
2758 KeyboardA = 0x4,
2759 /// Usage ID `0x5`: "Keyboard B"
2760 KeyboardB = 0x5,
2761 /// Usage ID `0x6`: "Keyboard C"
2762 KeyboardC = 0x6,
2763 /// Usage ID `0x7`: "Keyboard D"
2764 KeyboardD = 0x7,
2765 /// Usage ID `0x8`: "Keyboard E"
2766 KeyboardE = 0x8,
2767 /// Usage ID `0x9`: "Keyboard F"
2768 KeyboardF = 0x9,
2769 /// Usage ID `0xA`: "Keyboard G"
2770 KeyboardG = 0xA,
2771 /// Usage ID `0xB`: "Keyboard H"
2772 KeyboardH = 0xB,
2773 /// Usage ID `0xC`: "Keyboard I"
2774 KeyboardI = 0xC,
2775 /// Usage ID `0xD`: "Keyboard J"
2776 KeyboardJ = 0xD,
2777 /// Usage ID `0xE`: "Keyboard K"
2778 KeyboardK = 0xE,
2779 /// Usage ID `0xF`: "Keyboard L"
2780 KeyboardL = 0xF,
2781 /// Usage ID `0x10`: "Keyboard M"
2782 KeyboardM = 0x10,
2783 /// Usage ID `0x11`: "Keyboard N"
2784 KeyboardN = 0x11,
2785 /// Usage ID `0x12`: "Keyboard O"
2786 KeyboardO = 0x12,
2787 /// Usage ID `0x13`: "Keyboard P"
2788 KeyboardP = 0x13,
2789 /// Usage ID `0x14`: "Keyboard Q"
2790 KeyboardQ = 0x14,
2791 /// Usage ID `0x15`: "Keyboard R"
2792 KeyboardR = 0x15,
2793 /// Usage ID `0x16`: "Keyboard S"
2794 KeyboardS = 0x16,
2795 /// Usage ID `0x17`: "Keyboard T"
2796 KeyboardT = 0x17,
2797 /// Usage ID `0x18`: "Keyboard U"
2798 KeyboardU = 0x18,
2799 /// Usage ID `0x19`: "Keyboard V"
2800 KeyboardV = 0x19,
2801 /// Usage ID `0x1A`: "Keyboard W"
2802 KeyboardW = 0x1A,
2803 /// Usage ID `0x1B`: "Keyboard X"
2804 KeyboardX = 0x1B,
2805 /// Usage ID `0x1C`: "Keyboard Y"
2806 KeyboardY = 0x1C,
2807 /// Usage ID `0x1D`: "Keyboard Z"
2808 KeyboardZ = 0x1D,
2809 /// Usage ID `0x1E`: "Keyboard 1 and Bang"
2810 Keyboard1andBang = 0x1E,
2811 /// Usage ID `0x1F`: "Keyboard 2 and At"
2812 Keyboard2andAt = 0x1F,
2813 /// Usage ID `0x20`: "Keyboard 3 and Hash"
2814 Keyboard3andHash = 0x20,
2815 /// Usage ID `0x21`: "Keyboard 4 and Dollar"
2816 Keyboard4andDollar = 0x21,
2817 /// Usage ID `0x22`: "Keyboard 5 and Percent"
2818 Keyboard5andPercent = 0x22,
2819 /// Usage ID `0x23`: "Keyboard 6 and Caret"
2820 Keyboard6andCaret = 0x23,
2821 /// Usage ID `0x24`: "Keyboard 7 and Ampersand"
2822 Keyboard7andAmpersand = 0x24,
2823 /// Usage ID `0x25`: "Keyboard 8 and Star"
2824 Keyboard8andStar = 0x25,
2825 /// Usage ID `0x26`: "Keyboard 9 and Left Bracket"
2826 Keyboard9andLeftBracket = 0x26,
2827 /// Usage ID `0x27`: "Keyboard 0 and Right Bracket"
2828 Keyboard0andRightBracket = 0x27,
2829 /// Usage ID `0x28`: "Keyboard Return Enter"
2830 KeyboardReturnEnter = 0x28,
2831 /// Usage ID `0x29`: "Keyboard Escape"
2832 KeyboardEscape = 0x29,
2833 /// Usage ID `0x2A`: "Keyboard Delete"
2834 KeyboardDelete = 0x2A,
2835 /// Usage ID `0x2B`: "Keyboard Tab"
2836 KeyboardTab = 0x2B,
2837 /// Usage ID `0x2C`: "Keyboard Spacebar"
2838 KeyboardSpacebar = 0x2C,
2839 /// Usage ID `0x2D`: "Keyboard Dash and Underscore"
2840 KeyboardDashandUnderscore = 0x2D,
2841 /// Usage ID `0x2E`: "Keyboard Equals and Plus"
2842 KeyboardEqualsandPlus = 0x2E,
2843 /// Usage ID `0x2F`: "Keyboard Left Brace"
2844 KeyboardLeftBrace = 0x2F,
2845 /// Usage ID `0x30`: "Keyboard Right Brace"
2846 KeyboardRightBrace = 0x30,
2847 /// Usage ID `0x31`: "Keyboard Backslash and Pipe"
2848 KeyboardBackslashandPipe = 0x31,
2849 /// Usage ID `0x32`: "Keyboard Non-US Hash and Tilde"
2850 KeyboardNonUSHashandTilde = 0x32,
2851 /// Usage ID `0x33`: "Keyboard SemiColon and Colon"
2852 KeyboardSemiColonandColon = 0x33,
2853 /// Usage ID `0x34`: "Keyboard Left Apos and Double"
2854 KeyboardLeftAposandDouble = 0x34,
2855 /// Usage ID `0x35`: "Keyboard Grave Accent and Tilde"
2856 KeyboardGraveAccentandTilde = 0x35,
2857 /// Usage ID `0x36`: "Keyboard Comma and LessThan"
2858 KeyboardCommaandLessThan = 0x36,
2859 /// Usage ID `0x37`: "Keyboard Period and GreaterThan"
2860 KeyboardPeriodandGreaterThan = 0x37,
2861 /// Usage ID `0x38`: "Keyboard ForwardSlash and QuestionMark"
2862 KeyboardForwardSlashandQuestionMark = 0x38,
2863 /// Usage ID `0x39`: "Keyboard Caps Lock"
2864 KeyboardCapsLock = 0x39,
2865 /// Usage ID `0x3A`: "Keyboard F1"
2866 KeyboardF1 = 0x3A,
2867 /// Usage ID `0x3B`: "Keyboard F2"
2868 KeyboardF2 = 0x3B,
2869 /// Usage ID `0x3C`: "Keyboard F3"
2870 KeyboardF3 = 0x3C,
2871 /// Usage ID `0x3D`: "Keyboard F4"
2872 KeyboardF4 = 0x3D,
2873 /// Usage ID `0x3E`: "Keyboard F5"
2874 KeyboardF5 = 0x3E,
2875 /// Usage ID `0x3F`: "Keyboard F6"
2876 KeyboardF6 = 0x3F,
2877 /// Usage ID `0x40`: "Keyboard F7"
2878 KeyboardF7 = 0x40,
2879 /// Usage ID `0x41`: "Keyboard F8"
2880 KeyboardF8 = 0x41,
2881 /// Usage ID `0x42`: "Keyboard F9"
2882 KeyboardF9 = 0x42,
2883 /// Usage ID `0x43`: "Keyboard F10"
2884 KeyboardF10 = 0x43,
2885 /// Usage ID `0x44`: "Keyboard F11"
2886 KeyboardF11 = 0x44,
2887 /// Usage ID `0x45`: "Keyboard F12"
2888 KeyboardF12 = 0x45,
2889 /// Usage ID `0x46`: "Keyboard PrintScreen"
2890 KeyboardPrintScreen = 0x46,
2891 /// Usage ID `0x47`: "Keyboard Scroll Lock"
2892 KeyboardScrollLock = 0x47,
2893 /// Usage ID `0x48`: "Keyboard Pause"
2894 KeyboardPause = 0x48,
2895 /// Usage ID `0x49`: "Keyboard Insert"
2896 KeyboardInsert = 0x49,
2897 /// Usage ID `0x4A`: "Keyboard Home"
2898 KeyboardHome = 0x4A,
2899 /// Usage ID `0x4B`: "Keyboard PageUp"
2900 KeyboardPageUp = 0x4B,
2901 /// Usage ID `0x4C`: "Keyboard Delete Forward"
2902 KeyboardDeleteForward = 0x4C,
2903 /// Usage ID `0x4D`: "Keyboard End"
2904 KeyboardEnd = 0x4D,
2905 /// Usage ID `0x4E`: "Keyboard PageDown"
2906 KeyboardPageDown = 0x4E,
2907 /// Usage ID `0x4F`: "Keyboard RightArrow"
2908 KeyboardRightArrow = 0x4F,
2909 /// Usage ID `0x50`: "Keyboard LeftArrow"
2910 KeyboardLeftArrow = 0x50,
2911 /// Usage ID `0x51`: "Keyboard DownArrow"
2912 KeyboardDownArrow = 0x51,
2913 /// Usage ID `0x52`: "Keyboard UpArrow"
2914 KeyboardUpArrow = 0x52,
2915 /// Usage ID `0x53`: "Keypad Num Lock and Clear"
2916 KeypadNumLockandClear = 0x53,
2917 /// Usage ID `0x54`: "Keypad ForwardSlash"
2918 KeypadForwardSlash = 0x54,
2919 /// Usage ID `0x55`: "Keypad Star"
2920 KeypadStar = 0x55,
2921 /// Usage ID `0x56`: "Keypad Dash"
2922 KeypadDash = 0x56,
2923 /// Usage ID `0x57`: "Keypad Plus"
2924 KeypadPlus = 0x57,
2925 /// Usage ID `0x58`: "Keypad ENTER"
2926 KeypadENTER = 0x58,
2927 /// Usage ID `0x59`: "Keypad 1 and End"
2928 Keypad1andEnd = 0x59,
2929 /// Usage ID `0x5A`: "Keypad 2 and Down Arrow"
2930 Keypad2andDownArrow = 0x5A,
2931 /// Usage ID `0x5B`: "Keypad 3 and PageDn"
2932 Keypad3andPageDn = 0x5B,
2933 /// Usage ID `0x5C`: "Keypad 4 and Left Arrow"
2934 Keypad4andLeftArrow = 0x5C,
2935 /// Usage ID `0x5D`: "Keypad 5"
2936 Keypad5 = 0x5D,
2937 /// Usage ID `0x5E`: "Keypad 6 and Right Arrow"
2938 Keypad6andRightArrow = 0x5E,
2939 /// Usage ID `0x5F`: "Keypad 7 and Home"
2940 Keypad7andHome = 0x5F,
2941 /// Usage ID `0x60`: "Keypad 8 and Up Arrow"
2942 Keypad8andUpArrow = 0x60,
2943 /// Usage ID `0x61`: "Keypad 9 and PageUp"
2944 Keypad9andPageUp = 0x61,
2945 /// Usage ID `0x62`: "Keypad 0 and Insert"
2946 Keypad0andInsert = 0x62,
2947 /// Usage ID `0x63`: "Keypad Period and Delete"
2948 KeypadPeriodandDelete = 0x63,
2949 /// Usage ID `0x64`: "Keyboard Non-US Backslash and Pipe"
2950 KeyboardNonUSBackslashandPipe = 0x64,
2951 /// Usage ID `0x65`: "Keyboard Application"
2952 KeyboardApplication = 0x65,
2953 /// Usage ID `0x66`: "Keyboard Power"
2954 KeyboardPower = 0x66,
2955 /// Usage ID `0x67`: "Keypad Equals"
2956 KeypadEquals = 0x67,
2957 /// Usage ID `0x68`: "Keyboard F13"
2958 KeyboardF13 = 0x68,
2959 /// Usage ID `0x69`: "Keyboard F14"
2960 KeyboardF14 = 0x69,
2961 /// Usage ID `0x6A`: "Keyboard F15"
2962 KeyboardF15 = 0x6A,
2963 /// Usage ID `0x6B`: "Keyboard F16"
2964 KeyboardF16 = 0x6B,
2965 /// Usage ID `0x6C`: "Keyboard F17"
2966 KeyboardF17 = 0x6C,
2967 /// Usage ID `0x6D`: "Keyboard F18"
2968 KeyboardF18 = 0x6D,
2969 /// Usage ID `0x6E`: "Keyboard F19"
2970 KeyboardF19 = 0x6E,
2971 /// Usage ID `0x6F`: "Keyboard F20"
2972 KeyboardF20 = 0x6F,
2973 /// Usage ID `0x70`: "Keyboard F21"
2974 KeyboardF21 = 0x70,
2975 /// Usage ID `0x71`: "Keyboard F22"
2976 KeyboardF22 = 0x71,
2977 /// Usage ID `0x72`: "Keyboard F23"
2978 KeyboardF23 = 0x72,
2979 /// Usage ID `0x73`: "Keyboard F24"
2980 KeyboardF24 = 0x73,
2981 /// Usage ID `0x74`: "Keyboard Execute"
2982 KeyboardExecute = 0x74,
2983 /// Usage ID `0x75`: "Keyboard Help"
2984 KeyboardHelp = 0x75,
2985 /// Usage ID `0x76`: "Keyboard Menu"
2986 KeyboardMenu = 0x76,
2987 /// Usage ID `0x77`: "Keyboard Select"
2988 KeyboardSelect = 0x77,
2989 /// Usage ID `0x78`: "Keyboard Stop"
2990 KeyboardStop = 0x78,
2991 /// Usage ID `0x79`: "Keyboard Again"
2992 KeyboardAgain = 0x79,
2993 /// Usage ID `0x7A`: "Keyboard Undo"
2994 KeyboardUndo = 0x7A,
2995 /// Usage ID `0x7B`: "Keyboard Cut"
2996 KeyboardCut = 0x7B,
2997 /// Usage ID `0x7C`: "Keyboard Copy"
2998 KeyboardCopy = 0x7C,
2999 /// Usage ID `0x7D`: "Keyboard Paste"
3000 KeyboardPaste = 0x7D,
3001 /// Usage ID `0x7E`: "Keyboard Find"
3002 KeyboardFind = 0x7E,
3003 /// Usage ID `0x7F`: "Keyboard Mute"
3004 KeyboardMute = 0x7F,
3005 /// Usage ID `0x80`: "Keyboard Volume Up"
3006 KeyboardVolumeUp = 0x80,
3007 /// Usage ID `0x81`: "Keyboard Volume Down"
3008 KeyboardVolumeDown = 0x81,
3009 /// Usage ID `0x82`: "Keyboard Locking Caps Lock"
3010 KeyboardLockingCapsLock = 0x82,
3011 /// Usage ID `0x83`: "Keyboard Locking Num Lock"
3012 KeyboardLockingNumLock = 0x83,
3013 /// Usage ID `0x84`: "Keyboard Locking Scroll Lock"
3014 KeyboardLockingScrollLock = 0x84,
3015 /// Usage ID `0x85`: "Keypad Comma"
3016 KeypadComma = 0x85,
3017 /// Usage ID `0x86`: "Keypad Equal Sign"
3018 KeypadEqualSign = 0x86,
3019 /// Usage ID `0x87`: "Keyboard International1"
3020 KeyboardInternational1 = 0x87,
3021 /// Usage ID `0x88`: "Keyboard International2"
3022 KeyboardInternational2 = 0x88,
3023 /// Usage ID `0x89`: "Keyboard International3"
3024 KeyboardInternational3 = 0x89,
3025 /// Usage ID `0x8A`: "Keyboard International4"
3026 KeyboardInternational4 = 0x8A,
3027 /// Usage ID `0x8B`: "Keyboard International5"
3028 KeyboardInternational5 = 0x8B,
3029 /// Usage ID `0x8C`: "Keyboard International6"
3030 KeyboardInternational6 = 0x8C,
3031 /// Usage ID `0x8D`: "Keyboard International7"
3032 KeyboardInternational7 = 0x8D,
3033 /// Usage ID `0x8E`: "Keyboard International8"
3034 KeyboardInternational8 = 0x8E,
3035 /// Usage ID `0x8F`: "Keyboard International9"
3036 KeyboardInternational9 = 0x8F,
3037 /// Usage ID `0x90`: "Keyboard LANG1"
3038 KeyboardLANG1 = 0x90,
3039 /// Usage ID `0x91`: "Keyboard LANG2"
3040 KeyboardLANG2 = 0x91,
3041 /// Usage ID `0x92`: "Keyboard LANG3"
3042 KeyboardLANG3 = 0x92,
3043 /// Usage ID `0x93`: "Keyboard LANG4"
3044 KeyboardLANG4 = 0x93,
3045 /// Usage ID `0x94`: "Keyboard LANG5"
3046 KeyboardLANG5 = 0x94,
3047 /// Usage ID `0x95`: "Keyboard LANG6"
3048 KeyboardLANG6 = 0x95,
3049 /// Usage ID `0x96`: "Keyboard LANG7"
3050 KeyboardLANG7 = 0x96,
3051 /// Usage ID `0x97`: "Keyboard LANG8"
3052 KeyboardLANG8 = 0x97,
3053 /// Usage ID `0x98`: "Keyboard LANG9"
3054 KeyboardLANG9 = 0x98,
3055 /// Usage ID `0x99`: "Keyboard Alternate Erase"
3056 KeyboardAlternateErase = 0x99,
3057 /// Usage ID `0x9A`: "Keyboard SysReq Attention"
3058 KeyboardSysReqAttention = 0x9A,
3059 /// Usage ID `0x9B`: "Keyboard Cancel"
3060 KeyboardCancel = 0x9B,
3061 /// Usage ID `0x9C`: "Keyboard Clear"
3062 KeyboardClear = 0x9C,
3063 /// Usage ID `0x9D`: "Keyboard Prior"
3064 KeyboardPrior = 0x9D,
3065 /// Usage ID `0x9E`: "Keyboard Return"
3066 KeyboardReturn = 0x9E,
3067 /// Usage ID `0x9F`: "Keyboard Separator"
3068 KeyboardSeparator = 0x9F,
3069 /// Usage ID `0xA0`: "Keyboard Out"
3070 KeyboardOut = 0xA0,
3071 /// Usage ID `0xA1`: "Keyboard Oper"
3072 KeyboardOper = 0xA1,
3073 /// Usage ID `0xA2`: "Keyboard Clear Again"
3074 KeyboardClearAgain = 0xA2,
3075 /// Usage ID `0xA3`: "Keyboard CrSel Props"
3076 KeyboardCrSelProps = 0xA3,
3077 /// Usage ID `0xA4`: "Keyboard ExSel"
3078 KeyboardExSel = 0xA4,
3079 /// Usage ID `0xB0`: "Keypad Double 0"
3080 KeypadDouble0 = 0xB0,
3081 /// Usage ID `0xB1`: "Keypad Triple 0"
3082 KeypadTriple0 = 0xB1,
3083 /// Usage ID `0xB2`: "Thousands Separator"
3084 ThousandsSeparator = 0xB2,
3085 /// Usage ID `0xB3`: "Decimal Separator"
3086 DecimalSeparator = 0xB3,
3087 /// Usage ID `0xB4`: "Currency Unit"
3088 CurrencyUnit = 0xB4,
3089 /// Usage ID `0xB5`: "Currency Sub-unit"
3090 CurrencySubunit = 0xB5,
3091 /// Usage ID `0xB6`: "Keypad Left Bracket"
3092 KeypadLeftBracket = 0xB6,
3093 /// Usage ID `0xB7`: "Keypad Right Bracket"
3094 KeypadRightBracket = 0xB7,
3095 /// Usage ID `0xB8`: "Keypad Left Brace"
3096 KeypadLeftBrace = 0xB8,
3097 /// Usage ID `0xB9`: "Keypad Right Brace"
3098 KeypadRightBrace = 0xB9,
3099 /// Usage ID `0xBA`: "Keypad Tab"
3100 KeypadTab = 0xBA,
3101 /// Usage ID `0xBB`: "Keypad Backspace"
3102 KeypadBackspace = 0xBB,
3103 /// Usage ID `0xBC`: "Keypad A"
3104 KeypadA = 0xBC,
3105 /// Usage ID `0xBD`: "Keypad B"
3106 KeypadB = 0xBD,
3107 /// Usage ID `0xBE`: "Keypad C"
3108 KeypadC = 0xBE,
3109 /// Usage ID `0xBF`: "Keypad D"
3110 KeypadD = 0xBF,
3111 /// Usage ID `0xC0`: "Keypad E"
3112 KeypadE = 0xC0,
3113 /// Usage ID `0xC1`: "Keypad F"
3114 KeypadF = 0xC1,
3115 /// Usage ID `0xC2`: "Keypad XOR"
3116 KeypadXOR = 0xC2,
3117 /// Usage ID `0xC3`: "Keypad Caret"
3118 KeypadCaret = 0xC3,
3119 /// Usage ID `0xC4`: "Keypad Percentage"
3120 KeypadPercentage = 0xC4,
3121 /// Usage ID `0xC5`: "Keypad Less"
3122 KeypadLess = 0xC5,
3123 /// Usage ID `0xC6`: "Keypad Greater"
3124 KeypadGreater = 0xC6,
3125 /// Usage ID `0xC7`: "Keypad Ampersand"
3126 KeypadAmpersand = 0xC7,
3127 /// Usage ID `0xC8`: "Keypad Double Ampersand"
3128 KeypadDoubleAmpersand = 0xC8,
3129 /// Usage ID `0xC9`: "Keypad Bar"
3130 KeypadBar = 0xC9,
3131 /// Usage ID `0xCA`: "Keypad Double Bar"
3132 KeypadDoubleBar = 0xCA,
3133 /// Usage ID `0xCB`: "Keypad Colon"
3134 KeypadColon = 0xCB,
3135 /// Usage ID `0xCC`: "Keypad Hash"
3136 KeypadHash = 0xCC,
3137 /// Usage ID `0xCD`: "Keypad Space"
3138 KeypadSpace = 0xCD,
3139 /// Usage ID `0xCE`: "Keypad At"
3140 KeypadAt = 0xCE,
3141 /// Usage ID `0xCF`: "Keypad Bang"
3142 KeypadBang = 0xCF,
3143 /// Usage ID `0xD0`: "Keypad Memory Store"
3144 KeypadMemoryStore = 0xD0,
3145 /// Usage ID `0xD1`: "Keypad Memory Recall"
3146 KeypadMemoryRecall = 0xD1,
3147 /// Usage ID `0xD2`: "Keypad Memory Clear"
3148 KeypadMemoryClear = 0xD2,
3149 /// Usage ID `0xD3`: "Keypad Memory Add"
3150 KeypadMemoryAdd = 0xD3,
3151 /// Usage ID `0xD4`: "Keypad Memory Subtract"
3152 KeypadMemorySubtract = 0xD4,
3153 /// Usage ID `0xD5`: "Keypad Memory Multiply"
3154 KeypadMemoryMultiply = 0xD5,
3155 /// Usage ID `0xD6`: "Keypad Memory Divide"
3156 KeypadMemoryDivide = 0xD6,
3157 /// Usage ID `0xD7`: "Keypad Plus Minus"
3158 KeypadPlusMinus = 0xD7,
3159 /// Usage ID `0xD8`: "Keypad Clear"
3160 KeypadClear = 0xD8,
3161 /// Usage ID `0xD9`: "Keypad Clear Entry"
3162 KeypadClearEntry = 0xD9,
3163 /// Usage ID `0xDA`: "Keypad Binary"
3164 KeypadBinary = 0xDA,
3165 /// Usage ID `0xDB`: "Keypad Octal"
3166 KeypadOctal = 0xDB,
3167 /// Usage ID `0xDC`: "Keypad Decimal"
3168 KeypadDecimal = 0xDC,
3169 /// Usage ID `0xDD`: "Keypad Hexadecimal"
3170 KeypadHexadecimal = 0xDD,
3171 /// Usage ID `0xE0`: "Keyboard LeftControl"
3172 KeyboardLeftControl = 0xE0,
3173 /// Usage ID `0xE1`: "Keyboard LeftShift"
3174 KeyboardLeftShift = 0xE1,
3175 /// Usage ID `0xE2`: "Keyboard LeftAlt"
3176 KeyboardLeftAlt = 0xE2,
3177 /// Usage ID `0xE3`: "Keyboard Left GUI"
3178 KeyboardLeftGUI = 0xE3,
3179 /// Usage ID `0xE4`: "Keyboard RightControl"
3180 KeyboardRightControl = 0xE4,
3181 /// Usage ID `0xE5`: "Keyboard RightShift"
3182 KeyboardRightShift = 0xE5,
3183 /// Usage ID `0xE6`: "Keyboard RightAlt"
3184 KeyboardRightAlt = 0xE6,
3185 /// Usage ID `0xE7`: "Keyboard Right GUI"
3186 KeyboardRightGUI = 0xE7,
3187 }
3188
3189 impl KeyboardKeypad {
3190 #[cfg(feature = "std")]
3191 pub fn name(&self) -> String {
3192 match self {
3193 KeyboardKeypad::ErrorRollOver => "ErrorRollOver",
3194 KeyboardKeypad::POSTFail => "POSTFail",
3195 KeyboardKeypad::ErrorUndefined => "ErrorUndefined",
3196 KeyboardKeypad::KeyboardA => "Keyboard A",
3197 KeyboardKeypad::KeyboardB => "Keyboard B",
3198 KeyboardKeypad::KeyboardC => "Keyboard C",
3199 KeyboardKeypad::KeyboardD => "Keyboard D",
3200 KeyboardKeypad::KeyboardE => "Keyboard E",
3201 KeyboardKeypad::KeyboardF => "Keyboard F",
3202 KeyboardKeypad::KeyboardG => "Keyboard G",
3203 KeyboardKeypad::KeyboardH => "Keyboard H",
3204 KeyboardKeypad::KeyboardI => "Keyboard I",
3205 KeyboardKeypad::KeyboardJ => "Keyboard J",
3206 KeyboardKeypad::KeyboardK => "Keyboard K",
3207 KeyboardKeypad::KeyboardL => "Keyboard L",
3208 KeyboardKeypad::KeyboardM => "Keyboard M",
3209 KeyboardKeypad::KeyboardN => "Keyboard N",
3210 KeyboardKeypad::KeyboardO => "Keyboard O",
3211 KeyboardKeypad::KeyboardP => "Keyboard P",
3212 KeyboardKeypad::KeyboardQ => "Keyboard Q",
3213 KeyboardKeypad::KeyboardR => "Keyboard R",
3214 KeyboardKeypad::KeyboardS => "Keyboard S",
3215 KeyboardKeypad::KeyboardT => "Keyboard T",
3216 KeyboardKeypad::KeyboardU => "Keyboard U",
3217 KeyboardKeypad::KeyboardV => "Keyboard V",
3218 KeyboardKeypad::KeyboardW => "Keyboard W",
3219 KeyboardKeypad::KeyboardX => "Keyboard X",
3220 KeyboardKeypad::KeyboardY => "Keyboard Y",
3221 KeyboardKeypad::KeyboardZ => "Keyboard Z",
3222 KeyboardKeypad::Keyboard1andBang => "Keyboard 1 and Bang",
3223 KeyboardKeypad::Keyboard2andAt => "Keyboard 2 and At",
3224 KeyboardKeypad::Keyboard3andHash => "Keyboard 3 and Hash",
3225 KeyboardKeypad::Keyboard4andDollar => "Keyboard 4 and Dollar",
3226 KeyboardKeypad::Keyboard5andPercent => "Keyboard 5 and Percent",
3227 KeyboardKeypad::Keyboard6andCaret => "Keyboard 6 and Caret",
3228 KeyboardKeypad::Keyboard7andAmpersand => "Keyboard 7 and Ampersand",
3229 KeyboardKeypad::Keyboard8andStar => "Keyboard 8 and Star",
3230 KeyboardKeypad::Keyboard9andLeftBracket => "Keyboard 9 and Left Bracket",
3231 KeyboardKeypad::Keyboard0andRightBracket => "Keyboard 0 and Right Bracket",
3232 KeyboardKeypad::KeyboardReturnEnter => "Keyboard Return Enter",
3233 KeyboardKeypad::KeyboardEscape => "Keyboard Escape",
3234 KeyboardKeypad::KeyboardDelete => "Keyboard Delete",
3235 KeyboardKeypad::KeyboardTab => "Keyboard Tab",
3236 KeyboardKeypad::KeyboardSpacebar => "Keyboard Spacebar",
3237 KeyboardKeypad::KeyboardDashandUnderscore => "Keyboard Dash and Underscore",
3238 KeyboardKeypad::KeyboardEqualsandPlus => "Keyboard Equals and Plus",
3239 KeyboardKeypad::KeyboardLeftBrace => "Keyboard Left Brace",
3240 KeyboardKeypad::KeyboardRightBrace => "Keyboard Right Brace",
3241 KeyboardKeypad::KeyboardBackslashandPipe => "Keyboard Backslash and Pipe",
3242 KeyboardKeypad::KeyboardNonUSHashandTilde => "Keyboard Non-US Hash and Tilde",
3243 KeyboardKeypad::KeyboardSemiColonandColon => "Keyboard SemiColon and Colon",
3244 KeyboardKeypad::KeyboardLeftAposandDouble => "Keyboard Left Apos and Double",
3245 KeyboardKeypad::KeyboardGraveAccentandTilde => "Keyboard Grave Accent and Tilde",
3246 KeyboardKeypad::KeyboardCommaandLessThan => "Keyboard Comma and LessThan",
3247 KeyboardKeypad::KeyboardPeriodandGreaterThan => "Keyboard Period and GreaterThan",
3248 KeyboardKeypad::KeyboardForwardSlashandQuestionMark => {
3249 "Keyboard ForwardSlash and QuestionMark"
3250 }
3251 KeyboardKeypad::KeyboardCapsLock => "Keyboard Caps Lock",
3252 KeyboardKeypad::KeyboardF1 => "Keyboard F1",
3253 KeyboardKeypad::KeyboardF2 => "Keyboard F2",
3254 KeyboardKeypad::KeyboardF3 => "Keyboard F3",
3255 KeyboardKeypad::KeyboardF4 => "Keyboard F4",
3256 KeyboardKeypad::KeyboardF5 => "Keyboard F5",
3257 KeyboardKeypad::KeyboardF6 => "Keyboard F6",
3258 KeyboardKeypad::KeyboardF7 => "Keyboard F7",
3259 KeyboardKeypad::KeyboardF8 => "Keyboard F8",
3260 KeyboardKeypad::KeyboardF9 => "Keyboard F9",
3261 KeyboardKeypad::KeyboardF10 => "Keyboard F10",
3262 KeyboardKeypad::KeyboardF11 => "Keyboard F11",
3263 KeyboardKeypad::KeyboardF12 => "Keyboard F12",
3264 KeyboardKeypad::KeyboardPrintScreen => "Keyboard PrintScreen",
3265 KeyboardKeypad::KeyboardScrollLock => "Keyboard Scroll Lock",
3266 KeyboardKeypad::KeyboardPause => "Keyboard Pause",
3267 KeyboardKeypad::KeyboardInsert => "Keyboard Insert",
3268 KeyboardKeypad::KeyboardHome => "Keyboard Home",
3269 KeyboardKeypad::KeyboardPageUp => "Keyboard PageUp",
3270 KeyboardKeypad::KeyboardDeleteForward => "Keyboard Delete Forward",
3271 KeyboardKeypad::KeyboardEnd => "Keyboard End",
3272 KeyboardKeypad::KeyboardPageDown => "Keyboard PageDown",
3273 KeyboardKeypad::KeyboardRightArrow => "Keyboard RightArrow",
3274 KeyboardKeypad::KeyboardLeftArrow => "Keyboard LeftArrow",
3275 KeyboardKeypad::KeyboardDownArrow => "Keyboard DownArrow",
3276 KeyboardKeypad::KeyboardUpArrow => "Keyboard UpArrow",
3277 KeyboardKeypad::KeypadNumLockandClear => "Keypad Num Lock and Clear",
3278 KeyboardKeypad::KeypadForwardSlash => "Keypad ForwardSlash",
3279 KeyboardKeypad::KeypadStar => "Keypad Star",
3280 KeyboardKeypad::KeypadDash => "Keypad Dash",
3281 KeyboardKeypad::KeypadPlus => "Keypad Plus",
3282 KeyboardKeypad::KeypadENTER => "Keypad ENTER",
3283 KeyboardKeypad::Keypad1andEnd => "Keypad 1 and End",
3284 KeyboardKeypad::Keypad2andDownArrow => "Keypad 2 and Down Arrow",
3285 KeyboardKeypad::Keypad3andPageDn => "Keypad 3 and PageDn",
3286 KeyboardKeypad::Keypad4andLeftArrow => "Keypad 4 and Left Arrow",
3287 KeyboardKeypad::Keypad5 => "Keypad 5",
3288 KeyboardKeypad::Keypad6andRightArrow => "Keypad 6 and Right Arrow",
3289 KeyboardKeypad::Keypad7andHome => "Keypad 7 and Home",
3290 KeyboardKeypad::Keypad8andUpArrow => "Keypad 8 and Up Arrow",
3291 KeyboardKeypad::Keypad9andPageUp => "Keypad 9 and PageUp",
3292 KeyboardKeypad::Keypad0andInsert => "Keypad 0 and Insert",
3293 KeyboardKeypad::KeypadPeriodandDelete => "Keypad Period and Delete",
3294 KeyboardKeypad::KeyboardNonUSBackslashandPipe => "Keyboard Non-US Backslash and Pipe",
3295 KeyboardKeypad::KeyboardApplication => "Keyboard Application",
3296 KeyboardKeypad::KeyboardPower => "Keyboard Power",
3297 KeyboardKeypad::KeypadEquals => "Keypad Equals",
3298 KeyboardKeypad::KeyboardF13 => "Keyboard F13",
3299 KeyboardKeypad::KeyboardF14 => "Keyboard F14",
3300 KeyboardKeypad::KeyboardF15 => "Keyboard F15",
3301 KeyboardKeypad::KeyboardF16 => "Keyboard F16",
3302 KeyboardKeypad::KeyboardF17 => "Keyboard F17",
3303 KeyboardKeypad::KeyboardF18 => "Keyboard F18",
3304 KeyboardKeypad::KeyboardF19 => "Keyboard F19",
3305 KeyboardKeypad::KeyboardF20 => "Keyboard F20",
3306 KeyboardKeypad::KeyboardF21 => "Keyboard F21",
3307 KeyboardKeypad::KeyboardF22 => "Keyboard F22",
3308 KeyboardKeypad::KeyboardF23 => "Keyboard F23",
3309 KeyboardKeypad::KeyboardF24 => "Keyboard F24",
3310 KeyboardKeypad::KeyboardExecute => "Keyboard Execute",
3311 KeyboardKeypad::KeyboardHelp => "Keyboard Help",
3312 KeyboardKeypad::KeyboardMenu => "Keyboard Menu",
3313 KeyboardKeypad::KeyboardSelect => "Keyboard Select",
3314 KeyboardKeypad::KeyboardStop => "Keyboard Stop",
3315 KeyboardKeypad::KeyboardAgain => "Keyboard Again",
3316 KeyboardKeypad::KeyboardUndo => "Keyboard Undo",
3317 KeyboardKeypad::KeyboardCut => "Keyboard Cut",
3318 KeyboardKeypad::KeyboardCopy => "Keyboard Copy",
3319 KeyboardKeypad::KeyboardPaste => "Keyboard Paste",
3320 KeyboardKeypad::KeyboardFind => "Keyboard Find",
3321 KeyboardKeypad::KeyboardMute => "Keyboard Mute",
3322 KeyboardKeypad::KeyboardVolumeUp => "Keyboard Volume Up",
3323 KeyboardKeypad::KeyboardVolumeDown => "Keyboard Volume Down",
3324 KeyboardKeypad::KeyboardLockingCapsLock => "Keyboard Locking Caps Lock",
3325 KeyboardKeypad::KeyboardLockingNumLock => "Keyboard Locking Num Lock",
3326 KeyboardKeypad::KeyboardLockingScrollLock => "Keyboard Locking Scroll Lock",
3327 KeyboardKeypad::KeypadComma => "Keypad Comma",
3328 KeyboardKeypad::KeypadEqualSign => "Keypad Equal Sign",
3329 KeyboardKeypad::KeyboardInternational1 => "Keyboard International1",
3330 KeyboardKeypad::KeyboardInternational2 => "Keyboard International2",
3331 KeyboardKeypad::KeyboardInternational3 => "Keyboard International3",
3332 KeyboardKeypad::KeyboardInternational4 => "Keyboard International4",
3333 KeyboardKeypad::KeyboardInternational5 => "Keyboard International5",
3334 KeyboardKeypad::KeyboardInternational6 => "Keyboard International6",
3335 KeyboardKeypad::KeyboardInternational7 => "Keyboard International7",
3336 KeyboardKeypad::KeyboardInternational8 => "Keyboard International8",
3337 KeyboardKeypad::KeyboardInternational9 => "Keyboard International9",
3338 KeyboardKeypad::KeyboardLANG1 => "Keyboard LANG1",
3339 KeyboardKeypad::KeyboardLANG2 => "Keyboard LANG2",
3340 KeyboardKeypad::KeyboardLANG3 => "Keyboard LANG3",
3341 KeyboardKeypad::KeyboardLANG4 => "Keyboard LANG4",
3342 KeyboardKeypad::KeyboardLANG5 => "Keyboard LANG5",
3343 KeyboardKeypad::KeyboardLANG6 => "Keyboard LANG6",
3344 KeyboardKeypad::KeyboardLANG7 => "Keyboard LANG7",
3345 KeyboardKeypad::KeyboardLANG8 => "Keyboard LANG8",
3346 KeyboardKeypad::KeyboardLANG9 => "Keyboard LANG9",
3347 KeyboardKeypad::KeyboardAlternateErase => "Keyboard Alternate Erase",
3348 KeyboardKeypad::KeyboardSysReqAttention => "Keyboard SysReq Attention",
3349 KeyboardKeypad::KeyboardCancel => "Keyboard Cancel",
3350 KeyboardKeypad::KeyboardClear => "Keyboard Clear",
3351 KeyboardKeypad::KeyboardPrior => "Keyboard Prior",
3352 KeyboardKeypad::KeyboardReturn => "Keyboard Return",
3353 KeyboardKeypad::KeyboardSeparator => "Keyboard Separator",
3354 KeyboardKeypad::KeyboardOut => "Keyboard Out",
3355 KeyboardKeypad::KeyboardOper => "Keyboard Oper",
3356 KeyboardKeypad::KeyboardClearAgain => "Keyboard Clear Again",
3357 KeyboardKeypad::KeyboardCrSelProps => "Keyboard CrSel Props",
3358 KeyboardKeypad::KeyboardExSel => "Keyboard ExSel",
3359 KeyboardKeypad::KeypadDouble0 => "Keypad Double 0",
3360 KeyboardKeypad::KeypadTriple0 => "Keypad Triple 0",
3361 KeyboardKeypad::ThousandsSeparator => "Thousands Separator",
3362 KeyboardKeypad::DecimalSeparator => "Decimal Separator",
3363 KeyboardKeypad::CurrencyUnit => "Currency Unit",
3364 KeyboardKeypad::CurrencySubunit => "Currency Sub-unit",
3365 KeyboardKeypad::KeypadLeftBracket => "Keypad Left Bracket",
3366 KeyboardKeypad::KeypadRightBracket => "Keypad Right Bracket",
3367 KeyboardKeypad::KeypadLeftBrace => "Keypad Left Brace",
3368 KeyboardKeypad::KeypadRightBrace => "Keypad Right Brace",
3369 KeyboardKeypad::KeypadTab => "Keypad Tab",
3370 KeyboardKeypad::KeypadBackspace => "Keypad Backspace",
3371 KeyboardKeypad::KeypadA => "Keypad A",
3372 KeyboardKeypad::KeypadB => "Keypad B",
3373 KeyboardKeypad::KeypadC => "Keypad C",
3374 KeyboardKeypad::KeypadD => "Keypad D",
3375 KeyboardKeypad::KeypadE => "Keypad E",
3376 KeyboardKeypad::KeypadF => "Keypad F",
3377 KeyboardKeypad::KeypadXOR => "Keypad XOR",
3378 KeyboardKeypad::KeypadCaret => "Keypad Caret",
3379 KeyboardKeypad::KeypadPercentage => "Keypad Percentage",
3380 KeyboardKeypad::KeypadLess => "Keypad Less",
3381 KeyboardKeypad::KeypadGreater => "Keypad Greater",
3382 KeyboardKeypad::KeypadAmpersand => "Keypad Ampersand",
3383 KeyboardKeypad::KeypadDoubleAmpersand => "Keypad Double Ampersand",
3384 KeyboardKeypad::KeypadBar => "Keypad Bar",
3385 KeyboardKeypad::KeypadDoubleBar => "Keypad Double Bar",
3386 KeyboardKeypad::KeypadColon => "Keypad Colon",
3387 KeyboardKeypad::KeypadHash => "Keypad Hash",
3388 KeyboardKeypad::KeypadSpace => "Keypad Space",
3389 KeyboardKeypad::KeypadAt => "Keypad At",
3390 KeyboardKeypad::KeypadBang => "Keypad Bang",
3391 KeyboardKeypad::KeypadMemoryStore => "Keypad Memory Store",
3392 KeyboardKeypad::KeypadMemoryRecall => "Keypad Memory Recall",
3393 KeyboardKeypad::KeypadMemoryClear => "Keypad Memory Clear",
3394 KeyboardKeypad::KeypadMemoryAdd => "Keypad Memory Add",
3395 KeyboardKeypad::KeypadMemorySubtract => "Keypad Memory Subtract",
3396 KeyboardKeypad::KeypadMemoryMultiply => "Keypad Memory Multiply",
3397 KeyboardKeypad::KeypadMemoryDivide => "Keypad Memory Divide",
3398 KeyboardKeypad::KeypadPlusMinus => "Keypad Plus Minus",
3399 KeyboardKeypad::KeypadClear => "Keypad Clear",
3400 KeyboardKeypad::KeypadClearEntry => "Keypad Clear Entry",
3401 KeyboardKeypad::KeypadBinary => "Keypad Binary",
3402 KeyboardKeypad::KeypadOctal => "Keypad Octal",
3403 KeyboardKeypad::KeypadDecimal => "Keypad Decimal",
3404 KeyboardKeypad::KeypadHexadecimal => "Keypad Hexadecimal",
3405 KeyboardKeypad::KeyboardLeftControl => "Keyboard LeftControl",
3406 KeyboardKeypad::KeyboardLeftShift => "Keyboard LeftShift",
3407 KeyboardKeypad::KeyboardLeftAlt => "Keyboard LeftAlt",
3408 KeyboardKeypad::KeyboardLeftGUI => "Keyboard Left GUI",
3409 KeyboardKeypad::KeyboardRightControl => "Keyboard RightControl",
3410 KeyboardKeypad::KeyboardRightShift => "Keyboard RightShift",
3411 KeyboardKeypad::KeyboardRightAlt => "Keyboard RightAlt",
3412 KeyboardKeypad::KeyboardRightGUI => "Keyboard Right GUI",
3413 }
3414 .into()
3415 }
3416 }
3417
3418 #[cfg(feature = "std")]
3419 impl fmt::Display for KeyboardKeypad {
3420 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3421 write!(f, "{}", self.name())
3422 }
3423 }
3424
3425 impl AsUsage for KeyboardKeypad {
3426 /// Returns the 32 bit Usage value of this Usage
3427 fn usage_value(&self) -> u32 {
3428 u32::from(self)
3429 }
3430
3431 /// Returns the 16 bit Usage ID value of this Usage
3432 fn usage_id_value(&self) -> u16 {
3433 u16::from(self)
3434 }
3435
3436 /// Returns this usage as [Usage::KeyboardKeypad(self)](Usage::KeyboardKeypad)
3437 /// This is a convenience function to avoid having
3438 /// to implement `From` for every used type in the caller.
3439 ///
3440 /// ```
3441 /// # use hut::*;
3442 /// let gd_x = GenericDesktop::X;
3443 /// let usage = Usage::from(GenericDesktop::X);
3444 /// assert!(matches!(gd_x.usage(), usage));
3445 /// ```
3446 fn usage(&self) -> Usage {
3447 Usage::from(self)
3448 }
3449 }
3450
3451 impl AsUsagePage for KeyboardKeypad {
3452 /// Returns the 16 bit value of this UsagePage
3453 ///
3454 /// This value is `0x7` for [KeyboardKeypad]
3455 fn usage_page_value(&self) -> u16 {
3456 let up = UsagePage::from(self);
3457 u16::from(up)
3458 }
3459
3460 /// Returns [UsagePage::KeyboardKeypad]]
3461 fn usage_page(&self) -> UsagePage {
3462 UsagePage::from(self)
3463 }
3464 }
3465
3466 impl From<&KeyboardKeypad> for u16 {
3467 fn from(keyboardkeypad: &KeyboardKeypad) -> u16 {
3468 *keyboardkeypad as u16
3469 }
3470 }
3471
3472 impl From<KeyboardKeypad> for u16 {
3473 /// Returns the 16bit value of this usage. This is identical
3474 /// to [KeyboardKeypad::usage_page_value()].
3475 fn from(keyboardkeypad: KeyboardKeypad) -> u16 {
3476 u16::from(&keyboardkeypad)
3477 }
3478 }
3479
3480 impl From<&KeyboardKeypad> for u32 {
3481 /// Returns the 32 bit value of this usage. This is identical
3482 /// to [KeyboardKeypad::usage_value()].
3483 fn from(keyboardkeypad: &KeyboardKeypad) -> u32 {
3484 let up = UsagePage::from(keyboardkeypad);
3485 let up = (u16::from(&up) as u32) << 16;
3486 let id = u16::from(keyboardkeypad) as u32;
3487 up | id
3488 }
3489 }
3490
3491 impl From<&KeyboardKeypad> for UsagePage {
3492 /// Always returns [UsagePage::KeyboardKeypad] and is
3493 /// identical to [KeyboardKeypad::usage_page()].
3494 fn from(_: &KeyboardKeypad) -> UsagePage {
3495 UsagePage::KeyboardKeypad
3496 }
3497 }
3498
3499 impl From<KeyboardKeypad> for UsagePage {
3500 /// Always returns [UsagePage::KeyboardKeypad] and is
3501 /// identical to [KeyboardKeypad::usage_page()].
3502 fn from(_: KeyboardKeypad) -> UsagePage {
3503 UsagePage::KeyboardKeypad
3504 }
3505 }
3506
3507 impl From<&KeyboardKeypad> for Usage {
3508 fn from(keyboardkeypad: &KeyboardKeypad) -> Usage {
3509 Usage::try_from(u32::from(keyboardkeypad)).unwrap()
3510 }
3511 }
3512
3513 impl From<KeyboardKeypad> for Usage {
3514 fn from(keyboardkeypad: KeyboardKeypad) -> Usage {
3515 Usage::from(&keyboardkeypad)
3516 }
3517 }
3518
3519 impl TryFrom<u16> for KeyboardKeypad {
3520 type Error = HutError;
3521
3522 fn try_from(usage_id: u16) -> Result<KeyboardKeypad> {
3523 match usage_id {
3524 1 => Ok(KeyboardKeypad::ErrorRollOver),
3525 2 => Ok(KeyboardKeypad::POSTFail),
3526 3 => Ok(KeyboardKeypad::ErrorUndefined),
3527 4 => Ok(KeyboardKeypad::KeyboardA),
3528 5 => Ok(KeyboardKeypad::KeyboardB),
3529 6 => Ok(KeyboardKeypad::KeyboardC),
3530 7 => Ok(KeyboardKeypad::KeyboardD),
3531 8 => Ok(KeyboardKeypad::KeyboardE),
3532 9 => Ok(KeyboardKeypad::KeyboardF),
3533 10 => Ok(KeyboardKeypad::KeyboardG),
3534 11 => Ok(KeyboardKeypad::KeyboardH),
3535 12 => Ok(KeyboardKeypad::KeyboardI),
3536 13 => Ok(KeyboardKeypad::KeyboardJ),
3537 14 => Ok(KeyboardKeypad::KeyboardK),
3538 15 => Ok(KeyboardKeypad::KeyboardL),
3539 16 => Ok(KeyboardKeypad::KeyboardM),
3540 17 => Ok(KeyboardKeypad::KeyboardN),
3541 18 => Ok(KeyboardKeypad::KeyboardO),
3542 19 => Ok(KeyboardKeypad::KeyboardP),
3543 20 => Ok(KeyboardKeypad::KeyboardQ),
3544 21 => Ok(KeyboardKeypad::KeyboardR),
3545 22 => Ok(KeyboardKeypad::KeyboardS),
3546 23 => Ok(KeyboardKeypad::KeyboardT),
3547 24 => Ok(KeyboardKeypad::KeyboardU),
3548 25 => Ok(KeyboardKeypad::KeyboardV),
3549 26 => Ok(KeyboardKeypad::KeyboardW),
3550 27 => Ok(KeyboardKeypad::KeyboardX),
3551 28 => Ok(KeyboardKeypad::KeyboardY),
3552 29 => Ok(KeyboardKeypad::KeyboardZ),
3553 30 => Ok(KeyboardKeypad::Keyboard1andBang),
3554 31 => Ok(KeyboardKeypad::Keyboard2andAt),
3555 32 => Ok(KeyboardKeypad::Keyboard3andHash),
3556 33 => Ok(KeyboardKeypad::Keyboard4andDollar),
3557 34 => Ok(KeyboardKeypad::Keyboard5andPercent),
3558 35 => Ok(KeyboardKeypad::Keyboard6andCaret),
3559 36 => Ok(KeyboardKeypad::Keyboard7andAmpersand),
3560 37 => Ok(KeyboardKeypad::Keyboard8andStar),
3561 38 => Ok(KeyboardKeypad::Keyboard9andLeftBracket),
3562 39 => Ok(KeyboardKeypad::Keyboard0andRightBracket),
3563 40 => Ok(KeyboardKeypad::KeyboardReturnEnter),
3564 41 => Ok(KeyboardKeypad::KeyboardEscape),
3565 42 => Ok(KeyboardKeypad::KeyboardDelete),
3566 43 => Ok(KeyboardKeypad::KeyboardTab),
3567 44 => Ok(KeyboardKeypad::KeyboardSpacebar),
3568 45 => Ok(KeyboardKeypad::KeyboardDashandUnderscore),
3569 46 => Ok(KeyboardKeypad::KeyboardEqualsandPlus),
3570 47 => Ok(KeyboardKeypad::KeyboardLeftBrace),
3571 48 => Ok(KeyboardKeypad::KeyboardRightBrace),
3572 49 => Ok(KeyboardKeypad::KeyboardBackslashandPipe),
3573 50 => Ok(KeyboardKeypad::KeyboardNonUSHashandTilde),
3574 51 => Ok(KeyboardKeypad::KeyboardSemiColonandColon),
3575 52 => Ok(KeyboardKeypad::KeyboardLeftAposandDouble),
3576 53 => Ok(KeyboardKeypad::KeyboardGraveAccentandTilde),
3577 54 => Ok(KeyboardKeypad::KeyboardCommaandLessThan),
3578 55 => Ok(KeyboardKeypad::KeyboardPeriodandGreaterThan),
3579 56 => Ok(KeyboardKeypad::KeyboardForwardSlashandQuestionMark),
3580 57 => Ok(KeyboardKeypad::KeyboardCapsLock),
3581 58 => Ok(KeyboardKeypad::KeyboardF1),
3582 59 => Ok(KeyboardKeypad::KeyboardF2),
3583 60 => Ok(KeyboardKeypad::KeyboardF3),
3584 61 => Ok(KeyboardKeypad::KeyboardF4),
3585 62 => Ok(KeyboardKeypad::KeyboardF5),
3586 63 => Ok(KeyboardKeypad::KeyboardF6),
3587 64 => Ok(KeyboardKeypad::KeyboardF7),
3588 65 => Ok(KeyboardKeypad::KeyboardF8),
3589 66 => Ok(KeyboardKeypad::KeyboardF9),
3590 67 => Ok(KeyboardKeypad::KeyboardF10),
3591 68 => Ok(KeyboardKeypad::KeyboardF11),
3592 69 => Ok(KeyboardKeypad::KeyboardF12),
3593 70 => Ok(KeyboardKeypad::KeyboardPrintScreen),
3594 71 => Ok(KeyboardKeypad::KeyboardScrollLock),
3595 72 => Ok(KeyboardKeypad::KeyboardPause),
3596 73 => Ok(KeyboardKeypad::KeyboardInsert),
3597 74 => Ok(KeyboardKeypad::KeyboardHome),
3598 75 => Ok(KeyboardKeypad::KeyboardPageUp),
3599 76 => Ok(KeyboardKeypad::KeyboardDeleteForward),
3600 77 => Ok(KeyboardKeypad::KeyboardEnd),
3601 78 => Ok(KeyboardKeypad::KeyboardPageDown),
3602 79 => Ok(KeyboardKeypad::KeyboardRightArrow),
3603 80 => Ok(KeyboardKeypad::KeyboardLeftArrow),
3604 81 => Ok(KeyboardKeypad::KeyboardDownArrow),
3605 82 => Ok(KeyboardKeypad::KeyboardUpArrow),
3606 83 => Ok(KeyboardKeypad::KeypadNumLockandClear),
3607 84 => Ok(KeyboardKeypad::KeypadForwardSlash),
3608 85 => Ok(KeyboardKeypad::KeypadStar),
3609 86 => Ok(KeyboardKeypad::KeypadDash),
3610 87 => Ok(KeyboardKeypad::KeypadPlus),
3611 88 => Ok(KeyboardKeypad::KeypadENTER),
3612 89 => Ok(KeyboardKeypad::Keypad1andEnd),
3613 90 => Ok(KeyboardKeypad::Keypad2andDownArrow),
3614 91 => Ok(KeyboardKeypad::Keypad3andPageDn),
3615 92 => Ok(KeyboardKeypad::Keypad4andLeftArrow),
3616 93 => Ok(KeyboardKeypad::Keypad5),
3617 94 => Ok(KeyboardKeypad::Keypad6andRightArrow),
3618 95 => Ok(KeyboardKeypad::Keypad7andHome),
3619 96 => Ok(KeyboardKeypad::Keypad8andUpArrow),
3620 97 => Ok(KeyboardKeypad::Keypad9andPageUp),
3621 98 => Ok(KeyboardKeypad::Keypad0andInsert),
3622 99 => Ok(KeyboardKeypad::KeypadPeriodandDelete),
3623 100 => Ok(KeyboardKeypad::KeyboardNonUSBackslashandPipe),
3624 101 => Ok(KeyboardKeypad::KeyboardApplication),
3625 102 => Ok(KeyboardKeypad::KeyboardPower),
3626 103 => Ok(KeyboardKeypad::KeypadEquals),
3627 104 => Ok(KeyboardKeypad::KeyboardF13),
3628 105 => Ok(KeyboardKeypad::KeyboardF14),
3629 106 => Ok(KeyboardKeypad::KeyboardF15),
3630 107 => Ok(KeyboardKeypad::KeyboardF16),
3631 108 => Ok(KeyboardKeypad::KeyboardF17),
3632 109 => Ok(KeyboardKeypad::KeyboardF18),
3633 110 => Ok(KeyboardKeypad::KeyboardF19),
3634 111 => Ok(KeyboardKeypad::KeyboardF20),
3635 112 => Ok(KeyboardKeypad::KeyboardF21),
3636 113 => Ok(KeyboardKeypad::KeyboardF22),
3637 114 => Ok(KeyboardKeypad::KeyboardF23),
3638 115 => Ok(KeyboardKeypad::KeyboardF24),
3639 116 => Ok(KeyboardKeypad::KeyboardExecute),
3640 117 => Ok(KeyboardKeypad::KeyboardHelp),
3641 118 => Ok(KeyboardKeypad::KeyboardMenu),
3642 119 => Ok(KeyboardKeypad::KeyboardSelect),
3643 120 => Ok(KeyboardKeypad::KeyboardStop),
3644 121 => Ok(KeyboardKeypad::KeyboardAgain),
3645 122 => Ok(KeyboardKeypad::KeyboardUndo),
3646 123 => Ok(KeyboardKeypad::KeyboardCut),
3647 124 => Ok(KeyboardKeypad::KeyboardCopy),
3648 125 => Ok(KeyboardKeypad::KeyboardPaste),
3649 126 => Ok(KeyboardKeypad::KeyboardFind),
3650 127 => Ok(KeyboardKeypad::KeyboardMute),
3651 128 => Ok(KeyboardKeypad::KeyboardVolumeUp),
3652 129 => Ok(KeyboardKeypad::KeyboardVolumeDown),
3653 130 => Ok(KeyboardKeypad::KeyboardLockingCapsLock),
3654 131 => Ok(KeyboardKeypad::KeyboardLockingNumLock),
3655 132 => Ok(KeyboardKeypad::KeyboardLockingScrollLock),
3656 133 => Ok(KeyboardKeypad::KeypadComma),
3657 134 => Ok(KeyboardKeypad::KeypadEqualSign),
3658 135 => Ok(KeyboardKeypad::KeyboardInternational1),
3659 136 => Ok(KeyboardKeypad::KeyboardInternational2),
3660 137 => Ok(KeyboardKeypad::KeyboardInternational3),
3661 138 => Ok(KeyboardKeypad::KeyboardInternational4),
3662 139 => Ok(KeyboardKeypad::KeyboardInternational5),
3663 140 => Ok(KeyboardKeypad::KeyboardInternational6),
3664 141 => Ok(KeyboardKeypad::KeyboardInternational7),
3665 142 => Ok(KeyboardKeypad::KeyboardInternational8),
3666 143 => Ok(KeyboardKeypad::KeyboardInternational9),
3667 144 => Ok(KeyboardKeypad::KeyboardLANG1),
3668 145 => Ok(KeyboardKeypad::KeyboardLANG2),
3669 146 => Ok(KeyboardKeypad::KeyboardLANG3),
3670 147 => Ok(KeyboardKeypad::KeyboardLANG4),
3671 148 => Ok(KeyboardKeypad::KeyboardLANG5),
3672 149 => Ok(KeyboardKeypad::KeyboardLANG6),
3673 150 => Ok(KeyboardKeypad::KeyboardLANG7),
3674 151 => Ok(KeyboardKeypad::KeyboardLANG8),
3675 152 => Ok(KeyboardKeypad::KeyboardLANG9),
3676 153 => Ok(KeyboardKeypad::KeyboardAlternateErase),
3677 154 => Ok(KeyboardKeypad::KeyboardSysReqAttention),
3678 155 => Ok(KeyboardKeypad::KeyboardCancel),
3679 156 => Ok(KeyboardKeypad::KeyboardClear),
3680 157 => Ok(KeyboardKeypad::KeyboardPrior),
3681 158 => Ok(KeyboardKeypad::KeyboardReturn),
3682 159 => Ok(KeyboardKeypad::KeyboardSeparator),
3683 160 => Ok(KeyboardKeypad::KeyboardOut),
3684 161 => Ok(KeyboardKeypad::KeyboardOper),
3685 162 => Ok(KeyboardKeypad::KeyboardClearAgain),
3686 163 => Ok(KeyboardKeypad::KeyboardCrSelProps),
3687 164 => Ok(KeyboardKeypad::KeyboardExSel),
3688 176 => Ok(KeyboardKeypad::KeypadDouble0),
3689 177 => Ok(KeyboardKeypad::KeypadTriple0),
3690 178 => Ok(KeyboardKeypad::ThousandsSeparator),
3691 179 => Ok(KeyboardKeypad::DecimalSeparator),
3692 180 => Ok(KeyboardKeypad::CurrencyUnit),
3693 181 => Ok(KeyboardKeypad::CurrencySubunit),
3694 182 => Ok(KeyboardKeypad::KeypadLeftBracket),
3695 183 => Ok(KeyboardKeypad::KeypadRightBracket),
3696 184 => Ok(KeyboardKeypad::KeypadLeftBrace),
3697 185 => Ok(KeyboardKeypad::KeypadRightBrace),
3698 186 => Ok(KeyboardKeypad::KeypadTab),
3699 187 => Ok(KeyboardKeypad::KeypadBackspace),
3700 188 => Ok(KeyboardKeypad::KeypadA),
3701 189 => Ok(KeyboardKeypad::KeypadB),
3702 190 => Ok(KeyboardKeypad::KeypadC),
3703 191 => Ok(KeyboardKeypad::KeypadD),
3704 192 => Ok(KeyboardKeypad::KeypadE),
3705 193 => Ok(KeyboardKeypad::KeypadF),
3706 194 => Ok(KeyboardKeypad::KeypadXOR),
3707 195 => Ok(KeyboardKeypad::KeypadCaret),
3708 196 => Ok(KeyboardKeypad::KeypadPercentage),
3709 197 => Ok(KeyboardKeypad::KeypadLess),
3710 198 => Ok(KeyboardKeypad::KeypadGreater),
3711 199 => Ok(KeyboardKeypad::KeypadAmpersand),
3712 200 => Ok(KeyboardKeypad::KeypadDoubleAmpersand),
3713 201 => Ok(KeyboardKeypad::KeypadBar),
3714 202 => Ok(KeyboardKeypad::KeypadDoubleBar),
3715 203 => Ok(KeyboardKeypad::KeypadColon),
3716 204 => Ok(KeyboardKeypad::KeypadHash),
3717 205 => Ok(KeyboardKeypad::KeypadSpace),
3718 206 => Ok(KeyboardKeypad::KeypadAt),
3719 207 => Ok(KeyboardKeypad::KeypadBang),
3720 208 => Ok(KeyboardKeypad::KeypadMemoryStore),
3721 209 => Ok(KeyboardKeypad::KeypadMemoryRecall),
3722 210 => Ok(KeyboardKeypad::KeypadMemoryClear),
3723 211 => Ok(KeyboardKeypad::KeypadMemoryAdd),
3724 212 => Ok(KeyboardKeypad::KeypadMemorySubtract),
3725 213 => Ok(KeyboardKeypad::KeypadMemoryMultiply),
3726 214 => Ok(KeyboardKeypad::KeypadMemoryDivide),
3727 215 => Ok(KeyboardKeypad::KeypadPlusMinus),
3728 216 => Ok(KeyboardKeypad::KeypadClear),
3729 217 => Ok(KeyboardKeypad::KeypadClearEntry),
3730 218 => Ok(KeyboardKeypad::KeypadBinary),
3731 219 => Ok(KeyboardKeypad::KeypadOctal),
3732 220 => Ok(KeyboardKeypad::KeypadDecimal),
3733 221 => Ok(KeyboardKeypad::KeypadHexadecimal),
3734 224 => Ok(KeyboardKeypad::KeyboardLeftControl),
3735 225 => Ok(KeyboardKeypad::KeyboardLeftShift),
3736 226 => Ok(KeyboardKeypad::KeyboardLeftAlt),
3737 227 => Ok(KeyboardKeypad::KeyboardLeftGUI),
3738 228 => Ok(KeyboardKeypad::KeyboardRightControl),
3739 229 => Ok(KeyboardKeypad::KeyboardRightShift),
3740 230 => Ok(KeyboardKeypad::KeyboardRightAlt),
3741 231 => Ok(KeyboardKeypad::KeyboardRightGUI),
3742 n => Err(HutError::UnknownUsageId { usage_id: n }),
3743 }
3744 }
3745 }
3746
3747 impl BitOr<u16> for KeyboardKeypad {
3748 type Output = Usage;
3749
3750 /// A convenience function to combine a Usage Page with
3751 /// a value.
3752 ///
3753 /// This function panics if the Usage ID value results in
3754 /// an unknown Usage. Where error checking is required,
3755 /// use [UsagePage::to_usage_from_value].
3756 fn bitor(self, usage: u16) -> Usage {
3757 let up = u16::from(self) as u32;
3758 let u = usage as u32;
3759 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
3760 }
3761 }
3762
3763 /// *Usage Page `0x8`: "LED"*
3764 ///
3765 /// **This enum is autogenerated from the HID Usage Tables**.
3766 /// ```
3767 /// # use hut::*;
3768 /// let u1 = Usage::LED(LED::CapsLock);
3769 /// let u2 = Usage::new_from_page_and_id(0x8, 0x2).unwrap();
3770 /// let u3 = Usage::from(LED::CapsLock);
3771 /// let u4: Usage = LED::CapsLock.into();
3772 /// assert_eq!(u1, u2);
3773 /// assert_eq!(u1, u3);
3774 /// assert_eq!(u1, u4);
3775 ///
3776 /// assert!(matches!(u1.usage_page(), UsagePage::LED));
3777 /// assert_eq!(0x8, u1.usage_page_value());
3778 /// assert_eq!(0x2, u1.usage_id_value());
3779 /// assert_eq!((0x8 << 16) | 0x2, u1.usage_value());
3780 /// assert_eq!("Caps Lock", u1.name());
3781 /// ```
3782 ///
3783 #[allow(non_camel_case_types)]
3784 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
3785 #[non_exhaustive]
3786 #[repr(u16)]
3787 pub enum LED {
3788 /// Usage ID `0x1`: "Num Lock"
3789 NumLock = 0x1,
3790 /// Usage ID `0x2`: "Caps Lock"
3791 CapsLock = 0x2,
3792 /// Usage ID `0x3`: "Scroll Lock"
3793 ScrollLock = 0x3,
3794 /// Usage ID `0x4`: "Compose"
3795 Compose = 0x4,
3796 /// Usage ID `0x5`: "Kana"
3797 Kana = 0x5,
3798 /// Usage ID `0x6`: "Power"
3799 Power = 0x6,
3800 /// Usage ID `0x7`: "Shift"
3801 Shift = 0x7,
3802 /// Usage ID `0x8`: "Do Not Disturb"
3803 DoNotDisturb = 0x8,
3804 /// Usage ID `0x9`: "Mute"
3805 Mute = 0x9,
3806 /// Usage ID `0xA`: "Tone Enable"
3807 ToneEnable = 0xA,
3808 /// Usage ID `0xB`: "High Cut Filter"
3809 HighCutFilter = 0xB,
3810 /// Usage ID `0xC`: "Low Cut Filter"
3811 LowCutFilter = 0xC,
3812 /// Usage ID `0xD`: "Equalizer Enable"
3813 EqualizerEnable = 0xD,
3814 /// Usage ID `0xE`: "Sound Field On"
3815 SoundFieldOn = 0xE,
3816 /// Usage ID `0xF`: "Surround On"
3817 SurroundOn = 0xF,
3818 /// Usage ID `0x10`: "Repeat"
3819 Repeat = 0x10,
3820 /// Usage ID `0x11`: "Stereo"
3821 Stereo = 0x11,
3822 /// Usage ID `0x12`: "Sampling Rate Detect"
3823 SamplingRateDetect = 0x12,
3824 /// Usage ID `0x13`: "Spinning"
3825 Spinning = 0x13,
3826 /// Usage ID `0x14`: "CAV"
3827 CAV = 0x14,
3828 /// Usage ID `0x15`: "CLV"
3829 CLV = 0x15,
3830 /// Usage ID `0x16`: "Recording Format Detect"
3831 RecordingFormatDetect = 0x16,
3832 /// Usage ID `0x17`: "Off-Hook"
3833 OffHook = 0x17,
3834 /// Usage ID `0x18`: "Ring"
3835 Ring = 0x18,
3836 /// Usage ID `0x19`: "Message Waiting"
3837 MessageWaiting = 0x19,
3838 /// Usage ID `0x1A`: "Data Mode"
3839 DataMode = 0x1A,
3840 /// Usage ID `0x1B`: "Battery Operation"
3841 BatteryOperation = 0x1B,
3842 /// Usage ID `0x1C`: "Battery OK"
3843 BatteryOK = 0x1C,
3844 /// Usage ID `0x1D`: "Battery Low"
3845 BatteryLow = 0x1D,
3846 /// Usage ID `0x1E`: "Speaker"
3847 Speaker = 0x1E,
3848 /// Usage ID `0x1F`: "Headset"
3849 Headset = 0x1F,
3850 /// Usage ID `0x20`: "Hold"
3851 Hold = 0x20,
3852 /// Usage ID `0x21`: "Microphone"
3853 Microphone = 0x21,
3854 /// Usage ID `0x22`: "Coverage"
3855 Coverage = 0x22,
3856 /// Usage ID `0x23`: "Night Mode"
3857 NightMode = 0x23,
3858 /// Usage ID `0x24`: "Send Calls"
3859 SendCalls = 0x24,
3860 /// Usage ID `0x25`: "Call Pickup"
3861 CallPickup = 0x25,
3862 /// Usage ID `0x26`: "Conference"
3863 Conference = 0x26,
3864 /// Usage ID `0x27`: "Stand-by"
3865 Standby = 0x27,
3866 /// Usage ID `0x28`: "Camera On"
3867 CameraOn = 0x28,
3868 /// Usage ID `0x29`: "Camera Off"
3869 CameraOff = 0x29,
3870 /// Usage ID `0x2A`: "On-Line"
3871 OnLine = 0x2A,
3872 /// Usage ID `0x2B`: "Off-Line"
3873 OffLine = 0x2B,
3874 /// Usage ID `0x2C`: "Busy"
3875 Busy = 0x2C,
3876 /// Usage ID `0x2D`: "Ready"
3877 Ready = 0x2D,
3878 /// Usage ID `0x2E`: "Paper-Out"
3879 PaperOut = 0x2E,
3880 /// Usage ID `0x2F`: "Paper-Jam"
3881 PaperJam = 0x2F,
3882 /// Usage ID `0x30`: "Remote"
3883 Remote = 0x30,
3884 /// Usage ID `0x31`: "Forward"
3885 Forward = 0x31,
3886 /// Usage ID `0x32`: "Reverse"
3887 Reverse = 0x32,
3888 /// Usage ID `0x33`: "Stop"
3889 Stop = 0x33,
3890 /// Usage ID `0x34`: "Rewind"
3891 Rewind = 0x34,
3892 /// Usage ID `0x35`: "Fast Forward"
3893 FastForward = 0x35,
3894 /// Usage ID `0x36`: "Play"
3895 Play = 0x36,
3896 /// Usage ID `0x37`: "Pause"
3897 Pause = 0x37,
3898 /// Usage ID `0x38`: "Record"
3899 Record = 0x38,
3900 /// Usage ID `0x39`: "Error"
3901 Error = 0x39,
3902 /// Usage ID `0x3A`: "Usage Selected Indicator"
3903 UsageSelectedIndicator = 0x3A,
3904 /// Usage ID `0x3B`: "Usage In Use Indicator"
3905 UsageInUseIndicator = 0x3B,
3906 /// Usage ID `0x3C`: "Usage Multi Mode Indicator"
3907 UsageMultiModeIndicator = 0x3C,
3908 /// Usage ID `0x3D`: "Indicator On"
3909 IndicatorOn = 0x3D,
3910 /// Usage ID `0x3E`: "Indicator Flash"
3911 IndicatorFlash = 0x3E,
3912 /// Usage ID `0x3F`: "Indicator Slow Blink"
3913 IndicatorSlowBlink = 0x3F,
3914 /// Usage ID `0x40`: "Indicator Fast Blink"
3915 IndicatorFastBlink = 0x40,
3916 /// Usage ID `0x41`: "Indicator Off"
3917 IndicatorOff = 0x41,
3918 /// Usage ID `0x42`: "Flash On Time"
3919 FlashOnTime = 0x42,
3920 /// Usage ID `0x43`: "Slow Blink On Time"
3921 SlowBlinkOnTime = 0x43,
3922 /// Usage ID `0x44`: "Slow Blink Off Time"
3923 SlowBlinkOffTime = 0x44,
3924 /// Usage ID `0x45`: "Fast Blink On Time"
3925 FastBlinkOnTime = 0x45,
3926 /// Usage ID `0x46`: "Fast Blink Off Time"
3927 FastBlinkOffTime = 0x46,
3928 /// Usage ID `0x47`: "Usage Indicator Color"
3929 UsageIndicatorColor = 0x47,
3930 /// Usage ID `0x48`: "Indicator Red"
3931 IndicatorRed = 0x48,
3932 /// Usage ID `0x49`: "Indicator Green"
3933 IndicatorGreen = 0x49,
3934 /// Usage ID `0x4A`: "Indicator Amber"
3935 IndicatorAmber = 0x4A,
3936 /// Usage ID `0x4B`: "Generic Indicator"
3937 GenericIndicator = 0x4B,
3938 /// Usage ID `0x4C`: "System Suspend"
3939 SystemSuspend = 0x4C,
3940 /// Usage ID `0x4D`: "External Power Connected"
3941 ExternalPowerConnected = 0x4D,
3942 /// Usage ID `0x4E`: "Indicator Blue"
3943 IndicatorBlue = 0x4E,
3944 /// Usage ID `0x4F`: "Indicator Orange"
3945 IndicatorOrange = 0x4F,
3946 /// Usage ID `0x50`: "Good Status"
3947 GoodStatus = 0x50,
3948 /// Usage ID `0x51`: "Warning Status"
3949 WarningStatus = 0x51,
3950 /// Usage ID `0x52`: "RGB LED"
3951 RGBLED = 0x52,
3952 /// Usage ID `0x53`: "Red LED Channel"
3953 RedLEDChannel = 0x53,
3954 /// Usage ID `0x54`: "Blue LED Channel"
3955 BlueLEDChannel = 0x54,
3956 /// Usage ID `0x55`: "Green LED Channel"
3957 GreenLEDChannel = 0x55,
3958 /// Usage ID `0x56`: "LED Intensity"
3959 LEDIntensity = 0x56,
3960 /// Usage ID `0x57`: "System Microphone Mute"
3961 SystemMicrophoneMute = 0x57,
3962 /// Usage ID `0x60`: "Player Indicator"
3963 PlayerIndicator = 0x60,
3964 /// Usage ID `0x61`: "Player 1"
3965 Player1 = 0x61,
3966 /// Usage ID `0x62`: "Player 2"
3967 Player2 = 0x62,
3968 /// Usage ID `0x63`: "Player 3"
3969 Player3 = 0x63,
3970 /// Usage ID `0x64`: "Player 4"
3971 Player4 = 0x64,
3972 /// Usage ID `0x65`: "Player 5"
3973 Player5 = 0x65,
3974 /// Usage ID `0x66`: "Player 6"
3975 Player6 = 0x66,
3976 /// Usage ID `0x67`: "Player 7"
3977 Player7 = 0x67,
3978 /// Usage ID `0x68`: "Player 8"
3979 Player8 = 0x68,
3980 }
3981
3982 impl LED {
3983 #[cfg(feature = "std")]
3984 pub fn name(&self) -> String {
3985 match self {
3986 LED::NumLock => "Num Lock",
3987 LED::CapsLock => "Caps Lock",
3988 LED::ScrollLock => "Scroll Lock",
3989 LED::Compose => "Compose",
3990 LED::Kana => "Kana",
3991 LED::Power => "Power",
3992 LED::Shift => "Shift",
3993 LED::DoNotDisturb => "Do Not Disturb",
3994 LED::Mute => "Mute",
3995 LED::ToneEnable => "Tone Enable",
3996 LED::HighCutFilter => "High Cut Filter",
3997 LED::LowCutFilter => "Low Cut Filter",
3998 LED::EqualizerEnable => "Equalizer Enable",
3999 LED::SoundFieldOn => "Sound Field On",
4000 LED::SurroundOn => "Surround On",
4001 LED::Repeat => "Repeat",
4002 LED::Stereo => "Stereo",
4003 LED::SamplingRateDetect => "Sampling Rate Detect",
4004 LED::Spinning => "Spinning",
4005 LED::CAV => "CAV",
4006 LED::CLV => "CLV",
4007 LED::RecordingFormatDetect => "Recording Format Detect",
4008 LED::OffHook => "Off-Hook",
4009 LED::Ring => "Ring",
4010 LED::MessageWaiting => "Message Waiting",
4011 LED::DataMode => "Data Mode",
4012 LED::BatteryOperation => "Battery Operation",
4013 LED::BatteryOK => "Battery OK",
4014 LED::BatteryLow => "Battery Low",
4015 LED::Speaker => "Speaker",
4016 LED::Headset => "Headset",
4017 LED::Hold => "Hold",
4018 LED::Microphone => "Microphone",
4019 LED::Coverage => "Coverage",
4020 LED::NightMode => "Night Mode",
4021 LED::SendCalls => "Send Calls",
4022 LED::CallPickup => "Call Pickup",
4023 LED::Conference => "Conference",
4024 LED::Standby => "Stand-by",
4025 LED::CameraOn => "Camera On",
4026 LED::CameraOff => "Camera Off",
4027 LED::OnLine => "On-Line",
4028 LED::OffLine => "Off-Line",
4029 LED::Busy => "Busy",
4030 LED::Ready => "Ready",
4031 LED::PaperOut => "Paper-Out",
4032 LED::PaperJam => "Paper-Jam",
4033 LED::Remote => "Remote",
4034 LED::Forward => "Forward",
4035 LED::Reverse => "Reverse",
4036 LED::Stop => "Stop",
4037 LED::Rewind => "Rewind",
4038 LED::FastForward => "Fast Forward",
4039 LED::Play => "Play",
4040 LED::Pause => "Pause",
4041 LED::Record => "Record",
4042 LED::Error => "Error",
4043 LED::UsageSelectedIndicator => "Usage Selected Indicator",
4044 LED::UsageInUseIndicator => "Usage In Use Indicator",
4045 LED::UsageMultiModeIndicator => "Usage Multi Mode Indicator",
4046 LED::IndicatorOn => "Indicator On",
4047 LED::IndicatorFlash => "Indicator Flash",
4048 LED::IndicatorSlowBlink => "Indicator Slow Blink",
4049 LED::IndicatorFastBlink => "Indicator Fast Blink",
4050 LED::IndicatorOff => "Indicator Off",
4051 LED::FlashOnTime => "Flash On Time",
4052 LED::SlowBlinkOnTime => "Slow Blink On Time",
4053 LED::SlowBlinkOffTime => "Slow Blink Off Time",
4054 LED::FastBlinkOnTime => "Fast Blink On Time",
4055 LED::FastBlinkOffTime => "Fast Blink Off Time",
4056 LED::UsageIndicatorColor => "Usage Indicator Color",
4057 LED::IndicatorRed => "Indicator Red",
4058 LED::IndicatorGreen => "Indicator Green",
4059 LED::IndicatorAmber => "Indicator Amber",
4060 LED::GenericIndicator => "Generic Indicator",
4061 LED::SystemSuspend => "System Suspend",
4062 LED::ExternalPowerConnected => "External Power Connected",
4063 LED::IndicatorBlue => "Indicator Blue",
4064 LED::IndicatorOrange => "Indicator Orange",
4065 LED::GoodStatus => "Good Status",
4066 LED::WarningStatus => "Warning Status",
4067 LED::RGBLED => "RGB LED",
4068 LED::RedLEDChannel => "Red LED Channel",
4069 LED::BlueLEDChannel => "Blue LED Channel",
4070 LED::GreenLEDChannel => "Green LED Channel",
4071 LED::LEDIntensity => "LED Intensity",
4072 LED::SystemMicrophoneMute => "System Microphone Mute",
4073 LED::PlayerIndicator => "Player Indicator",
4074 LED::Player1 => "Player 1",
4075 LED::Player2 => "Player 2",
4076 LED::Player3 => "Player 3",
4077 LED::Player4 => "Player 4",
4078 LED::Player5 => "Player 5",
4079 LED::Player6 => "Player 6",
4080 LED::Player7 => "Player 7",
4081 LED::Player8 => "Player 8",
4082 }
4083 .into()
4084 }
4085 }
4086
4087 #[cfg(feature = "std")]
4088 impl fmt::Display for LED {
4089 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
4090 write!(f, "{}", self.name())
4091 }
4092 }
4093
4094 impl AsUsage for LED {
4095 /// Returns the 32 bit Usage value of this Usage
4096 fn usage_value(&self) -> u32 {
4097 u32::from(self)
4098 }
4099
4100 /// Returns the 16 bit Usage ID value of this Usage
4101 fn usage_id_value(&self) -> u16 {
4102 u16::from(self)
4103 }
4104
4105 /// Returns this usage as [Usage::LED(self)](Usage::LED)
4106 /// This is a convenience function to avoid having
4107 /// to implement `From` for every used type in the caller.
4108 ///
4109 /// ```
4110 /// # use hut::*;
4111 /// let gd_x = GenericDesktop::X;
4112 /// let usage = Usage::from(GenericDesktop::X);
4113 /// assert!(matches!(gd_x.usage(), usage));
4114 /// ```
4115 fn usage(&self) -> Usage {
4116 Usage::from(self)
4117 }
4118 }
4119
4120 impl AsUsagePage for LED {
4121 /// Returns the 16 bit value of this UsagePage
4122 ///
4123 /// This value is `0x8` for [LED]
4124 fn usage_page_value(&self) -> u16 {
4125 let up = UsagePage::from(self);
4126 u16::from(up)
4127 }
4128
4129 /// Returns [UsagePage::LED]]
4130 fn usage_page(&self) -> UsagePage {
4131 UsagePage::from(self)
4132 }
4133 }
4134
4135 impl From<&LED> for u16 {
4136 fn from(led: &LED) -> u16 {
4137 *led as u16
4138 }
4139 }
4140
4141 impl From<LED> for u16 {
4142 /// Returns the 16bit value of this usage. This is identical
4143 /// to [LED::usage_page_value()].
4144 fn from(led: LED) -> u16 {
4145 u16::from(&led)
4146 }
4147 }
4148
4149 impl From<&LED> for u32 {
4150 /// Returns the 32 bit value of this usage. This is identical
4151 /// to [LED::usage_value()].
4152 fn from(led: &LED) -> u32 {
4153 let up = UsagePage::from(led);
4154 let up = (u16::from(&up) as u32) << 16;
4155 let id = u16::from(led) as u32;
4156 up | id
4157 }
4158 }
4159
4160 impl From<&LED> for UsagePage {
4161 /// Always returns [UsagePage::LED] and is
4162 /// identical to [LED::usage_page()].
4163 fn from(_: &LED) -> UsagePage {
4164 UsagePage::LED
4165 }
4166 }
4167
4168 impl From<LED> for UsagePage {
4169 /// Always returns [UsagePage::LED] and is
4170 /// identical to [LED::usage_page()].
4171 fn from(_: LED) -> UsagePage {
4172 UsagePage::LED
4173 }
4174 }
4175
4176 impl From<&LED> for Usage {
4177 fn from(led: &LED) -> Usage {
4178 Usage::try_from(u32::from(led)).unwrap()
4179 }
4180 }
4181
4182 impl From<LED> for Usage {
4183 fn from(led: LED) -> Usage {
4184 Usage::from(&led)
4185 }
4186 }
4187
4188 impl TryFrom<u16> for LED {
4189 type Error = HutError;
4190
4191 fn try_from(usage_id: u16) -> Result<LED> {
4192 match usage_id {
4193 1 => Ok(LED::NumLock),
4194 2 => Ok(LED::CapsLock),
4195 3 => Ok(LED::ScrollLock),
4196 4 => Ok(LED::Compose),
4197 5 => Ok(LED::Kana),
4198 6 => Ok(LED::Power),
4199 7 => Ok(LED::Shift),
4200 8 => Ok(LED::DoNotDisturb),
4201 9 => Ok(LED::Mute),
4202 10 => Ok(LED::ToneEnable),
4203 11 => Ok(LED::HighCutFilter),
4204 12 => Ok(LED::LowCutFilter),
4205 13 => Ok(LED::EqualizerEnable),
4206 14 => Ok(LED::SoundFieldOn),
4207 15 => Ok(LED::SurroundOn),
4208 16 => Ok(LED::Repeat),
4209 17 => Ok(LED::Stereo),
4210 18 => Ok(LED::SamplingRateDetect),
4211 19 => Ok(LED::Spinning),
4212 20 => Ok(LED::CAV),
4213 21 => Ok(LED::CLV),
4214 22 => Ok(LED::RecordingFormatDetect),
4215 23 => Ok(LED::OffHook),
4216 24 => Ok(LED::Ring),
4217 25 => Ok(LED::MessageWaiting),
4218 26 => Ok(LED::DataMode),
4219 27 => Ok(LED::BatteryOperation),
4220 28 => Ok(LED::BatteryOK),
4221 29 => Ok(LED::BatteryLow),
4222 30 => Ok(LED::Speaker),
4223 31 => Ok(LED::Headset),
4224 32 => Ok(LED::Hold),
4225 33 => Ok(LED::Microphone),
4226 34 => Ok(LED::Coverage),
4227 35 => Ok(LED::NightMode),
4228 36 => Ok(LED::SendCalls),
4229 37 => Ok(LED::CallPickup),
4230 38 => Ok(LED::Conference),
4231 39 => Ok(LED::Standby),
4232 40 => Ok(LED::CameraOn),
4233 41 => Ok(LED::CameraOff),
4234 42 => Ok(LED::OnLine),
4235 43 => Ok(LED::OffLine),
4236 44 => Ok(LED::Busy),
4237 45 => Ok(LED::Ready),
4238 46 => Ok(LED::PaperOut),
4239 47 => Ok(LED::PaperJam),
4240 48 => Ok(LED::Remote),
4241 49 => Ok(LED::Forward),
4242 50 => Ok(LED::Reverse),
4243 51 => Ok(LED::Stop),
4244 52 => Ok(LED::Rewind),
4245 53 => Ok(LED::FastForward),
4246 54 => Ok(LED::Play),
4247 55 => Ok(LED::Pause),
4248 56 => Ok(LED::Record),
4249 57 => Ok(LED::Error),
4250 58 => Ok(LED::UsageSelectedIndicator),
4251 59 => Ok(LED::UsageInUseIndicator),
4252 60 => Ok(LED::UsageMultiModeIndicator),
4253 61 => Ok(LED::IndicatorOn),
4254 62 => Ok(LED::IndicatorFlash),
4255 63 => Ok(LED::IndicatorSlowBlink),
4256 64 => Ok(LED::IndicatorFastBlink),
4257 65 => Ok(LED::IndicatorOff),
4258 66 => Ok(LED::FlashOnTime),
4259 67 => Ok(LED::SlowBlinkOnTime),
4260 68 => Ok(LED::SlowBlinkOffTime),
4261 69 => Ok(LED::FastBlinkOnTime),
4262 70 => Ok(LED::FastBlinkOffTime),
4263 71 => Ok(LED::UsageIndicatorColor),
4264 72 => Ok(LED::IndicatorRed),
4265 73 => Ok(LED::IndicatorGreen),
4266 74 => Ok(LED::IndicatorAmber),
4267 75 => Ok(LED::GenericIndicator),
4268 76 => Ok(LED::SystemSuspend),
4269 77 => Ok(LED::ExternalPowerConnected),
4270 78 => Ok(LED::IndicatorBlue),
4271 79 => Ok(LED::IndicatorOrange),
4272 80 => Ok(LED::GoodStatus),
4273 81 => Ok(LED::WarningStatus),
4274 82 => Ok(LED::RGBLED),
4275 83 => Ok(LED::RedLEDChannel),
4276 84 => Ok(LED::BlueLEDChannel),
4277 85 => Ok(LED::GreenLEDChannel),
4278 86 => Ok(LED::LEDIntensity),
4279 87 => Ok(LED::SystemMicrophoneMute),
4280 96 => Ok(LED::PlayerIndicator),
4281 97 => Ok(LED::Player1),
4282 98 => Ok(LED::Player2),
4283 99 => Ok(LED::Player3),
4284 100 => Ok(LED::Player4),
4285 101 => Ok(LED::Player5),
4286 102 => Ok(LED::Player6),
4287 103 => Ok(LED::Player7),
4288 104 => Ok(LED::Player8),
4289 n => Err(HutError::UnknownUsageId { usage_id: n }),
4290 }
4291 }
4292 }
4293
4294 impl BitOr<u16> for LED {
4295 type Output = Usage;
4296
4297 /// A convenience function to combine a Usage Page with
4298 /// a value.
4299 ///
4300 /// This function panics if the Usage ID value results in
4301 /// an unknown Usage. Where error checking is required,
4302 /// use [UsagePage::to_usage_from_value].
4303 fn bitor(self, usage: u16) -> Usage {
4304 let up = u16::from(self) as u32;
4305 let u = usage as u32;
4306 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
4307 }
4308 }
4309
4310 /// *Usage Page `0x9`: "Button"*
4311 ///
4312 /// **This enum is autogenerated from the HID Usage Tables**.
4313 ///
4314 /// This Usage Page is generated, not defined, any Usage IDs in this Usage
4315 /// Page are simply the button number.
4316 ///
4317 /// ```
4318 /// # use hut::*;
4319 /// let u1 = Usage::Button(Button::Button(3));
4320 /// let u2 = Usage::new_from_page_and_id(0x9, 3).unwrap();
4321 /// let u3 = Usage::from(Button::Button(3));
4322 /// let u4: Usage = Button::Button(3).into();
4323 /// assert_eq!(u1, u2);
4324 /// assert_eq!(u1, u3);
4325 /// assert_eq!(u1, u4);
4326 ///
4327 /// assert!(matches!(u1.usage_page(), UsagePage::Button));
4328 /// assert_eq!(0x9, u1.usage_page_value());
4329 /// assert_eq!(3, u1.usage_id_value());
4330 /// assert_eq!((0x9 << 16) | 3, u1.usage_value());
4331 /// assert_eq!("Button 3", u1.name());
4332 /// ```
4333 #[allow(non_camel_case_types)]
4334 #[derive(Debug)]
4335 #[non_exhaustive]
4336 pub enum Button {
4337 Button(u16),
4338 }
4339
4340 impl Button {
4341 #[cfg(feature = "std")]
4342 pub fn name(&self) -> String {
4343 match self {
4344 Button::Button(button) => format!("Button {button}"),
4345 }
4346 }
4347 }
4348
4349 #[cfg(feature = "std")]
4350 impl fmt::Display for Button {
4351 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
4352 write!(f, "{}", self.name())
4353 }
4354 }
4355
4356 impl AsUsage for Button {
4357 /// Returns the 32 bit Usage value of this Usage
4358 fn usage_value(&self) -> u32 {
4359 u32::from(self)
4360 }
4361
4362 /// Returns the 16 bit Usage ID value of this Usage
4363 fn usage_id_value(&self) -> u16 {
4364 u16::from(self)
4365 }
4366
4367 /// Returns this usage as [Usage::Button(self)](Usage::Button)
4368 /// This is a convenience function to avoid having
4369 /// to implement `From` for every used type in the caller.
4370 ///
4371 /// ```
4372 /// # use hut::*;
4373 /// let gd_x = GenericDesktop::X;
4374 /// let usage = Usage::from(GenericDesktop::X);
4375 /// assert!(matches!(gd_x.usage(), usage));
4376 /// ```
4377 fn usage(&self) -> Usage {
4378 Usage::from(self)
4379 }
4380 }
4381
4382 impl AsUsagePage for Button {
4383 /// Returns the 16 bit value of this UsagePage
4384 ///
4385 /// This value is `0x9` for [Button]
4386 fn usage_page_value(&self) -> u16 {
4387 let up = UsagePage::from(self);
4388 u16::from(up)
4389 }
4390
4391 /// Returns [UsagePage::Button]]
4392 fn usage_page(&self) -> UsagePage {
4393 UsagePage::from(self)
4394 }
4395 }
4396
4397 impl From<&Button> for u16 {
4398 fn from(button: &Button) -> u16 {
4399 match *button {
4400 Button::Button(button) => button,
4401 }
4402 }
4403 }
4404
4405 impl From<Button> for u16 {
4406 /// Returns the 16bit value of this usage. This is identical
4407 /// to [Button::usage_page_value()].
4408 fn from(button: Button) -> u16 {
4409 u16::from(&button)
4410 }
4411 }
4412
4413 impl From<&Button> for u32 {
4414 /// Returns the 32 bit value of this usage. This is identical
4415 /// to [Button::usage_value()].
4416 fn from(button: &Button) -> u32 {
4417 let up = UsagePage::from(button);
4418 let up = (u16::from(&up) as u32) << 16;
4419 let id = u16::from(button) as u32;
4420 up | id
4421 }
4422 }
4423
4424 impl From<&Button> for UsagePage {
4425 /// Always returns [UsagePage::Button] and is
4426 /// identical to [Button::usage_page()].
4427 fn from(_: &Button) -> UsagePage {
4428 UsagePage::Button
4429 }
4430 }
4431
4432 impl From<Button> for UsagePage {
4433 /// Always returns [UsagePage::Button] and is
4434 /// identical to [Button::usage_page()].
4435 fn from(_: Button) -> UsagePage {
4436 UsagePage::Button
4437 }
4438 }
4439
4440 impl From<&Button> for Usage {
4441 fn from(button: &Button) -> Usage {
4442 Usage::try_from(u32::from(button)).unwrap()
4443 }
4444 }
4445
4446 impl From<Button> for Usage {
4447 fn from(button: Button) -> Usage {
4448 Usage::from(&button)
4449 }
4450 }
4451
4452 impl TryFrom<u16> for Button {
4453 type Error = HutError;
4454
4455 fn try_from(usage_id: u16) -> Result<Button> {
4456 match usage_id {
4457 n => Ok(Button::Button(n)),
4458 }
4459 }
4460 }
4461
4462 impl BitOr<u16> for Button {
4463 type Output = Usage;
4464
4465 /// A convenience function to combine a Usage Page with
4466 /// a value.
4467 ///
4468 /// This function panics if the Usage ID value results in
4469 /// an unknown Usage. Where error checking is required,
4470 /// use [UsagePage::to_usage_from_value].
4471 fn bitor(self, usage: u16) -> Usage {
4472 let up = u16::from(self) as u32;
4473 let u = usage as u32;
4474 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
4475 }
4476 }
4477
4478 /// *Usage Page `0xA`: "Ordinal"*
4479 ///
4480 /// **This enum is autogenerated from the HID Usage Tables**.
4481 ///
4482 /// This Usage Page is generated, not defined, any Usage IDs in this Usage
4483 /// Page are simply the instance number.
4484 ///
4485 /// ```
4486 /// # use hut::*;
4487 /// let u1 = Usage::Ordinal(Ordinal::Ordinal(3));
4488 /// let u2 = Usage::new_from_page_and_id(0xA, 3).unwrap();
4489 /// let u3 = Usage::from(Ordinal::Ordinal(3));
4490 /// let u4: Usage = Ordinal::Ordinal(3).into();
4491 /// assert_eq!(u1, u2);
4492 /// assert_eq!(u1, u3);
4493 /// assert_eq!(u1, u4);
4494 ///
4495 /// assert!(matches!(u1.usage_page(), UsagePage::Ordinal));
4496 /// assert_eq!(0xA, u1.usage_page_value());
4497 /// assert_eq!(3, u1.usage_id_value());
4498 /// assert_eq!((0xA << 16) | 3, u1.usage_value());
4499 /// assert_eq!("Instance 3", u1.name());
4500 /// ```
4501 #[allow(non_camel_case_types)]
4502 #[derive(Debug)]
4503 #[non_exhaustive]
4504 pub enum Ordinal {
4505 Ordinal(u16),
4506 }
4507
4508 impl Ordinal {
4509 #[cfg(feature = "std")]
4510 pub fn name(&self) -> String {
4511 match self {
4512 Ordinal::Ordinal(instance) => format!("Instance {instance}"),
4513 }
4514 }
4515 }
4516
4517 #[cfg(feature = "std")]
4518 impl fmt::Display for Ordinal {
4519 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
4520 write!(f, "{}", self.name())
4521 }
4522 }
4523
4524 impl AsUsage for Ordinal {
4525 /// Returns the 32 bit Usage value of this Usage
4526 fn usage_value(&self) -> u32 {
4527 u32::from(self)
4528 }
4529
4530 /// Returns the 16 bit Usage ID value of this Usage
4531 fn usage_id_value(&self) -> u16 {
4532 u16::from(self)
4533 }
4534
4535 /// Returns this usage as [Usage::Ordinal(self)](Usage::Ordinal)
4536 /// This is a convenience function to avoid having
4537 /// to implement `From` for every used type in the caller.
4538 ///
4539 /// ```
4540 /// # use hut::*;
4541 /// let gd_x = GenericDesktop::X;
4542 /// let usage = Usage::from(GenericDesktop::X);
4543 /// assert!(matches!(gd_x.usage(), usage));
4544 /// ```
4545 fn usage(&self) -> Usage {
4546 Usage::from(self)
4547 }
4548 }
4549
4550 impl AsUsagePage for Ordinal {
4551 /// Returns the 16 bit value of this UsagePage
4552 ///
4553 /// This value is `0xA` for [Ordinal]
4554 fn usage_page_value(&self) -> u16 {
4555 let up = UsagePage::from(self);
4556 u16::from(up)
4557 }
4558
4559 /// Returns [UsagePage::Ordinal]]
4560 fn usage_page(&self) -> UsagePage {
4561 UsagePage::from(self)
4562 }
4563 }
4564
4565 impl From<&Ordinal> for u16 {
4566 fn from(ordinal: &Ordinal) -> u16 {
4567 match *ordinal {
4568 Ordinal::Ordinal(instance) => instance,
4569 }
4570 }
4571 }
4572
4573 impl From<Ordinal> for u16 {
4574 /// Returns the 16bit value of this usage. This is identical
4575 /// to [Ordinal::usage_page_value()].
4576 fn from(ordinal: Ordinal) -> u16 {
4577 u16::from(&ordinal)
4578 }
4579 }
4580
4581 impl From<&Ordinal> for u32 {
4582 /// Returns the 32 bit value of this usage. This is identical
4583 /// to [Ordinal::usage_value()].
4584 fn from(ordinal: &Ordinal) -> u32 {
4585 let up = UsagePage::from(ordinal);
4586 let up = (u16::from(&up) as u32) << 16;
4587 let id = u16::from(ordinal) as u32;
4588 up | id
4589 }
4590 }
4591
4592 impl From<&Ordinal> for UsagePage {
4593 /// Always returns [UsagePage::Ordinal] and is
4594 /// identical to [Ordinal::usage_page()].
4595 fn from(_: &Ordinal) -> UsagePage {
4596 UsagePage::Ordinal
4597 }
4598 }
4599
4600 impl From<Ordinal> for UsagePage {
4601 /// Always returns [UsagePage::Ordinal] and is
4602 /// identical to [Ordinal::usage_page()].
4603 fn from(_: Ordinal) -> UsagePage {
4604 UsagePage::Ordinal
4605 }
4606 }
4607
4608 impl From<&Ordinal> for Usage {
4609 fn from(ordinal: &Ordinal) -> Usage {
4610 Usage::try_from(u32::from(ordinal)).unwrap()
4611 }
4612 }
4613
4614 impl From<Ordinal> for Usage {
4615 fn from(ordinal: Ordinal) -> Usage {
4616 Usage::from(&ordinal)
4617 }
4618 }
4619
4620 impl TryFrom<u16> for Ordinal {
4621 type Error = HutError;
4622
4623 fn try_from(usage_id: u16) -> Result<Ordinal> {
4624 match usage_id {
4625 n => Ok(Ordinal::Ordinal(n)),
4626 }
4627 }
4628 }
4629
4630 impl BitOr<u16> for Ordinal {
4631 type Output = Usage;
4632
4633 /// A convenience function to combine a Usage Page with
4634 /// a value.
4635 ///
4636 /// This function panics if the Usage ID value results in
4637 /// an unknown Usage. Where error checking is required,
4638 /// use [UsagePage::to_usage_from_value].
4639 fn bitor(self, usage: u16) -> Usage {
4640 let up = u16::from(self) as u32;
4641 let u = usage as u32;
4642 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
4643 }
4644 }
4645
4646 /// *Usage Page `0xB`: "Telephony Device"*
4647 ///
4648 /// **This enum is autogenerated from the HID Usage Tables**.
4649 /// ```
4650 /// # use hut::*;
4651 /// let u1 = Usage::TelephonyDevice(TelephonyDevice::AnsweringMachine);
4652 /// let u2 = Usage::new_from_page_and_id(0xB, 0x2).unwrap();
4653 /// let u3 = Usage::from(TelephonyDevice::AnsweringMachine);
4654 /// let u4: Usage = TelephonyDevice::AnsweringMachine.into();
4655 /// assert_eq!(u1, u2);
4656 /// assert_eq!(u1, u3);
4657 /// assert_eq!(u1, u4);
4658 ///
4659 /// assert!(matches!(u1.usage_page(), UsagePage::TelephonyDevice));
4660 /// assert_eq!(0xB, u1.usage_page_value());
4661 /// assert_eq!(0x2, u1.usage_id_value());
4662 /// assert_eq!((0xB << 16) | 0x2, u1.usage_value());
4663 /// assert_eq!("Answering Machine", u1.name());
4664 /// ```
4665 ///
4666 #[allow(non_camel_case_types)]
4667 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
4668 #[non_exhaustive]
4669 #[repr(u16)]
4670 pub enum TelephonyDevice {
4671 /// Usage ID `0x1`: "Phone"
4672 Phone = 0x1,
4673 /// Usage ID `0x2`: "Answering Machine"
4674 AnsweringMachine = 0x2,
4675 /// Usage ID `0x3`: "Message Controls"
4676 MessageControls = 0x3,
4677 /// Usage ID `0x4`: "Handset"
4678 Handset = 0x4,
4679 /// Usage ID `0x5`: "Headset"
4680 Headset = 0x5,
4681 /// Usage ID `0x6`: "Telephony Key Pad"
4682 TelephonyKeyPad = 0x6,
4683 /// Usage ID `0x7`: "Programmable Button"
4684 ProgrammableButton = 0x7,
4685 /// Usage ID `0x20`: "Hook Switch"
4686 HookSwitch = 0x20,
4687 /// Usage ID `0x21`: "Flash"
4688 Flash = 0x21,
4689 /// Usage ID `0x22`: "Feature"
4690 Feature = 0x22,
4691 /// Usage ID `0x23`: "Hold"
4692 Hold = 0x23,
4693 /// Usage ID `0x24`: "Redial"
4694 Redial = 0x24,
4695 /// Usage ID `0x25`: "Transfer"
4696 Transfer = 0x25,
4697 /// Usage ID `0x26`: "Drop"
4698 Drop = 0x26,
4699 /// Usage ID `0x27`: "Park"
4700 Park = 0x27,
4701 /// Usage ID `0x28`: "Forward Calls"
4702 ForwardCalls = 0x28,
4703 /// Usage ID `0x29`: "Alternate Function"
4704 AlternateFunction = 0x29,
4705 /// Usage ID `0x2A`: "Line"
4706 Line = 0x2A,
4707 /// Usage ID `0x2B`: "Speaker Phone"
4708 SpeakerPhone = 0x2B,
4709 /// Usage ID `0x2C`: "Conference"
4710 Conference = 0x2C,
4711 /// Usage ID `0x2D`: "Ring Enable"
4712 RingEnable = 0x2D,
4713 /// Usage ID `0x2E`: "Ring Select"
4714 RingSelect = 0x2E,
4715 /// Usage ID `0x2F`: "Phone Mute"
4716 PhoneMute = 0x2F,
4717 /// Usage ID `0x30`: "Caller ID"
4718 CallerID = 0x30,
4719 /// Usage ID `0x31`: "Send"
4720 Send = 0x31,
4721 /// Usage ID `0x50`: "Speed Dial"
4722 SpeedDial = 0x50,
4723 /// Usage ID `0x51`: "Store Number"
4724 StoreNumber = 0x51,
4725 /// Usage ID `0x52`: "Recall Number"
4726 RecallNumber = 0x52,
4727 /// Usage ID `0x53`: "Phone Directory"
4728 PhoneDirectory = 0x53,
4729 /// Usage ID `0x70`: "Voice Mail"
4730 VoiceMail = 0x70,
4731 /// Usage ID `0x71`: "Screen Calls"
4732 ScreenCalls = 0x71,
4733 /// Usage ID `0x72`: "Do Not Disturb"
4734 DoNotDisturb = 0x72,
4735 /// Usage ID `0x73`: "Message"
4736 Message = 0x73,
4737 /// Usage ID `0x74`: "Answer On/Off"
4738 AnswerOnOff = 0x74,
4739 /// Usage ID `0x90`: "Inside Dial Tone"
4740 InsideDialTone = 0x90,
4741 /// Usage ID `0x91`: "Outside Dial Tone"
4742 OutsideDialTone = 0x91,
4743 /// Usage ID `0x92`: "Inside Ring Tone"
4744 InsideRingTone = 0x92,
4745 /// Usage ID `0x93`: "Outside Ring Tone"
4746 OutsideRingTone = 0x93,
4747 /// Usage ID `0x94`: "Priority Ring Tone"
4748 PriorityRingTone = 0x94,
4749 /// Usage ID `0x95`: "Inside Ringback"
4750 InsideRingback = 0x95,
4751 /// Usage ID `0x96`: "Priority Ringback"
4752 PriorityRingback = 0x96,
4753 /// Usage ID `0x97`: "Line Busy Tone"
4754 LineBusyTone = 0x97,
4755 /// Usage ID `0x98`: "Reorder Tone"
4756 ReorderTone = 0x98,
4757 /// Usage ID `0x99`: "Call Waiting Tone"
4758 CallWaitingTone = 0x99,
4759 /// Usage ID `0x9A`: "Confirmation Tone 1"
4760 ConfirmationTone1 = 0x9A,
4761 /// Usage ID `0x9B`: "Confirmation Tone 2"
4762 ConfirmationTone2 = 0x9B,
4763 /// Usage ID `0x9C`: "Tones Off"
4764 TonesOff = 0x9C,
4765 /// Usage ID `0x9D`: "Outside Ringback"
4766 OutsideRingback = 0x9D,
4767 /// Usage ID `0x9E`: "Ringer"
4768 Ringer = 0x9E,
4769 /// Usage ID `0xB0`: "Phone Key 0"
4770 PhoneKey0 = 0xB0,
4771 /// Usage ID `0xB1`: "Phone Key 1"
4772 PhoneKey1 = 0xB1,
4773 /// Usage ID `0xB2`: "Phone Key 2"
4774 PhoneKey2 = 0xB2,
4775 /// Usage ID `0xB3`: "Phone Key 3"
4776 PhoneKey3 = 0xB3,
4777 /// Usage ID `0xB4`: "Phone Key 4"
4778 PhoneKey4 = 0xB4,
4779 /// Usage ID `0xB5`: "Phone Key 5"
4780 PhoneKey5 = 0xB5,
4781 /// Usage ID `0xB6`: "Phone Key 6"
4782 PhoneKey6 = 0xB6,
4783 /// Usage ID `0xB7`: "Phone Key 7"
4784 PhoneKey7 = 0xB7,
4785 /// Usage ID `0xB8`: "Phone Key 8"
4786 PhoneKey8 = 0xB8,
4787 /// Usage ID `0xB9`: "Phone Key 9"
4788 PhoneKey9 = 0xB9,
4789 /// Usage ID `0xBA`: "Phone Key Star"
4790 PhoneKeyStar = 0xBA,
4791 /// Usage ID `0xBB`: "Phone Key Pound"
4792 PhoneKeyPound = 0xBB,
4793 /// Usage ID `0xBC`: "Phone Key A"
4794 PhoneKeyA = 0xBC,
4795 /// Usage ID `0xBD`: "Phone Key B"
4796 PhoneKeyB = 0xBD,
4797 /// Usage ID `0xBE`: "Phone Key C"
4798 PhoneKeyC = 0xBE,
4799 /// Usage ID `0xBF`: "Phone Key D"
4800 PhoneKeyD = 0xBF,
4801 /// Usage ID `0xC0`: "Phone Call History Key"
4802 PhoneCallHistoryKey = 0xC0,
4803 /// Usage ID `0xC1`: "Phone Caller ID Key"
4804 PhoneCallerIDKey = 0xC1,
4805 /// Usage ID `0xC2`: "Phone Settings Key"
4806 PhoneSettingsKey = 0xC2,
4807 /// Usage ID `0xF0`: "Host Control"
4808 HostControl = 0xF0,
4809 /// Usage ID `0xF1`: "Host Available"
4810 HostAvailable = 0xF1,
4811 /// Usage ID `0xF2`: "Host Call Active"
4812 HostCallActive = 0xF2,
4813 /// Usage ID `0xF3`: "Activate Handset Audio"
4814 ActivateHandsetAudio = 0xF3,
4815 /// Usage ID `0xF4`: "Ring Type"
4816 RingType = 0xF4,
4817 /// Usage ID `0xF5`: "Re-dialable Phone Number"
4818 RedialablePhoneNumber = 0xF5,
4819 /// Usage ID `0xF8`: "Stop Ring Tone"
4820 StopRingTone = 0xF8,
4821 /// Usage ID `0xF9`: "PSTN Ring Tone"
4822 PSTNRingTone = 0xF9,
4823 /// Usage ID `0xFA`: "Host Ring Tone"
4824 HostRingTone = 0xFA,
4825 /// Usage ID `0xFB`: "Alert Sound Error"
4826 AlertSoundError = 0xFB,
4827 /// Usage ID `0xFC`: "Alert Sound Confirm"
4828 AlertSoundConfirm = 0xFC,
4829 /// Usage ID `0xFD`: "Alert Sound Notification"
4830 AlertSoundNotification = 0xFD,
4831 /// Usage ID `0xFE`: "Silent Ring"
4832 SilentRing = 0xFE,
4833 /// Usage ID `0x108`: "Email Message Waiting"
4834 EmailMessageWaiting = 0x108,
4835 /// Usage ID `0x109`: "Voicemail Message Waiting"
4836 VoicemailMessageWaiting = 0x109,
4837 /// Usage ID `0x10A`: "Host Hold"
4838 HostHold = 0x10A,
4839 /// Usage ID `0x110`: "Incoming Call History Count"
4840 IncomingCallHistoryCount = 0x110,
4841 /// Usage ID `0x111`: "Outgoing Call History Count"
4842 OutgoingCallHistoryCount = 0x111,
4843 /// Usage ID `0x112`: "Incoming Call History"
4844 IncomingCallHistory = 0x112,
4845 /// Usage ID `0x113`: "Outgoing Call History"
4846 OutgoingCallHistory = 0x113,
4847 /// Usage ID `0x114`: "Phone Locale"
4848 PhoneLocale = 0x114,
4849 /// Usage ID `0x140`: "Phone Time Second"
4850 PhoneTimeSecond = 0x140,
4851 /// Usage ID `0x141`: "Phone Time Minute"
4852 PhoneTimeMinute = 0x141,
4853 /// Usage ID `0x142`: "Phone Time Hour"
4854 PhoneTimeHour = 0x142,
4855 /// Usage ID `0x143`: "Phone Date Day"
4856 PhoneDateDay = 0x143,
4857 /// Usage ID `0x144`: "Phone Date Month"
4858 PhoneDateMonth = 0x144,
4859 /// Usage ID `0x145`: "Phone Date Year"
4860 PhoneDateYear = 0x145,
4861 /// Usage ID `0x146`: "Handset Nickname"
4862 HandsetNickname = 0x146,
4863 /// Usage ID `0x147`: "Address Book ID"
4864 AddressBookID = 0x147,
4865 /// Usage ID `0x14A`: "Call Duration"
4866 CallDuration = 0x14A,
4867 /// Usage ID `0x14B`: "Dual Mode Phone"
4868 DualModePhone = 0x14B,
4869 }
4870
4871 impl TelephonyDevice {
4872 #[cfg(feature = "std")]
4873 pub fn name(&self) -> String {
4874 match self {
4875 TelephonyDevice::Phone => "Phone",
4876 TelephonyDevice::AnsweringMachine => "Answering Machine",
4877 TelephonyDevice::MessageControls => "Message Controls",
4878 TelephonyDevice::Handset => "Handset",
4879 TelephonyDevice::Headset => "Headset",
4880 TelephonyDevice::TelephonyKeyPad => "Telephony Key Pad",
4881 TelephonyDevice::ProgrammableButton => "Programmable Button",
4882 TelephonyDevice::HookSwitch => "Hook Switch",
4883 TelephonyDevice::Flash => "Flash",
4884 TelephonyDevice::Feature => "Feature",
4885 TelephonyDevice::Hold => "Hold",
4886 TelephonyDevice::Redial => "Redial",
4887 TelephonyDevice::Transfer => "Transfer",
4888 TelephonyDevice::Drop => "Drop",
4889 TelephonyDevice::Park => "Park",
4890 TelephonyDevice::ForwardCalls => "Forward Calls",
4891 TelephonyDevice::AlternateFunction => "Alternate Function",
4892 TelephonyDevice::Line => "Line",
4893 TelephonyDevice::SpeakerPhone => "Speaker Phone",
4894 TelephonyDevice::Conference => "Conference",
4895 TelephonyDevice::RingEnable => "Ring Enable",
4896 TelephonyDevice::RingSelect => "Ring Select",
4897 TelephonyDevice::PhoneMute => "Phone Mute",
4898 TelephonyDevice::CallerID => "Caller ID",
4899 TelephonyDevice::Send => "Send",
4900 TelephonyDevice::SpeedDial => "Speed Dial",
4901 TelephonyDevice::StoreNumber => "Store Number",
4902 TelephonyDevice::RecallNumber => "Recall Number",
4903 TelephonyDevice::PhoneDirectory => "Phone Directory",
4904 TelephonyDevice::VoiceMail => "Voice Mail",
4905 TelephonyDevice::ScreenCalls => "Screen Calls",
4906 TelephonyDevice::DoNotDisturb => "Do Not Disturb",
4907 TelephonyDevice::Message => "Message",
4908 TelephonyDevice::AnswerOnOff => "Answer On/Off",
4909 TelephonyDevice::InsideDialTone => "Inside Dial Tone",
4910 TelephonyDevice::OutsideDialTone => "Outside Dial Tone",
4911 TelephonyDevice::InsideRingTone => "Inside Ring Tone",
4912 TelephonyDevice::OutsideRingTone => "Outside Ring Tone",
4913 TelephonyDevice::PriorityRingTone => "Priority Ring Tone",
4914 TelephonyDevice::InsideRingback => "Inside Ringback",
4915 TelephonyDevice::PriorityRingback => "Priority Ringback",
4916 TelephonyDevice::LineBusyTone => "Line Busy Tone",
4917 TelephonyDevice::ReorderTone => "Reorder Tone",
4918 TelephonyDevice::CallWaitingTone => "Call Waiting Tone",
4919 TelephonyDevice::ConfirmationTone1 => "Confirmation Tone 1",
4920 TelephonyDevice::ConfirmationTone2 => "Confirmation Tone 2",
4921 TelephonyDevice::TonesOff => "Tones Off",
4922 TelephonyDevice::OutsideRingback => "Outside Ringback",
4923 TelephonyDevice::Ringer => "Ringer",
4924 TelephonyDevice::PhoneKey0 => "Phone Key 0",
4925 TelephonyDevice::PhoneKey1 => "Phone Key 1",
4926 TelephonyDevice::PhoneKey2 => "Phone Key 2",
4927 TelephonyDevice::PhoneKey3 => "Phone Key 3",
4928 TelephonyDevice::PhoneKey4 => "Phone Key 4",
4929 TelephonyDevice::PhoneKey5 => "Phone Key 5",
4930 TelephonyDevice::PhoneKey6 => "Phone Key 6",
4931 TelephonyDevice::PhoneKey7 => "Phone Key 7",
4932 TelephonyDevice::PhoneKey8 => "Phone Key 8",
4933 TelephonyDevice::PhoneKey9 => "Phone Key 9",
4934 TelephonyDevice::PhoneKeyStar => "Phone Key Star",
4935 TelephonyDevice::PhoneKeyPound => "Phone Key Pound",
4936 TelephonyDevice::PhoneKeyA => "Phone Key A",
4937 TelephonyDevice::PhoneKeyB => "Phone Key B",
4938 TelephonyDevice::PhoneKeyC => "Phone Key C",
4939 TelephonyDevice::PhoneKeyD => "Phone Key D",
4940 TelephonyDevice::PhoneCallHistoryKey => "Phone Call History Key",
4941 TelephonyDevice::PhoneCallerIDKey => "Phone Caller ID Key",
4942 TelephonyDevice::PhoneSettingsKey => "Phone Settings Key",
4943 TelephonyDevice::HostControl => "Host Control",
4944 TelephonyDevice::HostAvailable => "Host Available",
4945 TelephonyDevice::HostCallActive => "Host Call Active",
4946 TelephonyDevice::ActivateHandsetAudio => "Activate Handset Audio",
4947 TelephonyDevice::RingType => "Ring Type",
4948 TelephonyDevice::RedialablePhoneNumber => "Re-dialable Phone Number",
4949 TelephonyDevice::StopRingTone => "Stop Ring Tone",
4950 TelephonyDevice::PSTNRingTone => "PSTN Ring Tone",
4951 TelephonyDevice::HostRingTone => "Host Ring Tone",
4952 TelephonyDevice::AlertSoundError => "Alert Sound Error",
4953 TelephonyDevice::AlertSoundConfirm => "Alert Sound Confirm",
4954 TelephonyDevice::AlertSoundNotification => "Alert Sound Notification",
4955 TelephonyDevice::SilentRing => "Silent Ring",
4956 TelephonyDevice::EmailMessageWaiting => "Email Message Waiting",
4957 TelephonyDevice::VoicemailMessageWaiting => "Voicemail Message Waiting",
4958 TelephonyDevice::HostHold => "Host Hold",
4959 TelephonyDevice::IncomingCallHistoryCount => "Incoming Call History Count",
4960 TelephonyDevice::OutgoingCallHistoryCount => "Outgoing Call History Count",
4961 TelephonyDevice::IncomingCallHistory => "Incoming Call History",
4962 TelephonyDevice::OutgoingCallHistory => "Outgoing Call History",
4963 TelephonyDevice::PhoneLocale => "Phone Locale",
4964 TelephonyDevice::PhoneTimeSecond => "Phone Time Second",
4965 TelephonyDevice::PhoneTimeMinute => "Phone Time Minute",
4966 TelephonyDevice::PhoneTimeHour => "Phone Time Hour",
4967 TelephonyDevice::PhoneDateDay => "Phone Date Day",
4968 TelephonyDevice::PhoneDateMonth => "Phone Date Month",
4969 TelephonyDevice::PhoneDateYear => "Phone Date Year",
4970 TelephonyDevice::HandsetNickname => "Handset Nickname",
4971 TelephonyDevice::AddressBookID => "Address Book ID",
4972 TelephonyDevice::CallDuration => "Call Duration",
4973 TelephonyDevice::DualModePhone => "Dual Mode Phone",
4974 }
4975 .into()
4976 }
4977 }
4978
4979 #[cfg(feature = "std")]
4980 impl fmt::Display for TelephonyDevice {
4981 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
4982 write!(f, "{}", self.name())
4983 }
4984 }
4985
4986 impl AsUsage for TelephonyDevice {
4987 /// Returns the 32 bit Usage value of this Usage
4988 fn usage_value(&self) -> u32 {
4989 u32::from(self)
4990 }
4991
4992 /// Returns the 16 bit Usage ID value of this Usage
4993 fn usage_id_value(&self) -> u16 {
4994 u16::from(self)
4995 }
4996
4997 /// Returns this usage as [Usage::TelephonyDevice(self)](Usage::TelephonyDevice)
4998 /// This is a convenience function to avoid having
4999 /// to implement `From` for every used type in the caller.
5000 ///
5001 /// ```
5002 /// # use hut::*;
5003 /// let gd_x = GenericDesktop::X;
5004 /// let usage = Usage::from(GenericDesktop::X);
5005 /// assert!(matches!(gd_x.usage(), usage));
5006 /// ```
5007 fn usage(&self) -> Usage {
5008 Usage::from(self)
5009 }
5010 }
5011
5012 impl AsUsagePage for TelephonyDevice {
5013 /// Returns the 16 bit value of this UsagePage
5014 ///
5015 /// This value is `0xB` for [TelephonyDevice]
5016 fn usage_page_value(&self) -> u16 {
5017 let up = UsagePage::from(self);
5018 u16::from(up)
5019 }
5020
5021 /// Returns [UsagePage::TelephonyDevice]]
5022 fn usage_page(&self) -> UsagePage {
5023 UsagePage::from(self)
5024 }
5025 }
5026
5027 impl From<&TelephonyDevice> for u16 {
5028 fn from(telephonydevice: &TelephonyDevice) -> u16 {
5029 *telephonydevice as u16
5030 }
5031 }
5032
5033 impl From<TelephonyDevice> for u16 {
5034 /// Returns the 16bit value of this usage. This is identical
5035 /// to [TelephonyDevice::usage_page_value()].
5036 fn from(telephonydevice: TelephonyDevice) -> u16 {
5037 u16::from(&telephonydevice)
5038 }
5039 }
5040
5041 impl From<&TelephonyDevice> for u32 {
5042 /// Returns the 32 bit value of this usage. This is identical
5043 /// to [TelephonyDevice::usage_value()].
5044 fn from(telephonydevice: &TelephonyDevice) -> u32 {
5045 let up = UsagePage::from(telephonydevice);
5046 let up = (u16::from(&up) as u32) << 16;
5047 let id = u16::from(telephonydevice) as u32;
5048 up | id
5049 }
5050 }
5051
5052 impl From<&TelephonyDevice> for UsagePage {
5053 /// Always returns [UsagePage::TelephonyDevice] and is
5054 /// identical to [TelephonyDevice::usage_page()].
5055 fn from(_: &TelephonyDevice) -> UsagePage {
5056 UsagePage::TelephonyDevice
5057 }
5058 }
5059
5060 impl From<TelephonyDevice> for UsagePage {
5061 /// Always returns [UsagePage::TelephonyDevice] and is
5062 /// identical to [TelephonyDevice::usage_page()].
5063 fn from(_: TelephonyDevice) -> UsagePage {
5064 UsagePage::TelephonyDevice
5065 }
5066 }
5067
5068 impl From<&TelephonyDevice> for Usage {
5069 fn from(telephonydevice: &TelephonyDevice) -> Usage {
5070 Usage::try_from(u32::from(telephonydevice)).unwrap()
5071 }
5072 }
5073
5074 impl From<TelephonyDevice> for Usage {
5075 fn from(telephonydevice: TelephonyDevice) -> Usage {
5076 Usage::from(&telephonydevice)
5077 }
5078 }
5079
5080 impl TryFrom<u16> for TelephonyDevice {
5081 type Error = HutError;
5082
5083 fn try_from(usage_id: u16) -> Result<TelephonyDevice> {
5084 match usage_id {
5085 1 => Ok(TelephonyDevice::Phone),
5086 2 => Ok(TelephonyDevice::AnsweringMachine),
5087 3 => Ok(TelephonyDevice::MessageControls),
5088 4 => Ok(TelephonyDevice::Handset),
5089 5 => Ok(TelephonyDevice::Headset),
5090 6 => Ok(TelephonyDevice::TelephonyKeyPad),
5091 7 => Ok(TelephonyDevice::ProgrammableButton),
5092 32 => Ok(TelephonyDevice::HookSwitch),
5093 33 => Ok(TelephonyDevice::Flash),
5094 34 => Ok(TelephonyDevice::Feature),
5095 35 => Ok(TelephonyDevice::Hold),
5096 36 => Ok(TelephonyDevice::Redial),
5097 37 => Ok(TelephonyDevice::Transfer),
5098 38 => Ok(TelephonyDevice::Drop),
5099 39 => Ok(TelephonyDevice::Park),
5100 40 => Ok(TelephonyDevice::ForwardCalls),
5101 41 => Ok(TelephonyDevice::AlternateFunction),
5102 42 => Ok(TelephonyDevice::Line),
5103 43 => Ok(TelephonyDevice::SpeakerPhone),
5104 44 => Ok(TelephonyDevice::Conference),
5105 45 => Ok(TelephonyDevice::RingEnable),
5106 46 => Ok(TelephonyDevice::RingSelect),
5107 47 => Ok(TelephonyDevice::PhoneMute),
5108 48 => Ok(TelephonyDevice::CallerID),
5109 49 => Ok(TelephonyDevice::Send),
5110 80 => Ok(TelephonyDevice::SpeedDial),
5111 81 => Ok(TelephonyDevice::StoreNumber),
5112 82 => Ok(TelephonyDevice::RecallNumber),
5113 83 => Ok(TelephonyDevice::PhoneDirectory),
5114 112 => Ok(TelephonyDevice::VoiceMail),
5115 113 => Ok(TelephonyDevice::ScreenCalls),
5116 114 => Ok(TelephonyDevice::DoNotDisturb),
5117 115 => Ok(TelephonyDevice::Message),
5118 116 => Ok(TelephonyDevice::AnswerOnOff),
5119 144 => Ok(TelephonyDevice::InsideDialTone),
5120 145 => Ok(TelephonyDevice::OutsideDialTone),
5121 146 => Ok(TelephonyDevice::InsideRingTone),
5122 147 => Ok(TelephonyDevice::OutsideRingTone),
5123 148 => Ok(TelephonyDevice::PriorityRingTone),
5124 149 => Ok(TelephonyDevice::InsideRingback),
5125 150 => Ok(TelephonyDevice::PriorityRingback),
5126 151 => Ok(TelephonyDevice::LineBusyTone),
5127 152 => Ok(TelephonyDevice::ReorderTone),
5128 153 => Ok(TelephonyDevice::CallWaitingTone),
5129 154 => Ok(TelephonyDevice::ConfirmationTone1),
5130 155 => Ok(TelephonyDevice::ConfirmationTone2),
5131 156 => Ok(TelephonyDevice::TonesOff),
5132 157 => Ok(TelephonyDevice::OutsideRingback),
5133 158 => Ok(TelephonyDevice::Ringer),
5134 176 => Ok(TelephonyDevice::PhoneKey0),
5135 177 => Ok(TelephonyDevice::PhoneKey1),
5136 178 => Ok(TelephonyDevice::PhoneKey2),
5137 179 => Ok(TelephonyDevice::PhoneKey3),
5138 180 => Ok(TelephonyDevice::PhoneKey4),
5139 181 => Ok(TelephonyDevice::PhoneKey5),
5140 182 => Ok(TelephonyDevice::PhoneKey6),
5141 183 => Ok(TelephonyDevice::PhoneKey7),
5142 184 => Ok(TelephonyDevice::PhoneKey8),
5143 185 => Ok(TelephonyDevice::PhoneKey9),
5144 186 => Ok(TelephonyDevice::PhoneKeyStar),
5145 187 => Ok(TelephonyDevice::PhoneKeyPound),
5146 188 => Ok(TelephonyDevice::PhoneKeyA),
5147 189 => Ok(TelephonyDevice::PhoneKeyB),
5148 190 => Ok(TelephonyDevice::PhoneKeyC),
5149 191 => Ok(TelephonyDevice::PhoneKeyD),
5150 192 => Ok(TelephonyDevice::PhoneCallHistoryKey),
5151 193 => Ok(TelephonyDevice::PhoneCallerIDKey),
5152 194 => Ok(TelephonyDevice::PhoneSettingsKey),
5153 240 => Ok(TelephonyDevice::HostControl),
5154 241 => Ok(TelephonyDevice::HostAvailable),
5155 242 => Ok(TelephonyDevice::HostCallActive),
5156 243 => Ok(TelephonyDevice::ActivateHandsetAudio),
5157 244 => Ok(TelephonyDevice::RingType),
5158 245 => Ok(TelephonyDevice::RedialablePhoneNumber),
5159 248 => Ok(TelephonyDevice::StopRingTone),
5160 249 => Ok(TelephonyDevice::PSTNRingTone),
5161 250 => Ok(TelephonyDevice::HostRingTone),
5162 251 => Ok(TelephonyDevice::AlertSoundError),
5163 252 => Ok(TelephonyDevice::AlertSoundConfirm),
5164 253 => Ok(TelephonyDevice::AlertSoundNotification),
5165 254 => Ok(TelephonyDevice::SilentRing),
5166 264 => Ok(TelephonyDevice::EmailMessageWaiting),
5167 265 => Ok(TelephonyDevice::VoicemailMessageWaiting),
5168 266 => Ok(TelephonyDevice::HostHold),
5169 272 => Ok(TelephonyDevice::IncomingCallHistoryCount),
5170 273 => Ok(TelephonyDevice::OutgoingCallHistoryCount),
5171 274 => Ok(TelephonyDevice::IncomingCallHistory),
5172 275 => Ok(TelephonyDevice::OutgoingCallHistory),
5173 276 => Ok(TelephonyDevice::PhoneLocale),
5174 320 => Ok(TelephonyDevice::PhoneTimeSecond),
5175 321 => Ok(TelephonyDevice::PhoneTimeMinute),
5176 322 => Ok(TelephonyDevice::PhoneTimeHour),
5177 323 => Ok(TelephonyDevice::PhoneDateDay),
5178 324 => Ok(TelephonyDevice::PhoneDateMonth),
5179 325 => Ok(TelephonyDevice::PhoneDateYear),
5180 326 => Ok(TelephonyDevice::HandsetNickname),
5181 327 => Ok(TelephonyDevice::AddressBookID),
5182 330 => Ok(TelephonyDevice::CallDuration),
5183 331 => Ok(TelephonyDevice::DualModePhone),
5184 n => Err(HutError::UnknownUsageId { usage_id: n }),
5185 }
5186 }
5187 }
5188
5189 impl BitOr<u16> for TelephonyDevice {
5190 type Output = Usage;
5191
5192 /// A convenience function to combine a Usage Page with
5193 /// a value.
5194 ///
5195 /// This function panics if the Usage ID value results in
5196 /// an unknown Usage. Where error checking is required,
5197 /// use [UsagePage::to_usage_from_value].
5198 fn bitor(self, usage: u16) -> Usage {
5199 let up = u16::from(self) as u32;
5200 let u = usage as u32;
5201 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
5202 }
5203 }
5204
5205 /// *Usage Page `0xC`: "Consumer"*
5206 ///
5207 /// **This enum is autogenerated from the HID Usage Tables**.
5208 /// ```
5209 /// # use hut::*;
5210 /// let u1 = Usage::Consumer(Consumer::NumericKeyPad);
5211 /// let u2 = Usage::new_from_page_and_id(0xC, 0x2).unwrap();
5212 /// let u3 = Usage::from(Consumer::NumericKeyPad);
5213 /// let u4: Usage = Consumer::NumericKeyPad.into();
5214 /// assert_eq!(u1, u2);
5215 /// assert_eq!(u1, u3);
5216 /// assert_eq!(u1, u4);
5217 ///
5218 /// assert!(matches!(u1.usage_page(), UsagePage::Consumer));
5219 /// assert_eq!(0xC, u1.usage_page_value());
5220 /// assert_eq!(0x2, u1.usage_id_value());
5221 /// assert_eq!((0xC << 16) | 0x2, u1.usage_value());
5222 /// assert_eq!("Numeric Key Pad", u1.name());
5223 /// ```
5224 ///
5225 #[allow(non_camel_case_types)]
5226 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
5227 #[non_exhaustive]
5228 #[repr(u16)]
5229 pub enum Consumer {
5230 /// Usage ID `0x1`: "Consumer Control"
5231 ConsumerControl = 0x1,
5232 /// Usage ID `0x2`: "Numeric Key Pad"
5233 NumericKeyPad = 0x2,
5234 /// Usage ID `0x3`: "Programmable Buttons"
5235 ProgrammableButtons = 0x3,
5236 /// Usage ID `0x4`: "Microphone"
5237 Microphone = 0x4,
5238 /// Usage ID `0x5`: "Headphone"
5239 Headphone = 0x5,
5240 /// Usage ID `0x6`: "Graphic Equalizer"
5241 GraphicEqualizer = 0x6,
5242 /// Usage ID `0x20`: "+10"
5243 Plus10 = 0x20,
5244 /// Usage ID `0x21`: "+100"
5245 Plus100 = 0x21,
5246 /// Usage ID `0x22`: "AM/PM"
5247 AMPM = 0x22,
5248 /// Usage ID `0x30`: "Power"
5249 Power = 0x30,
5250 /// Usage ID `0x31`: "Reset"
5251 Reset = 0x31,
5252 /// Usage ID `0x32`: "Sleep"
5253 Sleep = 0x32,
5254 /// Usage ID `0x33`: "Sleep After"
5255 SleepAfter = 0x33,
5256 /// Usage ID `0x34`: "Sleep Mode"
5257 SleepMode = 0x34,
5258 /// Usage ID `0x35`: "Illumination"
5259 Illumination = 0x35,
5260 /// Usage ID `0x36`: "Function Buttons"
5261 FunctionButtons = 0x36,
5262 /// Usage ID `0x40`: "Menu"
5263 Menu = 0x40,
5264 /// Usage ID `0x41`: "Menu Pick"
5265 MenuPick = 0x41,
5266 /// Usage ID `0x42`: "Menu Up"
5267 MenuUp = 0x42,
5268 /// Usage ID `0x43`: "Menu Down"
5269 MenuDown = 0x43,
5270 /// Usage ID `0x44`: "Menu Left"
5271 MenuLeft = 0x44,
5272 /// Usage ID `0x45`: "Menu Right"
5273 MenuRight = 0x45,
5274 /// Usage ID `0x46`: "Menu Escape"
5275 MenuEscape = 0x46,
5276 /// Usage ID `0x47`: "Menu Value Increase"
5277 MenuValueIncrease = 0x47,
5278 /// Usage ID `0x48`: "Menu Value Decrease"
5279 MenuValueDecrease = 0x48,
5280 /// Usage ID `0x60`: "Data On Screen"
5281 DataOnScreen = 0x60,
5282 /// Usage ID `0x61`: "Closed Caption"
5283 ClosedCaption = 0x61,
5284 /// Usage ID `0x62`: "Closed Caption Select"
5285 ClosedCaptionSelect = 0x62,
5286 /// Usage ID `0x63`: "VCR/TV"
5287 VCRTV = 0x63,
5288 /// Usage ID `0x64`: "Broadcast Mode"
5289 BroadcastMode = 0x64,
5290 /// Usage ID `0x65`: "Snapshot"
5291 Snapshot = 0x65,
5292 /// Usage ID `0x66`: "Still"
5293 Still = 0x66,
5294 /// Usage ID `0x67`: "Picture-in-Picture Toggle"
5295 PictureinPictureToggle = 0x67,
5296 /// Usage ID `0x68`: "Picture-in-Picture Swap"
5297 PictureinPictureSwap = 0x68,
5298 /// Usage ID `0x69`: "Red Menu Button"
5299 RedMenuButton = 0x69,
5300 /// Usage ID `0x6A`: "Green Menu Button"
5301 GreenMenuButton = 0x6A,
5302 /// Usage ID `0x6B`: "Blue Menu Button"
5303 BlueMenuButton = 0x6B,
5304 /// Usage ID `0x6C`: "Yellow Menu Button"
5305 YellowMenuButton = 0x6C,
5306 /// Usage ID `0x6D`: "Aspect"
5307 Aspect = 0x6D,
5308 /// Usage ID `0x6E`: "3D Mode Select"
5309 ThreeDModeSelect = 0x6E,
5310 /// Usage ID `0x6F`: "Display Brightness Increment"
5311 DisplayBrightnessIncrement = 0x6F,
5312 /// Usage ID `0x70`: "Display Brightness Decrement"
5313 DisplayBrightnessDecrement = 0x70,
5314 /// Usage ID `0x71`: "Display Brightness"
5315 DisplayBrightness = 0x71,
5316 /// Usage ID `0x72`: "Display Backlight Toggle"
5317 DisplayBacklightToggle = 0x72,
5318 /// Usage ID `0x73`: "Display Set Brightness to Minimum"
5319 DisplaySetBrightnesstoMinimum = 0x73,
5320 /// Usage ID `0x74`: "Display Set Brightness to Maximum"
5321 DisplaySetBrightnesstoMaximum = 0x74,
5322 /// Usage ID `0x75`: "Display Set Auto Brightness"
5323 DisplaySetAutoBrightness = 0x75,
5324 /// Usage ID `0x76`: "Camera Access Enabled"
5325 CameraAccessEnabled = 0x76,
5326 /// Usage ID `0x77`: "Camera Access Disabled"
5327 CameraAccessDisabled = 0x77,
5328 /// Usage ID `0x78`: "Camera Access Toggle"
5329 CameraAccessToggle = 0x78,
5330 /// Usage ID `0x79`: "Keyboard Brightness Increment"
5331 KeyboardBrightnessIncrement = 0x79,
5332 /// Usage ID `0x7A`: "Keyboard Brightness Decrement"
5333 KeyboardBrightnessDecrement = 0x7A,
5334 /// Usage ID `0x7B`: "Keyboard Backlight Set Level"
5335 KeyboardBacklightSetLevel = 0x7B,
5336 /// Usage ID `0x7C`: "Keyboard Backlight OOC"
5337 KeyboardBacklightOOC = 0x7C,
5338 /// Usage ID `0x7D`: "Keyboard Backlight Set Minimum"
5339 KeyboardBacklightSetMinimum = 0x7D,
5340 /// Usage ID `0x7E`: "Keyboard Backlight Set Maximum"
5341 KeyboardBacklightSetMaximum = 0x7E,
5342 /// Usage ID `0x7F`: "Keyboard Backlight Auto"
5343 KeyboardBacklightAuto = 0x7F,
5344 /// Usage ID `0x80`: "Selection"
5345 Selection = 0x80,
5346 /// Usage ID `0x81`: "Assign Selection"
5347 AssignSelection = 0x81,
5348 /// Usage ID `0x82`: "Mode Step"
5349 ModeStep = 0x82,
5350 /// Usage ID `0x83`: "Recall Last"
5351 RecallLast = 0x83,
5352 /// Usage ID `0x84`: "Enter Channel"
5353 EnterChannel = 0x84,
5354 /// Usage ID `0x85`: "Order Movie"
5355 OrderMovie = 0x85,
5356 /// Usage ID `0x86`: "Channel"
5357 Channel = 0x86,
5358 /// Usage ID `0x87`: "Media Selection"
5359 MediaSelection = 0x87,
5360 /// Usage ID `0x88`: "Media Select Computer"
5361 MediaSelectComputer = 0x88,
5362 /// Usage ID `0x89`: "Media Select TV"
5363 MediaSelectTV = 0x89,
5364 /// Usage ID `0x8A`: "Media Select WWW"
5365 MediaSelectWWW = 0x8A,
5366 /// Usage ID `0x8B`: "Media Select DVD"
5367 MediaSelectDVD = 0x8B,
5368 /// Usage ID `0x8C`: "Media Select Telephone"
5369 MediaSelectTelephone = 0x8C,
5370 /// Usage ID `0x8D`: "Media Select Program Guide"
5371 MediaSelectProgramGuide = 0x8D,
5372 /// Usage ID `0x8E`: "Media Select Video Phone"
5373 MediaSelectVideoPhone = 0x8E,
5374 /// Usage ID `0x8F`: "Media Select Games"
5375 MediaSelectGames = 0x8F,
5376 /// Usage ID `0x90`: "Media Select Messages"
5377 MediaSelectMessages = 0x90,
5378 /// Usage ID `0x91`: "Media Select CD"
5379 MediaSelectCD = 0x91,
5380 /// Usage ID `0x92`: "Media Select VCR"
5381 MediaSelectVCR = 0x92,
5382 /// Usage ID `0x93`: "Media Select Tuner"
5383 MediaSelectTuner = 0x93,
5384 /// Usage ID `0x94`: "Quit"
5385 Quit = 0x94,
5386 /// Usage ID `0x95`: "Help"
5387 Help = 0x95,
5388 /// Usage ID `0x96`: "Media Select Tape"
5389 MediaSelectTape = 0x96,
5390 /// Usage ID `0x97`: "Media Select Cable"
5391 MediaSelectCable = 0x97,
5392 /// Usage ID `0x98`: "Media Select Satellite"
5393 MediaSelectSatellite = 0x98,
5394 /// Usage ID `0x99`: "Media Select Security"
5395 MediaSelectSecurity = 0x99,
5396 /// Usage ID `0x9A`: "Media Select Home"
5397 MediaSelectHome = 0x9A,
5398 /// Usage ID `0x9B`: "Media Select Call"
5399 MediaSelectCall = 0x9B,
5400 /// Usage ID `0x9C`: "Channel Increment"
5401 ChannelIncrement = 0x9C,
5402 /// Usage ID `0x9D`: "Channel Decrement"
5403 ChannelDecrement = 0x9D,
5404 /// Usage ID `0x9E`: "Media Select SAP"
5405 MediaSelectSAP = 0x9E,
5406 /// Usage ID `0xA0`: "VCR Plus"
5407 VCRPlus = 0xA0,
5408 /// Usage ID `0xA1`: "Once"
5409 Once = 0xA1,
5410 /// Usage ID `0xA2`: "Daily"
5411 Daily = 0xA2,
5412 /// Usage ID `0xA3`: "Weekly"
5413 Weekly = 0xA3,
5414 /// Usage ID `0xA4`: "Monthly"
5415 Monthly = 0xA4,
5416 /// Usage ID `0xB0`: "Play"
5417 Play = 0xB0,
5418 /// Usage ID `0xB1`: "Pause"
5419 Pause = 0xB1,
5420 /// Usage ID `0xB2`: "Record"
5421 Record = 0xB2,
5422 /// Usage ID `0xB3`: "Fast Forward"
5423 FastForward = 0xB3,
5424 /// Usage ID `0xB4`: "Rewind"
5425 Rewind = 0xB4,
5426 /// Usage ID `0xB5`: "Scan Next Track"
5427 ScanNextTrack = 0xB5,
5428 /// Usage ID `0xB6`: "Scan Previous Track"
5429 ScanPreviousTrack = 0xB6,
5430 /// Usage ID `0xB7`: "Stop"
5431 Stop = 0xB7,
5432 /// Usage ID `0xB8`: "Eject"
5433 Eject = 0xB8,
5434 /// Usage ID `0xB9`: "Random Play"
5435 RandomPlay = 0xB9,
5436 /// Usage ID `0xBA`: "Select Disc"
5437 SelectDisc = 0xBA,
5438 /// Usage ID `0xBB`: "Enter Disc"
5439 EnterDisc = 0xBB,
5440 /// Usage ID `0xBC`: "Repeat"
5441 Repeat = 0xBC,
5442 /// Usage ID `0xBD`: "Tracking"
5443 Tracking = 0xBD,
5444 /// Usage ID `0xBE`: "Track Normal"
5445 TrackNormal = 0xBE,
5446 /// Usage ID `0xBF`: "Slow Tracking"
5447 SlowTracking = 0xBF,
5448 /// Usage ID `0xC0`: "Frame Forward"
5449 FrameForward = 0xC0,
5450 /// Usage ID `0xC1`: "Frame Back"
5451 FrameBack = 0xC1,
5452 /// Usage ID `0xC2`: "Mark"
5453 Mark = 0xC2,
5454 /// Usage ID `0xC3`: "Clear Mark"
5455 ClearMark = 0xC3,
5456 /// Usage ID `0xC4`: "Repeat From Mark"
5457 RepeatFromMark = 0xC4,
5458 /// Usage ID `0xC5`: "Return To Mark"
5459 ReturnToMark = 0xC5,
5460 /// Usage ID `0xC6`: "Search Mark Forward"
5461 SearchMarkForward = 0xC6,
5462 /// Usage ID `0xC7`: "Search Mark Backwards"
5463 SearchMarkBackwards = 0xC7,
5464 /// Usage ID `0xC8`: "Counter Reset"
5465 CounterReset = 0xC8,
5466 /// Usage ID `0xC9`: "Show Counter"
5467 ShowCounter = 0xC9,
5468 /// Usage ID `0xCA`: "Tracking Increment"
5469 TrackingIncrement = 0xCA,
5470 /// Usage ID `0xCB`: "Tracking Decrement"
5471 TrackingDecrement = 0xCB,
5472 /// Usage ID `0xCC`: "Stop/Eject"
5473 StopEject = 0xCC,
5474 /// Usage ID `0xCD`: "Play/Pause"
5475 PlayPause = 0xCD,
5476 /// Usage ID `0xCE`: "Play/Skip"
5477 PlaySkip = 0xCE,
5478 /// Usage ID `0xCF`: "Voice Command"
5479 VoiceCommand = 0xCF,
5480 /// Usage ID `0xD0`: "Invoke Capture Interface"
5481 InvokeCaptureInterface = 0xD0,
5482 /// Usage ID `0xD1`: "Start or Stop Game Recording"
5483 StartorStopGameRecording = 0xD1,
5484 /// Usage ID `0xD2`: "Historical Game Capture"
5485 HistoricalGameCapture = 0xD2,
5486 /// Usage ID `0xD3`: "Capture Game Screenshot"
5487 CaptureGameScreenshot = 0xD3,
5488 /// Usage ID `0xD4`: "Show or Hide Recording Indicator"
5489 ShoworHideRecordingIndicator = 0xD4,
5490 /// Usage ID `0xD5`: "Start or Stop Microphone Capture"
5491 StartorStopMicrophoneCapture = 0xD5,
5492 /// Usage ID `0xD6`: "Start or Stop Camera Capture"
5493 StartorStopCameraCapture = 0xD6,
5494 /// Usage ID `0xD7`: "Start or Stop Game Broadcast"
5495 StartorStopGameBroadcast = 0xD7,
5496 /// Usage ID `0xD8`: "Start or Stop Voice Dictation Session"
5497 StartorStopVoiceDictationSession = 0xD8,
5498 /// Usage ID `0xD9`: "Invoke/Dismiss Emoji Picker"
5499 InvokeDismissEmojiPicker = 0xD9,
5500 /// Usage ID `0xE0`: "Volume"
5501 Volume = 0xE0,
5502 /// Usage ID `0xE1`: "Balance"
5503 Balance = 0xE1,
5504 /// Usage ID `0xE2`: "Mute"
5505 Mute = 0xE2,
5506 /// Usage ID `0xE3`: "Bass"
5507 Bass = 0xE3,
5508 /// Usage ID `0xE4`: "Treble"
5509 Treble = 0xE4,
5510 /// Usage ID `0xE5`: "Bass Boost"
5511 BassBoost = 0xE5,
5512 /// Usage ID `0xE6`: "Surround Mode"
5513 SurroundMode = 0xE6,
5514 /// Usage ID `0xE7`: "Loudness"
5515 Loudness = 0xE7,
5516 /// Usage ID `0xE8`: "MPX"
5517 MPX = 0xE8,
5518 /// Usage ID `0xE9`: "Volume Increment"
5519 VolumeIncrement = 0xE9,
5520 /// Usage ID `0xEA`: "Volume Decrement"
5521 VolumeDecrement = 0xEA,
5522 /// Usage ID `0xF0`: "Speed Select"
5523 SpeedSelect = 0xF0,
5524 /// Usage ID `0xF1`: "Playback Speed"
5525 PlaybackSpeed = 0xF1,
5526 /// Usage ID `0xF2`: "Standard Play"
5527 StandardPlay = 0xF2,
5528 /// Usage ID `0xF3`: "Long Play"
5529 LongPlay = 0xF3,
5530 /// Usage ID `0xF4`: "Extended Play"
5531 ExtendedPlay = 0xF4,
5532 /// Usage ID `0xF5`: "Slow"
5533 Slow = 0xF5,
5534 /// Usage ID `0x100`: "Fan Enable"
5535 FanEnable = 0x100,
5536 /// Usage ID `0x101`: "Fan Speed"
5537 FanSpeed = 0x101,
5538 /// Usage ID `0x102`: "Light Enable"
5539 LightEnable = 0x102,
5540 /// Usage ID `0x103`: "Light Illumination Level"
5541 LightIlluminationLevel = 0x103,
5542 /// Usage ID `0x104`: "Climate Control Enable"
5543 ClimateControlEnable = 0x104,
5544 /// Usage ID `0x105`: "Room Temperature"
5545 RoomTemperature = 0x105,
5546 /// Usage ID `0x106`: "Security Enable"
5547 SecurityEnable = 0x106,
5548 /// Usage ID `0x107`: "Fire Alarm"
5549 FireAlarm = 0x107,
5550 /// Usage ID `0x108`: "Police Alarm"
5551 PoliceAlarm = 0x108,
5552 /// Usage ID `0x109`: "Proximity"
5553 Proximity = 0x109,
5554 /// Usage ID `0x10A`: "Motion"
5555 Motion = 0x10A,
5556 /// Usage ID `0x10B`: "Duress Alarm"
5557 DuressAlarm = 0x10B,
5558 /// Usage ID `0x10C`: "Holdup Alarm"
5559 HoldupAlarm = 0x10C,
5560 /// Usage ID `0x10D`: "Medical Alarm"
5561 MedicalAlarm = 0x10D,
5562 /// Usage ID `0x150`: "Balance Right"
5563 BalanceRight = 0x150,
5564 /// Usage ID `0x151`: "Balance Left"
5565 BalanceLeft = 0x151,
5566 /// Usage ID `0x152`: "Bass Increment"
5567 BassIncrement = 0x152,
5568 /// Usage ID `0x153`: "Bass Decrement"
5569 BassDecrement = 0x153,
5570 /// Usage ID `0x154`: "Treble Increment"
5571 TrebleIncrement = 0x154,
5572 /// Usage ID `0x155`: "Treble Decrement"
5573 TrebleDecrement = 0x155,
5574 /// Usage ID `0x160`: "Speaker System"
5575 SpeakerSystem = 0x160,
5576 /// Usage ID `0x161`: "Channel Left"
5577 ChannelLeft = 0x161,
5578 /// Usage ID `0x162`: "Channel Right"
5579 ChannelRight = 0x162,
5580 /// Usage ID `0x163`: "Channel Center"
5581 ChannelCenter = 0x163,
5582 /// Usage ID `0x164`: "Channel Front"
5583 ChannelFront = 0x164,
5584 /// Usage ID `0x165`: "Channel Center Front"
5585 ChannelCenterFront = 0x165,
5586 /// Usage ID `0x166`: "Channel Side"
5587 ChannelSide = 0x166,
5588 /// Usage ID `0x167`: "Channel Surround"
5589 ChannelSurround = 0x167,
5590 /// Usage ID `0x168`: "Channel Low Frequency Enhancement"
5591 ChannelLowFrequencyEnhancement = 0x168,
5592 /// Usage ID `0x169`: "Channel Top"
5593 ChannelTop = 0x169,
5594 /// Usage ID `0x16A`: "Channel Unknown"
5595 ChannelUnknown = 0x16A,
5596 /// Usage ID `0x170`: "Sub-channel"
5597 Subchannel = 0x170,
5598 /// Usage ID `0x171`: "Sub-channel Increment"
5599 SubchannelIncrement = 0x171,
5600 /// Usage ID `0x172`: "Sub-channel Decrement"
5601 SubchannelDecrement = 0x172,
5602 /// Usage ID `0x173`: "Alternate Audio Increment"
5603 AlternateAudioIncrement = 0x173,
5604 /// Usage ID `0x174`: "Alternate Audio Decrement"
5605 AlternateAudioDecrement = 0x174,
5606 /// Usage ID `0x180`: "Application Launch Buttons"
5607 ApplicationLaunchButtons = 0x180,
5608 /// Usage ID `0x181`: "AL Launch Button Configuration Tool"
5609 ALLaunchButtonConfigurationTool = 0x181,
5610 /// Usage ID `0x182`: "AL Programmable Button Configuration"
5611 ALProgrammableButtonConfiguration = 0x182,
5612 /// Usage ID `0x183`: "AL Consumer Control Configuration"
5613 ALConsumerControlConfiguration = 0x183,
5614 /// Usage ID `0x184`: "AL Word Processor"
5615 ALWordProcessor = 0x184,
5616 /// Usage ID `0x185`: "AL Text Editor"
5617 ALTextEditor = 0x185,
5618 /// Usage ID `0x186`: "AL Spreadsheet"
5619 ALSpreadsheet = 0x186,
5620 /// Usage ID `0x187`: "AL Graphics Editor"
5621 ALGraphicsEditor = 0x187,
5622 /// Usage ID `0x188`: "AL Presentation App"
5623 ALPresentationApp = 0x188,
5624 /// Usage ID `0x189`: "AL Database App"
5625 ALDatabaseApp = 0x189,
5626 /// Usage ID `0x18A`: "AL Email Reader"
5627 ALEmailReader = 0x18A,
5628 /// Usage ID `0x18B`: "AL Newsreader"
5629 ALNewsreader = 0x18B,
5630 /// Usage ID `0x18C`: "AL Voicemail"
5631 ALVoicemail = 0x18C,
5632 /// Usage ID `0x18D`: "AL Contacts/Address Book"
5633 ALContactsAddressBook = 0x18D,
5634 /// Usage ID `0x18E`: "AL Calendar/Schedule"
5635 ALCalendarSchedule = 0x18E,
5636 /// Usage ID `0x18F`: "AL Task/Project Manager"
5637 ALTaskProjectManager = 0x18F,
5638 /// Usage ID `0x190`: "AL Log/Journal/Timecard"
5639 ALLogJournalTimecard = 0x190,
5640 /// Usage ID `0x191`: "AL Checkbook/Finance"
5641 ALCheckbookFinance = 0x191,
5642 /// Usage ID `0x192`: "AL Calculator"
5643 ALCalculator = 0x192,
5644 /// Usage ID `0x193`: "AL A/V Capture/Playback"
5645 ALAVCapturePlayback = 0x193,
5646 /// Usage ID `0x194`: "AL Local Machine Browser"
5647 ALLocalMachineBrowser = 0x194,
5648 /// Usage ID `0x195`: "AL LAN/WAN Browser"
5649 ALLANWANBrowser = 0x195,
5650 /// Usage ID `0x196`: "AL Internet Browser"
5651 ALInternetBrowser = 0x196,
5652 /// Usage ID `0x197`: "AL Remote Networking/ISP Connect"
5653 ALRemoteNetworkingISPConnect = 0x197,
5654 /// Usage ID `0x198`: "AL Network Conference"
5655 ALNetworkConference = 0x198,
5656 /// Usage ID `0x199`: "AL Network Chat"
5657 ALNetworkChat = 0x199,
5658 /// Usage ID `0x19A`: "AL Telephony/Dialer"
5659 ALTelephonyDialer = 0x19A,
5660 /// Usage ID `0x19B`: "AL Logon"
5661 ALLogon = 0x19B,
5662 /// Usage ID `0x19C`: "AL Logoff"
5663 ALLogoff = 0x19C,
5664 /// Usage ID `0x19D`: "AL Logon/Logoff"
5665 ALLogonLogoff = 0x19D,
5666 /// Usage ID `0x19E`: "AL Terminal Lock/Screensaver"
5667 ALTerminalLockScreensaver = 0x19E,
5668 /// Usage ID `0x19F`: "AL Control Panel"
5669 ALControlPanel = 0x19F,
5670 /// Usage ID `0x1A0`: "AL Command Line Processor/Run"
5671 ALCommandLineProcessorRun = 0x1A0,
5672 /// Usage ID `0x1A1`: "AL Process/Task Manager"
5673 ALProcessTaskManager = 0x1A1,
5674 /// Usage ID `0x1A2`: "AL Select Task/Application"
5675 ALSelectTaskApplication = 0x1A2,
5676 /// Usage ID `0x1A3`: "AL Next Task/Application"
5677 ALNextTaskApplication = 0x1A3,
5678 /// Usage ID `0x1A4`: "AL Previous Task/Application"
5679 ALPreviousTaskApplication = 0x1A4,
5680 /// Usage ID `0x1A5`: "AL Preemptive Halt Task/Application"
5681 ALPreemptiveHaltTaskApplication = 0x1A5,
5682 /// Usage ID `0x1A6`: "AL Integrated Help Center"
5683 ALIntegratedHelpCenter = 0x1A6,
5684 /// Usage ID `0x1A7`: "AL Documents"
5685 ALDocuments = 0x1A7,
5686 /// Usage ID `0x1A8`: "AL Thesaurus"
5687 ALThesaurus = 0x1A8,
5688 /// Usage ID `0x1A9`: "AL Dictionary"
5689 ALDictionary = 0x1A9,
5690 /// Usage ID `0x1AA`: "AL Desktop"
5691 ALDesktop = 0x1AA,
5692 /// Usage ID `0x1AB`: "AL Spell Check"
5693 ALSpellCheck = 0x1AB,
5694 /// Usage ID `0x1AC`: "AL Grammar Check"
5695 ALGrammarCheck = 0x1AC,
5696 /// Usage ID `0x1AD`: "AL Wireless Status"
5697 ALWirelessStatus = 0x1AD,
5698 /// Usage ID `0x1AE`: "AL Keyboard Layout"
5699 ALKeyboardLayout = 0x1AE,
5700 /// Usage ID `0x1AF`: "AL Virus Protection"
5701 ALVirusProtection = 0x1AF,
5702 /// Usage ID `0x1B0`: "AL Encryption"
5703 ALEncryption = 0x1B0,
5704 /// Usage ID `0x1B1`: "AL Screen Saver"
5705 ALScreenSaver = 0x1B1,
5706 /// Usage ID `0x1B2`: "AL Alarms"
5707 ALAlarms = 0x1B2,
5708 /// Usage ID `0x1B3`: "AL Clock"
5709 ALClock = 0x1B3,
5710 /// Usage ID `0x1B4`: "AL File Browser"
5711 ALFileBrowser = 0x1B4,
5712 /// Usage ID `0x1B5`: "AL Power Status"
5713 ALPowerStatus = 0x1B5,
5714 /// Usage ID `0x1B6`: "AL Image Browser"
5715 ALImageBrowser = 0x1B6,
5716 /// Usage ID `0x1B7`: "AL Audio Browser"
5717 ALAudioBrowser = 0x1B7,
5718 /// Usage ID `0x1B8`: "AL Movie Browser"
5719 ALMovieBrowser = 0x1B8,
5720 /// Usage ID `0x1B9`: "AL Digital Rights Manager"
5721 ALDigitalRightsManager = 0x1B9,
5722 /// Usage ID `0x1BA`: "AL Digital Wallet"
5723 ALDigitalWallet = 0x1BA,
5724 /// Usage ID `0x1BC`: "AL Instant Messaging"
5725 ALInstantMessaging = 0x1BC,
5726 /// Usage ID `0x1BD`: "AL OEM Features/ Tips/Tutorial Browser"
5727 ALOEMFeaturesTipsTutorialBrowser = 0x1BD,
5728 /// Usage ID `0x1BE`: "AL OEM Help"
5729 ALOEMHelp = 0x1BE,
5730 /// Usage ID `0x1BF`: "AL Online Community"
5731 ALOnlineCommunity = 0x1BF,
5732 /// Usage ID `0x1C0`: "AL Entertainment Content Browser"
5733 ALEntertainmentContentBrowser = 0x1C0,
5734 /// Usage ID `0x1C1`: "AL Online Shopping Browser"
5735 ALOnlineShoppingBrowser = 0x1C1,
5736 /// Usage ID `0x1C2`: "AL SmartCard Information/Help"
5737 ALSmartCardInformationHelp = 0x1C2,
5738 /// Usage ID `0x1C3`: "AL Market Monitor/Finance Browser"
5739 ALMarketMonitorFinanceBrowser = 0x1C3,
5740 /// Usage ID `0x1C4`: "AL Customized Corporate News Browser"
5741 ALCustomizedCorporateNewsBrowser = 0x1C4,
5742 /// Usage ID `0x1C5`: "AL Online Activity Browser"
5743 ALOnlineActivityBrowser = 0x1C5,
5744 /// Usage ID `0x1C6`: "AL Research/Search Browser"
5745 ALResearchSearchBrowser = 0x1C6,
5746 /// Usage ID `0x1C7`: "AL Audio Player"
5747 ALAudioPlayer = 0x1C7,
5748 /// Usage ID `0x1C8`: "AL Message Status"
5749 ALMessageStatus = 0x1C8,
5750 /// Usage ID `0x1C9`: "AL Contact Sync"
5751 ALContactSync = 0x1C9,
5752 /// Usage ID `0x1CA`: "AL Navigation"
5753 ALNavigation = 0x1CA,
5754 /// Usage ID `0x1CB`: "AL Context‐aware Desktop Assistant"
5755 ALContextawareDesktopAssistant = 0x1CB,
5756 /// Usage ID `0x200`: "Generic GUI Application Controls"
5757 GenericGUIApplicationControls = 0x200,
5758 /// Usage ID `0x201`: "AC New"
5759 ACNew = 0x201,
5760 /// Usage ID `0x202`: "AC Open"
5761 ACOpen = 0x202,
5762 /// Usage ID `0x203`: "AC Close"
5763 ACClose = 0x203,
5764 /// Usage ID `0x204`: "AC Exit"
5765 ACExit = 0x204,
5766 /// Usage ID `0x205`: "AC Maximize"
5767 ACMaximize = 0x205,
5768 /// Usage ID `0x206`: "AC Minimize"
5769 ACMinimize = 0x206,
5770 /// Usage ID `0x207`: "AC Save"
5771 ACSave = 0x207,
5772 /// Usage ID `0x208`: "AC Print"
5773 ACPrint = 0x208,
5774 /// Usage ID `0x209`: "AC Properties"
5775 ACProperties = 0x209,
5776 /// Usage ID `0x21A`: "AC Undo"
5777 ACUndo = 0x21A,
5778 /// Usage ID `0x21B`: "AC Copy"
5779 ACCopy = 0x21B,
5780 /// Usage ID `0x21C`: "AC Cut"
5781 ACCut = 0x21C,
5782 /// Usage ID `0x21D`: "AC Paste"
5783 ACPaste = 0x21D,
5784 /// Usage ID `0x21E`: "AC Select All"
5785 ACSelectAll = 0x21E,
5786 /// Usage ID `0x21F`: "AC Find"
5787 ACFind = 0x21F,
5788 /// Usage ID `0x220`: "AC Find and Replace"
5789 ACFindandReplace = 0x220,
5790 /// Usage ID `0x221`: "AC Search"
5791 ACSearch = 0x221,
5792 /// Usage ID `0x222`: "AC Go To"
5793 ACGoTo = 0x222,
5794 /// Usage ID `0x223`: "AC Home"
5795 ACHome = 0x223,
5796 /// Usage ID `0x224`: "AC Back"
5797 ACBack = 0x224,
5798 /// Usage ID `0x225`: "AC Forward"
5799 ACForward = 0x225,
5800 /// Usage ID `0x226`: "AC Stop"
5801 ACStop = 0x226,
5802 /// Usage ID `0x227`: "AC Refresh"
5803 ACRefresh = 0x227,
5804 /// Usage ID `0x228`: "AC Previous Link"
5805 ACPreviousLink = 0x228,
5806 /// Usage ID `0x229`: "AC Next Link"
5807 ACNextLink = 0x229,
5808 /// Usage ID `0x22A`: "AC Bookmarks"
5809 ACBookmarks = 0x22A,
5810 /// Usage ID `0x22B`: "AC History"
5811 ACHistory = 0x22B,
5812 /// Usage ID `0x22C`: "AC Subscriptions"
5813 ACSubscriptions = 0x22C,
5814 /// Usage ID `0x22D`: "AC Zoom In"
5815 ACZoomIn = 0x22D,
5816 /// Usage ID `0x22E`: "AC Zoom Out"
5817 ACZoomOut = 0x22E,
5818 /// Usage ID `0x22F`: "AC Zoom"
5819 ACZoom = 0x22F,
5820 /// Usage ID `0x230`: "AC Full Screen View"
5821 ACFullScreenView = 0x230,
5822 /// Usage ID `0x231`: "AC Normal View"
5823 ACNormalView = 0x231,
5824 /// Usage ID `0x232`: "AC View Toggle"
5825 ACViewToggle = 0x232,
5826 /// Usage ID `0x233`: "AC Scroll Up"
5827 ACScrollUp = 0x233,
5828 /// Usage ID `0x234`: "AC Scroll Down"
5829 ACScrollDown = 0x234,
5830 /// Usage ID `0x235`: "AC Scroll"
5831 ACScroll = 0x235,
5832 /// Usage ID `0x236`: "AC Pan Left"
5833 ACPanLeft = 0x236,
5834 /// Usage ID `0x237`: "AC Pan Right"
5835 ACPanRight = 0x237,
5836 /// Usage ID `0x238`: "AC Pan"
5837 ACPan = 0x238,
5838 /// Usage ID `0x239`: "AC New Window"
5839 ACNewWindow = 0x239,
5840 /// Usage ID `0x23A`: "AC Tile Horizontally"
5841 ACTileHorizontally = 0x23A,
5842 /// Usage ID `0x23B`: "AC Tile Vertically"
5843 ACTileVertically = 0x23B,
5844 /// Usage ID `0x23C`: "AC Format"
5845 ACFormat = 0x23C,
5846 /// Usage ID `0x23D`: "AC Edit"
5847 ACEdit = 0x23D,
5848 /// Usage ID `0x23E`: "AC Bold"
5849 ACBold = 0x23E,
5850 /// Usage ID `0x23F`: "AC Italics"
5851 ACItalics = 0x23F,
5852 /// Usage ID `0x240`: "AC Underline"
5853 ACUnderline = 0x240,
5854 /// Usage ID `0x241`: "AC Strikethrough"
5855 ACStrikethrough = 0x241,
5856 /// Usage ID `0x242`: "AC Subscript"
5857 ACSubscript = 0x242,
5858 /// Usage ID `0x243`: "AC Superscript"
5859 ACSuperscript = 0x243,
5860 /// Usage ID `0x244`: "AC All Caps"
5861 ACAllCaps = 0x244,
5862 /// Usage ID `0x245`: "AC Rotate"
5863 ACRotate = 0x245,
5864 /// Usage ID `0x246`: "AC Resize"
5865 ACResize = 0x246,
5866 /// Usage ID `0x247`: "AC Flip Horizontal"
5867 ACFlipHorizontal = 0x247,
5868 /// Usage ID `0x248`: "AC Flip Vertical"
5869 ACFlipVertical = 0x248,
5870 /// Usage ID `0x249`: "AC Mirror Horizontal"
5871 ACMirrorHorizontal = 0x249,
5872 /// Usage ID `0x24A`: "AC Mirror Vertical"
5873 ACMirrorVertical = 0x24A,
5874 /// Usage ID `0x24B`: "AC Font Select"
5875 ACFontSelect = 0x24B,
5876 /// Usage ID `0x24C`: "AC Font Color"
5877 ACFontColor = 0x24C,
5878 /// Usage ID `0x24D`: "AC Font Size"
5879 ACFontSize = 0x24D,
5880 /// Usage ID `0x24E`: "AC Justify Left"
5881 ACJustifyLeft = 0x24E,
5882 /// Usage ID `0x24F`: "AC Justify Center H"
5883 ACJustifyCenterH = 0x24F,
5884 /// Usage ID `0x250`: "AC Justify Right"
5885 ACJustifyRight = 0x250,
5886 /// Usage ID `0x251`: "AC Justify Block H"
5887 ACJustifyBlockH = 0x251,
5888 /// Usage ID `0x252`: "AC Justify Top"
5889 ACJustifyTop = 0x252,
5890 /// Usage ID `0x253`: "AC Justify Center V"
5891 ACJustifyCenterV = 0x253,
5892 /// Usage ID `0x254`: "AC Justify Bottom"
5893 ACJustifyBottom = 0x254,
5894 /// Usage ID `0x255`: "AC Justify Block V"
5895 ACJustifyBlockV = 0x255,
5896 /// Usage ID `0x256`: "AC Indent Decrease"
5897 ACIndentDecrease = 0x256,
5898 /// Usage ID `0x257`: "AC Indent Increase"
5899 ACIndentIncrease = 0x257,
5900 /// Usage ID `0x258`: "AC Numbered List"
5901 ACNumberedList = 0x258,
5902 /// Usage ID `0x259`: "AC Restart Numbering"
5903 ACRestartNumbering = 0x259,
5904 /// Usage ID `0x25A`: "AC Bulleted List"
5905 ACBulletedList = 0x25A,
5906 /// Usage ID `0x25B`: "AC Promote"
5907 ACPromote = 0x25B,
5908 /// Usage ID `0x25C`: "AC Demote"
5909 ACDemote = 0x25C,
5910 /// Usage ID `0x25D`: "AC Yes"
5911 ACYes = 0x25D,
5912 /// Usage ID `0x25E`: "AC No"
5913 ACNo = 0x25E,
5914 /// Usage ID `0x25F`: "AC Cancel"
5915 ACCancel = 0x25F,
5916 /// Usage ID `0x260`: "AC Catalog"
5917 ACCatalog = 0x260,
5918 /// Usage ID `0x261`: "AC Buy/Checkout"
5919 ACBuyCheckout = 0x261,
5920 /// Usage ID `0x262`: "AC Add to Cart"
5921 ACAddtoCart = 0x262,
5922 /// Usage ID `0x263`: "AC Expand"
5923 ACExpand = 0x263,
5924 /// Usage ID `0x264`: "AC Expand All"
5925 ACExpandAll = 0x264,
5926 /// Usage ID `0x265`: "AC Collapse"
5927 ACCollapse = 0x265,
5928 /// Usage ID `0x266`: "AC Collapse All"
5929 ACCollapseAll = 0x266,
5930 /// Usage ID `0x267`: "AC Print Preview"
5931 ACPrintPreview = 0x267,
5932 /// Usage ID `0x268`: "AC Paste Special"
5933 ACPasteSpecial = 0x268,
5934 /// Usage ID `0x269`: "AC Insert Mode"
5935 ACInsertMode = 0x269,
5936 /// Usage ID `0x26A`: "AC Delete"
5937 ACDelete = 0x26A,
5938 /// Usage ID `0x26B`: "AC Lock"
5939 ACLock = 0x26B,
5940 /// Usage ID `0x26C`: "AC Unlock"
5941 ACUnlock = 0x26C,
5942 /// Usage ID `0x26D`: "AC Protect"
5943 ACProtect = 0x26D,
5944 /// Usage ID `0x26E`: "AC Unprotect"
5945 ACUnprotect = 0x26E,
5946 /// Usage ID `0x26F`: "AC Attach Comment"
5947 ACAttachComment = 0x26F,
5948 /// Usage ID `0x270`: "AC Delete Comment"
5949 ACDeleteComment = 0x270,
5950 /// Usage ID `0x271`: "AC View Comment"
5951 ACViewComment = 0x271,
5952 /// Usage ID `0x272`: "AC Select Word"
5953 ACSelectWord = 0x272,
5954 /// Usage ID `0x273`: "AC Select Sentence"
5955 ACSelectSentence = 0x273,
5956 /// Usage ID `0x274`: "AC Select Paragraph"
5957 ACSelectParagraph = 0x274,
5958 /// Usage ID `0x275`: "AC Select Column"
5959 ACSelectColumn = 0x275,
5960 /// Usage ID `0x276`: "AC Select Row"
5961 ACSelectRow = 0x276,
5962 /// Usage ID `0x277`: "AC Select Table"
5963 ACSelectTable = 0x277,
5964 /// Usage ID `0x278`: "AC Select Object"
5965 ACSelectObject = 0x278,
5966 /// Usage ID `0x279`: "AC Redo/Repeat"
5967 ACRedoRepeat = 0x279,
5968 /// Usage ID `0x27A`: "AC Sort"
5969 ACSort = 0x27A,
5970 /// Usage ID `0x27B`: "AC Sort Ascending"
5971 ACSortAscending = 0x27B,
5972 /// Usage ID `0x27C`: "AC Sort Descending"
5973 ACSortDescending = 0x27C,
5974 /// Usage ID `0x27D`: "AC Filter"
5975 ACFilter = 0x27D,
5976 /// Usage ID `0x27E`: "AC Set Clock"
5977 ACSetClock = 0x27E,
5978 /// Usage ID `0x27F`: "AC View Clock"
5979 ACViewClock = 0x27F,
5980 /// Usage ID `0x280`: "AC Select Time Zone"
5981 ACSelectTimeZone = 0x280,
5982 /// Usage ID `0x281`: "AC Edit Time Zones"
5983 ACEditTimeZones = 0x281,
5984 /// Usage ID `0x282`: "AC Set Alarm"
5985 ACSetAlarm = 0x282,
5986 /// Usage ID `0x283`: "AC Clear Alarm"
5987 ACClearAlarm = 0x283,
5988 /// Usage ID `0x284`: "AC Snooze Alarm"
5989 ACSnoozeAlarm = 0x284,
5990 /// Usage ID `0x285`: "AC Reset Alarm"
5991 ACResetAlarm = 0x285,
5992 /// Usage ID `0x286`: "AC Synchronize"
5993 ACSynchronize = 0x286,
5994 /// Usage ID `0x287`: "AC Send/Receive"
5995 ACSendReceive = 0x287,
5996 /// Usage ID `0x288`: "AC Send To"
5997 ACSendTo = 0x288,
5998 /// Usage ID `0x289`: "AC Reply"
5999 ACReply = 0x289,
6000 /// Usage ID `0x28A`: "AC Reply All"
6001 ACReplyAll = 0x28A,
6002 /// Usage ID `0x28B`: "AC Forward Msg"
6003 ACForwardMsg = 0x28B,
6004 /// Usage ID `0x28C`: "AC Send"
6005 ACSend = 0x28C,
6006 /// Usage ID `0x28D`: "AC Attach File"
6007 ACAttachFile = 0x28D,
6008 /// Usage ID `0x28E`: "AC Upload"
6009 ACUpload = 0x28E,
6010 /// Usage ID `0x28F`: "AC Download (Save Target As)"
6011 ACDownloadSaveTargetAs = 0x28F,
6012 /// Usage ID `0x290`: "AC Set Borders"
6013 ACSetBorders = 0x290,
6014 /// Usage ID `0x291`: "AC Insert Row"
6015 ACInsertRow = 0x291,
6016 /// Usage ID `0x292`: "AC Insert Column"
6017 ACInsertColumn = 0x292,
6018 /// Usage ID `0x293`: "AC Insert File"
6019 ACInsertFile = 0x293,
6020 /// Usage ID `0x294`: "AC Insert Picture"
6021 ACInsertPicture = 0x294,
6022 /// Usage ID `0x295`: "AC Insert Object"
6023 ACInsertObject = 0x295,
6024 /// Usage ID `0x296`: "AC Insert Symbol"
6025 ACInsertSymbol = 0x296,
6026 /// Usage ID `0x297`: "AC Save and Close"
6027 ACSaveandClose = 0x297,
6028 /// Usage ID `0x298`: "AC Rename"
6029 ACRename = 0x298,
6030 /// Usage ID `0x299`: "AC Merge"
6031 ACMerge = 0x299,
6032 /// Usage ID `0x29A`: "AC Split"
6033 ACSplit = 0x29A,
6034 /// Usage ID `0x29B`: "AC Disribute Horizontally"
6035 ACDisributeHorizontally = 0x29B,
6036 /// Usage ID `0x29C`: "AC Distribute Vertically"
6037 ACDistributeVertically = 0x29C,
6038 /// Usage ID `0x29D`: "AC Next Keyboard Layout Select"
6039 ACNextKeyboardLayoutSelect = 0x29D,
6040 /// Usage ID `0x29E`: "AC Navigation Guidance"
6041 ACNavigationGuidance = 0x29E,
6042 /// Usage ID `0x29F`: "AC Desktop Show All Windows"
6043 ACDesktopShowAllWindows = 0x29F,
6044 /// Usage ID `0x2A0`: "AC Soft Key Left"
6045 ACSoftKeyLeft = 0x2A0,
6046 /// Usage ID `0x2A1`: "AC Soft Key Right"
6047 ACSoftKeyRight = 0x2A1,
6048 /// Usage ID `0x2A2`: "AC Desktop Show All Applications"
6049 ACDesktopShowAllApplications = 0x2A2,
6050 /// Usage ID `0x2B0`: "AC Idle Keep Alive"
6051 ACIdleKeepAlive = 0x2B0,
6052 /// Usage ID `0x2C0`: "Extended Keyboard Attributes Collection"
6053 ExtendedKeyboardAttributesCollection = 0x2C0,
6054 /// Usage ID `0x2C1`: "Keyboard Form Factor"
6055 KeyboardFormFactor = 0x2C1,
6056 /// Usage ID `0x2C2`: "Keyboard Key Type"
6057 KeyboardKeyType = 0x2C2,
6058 /// Usage ID `0x2C3`: "Keyboard Physical Layout"
6059 KeyboardPhysicalLayout = 0x2C3,
6060 /// Usage ID `0x2C4`: "Vendor‐Specific Keyboard Physical Layout"
6061 VendorSpecificKeyboardPhysicalLayout = 0x2C4,
6062 /// Usage ID `0x2C5`: "Keyboard IETF Language Tag Index"
6063 KeyboardIETFLanguageTagIndex = 0x2C5,
6064 /// Usage ID `0x2C6`: "Implemented Keyboard Input Assist Controls"
6065 ImplementedKeyboardInputAssistControls = 0x2C6,
6066 /// Usage ID `0x2C7`: "Keyboard Input Assist Previous"
6067 KeyboardInputAssistPrevious = 0x2C7,
6068 /// Usage ID `0x2C8`: "Keyboard Input Assist Next"
6069 KeyboardInputAssistNext = 0x2C8,
6070 /// Usage ID `0x2C9`: "Keyboard Input Assist Previous Group"
6071 KeyboardInputAssistPreviousGroup = 0x2C9,
6072 /// Usage ID `0x2CA`: "Keyboard Input Assist Next Group"
6073 KeyboardInputAssistNextGroup = 0x2CA,
6074 /// Usage ID `0x2CB`: "Keyboard Input Assist Accept"
6075 KeyboardInputAssistAccept = 0x2CB,
6076 /// Usage ID `0x2CC`: "Keyboard Input Assist Cancel"
6077 KeyboardInputAssistCancel = 0x2CC,
6078 /// Usage ID `0x2D0`: "Privacy Screen Toggle"
6079 PrivacyScreenToggle = 0x2D0,
6080 /// Usage ID `0x2D1`: "Privacy Screen Level Decrement"
6081 PrivacyScreenLevelDecrement = 0x2D1,
6082 /// Usage ID `0x2D2`: "Privacy Screen Level Increment"
6083 PrivacyScreenLevelIncrement = 0x2D2,
6084 /// Usage ID `0x2D3`: "Privacy Screen Level Minimum"
6085 PrivacyScreenLevelMinimum = 0x2D3,
6086 /// Usage ID `0x2D4`: "Privacy Screen Level Maximum"
6087 PrivacyScreenLevelMaximum = 0x2D4,
6088 /// Usage ID `0x500`: "Contact Edited"
6089 ContactEdited = 0x500,
6090 /// Usage ID `0x501`: "Contact Added"
6091 ContactAdded = 0x501,
6092 /// Usage ID `0x502`: "Contact Record Active"
6093 ContactRecordActive = 0x502,
6094 /// Usage ID `0x503`: "Contact Index"
6095 ContactIndex = 0x503,
6096 /// Usage ID `0x504`: "Contact Nickname"
6097 ContactNickname = 0x504,
6098 /// Usage ID `0x505`: "Contact First Name"
6099 ContactFirstName = 0x505,
6100 /// Usage ID `0x506`: "Contact Last Name"
6101 ContactLastName = 0x506,
6102 /// Usage ID `0x507`: "Contact Full Name"
6103 ContactFullName = 0x507,
6104 /// Usage ID `0x508`: "Contact Phone Number Personal"
6105 ContactPhoneNumberPersonal = 0x508,
6106 /// Usage ID `0x509`: "Contact Phone Number Business"
6107 ContactPhoneNumberBusiness = 0x509,
6108 /// Usage ID `0x50A`: "Contact Phone Number Mobile"
6109 ContactPhoneNumberMobile = 0x50A,
6110 /// Usage ID `0x50B`: "Contact Phone Number Pager"
6111 ContactPhoneNumberPager = 0x50B,
6112 /// Usage ID `0x50C`: "Contact Phone Number Fax"
6113 ContactPhoneNumberFax = 0x50C,
6114 /// Usage ID `0x50D`: "Contact Phone Number Other"
6115 ContactPhoneNumberOther = 0x50D,
6116 /// Usage ID `0x50E`: "Contact Email Personal"
6117 ContactEmailPersonal = 0x50E,
6118 /// Usage ID `0x50F`: "Contact Email Business"
6119 ContactEmailBusiness = 0x50F,
6120 /// Usage ID `0x510`: "Contact Email Other"
6121 ContactEmailOther = 0x510,
6122 /// Usage ID `0x511`: "Contact Email Main"
6123 ContactEmailMain = 0x511,
6124 /// Usage ID `0x512`: "Contact Speed Dial Number"
6125 ContactSpeedDialNumber = 0x512,
6126 /// Usage ID `0x513`: "Contact Status Flag"
6127 ContactStatusFlag = 0x513,
6128 /// Usage ID `0x514`: "Contact Misc."
6129 ContactMisc = 0x514,
6130 }
6131
6132 impl Consumer {
6133 #[cfg(feature = "std")]
6134 pub fn name(&self) -> String {
6135 match self {
6136 Consumer::ConsumerControl => "Consumer Control",
6137 Consumer::NumericKeyPad => "Numeric Key Pad",
6138 Consumer::ProgrammableButtons => "Programmable Buttons",
6139 Consumer::Microphone => "Microphone",
6140 Consumer::Headphone => "Headphone",
6141 Consumer::GraphicEqualizer => "Graphic Equalizer",
6142 Consumer::Plus10 => "+10",
6143 Consumer::Plus100 => "+100",
6144 Consumer::AMPM => "AM/PM",
6145 Consumer::Power => "Power",
6146 Consumer::Reset => "Reset",
6147 Consumer::Sleep => "Sleep",
6148 Consumer::SleepAfter => "Sleep After",
6149 Consumer::SleepMode => "Sleep Mode",
6150 Consumer::Illumination => "Illumination",
6151 Consumer::FunctionButtons => "Function Buttons",
6152 Consumer::Menu => "Menu",
6153 Consumer::MenuPick => "Menu Pick",
6154 Consumer::MenuUp => "Menu Up",
6155 Consumer::MenuDown => "Menu Down",
6156 Consumer::MenuLeft => "Menu Left",
6157 Consumer::MenuRight => "Menu Right",
6158 Consumer::MenuEscape => "Menu Escape",
6159 Consumer::MenuValueIncrease => "Menu Value Increase",
6160 Consumer::MenuValueDecrease => "Menu Value Decrease",
6161 Consumer::DataOnScreen => "Data On Screen",
6162 Consumer::ClosedCaption => "Closed Caption",
6163 Consumer::ClosedCaptionSelect => "Closed Caption Select",
6164 Consumer::VCRTV => "VCR/TV",
6165 Consumer::BroadcastMode => "Broadcast Mode",
6166 Consumer::Snapshot => "Snapshot",
6167 Consumer::Still => "Still",
6168 Consumer::PictureinPictureToggle => "Picture-in-Picture Toggle",
6169 Consumer::PictureinPictureSwap => "Picture-in-Picture Swap",
6170 Consumer::RedMenuButton => "Red Menu Button",
6171 Consumer::GreenMenuButton => "Green Menu Button",
6172 Consumer::BlueMenuButton => "Blue Menu Button",
6173 Consumer::YellowMenuButton => "Yellow Menu Button",
6174 Consumer::Aspect => "Aspect",
6175 Consumer::ThreeDModeSelect => "3D Mode Select",
6176 Consumer::DisplayBrightnessIncrement => "Display Brightness Increment",
6177 Consumer::DisplayBrightnessDecrement => "Display Brightness Decrement",
6178 Consumer::DisplayBrightness => "Display Brightness",
6179 Consumer::DisplayBacklightToggle => "Display Backlight Toggle",
6180 Consumer::DisplaySetBrightnesstoMinimum => "Display Set Brightness to Minimum",
6181 Consumer::DisplaySetBrightnesstoMaximum => "Display Set Brightness to Maximum",
6182 Consumer::DisplaySetAutoBrightness => "Display Set Auto Brightness",
6183 Consumer::CameraAccessEnabled => "Camera Access Enabled",
6184 Consumer::CameraAccessDisabled => "Camera Access Disabled",
6185 Consumer::CameraAccessToggle => "Camera Access Toggle",
6186 Consumer::KeyboardBrightnessIncrement => "Keyboard Brightness Increment",
6187 Consumer::KeyboardBrightnessDecrement => "Keyboard Brightness Decrement",
6188 Consumer::KeyboardBacklightSetLevel => "Keyboard Backlight Set Level",
6189 Consumer::KeyboardBacklightOOC => "Keyboard Backlight OOC",
6190 Consumer::KeyboardBacklightSetMinimum => "Keyboard Backlight Set Minimum",
6191 Consumer::KeyboardBacklightSetMaximum => "Keyboard Backlight Set Maximum",
6192 Consumer::KeyboardBacklightAuto => "Keyboard Backlight Auto",
6193 Consumer::Selection => "Selection",
6194 Consumer::AssignSelection => "Assign Selection",
6195 Consumer::ModeStep => "Mode Step",
6196 Consumer::RecallLast => "Recall Last",
6197 Consumer::EnterChannel => "Enter Channel",
6198 Consumer::OrderMovie => "Order Movie",
6199 Consumer::Channel => "Channel",
6200 Consumer::MediaSelection => "Media Selection",
6201 Consumer::MediaSelectComputer => "Media Select Computer",
6202 Consumer::MediaSelectTV => "Media Select TV",
6203 Consumer::MediaSelectWWW => "Media Select WWW",
6204 Consumer::MediaSelectDVD => "Media Select DVD",
6205 Consumer::MediaSelectTelephone => "Media Select Telephone",
6206 Consumer::MediaSelectProgramGuide => "Media Select Program Guide",
6207 Consumer::MediaSelectVideoPhone => "Media Select Video Phone",
6208 Consumer::MediaSelectGames => "Media Select Games",
6209 Consumer::MediaSelectMessages => "Media Select Messages",
6210 Consumer::MediaSelectCD => "Media Select CD",
6211 Consumer::MediaSelectVCR => "Media Select VCR",
6212 Consumer::MediaSelectTuner => "Media Select Tuner",
6213 Consumer::Quit => "Quit",
6214 Consumer::Help => "Help",
6215 Consumer::MediaSelectTape => "Media Select Tape",
6216 Consumer::MediaSelectCable => "Media Select Cable",
6217 Consumer::MediaSelectSatellite => "Media Select Satellite",
6218 Consumer::MediaSelectSecurity => "Media Select Security",
6219 Consumer::MediaSelectHome => "Media Select Home",
6220 Consumer::MediaSelectCall => "Media Select Call",
6221 Consumer::ChannelIncrement => "Channel Increment",
6222 Consumer::ChannelDecrement => "Channel Decrement",
6223 Consumer::MediaSelectSAP => "Media Select SAP",
6224 Consumer::VCRPlus => "VCR Plus",
6225 Consumer::Once => "Once",
6226 Consumer::Daily => "Daily",
6227 Consumer::Weekly => "Weekly",
6228 Consumer::Monthly => "Monthly",
6229 Consumer::Play => "Play",
6230 Consumer::Pause => "Pause",
6231 Consumer::Record => "Record",
6232 Consumer::FastForward => "Fast Forward",
6233 Consumer::Rewind => "Rewind",
6234 Consumer::ScanNextTrack => "Scan Next Track",
6235 Consumer::ScanPreviousTrack => "Scan Previous Track",
6236 Consumer::Stop => "Stop",
6237 Consumer::Eject => "Eject",
6238 Consumer::RandomPlay => "Random Play",
6239 Consumer::SelectDisc => "Select Disc",
6240 Consumer::EnterDisc => "Enter Disc",
6241 Consumer::Repeat => "Repeat",
6242 Consumer::Tracking => "Tracking",
6243 Consumer::TrackNormal => "Track Normal",
6244 Consumer::SlowTracking => "Slow Tracking",
6245 Consumer::FrameForward => "Frame Forward",
6246 Consumer::FrameBack => "Frame Back",
6247 Consumer::Mark => "Mark",
6248 Consumer::ClearMark => "Clear Mark",
6249 Consumer::RepeatFromMark => "Repeat From Mark",
6250 Consumer::ReturnToMark => "Return To Mark",
6251 Consumer::SearchMarkForward => "Search Mark Forward",
6252 Consumer::SearchMarkBackwards => "Search Mark Backwards",
6253 Consumer::CounterReset => "Counter Reset",
6254 Consumer::ShowCounter => "Show Counter",
6255 Consumer::TrackingIncrement => "Tracking Increment",
6256 Consumer::TrackingDecrement => "Tracking Decrement",
6257 Consumer::StopEject => "Stop/Eject",
6258 Consumer::PlayPause => "Play/Pause",
6259 Consumer::PlaySkip => "Play/Skip",
6260 Consumer::VoiceCommand => "Voice Command",
6261 Consumer::InvokeCaptureInterface => "Invoke Capture Interface",
6262 Consumer::StartorStopGameRecording => "Start or Stop Game Recording",
6263 Consumer::HistoricalGameCapture => "Historical Game Capture",
6264 Consumer::CaptureGameScreenshot => "Capture Game Screenshot",
6265 Consumer::ShoworHideRecordingIndicator => "Show or Hide Recording Indicator",
6266 Consumer::StartorStopMicrophoneCapture => "Start or Stop Microphone Capture",
6267 Consumer::StartorStopCameraCapture => "Start or Stop Camera Capture",
6268 Consumer::StartorStopGameBroadcast => "Start or Stop Game Broadcast",
6269 Consumer::StartorStopVoiceDictationSession => "Start or Stop Voice Dictation Session",
6270 Consumer::InvokeDismissEmojiPicker => "Invoke/Dismiss Emoji Picker",
6271 Consumer::Volume => "Volume",
6272 Consumer::Balance => "Balance",
6273 Consumer::Mute => "Mute",
6274 Consumer::Bass => "Bass",
6275 Consumer::Treble => "Treble",
6276 Consumer::BassBoost => "Bass Boost",
6277 Consumer::SurroundMode => "Surround Mode",
6278 Consumer::Loudness => "Loudness",
6279 Consumer::MPX => "MPX",
6280 Consumer::VolumeIncrement => "Volume Increment",
6281 Consumer::VolumeDecrement => "Volume Decrement",
6282 Consumer::SpeedSelect => "Speed Select",
6283 Consumer::PlaybackSpeed => "Playback Speed",
6284 Consumer::StandardPlay => "Standard Play",
6285 Consumer::LongPlay => "Long Play",
6286 Consumer::ExtendedPlay => "Extended Play",
6287 Consumer::Slow => "Slow",
6288 Consumer::FanEnable => "Fan Enable",
6289 Consumer::FanSpeed => "Fan Speed",
6290 Consumer::LightEnable => "Light Enable",
6291 Consumer::LightIlluminationLevel => "Light Illumination Level",
6292 Consumer::ClimateControlEnable => "Climate Control Enable",
6293 Consumer::RoomTemperature => "Room Temperature",
6294 Consumer::SecurityEnable => "Security Enable",
6295 Consumer::FireAlarm => "Fire Alarm",
6296 Consumer::PoliceAlarm => "Police Alarm",
6297 Consumer::Proximity => "Proximity",
6298 Consumer::Motion => "Motion",
6299 Consumer::DuressAlarm => "Duress Alarm",
6300 Consumer::HoldupAlarm => "Holdup Alarm",
6301 Consumer::MedicalAlarm => "Medical Alarm",
6302 Consumer::BalanceRight => "Balance Right",
6303 Consumer::BalanceLeft => "Balance Left",
6304 Consumer::BassIncrement => "Bass Increment",
6305 Consumer::BassDecrement => "Bass Decrement",
6306 Consumer::TrebleIncrement => "Treble Increment",
6307 Consumer::TrebleDecrement => "Treble Decrement",
6308 Consumer::SpeakerSystem => "Speaker System",
6309 Consumer::ChannelLeft => "Channel Left",
6310 Consumer::ChannelRight => "Channel Right",
6311 Consumer::ChannelCenter => "Channel Center",
6312 Consumer::ChannelFront => "Channel Front",
6313 Consumer::ChannelCenterFront => "Channel Center Front",
6314 Consumer::ChannelSide => "Channel Side",
6315 Consumer::ChannelSurround => "Channel Surround",
6316 Consumer::ChannelLowFrequencyEnhancement => "Channel Low Frequency Enhancement",
6317 Consumer::ChannelTop => "Channel Top",
6318 Consumer::ChannelUnknown => "Channel Unknown",
6319 Consumer::Subchannel => "Sub-channel",
6320 Consumer::SubchannelIncrement => "Sub-channel Increment",
6321 Consumer::SubchannelDecrement => "Sub-channel Decrement",
6322 Consumer::AlternateAudioIncrement => "Alternate Audio Increment",
6323 Consumer::AlternateAudioDecrement => "Alternate Audio Decrement",
6324 Consumer::ApplicationLaunchButtons => "Application Launch Buttons",
6325 Consumer::ALLaunchButtonConfigurationTool => "AL Launch Button Configuration Tool",
6326 Consumer::ALProgrammableButtonConfiguration => "AL Programmable Button Configuration",
6327 Consumer::ALConsumerControlConfiguration => "AL Consumer Control Configuration",
6328 Consumer::ALWordProcessor => "AL Word Processor",
6329 Consumer::ALTextEditor => "AL Text Editor",
6330 Consumer::ALSpreadsheet => "AL Spreadsheet",
6331 Consumer::ALGraphicsEditor => "AL Graphics Editor",
6332 Consumer::ALPresentationApp => "AL Presentation App",
6333 Consumer::ALDatabaseApp => "AL Database App",
6334 Consumer::ALEmailReader => "AL Email Reader",
6335 Consumer::ALNewsreader => "AL Newsreader",
6336 Consumer::ALVoicemail => "AL Voicemail",
6337 Consumer::ALContactsAddressBook => "AL Contacts/Address Book",
6338 Consumer::ALCalendarSchedule => "AL Calendar/Schedule",
6339 Consumer::ALTaskProjectManager => "AL Task/Project Manager",
6340 Consumer::ALLogJournalTimecard => "AL Log/Journal/Timecard",
6341 Consumer::ALCheckbookFinance => "AL Checkbook/Finance",
6342 Consumer::ALCalculator => "AL Calculator",
6343 Consumer::ALAVCapturePlayback => "AL A/V Capture/Playback",
6344 Consumer::ALLocalMachineBrowser => "AL Local Machine Browser",
6345 Consumer::ALLANWANBrowser => "AL LAN/WAN Browser",
6346 Consumer::ALInternetBrowser => "AL Internet Browser",
6347 Consumer::ALRemoteNetworkingISPConnect => "AL Remote Networking/ISP Connect",
6348 Consumer::ALNetworkConference => "AL Network Conference",
6349 Consumer::ALNetworkChat => "AL Network Chat",
6350 Consumer::ALTelephonyDialer => "AL Telephony/Dialer",
6351 Consumer::ALLogon => "AL Logon",
6352 Consumer::ALLogoff => "AL Logoff",
6353 Consumer::ALLogonLogoff => "AL Logon/Logoff",
6354 Consumer::ALTerminalLockScreensaver => "AL Terminal Lock/Screensaver",
6355 Consumer::ALControlPanel => "AL Control Panel",
6356 Consumer::ALCommandLineProcessorRun => "AL Command Line Processor/Run",
6357 Consumer::ALProcessTaskManager => "AL Process/Task Manager",
6358 Consumer::ALSelectTaskApplication => "AL Select Task/Application",
6359 Consumer::ALNextTaskApplication => "AL Next Task/Application",
6360 Consumer::ALPreviousTaskApplication => "AL Previous Task/Application",
6361 Consumer::ALPreemptiveHaltTaskApplication => "AL Preemptive Halt Task/Application",
6362 Consumer::ALIntegratedHelpCenter => "AL Integrated Help Center",
6363 Consumer::ALDocuments => "AL Documents",
6364 Consumer::ALThesaurus => "AL Thesaurus",
6365 Consumer::ALDictionary => "AL Dictionary",
6366 Consumer::ALDesktop => "AL Desktop",
6367 Consumer::ALSpellCheck => "AL Spell Check",
6368 Consumer::ALGrammarCheck => "AL Grammar Check",
6369 Consumer::ALWirelessStatus => "AL Wireless Status",
6370 Consumer::ALKeyboardLayout => "AL Keyboard Layout",
6371 Consumer::ALVirusProtection => "AL Virus Protection",
6372 Consumer::ALEncryption => "AL Encryption",
6373 Consumer::ALScreenSaver => "AL Screen Saver",
6374 Consumer::ALAlarms => "AL Alarms",
6375 Consumer::ALClock => "AL Clock",
6376 Consumer::ALFileBrowser => "AL File Browser",
6377 Consumer::ALPowerStatus => "AL Power Status",
6378 Consumer::ALImageBrowser => "AL Image Browser",
6379 Consumer::ALAudioBrowser => "AL Audio Browser",
6380 Consumer::ALMovieBrowser => "AL Movie Browser",
6381 Consumer::ALDigitalRightsManager => "AL Digital Rights Manager",
6382 Consumer::ALDigitalWallet => "AL Digital Wallet",
6383 Consumer::ALInstantMessaging => "AL Instant Messaging",
6384 Consumer::ALOEMFeaturesTipsTutorialBrowser => "AL OEM Features/ Tips/Tutorial Browser",
6385 Consumer::ALOEMHelp => "AL OEM Help",
6386 Consumer::ALOnlineCommunity => "AL Online Community",
6387 Consumer::ALEntertainmentContentBrowser => "AL Entertainment Content Browser",
6388 Consumer::ALOnlineShoppingBrowser => "AL Online Shopping Browser",
6389 Consumer::ALSmartCardInformationHelp => "AL SmartCard Information/Help",
6390 Consumer::ALMarketMonitorFinanceBrowser => "AL Market Monitor/Finance Browser",
6391 Consumer::ALCustomizedCorporateNewsBrowser => "AL Customized Corporate News Browser",
6392 Consumer::ALOnlineActivityBrowser => "AL Online Activity Browser",
6393 Consumer::ALResearchSearchBrowser => "AL Research/Search Browser",
6394 Consumer::ALAudioPlayer => "AL Audio Player",
6395 Consumer::ALMessageStatus => "AL Message Status",
6396 Consumer::ALContactSync => "AL Contact Sync",
6397 Consumer::ALNavigation => "AL Navigation",
6398 Consumer::ALContextawareDesktopAssistant => "AL Context‐aware Desktop Assistant",
6399 Consumer::GenericGUIApplicationControls => "Generic GUI Application Controls",
6400 Consumer::ACNew => "AC New",
6401 Consumer::ACOpen => "AC Open",
6402 Consumer::ACClose => "AC Close",
6403 Consumer::ACExit => "AC Exit",
6404 Consumer::ACMaximize => "AC Maximize",
6405 Consumer::ACMinimize => "AC Minimize",
6406 Consumer::ACSave => "AC Save",
6407 Consumer::ACPrint => "AC Print",
6408 Consumer::ACProperties => "AC Properties",
6409 Consumer::ACUndo => "AC Undo",
6410 Consumer::ACCopy => "AC Copy",
6411 Consumer::ACCut => "AC Cut",
6412 Consumer::ACPaste => "AC Paste",
6413 Consumer::ACSelectAll => "AC Select All",
6414 Consumer::ACFind => "AC Find",
6415 Consumer::ACFindandReplace => "AC Find and Replace",
6416 Consumer::ACSearch => "AC Search",
6417 Consumer::ACGoTo => "AC Go To",
6418 Consumer::ACHome => "AC Home",
6419 Consumer::ACBack => "AC Back",
6420 Consumer::ACForward => "AC Forward",
6421 Consumer::ACStop => "AC Stop",
6422 Consumer::ACRefresh => "AC Refresh",
6423 Consumer::ACPreviousLink => "AC Previous Link",
6424 Consumer::ACNextLink => "AC Next Link",
6425 Consumer::ACBookmarks => "AC Bookmarks",
6426 Consumer::ACHistory => "AC History",
6427 Consumer::ACSubscriptions => "AC Subscriptions",
6428 Consumer::ACZoomIn => "AC Zoom In",
6429 Consumer::ACZoomOut => "AC Zoom Out",
6430 Consumer::ACZoom => "AC Zoom",
6431 Consumer::ACFullScreenView => "AC Full Screen View",
6432 Consumer::ACNormalView => "AC Normal View",
6433 Consumer::ACViewToggle => "AC View Toggle",
6434 Consumer::ACScrollUp => "AC Scroll Up",
6435 Consumer::ACScrollDown => "AC Scroll Down",
6436 Consumer::ACScroll => "AC Scroll",
6437 Consumer::ACPanLeft => "AC Pan Left",
6438 Consumer::ACPanRight => "AC Pan Right",
6439 Consumer::ACPan => "AC Pan",
6440 Consumer::ACNewWindow => "AC New Window",
6441 Consumer::ACTileHorizontally => "AC Tile Horizontally",
6442 Consumer::ACTileVertically => "AC Tile Vertically",
6443 Consumer::ACFormat => "AC Format",
6444 Consumer::ACEdit => "AC Edit",
6445 Consumer::ACBold => "AC Bold",
6446 Consumer::ACItalics => "AC Italics",
6447 Consumer::ACUnderline => "AC Underline",
6448 Consumer::ACStrikethrough => "AC Strikethrough",
6449 Consumer::ACSubscript => "AC Subscript",
6450 Consumer::ACSuperscript => "AC Superscript",
6451 Consumer::ACAllCaps => "AC All Caps",
6452 Consumer::ACRotate => "AC Rotate",
6453 Consumer::ACResize => "AC Resize",
6454 Consumer::ACFlipHorizontal => "AC Flip Horizontal",
6455 Consumer::ACFlipVertical => "AC Flip Vertical",
6456 Consumer::ACMirrorHorizontal => "AC Mirror Horizontal",
6457 Consumer::ACMirrorVertical => "AC Mirror Vertical",
6458 Consumer::ACFontSelect => "AC Font Select",
6459 Consumer::ACFontColor => "AC Font Color",
6460 Consumer::ACFontSize => "AC Font Size",
6461 Consumer::ACJustifyLeft => "AC Justify Left",
6462 Consumer::ACJustifyCenterH => "AC Justify Center H",
6463 Consumer::ACJustifyRight => "AC Justify Right",
6464 Consumer::ACJustifyBlockH => "AC Justify Block H",
6465 Consumer::ACJustifyTop => "AC Justify Top",
6466 Consumer::ACJustifyCenterV => "AC Justify Center V",
6467 Consumer::ACJustifyBottom => "AC Justify Bottom",
6468 Consumer::ACJustifyBlockV => "AC Justify Block V",
6469 Consumer::ACIndentDecrease => "AC Indent Decrease",
6470 Consumer::ACIndentIncrease => "AC Indent Increase",
6471 Consumer::ACNumberedList => "AC Numbered List",
6472 Consumer::ACRestartNumbering => "AC Restart Numbering",
6473 Consumer::ACBulletedList => "AC Bulleted List",
6474 Consumer::ACPromote => "AC Promote",
6475 Consumer::ACDemote => "AC Demote",
6476 Consumer::ACYes => "AC Yes",
6477 Consumer::ACNo => "AC No",
6478 Consumer::ACCancel => "AC Cancel",
6479 Consumer::ACCatalog => "AC Catalog",
6480 Consumer::ACBuyCheckout => "AC Buy/Checkout",
6481 Consumer::ACAddtoCart => "AC Add to Cart",
6482 Consumer::ACExpand => "AC Expand",
6483 Consumer::ACExpandAll => "AC Expand All",
6484 Consumer::ACCollapse => "AC Collapse",
6485 Consumer::ACCollapseAll => "AC Collapse All",
6486 Consumer::ACPrintPreview => "AC Print Preview",
6487 Consumer::ACPasteSpecial => "AC Paste Special",
6488 Consumer::ACInsertMode => "AC Insert Mode",
6489 Consumer::ACDelete => "AC Delete",
6490 Consumer::ACLock => "AC Lock",
6491 Consumer::ACUnlock => "AC Unlock",
6492 Consumer::ACProtect => "AC Protect",
6493 Consumer::ACUnprotect => "AC Unprotect",
6494 Consumer::ACAttachComment => "AC Attach Comment",
6495 Consumer::ACDeleteComment => "AC Delete Comment",
6496 Consumer::ACViewComment => "AC View Comment",
6497 Consumer::ACSelectWord => "AC Select Word",
6498 Consumer::ACSelectSentence => "AC Select Sentence",
6499 Consumer::ACSelectParagraph => "AC Select Paragraph",
6500 Consumer::ACSelectColumn => "AC Select Column",
6501 Consumer::ACSelectRow => "AC Select Row",
6502 Consumer::ACSelectTable => "AC Select Table",
6503 Consumer::ACSelectObject => "AC Select Object",
6504 Consumer::ACRedoRepeat => "AC Redo/Repeat",
6505 Consumer::ACSort => "AC Sort",
6506 Consumer::ACSortAscending => "AC Sort Ascending",
6507 Consumer::ACSortDescending => "AC Sort Descending",
6508 Consumer::ACFilter => "AC Filter",
6509 Consumer::ACSetClock => "AC Set Clock",
6510 Consumer::ACViewClock => "AC View Clock",
6511 Consumer::ACSelectTimeZone => "AC Select Time Zone",
6512 Consumer::ACEditTimeZones => "AC Edit Time Zones",
6513 Consumer::ACSetAlarm => "AC Set Alarm",
6514 Consumer::ACClearAlarm => "AC Clear Alarm",
6515 Consumer::ACSnoozeAlarm => "AC Snooze Alarm",
6516 Consumer::ACResetAlarm => "AC Reset Alarm",
6517 Consumer::ACSynchronize => "AC Synchronize",
6518 Consumer::ACSendReceive => "AC Send/Receive",
6519 Consumer::ACSendTo => "AC Send To",
6520 Consumer::ACReply => "AC Reply",
6521 Consumer::ACReplyAll => "AC Reply All",
6522 Consumer::ACForwardMsg => "AC Forward Msg",
6523 Consumer::ACSend => "AC Send",
6524 Consumer::ACAttachFile => "AC Attach File",
6525 Consumer::ACUpload => "AC Upload",
6526 Consumer::ACDownloadSaveTargetAs => "AC Download (Save Target As)",
6527 Consumer::ACSetBorders => "AC Set Borders",
6528 Consumer::ACInsertRow => "AC Insert Row",
6529 Consumer::ACInsertColumn => "AC Insert Column",
6530 Consumer::ACInsertFile => "AC Insert File",
6531 Consumer::ACInsertPicture => "AC Insert Picture",
6532 Consumer::ACInsertObject => "AC Insert Object",
6533 Consumer::ACInsertSymbol => "AC Insert Symbol",
6534 Consumer::ACSaveandClose => "AC Save and Close",
6535 Consumer::ACRename => "AC Rename",
6536 Consumer::ACMerge => "AC Merge",
6537 Consumer::ACSplit => "AC Split",
6538 Consumer::ACDisributeHorizontally => "AC Disribute Horizontally",
6539 Consumer::ACDistributeVertically => "AC Distribute Vertically",
6540 Consumer::ACNextKeyboardLayoutSelect => "AC Next Keyboard Layout Select",
6541 Consumer::ACNavigationGuidance => "AC Navigation Guidance",
6542 Consumer::ACDesktopShowAllWindows => "AC Desktop Show All Windows",
6543 Consumer::ACSoftKeyLeft => "AC Soft Key Left",
6544 Consumer::ACSoftKeyRight => "AC Soft Key Right",
6545 Consumer::ACDesktopShowAllApplications => "AC Desktop Show All Applications",
6546 Consumer::ACIdleKeepAlive => "AC Idle Keep Alive",
6547 Consumer::ExtendedKeyboardAttributesCollection => {
6548 "Extended Keyboard Attributes Collection"
6549 }
6550 Consumer::KeyboardFormFactor => "Keyboard Form Factor",
6551 Consumer::KeyboardKeyType => "Keyboard Key Type",
6552 Consumer::KeyboardPhysicalLayout => "Keyboard Physical Layout",
6553 Consumer::VendorSpecificKeyboardPhysicalLayout => {
6554 "Vendor‐Specific Keyboard Physical Layout"
6555 }
6556 Consumer::KeyboardIETFLanguageTagIndex => "Keyboard IETF Language Tag Index",
6557 Consumer::ImplementedKeyboardInputAssistControls => {
6558 "Implemented Keyboard Input Assist Controls"
6559 }
6560 Consumer::KeyboardInputAssistPrevious => "Keyboard Input Assist Previous",
6561 Consumer::KeyboardInputAssistNext => "Keyboard Input Assist Next",
6562 Consumer::KeyboardInputAssistPreviousGroup => "Keyboard Input Assist Previous Group",
6563 Consumer::KeyboardInputAssistNextGroup => "Keyboard Input Assist Next Group",
6564 Consumer::KeyboardInputAssistAccept => "Keyboard Input Assist Accept",
6565 Consumer::KeyboardInputAssistCancel => "Keyboard Input Assist Cancel",
6566 Consumer::PrivacyScreenToggle => "Privacy Screen Toggle",
6567 Consumer::PrivacyScreenLevelDecrement => "Privacy Screen Level Decrement",
6568 Consumer::PrivacyScreenLevelIncrement => "Privacy Screen Level Increment",
6569 Consumer::PrivacyScreenLevelMinimum => "Privacy Screen Level Minimum",
6570 Consumer::PrivacyScreenLevelMaximum => "Privacy Screen Level Maximum",
6571 Consumer::ContactEdited => "Contact Edited",
6572 Consumer::ContactAdded => "Contact Added",
6573 Consumer::ContactRecordActive => "Contact Record Active",
6574 Consumer::ContactIndex => "Contact Index",
6575 Consumer::ContactNickname => "Contact Nickname",
6576 Consumer::ContactFirstName => "Contact First Name",
6577 Consumer::ContactLastName => "Contact Last Name",
6578 Consumer::ContactFullName => "Contact Full Name",
6579 Consumer::ContactPhoneNumberPersonal => "Contact Phone Number Personal",
6580 Consumer::ContactPhoneNumberBusiness => "Contact Phone Number Business",
6581 Consumer::ContactPhoneNumberMobile => "Contact Phone Number Mobile",
6582 Consumer::ContactPhoneNumberPager => "Contact Phone Number Pager",
6583 Consumer::ContactPhoneNumberFax => "Contact Phone Number Fax",
6584 Consumer::ContactPhoneNumberOther => "Contact Phone Number Other",
6585 Consumer::ContactEmailPersonal => "Contact Email Personal",
6586 Consumer::ContactEmailBusiness => "Contact Email Business",
6587 Consumer::ContactEmailOther => "Contact Email Other",
6588 Consumer::ContactEmailMain => "Contact Email Main",
6589 Consumer::ContactSpeedDialNumber => "Contact Speed Dial Number",
6590 Consumer::ContactStatusFlag => "Contact Status Flag",
6591 Consumer::ContactMisc => "Contact Misc.",
6592 }
6593 .into()
6594 }
6595 }
6596
6597 #[cfg(feature = "std")]
6598 impl fmt::Display for Consumer {
6599 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
6600 write!(f, "{}", self.name())
6601 }
6602 }
6603
6604 impl AsUsage for Consumer {
6605 /// Returns the 32 bit Usage value of this Usage
6606 fn usage_value(&self) -> u32 {
6607 u32::from(self)
6608 }
6609
6610 /// Returns the 16 bit Usage ID value of this Usage
6611 fn usage_id_value(&self) -> u16 {
6612 u16::from(self)
6613 }
6614
6615 /// Returns this usage as [Usage::Consumer(self)](Usage::Consumer)
6616 /// This is a convenience function to avoid having
6617 /// to implement `From` for every used type in the caller.
6618 ///
6619 /// ```
6620 /// # use hut::*;
6621 /// let gd_x = GenericDesktop::X;
6622 /// let usage = Usage::from(GenericDesktop::X);
6623 /// assert!(matches!(gd_x.usage(), usage));
6624 /// ```
6625 fn usage(&self) -> Usage {
6626 Usage::from(self)
6627 }
6628 }
6629
6630 impl AsUsagePage for Consumer {
6631 /// Returns the 16 bit value of this UsagePage
6632 ///
6633 /// This value is `0xC` for [Consumer]
6634 fn usage_page_value(&self) -> u16 {
6635 let up = UsagePage::from(self);
6636 u16::from(up)
6637 }
6638
6639 /// Returns [UsagePage::Consumer]]
6640 fn usage_page(&self) -> UsagePage {
6641 UsagePage::from(self)
6642 }
6643 }
6644
6645 impl From<&Consumer> for u16 {
6646 fn from(consumer: &Consumer) -> u16 {
6647 *consumer as u16
6648 }
6649 }
6650
6651 impl From<Consumer> for u16 {
6652 /// Returns the 16bit value of this usage. This is identical
6653 /// to [Consumer::usage_page_value()].
6654 fn from(consumer: Consumer) -> u16 {
6655 u16::from(&consumer)
6656 }
6657 }
6658
6659 impl From<&Consumer> for u32 {
6660 /// Returns the 32 bit value of this usage. This is identical
6661 /// to [Consumer::usage_value()].
6662 fn from(consumer: &Consumer) -> u32 {
6663 let up = UsagePage::from(consumer);
6664 let up = (u16::from(&up) as u32) << 16;
6665 let id = u16::from(consumer) as u32;
6666 up | id
6667 }
6668 }
6669
6670 impl From<&Consumer> for UsagePage {
6671 /// Always returns [UsagePage::Consumer] and is
6672 /// identical to [Consumer::usage_page()].
6673 fn from(_: &Consumer) -> UsagePage {
6674 UsagePage::Consumer
6675 }
6676 }
6677
6678 impl From<Consumer> for UsagePage {
6679 /// Always returns [UsagePage::Consumer] and is
6680 /// identical to [Consumer::usage_page()].
6681 fn from(_: Consumer) -> UsagePage {
6682 UsagePage::Consumer
6683 }
6684 }
6685
6686 impl From<&Consumer> for Usage {
6687 fn from(consumer: &Consumer) -> Usage {
6688 Usage::try_from(u32::from(consumer)).unwrap()
6689 }
6690 }
6691
6692 impl From<Consumer> for Usage {
6693 fn from(consumer: Consumer) -> Usage {
6694 Usage::from(&consumer)
6695 }
6696 }
6697
6698 impl TryFrom<u16> for Consumer {
6699 type Error = HutError;
6700
6701 fn try_from(usage_id: u16) -> Result<Consumer> {
6702 match usage_id {
6703 1 => Ok(Consumer::ConsumerControl),
6704 2 => Ok(Consumer::NumericKeyPad),
6705 3 => Ok(Consumer::ProgrammableButtons),
6706 4 => Ok(Consumer::Microphone),
6707 5 => Ok(Consumer::Headphone),
6708 6 => Ok(Consumer::GraphicEqualizer),
6709 32 => Ok(Consumer::Plus10),
6710 33 => Ok(Consumer::Plus100),
6711 34 => Ok(Consumer::AMPM),
6712 48 => Ok(Consumer::Power),
6713 49 => Ok(Consumer::Reset),
6714 50 => Ok(Consumer::Sleep),
6715 51 => Ok(Consumer::SleepAfter),
6716 52 => Ok(Consumer::SleepMode),
6717 53 => Ok(Consumer::Illumination),
6718 54 => Ok(Consumer::FunctionButtons),
6719 64 => Ok(Consumer::Menu),
6720 65 => Ok(Consumer::MenuPick),
6721 66 => Ok(Consumer::MenuUp),
6722 67 => Ok(Consumer::MenuDown),
6723 68 => Ok(Consumer::MenuLeft),
6724 69 => Ok(Consumer::MenuRight),
6725 70 => Ok(Consumer::MenuEscape),
6726 71 => Ok(Consumer::MenuValueIncrease),
6727 72 => Ok(Consumer::MenuValueDecrease),
6728 96 => Ok(Consumer::DataOnScreen),
6729 97 => Ok(Consumer::ClosedCaption),
6730 98 => Ok(Consumer::ClosedCaptionSelect),
6731 99 => Ok(Consumer::VCRTV),
6732 100 => Ok(Consumer::BroadcastMode),
6733 101 => Ok(Consumer::Snapshot),
6734 102 => Ok(Consumer::Still),
6735 103 => Ok(Consumer::PictureinPictureToggle),
6736 104 => Ok(Consumer::PictureinPictureSwap),
6737 105 => Ok(Consumer::RedMenuButton),
6738 106 => Ok(Consumer::GreenMenuButton),
6739 107 => Ok(Consumer::BlueMenuButton),
6740 108 => Ok(Consumer::YellowMenuButton),
6741 109 => Ok(Consumer::Aspect),
6742 110 => Ok(Consumer::ThreeDModeSelect),
6743 111 => Ok(Consumer::DisplayBrightnessIncrement),
6744 112 => Ok(Consumer::DisplayBrightnessDecrement),
6745 113 => Ok(Consumer::DisplayBrightness),
6746 114 => Ok(Consumer::DisplayBacklightToggle),
6747 115 => Ok(Consumer::DisplaySetBrightnesstoMinimum),
6748 116 => Ok(Consumer::DisplaySetBrightnesstoMaximum),
6749 117 => Ok(Consumer::DisplaySetAutoBrightness),
6750 118 => Ok(Consumer::CameraAccessEnabled),
6751 119 => Ok(Consumer::CameraAccessDisabled),
6752 120 => Ok(Consumer::CameraAccessToggle),
6753 121 => Ok(Consumer::KeyboardBrightnessIncrement),
6754 122 => Ok(Consumer::KeyboardBrightnessDecrement),
6755 123 => Ok(Consumer::KeyboardBacklightSetLevel),
6756 124 => Ok(Consumer::KeyboardBacklightOOC),
6757 125 => Ok(Consumer::KeyboardBacklightSetMinimum),
6758 126 => Ok(Consumer::KeyboardBacklightSetMaximum),
6759 127 => Ok(Consumer::KeyboardBacklightAuto),
6760 128 => Ok(Consumer::Selection),
6761 129 => Ok(Consumer::AssignSelection),
6762 130 => Ok(Consumer::ModeStep),
6763 131 => Ok(Consumer::RecallLast),
6764 132 => Ok(Consumer::EnterChannel),
6765 133 => Ok(Consumer::OrderMovie),
6766 134 => Ok(Consumer::Channel),
6767 135 => Ok(Consumer::MediaSelection),
6768 136 => Ok(Consumer::MediaSelectComputer),
6769 137 => Ok(Consumer::MediaSelectTV),
6770 138 => Ok(Consumer::MediaSelectWWW),
6771 139 => Ok(Consumer::MediaSelectDVD),
6772 140 => Ok(Consumer::MediaSelectTelephone),
6773 141 => Ok(Consumer::MediaSelectProgramGuide),
6774 142 => Ok(Consumer::MediaSelectVideoPhone),
6775 143 => Ok(Consumer::MediaSelectGames),
6776 144 => Ok(Consumer::MediaSelectMessages),
6777 145 => Ok(Consumer::MediaSelectCD),
6778 146 => Ok(Consumer::MediaSelectVCR),
6779 147 => Ok(Consumer::MediaSelectTuner),
6780 148 => Ok(Consumer::Quit),
6781 149 => Ok(Consumer::Help),
6782 150 => Ok(Consumer::MediaSelectTape),
6783 151 => Ok(Consumer::MediaSelectCable),
6784 152 => Ok(Consumer::MediaSelectSatellite),
6785 153 => Ok(Consumer::MediaSelectSecurity),
6786 154 => Ok(Consumer::MediaSelectHome),
6787 155 => Ok(Consumer::MediaSelectCall),
6788 156 => Ok(Consumer::ChannelIncrement),
6789 157 => Ok(Consumer::ChannelDecrement),
6790 158 => Ok(Consumer::MediaSelectSAP),
6791 160 => Ok(Consumer::VCRPlus),
6792 161 => Ok(Consumer::Once),
6793 162 => Ok(Consumer::Daily),
6794 163 => Ok(Consumer::Weekly),
6795 164 => Ok(Consumer::Monthly),
6796 176 => Ok(Consumer::Play),
6797 177 => Ok(Consumer::Pause),
6798 178 => Ok(Consumer::Record),
6799 179 => Ok(Consumer::FastForward),
6800 180 => Ok(Consumer::Rewind),
6801 181 => Ok(Consumer::ScanNextTrack),
6802 182 => Ok(Consumer::ScanPreviousTrack),
6803 183 => Ok(Consumer::Stop),
6804 184 => Ok(Consumer::Eject),
6805 185 => Ok(Consumer::RandomPlay),
6806 186 => Ok(Consumer::SelectDisc),
6807 187 => Ok(Consumer::EnterDisc),
6808 188 => Ok(Consumer::Repeat),
6809 189 => Ok(Consumer::Tracking),
6810 190 => Ok(Consumer::TrackNormal),
6811 191 => Ok(Consumer::SlowTracking),
6812 192 => Ok(Consumer::FrameForward),
6813 193 => Ok(Consumer::FrameBack),
6814 194 => Ok(Consumer::Mark),
6815 195 => Ok(Consumer::ClearMark),
6816 196 => Ok(Consumer::RepeatFromMark),
6817 197 => Ok(Consumer::ReturnToMark),
6818 198 => Ok(Consumer::SearchMarkForward),
6819 199 => Ok(Consumer::SearchMarkBackwards),
6820 200 => Ok(Consumer::CounterReset),
6821 201 => Ok(Consumer::ShowCounter),
6822 202 => Ok(Consumer::TrackingIncrement),
6823 203 => Ok(Consumer::TrackingDecrement),
6824 204 => Ok(Consumer::StopEject),
6825 205 => Ok(Consumer::PlayPause),
6826 206 => Ok(Consumer::PlaySkip),
6827 207 => Ok(Consumer::VoiceCommand),
6828 208 => Ok(Consumer::InvokeCaptureInterface),
6829 209 => Ok(Consumer::StartorStopGameRecording),
6830 210 => Ok(Consumer::HistoricalGameCapture),
6831 211 => Ok(Consumer::CaptureGameScreenshot),
6832 212 => Ok(Consumer::ShoworHideRecordingIndicator),
6833 213 => Ok(Consumer::StartorStopMicrophoneCapture),
6834 214 => Ok(Consumer::StartorStopCameraCapture),
6835 215 => Ok(Consumer::StartorStopGameBroadcast),
6836 216 => Ok(Consumer::StartorStopVoiceDictationSession),
6837 217 => Ok(Consumer::InvokeDismissEmojiPicker),
6838 224 => Ok(Consumer::Volume),
6839 225 => Ok(Consumer::Balance),
6840 226 => Ok(Consumer::Mute),
6841 227 => Ok(Consumer::Bass),
6842 228 => Ok(Consumer::Treble),
6843 229 => Ok(Consumer::BassBoost),
6844 230 => Ok(Consumer::SurroundMode),
6845 231 => Ok(Consumer::Loudness),
6846 232 => Ok(Consumer::MPX),
6847 233 => Ok(Consumer::VolumeIncrement),
6848 234 => Ok(Consumer::VolumeDecrement),
6849 240 => Ok(Consumer::SpeedSelect),
6850 241 => Ok(Consumer::PlaybackSpeed),
6851 242 => Ok(Consumer::StandardPlay),
6852 243 => Ok(Consumer::LongPlay),
6853 244 => Ok(Consumer::ExtendedPlay),
6854 245 => Ok(Consumer::Slow),
6855 256 => Ok(Consumer::FanEnable),
6856 257 => Ok(Consumer::FanSpeed),
6857 258 => Ok(Consumer::LightEnable),
6858 259 => Ok(Consumer::LightIlluminationLevel),
6859 260 => Ok(Consumer::ClimateControlEnable),
6860 261 => Ok(Consumer::RoomTemperature),
6861 262 => Ok(Consumer::SecurityEnable),
6862 263 => Ok(Consumer::FireAlarm),
6863 264 => Ok(Consumer::PoliceAlarm),
6864 265 => Ok(Consumer::Proximity),
6865 266 => Ok(Consumer::Motion),
6866 267 => Ok(Consumer::DuressAlarm),
6867 268 => Ok(Consumer::HoldupAlarm),
6868 269 => Ok(Consumer::MedicalAlarm),
6869 336 => Ok(Consumer::BalanceRight),
6870 337 => Ok(Consumer::BalanceLeft),
6871 338 => Ok(Consumer::BassIncrement),
6872 339 => Ok(Consumer::BassDecrement),
6873 340 => Ok(Consumer::TrebleIncrement),
6874 341 => Ok(Consumer::TrebleDecrement),
6875 352 => Ok(Consumer::SpeakerSystem),
6876 353 => Ok(Consumer::ChannelLeft),
6877 354 => Ok(Consumer::ChannelRight),
6878 355 => Ok(Consumer::ChannelCenter),
6879 356 => Ok(Consumer::ChannelFront),
6880 357 => Ok(Consumer::ChannelCenterFront),
6881 358 => Ok(Consumer::ChannelSide),
6882 359 => Ok(Consumer::ChannelSurround),
6883 360 => Ok(Consumer::ChannelLowFrequencyEnhancement),
6884 361 => Ok(Consumer::ChannelTop),
6885 362 => Ok(Consumer::ChannelUnknown),
6886 368 => Ok(Consumer::Subchannel),
6887 369 => Ok(Consumer::SubchannelIncrement),
6888 370 => Ok(Consumer::SubchannelDecrement),
6889 371 => Ok(Consumer::AlternateAudioIncrement),
6890 372 => Ok(Consumer::AlternateAudioDecrement),
6891 384 => Ok(Consumer::ApplicationLaunchButtons),
6892 385 => Ok(Consumer::ALLaunchButtonConfigurationTool),
6893 386 => Ok(Consumer::ALProgrammableButtonConfiguration),
6894 387 => Ok(Consumer::ALConsumerControlConfiguration),
6895 388 => Ok(Consumer::ALWordProcessor),
6896 389 => Ok(Consumer::ALTextEditor),
6897 390 => Ok(Consumer::ALSpreadsheet),
6898 391 => Ok(Consumer::ALGraphicsEditor),
6899 392 => Ok(Consumer::ALPresentationApp),
6900 393 => Ok(Consumer::ALDatabaseApp),
6901 394 => Ok(Consumer::ALEmailReader),
6902 395 => Ok(Consumer::ALNewsreader),
6903 396 => Ok(Consumer::ALVoicemail),
6904 397 => Ok(Consumer::ALContactsAddressBook),
6905 398 => Ok(Consumer::ALCalendarSchedule),
6906 399 => Ok(Consumer::ALTaskProjectManager),
6907 400 => Ok(Consumer::ALLogJournalTimecard),
6908 401 => Ok(Consumer::ALCheckbookFinance),
6909 402 => Ok(Consumer::ALCalculator),
6910 403 => Ok(Consumer::ALAVCapturePlayback),
6911 404 => Ok(Consumer::ALLocalMachineBrowser),
6912 405 => Ok(Consumer::ALLANWANBrowser),
6913 406 => Ok(Consumer::ALInternetBrowser),
6914 407 => Ok(Consumer::ALRemoteNetworkingISPConnect),
6915 408 => Ok(Consumer::ALNetworkConference),
6916 409 => Ok(Consumer::ALNetworkChat),
6917 410 => Ok(Consumer::ALTelephonyDialer),
6918 411 => Ok(Consumer::ALLogon),
6919 412 => Ok(Consumer::ALLogoff),
6920 413 => Ok(Consumer::ALLogonLogoff),
6921 414 => Ok(Consumer::ALTerminalLockScreensaver),
6922 415 => Ok(Consumer::ALControlPanel),
6923 416 => Ok(Consumer::ALCommandLineProcessorRun),
6924 417 => Ok(Consumer::ALProcessTaskManager),
6925 418 => Ok(Consumer::ALSelectTaskApplication),
6926 419 => Ok(Consumer::ALNextTaskApplication),
6927 420 => Ok(Consumer::ALPreviousTaskApplication),
6928 421 => Ok(Consumer::ALPreemptiveHaltTaskApplication),
6929 422 => Ok(Consumer::ALIntegratedHelpCenter),
6930 423 => Ok(Consumer::ALDocuments),
6931 424 => Ok(Consumer::ALThesaurus),
6932 425 => Ok(Consumer::ALDictionary),
6933 426 => Ok(Consumer::ALDesktop),
6934 427 => Ok(Consumer::ALSpellCheck),
6935 428 => Ok(Consumer::ALGrammarCheck),
6936 429 => Ok(Consumer::ALWirelessStatus),
6937 430 => Ok(Consumer::ALKeyboardLayout),
6938 431 => Ok(Consumer::ALVirusProtection),
6939 432 => Ok(Consumer::ALEncryption),
6940 433 => Ok(Consumer::ALScreenSaver),
6941 434 => Ok(Consumer::ALAlarms),
6942 435 => Ok(Consumer::ALClock),
6943 436 => Ok(Consumer::ALFileBrowser),
6944 437 => Ok(Consumer::ALPowerStatus),
6945 438 => Ok(Consumer::ALImageBrowser),
6946 439 => Ok(Consumer::ALAudioBrowser),
6947 440 => Ok(Consumer::ALMovieBrowser),
6948 441 => Ok(Consumer::ALDigitalRightsManager),
6949 442 => Ok(Consumer::ALDigitalWallet),
6950 444 => Ok(Consumer::ALInstantMessaging),
6951 445 => Ok(Consumer::ALOEMFeaturesTipsTutorialBrowser),
6952 446 => Ok(Consumer::ALOEMHelp),
6953 447 => Ok(Consumer::ALOnlineCommunity),
6954 448 => Ok(Consumer::ALEntertainmentContentBrowser),
6955 449 => Ok(Consumer::ALOnlineShoppingBrowser),
6956 450 => Ok(Consumer::ALSmartCardInformationHelp),
6957 451 => Ok(Consumer::ALMarketMonitorFinanceBrowser),
6958 452 => Ok(Consumer::ALCustomizedCorporateNewsBrowser),
6959 453 => Ok(Consumer::ALOnlineActivityBrowser),
6960 454 => Ok(Consumer::ALResearchSearchBrowser),
6961 455 => Ok(Consumer::ALAudioPlayer),
6962 456 => Ok(Consumer::ALMessageStatus),
6963 457 => Ok(Consumer::ALContactSync),
6964 458 => Ok(Consumer::ALNavigation),
6965 459 => Ok(Consumer::ALContextawareDesktopAssistant),
6966 512 => Ok(Consumer::GenericGUIApplicationControls),
6967 513 => Ok(Consumer::ACNew),
6968 514 => Ok(Consumer::ACOpen),
6969 515 => Ok(Consumer::ACClose),
6970 516 => Ok(Consumer::ACExit),
6971 517 => Ok(Consumer::ACMaximize),
6972 518 => Ok(Consumer::ACMinimize),
6973 519 => Ok(Consumer::ACSave),
6974 520 => Ok(Consumer::ACPrint),
6975 521 => Ok(Consumer::ACProperties),
6976 538 => Ok(Consumer::ACUndo),
6977 539 => Ok(Consumer::ACCopy),
6978 540 => Ok(Consumer::ACCut),
6979 541 => Ok(Consumer::ACPaste),
6980 542 => Ok(Consumer::ACSelectAll),
6981 543 => Ok(Consumer::ACFind),
6982 544 => Ok(Consumer::ACFindandReplace),
6983 545 => Ok(Consumer::ACSearch),
6984 546 => Ok(Consumer::ACGoTo),
6985 547 => Ok(Consumer::ACHome),
6986 548 => Ok(Consumer::ACBack),
6987 549 => Ok(Consumer::ACForward),
6988 550 => Ok(Consumer::ACStop),
6989 551 => Ok(Consumer::ACRefresh),
6990 552 => Ok(Consumer::ACPreviousLink),
6991 553 => Ok(Consumer::ACNextLink),
6992 554 => Ok(Consumer::ACBookmarks),
6993 555 => Ok(Consumer::ACHistory),
6994 556 => Ok(Consumer::ACSubscriptions),
6995 557 => Ok(Consumer::ACZoomIn),
6996 558 => Ok(Consumer::ACZoomOut),
6997 559 => Ok(Consumer::ACZoom),
6998 560 => Ok(Consumer::ACFullScreenView),
6999 561 => Ok(Consumer::ACNormalView),
7000 562 => Ok(Consumer::ACViewToggle),
7001 563 => Ok(Consumer::ACScrollUp),
7002 564 => Ok(Consumer::ACScrollDown),
7003 565 => Ok(Consumer::ACScroll),
7004 566 => Ok(Consumer::ACPanLeft),
7005 567 => Ok(Consumer::ACPanRight),
7006 568 => Ok(Consumer::ACPan),
7007 569 => Ok(Consumer::ACNewWindow),
7008 570 => Ok(Consumer::ACTileHorizontally),
7009 571 => Ok(Consumer::ACTileVertically),
7010 572 => Ok(Consumer::ACFormat),
7011 573 => Ok(Consumer::ACEdit),
7012 574 => Ok(Consumer::ACBold),
7013 575 => Ok(Consumer::ACItalics),
7014 576 => Ok(Consumer::ACUnderline),
7015 577 => Ok(Consumer::ACStrikethrough),
7016 578 => Ok(Consumer::ACSubscript),
7017 579 => Ok(Consumer::ACSuperscript),
7018 580 => Ok(Consumer::ACAllCaps),
7019 581 => Ok(Consumer::ACRotate),
7020 582 => Ok(Consumer::ACResize),
7021 583 => Ok(Consumer::ACFlipHorizontal),
7022 584 => Ok(Consumer::ACFlipVertical),
7023 585 => Ok(Consumer::ACMirrorHorizontal),
7024 586 => Ok(Consumer::ACMirrorVertical),
7025 587 => Ok(Consumer::ACFontSelect),
7026 588 => Ok(Consumer::ACFontColor),
7027 589 => Ok(Consumer::ACFontSize),
7028 590 => Ok(Consumer::ACJustifyLeft),
7029 591 => Ok(Consumer::ACJustifyCenterH),
7030 592 => Ok(Consumer::ACJustifyRight),
7031 593 => Ok(Consumer::ACJustifyBlockH),
7032 594 => Ok(Consumer::ACJustifyTop),
7033 595 => Ok(Consumer::ACJustifyCenterV),
7034 596 => Ok(Consumer::ACJustifyBottom),
7035 597 => Ok(Consumer::ACJustifyBlockV),
7036 598 => Ok(Consumer::ACIndentDecrease),
7037 599 => Ok(Consumer::ACIndentIncrease),
7038 600 => Ok(Consumer::ACNumberedList),
7039 601 => Ok(Consumer::ACRestartNumbering),
7040 602 => Ok(Consumer::ACBulletedList),
7041 603 => Ok(Consumer::ACPromote),
7042 604 => Ok(Consumer::ACDemote),
7043 605 => Ok(Consumer::ACYes),
7044 606 => Ok(Consumer::ACNo),
7045 607 => Ok(Consumer::ACCancel),
7046 608 => Ok(Consumer::ACCatalog),
7047 609 => Ok(Consumer::ACBuyCheckout),
7048 610 => Ok(Consumer::ACAddtoCart),
7049 611 => Ok(Consumer::ACExpand),
7050 612 => Ok(Consumer::ACExpandAll),
7051 613 => Ok(Consumer::ACCollapse),
7052 614 => Ok(Consumer::ACCollapseAll),
7053 615 => Ok(Consumer::ACPrintPreview),
7054 616 => Ok(Consumer::ACPasteSpecial),
7055 617 => Ok(Consumer::ACInsertMode),
7056 618 => Ok(Consumer::ACDelete),
7057 619 => Ok(Consumer::ACLock),
7058 620 => Ok(Consumer::ACUnlock),
7059 621 => Ok(Consumer::ACProtect),
7060 622 => Ok(Consumer::ACUnprotect),
7061 623 => Ok(Consumer::ACAttachComment),
7062 624 => Ok(Consumer::ACDeleteComment),
7063 625 => Ok(Consumer::ACViewComment),
7064 626 => Ok(Consumer::ACSelectWord),
7065 627 => Ok(Consumer::ACSelectSentence),
7066 628 => Ok(Consumer::ACSelectParagraph),
7067 629 => Ok(Consumer::ACSelectColumn),
7068 630 => Ok(Consumer::ACSelectRow),
7069 631 => Ok(Consumer::ACSelectTable),
7070 632 => Ok(Consumer::ACSelectObject),
7071 633 => Ok(Consumer::ACRedoRepeat),
7072 634 => Ok(Consumer::ACSort),
7073 635 => Ok(Consumer::ACSortAscending),
7074 636 => Ok(Consumer::ACSortDescending),
7075 637 => Ok(Consumer::ACFilter),
7076 638 => Ok(Consumer::ACSetClock),
7077 639 => Ok(Consumer::ACViewClock),
7078 640 => Ok(Consumer::ACSelectTimeZone),
7079 641 => Ok(Consumer::ACEditTimeZones),
7080 642 => Ok(Consumer::ACSetAlarm),
7081 643 => Ok(Consumer::ACClearAlarm),
7082 644 => Ok(Consumer::ACSnoozeAlarm),
7083 645 => Ok(Consumer::ACResetAlarm),
7084 646 => Ok(Consumer::ACSynchronize),
7085 647 => Ok(Consumer::ACSendReceive),
7086 648 => Ok(Consumer::ACSendTo),
7087 649 => Ok(Consumer::ACReply),
7088 650 => Ok(Consumer::ACReplyAll),
7089 651 => Ok(Consumer::ACForwardMsg),
7090 652 => Ok(Consumer::ACSend),
7091 653 => Ok(Consumer::ACAttachFile),
7092 654 => Ok(Consumer::ACUpload),
7093 655 => Ok(Consumer::ACDownloadSaveTargetAs),
7094 656 => Ok(Consumer::ACSetBorders),
7095 657 => Ok(Consumer::ACInsertRow),
7096 658 => Ok(Consumer::ACInsertColumn),
7097 659 => Ok(Consumer::ACInsertFile),
7098 660 => Ok(Consumer::ACInsertPicture),
7099 661 => Ok(Consumer::ACInsertObject),
7100 662 => Ok(Consumer::ACInsertSymbol),
7101 663 => Ok(Consumer::ACSaveandClose),
7102 664 => Ok(Consumer::ACRename),
7103 665 => Ok(Consumer::ACMerge),
7104 666 => Ok(Consumer::ACSplit),
7105 667 => Ok(Consumer::ACDisributeHorizontally),
7106 668 => Ok(Consumer::ACDistributeVertically),
7107 669 => Ok(Consumer::ACNextKeyboardLayoutSelect),
7108 670 => Ok(Consumer::ACNavigationGuidance),
7109 671 => Ok(Consumer::ACDesktopShowAllWindows),
7110 672 => Ok(Consumer::ACSoftKeyLeft),
7111 673 => Ok(Consumer::ACSoftKeyRight),
7112 674 => Ok(Consumer::ACDesktopShowAllApplications),
7113 688 => Ok(Consumer::ACIdleKeepAlive),
7114 704 => Ok(Consumer::ExtendedKeyboardAttributesCollection),
7115 705 => Ok(Consumer::KeyboardFormFactor),
7116 706 => Ok(Consumer::KeyboardKeyType),
7117 707 => Ok(Consumer::KeyboardPhysicalLayout),
7118 708 => Ok(Consumer::VendorSpecificKeyboardPhysicalLayout),
7119 709 => Ok(Consumer::KeyboardIETFLanguageTagIndex),
7120 710 => Ok(Consumer::ImplementedKeyboardInputAssistControls),
7121 711 => Ok(Consumer::KeyboardInputAssistPrevious),
7122 712 => Ok(Consumer::KeyboardInputAssistNext),
7123 713 => Ok(Consumer::KeyboardInputAssistPreviousGroup),
7124 714 => Ok(Consumer::KeyboardInputAssistNextGroup),
7125 715 => Ok(Consumer::KeyboardInputAssistAccept),
7126 716 => Ok(Consumer::KeyboardInputAssistCancel),
7127 720 => Ok(Consumer::PrivacyScreenToggle),
7128 721 => Ok(Consumer::PrivacyScreenLevelDecrement),
7129 722 => Ok(Consumer::PrivacyScreenLevelIncrement),
7130 723 => Ok(Consumer::PrivacyScreenLevelMinimum),
7131 724 => Ok(Consumer::PrivacyScreenLevelMaximum),
7132 1280 => Ok(Consumer::ContactEdited),
7133 1281 => Ok(Consumer::ContactAdded),
7134 1282 => Ok(Consumer::ContactRecordActive),
7135 1283 => Ok(Consumer::ContactIndex),
7136 1284 => Ok(Consumer::ContactNickname),
7137 1285 => Ok(Consumer::ContactFirstName),
7138 1286 => Ok(Consumer::ContactLastName),
7139 1287 => Ok(Consumer::ContactFullName),
7140 1288 => Ok(Consumer::ContactPhoneNumberPersonal),
7141 1289 => Ok(Consumer::ContactPhoneNumberBusiness),
7142 1290 => Ok(Consumer::ContactPhoneNumberMobile),
7143 1291 => Ok(Consumer::ContactPhoneNumberPager),
7144 1292 => Ok(Consumer::ContactPhoneNumberFax),
7145 1293 => Ok(Consumer::ContactPhoneNumberOther),
7146 1294 => Ok(Consumer::ContactEmailPersonal),
7147 1295 => Ok(Consumer::ContactEmailBusiness),
7148 1296 => Ok(Consumer::ContactEmailOther),
7149 1297 => Ok(Consumer::ContactEmailMain),
7150 1298 => Ok(Consumer::ContactSpeedDialNumber),
7151 1299 => Ok(Consumer::ContactStatusFlag),
7152 1300 => Ok(Consumer::ContactMisc),
7153 n => Err(HutError::UnknownUsageId { usage_id: n }),
7154 }
7155 }
7156 }
7157
7158 impl BitOr<u16> for Consumer {
7159 type Output = Usage;
7160
7161 /// A convenience function to combine a Usage Page with
7162 /// a value.
7163 ///
7164 /// This function panics if the Usage ID value results in
7165 /// an unknown Usage. Where error checking is required,
7166 /// use [UsagePage::to_usage_from_value].
7167 fn bitor(self, usage: u16) -> Usage {
7168 let up = u16::from(self) as u32;
7169 let u = usage as u32;
7170 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
7171 }
7172 }
7173
7174 /// *Usage Page `0xD`: "Digitizers"*
7175 ///
7176 /// **This enum is autogenerated from the HID Usage Tables**.
7177 /// ```
7178 /// # use hut::*;
7179 /// let u1 = Usage::Digitizers(Digitizers::Pen);
7180 /// let u2 = Usage::new_from_page_and_id(0xD, 0x2).unwrap();
7181 /// let u3 = Usage::from(Digitizers::Pen);
7182 /// let u4: Usage = Digitizers::Pen.into();
7183 /// assert_eq!(u1, u2);
7184 /// assert_eq!(u1, u3);
7185 /// assert_eq!(u1, u4);
7186 ///
7187 /// assert!(matches!(u1.usage_page(), UsagePage::Digitizers));
7188 /// assert_eq!(0xD, u1.usage_page_value());
7189 /// assert_eq!(0x2, u1.usage_id_value());
7190 /// assert_eq!((0xD << 16) | 0x2, u1.usage_value());
7191 /// assert_eq!("Pen", u1.name());
7192 /// ```
7193 ///
7194 #[allow(non_camel_case_types)]
7195 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
7196 #[non_exhaustive]
7197 #[repr(u16)]
7198 pub enum Digitizers {
7199 /// Usage ID `0x1`: "Digitizer"
7200 Digitizer = 0x1,
7201 /// Usage ID `0x2`: "Pen"
7202 Pen = 0x2,
7203 /// Usage ID `0x3`: "Light Pen"
7204 LightPen = 0x3,
7205 /// Usage ID `0x4`: "Touch Screen"
7206 TouchScreen = 0x4,
7207 /// Usage ID `0x5`: "Touch Pad"
7208 TouchPad = 0x5,
7209 /// Usage ID `0x6`: "Whiteboard"
7210 Whiteboard = 0x6,
7211 /// Usage ID `0x7`: "Coordinate Measuring Machine"
7212 CoordinateMeasuringMachine = 0x7,
7213 /// Usage ID `0x8`: "3D Digitizer"
7214 ThreeDDigitizer = 0x8,
7215 /// Usage ID `0x9`: "Stereo Plotter"
7216 StereoPlotter = 0x9,
7217 /// Usage ID `0xA`: "Articulated Arm"
7218 ArticulatedArm = 0xA,
7219 /// Usage ID `0xB`: "Armature"
7220 Armature = 0xB,
7221 /// Usage ID `0xC`: "Multiple Point Digitizer"
7222 MultiplePointDigitizer = 0xC,
7223 /// Usage ID `0xD`: "Free Space Wand"
7224 FreeSpaceWand = 0xD,
7225 /// Usage ID `0xE`: "Device Configuration"
7226 DeviceConfiguration = 0xE,
7227 /// Usage ID `0xF`: "Capacitive Heat Map Digitizer"
7228 CapacitiveHeatMapDigitizer = 0xF,
7229 /// Usage ID `0x20`: "Stylus"
7230 Stylus = 0x20,
7231 /// Usage ID `0x21`: "Puck"
7232 Puck = 0x21,
7233 /// Usage ID `0x22`: "Finger"
7234 Finger = 0x22,
7235 /// Usage ID `0x23`: "Device settings"
7236 Devicesettings = 0x23,
7237 /// Usage ID `0x24`: "Character Gesture"
7238 CharacterGesture = 0x24,
7239 /// Usage ID `0x30`: "Tip Pressure"
7240 TipPressure = 0x30,
7241 /// Usage ID `0x31`: "Barrel Pressure"
7242 BarrelPressure = 0x31,
7243 /// Usage ID `0x32`: "In Range"
7244 InRange = 0x32,
7245 /// Usage ID `0x33`: "Touch"
7246 Touch = 0x33,
7247 /// Usage ID `0x34`: "Untouch"
7248 Untouch = 0x34,
7249 /// Usage ID `0x35`: "Tap"
7250 Tap = 0x35,
7251 /// Usage ID `0x36`: "Quality"
7252 Quality = 0x36,
7253 /// Usage ID `0x37`: "Data Valid"
7254 DataValid = 0x37,
7255 /// Usage ID `0x38`: "Transducer Index"
7256 TransducerIndex = 0x38,
7257 /// Usage ID `0x39`: "Tablet Function Keys"
7258 TabletFunctionKeys = 0x39,
7259 /// Usage ID `0x3A`: "Program Change Keys"
7260 ProgramChangeKeys = 0x3A,
7261 /// Usage ID `0x3B`: "Battery Strength"
7262 BatteryStrength = 0x3B,
7263 /// Usage ID `0x3C`: "Invert"
7264 Invert = 0x3C,
7265 /// Usage ID `0x3D`: "X Tilt"
7266 XTilt = 0x3D,
7267 /// Usage ID `0x3E`: "Y Tilt"
7268 YTilt = 0x3E,
7269 /// Usage ID `0x3F`: "Azimuth"
7270 Azimuth = 0x3F,
7271 /// Usage ID `0x40`: "Altitude"
7272 Altitude = 0x40,
7273 /// Usage ID `0x41`: "Twist"
7274 Twist = 0x41,
7275 /// Usage ID `0x42`: "Tip Switch"
7276 TipSwitch = 0x42,
7277 /// Usage ID `0x43`: "Secondary Tip Switch"
7278 SecondaryTipSwitch = 0x43,
7279 /// Usage ID `0x44`: "Barrel Switch"
7280 BarrelSwitch = 0x44,
7281 /// Usage ID `0x45`: "Eraser"
7282 Eraser = 0x45,
7283 /// Usage ID `0x46`: "Tablet Pick"
7284 TabletPick = 0x46,
7285 /// Usage ID `0x47`: "Touch Valid"
7286 TouchValid = 0x47,
7287 /// Usage ID `0x48`: "Width"
7288 Width = 0x48,
7289 /// Usage ID `0x49`: "Height"
7290 Height = 0x49,
7291 /// Usage ID `0x51`: "Contact Identifier"
7292 ContactIdentifier = 0x51,
7293 /// Usage ID `0x52`: "Device Mode"
7294 DeviceMode = 0x52,
7295 /// Usage ID `0x53`: "Device Identifier"
7296 DeviceIdentifier = 0x53,
7297 /// Usage ID `0x54`: "Contact Count"
7298 ContactCount = 0x54,
7299 /// Usage ID `0x55`: "Contact Count Maximum"
7300 ContactCountMaximum = 0x55,
7301 /// Usage ID `0x56`: "Scan Time"
7302 ScanTime = 0x56,
7303 /// Usage ID `0x57`: "Surface Switch"
7304 SurfaceSwitch = 0x57,
7305 /// Usage ID `0x58`: "Button Switch"
7306 ButtonSwitch = 0x58,
7307 /// Usage ID `0x59`: "Pad Type"
7308 PadType = 0x59,
7309 /// Usage ID `0x5A`: "Secondary Barrel Switch"
7310 SecondaryBarrelSwitch = 0x5A,
7311 /// Usage ID `0x5B`: "Transducer Serial Number"
7312 TransducerSerialNumber = 0x5B,
7313 /// Usage ID `0x5C`: "Preferred Color"
7314 PreferredColor = 0x5C,
7315 /// Usage ID `0x5D`: "Preferred Color is Locked"
7316 PreferredColorisLocked = 0x5D,
7317 /// Usage ID `0x5E`: "Preferred Line Width"
7318 PreferredLineWidth = 0x5E,
7319 /// Usage ID `0x5F`: "Preferred Line Width is Locked"
7320 PreferredLineWidthisLocked = 0x5F,
7321 /// Usage ID `0x60`: "Latency Mode"
7322 LatencyMode = 0x60,
7323 /// Usage ID `0x61`: "Gesture Character Quality"
7324 GestureCharacterQuality = 0x61,
7325 /// Usage ID `0x62`: "Character Gesture Data Length"
7326 CharacterGestureDataLength = 0x62,
7327 /// Usage ID `0x63`: "Character Gesture Data"
7328 CharacterGestureData = 0x63,
7329 /// Usage ID `0x64`: "Gesture Character Encoding"
7330 GestureCharacterEncoding = 0x64,
7331 /// Usage ID `0x65`: "UTF8 Character Gesture Encoding"
7332 UTF8CharacterGestureEncoding = 0x65,
7333 /// Usage ID `0x66`: "UTF16 Little Endian Character Gesture Encoding"
7334 UTF16LittleEndianCharacterGestureEncoding = 0x66,
7335 /// Usage ID `0x67`: "UTF16 Big Endian Character Gesture Encoding"
7336 UTF16BigEndianCharacterGestureEncoding = 0x67,
7337 /// Usage ID `0x68`: "UTF32 Little Endian Character Gesture Encoding"
7338 UTF32LittleEndianCharacterGestureEncoding = 0x68,
7339 /// Usage ID `0x69`: "UTF32 Big Endian Character Gesture Encoding"
7340 UTF32BigEndianCharacterGestureEncoding = 0x69,
7341 /// Usage ID `0x6A`: "Capacitive Heat Map Protocol Vendor ID"
7342 CapacitiveHeatMapProtocolVendorID = 0x6A,
7343 /// Usage ID `0x6B`: "Capacitive Heat Map Protocol Version"
7344 CapacitiveHeatMapProtocolVersion = 0x6B,
7345 /// Usage ID `0x6C`: "Capacitive Heat Map Frame Data"
7346 CapacitiveHeatMapFrameData = 0x6C,
7347 /// Usage ID `0x6D`: "Gesture Character Enable"
7348 GestureCharacterEnable = 0x6D,
7349 /// Usage ID `0x6E`: "Transducer Serial Number Part 2"
7350 TransducerSerialNumberPart2 = 0x6E,
7351 /// Usage ID `0x6F`: "No Preferred Color"
7352 NoPreferredColor = 0x6F,
7353 /// Usage ID `0x70`: "Preferred Line Style"
7354 PreferredLineStyle = 0x70,
7355 /// Usage ID `0x71`: "Preferred Line Style is Locked"
7356 PreferredLineStyleisLocked = 0x71,
7357 /// Usage ID `0x72`: "Ink"
7358 Ink = 0x72,
7359 /// Usage ID `0x73`: "Pencil"
7360 Pencil = 0x73,
7361 /// Usage ID `0x74`: "Highlighter"
7362 Highlighter = 0x74,
7363 /// Usage ID `0x75`: "Chisel Marker"
7364 ChiselMarker = 0x75,
7365 /// Usage ID `0x76`: "Brush"
7366 Brush = 0x76,
7367 /// Usage ID `0x77`: "No Preference"
7368 NoPreference = 0x77,
7369 /// Usage ID `0x80`: "Digitizer Diagnostic"
7370 DigitizerDiagnostic = 0x80,
7371 /// Usage ID `0x81`: "Digitizer Error"
7372 DigitizerError = 0x81,
7373 /// Usage ID `0x82`: "Err Normal Status"
7374 ErrNormalStatus = 0x82,
7375 /// Usage ID `0x83`: "Err Transducers Exceeded"
7376 ErrTransducersExceeded = 0x83,
7377 /// Usage ID `0x84`: "Err Full Trans Features Unavailable"
7378 ErrFullTransFeaturesUnavailable = 0x84,
7379 /// Usage ID `0x85`: "Err Charge Low"
7380 ErrChargeLow = 0x85,
7381 /// Usage ID `0x90`: "Transducer Software Info"
7382 TransducerSoftwareInfo = 0x90,
7383 /// Usage ID `0x91`: "Transducer Vendor Id"
7384 TransducerVendorId = 0x91,
7385 /// Usage ID `0x92`: "Transducer Product Id"
7386 TransducerProductId = 0x92,
7387 /// Usage ID `0x93`: "Device Supported Protocols"
7388 DeviceSupportedProtocols = 0x93,
7389 /// Usage ID `0x94`: "Transducer Supported Protocols"
7390 TransducerSupportedProtocols = 0x94,
7391 /// Usage ID `0x95`: "No Protocol"
7392 NoProtocol = 0x95,
7393 /// Usage ID `0x96`: "Wacom AES Protocol"
7394 WacomAESProtocol = 0x96,
7395 /// Usage ID `0x97`: "USI Protocol"
7396 USIProtocol = 0x97,
7397 /// Usage ID `0x98`: "Microsoft Pen Protocol"
7398 MicrosoftPenProtocol = 0x98,
7399 /// Usage ID `0xA0`: "Supported Report Rates"
7400 SupportedReportRates = 0xA0,
7401 /// Usage ID `0xA1`: "Report Rate"
7402 ReportRate = 0xA1,
7403 /// Usage ID `0xA2`: "Transducer Connected"
7404 TransducerConnected = 0xA2,
7405 /// Usage ID `0xA3`: "Switch Disabled"
7406 SwitchDisabled = 0xA3,
7407 /// Usage ID `0xA4`: "Switch Unimplemented"
7408 SwitchUnimplemented = 0xA4,
7409 /// Usage ID `0xA5`: "Transducer Switches"
7410 TransducerSwitches = 0xA5,
7411 /// Usage ID `0xA6`: "Transducer Index Selector"
7412 TransducerIndexSelector = 0xA6,
7413 /// Usage ID `0xB0`: "Button Press Threshold"
7414 ButtonPressThreshold = 0xB0,
7415 }
7416
7417 impl Digitizers {
7418 #[cfg(feature = "std")]
7419 pub fn name(&self) -> String {
7420 match self {
7421 Digitizers::Digitizer => "Digitizer",
7422 Digitizers::Pen => "Pen",
7423 Digitizers::LightPen => "Light Pen",
7424 Digitizers::TouchScreen => "Touch Screen",
7425 Digitizers::TouchPad => "Touch Pad",
7426 Digitizers::Whiteboard => "Whiteboard",
7427 Digitizers::CoordinateMeasuringMachine => "Coordinate Measuring Machine",
7428 Digitizers::ThreeDDigitizer => "3D Digitizer",
7429 Digitizers::StereoPlotter => "Stereo Plotter",
7430 Digitizers::ArticulatedArm => "Articulated Arm",
7431 Digitizers::Armature => "Armature",
7432 Digitizers::MultiplePointDigitizer => "Multiple Point Digitizer",
7433 Digitizers::FreeSpaceWand => "Free Space Wand",
7434 Digitizers::DeviceConfiguration => "Device Configuration",
7435 Digitizers::CapacitiveHeatMapDigitizer => "Capacitive Heat Map Digitizer",
7436 Digitizers::Stylus => "Stylus",
7437 Digitizers::Puck => "Puck",
7438 Digitizers::Finger => "Finger",
7439 Digitizers::Devicesettings => "Device settings",
7440 Digitizers::CharacterGesture => "Character Gesture",
7441 Digitizers::TipPressure => "Tip Pressure",
7442 Digitizers::BarrelPressure => "Barrel Pressure",
7443 Digitizers::InRange => "In Range",
7444 Digitizers::Touch => "Touch",
7445 Digitizers::Untouch => "Untouch",
7446 Digitizers::Tap => "Tap",
7447 Digitizers::Quality => "Quality",
7448 Digitizers::DataValid => "Data Valid",
7449 Digitizers::TransducerIndex => "Transducer Index",
7450 Digitizers::TabletFunctionKeys => "Tablet Function Keys",
7451 Digitizers::ProgramChangeKeys => "Program Change Keys",
7452 Digitizers::BatteryStrength => "Battery Strength",
7453 Digitizers::Invert => "Invert",
7454 Digitizers::XTilt => "X Tilt",
7455 Digitizers::YTilt => "Y Tilt",
7456 Digitizers::Azimuth => "Azimuth",
7457 Digitizers::Altitude => "Altitude",
7458 Digitizers::Twist => "Twist",
7459 Digitizers::TipSwitch => "Tip Switch",
7460 Digitizers::SecondaryTipSwitch => "Secondary Tip Switch",
7461 Digitizers::BarrelSwitch => "Barrel Switch",
7462 Digitizers::Eraser => "Eraser",
7463 Digitizers::TabletPick => "Tablet Pick",
7464 Digitizers::TouchValid => "Touch Valid",
7465 Digitizers::Width => "Width",
7466 Digitizers::Height => "Height",
7467 Digitizers::ContactIdentifier => "Contact Identifier",
7468 Digitizers::DeviceMode => "Device Mode",
7469 Digitizers::DeviceIdentifier => "Device Identifier",
7470 Digitizers::ContactCount => "Contact Count",
7471 Digitizers::ContactCountMaximum => "Contact Count Maximum",
7472 Digitizers::ScanTime => "Scan Time",
7473 Digitizers::SurfaceSwitch => "Surface Switch",
7474 Digitizers::ButtonSwitch => "Button Switch",
7475 Digitizers::PadType => "Pad Type",
7476 Digitizers::SecondaryBarrelSwitch => "Secondary Barrel Switch",
7477 Digitizers::TransducerSerialNumber => "Transducer Serial Number",
7478 Digitizers::PreferredColor => "Preferred Color",
7479 Digitizers::PreferredColorisLocked => "Preferred Color is Locked",
7480 Digitizers::PreferredLineWidth => "Preferred Line Width",
7481 Digitizers::PreferredLineWidthisLocked => "Preferred Line Width is Locked",
7482 Digitizers::LatencyMode => "Latency Mode",
7483 Digitizers::GestureCharacterQuality => "Gesture Character Quality",
7484 Digitizers::CharacterGestureDataLength => "Character Gesture Data Length",
7485 Digitizers::CharacterGestureData => "Character Gesture Data",
7486 Digitizers::GestureCharacterEncoding => "Gesture Character Encoding",
7487 Digitizers::UTF8CharacterGestureEncoding => "UTF8 Character Gesture Encoding",
7488 Digitizers::UTF16LittleEndianCharacterGestureEncoding => {
7489 "UTF16 Little Endian Character Gesture Encoding"
7490 }
7491 Digitizers::UTF16BigEndianCharacterGestureEncoding => {
7492 "UTF16 Big Endian Character Gesture Encoding"
7493 }
7494 Digitizers::UTF32LittleEndianCharacterGestureEncoding => {
7495 "UTF32 Little Endian Character Gesture Encoding"
7496 }
7497 Digitizers::UTF32BigEndianCharacterGestureEncoding => {
7498 "UTF32 Big Endian Character Gesture Encoding"
7499 }
7500 Digitizers::CapacitiveHeatMapProtocolVendorID => {
7501 "Capacitive Heat Map Protocol Vendor ID"
7502 }
7503 Digitizers::CapacitiveHeatMapProtocolVersion => "Capacitive Heat Map Protocol Version",
7504 Digitizers::CapacitiveHeatMapFrameData => "Capacitive Heat Map Frame Data",
7505 Digitizers::GestureCharacterEnable => "Gesture Character Enable",
7506 Digitizers::TransducerSerialNumberPart2 => "Transducer Serial Number Part 2",
7507 Digitizers::NoPreferredColor => "No Preferred Color",
7508 Digitizers::PreferredLineStyle => "Preferred Line Style",
7509 Digitizers::PreferredLineStyleisLocked => "Preferred Line Style is Locked",
7510 Digitizers::Ink => "Ink",
7511 Digitizers::Pencil => "Pencil",
7512 Digitizers::Highlighter => "Highlighter",
7513 Digitizers::ChiselMarker => "Chisel Marker",
7514 Digitizers::Brush => "Brush",
7515 Digitizers::NoPreference => "No Preference",
7516 Digitizers::DigitizerDiagnostic => "Digitizer Diagnostic",
7517 Digitizers::DigitizerError => "Digitizer Error",
7518 Digitizers::ErrNormalStatus => "Err Normal Status",
7519 Digitizers::ErrTransducersExceeded => "Err Transducers Exceeded",
7520 Digitizers::ErrFullTransFeaturesUnavailable => "Err Full Trans Features Unavailable",
7521 Digitizers::ErrChargeLow => "Err Charge Low",
7522 Digitizers::TransducerSoftwareInfo => "Transducer Software Info",
7523 Digitizers::TransducerVendorId => "Transducer Vendor Id",
7524 Digitizers::TransducerProductId => "Transducer Product Id",
7525 Digitizers::DeviceSupportedProtocols => "Device Supported Protocols",
7526 Digitizers::TransducerSupportedProtocols => "Transducer Supported Protocols",
7527 Digitizers::NoProtocol => "No Protocol",
7528 Digitizers::WacomAESProtocol => "Wacom AES Protocol",
7529 Digitizers::USIProtocol => "USI Protocol",
7530 Digitizers::MicrosoftPenProtocol => "Microsoft Pen Protocol",
7531 Digitizers::SupportedReportRates => "Supported Report Rates",
7532 Digitizers::ReportRate => "Report Rate",
7533 Digitizers::TransducerConnected => "Transducer Connected",
7534 Digitizers::SwitchDisabled => "Switch Disabled",
7535 Digitizers::SwitchUnimplemented => "Switch Unimplemented",
7536 Digitizers::TransducerSwitches => "Transducer Switches",
7537 Digitizers::TransducerIndexSelector => "Transducer Index Selector",
7538 Digitizers::ButtonPressThreshold => "Button Press Threshold",
7539 }
7540 .into()
7541 }
7542 }
7543
7544 #[cfg(feature = "std")]
7545 impl fmt::Display for Digitizers {
7546 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
7547 write!(f, "{}", self.name())
7548 }
7549 }
7550
7551 impl AsUsage for Digitizers {
7552 /// Returns the 32 bit Usage value of this Usage
7553 fn usage_value(&self) -> u32 {
7554 u32::from(self)
7555 }
7556
7557 /// Returns the 16 bit Usage ID value of this Usage
7558 fn usage_id_value(&self) -> u16 {
7559 u16::from(self)
7560 }
7561
7562 /// Returns this usage as [Usage::Digitizers(self)](Usage::Digitizers)
7563 /// This is a convenience function to avoid having
7564 /// to implement `From` for every used type in the caller.
7565 ///
7566 /// ```
7567 /// # use hut::*;
7568 /// let gd_x = GenericDesktop::X;
7569 /// let usage = Usage::from(GenericDesktop::X);
7570 /// assert!(matches!(gd_x.usage(), usage));
7571 /// ```
7572 fn usage(&self) -> Usage {
7573 Usage::from(self)
7574 }
7575 }
7576
7577 impl AsUsagePage for Digitizers {
7578 /// Returns the 16 bit value of this UsagePage
7579 ///
7580 /// This value is `0xD` for [Digitizers]
7581 fn usage_page_value(&self) -> u16 {
7582 let up = UsagePage::from(self);
7583 u16::from(up)
7584 }
7585
7586 /// Returns [UsagePage::Digitizers]]
7587 fn usage_page(&self) -> UsagePage {
7588 UsagePage::from(self)
7589 }
7590 }
7591
7592 impl From<&Digitizers> for u16 {
7593 fn from(digitizers: &Digitizers) -> u16 {
7594 *digitizers as u16
7595 }
7596 }
7597
7598 impl From<Digitizers> for u16 {
7599 /// Returns the 16bit value of this usage. This is identical
7600 /// to [Digitizers::usage_page_value()].
7601 fn from(digitizers: Digitizers) -> u16 {
7602 u16::from(&digitizers)
7603 }
7604 }
7605
7606 impl From<&Digitizers> for u32 {
7607 /// Returns the 32 bit value of this usage. This is identical
7608 /// to [Digitizers::usage_value()].
7609 fn from(digitizers: &Digitizers) -> u32 {
7610 let up = UsagePage::from(digitizers);
7611 let up = (u16::from(&up) as u32) << 16;
7612 let id = u16::from(digitizers) as u32;
7613 up | id
7614 }
7615 }
7616
7617 impl From<&Digitizers> for UsagePage {
7618 /// Always returns [UsagePage::Digitizers] and is
7619 /// identical to [Digitizers::usage_page()].
7620 fn from(_: &Digitizers) -> UsagePage {
7621 UsagePage::Digitizers
7622 }
7623 }
7624
7625 impl From<Digitizers> for UsagePage {
7626 /// Always returns [UsagePage::Digitizers] and is
7627 /// identical to [Digitizers::usage_page()].
7628 fn from(_: Digitizers) -> UsagePage {
7629 UsagePage::Digitizers
7630 }
7631 }
7632
7633 impl From<&Digitizers> for Usage {
7634 fn from(digitizers: &Digitizers) -> Usage {
7635 Usage::try_from(u32::from(digitizers)).unwrap()
7636 }
7637 }
7638
7639 impl From<Digitizers> for Usage {
7640 fn from(digitizers: Digitizers) -> Usage {
7641 Usage::from(&digitizers)
7642 }
7643 }
7644
7645 impl TryFrom<u16> for Digitizers {
7646 type Error = HutError;
7647
7648 fn try_from(usage_id: u16) -> Result<Digitizers> {
7649 match usage_id {
7650 1 => Ok(Digitizers::Digitizer),
7651 2 => Ok(Digitizers::Pen),
7652 3 => Ok(Digitizers::LightPen),
7653 4 => Ok(Digitizers::TouchScreen),
7654 5 => Ok(Digitizers::TouchPad),
7655 6 => Ok(Digitizers::Whiteboard),
7656 7 => Ok(Digitizers::CoordinateMeasuringMachine),
7657 8 => Ok(Digitizers::ThreeDDigitizer),
7658 9 => Ok(Digitizers::StereoPlotter),
7659 10 => Ok(Digitizers::ArticulatedArm),
7660 11 => Ok(Digitizers::Armature),
7661 12 => Ok(Digitizers::MultiplePointDigitizer),
7662 13 => Ok(Digitizers::FreeSpaceWand),
7663 14 => Ok(Digitizers::DeviceConfiguration),
7664 15 => Ok(Digitizers::CapacitiveHeatMapDigitizer),
7665 32 => Ok(Digitizers::Stylus),
7666 33 => Ok(Digitizers::Puck),
7667 34 => Ok(Digitizers::Finger),
7668 35 => Ok(Digitizers::Devicesettings),
7669 36 => Ok(Digitizers::CharacterGesture),
7670 48 => Ok(Digitizers::TipPressure),
7671 49 => Ok(Digitizers::BarrelPressure),
7672 50 => Ok(Digitizers::InRange),
7673 51 => Ok(Digitizers::Touch),
7674 52 => Ok(Digitizers::Untouch),
7675 53 => Ok(Digitizers::Tap),
7676 54 => Ok(Digitizers::Quality),
7677 55 => Ok(Digitizers::DataValid),
7678 56 => Ok(Digitizers::TransducerIndex),
7679 57 => Ok(Digitizers::TabletFunctionKeys),
7680 58 => Ok(Digitizers::ProgramChangeKeys),
7681 59 => Ok(Digitizers::BatteryStrength),
7682 60 => Ok(Digitizers::Invert),
7683 61 => Ok(Digitizers::XTilt),
7684 62 => Ok(Digitizers::YTilt),
7685 63 => Ok(Digitizers::Azimuth),
7686 64 => Ok(Digitizers::Altitude),
7687 65 => Ok(Digitizers::Twist),
7688 66 => Ok(Digitizers::TipSwitch),
7689 67 => Ok(Digitizers::SecondaryTipSwitch),
7690 68 => Ok(Digitizers::BarrelSwitch),
7691 69 => Ok(Digitizers::Eraser),
7692 70 => Ok(Digitizers::TabletPick),
7693 71 => Ok(Digitizers::TouchValid),
7694 72 => Ok(Digitizers::Width),
7695 73 => Ok(Digitizers::Height),
7696 81 => Ok(Digitizers::ContactIdentifier),
7697 82 => Ok(Digitizers::DeviceMode),
7698 83 => Ok(Digitizers::DeviceIdentifier),
7699 84 => Ok(Digitizers::ContactCount),
7700 85 => Ok(Digitizers::ContactCountMaximum),
7701 86 => Ok(Digitizers::ScanTime),
7702 87 => Ok(Digitizers::SurfaceSwitch),
7703 88 => Ok(Digitizers::ButtonSwitch),
7704 89 => Ok(Digitizers::PadType),
7705 90 => Ok(Digitizers::SecondaryBarrelSwitch),
7706 91 => Ok(Digitizers::TransducerSerialNumber),
7707 92 => Ok(Digitizers::PreferredColor),
7708 93 => Ok(Digitizers::PreferredColorisLocked),
7709 94 => Ok(Digitizers::PreferredLineWidth),
7710 95 => Ok(Digitizers::PreferredLineWidthisLocked),
7711 96 => Ok(Digitizers::LatencyMode),
7712 97 => Ok(Digitizers::GestureCharacterQuality),
7713 98 => Ok(Digitizers::CharacterGestureDataLength),
7714 99 => Ok(Digitizers::CharacterGestureData),
7715 100 => Ok(Digitizers::GestureCharacterEncoding),
7716 101 => Ok(Digitizers::UTF8CharacterGestureEncoding),
7717 102 => Ok(Digitizers::UTF16LittleEndianCharacterGestureEncoding),
7718 103 => Ok(Digitizers::UTF16BigEndianCharacterGestureEncoding),
7719 104 => Ok(Digitizers::UTF32LittleEndianCharacterGestureEncoding),
7720 105 => Ok(Digitizers::UTF32BigEndianCharacterGestureEncoding),
7721 106 => Ok(Digitizers::CapacitiveHeatMapProtocolVendorID),
7722 107 => Ok(Digitizers::CapacitiveHeatMapProtocolVersion),
7723 108 => Ok(Digitizers::CapacitiveHeatMapFrameData),
7724 109 => Ok(Digitizers::GestureCharacterEnable),
7725 110 => Ok(Digitizers::TransducerSerialNumberPart2),
7726 111 => Ok(Digitizers::NoPreferredColor),
7727 112 => Ok(Digitizers::PreferredLineStyle),
7728 113 => Ok(Digitizers::PreferredLineStyleisLocked),
7729 114 => Ok(Digitizers::Ink),
7730 115 => Ok(Digitizers::Pencil),
7731 116 => Ok(Digitizers::Highlighter),
7732 117 => Ok(Digitizers::ChiselMarker),
7733 118 => Ok(Digitizers::Brush),
7734 119 => Ok(Digitizers::NoPreference),
7735 128 => Ok(Digitizers::DigitizerDiagnostic),
7736 129 => Ok(Digitizers::DigitizerError),
7737 130 => Ok(Digitizers::ErrNormalStatus),
7738 131 => Ok(Digitizers::ErrTransducersExceeded),
7739 132 => Ok(Digitizers::ErrFullTransFeaturesUnavailable),
7740 133 => Ok(Digitizers::ErrChargeLow),
7741 144 => Ok(Digitizers::TransducerSoftwareInfo),
7742 145 => Ok(Digitizers::TransducerVendorId),
7743 146 => Ok(Digitizers::TransducerProductId),
7744 147 => Ok(Digitizers::DeviceSupportedProtocols),
7745 148 => Ok(Digitizers::TransducerSupportedProtocols),
7746 149 => Ok(Digitizers::NoProtocol),
7747 150 => Ok(Digitizers::WacomAESProtocol),
7748 151 => Ok(Digitizers::USIProtocol),
7749 152 => Ok(Digitizers::MicrosoftPenProtocol),
7750 160 => Ok(Digitizers::SupportedReportRates),
7751 161 => Ok(Digitizers::ReportRate),
7752 162 => Ok(Digitizers::TransducerConnected),
7753 163 => Ok(Digitizers::SwitchDisabled),
7754 164 => Ok(Digitizers::SwitchUnimplemented),
7755 165 => Ok(Digitizers::TransducerSwitches),
7756 166 => Ok(Digitizers::TransducerIndexSelector),
7757 176 => Ok(Digitizers::ButtonPressThreshold),
7758 n => Err(HutError::UnknownUsageId { usage_id: n }),
7759 }
7760 }
7761 }
7762
7763 impl BitOr<u16> for Digitizers {
7764 type Output = Usage;
7765
7766 /// A convenience function to combine a Usage Page with
7767 /// a value.
7768 ///
7769 /// This function panics if the Usage ID value results in
7770 /// an unknown Usage. Where error checking is required,
7771 /// use [UsagePage::to_usage_from_value].
7772 fn bitor(self, usage: u16) -> Usage {
7773 let up = u16::from(self) as u32;
7774 let u = usage as u32;
7775 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
7776 }
7777 }
7778
7779 /// *Usage Page `0xE`: "Haptics"*
7780 ///
7781 /// **This enum is autogenerated from the HID Usage Tables**.
7782 /// ```
7783 /// # use hut::*;
7784 /// let u1 = Usage::Haptics(Haptics::WaveformList);
7785 /// let u2 = Usage::new_from_page_and_id(0xE, 0x10).unwrap();
7786 /// let u3 = Usage::from(Haptics::WaveformList);
7787 /// let u4: Usage = Haptics::WaveformList.into();
7788 /// assert_eq!(u1, u2);
7789 /// assert_eq!(u1, u3);
7790 /// assert_eq!(u1, u4);
7791 ///
7792 /// assert!(matches!(u1.usage_page(), UsagePage::Haptics));
7793 /// assert_eq!(0xE, u1.usage_page_value());
7794 /// assert_eq!(0x10, u1.usage_id_value());
7795 /// assert_eq!((0xE << 16) | 0x10, u1.usage_value());
7796 /// assert_eq!("Waveform List", u1.name());
7797 /// ```
7798 ///
7799 #[allow(non_camel_case_types)]
7800 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
7801 #[non_exhaustive]
7802 #[repr(u16)]
7803 pub enum Haptics {
7804 /// Usage ID `0x1`: "Simple Haptic Controller"
7805 SimpleHapticController = 0x1,
7806 /// Usage ID `0x10`: "Waveform List"
7807 WaveformList = 0x10,
7808 /// Usage ID `0x11`: "Duration List"
7809 DurationList = 0x11,
7810 /// Usage ID `0x20`: "Auto Trigger"
7811 AutoTrigger = 0x20,
7812 /// Usage ID `0x21`: "Manual Trigger"
7813 ManualTrigger = 0x21,
7814 /// Usage ID `0x22`: "Auto Trigger Associated Control"
7815 AutoTriggerAssociatedControl = 0x22,
7816 /// Usage ID `0x23`: "Intensity"
7817 Intensity = 0x23,
7818 /// Usage ID `0x24`: "Repeat Count"
7819 RepeatCount = 0x24,
7820 /// Usage ID `0x25`: "Retrigger Period"
7821 RetriggerPeriod = 0x25,
7822 /// Usage ID `0x26`: "Waveform Vendor Page"
7823 WaveformVendorPage = 0x26,
7824 /// Usage ID `0x27`: "Waveform Vendor ID"
7825 WaveformVendorID = 0x27,
7826 /// Usage ID `0x28`: "Waveform Cutoff Time"
7827 WaveformCutoffTime = 0x28,
7828 /// Usage ID `0x1001`: "Waveform None"
7829 WaveformNone = 0x1001,
7830 /// Usage ID `0x1002`: "Waveform Stop"
7831 WaveformStop = 0x1002,
7832 /// Usage ID `0x1003`: "Waveform Click"
7833 WaveformClick = 0x1003,
7834 /// Usage ID `0x1004`: "Waveform Buzz Continuous"
7835 WaveformBuzzContinuous = 0x1004,
7836 /// Usage ID `0x1005`: "Waveform Rumble Continuous"
7837 WaveformRumbleContinuous = 0x1005,
7838 /// Usage ID `0x1006`: "Waveform Press"
7839 WaveformPress = 0x1006,
7840 /// Usage ID `0x1007`: "Waveform Release"
7841 WaveformRelease = 0x1007,
7842 /// Usage ID `0x1008`: "Waveform Hover"
7843 WaveformHover = 0x1008,
7844 /// Usage ID `0x1009`: "Waveform Success"
7845 WaveformSuccess = 0x1009,
7846 /// Usage ID `0x100A`: "Waveform Error"
7847 WaveformError = 0x100A,
7848 /// Usage ID `0x100B`: "Waveform Ink Continuous"
7849 WaveformInkContinuous = 0x100B,
7850 /// Usage ID `0x100C`: "Waveform Pencil Continuous"
7851 WaveformPencilContinuous = 0x100C,
7852 /// Usage ID `0x100D`: "Waveform Marker Continuous"
7853 WaveformMarkerContinuous = 0x100D,
7854 /// Usage ID `0x100E`: "Waveform Chisel Marker Continuous"
7855 WaveformChiselMarkerContinuous = 0x100E,
7856 /// Usage ID `0x100F`: "Waveform Brush Continuous"
7857 WaveformBrushContinuous = 0x100F,
7858 /// Usage ID `0x1010`: "Waveform Eraser Continuous"
7859 WaveformEraserContinuous = 0x1010,
7860 /// Usage ID `0x1011`: "Waveform Sparkle Continuous"
7861 WaveformSparkleContinuous = 0x1011,
7862 }
7863
7864 impl Haptics {
7865 #[cfg(feature = "std")]
7866 pub fn name(&self) -> String {
7867 match self {
7868 Haptics::SimpleHapticController => "Simple Haptic Controller",
7869 Haptics::WaveformList => "Waveform List",
7870 Haptics::DurationList => "Duration List",
7871 Haptics::AutoTrigger => "Auto Trigger",
7872 Haptics::ManualTrigger => "Manual Trigger",
7873 Haptics::AutoTriggerAssociatedControl => "Auto Trigger Associated Control",
7874 Haptics::Intensity => "Intensity",
7875 Haptics::RepeatCount => "Repeat Count",
7876 Haptics::RetriggerPeriod => "Retrigger Period",
7877 Haptics::WaveformVendorPage => "Waveform Vendor Page",
7878 Haptics::WaveformVendorID => "Waveform Vendor ID",
7879 Haptics::WaveformCutoffTime => "Waveform Cutoff Time",
7880 Haptics::WaveformNone => "Waveform None",
7881 Haptics::WaveformStop => "Waveform Stop",
7882 Haptics::WaveformClick => "Waveform Click",
7883 Haptics::WaveformBuzzContinuous => "Waveform Buzz Continuous",
7884 Haptics::WaveformRumbleContinuous => "Waveform Rumble Continuous",
7885 Haptics::WaveformPress => "Waveform Press",
7886 Haptics::WaveformRelease => "Waveform Release",
7887 Haptics::WaveformHover => "Waveform Hover",
7888 Haptics::WaveformSuccess => "Waveform Success",
7889 Haptics::WaveformError => "Waveform Error",
7890 Haptics::WaveformInkContinuous => "Waveform Ink Continuous",
7891 Haptics::WaveformPencilContinuous => "Waveform Pencil Continuous",
7892 Haptics::WaveformMarkerContinuous => "Waveform Marker Continuous",
7893 Haptics::WaveformChiselMarkerContinuous => "Waveform Chisel Marker Continuous",
7894 Haptics::WaveformBrushContinuous => "Waveform Brush Continuous",
7895 Haptics::WaveformEraserContinuous => "Waveform Eraser Continuous",
7896 Haptics::WaveformSparkleContinuous => "Waveform Sparkle Continuous",
7897 }
7898 .into()
7899 }
7900 }
7901
7902 #[cfg(feature = "std")]
7903 impl fmt::Display for Haptics {
7904 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
7905 write!(f, "{}", self.name())
7906 }
7907 }
7908
7909 impl AsUsage for Haptics {
7910 /// Returns the 32 bit Usage value of this Usage
7911 fn usage_value(&self) -> u32 {
7912 u32::from(self)
7913 }
7914
7915 /// Returns the 16 bit Usage ID value of this Usage
7916 fn usage_id_value(&self) -> u16 {
7917 u16::from(self)
7918 }
7919
7920 /// Returns this usage as [Usage::Haptics(self)](Usage::Haptics)
7921 /// This is a convenience function to avoid having
7922 /// to implement `From` for every used type in the caller.
7923 ///
7924 /// ```
7925 /// # use hut::*;
7926 /// let gd_x = GenericDesktop::X;
7927 /// let usage = Usage::from(GenericDesktop::X);
7928 /// assert!(matches!(gd_x.usage(), usage));
7929 /// ```
7930 fn usage(&self) -> Usage {
7931 Usage::from(self)
7932 }
7933 }
7934
7935 impl AsUsagePage for Haptics {
7936 /// Returns the 16 bit value of this UsagePage
7937 ///
7938 /// This value is `0xE` for [Haptics]
7939 fn usage_page_value(&self) -> u16 {
7940 let up = UsagePage::from(self);
7941 u16::from(up)
7942 }
7943
7944 /// Returns [UsagePage::Haptics]]
7945 fn usage_page(&self) -> UsagePage {
7946 UsagePage::from(self)
7947 }
7948 }
7949
7950 impl From<&Haptics> for u16 {
7951 fn from(haptics: &Haptics) -> u16 {
7952 *haptics as u16
7953 }
7954 }
7955
7956 impl From<Haptics> for u16 {
7957 /// Returns the 16bit value of this usage. This is identical
7958 /// to [Haptics::usage_page_value()].
7959 fn from(haptics: Haptics) -> u16 {
7960 u16::from(&haptics)
7961 }
7962 }
7963
7964 impl From<&Haptics> for u32 {
7965 /// Returns the 32 bit value of this usage. This is identical
7966 /// to [Haptics::usage_value()].
7967 fn from(haptics: &Haptics) -> u32 {
7968 let up = UsagePage::from(haptics);
7969 let up = (u16::from(&up) as u32) << 16;
7970 let id = u16::from(haptics) as u32;
7971 up | id
7972 }
7973 }
7974
7975 impl From<&Haptics> for UsagePage {
7976 /// Always returns [UsagePage::Haptics] and is
7977 /// identical to [Haptics::usage_page()].
7978 fn from(_: &Haptics) -> UsagePage {
7979 UsagePage::Haptics
7980 }
7981 }
7982
7983 impl From<Haptics> for UsagePage {
7984 /// Always returns [UsagePage::Haptics] and is
7985 /// identical to [Haptics::usage_page()].
7986 fn from(_: Haptics) -> UsagePage {
7987 UsagePage::Haptics
7988 }
7989 }
7990
7991 impl From<&Haptics> for Usage {
7992 fn from(haptics: &Haptics) -> Usage {
7993 Usage::try_from(u32::from(haptics)).unwrap()
7994 }
7995 }
7996
7997 impl From<Haptics> for Usage {
7998 fn from(haptics: Haptics) -> Usage {
7999 Usage::from(&haptics)
8000 }
8001 }
8002
8003 impl TryFrom<u16> for Haptics {
8004 type Error = HutError;
8005
8006 fn try_from(usage_id: u16) -> Result<Haptics> {
8007 match usage_id {
8008 1 => Ok(Haptics::SimpleHapticController),
8009 16 => Ok(Haptics::WaveformList),
8010 17 => Ok(Haptics::DurationList),
8011 32 => Ok(Haptics::AutoTrigger),
8012 33 => Ok(Haptics::ManualTrigger),
8013 34 => Ok(Haptics::AutoTriggerAssociatedControl),
8014 35 => Ok(Haptics::Intensity),
8015 36 => Ok(Haptics::RepeatCount),
8016 37 => Ok(Haptics::RetriggerPeriod),
8017 38 => Ok(Haptics::WaveformVendorPage),
8018 39 => Ok(Haptics::WaveformVendorID),
8019 40 => Ok(Haptics::WaveformCutoffTime),
8020 4097 => Ok(Haptics::WaveformNone),
8021 4098 => Ok(Haptics::WaveformStop),
8022 4099 => Ok(Haptics::WaveformClick),
8023 4100 => Ok(Haptics::WaveformBuzzContinuous),
8024 4101 => Ok(Haptics::WaveformRumbleContinuous),
8025 4102 => Ok(Haptics::WaveformPress),
8026 4103 => Ok(Haptics::WaveformRelease),
8027 4104 => Ok(Haptics::WaveformHover),
8028 4105 => Ok(Haptics::WaveformSuccess),
8029 4106 => Ok(Haptics::WaveformError),
8030 4107 => Ok(Haptics::WaveformInkContinuous),
8031 4108 => Ok(Haptics::WaveformPencilContinuous),
8032 4109 => Ok(Haptics::WaveformMarkerContinuous),
8033 4110 => Ok(Haptics::WaveformChiselMarkerContinuous),
8034 4111 => Ok(Haptics::WaveformBrushContinuous),
8035 4112 => Ok(Haptics::WaveformEraserContinuous),
8036 4113 => Ok(Haptics::WaveformSparkleContinuous),
8037 n => Err(HutError::UnknownUsageId { usage_id: n }),
8038 }
8039 }
8040 }
8041
8042 impl BitOr<u16> for Haptics {
8043 type Output = Usage;
8044
8045 /// A convenience function to combine a Usage Page with
8046 /// a value.
8047 ///
8048 /// This function panics if the Usage ID value results in
8049 /// an unknown Usage. Where error checking is required,
8050 /// use [UsagePage::to_usage_from_value].
8051 fn bitor(self, usage: u16) -> Usage {
8052 let up = u16::from(self) as u32;
8053 let u = usage as u32;
8054 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
8055 }
8056 }
8057
8058 /// *Usage Page `0xF`: "Physical Input Device"*
8059 ///
8060 /// **This enum is autogenerated from the HID Usage Tables**.
8061 /// ```
8062 /// # use hut::*;
8063 /// let u1 = Usage::PhysicalInputDevice(PhysicalInputDevice::Normal);
8064 /// let u2 = Usage::new_from_page_and_id(0xF, 0x20).unwrap();
8065 /// let u3 = Usage::from(PhysicalInputDevice::Normal);
8066 /// let u4: Usage = PhysicalInputDevice::Normal.into();
8067 /// assert_eq!(u1, u2);
8068 /// assert_eq!(u1, u3);
8069 /// assert_eq!(u1, u4);
8070 ///
8071 /// assert!(matches!(u1.usage_page(), UsagePage::PhysicalInputDevice));
8072 /// assert_eq!(0xF, u1.usage_page_value());
8073 /// assert_eq!(0x20, u1.usage_id_value());
8074 /// assert_eq!((0xF << 16) | 0x20, u1.usage_value());
8075 /// assert_eq!("Normal", u1.name());
8076 /// ```
8077 ///
8078 #[allow(non_camel_case_types)]
8079 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
8080 #[non_exhaustive]
8081 #[repr(u16)]
8082 pub enum PhysicalInputDevice {
8083 /// Usage ID `0x1`: "Physical Input Device"
8084 PhysicalInputDevice = 0x1,
8085 /// Usage ID `0x20`: "Normal"
8086 Normal = 0x20,
8087 /// Usage ID `0x21`: "Set Effect Report"
8088 SetEffectReport = 0x21,
8089 /// Usage ID `0x22`: "Effect Parameter Block Index"
8090 EffectParameterBlockIndex = 0x22,
8091 /// Usage ID `0x23`: "Parameter Block Offset"
8092 ParameterBlockOffset = 0x23,
8093 /// Usage ID `0x24`: "ROM Flag"
8094 ROMFlag = 0x24,
8095 /// Usage ID `0x25`: "Effect Type"
8096 EffectType = 0x25,
8097 /// Usage ID `0x26`: "ET Constant-Force"
8098 ETConstantForce = 0x26,
8099 /// Usage ID `0x27`: "ET Ramp"
8100 ETRamp = 0x27,
8101 /// Usage ID `0x28`: "ET Custom-Force"
8102 ETCustomForce = 0x28,
8103 /// Usage ID `0x30`: "ET Square"
8104 ETSquare = 0x30,
8105 /// Usage ID `0x31`: "ET Sine"
8106 ETSine = 0x31,
8107 /// Usage ID `0x32`: "ET Triangle"
8108 ETTriangle = 0x32,
8109 /// Usage ID `0x33`: "ET Sawtooth Up"
8110 ETSawtoothUp = 0x33,
8111 /// Usage ID `0x34`: "ET Sawtooth Down"
8112 ETSawtoothDown = 0x34,
8113 /// Usage ID `0x40`: "ET Spring"
8114 ETSpring = 0x40,
8115 /// Usage ID `0x41`: "ET Damper"
8116 ETDamper = 0x41,
8117 /// Usage ID `0x42`: "ET Inertia"
8118 ETInertia = 0x42,
8119 /// Usage ID `0x43`: "ET Friction"
8120 ETFriction = 0x43,
8121 /// Usage ID `0x50`: "Duration"
8122 Duration = 0x50,
8123 /// Usage ID `0x51`: "Sample Period"
8124 SamplePeriod = 0x51,
8125 /// Usage ID `0x52`: "Gain"
8126 Gain = 0x52,
8127 /// Usage ID `0x53`: "Trigger Button"
8128 TriggerButton = 0x53,
8129 /// Usage ID `0x54`: "Trigger Repeat Interval"
8130 TriggerRepeatInterval = 0x54,
8131 /// Usage ID `0x55`: "Axes Enable"
8132 AxesEnable = 0x55,
8133 /// Usage ID `0x56`: "Direction Enable"
8134 DirectionEnable = 0x56,
8135 /// Usage ID `0x57`: "Direction"
8136 Direction = 0x57,
8137 /// Usage ID `0x58`: "Type Specific Block Offset"
8138 TypeSpecificBlockOffset = 0x58,
8139 /// Usage ID `0x59`: "Block Type"
8140 BlockType = 0x59,
8141 /// Usage ID `0x5A`: "Set Envelope Report"
8142 SetEnvelopeReport = 0x5A,
8143 /// Usage ID `0x5B`: "Attack Level"
8144 AttackLevel = 0x5B,
8145 /// Usage ID `0x5C`: "Attack Time"
8146 AttackTime = 0x5C,
8147 /// Usage ID `0x5D`: "Fade Level"
8148 FadeLevel = 0x5D,
8149 /// Usage ID `0x5E`: "Fade Time"
8150 FadeTime = 0x5E,
8151 /// Usage ID `0x5F`: "Set Condition Report"
8152 SetConditionReport = 0x5F,
8153 /// Usage ID `0x60`: "Center-Point Offset"
8154 CenterPointOffset = 0x60,
8155 /// Usage ID `0x61`: "Positive Coefficient"
8156 PositiveCoefficient = 0x61,
8157 /// Usage ID `0x62`: "Negative Coefficient"
8158 NegativeCoefficient = 0x62,
8159 /// Usage ID `0x63`: "Positive Saturation"
8160 PositiveSaturation = 0x63,
8161 /// Usage ID `0x64`: "Negative Saturation"
8162 NegativeSaturation = 0x64,
8163 /// Usage ID `0x65`: "Dead Band"
8164 DeadBand = 0x65,
8165 /// Usage ID `0x66`: "Download Force Sample"
8166 DownloadForceSample = 0x66,
8167 /// Usage ID `0x67`: "Isoch Custom-Force Enable"
8168 IsochCustomForceEnable = 0x67,
8169 /// Usage ID `0x68`: "Custom-Force Data Report"
8170 CustomForceDataReport = 0x68,
8171 /// Usage ID `0x69`: "Custom-Force Data"
8172 CustomForceData = 0x69,
8173 /// Usage ID `0x6A`: "Custom-Force Vendor Defined Data"
8174 CustomForceVendorDefinedData = 0x6A,
8175 /// Usage ID `0x6B`: "Set Custom-Force Report"
8176 SetCustomForceReport = 0x6B,
8177 /// Usage ID `0x6C`: "Custom-Force Data Offset"
8178 CustomForceDataOffset = 0x6C,
8179 /// Usage ID `0x6D`: "Sample Count"
8180 SampleCount = 0x6D,
8181 /// Usage ID `0x6E`: "Set Periodic Report"
8182 SetPeriodicReport = 0x6E,
8183 /// Usage ID `0x6F`: "Offset"
8184 Offset = 0x6F,
8185 /// Usage ID `0x70`: "Magnitude"
8186 Magnitude = 0x70,
8187 /// Usage ID `0x71`: "Phase"
8188 Phase = 0x71,
8189 /// Usage ID `0x72`: "Period"
8190 Period = 0x72,
8191 /// Usage ID `0x73`: "Set Constant-Force Report"
8192 SetConstantForceReport = 0x73,
8193 /// Usage ID `0x74`: "Set Ramp-Force Report"
8194 SetRampForceReport = 0x74,
8195 /// Usage ID `0x75`: "Ramp Start"
8196 RampStart = 0x75,
8197 /// Usage ID `0x76`: "Ramp End"
8198 RampEnd = 0x76,
8199 /// Usage ID `0x77`: "Effect Operation Report"
8200 EffectOperationReport = 0x77,
8201 /// Usage ID `0x78`: "Effect Operation"
8202 EffectOperation = 0x78,
8203 /// Usage ID `0x79`: "Op Effect Start"
8204 OpEffectStart = 0x79,
8205 /// Usage ID `0x7A`: "Op Effect Start Solo"
8206 OpEffectStartSolo = 0x7A,
8207 /// Usage ID `0x7B`: "Op Effect Stop"
8208 OpEffectStop = 0x7B,
8209 /// Usage ID `0x7C`: "Loop Count"
8210 LoopCount = 0x7C,
8211 /// Usage ID `0x7D`: "Device Gain Report"
8212 DeviceGainReport = 0x7D,
8213 /// Usage ID `0x7E`: "Device Gain"
8214 DeviceGain = 0x7E,
8215 /// Usage ID `0x7F`: "Parameter Block Pools Report"
8216 ParameterBlockPoolsReport = 0x7F,
8217 /// Usage ID `0x80`: "RAM Pool Size"
8218 RAMPoolSize = 0x80,
8219 /// Usage ID `0x81`: "ROM Pool Size"
8220 ROMPoolSize = 0x81,
8221 /// Usage ID `0x82`: "ROM Effect Block Count"
8222 ROMEffectBlockCount = 0x82,
8223 /// Usage ID `0x83`: "Simultaneous Effects Max"
8224 SimultaneousEffectsMax = 0x83,
8225 /// Usage ID `0x84`: "Pool Alignment"
8226 PoolAlignment = 0x84,
8227 /// Usage ID `0x85`: "Parameter Block Move Report"
8228 ParameterBlockMoveReport = 0x85,
8229 /// Usage ID `0x86`: "Move Source"
8230 MoveSource = 0x86,
8231 /// Usage ID `0x87`: "Move Destination"
8232 MoveDestination = 0x87,
8233 /// Usage ID `0x88`: "Move Length"
8234 MoveLength = 0x88,
8235 /// Usage ID `0x89`: "Effect Parameter Block Load Report"
8236 EffectParameterBlockLoadReport = 0x89,
8237 /// Usage ID `0x8B`: "Effect Parameter Block Load Status"
8238 EffectParameterBlockLoadStatus = 0x8B,
8239 /// Usage ID `0x8C`: "Block Load Success"
8240 BlockLoadSuccess = 0x8C,
8241 /// Usage ID `0x8D`: "Block Load Full"
8242 BlockLoadFull = 0x8D,
8243 /// Usage ID `0x8E`: "Block Load Error"
8244 BlockLoadError = 0x8E,
8245 /// Usage ID `0x8F`: "Block Handle"
8246 BlockHandle = 0x8F,
8247 /// Usage ID `0x90`: "Effect Parameter Block Free Report"
8248 EffectParameterBlockFreeReport = 0x90,
8249 /// Usage ID `0x91`: "Type Specific Block Handle"
8250 TypeSpecificBlockHandle = 0x91,
8251 /// Usage ID `0x92`: "PID State Report"
8252 PIDStateReport = 0x92,
8253 /// Usage ID `0x94`: "Effect Playing"
8254 EffectPlaying = 0x94,
8255 /// Usage ID `0x95`: "PID Device Control Report"
8256 PIDDeviceControlReport = 0x95,
8257 /// Usage ID `0x96`: "PID Device Control"
8258 PIDDeviceControl = 0x96,
8259 /// Usage ID `0x97`: "DC Enable Actuators"
8260 DCEnableActuators = 0x97,
8261 /// Usage ID `0x98`: "DC Disable Actuators"
8262 DCDisableActuators = 0x98,
8263 /// Usage ID `0x99`: "DC Stop All Effects"
8264 DCStopAllEffects = 0x99,
8265 /// Usage ID `0x9A`: "DC Reset"
8266 DCReset = 0x9A,
8267 /// Usage ID `0x9B`: "DC Pause"
8268 DCPause = 0x9B,
8269 /// Usage ID `0x9C`: "DC Continue"
8270 DCContinue = 0x9C,
8271 /// Usage ID `0x9F`: "Device Paused"
8272 DevicePaused = 0x9F,
8273 /// Usage ID `0xA0`: "Actuators Enabled"
8274 ActuatorsEnabled = 0xA0,
8275 /// Usage ID `0xA4`: "Safety Switch"
8276 SafetySwitch = 0xA4,
8277 /// Usage ID `0xA5`: "Actuator Override Switch"
8278 ActuatorOverrideSwitch = 0xA5,
8279 /// Usage ID `0xA6`: "Actuator Power"
8280 ActuatorPower = 0xA6,
8281 /// Usage ID `0xA7`: "Start Delay"
8282 StartDelay = 0xA7,
8283 /// Usage ID `0xA8`: "Parameter Block Size"
8284 ParameterBlockSize = 0xA8,
8285 /// Usage ID `0xA9`: "Device-Managed Pool"
8286 DeviceManagedPool = 0xA9,
8287 /// Usage ID `0xAA`: "Shared Parameter Blocks"
8288 SharedParameterBlocks = 0xAA,
8289 /// Usage ID `0xAB`: "Create New Effect Parameter Block Report"
8290 CreateNewEffectParameterBlockReport = 0xAB,
8291 /// Usage ID `0xAC`: "RAM Pool Available"
8292 RAMPoolAvailable = 0xAC,
8293 }
8294
8295 impl PhysicalInputDevice {
8296 #[cfg(feature = "std")]
8297 pub fn name(&self) -> String {
8298 match self {
8299 PhysicalInputDevice::PhysicalInputDevice => "Physical Input Device",
8300 PhysicalInputDevice::Normal => "Normal",
8301 PhysicalInputDevice::SetEffectReport => "Set Effect Report",
8302 PhysicalInputDevice::EffectParameterBlockIndex => "Effect Parameter Block Index",
8303 PhysicalInputDevice::ParameterBlockOffset => "Parameter Block Offset",
8304 PhysicalInputDevice::ROMFlag => "ROM Flag",
8305 PhysicalInputDevice::EffectType => "Effect Type",
8306 PhysicalInputDevice::ETConstantForce => "ET Constant-Force",
8307 PhysicalInputDevice::ETRamp => "ET Ramp",
8308 PhysicalInputDevice::ETCustomForce => "ET Custom-Force",
8309 PhysicalInputDevice::ETSquare => "ET Square",
8310 PhysicalInputDevice::ETSine => "ET Sine",
8311 PhysicalInputDevice::ETTriangle => "ET Triangle",
8312 PhysicalInputDevice::ETSawtoothUp => "ET Sawtooth Up",
8313 PhysicalInputDevice::ETSawtoothDown => "ET Sawtooth Down",
8314 PhysicalInputDevice::ETSpring => "ET Spring",
8315 PhysicalInputDevice::ETDamper => "ET Damper",
8316 PhysicalInputDevice::ETInertia => "ET Inertia",
8317 PhysicalInputDevice::ETFriction => "ET Friction",
8318 PhysicalInputDevice::Duration => "Duration",
8319 PhysicalInputDevice::SamplePeriod => "Sample Period",
8320 PhysicalInputDevice::Gain => "Gain",
8321 PhysicalInputDevice::TriggerButton => "Trigger Button",
8322 PhysicalInputDevice::TriggerRepeatInterval => "Trigger Repeat Interval",
8323 PhysicalInputDevice::AxesEnable => "Axes Enable",
8324 PhysicalInputDevice::DirectionEnable => "Direction Enable",
8325 PhysicalInputDevice::Direction => "Direction",
8326 PhysicalInputDevice::TypeSpecificBlockOffset => "Type Specific Block Offset",
8327 PhysicalInputDevice::BlockType => "Block Type",
8328 PhysicalInputDevice::SetEnvelopeReport => "Set Envelope Report",
8329 PhysicalInputDevice::AttackLevel => "Attack Level",
8330 PhysicalInputDevice::AttackTime => "Attack Time",
8331 PhysicalInputDevice::FadeLevel => "Fade Level",
8332 PhysicalInputDevice::FadeTime => "Fade Time",
8333 PhysicalInputDevice::SetConditionReport => "Set Condition Report",
8334 PhysicalInputDevice::CenterPointOffset => "Center-Point Offset",
8335 PhysicalInputDevice::PositiveCoefficient => "Positive Coefficient",
8336 PhysicalInputDevice::NegativeCoefficient => "Negative Coefficient",
8337 PhysicalInputDevice::PositiveSaturation => "Positive Saturation",
8338 PhysicalInputDevice::NegativeSaturation => "Negative Saturation",
8339 PhysicalInputDevice::DeadBand => "Dead Band",
8340 PhysicalInputDevice::DownloadForceSample => "Download Force Sample",
8341 PhysicalInputDevice::IsochCustomForceEnable => "Isoch Custom-Force Enable",
8342 PhysicalInputDevice::CustomForceDataReport => "Custom-Force Data Report",
8343 PhysicalInputDevice::CustomForceData => "Custom-Force Data",
8344 PhysicalInputDevice::CustomForceVendorDefinedData => "Custom-Force Vendor Defined Data",
8345 PhysicalInputDevice::SetCustomForceReport => "Set Custom-Force Report",
8346 PhysicalInputDevice::CustomForceDataOffset => "Custom-Force Data Offset",
8347 PhysicalInputDevice::SampleCount => "Sample Count",
8348 PhysicalInputDevice::SetPeriodicReport => "Set Periodic Report",
8349 PhysicalInputDevice::Offset => "Offset",
8350 PhysicalInputDevice::Magnitude => "Magnitude",
8351 PhysicalInputDevice::Phase => "Phase",
8352 PhysicalInputDevice::Period => "Period",
8353 PhysicalInputDevice::SetConstantForceReport => "Set Constant-Force Report",
8354 PhysicalInputDevice::SetRampForceReport => "Set Ramp-Force Report",
8355 PhysicalInputDevice::RampStart => "Ramp Start",
8356 PhysicalInputDevice::RampEnd => "Ramp End",
8357 PhysicalInputDevice::EffectOperationReport => "Effect Operation Report",
8358 PhysicalInputDevice::EffectOperation => "Effect Operation",
8359 PhysicalInputDevice::OpEffectStart => "Op Effect Start",
8360 PhysicalInputDevice::OpEffectStartSolo => "Op Effect Start Solo",
8361 PhysicalInputDevice::OpEffectStop => "Op Effect Stop",
8362 PhysicalInputDevice::LoopCount => "Loop Count",
8363 PhysicalInputDevice::DeviceGainReport => "Device Gain Report",
8364 PhysicalInputDevice::DeviceGain => "Device Gain",
8365 PhysicalInputDevice::ParameterBlockPoolsReport => "Parameter Block Pools Report",
8366 PhysicalInputDevice::RAMPoolSize => "RAM Pool Size",
8367 PhysicalInputDevice::ROMPoolSize => "ROM Pool Size",
8368 PhysicalInputDevice::ROMEffectBlockCount => "ROM Effect Block Count",
8369 PhysicalInputDevice::SimultaneousEffectsMax => "Simultaneous Effects Max",
8370 PhysicalInputDevice::PoolAlignment => "Pool Alignment",
8371 PhysicalInputDevice::ParameterBlockMoveReport => "Parameter Block Move Report",
8372 PhysicalInputDevice::MoveSource => "Move Source",
8373 PhysicalInputDevice::MoveDestination => "Move Destination",
8374 PhysicalInputDevice::MoveLength => "Move Length",
8375 PhysicalInputDevice::EffectParameterBlockLoadReport => {
8376 "Effect Parameter Block Load Report"
8377 }
8378 PhysicalInputDevice::EffectParameterBlockLoadStatus => {
8379 "Effect Parameter Block Load Status"
8380 }
8381 PhysicalInputDevice::BlockLoadSuccess => "Block Load Success",
8382 PhysicalInputDevice::BlockLoadFull => "Block Load Full",
8383 PhysicalInputDevice::BlockLoadError => "Block Load Error",
8384 PhysicalInputDevice::BlockHandle => "Block Handle",
8385 PhysicalInputDevice::EffectParameterBlockFreeReport => {
8386 "Effect Parameter Block Free Report"
8387 }
8388 PhysicalInputDevice::TypeSpecificBlockHandle => "Type Specific Block Handle",
8389 PhysicalInputDevice::PIDStateReport => "PID State Report",
8390 PhysicalInputDevice::EffectPlaying => "Effect Playing",
8391 PhysicalInputDevice::PIDDeviceControlReport => "PID Device Control Report",
8392 PhysicalInputDevice::PIDDeviceControl => "PID Device Control",
8393 PhysicalInputDevice::DCEnableActuators => "DC Enable Actuators",
8394 PhysicalInputDevice::DCDisableActuators => "DC Disable Actuators",
8395 PhysicalInputDevice::DCStopAllEffects => "DC Stop All Effects",
8396 PhysicalInputDevice::DCReset => "DC Reset",
8397 PhysicalInputDevice::DCPause => "DC Pause",
8398 PhysicalInputDevice::DCContinue => "DC Continue",
8399 PhysicalInputDevice::DevicePaused => "Device Paused",
8400 PhysicalInputDevice::ActuatorsEnabled => "Actuators Enabled",
8401 PhysicalInputDevice::SafetySwitch => "Safety Switch",
8402 PhysicalInputDevice::ActuatorOverrideSwitch => "Actuator Override Switch",
8403 PhysicalInputDevice::ActuatorPower => "Actuator Power",
8404 PhysicalInputDevice::StartDelay => "Start Delay",
8405 PhysicalInputDevice::ParameterBlockSize => "Parameter Block Size",
8406 PhysicalInputDevice::DeviceManagedPool => "Device-Managed Pool",
8407 PhysicalInputDevice::SharedParameterBlocks => "Shared Parameter Blocks",
8408 PhysicalInputDevice::CreateNewEffectParameterBlockReport => {
8409 "Create New Effect Parameter Block Report"
8410 }
8411 PhysicalInputDevice::RAMPoolAvailable => "RAM Pool Available",
8412 }
8413 .into()
8414 }
8415 }
8416
8417 #[cfg(feature = "std")]
8418 impl fmt::Display for PhysicalInputDevice {
8419 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
8420 write!(f, "{}", self.name())
8421 }
8422 }
8423
8424 impl AsUsage for PhysicalInputDevice {
8425 /// Returns the 32 bit Usage value of this Usage
8426 fn usage_value(&self) -> u32 {
8427 u32::from(self)
8428 }
8429
8430 /// Returns the 16 bit Usage ID value of this Usage
8431 fn usage_id_value(&self) -> u16 {
8432 u16::from(self)
8433 }
8434
8435 /// Returns this usage as [Usage::PhysicalInputDevice(self)](Usage::PhysicalInputDevice)
8436 /// This is a convenience function to avoid having
8437 /// to implement `From` for every used type in the caller.
8438 ///
8439 /// ```
8440 /// # use hut::*;
8441 /// let gd_x = GenericDesktop::X;
8442 /// let usage = Usage::from(GenericDesktop::X);
8443 /// assert!(matches!(gd_x.usage(), usage));
8444 /// ```
8445 fn usage(&self) -> Usage {
8446 Usage::from(self)
8447 }
8448 }
8449
8450 impl AsUsagePage for PhysicalInputDevice {
8451 /// Returns the 16 bit value of this UsagePage
8452 ///
8453 /// This value is `0xF` for [PhysicalInputDevice]
8454 fn usage_page_value(&self) -> u16 {
8455 let up = UsagePage::from(self);
8456 u16::from(up)
8457 }
8458
8459 /// Returns [UsagePage::PhysicalInputDevice]]
8460 fn usage_page(&self) -> UsagePage {
8461 UsagePage::from(self)
8462 }
8463 }
8464
8465 impl From<&PhysicalInputDevice> for u16 {
8466 fn from(physicalinputdevice: &PhysicalInputDevice) -> u16 {
8467 *physicalinputdevice as u16
8468 }
8469 }
8470
8471 impl From<PhysicalInputDevice> for u16 {
8472 /// Returns the 16bit value of this usage. This is identical
8473 /// to [PhysicalInputDevice::usage_page_value()].
8474 fn from(physicalinputdevice: PhysicalInputDevice) -> u16 {
8475 u16::from(&physicalinputdevice)
8476 }
8477 }
8478
8479 impl From<&PhysicalInputDevice> for u32 {
8480 /// Returns the 32 bit value of this usage. This is identical
8481 /// to [PhysicalInputDevice::usage_value()].
8482 fn from(physicalinputdevice: &PhysicalInputDevice) -> u32 {
8483 let up = UsagePage::from(physicalinputdevice);
8484 let up = (u16::from(&up) as u32) << 16;
8485 let id = u16::from(physicalinputdevice) as u32;
8486 up | id
8487 }
8488 }
8489
8490 impl From<&PhysicalInputDevice> for UsagePage {
8491 /// Always returns [UsagePage::PhysicalInputDevice] and is
8492 /// identical to [PhysicalInputDevice::usage_page()].
8493 fn from(_: &PhysicalInputDevice) -> UsagePage {
8494 UsagePage::PhysicalInputDevice
8495 }
8496 }
8497
8498 impl From<PhysicalInputDevice> for UsagePage {
8499 /// Always returns [UsagePage::PhysicalInputDevice] and is
8500 /// identical to [PhysicalInputDevice::usage_page()].
8501 fn from(_: PhysicalInputDevice) -> UsagePage {
8502 UsagePage::PhysicalInputDevice
8503 }
8504 }
8505
8506 impl From<&PhysicalInputDevice> for Usage {
8507 fn from(physicalinputdevice: &PhysicalInputDevice) -> Usage {
8508 Usage::try_from(u32::from(physicalinputdevice)).unwrap()
8509 }
8510 }
8511
8512 impl From<PhysicalInputDevice> for Usage {
8513 fn from(physicalinputdevice: PhysicalInputDevice) -> Usage {
8514 Usage::from(&physicalinputdevice)
8515 }
8516 }
8517
8518 impl TryFrom<u16> for PhysicalInputDevice {
8519 type Error = HutError;
8520
8521 fn try_from(usage_id: u16) -> Result<PhysicalInputDevice> {
8522 match usage_id {
8523 1 => Ok(PhysicalInputDevice::PhysicalInputDevice),
8524 32 => Ok(PhysicalInputDevice::Normal),
8525 33 => Ok(PhysicalInputDevice::SetEffectReport),
8526 34 => Ok(PhysicalInputDevice::EffectParameterBlockIndex),
8527 35 => Ok(PhysicalInputDevice::ParameterBlockOffset),
8528 36 => Ok(PhysicalInputDevice::ROMFlag),
8529 37 => Ok(PhysicalInputDevice::EffectType),
8530 38 => Ok(PhysicalInputDevice::ETConstantForce),
8531 39 => Ok(PhysicalInputDevice::ETRamp),
8532 40 => Ok(PhysicalInputDevice::ETCustomForce),
8533 48 => Ok(PhysicalInputDevice::ETSquare),
8534 49 => Ok(PhysicalInputDevice::ETSine),
8535 50 => Ok(PhysicalInputDevice::ETTriangle),
8536 51 => Ok(PhysicalInputDevice::ETSawtoothUp),
8537 52 => Ok(PhysicalInputDevice::ETSawtoothDown),
8538 64 => Ok(PhysicalInputDevice::ETSpring),
8539 65 => Ok(PhysicalInputDevice::ETDamper),
8540 66 => Ok(PhysicalInputDevice::ETInertia),
8541 67 => Ok(PhysicalInputDevice::ETFriction),
8542 80 => Ok(PhysicalInputDevice::Duration),
8543 81 => Ok(PhysicalInputDevice::SamplePeriod),
8544 82 => Ok(PhysicalInputDevice::Gain),
8545 83 => Ok(PhysicalInputDevice::TriggerButton),
8546 84 => Ok(PhysicalInputDevice::TriggerRepeatInterval),
8547 85 => Ok(PhysicalInputDevice::AxesEnable),
8548 86 => Ok(PhysicalInputDevice::DirectionEnable),
8549 87 => Ok(PhysicalInputDevice::Direction),
8550 88 => Ok(PhysicalInputDevice::TypeSpecificBlockOffset),
8551 89 => Ok(PhysicalInputDevice::BlockType),
8552 90 => Ok(PhysicalInputDevice::SetEnvelopeReport),
8553 91 => Ok(PhysicalInputDevice::AttackLevel),
8554 92 => Ok(PhysicalInputDevice::AttackTime),
8555 93 => Ok(PhysicalInputDevice::FadeLevel),
8556 94 => Ok(PhysicalInputDevice::FadeTime),
8557 95 => Ok(PhysicalInputDevice::SetConditionReport),
8558 96 => Ok(PhysicalInputDevice::CenterPointOffset),
8559 97 => Ok(PhysicalInputDevice::PositiveCoefficient),
8560 98 => Ok(PhysicalInputDevice::NegativeCoefficient),
8561 99 => Ok(PhysicalInputDevice::PositiveSaturation),
8562 100 => Ok(PhysicalInputDevice::NegativeSaturation),
8563 101 => Ok(PhysicalInputDevice::DeadBand),
8564 102 => Ok(PhysicalInputDevice::DownloadForceSample),
8565 103 => Ok(PhysicalInputDevice::IsochCustomForceEnable),
8566 104 => Ok(PhysicalInputDevice::CustomForceDataReport),
8567 105 => Ok(PhysicalInputDevice::CustomForceData),
8568 106 => Ok(PhysicalInputDevice::CustomForceVendorDefinedData),
8569 107 => Ok(PhysicalInputDevice::SetCustomForceReport),
8570 108 => Ok(PhysicalInputDevice::CustomForceDataOffset),
8571 109 => Ok(PhysicalInputDevice::SampleCount),
8572 110 => Ok(PhysicalInputDevice::SetPeriodicReport),
8573 111 => Ok(PhysicalInputDevice::Offset),
8574 112 => Ok(PhysicalInputDevice::Magnitude),
8575 113 => Ok(PhysicalInputDevice::Phase),
8576 114 => Ok(PhysicalInputDevice::Period),
8577 115 => Ok(PhysicalInputDevice::SetConstantForceReport),
8578 116 => Ok(PhysicalInputDevice::SetRampForceReport),
8579 117 => Ok(PhysicalInputDevice::RampStart),
8580 118 => Ok(PhysicalInputDevice::RampEnd),
8581 119 => Ok(PhysicalInputDevice::EffectOperationReport),
8582 120 => Ok(PhysicalInputDevice::EffectOperation),
8583 121 => Ok(PhysicalInputDevice::OpEffectStart),
8584 122 => Ok(PhysicalInputDevice::OpEffectStartSolo),
8585 123 => Ok(PhysicalInputDevice::OpEffectStop),
8586 124 => Ok(PhysicalInputDevice::LoopCount),
8587 125 => Ok(PhysicalInputDevice::DeviceGainReport),
8588 126 => Ok(PhysicalInputDevice::DeviceGain),
8589 127 => Ok(PhysicalInputDevice::ParameterBlockPoolsReport),
8590 128 => Ok(PhysicalInputDevice::RAMPoolSize),
8591 129 => Ok(PhysicalInputDevice::ROMPoolSize),
8592 130 => Ok(PhysicalInputDevice::ROMEffectBlockCount),
8593 131 => Ok(PhysicalInputDevice::SimultaneousEffectsMax),
8594 132 => Ok(PhysicalInputDevice::PoolAlignment),
8595 133 => Ok(PhysicalInputDevice::ParameterBlockMoveReport),
8596 134 => Ok(PhysicalInputDevice::MoveSource),
8597 135 => Ok(PhysicalInputDevice::MoveDestination),
8598 136 => Ok(PhysicalInputDevice::MoveLength),
8599 137 => Ok(PhysicalInputDevice::EffectParameterBlockLoadReport),
8600 139 => Ok(PhysicalInputDevice::EffectParameterBlockLoadStatus),
8601 140 => Ok(PhysicalInputDevice::BlockLoadSuccess),
8602 141 => Ok(PhysicalInputDevice::BlockLoadFull),
8603 142 => Ok(PhysicalInputDevice::BlockLoadError),
8604 143 => Ok(PhysicalInputDevice::BlockHandle),
8605 144 => Ok(PhysicalInputDevice::EffectParameterBlockFreeReport),
8606 145 => Ok(PhysicalInputDevice::TypeSpecificBlockHandle),
8607 146 => Ok(PhysicalInputDevice::PIDStateReport),
8608 148 => Ok(PhysicalInputDevice::EffectPlaying),
8609 149 => Ok(PhysicalInputDevice::PIDDeviceControlReport),
8610 150 => Ok(PhysicalInputDevice::PIDDeviceControl),
8611 151 => Ok(PhysicalInputDevice::DCEnableActuators),
8612 152 => Ok(PhysicalInputDevice::DCDisableActuators),
8613 153 => Ok(PhysicalInputDevice::DCStopAllEffects),
8614 154 => Ok(PhysicalInputDevice::DCReset),
8615 155 => Ok(PhysicalInputDevice::DCPause),
8616 156 => Ok(PhysicalInputDevice::DCContinue),
8617 159 => Ok(PhysicalInputDevice::DevicePaused),
8618 160 => Ok(PhysicalInputDevice::ActuatorsEnabled),
8619 164 => Ok(PhysicalInputDevice::SafetySwitch),
8620 165 => Ok(PhysicalInputDevice::ActuatorOverrideSwitch),
8621 166 => Ok(PhysicalInputDevice::ActuatorPower),
8622 167 => Ok(PhysicalInputDevice::StartDelay),
8623 168 => Ok(PhysicalInputDevice::ParameterBlockSize),
8624 169 => Ok(PhysicalInputDevice::DeviceManagedPool),
8625 170 => Ok(PhysicalInputDevice::SharedParameterBlocks),
8626 171 => Ok(PhysicalInputDevice::CreateNewEffectParameterBlockReport),
8627 172 => Ok(PhysicalInputDevice::RAMPoolAvailable),
8628 n => Err(HutError::UnknownUsageId { usage_id: n }),
8629 }
8630 }
8631 }
8632
8633 impl BitOr<u16> for PhysicalInputDevice {
8634 type Output = Usage;
8635
8636 /// A convenience function to combine a Usage Page with
8637 /// a value.
8638 ///
8639 /// This function panics if the Usage ID value results in
8640 /// an unknown Usage. Where error checking is required,
8641 /// use [UsagePage::to_usage_from_value].
8642 fn bitor(self, usage: u16) -> Usage {
8643 let up = u16::from(self) as u32;
8644 let u = usage as u32;
8645 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
8646 }
8647 }
8648
8649 /// *Usage Page `0x10`: "Unicode"*
8650 ///
8651 /// **This enum is autogenerated from the HID Usage Tables**.
8652 ///
8653 /// This Usage Page is generated, not defined, any Usage IDs in this Usage
8654 /// Page are simply the codepoint number.
8655 ///
8656 /// ```
8657 /// # use hut::*;
8658 /// let u1 = Usage::Unicode(Unicode::Unicode(3));
8659 /// let u2 = Usage::new_from_page_and_id(0x10, 3).unwrap();
8660 /// let u3 = Usage::from(Unicode::Unicode(3));
8661 /// let u4: Usage = Unicode::Unicode(3).into();
8662 /// assert_eq!(u1, u2);
8663 /// assert_eq!(u1, u3);
8664 /// assert_eq!(u1, u4);
8665 ///
8666 /// assert!(matches!(u1.usage_page(), UsagePage::Unicode));
8667 /// assert_eq!(0x10, u1.usage_page_value());
8668 /// assert_eq!(3, u1.usage_id_value());
8669 /// assert_eq!((0x10 << 16) | 3, u1.usage_value());
8670 /// assert_eq!("codepoint 3", u1.name());
8671 /// ```
8672 #[allow(non_camel_case_types)]
8673 #[derive(Debug)]
8674 #[non_exhaustive]
8675 pub enum Unicode {
8676 Unicode(u16),
8677 }
8678
8679 impl Unicode {
8680 #[cfg(feature = "std")]
8681 pub fn name(&self) -> String {
8682 match self {
8683 Unicode::Unicode(codepoint) => format!("codepoint {codepoint}"),
8684 }
8685 }
8686 }
8687
8688 #[cfg(feature = "std")]
8689 impl fmt::Display for Unicode {
8690 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
8691 write!(f, "{}", self.name())
8692 }
8693 }
8694
8695 impl AsUsage for Unicode {
8696 /// Returns the 32 bit Usage value of this Usage
8697 fn usage_value(&self) -> u32 {
8698 u32::from(self)
8699 }
8700
8701 /// Returns the 16 bit Usage ID value of this Usage
8702 fn usage_id_value(&self) -> u16 {
8703 u16::from(self)
8704 }
8705
8706 /// Returns this usage as [Usage::Unicode(self)](Usage::Unicode)
8707 /// This is a convenience function to avoid having
8708 /// to implement `From` for every used type in the caller.
8709 ///
8710 /// ```
8711 /// # use hut::*;
8712 /// let gd_x = GenericDesktop::X;
8713 /// let usage = Usage::from(GenericDesktop::X);
8714 /// assert!(matches!(gd_x.usage(), usage));
8715 /// ```
8716 fn usage(&self) -> Usage {
8717 Usage::from(self)
8718 }
8719 }
8720
8721 impl AsUsagePage for Unicode {
8722 /// Returns the 16 bit value of this UsagePage
8723 ///
8724 /// This value is `0x10` for [Unicode]
8725 fn usage_page_value(&self) -> u16 {
8726 let up = UsagePage::from(self);
8727 u16::from(up)
8728 }
8729
8730 /// Returns [UsagePage::Unicode]]
8731 fn usage_page(&self) -> UsagePage {
8732 UsagePage::from(self)
8733 }
8734 }
8735
8736 impl From<&Unicode> for u16 {
8737 fn from(unicode: &Unicode) -> u16 {
8738 match *unicode {
8739 Unicode::Unicode(codepoint) => codepoint,
8740 }
8741 }
8742 }
8743
8744 impl From<Unicode> for u16 {
8745 /// Returns the 16bit value of this usage. This is identical
8746 /// to [Unicode::usage_page_value()].
8747 fn from(unicode: Unicode) -> u16 {
8748 u16::from(&unicode)
8749 }
8750 }
8751
8752 impl From<&Unicode> for u32 {
8753 /// Returns the 32 bit value of this usage. This is identical
8754 /// to [Unicode::usage_value()].
8755 fn from(unicode: &Unicode) -> u32 {
8756 let up = UsagePage::from(unicode);
8757 let up = (u16::from(&up) as u32) << 16;
8758 let id = u16::from(unicode) as u32;
8759 up | id
8760 }
8761 }
8762
8763 impl From<&Unicode> for UsagePage {
8764 /// Always returns [UsagePage::Unicode] and is
8765 /// identical to [Unicode::usage_page()].
8766 fn from(_: &Unicode) -> UsagePage {
8767 UsagePage::Unicode
8768 }
8769 }
8770
8771 impl From<Unicode> for UsagePage {
8772 /// Always returns [UsagePage::Unicode] and is
8773 /// identical to [Unicode::usage_page()].
8774 fn from(_: Unicode) -> UsagePage {
8775 UsagePage::Unicode
8776 }
8777 }
8778
8779 impl From<&Unicode> for Usage {
8780 fn from(unicode: &Unicode) -> Usage {
8781 Usage::try_from(u32::from(unicode)).unwrap()
8782 }
8783 }
8784
8785 impl From<Unicode> for Usage {
8786 fn from(unicode: Unicode) -> Usage {
8787 Usage::from(&unicode)
8788 }
8789 }
8790
8791 impl TryFrom<u16> for Unicode {
8792 type Error = HutError;
8793
8794 fn try_from(usage_id: u16) -> Result<Unicode> {
8795 match usage_id {
8796 n => Ok(Unicode::Unicode(n)),
8797 }
8798 }
8799 }
8800
8801 impl BitOr<u16> for Unicode {
8802 type Output = Usage;
8803
8804 /// A convenience function to combine a Usage Page with
8805 /// a value.
8806 ///
8807 /// This function panics if the Usage ID value results in
8808 /// an unknown Usage. Where error checking is required,
8809 /// use [UsagePage::to_usage_from_value].
8810 fn bitor(self, usage: u16) -> Usage {
8811 let up = u16::from(self) as u32;
8812 let u = usage as u32;
8813 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
8814 }
8815 }
8816
8817 /// *Usage Page `0x11`: "SoC"*
8818 ///
8819 /// **This enum is autogenerated from the HID Usage Tables**.
8820 /// ```
8821 /// # use hut::*;
8822 /// let u1 = Usage::SoC(SoC::FirmwareTransfer);
8823 /// let u2 = Usage::new_from_page_and_id(0x11, 0x2).unwrap();
8824 /// let u3 = Usage::from(SoC::FirmwareTransfer);
8825 /// let u4: Usage = SoC::FirmwareTransfer.into();
8826 /// assert_eq!(u1, u2);
8827 /// assert_eq!(u1, u3);
8828 /// assert_eq!(u1, u4);
8829 ///
8830 /// assert!(matches!(u1.usage_page(), UsagePage::SoC));
8831 /// assert_eq!(0x11, u1.usage_page_value());
8832 /// assert_eq!(0x2, u1.usage_id_value());
8833 /// assert_eq!((0x11 << 16) | 0x2, u1.usage_value());
8834 /// assert_eq!("FirmwareTransfer", u1.name());
8835 /// ```
8836 ///
8837 #[allow(non_camel_case_types)]
8838 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
8839 #[non_exhaustive]
8840 #[repr(u16)]
8841 pub enum SoC {
8842 /// Usage ID `0x1`: "SocControl"
8843 SocControl = 0x1,
8844 /// Usage ID `0x2`: "FirmwareTransfer"
8845 FirmwareTransfer = 0x2,
8846 /// Usage ID `0x3`: "FirmwareFileId"
8847 FirmwareFileId = 0x3,
8848 /// Usage ID `0x4`: "FileOffsetInBytes"
8849 FileOffsetInBytes = 0x4,
8850 /// Usage ID `0x5`: "FileTransferSizeMaxInBytes"
8851 FileTransferSizeMaxInBytes = 0x5,
8852 /// Usage ID `0x6`: "FilePayload"
8853 FilePayload = 0x6,
8854 /// Usage ID `0x7`: "FilePayloadSizeInBytes"
8855 FilePayloadSizeInBytes = 0x7,
8856 /// Usage ID `0x8`: "FilePayloadContainsLastBytes"
8857 FilePayloadContainsLastBytes = 0x8,
8858 /// Usage ID `0x9`: "FileTransferStop"
8859 FileTransferStop = 0x9,
8860 /// Usage ID `0xA`: "FileTransferTillEnd"
8861 FileTransferTillEnd = 0xA,
8862 }
8863
8864 impl SoC {
8865 #[cfg(feature = "std")]
8866 pub fn name(&self) -> String {
8867 match self {
8868 SoC::SocControl => "SocControl",
8869 SoC::FirmwareTransfer => "FirmwareTransfer",
8870 SoC::FirmwareFileId => "FirmwareFileId",
8871 SoC::FileOffsetInBytes => "FileOffsetInBytes",
8872 SoC::FileTransferSizeMaxInBytes => "FileTransferSizeMaxInBytes",
8873 SoC::FilePayload => "FilePayload",
8874 SoC::FilePayloadSizeInBytes => "FilePayloadSizeInBytes",
8875 SoC::FilePayloadContainsLastBytes => "FilePayloadContainsLastBytes",
8876 SoC::FileTransferStop => "FileTransferStop",
8877 SoC::FileTransferTillEnd => "FileTransferTillEnd",
8878 }
8879 .into()
8880 }
8881 }
8882
8883 #[cfg(feature = "std")]
8884 impl fmt::Display for SoC {
8885 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
8886 write!(f, "{}", self.name())
8887 }
8888 }
8889
8890 impl AsUsage for SoC {
8891 /// Returns the 32 bit Usage value of this Usage
8892 fn usage_value(&self) -> u32 {
8893 u32::from(self)
8894 }
8895
8896 /// Returns the 16 bit Usage ID value of this Usage
8897 fn usage_id_value(&self) -> u16 {
8898 u16::from(self)
8899 }
8900
8901 /// Returns this usage as [Usage::SoC(self)](Usage::SoC)
8902 /// This is a convenience function to avoid having
8903 /// to implement `From` for every used type in the caller.
8904 ///
8905 /// ```
8906 /// # use hut::*;
8907 /// let gd_x = GenericDesktop::X;
8908 /// let usage = Usage::from(GenericDesktop::X);
8909 /// assert!(matches!(gd_x.usage(), usage));
8910 /// ```
8911 fn usage(&self) -> Usage {
8912 Usage::from(self)
8913 }
8914 }
8915
8916 impl AsUsagePage for SoC {
8917 /// Returns the 16 bit value of this UsagePage
8918 ///
8919 /// This value is `0x11` for [SoC]
8920 fn usage_page_value(&self) -> u16 {
8921 let up = UsagePage::from(self);
8922 u16::from(up)
8923 }
8924
8925 /// Returns [UsagePage::SoC]]
8926 fn usage_page(&self) -> UsagePage {
8927 UsagePage::from(self)
8928 }
8929 }
8930
8931 impl From<&SoC> for u16 {
8932 fn from(soc: &SoC) -> u16 {
8933 *soc as u16
8934 }
8935 }
8936
8937 impl From<SoC> for u16 {
8938 /// Returns the 16bit value of this usage. This is identical
8939 /// to [SoC::usage_page_value()].
8940 fn from(soc: SoC) -> u16 {
8941 u16::from(&soc)
8942 }
8943 }
8944
8945 impl From<&SoC> for u32 {
8946 /// Returns the 32 bit value of this usage. This is identical
8947 /// to [SoC::usage_value()].
8948 fn from(soc: &SoC) -> u32 {
8949 let up = UsagePage::from(soc);
8950 let up = (u16::from(&up) as u32) << 16;
8951 let id = u16::from(soc) as u32;
8952 up | id
8953 }
8954 }
8955
8956 impl From<&SoC> for UsagePage {
8957 /// Always returns [UsagePage::SoC] and is
8958 /// identical to [SoC::usage_page()].
8959 fn from(_: &SoC) -> UsagePage {
8960 UsagePage::SoC
8961 }
8962 }
8963
8964 impl From<SoC> for UsagePage {
8965 /// Always returns [UsagePage::SoC] and is
8966 /// identical to [SoC::usage_page()].
8967 fn from(_: SoC) -> UsagePage {
8968 UsagePage::SoC
8969 }
8970 }
8971
8972 impl From<&SoC> for Usage {
8973 fn from(soc: &SoC) -> Usage {
8974 Usage::try_from(u32::from(soc)).unwrap()
8975 }
8976 }
8977
8978 impl From<SoC> for Usage {
8979 fn from(soc: SoC) -> Usage {
8980 Usage::from(&soc)
8981 }
8982 }
8983
8984 impl TryFrom<u16> for SoC {
8985 type Error = HutError;
8986
8987 fn try_from(usage_id: u16) -> Result<SoC> {
8988 match usage_id {
8989 1 => Ok(SoC::SocControl),
8990 2 => Ok(SoC::FirmwareTransfer),
8991 3 => Ok(SoC::FirmwareFileId),
8992 4 => Ok(SoC::FileOffsetInBytes),
8993 5 => Ok(SoC::FileTransferSizeMaxInBytes),
8994 6 => Ok(SoC::FilePayload),
8995 7 => Ok(SoC::FilePayloadSizeInBytes),
8996 8 => Ok(SoC::FilePayloadContainsLastBytes),
8997 9 => Ok(SoC::FileTransferStop),
8998 10 => Ok(SoC::FileTransferTillEnd),
8999 n => Err(HutError::UnknownUsageId { usage_id: n }),
9000 }
9001 }
9002 }
9003
9004 impl BitOr<u16> for SoC {
9005 type Output = Usage;
9006
9007 /// A convenience function to combine a Usage Page with
9008 /// a value.
9009 ///
9010 /// This function panics if the Usage ID value results in
9011 /// an unknown Usage. Where error checking is required,
9012 /// use [UsagePage::to_usage_from_value].
9013 fn bitor(self, usage: u16) -> Usage {
9014 let up = u16::from(self) as u32;
9015 let u = usage as u32;
9016 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
9017 }
9018 }
9019
9020 /// *Usage Page `0x12`: "Eye and Head Trackers"*
9021 ///
9022 /// **This enum is autogenerated from the HID Usage Tables**.
9023 /// ```
9024 /// # use hut::*;
9025 /// let u1 = Usage::EyeandHeadTrackers(EyeandHeadTrackers::HeadTracker);
9026 /// let u2 = Usage::new_from_page_and_id(0x12, 0x2).unwrap();
9027 /// let u3 = Usage::from(EyeandHeadTrackers::HeadTracker);
9028 /// let u4: Usage = EyeandHeadTrackers::HeadTracker.into();
9029 /// assert_eq!(u1, u2);
9030 /// assert_eq!(u1, u3);
9031 /// assert_eq!(u1, u4);
9032 ///
9033 /// assert!(matches!(u1.usage_page(), UsagePage::EyeandHeadTrackers));
9034 /// assert_eq!(0x12, u1.usage_page_value());
9035 /// assert_eq!(0x2, u1.usage_id_value());
9036 /// assert_eq!((0x12 << 16) | 0x2, u1.usage_value());
9037 /// assert_eq!("Head Tracker", u1.name());
9038 /// ```
9039 ///
9040 #[allow(non_camel_case_types)]
9041 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
9042 #[non_exhaustive]
9043 #[repr(u16)]
9044 pub enum EyeandHeadTrackers {
9045 /// Usage ID `0x1`: "Eye Tracker"
9046 EyeTracker = 0x1,
9047 /// Usage ID `0x2`: "Head Tracker"
9048 HeadTracker = 0x2,
9049 /// Usage ID `0x10`: "Tracking Data"
9050 TrackingData = 0x10,
9051 /// Usage ID `0x11`: "Capabilities"
9052 Capabilities = 0x11,
9053 /// Usage ID `0x12`: "Configuration"
9054 Configuration = 0x12,
9055 /// Usage ID `0x13`: "Status"
9056 Status = 0x13,
9057 /// Usage ID `0x14`: "Control"
9058 Control = 0x14,
9059 /// Usage ID `0x20`: "Sensor Timestamp"
9060 SensorTimestamp = 0x20,
9061 /// Usage ID `0x21`: "Position X"
9062 PositionX = 0x21,
9063 /// Usage ID `0x22`: "Position Y"
9064 PositionY = 0x22,
9065 /// Usage ID `0x23`: "Position Z"
9066 PositionZ = 0x23,
9067 /// Usage ID `0x24`: "Gaze Point"
9068 GazePoint = 0x24,
9069 /// Usage ID `0x25`: "Left Eye Position"
9070 LeftEyePosition = 0x25,
9071 /// Usage ID `0x26`: "Right Eye Position"
9072 RightEyePosition = 0x26,
9073 /// Usage ID `0x27`: "Head Position"
9074 HeadPosition = 0x27,
9075 /// Usage ID `0x28`: "Head Direction Point"
9076 HeadDirectionPoint = 0x28,
9077 /// Usage ID `0x29`: "Rotation about X axis"
9078 RotationaboutXaxis = 0x29,
9079 /// Usage ID `0x2A`: "Rotation about Y axis"
9080 RotationaboutYaxis = 0x2A,
9081 /// Usage ID `0x2B`: "Rotation about Z axis"
9082 RotationaboutZaxis = 0x2B,
9083 /// Usage ID `0x100`: "Tracker Quality"
9084 TrackerQuality = 0x100,
9085 /// Usage ID `0x101`: "Minimum Tracking Distance"
9086 MinimumTrackingDistance = 0x101,
9087 /// Usage ID `0x102`: "Optimum Tracking Distance"
9088 OptimumTrackingDistance = 0x102,
9089 /// Usage ID `0x103`: "Maximum Tracking Distance"
9090 MaximumTrackingDistance = 0x103,
9091 /// Usage ID `0x104`: "Maximum Screen Plane Width"
9092 MaximumScreenPlaneWidth = 0x104,
9093 /// Usage ID `0x105`: "Maximum Screen Plane Height"
9094 MaximumScreenPlaneHeight = 0x105,
9095 /// Usage ID `0x200`: "Display Manufacturer ID"
9096 DisplayManufacturerID = 0x200,
9097 /// Usage ID `0x201`: "Display Product ID"
9098 DisplayProductID = 0x201,
9099 /// Usage ID `0x202`: "Display Serial Number"
9100 DisplaySerialNumber = 0x202,
9101 /// Usage ID `0x203`: "Display Manufacturer Date"
9102 DisplayManufacturerDate = 0x203,
9103 /// Usage ID `0x204`: "Calibrated Screen Width"
9104 CalibratedScreenWidth = 0x204,
9105 /// Usage ID `0x205`: "Calibrated Screen Height"
9106 CalibratedScreenHeight = 0x205,
9107 /// Usage ID `0x300`: "Sampling Frequency"
9108 SamplingFrequency = 0x300,
9109 /// Usage ID `0x301`: "Configuration Status"
9110 ConfigurationStatus = 0x301,
9111 /// Usage ID `0x400`: "Device Mode Request"
9112 DeviceModeRequest = 0x400,
9113 }
9114
9115 impl EyeandHeadTrackers {
9116 #[cfg(feature = "std")]
9117 pub fn name(&self) -> String {
9118 match self {
9119 EyeandHeadTrackers::EyeTracker => "Eye Tracker",
9120 EyeandHeadTrackers::HeadTracker => "Head Tracker",
9121 EyeandHeadTrackers::TrackingData => "Tracking Data",
9122 EyeandHeadTrackers::Capabilities => "Capabilities",
9123 EyeandHeadTrackers::Configuration => "Configuration",
9124 EyeandHeadTrackers::Status => "Status",
9125 EyeandHeadTrackers::Control => "Control",
9126 EyeandHeadTrackers::SensorTimestamp => "Sensor Timestamp",
9127 EyeandHeadTrackers::PositionX => "Position X",
9128 EyeandHeadTrackers::PositionY => "Position Y",
9129 EyeandHeadTrackers::PositionZ => "Position Z",
9130 EyeandHeadTrackers::GazePoint => "Gaze Point",
9131 EyeandHeadTrackers::LeftEyePosition => "Left Eye Position",
9132 EyeandHeadTrackers::RightEyePosition => "Right Eye Position",
9133 EyeandHeadTrackers::HeadPosition => "Head Position",
9134 EyeandHeadTrackers::HeadDirectionPoint => "Head Direction Point",
9135 EyeandHeadTrackers::RotationaboutXaxis => "Rotation about X axis",
9136 EyeandHeadTrackers::RotationaboutYaxis => "Rotation about Y axis",
9137 EyeandHeadTrackers::RotationaboutZaxis => "Rotation about Z axis",
9138 EyeandHeadTrackers::TrackerQuality => "Tracker Quality",
9139 EyeandHeadTrackers::MinimumTrackingDistance => "Minimum Tracking Distance",
9140 EyeandHeadTrackers::OptimumTrackingDistance => "Optimum Tracking Distance",
9141 EyeandHeadTrackers::MaximumTrackingDistance => "Maximum Tracking Distance",
9142 EyeandHeadTrackers::MaximumScreenPlaneWidth => "Maximum Screen Plane Width",
9143 EyeandHeadTrackers::MaximumScreenPlaneHeight => "Maximum Screen Plane Height",
9144 EyeandHeadTrackers::DisplayManufacturerID => "Display Manufacturer ID",
9145 EyeandHeadTrackers::DisplayProductID => "Display Product ID",
9146 EyeandHeadTrackers::DisplaySerialNumber => "Display Serial Number",
9147 EyeandHeadTrackers::DisplayManufacturerDate => "Display Manufacturer Date",
9148 EyeandHeadTrackers::CalibratedScreenWidth => "Calibrated Screen Width",
9149 EyeandHeadTrackers::CalibratedScreenHeight => "Calibrated Screen Height",
9150 EyeandHeadTrackers::SamplingFrequency => "Sampling Frequency",
9151 EyeandHeadTrackers::ConfigurationStatus => "Configuration Status",
9152 EyeandHeadTrackers::DeviceModeRequest => "Device Mode Request",
9153 }
9154 .into()
9155 }
9156 }
9157
9158 #[cfg(feature = "std")]
9159 impl fmt::Display for EyeandHeadTrackers {
9160 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
9161 write!(f, "{}", self.name())
9162 }
9163 }
9164
9165 impl AsUsage for EyeandHeadTrackers {
9166 /// Returns the 32 bit Usage value of this Usage
9167 fn usage_value(&self) -> u32 {
9168 u32::from(self)
9169 }
9170
9171 /// Returns the 16 bit Usage ID value of this Usage
9172 fn usage_id_value(&self) -> u16 {
9173 u16::from(self)
9174 }
9175
9176 /// Returns this usage as [Usage::EyeandHeadTrackers(self)](Usage::EyeandHeadTrackers)
9177 /// This is a convenience function to avoid having
9178 /// to implement `From` for every used type in the caller.
9179 ///
9180 /// ```
9181 /// # use hut::*;
9182 /// let gd_x = GenericDesktop::X;
9183 /// let usage = Usage::from(GenericDesktop::X);
9184 /// assert!(matches!(gd_x.usage(), usage));
9185 /// ```
9186 fn usage(&self) -> Usage {
9187 Usage::from(self)
9188 }
9189 }
9190
9191 impl AsUsagePage for EyeandHeadTrackers {
9192 /// Returns the 16 bit value of this UsagePage
9193 ///
9194 /// This value is `0x12` for [EyeandHeadTrackers]
9195 fn usage_page_value(&self) -> u16 {
9196 let up = UsagePage::from(self);
9197 u16::from(up)
9198 }
9199
9200 /// Returns [UsagePage::EyeandHeadTrackers]]
9201 fn usage_page(&self) -> UsagePage {
9202 UsagePage::from(self)
9203 }
9204 }
9205
9206 impl From<&EyeandHeadTrackers> for u16 {
9207 fn from(eyeandheadtrackers: &EyeandHeadTrackers) -> u16 {
9208 *eyeandheadtrackers as u16
9209 }
9210 }
9211
9212 impl From<EyeandHeadTrackers> for u16 {
9213 /// Returns the 16bit value of this usage. This is identical
9214 /// to [EyeandHeadTrackers::usage_page_value()].
9215 fn from(eyeandheadtrackers: EyeandHeadTrackers) -> u16 {
9216 u16::from(&eyeandheadtrackers)
9217 }
9218 }
9219
9220 impl From<&EyeandHeadTrackers> for u32 {
9221 /// Returns the 32 bit value of this usage. This is identical
9222 /// to [EyeandHeadTrackers::usage_value()].
9223 fn from(eyeandheadtrackers: &EyeandHeadTrackers) -> u32 {
9224 let up = UsagePage::from(eyeandheadtrackers);
9225 let up = (u16::from(&up) as u32) << 16;
9226 let id = u16::from(eyeandheadtrackers) as u32;
9227 up | id
9228 }
9229 }
9230
9231 impl From<&EyeandHeadTrackers> for UsagePage {
9232 /// Always returns [UsagePage::EyeandHeadTrackers] and is
9233 /// identical to [EyeandHeadTrackers::usage_page()].
9234 fn from(_: &EyeandHeadTrackers) -> UsagePage {
9235 UsagePage::EyeandHeadTrackers
9236 }
9237 }
9238
9239 impl From<EyeandHeadTrackers> for UsagePage {
9240 /// Always returns [UsagePage::EyeandHeadTrackers] and is
9241 /// identical to [EyeandHeadTrackers::usage_page()].
9242 fn from(_: EyeandHeadTrackers) -> UsagePage {
9243 UsagePage::EyeandHeadTrackers
9244 }
9245 }
9246
9247 impl From<&EyeandHeadTrackers> for Usage {
9248 fn from(eyeandheadtrackers: &EyeandHeadTrackers) -> Usage {
9249 Usage::try_from(u32::from(eyeandheadtrackers)).unwrap()
9250 }
9251 }
9252
9253 impl From<EyeandHeadTrackers> for Usage {
9254 fn from(eyeandheadtrackers: EyeandHeadTrackers) -> Usage {
9255 Usage::from(&eyeandheadtrackers)
9256 }
9257 }
9258
9259 impl TryFrom<u16> for EyeandHeadTrackers {
9260 type Error = HutError;
9261
9262 fn try_from(usage_id: u16) -> Result<EyeandHeadTrackers> {
9263 match usage_id {
9264 1 => Ok(EyeandHeadTrackers::EyeTracker),
9265 2 => Ok(EyeandHeadTrackers::HeadTracker),
9266 16 => Ok(EyeandHeadTrackers::TrackingData),
9267 17 => Ok(EyeandHeadTrackers::Capabilities),
9268 18 => Ok(EyeandHeadTrackers::Configuration),
9269 19 => Ok(EyeandHeadTrackers::Status),
9270 20 => Ok(EyeandHeadTrackers::Control),
9271 32 => Ok(EyeandHeadTrackers::SensorTimestamp),
9272 33 => Ok(EyeandHeadTrackers::PositionX),
9273 34 => Ok(EyeandHeadTrackers::PositionY),
9274 35 => Ok(EyeandHeadTrackers::PositionZ),
9275 36 => Ok(EyeandHeadTrackers::GazePoint),
9276 37 => Ok(EyeandHeadTrackers::LeftEyePosition),
9277 38 => Ok(EyeandHeadTrackers::RightEyePosition),
9278 39 => Ok(EyeandHeadTrackers::HeadPosition),
9279 40 => Ok(EyeandHeadTrackers::HeadDirectionPoint),
9280 41 => Ok(EyeandHeadTrackers::RotationaboutXaxis),
9281 42 => Ok(EyeandHeadTrackers::RotationaboutYaxis),
9282 43 => Ok(EyeandHeadTrackers::RotationaboutZaxis),
9283 256 => Ok(EyeandHeadTrackers::TrackerQuality),
9284 257 => Ok(EyeandHeadTrackers::MinimumTrackingDistance),
9285 258 => Ok(EyeandHeadTrackers::OptimumTrackingDistance),
9286 259 => Ok(EyeandHeadTrackers::MaximumTrackingDistance),
9287 260 => Ok(EyeandHeadTrackers::MaximumScreenPlaneWidth),
9288 261 => Ok(EyeandHeadTrackers::MaximumScreenPlaneHeight),
9289 512 => Ok(EyeandHeadTrackers::DisplayManufacturerID),
9290 513 => Ok(EyeandHeadTrackers::DisplayProductID),
9291 514 => Ok(EyeandHeadTrackers::DisplaySerialNumber),
9292 515 => Ok(EyeandHeadTrackers::DisplayManufacturerDate),
9293 516 => Ok(EyeandHeadTrackers::CalibratedScreenWidth),
9294 517 => Ok(EyeandHeadTrackers::CalibratedScreenHeight),
9295 768 => Ok(EyeandHeadTrackers::SamplingFrequency),
9296 769 => Ok(EyeandHeadTrackers::ConfigurationStatus),
9297 1024 => Ok(EyeandHeadTrackers::DeviceModeRequest),
9298 n => Err(HutError::UnknownUsageId { usage_id: n }),
9299 }
9300 }
9301 }
9302
9303 impl BitOr<u16> for EyeandHeadTrackers {
9304 type Output = Usage;
9305
9306 /// A convenience function to combine a Usage Page with
9307 /// a value.
9308 ///
9309 /// This function panics if the Usage ID value results in
9310 /// an unknown Usage. Where error checking is required,
9311 /// use [UsagePage::to_usage_from_value].
9312 fn bitor(self, usage: u16) -> Usage {
9313 let up = u16::from(self) as u32;
9314 let u = usage as u32;
9315 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
9316 }
9317 }
9318
9319 /// *Usage Page `0x14`: "Auxiliary Display"*
9320 ///
9321 /// **This enum is autogenerated from the HID Usage Tables**.
9322 /// ```
9323 /// # use hut::*;
9324 /// let u1 = Usage::AuxiliaryDisplay(AuxiliaryDisplay::AuxiliaryDisplay);
9325 /// let u2 = Usage::new_from_page_and_id(0x14, 0x2).unwrap();
9326 /// let u3 = Usage::from(AuxiliaryDisplay::AuxiliaryDisplay);
9327 /// let u4: Usage = AuxiliaryDisplay::AuxiliaryDisplay.into();
9328 /// assert_eq!(u1, u2);
9329 /// assert_eq!(u1, u3);
9330 /// assert_eq!(u1, u4);
9331 ///
9332 /// assert!(matches!(u1.usage_page(), UsagePage::AuxiliaryDisplay));
9333 /// assert_eq!(0x14, u1.usage_page_value());
9334 /// assert_eq!(0x2, u1.usage_id_value());
9335 /// assert_eq!((0x14 << 16) | 0x2, u1.usage_value());
9336 /// assert_eq!("Auxiliary Display", u1.name());
9337 /// ```
9338 ///
9339 #[allow(non_camel_case_types)]
9340 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
9341 #[non_exhaustive]
9342 #[repr(u16)]
9343 pub enum AuxiliaryDisplay {
9344 /// Usage ID `0x1`: "Alphanumeric Display"
9345 AlphanumericDisplay = 0x1,
9346 /// Usage ID `0x2`: "Auxiliary Display"
9347 AuxiliaryDisplay = 0x2,
9348 /// Usage ID `0x20`: "Display Attributes Report"
9349 DisplayAttributesReport = 0x20,
9350 /// Usage ID `0x21`: "ASCII Character Set"
9351 ASCIICharacterSet = 0x21,
9352 /// Usage ID `0x22`: "Data Read Back"
9353 DataReadBack = 0x22,
9354 /// Usage ID `0x23`: "Font Read Back"
9355 FontReadBack = 0x23,
9356 /// Usage ID `0x24`: "Display Control Report"
9357 DisplayControlReport = 0x24,
9358 /// Usage ID `0x25`: "Clear Display"
9359 ClearDisplay = 0x25,
9360 /// Usage ID `0x26`: "Display Enable"
9361 DisplayEnable = 0x26,
9362 /// Usage ID `0x27`: "Screen Saver Delay"
9363 ScreenSaverDelay = 0x27,
9364 /// Usage ID `0x28`: "Screen Saver Enable"
9365 ScreenSaverEnable = 0x28,
9366 /// Usage ID `0x29`: "Vertical Scroll"
9367 VerticalScroll = 0x29,
9368 /// Usage ID `0x2A`: "Horizontal Scroll"
9369 HorizontalScroll = 0x2A,
9370 /// Usage ID `0x2B`: "Character Report"
9371 CharacterReport = 0x2B,
9372 /// Usage ID `0x2C`: "Display Data"
9373 DisplayData = 0x2C,
9374 /// Usage ID `0x2D`: "Display Status"
9375 DisplayStatus = 0x2D,
9376 /// Usage ID `0x2E`: "Stat Not Ready"
9377 StatNotReady = 0x2E,
9378 /// Usage ID `0x2F`: "Stat Ready"
9379 StatReady = 0x2F,
9380 /// Usage ID `0x30`: "Err Not a loadable character"
9381 ErrNotaloadablecharacter = 0x30,
9382 /// Usage ID `0x31`: "Err Font data cannot be read"
9383 ErrFontdatacannotberead = 0x31,
9384 /// Usage ID `0x32`: "Cursor Position Report"
9385 CursorPositionReport = 0x32,
9386 /// Usage ID `0x33`: "Row"
9387 Row = 0x33,
9388 /// Usage ID `0x34`: "Column"
9389 Column = 0x34,
9390 /// Usage ID `0x35`: "Rows"
9391 Rows = 0x35,
9392 /// Usage ID `0x36`: "Columns"
9393 Columns = 0x36,
9394 /// Usage ID `0x37`: "Cursor Pixel Positioning"
9395 CursorPixelPositioning = 0x37,
9396 /// Usage ID `0x38`: "Cursor Mode"
9397 CursorMode = 0x38,
9398 /// Usage ID `0x39`: "Cursor Enable"
9399 CursorEnable = 0x39,
9400 /// Usage ID `0x3A`: "Cursor Blink"
9401 CursorBlink = 0x3A,
9402 /// Usage ID `0x3B`: "Font Report"
9403 FontReport = 0x3B,
9404 /// Usage ID `0x3C`: "Font Data"
9405 FontData = 0x3C,
9406 /// Usage ID `0x3D`: "Character Width"
9407 CharacterWidth = 0x3D,
9408 /// Usage ID `0x3E`: "Character Height"
9409 CharacterHeight = 0x3E,
9410 /// Usage ID `0x3F`: "Character Spacing Horizontal"
9411 CharacterSpacingHorizontal = 0x3F,
9412 /// Usage ID `0x40`: "Character Spacing Vertical"
9413 CharacterSpacingVertical = 0x40,
9414 /// Usage ID `0x41`: "Unicode Character Set"
9415 UnicodeCharacterSet = 0x41,
9416 /// Usage ID `0x42`: "Font 7-Segment"
9417 Font7Segment = 0x42,
9418 /// Usage ID `0x43`: "7-Segment Direct Map"
9419 SevenSegmentDirectMap = 0x43,
9420 /// Usage ID `0x44`: "Font 14-Segment"
9421 Font14Segment = 0x44,
9422 /// Usage ID `0x45`: "14-Segment Direct Map"
9423 One4SegmentDirectMap = 0x45,
9424 /// Usage ID `0x46`: "Display Brightness"
9425 DisplayBrightness = 0x46,
9426 /// Usage ID `0x47`: "Display Contrast"
9427 DisplayContrast = 0x47,
9428 /// Usage ID `0x48`: "Character Attribute"
9429 CharacterAttribute = 0x48,
9430 /// Usage ID `0x49`: "Attribute Readback"
9431 AttributeReadback = 0x49,
9432 /// Usage ID `0x4A`: "Attribute Data"
9433 AttributeData = 0x4A,
9434 /// Usage ID `0x4B`: "Char Attr Enhance"
9435 CharAttrEnhance = 0x4B,
9436 /// Usage ID `0x4C`: "Char Attr Underline"
9437 CharAttrUnderline = 0x4C,
9438 /// Usage ID `0x4D`: "Char Attr Blink"
9439 CharAttrBlink = 0x4D,
9440 /// Usage ID `0x80`: "Bitmap Size X"
9441 BitmapSizeX = 0x80,
9442 /// Usage ID `0x81`: "Bitmap Size Y"
9443 BitmapSizeY = 0x81,
9444 /// Usage ID `0x82`: "Max Blit Size"
9445 MaxBlitSize = 0x82,
9446 /// Usage ID `0x83`: "Bit Depth Format"
9447 BitDepthFormat = 0x83,
9448 /// Usage ID `0x84`: "Display Orientation"
9449 DisplayOrientation = 0x84,
9450 /// Usage ID `0x85`: "Palette Report"
9451 PaletteReport = 0x85,
9452 /// Usage ID `0x86`: "Palette Data Size"
9453 PaletteDataSize = 0x86,
9454 /// Usage ID `0x87`: "Palette Data Offset"
9455 PaletteDataOffset = 0x87,
9456 /// Usage ID `0x88`: "Palette Data"
9457 PaletteData = 0x88,
9458 /// Usage ID `0x8A`: "Blit Report"
9459 BlitReport = 0x8A,
9460 /// Usage ID `0x8B`: "Blit Rectangle X1"
9461 BlitRectangleX1 = 0x8B,
9462 /// Usage ID `0x8C`: "Blit Rectangle Y1"
9463 BlitRectangleY1 = 0x8C,
9464 /// Usage ID `0x8D`: "Blit Rectangle X2"
9465 BlitRectangleX2 = 0x8D,
9466 /// Usage ID `0x8E`: "Blit Rectangle Y2"
9467 BlitRectangleY2 = 0x8E,
9468 /// Usage ID `0x8F`: "Blit Data"
9469 BlitData = 0x8F,
9470 /// Usage ID `0x90`: "Soft Button"
9471 SoftButton = 0x90,
9472 /// Usage ID `0x91`: "Soft Button ID"
9473 SoftButtonID = 0x91,
9474 /// Usage ID `0x92`: "Soft Button Side"
9475 SoftButtonSide = 0x92,
9476 /// Usage ID `0x93`: "Soft Button Offset 1"
9477 SoftButtonOffset1 = 0x93,
9478 /// Usage ID `0x94`: "Soft Button Offset 2"
9479 SoftButtonOffset2 = 0x94,
9480 /// Usage ID `0x95`: "Soft Button Report"
9481 SoftButtonReport = 0x95,
9482 /// Usage ID `0xC2`: "Soft Keys"
9483 SoftKeys = 0xC2,
9484 /// Usage ID `0xCC`: "Display Data Extensions"
9485 DisplayDataExtensions = 0xCC,
9486 /// Usage ID `0xCF`: "Character Mapping"
9487 CharacterMapping = 0xCF,
9488 /// Usage ID `0xDD`: "Unicode Equivalent"
9489 UnicodeEquivalent = 0xDD,
9490 /// Usage ID `0xDF`: "Character Page Mapping"
9491 CharacterPageMapping = 0xDF,
9492 /// Usage ID `0xFF`: "Request Report"
9493 RequestReport = 0xFF,
9494 }
9495
9496 impl AuxiliaryDisplay {
9497 #[cfg(feature = "std")]
9498 pub fn name(&self) -> String {
9499 match self {
9500 AuxiliaryDisplay::AlphanumericDisplay => "Alphanumeric Display",
9501 AuxiliaryDisplay::AuxiliaryDisplay => "Auxiliary Display",
9502 AuxiliaryDisplay::DisplayAttributesReport => "Display Attributes Report",
9503 AuxiliaryDisplay::ASCIICharacterSet => "ASCII Character Set",
9504 AuxiliaryDisplay::DataReadBack => "Data Read Back",
9505 AuxiliaryDisplay::FontReadBack => "Font Read Back",
9506 AuxiliaryDisplay::DisplayControlReport => "Display Control Report",
9507 AuxiliaryDisplay::ClearDisplay => "Clear Display",
9508 AuxiliaryDisplay::DisplayEnable => "Display Enable",
9509 AuxiliaryDisplay::ScreenSaverDelay => "Screen Saver Delay",
9510 AuxiliaryDisplay::ScreenSaverEnable => "Screen Saver Enable",
9511 AuxiliaryDisplay::VerticalScroll => "Vertical Scroll",
9512 AuxiliaryDisplay::HorizontalScroll => "Horizontal Scroll",
9513 AuxiliaryDisplay::CharacterReport => "Character Report",
9514 AuxiliaryDisplay::DisplayData => "Display Data",
9515 AuxiliaryDisplay::DisplayStatus => "Display Status",
9516 AuxiliaryDisplay::StatNotReady => "Stat Not Ready",
9517 AuxiliaryDisplay::StatReady => "Stat Ready",
9518 AuxiliaryDisplay::ErrNotaloadablecharacter => "Err Not a loadable character",
9519 AuxiliaryDisplay::ErrFontdatacannotberead => "Err Font data cannot be read",
9520 AuxiliaryDisplay::CursorPositionReport => "Cursor Position Report",
9521 AuxiliaryDisplay::Row => "Row",
9522 AuxiliaryDisplay::Column => "Column",
9523 AuxiliaryDisplay::Rows => "Rows",
9524 AuxiliaryDisplay::Columns => "Columns",
9525 AuxiliaryDisplay::CursorPixelPositioning => "Cursor Pixel Positioning",
9526 AuxiliaryDisplay::CursorMode => "Cursor Mode",
9527 AuxiliaryDisplay::CursorEnable => "Cursor Enable",
9528 AuxiliaryDisplay::CursorBlink => "Cursor Blink",
9529 AuxiliaryDisplay::FontReport => "Font Report",
9530 AuxiliaryDisplay::FontData => "Font Data",
9531 AuxiliaryDisplay::CharacterWidth => "Character Width",
9532 AuxiliaryDisplay::CharacterHeight => "Character Height",
9533 AuxiliaryDisplay::CharacterSpacingHorizontal => "Character Spacing Horizontal",
9534 AuxiliaryDisplay::CharacterSpacingVertical => "Character Spacing Vertical",
9535 AuxiliaryDisplay::UnicodeCharacterSet => "Unicode Character Set",
9536 AuxiliaryDisplay::Font7Segment => "Font 7-Segment",
9537 AuxiliaryDisplay::SevenSegmentDirectMap => "7-Segment Direct Map",
9538 AuxiliaryDisplay::Font14Segment => "Font 14-Segment",
9539 AuxiliaryDisplay::One4SegmentDirectMap => "14-Segment Direct Map",
9540 AuxiliaryDisplay::DisplayBrightness => "Display Brightness",
9541 AuxiliaryDisplay::DisplayContrast => "Display Contrast",
9542 AuxiliaryDisplay::CharacterAttribute => "Character Attribute",
9543 AuxiliaryDisplay::AttributeReadback => "Attribute Readback",
9544 AuxiliaryDisplay::AttributeData => "Attribute Data",
9545 AuxiliaryDisplay::CharAttrEnhance => "Char Attr Enhance",
9546 AuxiliaryDisplay::CharAttrUnderline => "Char Attr Underline",
9547 AuxiliaryDisplay::CharAttrBlink => "Char Attr Blink",
9548 AuxiliaryDisplay::BitmapSizeX => "Bitmap Size X",
9549 AuxiliaryDisplay::BitmapSizeY => "Bitmap Size Y",
9550 AuxiliaryDisplay::MaxBlitSize => "Max Blit Size",
9551 AuxiliaryDisplay::BitDepthFormat => "Bit Depth Format",
9552 AuxiliaryDisplay::DisplayOrientation => "Display Orientation",
9553 AuxiliaryDisplay::PaletteReport => "Palette Report",
9554 AuxiliaryDisplay::PaletteDataSize => "Palette Data Size",
9555 AuxiliaryDisplay::PaletteDataOffset => "Palette Data Offset",
9556 AuxiliaryDisplay::PaletteData => "Palette Data",
9557 AuxiliaryDisplay::BlitReport => "Blit Report",
9558 AuxiliaryDisplay::BlitRectangleX1 => "Blit Rectangle X1",
9559 AuxiliaryDisplay::BlitRectangleY1 => "Blit Rectangle Y1",
9560 AuxiliaryDisplay::BlitRectangleX2 => "Blit Rectangle X2",
9561 AuxiliaryDisplay::BlitRectangleY2 => "Blit Rectangle Y2",
9562 AuxiliaryDisplay::BlitData => "Blit Data",
9563 AuxiliaryDisplay::SoftButton => "Soft Button",
9564 AuxiliaryDisplay::SoftButtonID => "Soft Button ID",
9565 AuxiliaryDisplay::SoftButtonSide => "Soft Button Side",
9566 AuxiliaryDisplay::SoftButtonOffset1 => "Soft Button Offset 1",
9567 AuxiliaryDisplay::SoftButtonOffset2 => "Soft Button Offset 2",
9568 AuxiliaryDisplay::SoftButtonReport => "Soft Button Report",
9569 AuxiliaryDisplay::SoftKeys => "Soft Keys",
9570 AuxiliaryDisplay::DisplayDataExtensions => "Display Data Extensions",
9571 AuxiliaryDisplay::CharacterMapping => "Character Mapping",
9572 AuxiliaryDisplay::UnicodeEquivalent => "Unicode Equivalent",
9573 AuxiliaryDisplay::CharacterPageMapping => "Character Page Mapping",
9574 AuxiliaryDisplay::RequestReport => "Request Report",
9575 }
9576 .into()
9577 }
9578 }
9579
9580 #[cfg(feature = "std")]
9581 impl fmt::Display for AuxiliaryDisplay {
9582 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
9583 write!(f, "{}", self.name())
9584 }
9585 }
9586
9587 impl AsUsage for AuxiliaryDisplay {
9588 /// Returns the 32 bit Usage value of this Usage
9589 fn usage_value(&self) -> u32 {
9590 u32::from(self)
9591 }
9592
9593 /// Returns the 16 bit Usage ID value of this Usage
9594 fn usage_id_value(&self) -> u16 {
9595 u16::from(self)
9596 }
9597
9598 /// Returns this usage as [Usage::AuxiliaryDisplay(self)](Usage::AuxiliaryDisplay)
9599 /// This is a convenience function to avoid having
9600 /// to implement `From` for every used type in the caller.
9601 ///
9602 /// ```
9603 /// # use hut::*;
9604 /// let gd_x = GenericDesktop::X;
9605 /// let usage = Usage::from(GenericDesktop::X);
9606 /// assert!(matches!(gd_x.usage(), usage));
9607 /// ```
9608 fn usage(&self) -> Usage {
9609 Usage::from(self)
9610 }
9611 }
9612
9613 impl AsUsagePage for AuxiliaryDisplay {
9614 /// Returns the 16 bit value of this UsagePage
9615 ///
9616 /// This value is `0x14` for [AuxiliaryDisplay]
9617 fn usage_page_value(&self) -> u16 {
9618 let up = UsagePage::from(self);
9619 u16::from(up)
9620 }
9621
9622 /// Returns [UsagePage::AuxiliaryDisplay]]
9623 fn usage_page(&self) -> UsagePage {
9624 UsagePage::from(self)
9625 }
9626 }
9627
9628 impl From<&AuxiliaryDisplay> for u16 {
9629 fn from(auxiliarydisplay: &AuxiliaryDisplay) -> u16 {
9630 *auxiliarydisplay as u16
9631 }
9632 }
9633
9634 impl From<AuxiliaryDisplay> for u16 {
9635 /// Returns the 16bit value of this usage. This is identical
9636 /// to [AuxiliaryDisplay::usage_page_value()].
9637 fn from(auxiliarydisplay: AuxiliaryDisplay) -> u16 {
9638 u16::from(&auxiliarydisplay)
9639 }
9640 }
9641
9642 impl From<&AuxiliaryDisplay> for u32 {
9643 /// Returns the 32 bit value of this usage. This is identical
9644 /// to [AuxiliaryDisplay::usage_value()].
9645 fn from(auxiliarydisplay: &AuxiliaryDisplay) -> u32 {
9646 let up = UsagePage::from(auxiliarydisplay);
9647 let up = (u16::from(&up) as u32) << 16;
9648 let id = u16::from(auxiliarydisplay) as u32;
9649 up | id
9650 }
9651 }
9652
9653 impl From<&AuxiliaryDisplay> for UsagePage {
9654 /// Always returns [UsagePage::AuxiliaryDisplay] and is
9655 /// identical to [AuxiliaryDisplay::usage_page()].
9656 fn from(_: &AuxiliaryDisplay) -> UsagePage {
9657 UsagePage::AuxiliaryDisplay
9658 }
9659 }
9660
9661 impl From<AuxiliaryDisplay> for UsagePage {
9662 /// Always returns [UsagePage::AuxiliaryDisplay] and is
9663 /// identical to [AuxiliaryDisplay::usage_page()].
9664 fn from(_: AuxiliaryDisplay) -> UsagePage {
9665 UsagePage::AuxiliaryDisplay
9666 }
9667 }
9668
9669 impl From<&AuxiliaryDisplay> for Usage {
9670 fn from(auxiliarydisplay: &AuxiliaryDisplay) -> Usage {
9671 Usage::try_from(u32::from(auxiliarydisplay)).unwrap()
9672 }
9673 }
9674
9675 impl From<AuxiliaryDisplay> for Usage {
9676 fn from(auxiliarydisplay: AuxiliaryDisplay) -> Usage {
9677 Usage::from(&auxiliarydisplay)
9678 }
9679 }
9680
9681 impl TryFrom<u16> for AuxiliaryDisplay {
9682 type Error = HutError;
9683
9684 fn try_from(usage_id: u16) -> Result<AuxiliaryDisplay> {
9685 match usage_id {
9686 1 => Ok(AuxiliaryDisplay::AlphanumericDisplay),
9687 2 => Ok(AuxiliaryDisplay::AuxiliaryDisplay),
9688 32 => Ok(AuxiliaryDisplay::DisplayAttributesReport),
9689 33 => Ok(AuxiliaryDisplay::ASCIICharacterSet),
9690 34 => Ok(AuxiliaryDisplay::DataReadBack),
9691 35 => Ok(AuxiliaryDisplay::FontReadBack),
9692 36 => Ok(AuxiliaryDisplay::DisplayControlReport),
9693 37 => Ok(AuxiliaryDisplay::ClearDisplay),
9694 38 => Ok(AuxiliaryDisplay::DisplayEnable),
9695 39 => Ok(AuxiliaryDisplay::ScreenSaverDelay),
9696 40 => Ok(AuxiliaryDisplay::ScreenSaverEnable),
9697 41 => Ok(AuxiliaryDisplay::VerticalScroll),
9698 42 => Ok(AuxiliaryDisplay::HorizontalScroll),
9699 43 => Ok(AuxiliaryDisplay::CharacterReport),
9700 44 => Ok(AuxiliaryDisplay::DisplayData),
9701 45 => Ok(AuxiliaryDisplay::DisplayStatus),
9702 46 => Ok(AuxiliaryDisplay::StatNotReady),
9703 47 => Ok(AuxiliaryDisplay::StatReady),
9704 48 => Ok(AuxiliaryDisplay::ErrNotaloadablecharacter),
9705 49 => Ok(AuxiliaryDisplay::ErrFontdatacannotberead),
9706 50 => Ok(AuxiliaryDisplay::CursorPositionReport),
9707 51 => Ok(AuxiliaryDisplay::Row),
9708 52 => Ok(AuxiliaryDisplay::Column),
9709 53 => Ok(AuxiliaryDisplay::Rows),
9710 54 => Ok(AuxiliaryDisplay::Columns),
9711 55 => Ok(AuxiliaryDisplay::CursorPixelPositioning),
9712 56 => Ok(AuxiliaryDisplay::CursorMode),
9713 57 => Ok(AuxiliaryDisplay::CursorEnable),
9714 58 => Ok(AuxiliaryDisplay::CursorBlink),
9715 59 => Ok(AuxiliaryDisplay::FontReport),
9716 60 => Ok(AuxiliaryDisplay::FontData),
9717 61 => Ok(AuxiliaryDisplay::CharacterWidth),
9718 62 => Ok(AuxiliaryDisplay::CharacterHeight),
9719 63 => Ok(AuxiliaryDisplay::CharacterSpacingHorizontal),
9720 64 => Ok(AuxiliaryDisplay::CharacterSpacingVertical),
9721 65 => Ok(AuxiliaryDisplay::UnicodeCharacterSet),
9722 66 => Ok(AuxiliaryDisplay::Font7Segment),
9723 67 => Ok(AuxiliaryDisplay::SevenSegmentDirectMap),
9724 68 => Ok(AuxiliaryDisplay::Font14Segment),
9725 69 => Ok(AuxiliaryDisplay::One4SegmentDirectMap),
9726 70 => Ok(AuxiliaryDisplay::DisplayBrightness),
9727 71 => Ok(AuxiliaryDisplay::DisplayContrast),
9728 72 => Ok(AuxiliaryDisplay::CharacterAttribute),
9729 73 => Ok(AuxiliaryDisplay::AttributeReadback),
9730 74 => Ok(AuxiliaryDisplay::AttributeData),
9731 75 => Ok(AuxiliaryDisplay::CharAttrEnhance),
9732 76 => Ok(AuxiliaryDisplay::CharAttrUnderline),
9733 77 => Ok(AuxiliaryDisplay::CharAttrBlink),
9734 128 => Ok(AuxiliaryDisplay::BitmapSizeX),
9735 129 => Ok(AuxiliaryDisplay::BitmapSizeY),
9736 130 => Ok(AuxiliaryDisplay::MaxBlitSize),
9737 131 => Ok(AuxiliaryDisplay::BitDepthFormat),
9738 132 => Ok(AuxiliaryDisplay::DisplayOrientation),
9739 133 => Ok(AuxiliaryDisplay::PaletteReport),
9740 134 => Ok(AuxiliaryDisplay::PaletteDataSize),
9741 135 => Ok(AuxiliaryDisplay::PaletteDataOffset),
9742 136 => Ok(AuxiliaryDisplay::PaletteData),
9743 138 => Ok(AuxiliaryDisplay::BlitReport),
9744 139 => Ok(AuxiliaryDisplay::BlitRectangleX1),
9745 140 => Ok(AuxiliaryDisplay::BlitRectangleY1),
9746 141 => Ok(AuxiliaryDisplay::BlitRectangleX2),
9747 142 => Ok(AuxiliaryDisplay::BlitRectangleY2),
9748 143 => Ok(AuxiliaryDisplay::BlitData),
9749 144 => Ok(AuxiliaryDisplay::SoftButton),
9750 145 => Ok(AuxiliaryDisplay::SoftButtonID),
9751 146 => Ok(AuxiliaryDisplay::SoftButtonSide),
9752 147 => Ok(AuxiliaryDisplay::SoftButtonOffset1),
9753 148 => Ok(AuxiliaryDisplay::SoftButtonOffset2),
9754 149 => Ok(AuxiliaryDisplay::SoftButtonReport),
9755 194 => Ok(AuxiliaryDisplay::SoftKeys),
9756 204 => Ok(AuxiliaryDisplay::DisplayDataExtensions),
9757 207 => Ok(AuxiliaryDisplay::CharacterMapping),
9758 221 => Ok(AuxiliaryDisplay::UnicodeEquivalent),
9759 223 => Ok(AuxiliaryDisplay::CharacterPageMapping),
9760 255 => Ok(AuxiliaryDisplay::RequestReport),
9761 n => Err(HutError::UnknownUsageId { usage_id: n }),
9762 }
9763 }
9764 }
9765
9766 impl BitOr<u16> for AuxiliaryDisplay {
9767 type Output = Usage;
9768
9769 /// A convenience function to combine a Usage Page with
9770 /// a value.
9771 ///
9772 /// This function panics if the Usage ID value results in
9773 /// an unknown Usage. Where error checking is required,
9774 /// use [UsagePage::to_usage_from_value].
9775 fn bitor(self, usage: u16) -> Usage {
9776 let up = u16::from(self) as u32;
9777 let u = usage as u32;
9778 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
9779 }
9780 }
9781
9782 /// *Usage Page `0x20`: "Sensors"*
9783 ///
9784 /// **This enum is autogenerated from the HID Usage Tables**.
9785 /// ```
9786 /// # use hut::*;
9787 /// let u1 = Usage::Sensors(Sensors::Biometric);
9788 /// let u2 = Usage::new_from_page_and_id(0x20, 0x10).unwrap();
9789 /// let u3 = Usage::from(Sensors::Biometric);
9790 /// let u4: Usage = Sensors::Biometric.into();
9791 /// assert_eq!(u1, u2);
9792 /// assert_eq!(u1, u3);
9793 /// assert_eq!(u1, u4);
9794 ///
9795 /// assert!(matches!(u1.usage_page(), UsagePage::Sensors));
9796 /// assert_eq!(0x20, u1.usage_page_value());
9797 /// assert_eq!(0x10, u1.usage_id_value());
9798 /// assert_eq!((0x20 << 16) | 0x10, u1.usage_value());
9799 /// assert_eq!("Biometric", u1.name());
9800 /// ```
9801 ///
9802 #[allow(non_camel_case_types)]
9803 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
9804 #[non_exhaustive]
9805 #[repr(u16)]
9806 pub enum Sensors {
9807 /// Usage ID `0x1`: "Sensor"
9808 Sensor = 0x1,
9809 /// Usage ID `0x10`: "Biometric"
9810 Biometric = 0x10,
9811 /// Usage ID `0x11`: "Biometric: Human Presence"
9812 BiometricHumanPresence = 0x11,
9813 /// Usage ID `0x12`: "Biometric: Human Proximity"
9814 BiometricHumanProximity = 0x12,
9815 /// Usage ID `0x13`: "Biometric: Human Touch"
9816 BiometricHumanTouch = 0x13,
9817 /// Usage ID `0x14`: "Biometric: Blood Pressure"
9818 BiometricBloodPressure = 0x14,
9819 /// Usage ID `0x15`: "Biometric: Body Temperature"
9820 BiometricBodyTemperature = 0x15,
9821 /// Usage ID `0x16`: "Biometric: Heart Rate"
9822 BiometricHeartRate = 0x16,
9823 /// Usage ID `0x17`: "Biometric: Heart Rate Variability"
9824 BiometricHeartRateVariability = 0x17,
9825 /// Usage ID `0x18`: "Biometric: Peripheral Oxygen Saturation"
9826 BiometricPeripheralOxygenSaturation = 0x18,
9827 /// Usage ID `0x19`: "Biometric: Respiratory Rate"
9828 BiometricRespiratoryRate = 0x19,
9829 /// Usage ID `0x20`: "Electrical"
9830 Electrical = 0x20,
9831 /// Usage ID `0x21`: "Electrical: Capacitance"
9832 ElectricalCapacitance = 0x21,
9833 /// Usage ID `0x22`: "Electrical: Current"
9834 ElectricalCurrent = 0x22,
9835 /// Usage ID `0x23`: "Electrical: Power"
9836 ElectricalPower = 0x23,
9837 /// Usage ID `0x24`: "Electrical: Inductance"
9838 ElectricalInductance = 0x24,
9839 /// Usage ID `0x25`: "Electrical: Resistance"
9840 ElectricalResistance = 0x25,
9841 /// Usage ID `0x26`: "Electrical: Voltage"
9842 ElectricalVoltage = 0x26,
9843 /// Usage ID `0x27`: "Electrical: Potentiometer"
9844 ElectricalPotentiometer = 0x27,
9845 /// Usage ID `0x28`: "Electrical: Frequency"
9846 ElectricalFrequency = 0x28,
9847 /// Usage ID `0x29`: "Electrical: Period"
9848 ElectricalPeriod = 0x29,
9849 /// Usage ID `0x30`: "Environmental"
9850 Environmental = 0x30,
9851 /// Usage ID `0x31`: "Environmental: Atmospheric Pressure"
9852 EnvironmentalAtmosphericPressure = 0x31,
9853 /// Usage ID `0x32`: "Environmental: Humidity"
9854 EnvironmentalHumidity = 0x32,
9855 /// Usage ID `0x33`: "Environmental: Temperature"
9856 EnvironmentalTemperature = 0x33,
9857 /// Usage ID `0x34`: "Environmental: Wind Direction"
9858 EnvironmentalWindDirection = 0x34,
9859 /// Usage ID `0x35`: "Environmental: Wind Speed"
9860 EnvironmentalWindSpeed = 0x35,
9861 /// Usage ID `0x36`: "Environmental: Air Quality"
9862 EnvironmentalAirQuality = 0x36,
9863 /// Usage ID `0x37`: "Environmental: Heat Index"
9864 EnvironmentalHeatIndex = 0x37,
9865 /// Usage ID `0x38`: "Environmental: Surface Temperature"
9866 EnvironmentalSurfaceTemperature = 0x38,
9867 /// Usage ID `0x39`: "Environmental: Volatile Organic Compounds"
9868 EnvironmentalVolatileOrganicCompounds = 0x39,
9869 /// Usage ID `0x3A`: "Environmental: Object Presence"
9870 EnvironmentalObjectPresence = 0x3A,
9871 /// Usage ID `0x3B`: "Environmental: Object Proximity"
9872 EnvironmentalObjectProximity = 0x3B,
9873 /// Usage ID `0x40`: "Light"
9874 Light = 0x40,
9875 /// Usage ID `0x41`: "Light: Ambient Light"
9876 LightAmbientLight = 0x41,
9877 /// Usage ID `0x42`: "Light: Consumer Infrared"
9878 LightConsumerInfrared = 0x42,
9879 /// Usage ID `0x43`: "Light: Infrared Light"
9880 LightInfraredLight = 0x43,
9881 /// Usage ID `0x44`: "Light: Visible Light"
9882 LightVisibleLight = 0x44,
9883 /// Usage ID `0x45`: "Light: Ultraviolet Light"
9884 LightUltravioletLight = 0x45,
9885 /// Usage ID `0x50`: "Location"
9886 Location = 0x50,
9887 /// Usage ID `0x51`: "Location: Broadcast"
9888 LocationBroadcast = 0x51,
9889 /// Usage ID `0x52`: "Location: Dead Reckoning"
9890 LocationDeadReckoning = 0x52,
9891 /// Usage ID `0x53`: "Location: GPS (Global Positioning System)"
9892 LocationGPSGlobalPositioningSystem = 0x53,
9893 /// Usage ID `0x54`: "Location: Lookup"
9894 LocationLookup = 0x54,
9895 /// Usage ID `0x55`: "Location: Other"
9896 LocationOther = 0x55,
9897 /// Usage ID `0x56`: "Location: Static"
9898 LocationStatic = 0x56,
9899 /// Usage ID `0x57`: "Location: Triangulation"
9900 LocationTriangulation = 0x57,
9901 /// Usage ID `0x60`: "Mechanical"
9902 Mechanical = 0x60,
9903 /// Usage ID `0x61`: "Mechanical: Boolean Switch"
9904 MechanicalBooleanSwitch = 0x61,
9905 /// Usage ID `0x62`: "Mechanical: Boolean Switch Array"
9906 MechanicalBooleanSwitchArray = 0x62,
9907 /// Usage ID `0x63`: "Mechanical: Multivalue Switch"
9908 MechanicalMultivalueSwitch = 0x63,
9909 /// Usage ID `0x64`: "Mechanical: Force"
9910 MechanicalForce = 0x64,
9911 /// Usage ID `0x65`: "Mechanical: Pressure"
9912 MechanicalPressure = 0x65,
9913 /// Usage ID `0x66`: "Mechanical: Strain"
9914 MechanicalStrain = 0x66,
9915 /// Usage ID `0x67`: "Mechanical: Weight"
9916 MechanicalWeight = 0x67,
9917 /// Usage ID `0x68`: "Mechanical: Haptic Vibrator"
9918 MechanicalHapticVibrator = 0x68,
9919 /// Usage ID `0x69`: "Mechanical: Hall Effect Switch"
9920 MechanicalHallEffectSwitch = 0x69,
9921 /// Usage ID `0x70`: "Motion"
9922 Motion = 0x70,
9923 /// Usage ID `0x71`: "Motion: Accelerometer 1D"
9924 MotionAccelerometer1D = 0x71,
9925 /// Usage ID `0x72`: "Motion: Accelerometer 2D"
9926 MotionAccelerometer2D = 0x72,
9927 /// Usage ID `0x73`: "Motion: Accelerometer 3D"
9928 MotionAccelerometer3D = 0x73,
9929 /// Usage ID `0x74`: "Motion: Gyrometer 1D"
9930 MotionGyrometer1D = 0x74,
9931 /// Usage ID `0x75`: "Motion: Gyrometer 2D"
9932 MotionGyrometer2D = 0x75,
9933 /// Usage ID `0x76`: "Motion: Gyrometer 3D"
9934 MotionGyrometer3D = 0x76,
9935 /// Usage ID `0x77`: "Motion: Motion Detector"
9936 MotionMotionDetector = 0x77,
9937 /// Usage ID `0x78`: "Motion: Speedometer"
9938 MotionSpeedometer = 0x78,
9939 /// Usage ID `0x79`: "Motion: Accelerometer"
9940 MotionAccelerometer = 0x79,
9941 /// Usage ID `0x7A`: "Motion: Gyrometer"
9942 MotionGyrometer = 0x7A,
9943 /// Usage ID `0x7B`: "Motion: Gravity Vector"
9944 MotionGravityVector = 0x7B,
9945 /// Usage ID `0x7C`: "Motion: Linear Accelerometer"
9946 MotionLinearAccelerometer = 0x7C,
9947 /// Usage ID `0x80`: "Orientation"
9948 Orientation = 0x80,
9949 /// Usage ID `0x81`: "Orientation: Compass 1D"
9950 OrientationCompass1D = 0x81,
9951 /// Usage ID `0x82`: "Orientation: Compass 2D"
9952 OrientationCompass2D = 0x82,
9953 /// Usage ID `0x83`: "Orientation: Compass 3D"
9954 OrientationCompass3D = 0x83,
9955 /// Usage ID `0x84`: "Orientation: Inclinometer 1D"
9956 OrientationInclinometer1D = 0x84,
9957 /// Usage ID `0x85`: "Orientation: Inclinometer 2D"
9958 OrientationInclinometer2D = 0x85,
9959 /// Usage ID `0x86`: "Orientation: Inclinometer 3D"
9960 OrientationInclinometer3D = 0x86,
9961 /// Usage ID `0x87`: "Orientation: Distance 1D"
9962 OrientationDistance1D = 0x87,
9963 /// Usage ID `0x88`: "Orientation: Distance 2D"
9964 OrientationDistance2D = 0x88,
9965 /// Usage ID `0x89`: "Orientation: Distance 3D"
9966 OrientationDistance3D = 0x89,
9967 /// Usage ID `0x8A`: "Orientation: Device Orientation"
9968 OrientationDeviceOrientation = 0x8A,
9969 /// Usage ID `0x8B`: "Orientation: Compass"
9970 OrientationCompass = 0x8B,
9971 /// Usage ID `0x8C`: "Orientation: Inclinometer"
9972 OrientationInclinometer = 0x8C,
9973 /// Usage ID `0x8D`: "Orientation: Distance"
9974 OrientationDistance = 0x8D,
9975 /// Usage ID `0x8E`: "Orientation: Relative Orientation"
9976 OrientationRelativeOrientation = 0x8E,
9977 /// Usage ID `0x8F`: "Orientation: Simple Orientation"
9978 OrientationSimpleOrientation = 0x8F,
9979 /// Usage ID `0x90`: "Scanner"
9980 Scanner = 0x90,
9981 /// Usage ID `0x91`: "Scanner: Barcode"
9982 ScannerBarcode = 0x91,
9983 /// Usage ID `0x92`: "Scanner: RFID"
9984 ScannerRFID = 0x92,
9985 /// Usage ID `0x93`: "Scanner: NFC"
9986 ScannerNFC = 0x93,
9987 /// Usage ID `0xA0`: "Time"
9988 Time = 0xA0,
9989 /// Usage ID `0xA1`: "Time: Alarm Timer"
9990 TimeAlarmTimer = 0xA1,
9991 /// Usage ID `0xA2`: "Time: Real Time Clock"
9992 TimeRealTimeClock = 0xA2,
9993 /// Usage ID `0xB0`: "Personal Activity"
9994 PersonalActivity = 0xB0,
9995 /// Usage ID `0xB1`: "Personal Activity: Activity Detection"
9996 PersonalActivityActivityDetection = 0xB1,
9997 /// Usage ID `0xB2`: "Personal Activity: Device Position"
9998 PersonalActivityDevicePosition = 0xB2,
9999 /// Usage ID `0xB3`: "Personal Activity: Floor Tracker"
10000 PersonalActivityFloorTracker = 0xB3,
10001 /// Usage ID `0xB4`: "Personal Activity: Pedometer"
10002 PersonalActivityPedometer = 0xB4,
10003 /// Usage ID `0xB5`: "Personal Activity: Step Detection"
10004 PersonalActivityStepDetection = 0xB5,
10005 /// Usage ID `0xC0`: "Orientation Extended"
10006 OrientationExtended = 0xC0,
10007 /// Usage ID `0xC1`: "Orientation Extended: Geomagnetic Orientation"
10008 OrientationExtendedGeomagneticOrientation = 0xC1,
10009 /// Usage ID `0xC2`: "Orientation Extended: Magnetometer"
10010 OrientationExtendedMagnetometer = 0xC2,
10011 /// Usage ID `0xD0`: "Gesture"
10012 Gesture = 0xD0,
10013 /// Usage ID `0xD1`: "Gesture: Chassis Flip Gesture"
10014 GestureChassisFlipGesture = 0xD1,
10015 /// Usage ID `0xD2`: "Gesture: Hinge Fold Gesture"
10016 GestureHingeFoldGesture = 0xD2,
10017 /// Usage ID `0xE0`: "Other"
10018 Other = 0xE0,
10019 /// Usage ID `0xE1`: "Other: Custom"
10020 OtherCustom = 0xE1,
10021 /// Usage ID `0xE2`: "Other: Generic"
10022 OtherGeneric = 0xE2,
10023 /// Usage ID `0xE3`: "Other: Generic Enumerator"
10024 OtherGenericEnumerator = 0xE3,
10025 /// Usage ID `0xE4`: "Other: Hinge Angle"
10026 OtherHingeAngle = 0xE4,
10027 /// Usage ID `0xF0`: "Vendor Reserved 1"
10028 VendorReserved1 = 0xF0,
10029 /// Usage ID `0xF1`: "Vendor Reserved 2"
10030 VendorReserved2 = 0xF1,
10031 /// Usage ID `0xF2`: "Vendor Reserved 3"
10032 VendorReserved3 = 0xF2,
10033 /// Usage ID `0xF3`: "Vendor Reserved 4"
10034 VendorReserved4 = 0xF3,
10035 /// Usage ID `0xF4`: "Vendor Reserved 5"
10036 VendorReserved5 = 0xF4,
10037 /// Usage ID `0xF5`: "Vendor Reserved 6"
10038 VendorReserved6 = 0xF5,
10039 /// Usage ID `0xF6`: "Vendor Reserved 7"
10040 VendorReserved7 = 0xF6,
10041 /// Usage ID `0xF7`: "Vendor Reserved 8"
10042 VendorReserved8 = 0xF7,
10043 /// Usage ID `0xF8`: "Vendor Reserved 9"
10044 VendorReserved9 = 0xF8,
10045 /// Usage ID `0xF9`: "Vendor Reserved 10"
10046 VendorReserved10 = 0xF9,
10047 /// Usage ID `0xFA`: "Vendor Reserved 11"
10048 VendorReserved11 = 0xFA,
10049 /// Usage ID `0xFB`: "Vendor Reserved 12"
10050 VendorReserved12 = 0xFB,
10051 /// Usage ID `0xFC`: "Vendor Reserved 13"
10052 VendorReserved13 = 0xFC,
10053 /// Usage ID `0xFD`: "Vendor Reserved 14"
10054 VendorReserved14 = 0xFD,
10055 /// Usage ID `0xFE`: "Vendor Reserved 15"
10056 VendorReserved15 = 0xFE,
10057 /// Usage ID `0xFF`: "Vendor Reserved 16"
10058 VendorReserved16 = 0xFF,
10059 /// Usage ID `0x200`: "Event"
10060 Event = 0x200,
10061 /// Usage ID `0x201`: "Event: Sensor State"
10062 EventSensorState = 0x201,
10063 /// Usage ID `0x202`: "Event: Sensor Event"
10064 EventSensorEvent = 0x202,
10065 /// Usage ID `0x300`: "Property"
10066 Property = 0x300,
10067 /// Usage ID `0x301`: "Property: Friendly Name"
10068 PropertyFriendlyName = 0x301,
10069 /// Usage ID `0x302`: "Property: Persistent Unique ID"
10070 PropertyPersistentUniqueID = 0x302,
10071 /// Usage ID `0x303`: "Property: Sensor Status"
10072 PropertySensorStatus = 0x303,
10073 /// Usage ID `0x304`: "Property: Minimum Report Interval"
10074 PropertyMinimumReportInterval = 0x304,
10075 /// Usage ID `0x305`: "Property: Sensor Manufacturer"
10076 PropertySensorManufacturer = 0x305,
10077 /// Usage ID `0x306`: "Property: Sensor Model"
10078 PropertySensorModel = 0x306,
10079 /// Usage ID `0x307`: "Property: Sensor Serial Number"
10080 PropertySensorSerialNumber = 0x307,
10081 /// Usage ID `0x308`: "Property: Sensor Description"
10082 PropertySensorDescription = 0x308,
10083 /// Usage ID `0x309`: "Property: Sensor Connection Type"
10084 PropertySensorConnectionType = 0x309,
10085 /// Usage ID `0x30A`: "Property: Sensor Device Path"
10086 PropertySensorDevicePath = 0x30A,
10087 /// Usage ID `0x30B`: "Property: Hardware Revision"
10088 PropertyHardwareRevision = 0x30B,
10089 /// Usage ID `0x30C`: "Property: Firmware Version"
10090 PropertyFirmwareVersion = 0x30C,
10091 /// Usage ID `0x30D`: "Property: Release Date"
10092 PropertyReleaseDate = 0x30D,
10093 /// Usage ID `0x30E`: "Property: Report Interval"
10094 PropertyReportInterval = 0x30E,
10095 /// Usage ID `0x30F`: "Property: Change Sensitivity Absolute"
10096 PropertyChangeSensitivityAbsolute = 0x30F,
10097 /// Usage ID `0x310`: "Property: Change Sensitivity Percent of Range"
10098 PropertyChangeSensitivityPercentofRange = 0x310,
10099 /// Usage ID `0x311`: "Property: Change Sensitivity Percent Relative"
10100 PropertyChangeSensitivityPercentRelative = 0x311,
10101 /// Usage ID `0x312`: "Property: Accuracy"
10102 PropertyAccuracy = 0x312,
10103 /// Usage ID `0x313`: "Property: Resolution"
10104 PropertyResolution = 0x313,
10105 /// Usage ID `0x314`: "Property: Maximum"
10106 PropertyMaximum = 0x314,
10107 /// Usage ID `0x315`: "Property: Minimum"
10108 PropertyMinimum = 0x315,
10109 /// Usage ID `0x316`: "Property: Reporting State"
10110 PropertyReportingState = 0x316,
10111 /// Usage ID `0x317`: "Property: Sampling Rate"
10112 PropertySamplingRate = 0x317,
10113 /// Usage ID `0x318`: "Property: Response Curve"
10114 PropertyResponseCurve = 0x318,
10115 /// Usage ID `0x319`: "Property: Power State"
10116 PropertyPowerState = 0x319,
10117 /// Usage ID `0x31A`: "Property: Maximum FIFO Events"
10118 PropertyMaximumFIFOEvents = 0x31A,
10119 /// Usage ID `0x31B`: "Property: Report Latency"
10120 PropertyReportLatency = 0x31B,
10121 /// Usage ID `0x31C`: "Property: Flush FIFO Events"
10122 PropertyFlushFIFOEvents = 0x31C,
10123 /// Usage ID `0x31D`: "Property: Maximum Power Consumption"
10124 PropertyMaximumPowerConsumption = 0x31D,
10125 /// Usage ID `0x31E`: "Property: Is Primary"
10126 PropertyIsPrimary = 0x31E,
10127 /// Usage ID `0x31F`: "Property: Human Presence Detection Type"
10128 PropertyHumanPresenceDetectionType = 0x31F,
10129 /// Usage ID `0x400`: "Data Field: Location"
10130 DataFieldLocation = 0x400,
10131 /// Usage ID `0x402`: "Data Field: Altitude Antenna Sea Level"
10132 DataFieldAltitudeAntennaSeaLevel = 0x402,
10133 /// Usage ID `0x403`: "Data Field: Differential Reference Station ID"
10134 DataFieldDifferentialReferenceStationID = 0x403,
10135 /// Usage ID `0x404`: "Data Field: Altitude Ellipsoid Error"
10136 DataFieldAltitudeEllipsoidError = 0x404,
10137 /// Usage ID `0x405`: "Data Field: Altitude Ellipsoid"
10138 DataFieldAltitudeEllipsoid = 0x405,
10139 /// Usage ID `0x406`: "Data Field: Altitude Sea Level Error"
10140 DataFieldAltitudeSeaLevelError = 0x406,
10141 /// Usage ID `0x407`: "Data Field: Altitude Sea Level"
10142 DataFieldAltitudeSeaLevel = 0x407,
10143 /// Usage ID `0x408`: "Data Field: Differential GPS Data Age"
10144 DataFieldDifferentialGPSDataAge = 0x408,
10145 /// Usage ID `0x409`: "Data Field: Error Radius"
10146 DataFieldErrorRadius = 0x409,
10147 /// Usage ID `0x40A`: "Data Field: Fix Quality"
10148 DataFieldFixQuality = 0x40A,
10149 /// Usage ID `0x40B`: "Data Field: Fix Type"
10150 DataFieldFixType = 0x40B,
10151 /// Usage ID `0x40C`: "Data Field: Geoidal Separation"
10152 DataFieldGeoidalSeparation = 0x40C,
10153 /// Usage ID `0x40D`: "Data Field: GPS Operation Mode"
10154 DataFieldGPSOperationMode = 0x40D,
10155 /// Usage ID `0x40E`: "Data Field: GPS Selection Mode"
10156 DataFieldGPSSelectionMode = 0x40E,
10157 /// Usage ID `0x40F`: "Data Field: GPS Status"
10158 DataFieldGPSStatus = 0x40F,
10159 /// Usage ID `0x410`: "Data Field: Position Dilution of Precision"
10160 DataFieldPositionDilutionofPrecision = 0x410,
10161 /// Usage ID `0x411`: "Data Field: Horizontal Dilution of Precision"
10162 DataFieldHorizontalDilutionofPrecision = 0x411,
10163 /// Usage ID `0x412`: "Data Field: Vertical Dilution of Precision"
10164 DataFieldVerticalDilutionofPrecision = 0x412,
10165 /// Usage ID `0x413`: "Data Field: Latitude"
10166 DataFieldLatitude = 0x413,
10167 /// Usage ID `0x414`: "Data Field: Longitude"
10168 DataFieldLongitude = 0x414,
10169 /// Usage ID `0x415`: "Data Field: True Heading"
10170 DataFieldTrueHeading = 0x415,
10171 /// Usage ID `0x416`: "Data Field: Magnetic Heading"
10172 DataFieldMagneticHeading = 0x416,
10173 /// Usage ID `0x417`: "Data Field: Magnetic Variation"
10174 DataFieldMagneticVariation = 0x417,
10175 /// Usage ID `0x418`: "Data Field: Speed"
10176 DataFieldSpeed = 0x418,
10177 /// Usage ID `0x419`: "Data Field: Satellites in View"
10178 DataFieldSatellitesinView = 0x419,
10179 /// Usage ID `0x41A`: "Data Field: Satellites in View Azimuth"
10180 DataFieldSatellitesinViewAzimuth = 0x41A,
10181 /// Usage ID `0x41B`: "Data Field: Satellites in View Elevation"
10182 DataFieldSatellitesinViewElevation = 0x41B,
10183 /// Usage ID `0x41C`: "Data Field: Satellites in View IDs"
10184 DataFieldSatellitesinViewIDs = 0x41C,
10185 /// Usage ID `0x41D`: "Data Field: Satellites in View PRNs"
10186 DataFieldSatellitesinViewPRNs = 0x41D,
10187 /// Usage ID `0x41E`: "Data Field: Satellites in View S/N Ratios"
10188 DataFieldSatellitesinViewSNRatios = 0x41E,
10189 /// Usage ID `0x41F`: "Data Field: Satellites Used Count"
10190 DataFieldSatellitesUsedCount = 0x41F,
10191 /// Usage ID `0x420`: "Data Field: Satellites Used PRNs"
10192 DataFieldSatellitesUsedPRNs = 0x420,
10193 /// Usage ID `0x421`: "Data Field: NMEA Sentence"
10194 DataFieldNMEASentence = 0x421,
10195 /// Usage ID `0x422`: "Data Field: Address Line 1"
10196 DataFieldAddressLine1 = 0x422,
10197 /// Usage ID `0x423`: "Data Field: Address Line 2"
10198 DataFieldAddressLine2 = 0x423,
10199 /// Usage ID `0x424`: "Data Field: City"
10200 DataFieldCity = 0x424,
10201 /// Usage ID `0x425`: "Data Field: State or Province"
10202 DataFieldStateorProvince = 0x425,
10203 /// Usage ID `0x426`: "Data Field: Country or Region"
10204 DataFieldCountryorRegion = 0x426,
10205 /// Usage ID `0x427`: "Data Field: Postal Code"
10206 DataFieldPostalCode = 0x427,
10207 /// Usage ID `0x42A`: "Property: Location"
10208 PropertyLocation = 0x42A,
10209 /// Usage ID `0x42B`: "Property: Location Desired Accuracy"
10210 PropertyLocationDesiredAccuracy = 0x42B,
10211 /// Usage ID `0x430`: "Data Field: Environmental"
10212 DataFieldEnvironmental = 0x430,
10213 /// Usage ID `0x431`: "Data Field: Atmospheric Pressure"
10214 DataFieldAtmosphericPressure = 0x431,
10215 /// Usage ID `0x433`: "Data Field: Relative Humidity"
10216 DataFieldRelativeHumidity = 0x433,
10217 /// Usage ID `0x434`: "Data Field: Temperature"
10218 DataFieldTemperature = 0x434,
10219 /// Usage ID `0x435`: "Data Field: Wind Direction"
10220 DataFieldWindDirection = 0x435,
10221 /// Usage ID `0x436`: "Data Field: Wind Speed"
10222 DataFieldWindSpeed = 0x436,
10223 /// Usage ID `0x437`: "Data Field: Air Quality Index"
10224 DataFieldAirQualityIndex = 0x437,
10225 /// Usage ID `0x438`: "Data Field: Equivalent CO2"
10226 DataFieldEquivalentCO2 = 0x438,
10227 /// Usage ID `0x439`: "Data Field: Volatile Organic Compound Concentration"
10228 DataFieldVolatileOrganicCompoundConcentration = 0x439,
10229 /// Usage ID `0x43A`: "Data Field: Object Presence"
10230 DataFieldObjectPresence = 0x43A,
10231 /// Usage ID `0x43B`: "Data Field: Object Proximity Range"
10232 DataFieldObjectProximityRange = 0x43B,
10233 /// Usage ID `0x43C`: "Data Field: Object Proximity Out of Range"
10234 DataFieldObjectProximityOutofRange = 0x43C,
10235 /// Usage ID `0x440`: "Property: Environmental"
10236 PropertyEnvironmental = 0x440,
10237 /// Usage ID `0x441`: "Property: Reference Pressure"
10238 PropertyReferencePressure = 0x441,
10239 /// Usage ID `0x450`: "Data Field: Motion"
10240 DataFieldMotion = 0x450,
10241 /// Usage ID `0x451`: "Data Field: Motion State"
10242 DataFieldMotionState = 0x451,
10243 /// Usage ID `0x452`: "Data Field: Acceleration"
10244 DataFieldAcceleration = 0x452,
10245 /// Usage ID `0x453`: "Data Field: Acceleration Axis X"
10246 DataFieldAccelerationAxisX = 0x453,
10247 /// Usage ID `0x454`: "Data Field: Acceleration Axis Y"
10248 DataFieldAccelerationAxisY = 0x454,
10249 /// Usage ID `0x455`: "Data Field: Acceleration Axis Z"
10250 DataFieldAccelerationAxisZ = 0x455,
10251 /// Usage ID `0x456`: "Data Field: Angular Velocity"
10252 DataFieldAngularVelocity = 0x456,
10253 /// Usage ID `0x457`: "Data Field: Angular Velocity about X Axis"
10254 DataFieldAngularVelocityaboutXAxis = 0x457,
10255 /// Usage ID `0x458`: "Data Field: Angular Velocity about Y Axis"
10256 DataFieldAngularVelocityaboutYAxis = 0x458,
10257 /// Usage ID `0x459`: "Data Field: Angular Velocity about Z Axis"
10258 DataFieldAngularVelocityaboutZAxis = 0x459,
10259 /// Usage ID `0x45A`: "Data Field: Angular Position"
10260 DataFieldAngularPosition = 0x45A,
10261 /// Usage ID `0x45B`: "Data Field: Angular Position about X Axis"
10262 DataFieldAngularPositionaboutXAxis = 0x45B,
10263 /// Usage ID `0x45C`: "Data Field: Angular Position about Y Axis"
10264 DataFieldAngularPositionaboutYAxis = 0x45C,
10265 /// Usage ID `0x45D`: "Data Field: Angular Position about Z Axis"
10266 DataFieldAngularPositionaboutZAxis = 0x45D,
10267 /// Usage ID `0x45E`: "Data Field: Motion Speed"
10268 DataFieldMotionSpeed = 0x45E,
10269 /// Usage ID `0x45F`: "Data Field: Motion Intensity"
10270 DataFieldMotionIntensity = 0x45F,
10271 /// Usage ID `0x470`: "Data Field: Orientation"
10272 DataFieldOrientation = 0x470,
10273 /// Usage ID `0x471`: "Data Field: Heading"
10274 DataFieldHeading = 0x471,
10275 /// Usage ID `0x472`: "Data Field: Heading X Axis"
10276 DataFieldHeadingXAxis = 0x472,
10277 /// Usage ID `0x473`: "Data Field: Heading Y Axis"
10278 DataFieldHeadingYAxis = 0x473,
10279 /// Usage ID `0x474`: "Data Field: Heading Z Axis"
10280 DataFieldHeadingZAxis = 0x474,
10281 /// Usage ID `0x475`: "Data Field: Heading Compensated Magnetic North"
10282 DataFieldHeadingCompensatedMagneticNorth = 0x475,
10283 /// Usage ID `0x476`: "Data Field: Heading Compensated True North"
10284 DataFieldHeadingCompensatedTrueNorth = 0x476,
10285 /// Usage ID `0x477`: "Data Field: Heading Magnetic North"
10286 DataFieldHeadingMagneticNorth = 0x477,
10287 /// Usage ID `0x478`: "Data Field: Heading True North"
10288 DataFieldHeadingTrueNorth = 0x478,
10289 /// Usage ID `0x479`: "Data Field: Distance"
10290 DataFieldDistance = 0x479,
10291 /// Usage ID `0x47A`: "Data Field: Distance X Axis"
10292 DataFieldDistanceXAxis = 0x47A,
10293 /// Usage ID `0x47B`: "Data Field: Distance Y Axis"
10294 DataFieldDistanceYAxis = 0x47B,
10295 /// Usage ID `0x47C`: "Data Field: Distance Z Axis"
10296 DataFieldDistanceZAxis = 0x47C,
10297 /// Usage ID `0x47D`: "Data Field: Distance Out-of-Range"
10298 DataFieldDistanceOutofRange = 0x47D,
10299 /// Usage ID `0x47E`: "Data Field: Tilt"
10300 DataFieldTilt = 0x47E,
10301 /// Usage ID `0x47F`: "Data Field: Tilt X Axis"
10302 DataFieldTiltXAxis = 0x47F,
10303 /// Usage ID `0x480`: "Data Field: Tilt Y Axis"
10304 DataFieldTiltYAxis = 0x480,
10305 /// Usage ID `0x481`: "Data Field: Tilt Z Axis"
10306 DataFieldTiltZAxis = 0x481,
10307 /// Usage ID `0x482`: "Data Field: Rotation Matrix"
10308 DataFieldRotationMatrix = 0x482,
10309 /// Usage ID `0x483`: "Data Field: Quaternion"
10310 DataFieldQuaternion = 0x483,
10311 /// Usage ID `0x484`: "Data Field: Magnetic Flux"
10312 DataFieldMagneticFlux = 0x484,
10313 /// Usage ID `0x485`: "Data Field: Magnetic Flux X Axis"
10314 DataFieldMagneticFluxXAxis = 0x485,
10315 /// Usage ID `0x486`: "Data Field: Magnetic Flux Y Axis"
10316 DataFieldMagneticFluxYAxis = 0x486,
10317 /// Usage ID `0x487`: "Data Field: Magnetic Flux Z Axis"
10318 DataFieldMagneticFluxZAxis = 0x487,
10319 /// Usage ID `0x488`: "Data Field: Magnetometer Accuracy"
10320 DataFieldMagnetometerAccuracy = 0x488,
10321 /// Usage ID `0x489`: "Data Field: Simple Orientation Direction"
10322 DataFieldSimpleOrientationDirection = 0x489,
10323 /// Usage ID `0x490`: "Data Field: Mechanical"
10324 DataFieldMechanical = 0x490,
10325 /// Usage ID `0x491`: "Data Field: Boolean Switch State"
10326 DataFieldBooleanSwitchState = 0x491,
10327 /// Usage ID `0x492`: "Data Field: Boolean Switch Array States"
10328 DataFieldBooleanSwitchArrayStates = 0x492,
10329 /// Usage ID `0x493`: "Data Field: Multivalue Switch Value"
10330 DataFieldMultivalueSwitchValue = 0x493,
10331 /// Usage ID `0x494`: "Data Field: Force"
10332 DataFieldForce = 0x494,
10333 /// Usage ID `0x495`: "Data Field: Absolute Pressure"
10334 DataFieldAbsolutePressure = 0x495,
10335 /// Usage ID `0x496`: "Data Field: Gauge Pressure"
10336 DataFieldGaugePressure = 0x496,
10337 /// Usage ID `0x497`: "Data Field: Strain"
10338 DataFieldStrain = 0x497,
10339 /// Usage ID `0x498`: "Data Field: Weight"
10340 DataFieldWeight = 0x498,
10341 /// Usage ID `0x4A0`: "Property: Mechanical"
10342 PropertyMechanical = 0x4A0,
10343 /// Usage ID `0x4A1`: "Property: Vibration State"
10344 PropertyVibrationState = 0x4A1,
10345 /// Usage ID `0x4A2`: "Property: Forward Vibration Speed"
10346 PropertyForwardVibrationSpeed = 0x4A2,
10347 /// Usage ID `0x4A3`: "Property: Backward Vibration Speed"
10348 PropertyBackwardVibrationSpeed = 0x4A3,
10349 /// Usage ID `0x4B0`: "Data Field: Biometric"
10350 DataFieldBiometric = 0x4B0,
10351 /// Usage ID `0x4B1`: "Data Field: Human Presence"
10352 DataFieldHumanPresence = 0x4B1,
10353 /// Usage ID `0x4B2`: "Data Field: Human Proximity Range"
10354 DataFieldHumanProximityRange = 0x4B2,
10355 /// Usage ID `0x4B3`: "Data Field: Human Proximity Out of Range"
10356 DataFieldHumanProximityOutofRange = 0x4B3,
10357 /// Usage ID `0x4B4`: "Data Field: Human Touch State"
10358 DataFieldHumanTouchState = 0x4B4,
10359 /// Usage ID `0x4B5`: "Data Field: Blood Pressure"
10360 DataFieldBloodPressure = 0x4B5,
10361 /// Usage ID `0x4B6`: "Data Field: Blood Pressure Diastolic"
10362 DataFieldBloodPressureDiastolic = 0x4B6,
10363 /// Usage ID `0x4B7`: "Data Field: Blood Pressure Systolic"
10364 DataFieldBloodPressureSystolic = 0x4B7,
10365 /// Usage ID `0x4B8`: "Data Field: Heart Rate"
10366 DataFieldHeartRate = 0x4B8,
10367 /// Usage ID `0x4B9`: "Data Field: Resting Heart Rate"
10368 DataFieldRestingHeartRate = 0x4B9,
10369 /// Usage ID `0x4BA`: "Data Field: Heartbeat Interval"
10370 DataFieldHeartbeatInterval = 0x4BA,
10371 /// Usage ID `0x4BB`: "Data Field: Respiratory Rate"
10372 DataFieldRespiratoryRate = 0x4BB,
10373 /// Usage ID `0x4BC`: "Data Field: SpO2"
10374 DataFieldSpO2 = 0x4BC,
10375 /// Usage ID `0x4BD`: "Data Field: Human Attention Detected"
10376 DataFieldHumanAttentionDetected = 0x4BD,
10377 /// Usage ID `0x4BE`: "Data Field: Human Head Azimuth"
10378 DataFieldHumanHeadAzimuth = 0x4BE,
10379 /// Usage ID `0x4BF`: "Data Field: Human Head Altitude"
10380 DataFieldHumanHeadAltitude = 0x4BF,
10381 /// Usage ID `0x4C0`: "Data Field: Human Head Roll"
10382 DataFieldHumanHeadRoll = 0x4C0,
10383 /// Usage ID `0x4C1`: "Data Field: Human Head Pitch"
10384 DataFieldHumanHeadPitch = 0x4C1,
10385 /// Usage ID `0x4C2`: "Data Field: Human Head Yaw"
10386 DataFieldHumanHeadYaw = 0x4C2,
10387 /// Usage ID `0x4C3`: "Data Field: Human Correlation Id"
10388 DataFieldHumanCorrelationId = 0x4C3,
10389 /// Usage ID `0x4D0`: "Data Field: Light"
10390 DataFieldLight = 0x4D0,
10391 /// Usage ID `0x4D1`: "Data Field: Illuminance"
10392 DataFieldIlluminance = 0x4D1,
10393 /// Usage ID `0x4D2`: "Data Field: Color Temperature"
10394 DataFieldColorTemperature = 0x4D2,
10395 /// Usage ID `0x4D3`: "Data Field: Chromaticity"
10396 DataFieldChromaticity = 0x4D3,
10397 /// Usage ID `0x4D4`: "Data Field: Chromaticity X"
10398 DataFieldChromaticityX = 0x4D4,
10399 /// Usage ID `0x4D5`: "Data Field: Chromaticity Y"
10400 DataFieldChromaticityY = 0x4D5,
10401 /// Usage ID `0x4D6`: "Data Field: Consumer IR Sentence Receive"
10402 DataFieldConsumerIRSentenceReceive = 0x4D6,
10403 /// Usage ID `0x4D7`: "Data Field: Infrared Light"
10404 DataFieldInfraredLight = 0x4D7,
10405 /// Usage ID `0x4D8`: "Data Field: Red Light"
10406 DataFieldRedLight = 0x4D8,
10407 /// Usage ID `0x4D9`: "Data Field: Green Light"
10408 DataFieldGreenLight = 0x4D9,
10409 /// Usage ID `0x4DA`: "Data Field: Blue Light"
10410 DataFieldBlueLight = 0x4DA,
10411 /// Usage ID `0x4DB`: "Data Field: Ultraviolet A Light"
10412 DataFieldUltravioletALight = 0x4DB,
10413 /// Usage ID `0x4DC`: "Data Field: Ultraviolet B Light"
10414 DataFieldUltravioletBLight = 0x4DC,
10415 /// Usage ID `0x4DD`: "Data Field: Ultraviolet Index"
10416 DataFieldUltravioletIndex = 0x4DD,
10417 /// Usage ID `0x4DE`: "Data Field: Near Infrared Light"
10418 DataFieldNearInfraredLight = 0x4DE,
10419 /// Usage ID `0x4DF`: "Property: Light"
10420 PropertyLight = 0x4DF,
10421 /// Usage ID `0x4E0`: "Property: Consumer IR Sentence Send"
10422 PropertyConsumerIRSentenceSend = 0x4E0,
10423 /// Usage ID `0x4E2`: "Property: Auto Brightness Preferred"
10424 PropertyAutoBrightnessPreferred = 0x4E2,
10425 /// Usage ID `0x4E3`: "Property: Auto Color Preferred"
10426 PropertyAutoColorPreferred = 0x4E3,
10427 /// Usage ID `0x4F0`: "Data Field: Scanner"
10428 DataFieldScanner = 0x4F0,
10429 /// Usage ID `0x4F1`: "Data Field: RFID Tag 40 Bit"
10430 DataFieldRFIDTag40Bit = 0x4F1,
10431 /// Usage ID `0x4F2`: "Data Field: NFC Sentence Receive"
10432 DataFieldNFCSentenceReceive = 0x4F2,
10433 /// Usage ID `0x4F8`: "Property: Scanner"
10434 PropertyScanner = 0x4F8,
10435 /// Usage ID `0x4F9`: "Property: NFC Sentence Send"
10436 PropertyNFCSentenceSend = 0x4F9,
10437 /// Usage ID `0x500`: "Data Field: Electrical"
10438 DataFieldElectrical = 0x500,
10439 /// Usage ID `0x501`: "Data Field: Capacitance"
10440 DataFieldCapacitance = 0x501,
10441 /// Usage ID `0x502`: "Data Field: Current"
10442 DataFieldCurrent = 0x502,
10443 /// Usage ID `0x503`: "Data Field: Electrical Power"
10444 DataFieldElectricalPower = 0x503,
10445 /// Usage ID `0x504`: "Data Field: Inductance"
10446 DataFieldInductance = 0x504,
10447 /// Usage ID `0x505`: "Data Field: Resistance"
10448 DataFieldResistance = 0x505,
10449 /// Usage ID `0x506`: "Data Field: Voltage"
10450 DataFieldVoltage = 0x506,
10451 /// Usage ID `0x507`: "Data Field: Frequency"
10452 DataFieldFrequency = 0x507,
10453 /// Usage ID `0x508`: "Data Field: Period"
10454 DataFieldPeriod = 0x508,
10455 /// Usage ID `0x509`: "Data Field: Percent of Range"
10456 DataFieldPercentofRange = 0x509,
10457 /// Usage ID `0x520`: "Data Field: Time"
10458 DataFieldTime = 0x520,
10459 /// Usage ID `0x521`: "Data Field: Year"
10460 DataFieldYear = 0x521,
10461 /// Usage ID `0x522`: "Data Field: Month"
10462 DataFieldMonth = 0x522,
10463 /// Usage ID `0x523`: "Data Field: Day"
10464 DataFieldDay = 0x523,
10465 /// Usage ID `0x524`: "Data Field: Day of Week"
10466 DataFieldDayofWeek = 0x524,
10467 /// Usage ID `0x525`: "Data Field: Hour"
10468 DataFieldHour = 0x525,
10469 /// Usage ID `0x526`: "Data Field: Minute"
10470 DataFieldMinute = 0x526,
10471 /// Usage ID `0x527`: "Data Field: Second"
10472 DataFieldSecond = 0x527,
10473 /// Usage ID `0x528`: "Data Field: Millisecond"
10474 DataFieldMillisecond = 0x528,
10475 /// Usage ID `0x529`: "Data Field: Timestamp"
10476 DataFieldTimestamp = 0x529,
10477 /// Usage ID `0x52A`: "Data Field: Julian Day of Year"
10478 DataFieldJulianDayofYear = 0x52A,
10479 /// Usage ID `0x52B`: "Data Field: Time Since System Boot"
10480 DataFieldTimeSinceSystemBoot = 0x52B,
10481 /// Usage ID `0x530`: "Property: Time"
10482 PropertyTime = 0x530,
10483 /// Usage ID `0x531`: "Property: Time Zone Offset from UTC"
10484 PropertyTimeZoneOffsetfromUTC = 0x531,
10485 /// Usage ID `0x532`: "Property: Time Zone Name"
10486 PropertyTimeZoneName = 0x532,
10487 /// Usage ID `0x533`: "Property: Daylight Savings Time Observed"
10488 PropertyDaylightSavingsTimeObserved = 0x533,
10489 /// Usage ID `0x534`: "Property: Time Trim Adjustment"
10490 PropertyTimeTrimAdjustment = 0x534,
10491 /// Usage ID `0x535`: "Property: Arm Alarm"
10492 PropertyArmAlarm = 0x535,
10493 /// Usage ID `0x540`: "Data Field: Custom"
10494 DataFieldCustom = 0x540,
10495 /// Usage ID `0x541`: "Data Field: Custom Usage"
10496 DataFieldCustomUsage = 0x541,
10497 /// Usage ID `0x542`: "Data Field: Custom Boolean Array"
10498 DataFieldCustomBooleanArray = 0x542,
10499 /// Usage ID `0x543`: "Data Field: Custom Value"
10500 DataFieldCustomValue = 0x543,
10501 /// Usage ID `0x544`: "Data Field: Custom Value 1"
10502 DataFieldCustomValue1 = 0x544,
10503 /// Usage ID `0x545`: "Data Field: Custom Value 2"
10504 DataFieldCustomValue2 = 0x545,
10505 /// Usage ID `0x546`: "Data Field: Custom Value 3"
10506 DataFieldCustomValue3 = 0x546,
10507 /// Usage ID `0x547`: "Data Field: Custom Value 4"
10508 DataFieldCustomValue4 = 0x547,
10509 /// Usage ID `0x548`: "Data Field: Custom Value 5"
10510 DataFieldCustomValue5 = 0x548,
10511 /// Usage ID `0x549`: "Data Field: Custom Value 6"
10512 DataFieldCustomValue6 = 0x549,
10513 /// Usage ID `0x54A`: "Data Field: Custom Value 7"
10514 DataFieldCustomValue7 = 0x54A,
10515 /// Usage ID `0x54B`: "Data Field: Custom Value 8"
10516 DataFieldCustomValue8 = 0x54B,
10517 /// Usage ID `0x54C`: "Data Field: Custom Value 9"
10518 DataFieldCustomValue9 = 0x54C,
10519 /// Usage ID `0x54D`: "Data Field: Custom Value 10"
10520 DataFieldCustomValue10 = 0x54D,
10521 /// Usage ID `0x54E`: "Data Field: Custom Value 11"
10522 DataFieldCustomValue11 = 0x54E,
10523 /// Usage ID `0x54F`: "Data Field: Custom Value 12"
10524 DataFieldCustomValue12 = 0x54F,
10525 /// Usage ID `0x550`: "Data Field: Custom Value 13"
10526 DataFieldCustomValue13 = 0x550,
10527 /// Usage ID `0x551`: "Data Field: Custom Value 14"
10528 DataFieldCustomValue14 = 0x551,
10529 /// Usage ID `0x552`: "Data Field: Custom Value 15"
10530 DataFieldCustomValue15 = 0x552,
10531 /// Usage ID `0x553`: "Data Field: Custom Value 16"
10532 DataFieldCustomValue16 = 0x553,
10533 /// Usage ID `0x554`: "Data Field: Custom Value 17"
10534 DataFieldCustomValue17 = 0x554,
10535 /// Usage ID `0x555`: "Data Field: Custom Value 18"
10536 DataFieldCustomValue18 = 0x555,
10537 /// Usage ID `0x556`: "Data Field: Custom Value 19"
10538 DataFieldCustomValue19 = 0x556,
10539 /// Usage ID `0x557`: "Data Field: Custom Value 20"
10540 DataFieldCustomValue20 = 0x557,
10541 /// Usage ID `0x558`: "Data Field: Custom Value 21"
10542 DataFieldCustomValue21 = 0x558,
10543 /// Usage ID `0x559`: "Data Field: Custom Value 22"
10544 DataFieldCustomValue22 = 0x559,
10545 /// Usage ID `0x55A`: "Data Field: Custom Value 23"
10546 DataFieldCustomValue23 = 0x55A,
10547 /// Usage ID `0x55B`: "Data Field: Custom Value 24"
10548 DataFieldCustomValue24 = 0x55B,
10549 /// Usage ID `0x55C`: "Data Field: Custom Value 25"
10550 DataFieldCustomValue25 = 0x55C,
10551 /// Usage ID `0x55D`: "Data Field: Custom Value 26"
10552 DataFieldCustomValue26 = 0x55D,
10553 /// Usage ID `0x55E`: "Data Field: Custom Value 27"
10554 DataFieldCustomValue27 = 0x55E,
10555 /// Usage ID `0x55F`: "Data Field: Custom Value 28"
10556 DataFieldCustomValue28 = 0x55F,
10557 /// Usage ID `0x560`: "Data Field: Generic"
10558 DataFieldGeneric = 0x560,
10559 /// Usage ID `0x561`: "Data Field: Generic GUID or PROPERTYKEY"
10560 DataFieldGenericGUIDorPROPERTYKEY = 0x561,
10561 /// Usage ID `0x562`: "Data Field: Generic Category GUID"
10562 DataFieldGenericCategoryGUID = 0x562,
10563 /// Usage ID `0x563`: "Data Field: Generic Type GUID"
10564 DataFieldGenericTypeGUID = 0x563,
10565 /// Usage ID `0x564`: "Data Field: Generic Event PROPERTYKEY"
10566 DataFieldGenericEventPROPERTYKEY = 0x564,
10567 /// Usage ID `0x565`: "Data Field: Generic Property PROPERTYKEY"
10568 DataFieldGenericPropertyPROPERTYKEY = 0x565,
10569 /// Usage ID `0x566`: "Data Field: Generic Data Field PROPERTYKEY"
10570 DataFieldGenericDataFieldPROPERTYKEY = 0x566,
10571 /// Usage ID `0x567`: "Data Field: Generic Event"
10572 DataFieldGenericEvent = 0x567,
10573 /// Usage ID `0x568`: "Data Field: Generic Property"
10574 DataFieldGenericProperty = 0x568,
10575 /// Usage ID `0x569`: "Data Field: Generic Data Field"
10576 DataFieldGenericDataField = 0x569,
10577 /// Usage ID `0x56A`: "Data Field: Enumerator Table Row Index"
10578 DataFieldEnumeratorTableRowIndex = 0x56A,
10579 /// Usage ID `0x56B`: "Data Field: Enumerator Table Row Count"
10580 DataFieldEnumeratorTableRowCount = 0x56B,
10581 /// Usage ID `0x56C`: "Data Field: Generic GUID or PROPERTYKEY kind"
10582 DataFieldGenericGUIDorPROPERTYKEYkind = 0x56C,
10583 /// Usage ID `0x56D`: "Data Field: Generic GUID"
10584 DataFieldGenericGUID = 0x56D,
10585 /// Usage ID `0x56E`: "Data Field: Generic PROPERTYKEY"
10586 DataFieldGenericPROPERTYKEY = 0x56E,
10587 /// Usage ID `0x56F`: "Data Field: Generic Top Level Collection ID"
10588 DataFieldGenericTopLevelCollectionID = 0x56F,
10589 /// Usage ID `0x570`: "Data Field: Generic Report ID"
10590 DataFieldGenericReportID = 0x570,
10591 /// Usage ID `0x571`: "Data Field: Generic Report Item Position Index"
10592 DataFieldGenericReportItemPositionIndex = 0x571,
10593 /// Usage ID `0x572`: "Data Field: Generic Firmware VARTYPE"
10594 DataFieldGenericFirmwareVARTYPE = 0x572,
10595 /// Usage ID `0x573`: "Data Field: Generic Unit of Measure"
10596 DataFieldGenericUnitofMeasure = 0x573,
10597 /// Usage ID `0x574`: "Data Field: Generic Unit Exponent"
10598 DataFieldGenericUnitExponent = 0x574,
10599 /// Usage ID `0x575`: "Data Field: Generic Report Size"
10600 DataFieldGenericReportSize = 0x575,
10601 /// Usage ID `0x576`: "Data Field: Generic Report Count"
10602 DataFieldGenericReportCount = 0x576,
10603 /// Usage ID `0x580`: "Property: Generic"
10604 PropertyGeneric = 0x580,
10605 /// Usage ID `0x581`: "Property: Enumerator Table Row Index"
10606 PropertyEnumeratorTableRowIndex = 0x581,
10607 /// Usage ID `0x582`: "Property: Enumerator Table Row Count"
10608 PropertyEnumeratorTableRowCount = 0x582,
10609 /// Usage ID `0x590`: "Data Field: Personal Activity"
10610 DataFieldPersonalActivity = 0x590,
10611 /// Usage ID `0x591`: "Data Field: Activity Type"
10612 DataFieldActivityType = 0x591,
10613 /// Usage ID `0x592`: "Data Field: Activity State"
10614 DataFieldActivityState = 0x592,
10615 /// Usage ID `0x593`: "Data Field: Device Position"
10616 DataFieldDevicePosition = 0x593,
10617 /// Usage ID `0x594`: "Data Field: Step Count"
10618 DataFieldStepCount = 0x594,
10619 /// Usage ID `0x595`: "Data Field: Step Count Reset"
10620 DataFieldStepCountReset = 0x595,
10621 /// Usage ID `0x596`: "Data Field: Step Duration"
10622 DataFieldStepDuration = 0x596,
10623 /// Usage ID `0x597`: "Data Field: Step Type"
10624 DataFieldStepType = 0x597,
10625 /// Usage ID `0x5A0`: "Property: Minimum Activity Detection Interval"
10626 PropertyMinimumActivityDetectionInterval = 0x5A0,
10627 /// Usage ID `0x5A1`: "Property: Supported Activity Types"
10628 PropertySupportedActivityTypes = 0x5A1,
10629 /// Usage ID `0x5A2`: "Property: Subscribed Activity Types"
10630 PropertySubscribedActivityTypes = 0x5A2,
10631 /// Usage ID `0x5A3`: "Property: Supported Step Types"
10632 PropertySupportedStepTypes = 0x5A3,
10633 /// Usage ID `0x5A4`: "Property: Subscribed Step Types"
10634 PropertySubscribedStepTypes = 0x5A4,
10635 /// Usage ID `0x5A5`: "Property: Floor Height"
10636 PropertyFloorHeight = 0x5A5,
10637 /// Usage ID `0x5B0`: "Data Field: Custom Type ID"
10638 DataFieldCustomTypeID = 0x5B0,
10639 /// Usage ID `0x5C0`: "Property: Custom"
10640 PropertyCustom = 0x5C0,
10641 /// Usage ID `0x5C1`: "Property: Custom Value 1"
10642 PropertyCustomValue1 = 0x5C1,
10643 /// Usage ID `0x5C2`: "Property: Custom Value 2"
10644 PropertyCustomValue2 = 0x5C2,
10645 /// Usage ID `0x5C3`: "Property: Custom Value 3"
10646 PropertyCustomValue3 = 0x5C3,
10647 /// Usage ID `0x5C4`: "Property: Custom Value 4"
10648 PropertyCustomValue4 = 0x5C4,
10649 /// Usage ID `0x5C5`: "Property: Custom Value 5"
10650 PropertyCustomValue5 = 0x5C5,
10651 /// Usage ID `0x5C6`: "Property: Custom Value 6"
10652 PropertyCustomValue6 = 0x5C6,
10653 /// Usage ID `0x5C7`: "Property: Custom Value 7"
10654 PropertyCustomValue7 = 0x5C7,
10655 /// Usage ID `0x5C8`: "Property: Custom Value 8"
10656 PropertyCustomValue8 = 0x5C8,
10657 /// Usage ID `0x5C9`: "Property: Custom Value 9"
10658 PropertyCustomValue9 = 0x5C9,
10659 /// Usage ID `0x5CA`: "Property: Custom Value 10"
10660 PropertyCustomValue10 = 0x5CA,
10661 /// Usage ID `0x5CB`: "Property: Custom Value 11"
10662 PropertyCustomValue11 = 0x5CB,
10663 /// Usage ID `0x5CC`: "Property: Custom Value 12"
10664 PropertyCustomValue12 = 0x5CC,
10665 /// Usage ID `0x5CD`: "Property: Custom Value 13"
10666 PropertyCustomValue13 = 0x5CD,
10667 /// Usage ID `0x5CE`: "Property: Custom Value 14"
10668 PropertyCustomValue14 = 0x5CE,
10669 /// Usage ID `0x5CF`: "Property: Custom Value 15"
10670 PropertyCustomValue15 = 0x5CF,
10671 /// Usage ID `0x5D0`: "Property: Custom Value 16"
10672 PropertyCustomValue16 = 0x5D0,
10673 /// Usage ID `0x5E0`: "Data Field: Hinge"
10674 DataFieldHinge = 0x5E0,
10675 /// Usage ID `0x5E1`: "Data Field: Hinge Angle"
10676 DataFieldHingeAngle = 0x5E1,
10677 /// Usage ID `0x5F0`: "Data Field: Gesture Sensor"
10678 DataFieldGestureSensor = 0x5F0,
10679 /// Usage ID `0x5F1`: "Data Field: Gesture State"
10680 DataFieldGestureState = 0x5F1,
10681 /// Usage ID `0x5F2`: "Data Field: Hinge Fold Initial Angle"
10682 DataFieldHingeFoldInitialAngle = 0x5F2,
10683 /// Usage ID `0x5F3`: "Data Field: Hinge Fold Final Angle"
10684 DataFieldHingeFoldFinalAngle = 0x5F3,
10685 /// Usage ID `0x5F4`: "Data Field: Hinge Fold Contributing Panel"
10686 DataFieldHingeFoldContributingPanel = 0x5F4,
10687 /// Usage ID `0x5F5`: "Data Field: Hinge Fold Type"
10688 DataFieldHingeFoldType = 0x5F5,
10689 /// Usage ID `0x800`: "Sensor State: Undefined"
10690 SensorStateUndefined = 0x800,
10691 /// Usage ID `0x801`: "Sensor State: Ready"
10692 SensorStateReady = 0x801,
10693 /// Usage ID `0x802`: "Sensor State: Not Available"
10694 SensorStateNotAvailable = 0x802,
10695 /// Usage ID `0x803`: "Sensor State: No Data"
10696 SensorStateNoData = 0x803,
10697 /// Usage ID `0x804`: "Sensor State: Initializing"
10698 SensorStateInitializing = 0x804,
10699 /// Usage ID `0x805`: "Sensor State: Access Denied"
10700 SensorStateAccessDenied = 0x805,
10701 /// Usage ID `0x806`: "Sensor State: Error"
10702 SensorStateError = 0x806,
10703 /// Usage ID `0x810`: "Sensor Event: Unknown"
10704 SensorEventUnknown = 0x810,
10705 /// Usage ID `0x811`: "Sensor Event: State Changed"
10706 SensorEventStateChanged = 0x811,
10707 /// Usage ID `0x812`: "Sensor Event: Property Changed"
10708 SensorEventPropertyChanged = 0x812,
10709 /// Usage ID `0x813`: "Sensor Event: Data Updated"
10710 SensorEventDataUpdated = 0x813,
10711 /// Usage ID `0x814`: "Sensor Event: Poll Response"
10712 SensorEventPollResponse = 0x814,
10713 /// Usage ID `0x815`: "Sensor Event: Change Sensitivity"
10714 SensorEventChangeSensitivity = 0x815,
10715 /// Usage ID `0x816`: "Sensor Event: Range Maximum Reached"
10716 SensorEventRangeMaximumReached = 0x816,
10717 /// Usage ID `0x817`: "Sensor Event: Range Minimum Reached"
10718 SensorEventRangeMinimumReached = 0x817,
10719 /// Usage ID `0x818`: "Sensor Event: High Threshold Cross Upward"
10720 SensorEventHighThresholdCrossUpward = 0x818,
10721 /// Usage ID `0x819`: "Sensor Event: High Threshold Cross Downward"
10722 SensorEventHighThresholdCrossDownward = 0x819,
10723 /// Usage ID `0x81A`: "Sensor Event: Low Threshold Cross Upward"
10724 SensorEventLowThresholdCrossUpward = 0x81A,
10725 /// Usage ID `0x81B`: "Sensor Event: Low Threshold Cross Downward"
10726 SensorEventLowThresholdCrossDownward = 0x81B,
10727 /// Usage ID `0x81C`: "Sensor Event: Zero Threshold Cross Upward"
10728 SensorEventZeroThresholdCrossUpward = 0x81C,
10729 /// Usage ID `0x81D`: "Sensor Event: Zero Threshold Cross Downward"
10730 SensorEventZeroThresholdCrossDownward = 0x81D,
10731 /// Usage ID `0x81E`: "Sensor Event: Period Exceeded"
10732 SensorEventPeriodExceeded = 0x81E,
10733 /// Usage ID `0x81F`: "Sensor Event: Frequency Exceeded"
10734 SensorEventFrequencyExceeded = 0x81F,
10735 /// Usage ID `0x820`: "Sensor Event: Complex Trigger"
10736 SensorEventComplexTrigger = 0x820,
10737 /// Usage ID `0x830`: "Connection Type: PC Integrated"
10738 ConnectionTypePCIntegrated = 0x830,
10739 /// Usage ID `0x831`: "Connection Type: PC Attached"
10740 ConnectionTypePCAttached = 0x831,
10741 /// Usage ID `0x832`: "Connection Type: PC External"
10742 ConnectionTypePCExternal = 0x832,
10743 /// Usage ID `0x840`: "Reporting State: Report No Events"
10744 ReportingStateReportNoEvents = 0x840,
10745 /// Usage ID `0x841`: "Reporting State: Report All Events"
10746 ReportingStateReportAllEvents = 0x841,
10747 /// Usage ID `0x842`: "Reporting State: Report Threshold Events"
10748 ReportingStateReportThresholdEvents = 0x842,
10749 /// Usage ID `0x843`: "Reporting State: Wake On No Events"
10750 ReportingStateWakeOnNoEvents = 0x843,
10751 /// Usage ID `0x844`: "Reporting State: Wake On All Events"
10752 ReportingStateWakeOnAllEvents = 0x844,
10753 /// Usage ID `0x845`: "Reporting State: Wake On Threshold Events"
10754 ReportingStateWakeOnThresholdEvents = 0x845,
10755 /// Usage ID `0x846`: "Reporting State: Anytime"
10756 ReportingStateAnytime = 0x846,
10757 /// Usage ID `0x850`: "Power State: Undefined"
10758 PowerStateUndefined = 0x850,
10759 /// Usage ID `0x851`: "Power State: D0 Full Power"
10760 PowerStateD0FullPower = 0x851,
10761 /// Usage ID `0x852`: "Power State: D1 Low Power"
10762 PowerStateD1LowPower = 0x852,
10763 /// Usage ID `0x853`: "Power State: D2 Standby Power with Wakeup"
10764 PowerStateD2StandbyPowerwithWakeup = 0x853,
10765 /// Usage ID `0x854`: "Power State: D3 Sleep with Wakeup"
10766 PowerStateD3SleepwithWakeup = 0x854,
10767 /// Usage ID `0x855`: "Power State: D4 Power Off"
10768 PowerStateD4PowerOff = 0x855,
10769 /// Usage ID `0x860`: "Accuracy: Default"
10770 AccuracyDefault = 0x860,
10771 /// Usage ID `0x861`: "Accuracy: High"
10772 AccuracyHigh = 0x861,
10773 /// Usage ID `0x862`: "Accuracy: Medium"
10774 AccuracyMedium = 0x862,
10775 /// Usage ID `0x863`: "Accuracy: Low"
10776 AccuracyLow = 0x863,
10777 /// Usage ID `0x870`: "Fix Quality: No Fix"
10778 FixQualityNoFix = 0x870,
10779 /// Usage ID `0x871`: "Fix Quality: GPS"
10780 FixQualityGPS = 0x871,
10781 /// Usage ID `0x872`: "Fix Quality: DGPS"
10782 FixQualityDGPS = 0x872,
10783 /// Usage ID `0x880`: "Fix Type: No Fix"
10784 FixTypeNoFix = 0x880,
10785 /// Usage ID `0x881`: "Fix Type: GPS SPS Mode, Fix Valid"
10786 FixTypeGPSSPSModeFixValid = 0x881,
10787 /// Usage ID `0x882`: "Fix Type: DGPS SPS Mode, Fix Valid"
10788 FixTypeDGPSSPSModeFixValid = 0x882,
10789 /// Usage ID `0x883`: "Fix Type: GPS PPS Mode, Fix Valid"
10790 FixTypeGPSPPSModeFixValid = 0x883,
10791 /// Usage ID `0x884`: "Fix Type: Real Time Kinematic"
10792 FixTypeRealTimeKinematic = 0x884,
10793 /// Usage ID `0x885`: "Fix Type: Float RTK"
10794 FixTypeFloatRTK = 0x885,
10795 /// Usage ID `0x886`: "Fix Type: Estimated (dead reckoned)"
10796 FixTypeEstimateddeadreckoned = 0x886,
10797 /// Usage ID `0x887`: "Fix Type: Manual Input Mode"
10798 FixTypeManualInputMode = 0x887,
10799 /// Usage ID `0x888`: "Fix Type: Simulator Mode"
10800 FixTypeSimulatorMode = 0x888,
10801 /// Usage ID `0x890`: "GPS Operation Mode: Manual"
10802 GPSOperationModeManual = 0x890,
10803 /// Usage ID `0x891`: "GPS Operation Mode: Automatic"
10804 GPSOperationModeAutomatic = 0x891,
10805 /// Usage ID `0x8A0`: "GPS Selection Mode: Autonomous"
10806 GPSSelectionModeAutonomous = 0x8A0,
10807 /// Usage ID `0x8A1`: "GPS Selection Mode: DGPS"
10808 GPSSelectionModeDGPS = 0x8A1,
10809 /// Usage ID `0x8A2`: "GPS Selection Mode: Estimated (dead reckoned)"
10810 GPSSelectionModeEstimateddeadreckoned = 0x8A2,
10811 /// Usage ID `0x8A3`: "GPS Selection Mode: Manual Input"
10812 GPSSelectionModeManualInput = 0x8A3,
10813 /// Usage ID `0x8A4`: "GPS Selection Mode: Simulator"
10814 GPSSelectionModeSimulator = 0x8A4,
10815 /// Usage ID `0x8A5`: "GPS Selection Mode: Data Not Valid"
10816 GPSSelectionModeDataNotValid = 0x8A5,
10817 /// Usage ID `0x8B0`: "GPS Status Data: Valid"
10818 GPSStatusDataValid = 0x8B0,
10819 /// Usage ID `0x8B1`: "GPS Status Data: Not Valid"
10820 GPSStatusDataNotValid = 0x8B1,
10821 /// Usage ID `0x8C0`: "Day of Week: Sunday"
10822 DayofWeekSunday = 0x8C0,
10823 /// Usage ID `0x8C1`: "Day of Week: Monday"
10824 DayofWeekMonday = 0x8C1,
10825 /// Usage ID `0x8C2`: "Day of Week: Tuesday"
10826 DayofWeekTuesday = 0x8C2,
10827 /// Usage ID `0x8C3`: "Day of Week: Wednesday"
10828 DayofWeekWednesday = 0x8C3,
10829 /// Usage ID `0x8C4`: "Day of Week: Thursday"
10830 DayofWeekThursday = 0x8C4,
10831 /// Usage ID `0x8C5`: "Day of Week: Friday"
10832 DayofWeekFriday = 0x8C5,
10833 /// Usage ID `0x8C6`: "Day of Week: Saturday"
10834 DayofWeekSaturday = 0x8C6,
10835 /// Usage ID `0x8D0`: "Kind: Category"
10836 KindCategory = 0x8D0,
10837 /// Usage ID `0x8D1`: "Kind: Type"
10838 KindType = 0x8D1,
10839 /// Usage ID `0x8D2`: "Kind: Event"
10840 KindEvent = 0x8D2,
10841 /// Usage ID `0x8D3`: "Kind: Property"
10842 KindProperty = 0x8D3,
10843 /// Usage ID `0x8D4`: "Kind: Data Field"
10844 KindDataField = 0x8D4,
10845 /// Usage ID `0x8E0`: "Magnetometer Accuracy: Low"
10846 MagnetometerAccuracyLow = 0x8E0,
10847 /// Usage ID `0x8E1`: "Magnetometer Accuracy: Medium"
10848 MagnetometerAccuracyMedium = 0x8E1,
10849 /// Usage ID `0x8E2`: "Magnetometer Accuracy: High"
10850 MagnetometerAccuracyHigh = 0x8E2,
10851 /// Usage ID `0x8F0`: "Simple Orientation Direction: Not Rotated"
10852 SimpleOrientationDirectionNotRotated = 0x8F0,
10853 /// Usage ID `0x8F1`: "Simple Orientation Direction: Rotated 90 Degrees CCW"
10854 SimpleOrientationDirectionRotated90DegreesCCW = 0x8F1,
10855 /// Usage ID `0x8F2`: "Simple Orientation Direction: Rotated 180 Degrees CCW"
10856 SimpleOrientationDirectionRotated180DegreesCCW = 0x8F2,
10857 /// Usage ID `0x8F3`: "Simple Orientation Direction: Rotated 270 Degrees CCW"
10858 SimpleOrientationDirectionRotated270DegreesCCW = 0x8F3,
10859 /// Usage ID `0x8F4`: "Simple Orientation Direction: Face Up"
10860 SimpleOrientationDirectionFaceUp = 0x8F4,
10861 /// Usage ID `0x8F5`: "Simple Orientation Direction: Face Down"
10862 SimpleOrientationDirectionFaceDown = 0x8F5,
10863 /// Usage ID `0x900`: "VT_NULL"
10864 VT_NULL = 0x900,
10865 /// Usage ID `0x901`: "VT_BOOL"
10866 VT_BOOL = 0x901,
10867 /// Usage ID `0x902`: "VT_UI1"
10868 VT_UI1 = 0x902,
10869 /// Usage ID `0x903`: "VT_I1"
10870 VT_I1 = 0x903,
10871 /// Usage ID `0x904`: "VT_UI2"
10872 VT_UI2 = 0x904,
10873 /// Usage ID `0x905`: "VT_I2"
10874 VT_I2 = 0x905,
10875 /// Usage ID `0x906`: "VT_UI4"
10876 VT_UI4 = 0x906,
10877 /// Usage ID `0x907`: "VT_I4"
10878 VT_I4 = 0x907,
10879 /// Usage ID `0x908`: "VT_UI8"
10880 VT_UI8 = 0x908,
10881 /// Usage ID `0x909`: "VT_I8"
10882 VT_I8 = 0x909,
10883 /// Usage ID `0x90A`: "VT_R4"
10884 VT_R4 = 0x90A,
10885 /// Usage ID `0x90B`: "VT_R8"
10886 VT_R8 = 0x90B,
10887 /// Usage ID `0x90C`: "VT_WSTR"
10888 VT_WSTR = 0x90C,
10889 /// Usage ID `0x90D`: "VT_STR"
10890 VT_STR = 0x90D,
10891 /// Usage ID `0x90E`: "VT_CLSID"
10892 VT_CLSID = 0x90E,
10893 /// Usage ID `0x90F`: "VT_VECTOR VT_UI1"
10894 VT_VECTORVT_UI1 = 0x90F,
10895 /// Usage ID `0x910`: "VT_F16E0"
10896 VT_F16E0 = 0x910,
10897 /// Usage ID `0x911`: "VT_F16E1"
10898 VT_F16E1 = 0x911,
10899 /// Usage ID `0x912`: "VT_F16E2"
10900 VT_F16E2 = 0x912,
10901 /// Usage ID `0x913`: "VT_F16E3"
10902 VT_F16E3 = 0x913,
10903 /// Usage ID `0x914`: "VT_F16E4"
10904 VT_F16E4 = 0x914,
10905 /// Usage ID `0x915`: "VT_F16E5"
10906 VT_F16E5 = 0x915,
10907 /// Usage ID `0x916`: "VT_F16E6"
10908 VT_F16E6 = 0x916,
10909 /// Usage ID `0x917`: "VT_F16E7"
10910 VT_F16E7 = 0x917,
10911 /// Usage ID `0x918`: "VT_F16E8"
10912 VT_F16E8 = 0x918,
10913 /// Usage ID `0x919`: "VT_F16E9"
10914 VT_F16E9 = 0x919,
10915 /// Usage ID `0x91A`: "VT_F16EA"
10916 VT_F16EA = 0x91A,
10917 /// Usage ID `0x91B`: "VT_F16EB"
10918 VT_F16EB = 0x91B,
10919 /// Usage ID `0x91C`: "VT_F16EC"
10920 VT_F16EC = 0x91C,
10921 /// Usage ID `0x91D`: "VT_F16ED"
10922 VT_F16ED = 0x91D,
10923 /// Usage ID `0x91E`: "VT_F16EE"
10924 VT_F16EE = 0x91E,
10925 /// Usage ID `0x91F`: "VT_F16EF"
10926 VT_F16EF = 0x91F,
10927 /// Usage ID `0x920`: "VT_F32E0"
10928 VT_F32E0 = 0x920,
10929 /// Usage ID `0x921`: "VT_F32E1"
10930 VT_F32E1 = 0x921,
10931 /// Usage ID `0x922`: "VT_F32E2"
10932 VT_F32E2 = 0x922,
10933 /// Usage ID `0x923`: "VT_F32E3"
10934 VT_F32E3 = 0x923,
10935 /// Usage ID `0x924`: "VT_F32E4"
10936 VT_F32E4 = 0x924,
10937 /// Usage ID `0x925`: "VT_F32E5"
10938 VT_F32E5 = 0x925,
10939 /// Usage ID `0x926`: "VT_F32E6"
10940 VT_F32E6 = 0x926,
10941 /// Usage ID `0x927`: "VT_F32E7"
10942 VT_F32E7 = 0x927,
10943 /// Usage ID `0x928`: "VT_F32E8"
10944 VT_F32E8 = 0x928,
10945 /// Usage ID `0x929`: "VT_F32E9"
10946 VT_F32E9 = 0x929,
10947 /// Usage ID `0x92A`: "VT_F32EA"
10948 VT_F32EA = 0x92A,
10949 /// Usage ID `0x92B`: "VT_F32EB"
10950 VT_F32EB = 0x92B,
10951 /// Usage ID `0x92C`: "VT_F32EC"
10952 VT_F32EC = 0x92C,
10953 /// Usage ID `0x92D`: "VT_F32ED"
10954 VT_F32ED = 0x92D,
10955 /// Usage ID `0x92E`: "VT_F32EE"
10956 VT_F32EE = 0x92E,
10957 /// Usage ID `0x92F`: "VT_F32EF"
10958 VT_F32EF = 0x92F,
10959 /// Usage ID `0x930`: "Activity Type: Unknown"
10960 ActivityTypeUnknown = 0x930,
10961 /// Usage ID `0x931`: "Activity Type: Stationary"
10962 ActivityTypeStationary = 0x931,
10963 /// Usage ID `0x932`: "Activity Type: Fidgeting"
10964 ActivityTypeFidgeting = 0x932,
10965 /// Usage ID `0x933`: "Activity Type: Walking"
10966 ActivityTypeWalking = 0x933,
10967 /// Usage ID `0x934`: "Activity Type: Running"
10968 ActivityTypeRunning = 0x934,
10969 /// Usage ID `0x935`: "Activity Type: In Vehicle"
10970 ActivityTypeInVehicle = 0x935,
10971 /// Usage ID `0x936`: "Activity Type: Biking"
10972 ActivityTypeBiking = 0x936,
10973 /// Usage ID `0x937`: "Activity Type: Idle"
10974 ActivityTypeIdle = 0x937,
10975 /// Usage ID `0x940`: "Unit: Not Specified"
10976 UnitNotSpecified = 0x940,
10977 /// Usage ID `0x941`: "Unit: Lux"
10978 UnitLux = 0x941,
10979 /// Usage ID `0x942`: "Unit: Degrees Kelvin"
10980 UnitDegreesKelvin = 0x942,
10981 /// Usage ID `0x943`: "Unit: Degrees Celsius"
10982 UnitDegreesCelsius = 0x943,
10983 /// Usage ID `0x944`: "Unit: Pascal"
10984 UnitPascal = 0x944,
10985 /// Usage ID `0x945`: "Unit: Newton"
10986 UnitNewton = 0x945,
10987 /// Usage ID `0x946`: "Unit: Meters/Second"
10988 UnitMetersSecond = 0x946,
10989 /// Usage ID `0x947`: "Unit: Kilogram"
10990 UnitKilogram = 0x947,
10991 /// Usage ID `0x948`: "Unit: Meter"
10992 UnitMeter = 0x948,
10993 /// Usage ID `0x949`: "Unit: Meters/Second/Second"
10994 UnitMetersSecondSecond = 0x949,
10995 /// Usage ID `0x94A`: "Unit: Farad"
10996 UnitFarad = 0x94A,
10997 /// Usage ID `0x94B`: "Unit: Ampere"
10998 UnitAmpere = 0x94B,
10999 /// Usage ID `0x94C`: "Unit: Watt"
11000 UnitWatt = 0x94C,
11001 /// Usage ID `0x94D`: "Unit: Henry"
11002 UnitHenry = 0x94D,
11003 /// Usage ID `0x94E`: "Unit: Ohm"
11004 UnitOhm = 0x94E,
11005 /// Usage ID `0x94F`: "Unit: Volt"
11006 UnitVolt = 0x94F,
11007 /// Usage ID `0x950`: "Unit: Hertz"
11008 UnitHertz = 0x950,
11009 /// Usage ID `0x951`: "Unit: Bar"
11010 UnitBar = 0x951,
11011 /// Usage ID `0x952`: "Unit: Degrees Anti-clockwise"
11012 UnitDegreesAnticlockwise = 0x952,
11013 /// Usage ID `0x953`: "Unit: Degrees Clockwise"
11014 UnitDegreesClockwise = 0x953,
11015 /// Usage ID `0x954`: "Unit: Degrees"
11016 UnitDegrees = 0x954,
11017 /// Usage ID `0x955`: "Unit: Degrees/Second"
11018 UnitDegreesSecond = 0x955,
11019 /// Usage ID `0x956`: "Unit: Degrees/Second/Second"
11020 UnitDegreesSecondSecond = 0x956,
11021 /// Usage ID `0x957`: "Unit: Knot"
11022 UnitKnot = 0x957,
11023 /// Usage ID `0x958`: "Unit: Percent"
11024 UnitPercent = 0x958,
11025 /// Usage ID `0x959`: "Unit: Second"
11026 UnitSecond = 0x959,
11027 /// Usage ID `0x95A`: "Unit: Millisecond"
11028 UnitMillisecond = 0x95A,
11029 /// Usage ID `0x95B`: "Unit: G"
11030 UnitG = 0x95B,
11031 /// Usage ID `0x95C`: "Unit: Bytes"
11032 UnitBytes = 0x95C,
11033 /// Usage ID `0x95D`: "Unit: Milligauss"
11034 UnitMilligauss = 0x95D,
11035 /// Usage ID `0x95E`: "Unit: Bits"
11036 UnitBits = 0x95E,
11037 /// Usage ID `0x960`: "Activity State: No State Change"
11038 ActivityStateNoStateChange = 0x960,
11039 /// Usage ID `0x961`: "Activity State: Start Activity"
11040 ActivityStateStartActivity = 0x961,
11041 /// Usage ID `0x962`: "Activity State: End Activity"
11042 ActivityStateEndActivity = 0x962,
11043 /// Usage ID `0x970`: "Exponent 0"
11044 Exponent0 = 0x970,
11045 /// Usage ID `0x971`: "Exponent 1"
11046 Exponent1 = 0x971,
11047 /// Usage ID `0x972`: "Exponent 2"
11048 Exponent2 = 0x972,
11049 /// Usage ID `0x973`: "Exponent 3"
11050 Exponent3 = 0x973,
11051 /// Usage ID `0x974`: "Exponent 4"
11052 Exponent4 = 0x974,
11053 /// Usage ID `0x975`: "Exponent 5"
11054 Exponent5 = 0x975,
11055 /// Usage ID `0x976`: "Exponent 6"
11056 Exponent6 = 0x976,
11057 /// Usage ID `0x977`: "Exponent 7"
11058 Exponent7 = 0x977,
11059 /// Usage ID `0x978`: "Exponent 8"
11060 Exponent8 = 0x978,
11061 /// Usage ID `0x979`: "Exponent 9"
11062 Exponent9 = 0x979,
11063 /// Usage ID `0x97A`: "Exponent A"
11064 ExponentA = 0x97A,
11065 /// Usage ID `0x97B`: "Exponent B"
11066 ExponentB = 0x97B,
11067 /// Usage ID `0x97C`: "Exponent C"
11068 ExponentC = 0x97C,
11069 /// Usage ID `0x97D`: "Exponent D"
11070 ExponentD = 0x97D,
11071 /// Usage ID `0x97E`: "Exponent E"
11072 ExponentE = 0x97E,
11073 /// Usage ID `0x97F`: "Exponent F"
11074 ExponentF = 0x97F,
11075 /// Usage ID `0x980`: "Device Position: Unknown"
11076 DevicePositionUnknown = 0x980,
11077 /// Usage ID `0x981`: "Device Position: Unchanged"
11078 DevicePositionUnchanged = 0x981,
11079 /// Usage ID `0x982`: "Device Position: On Desk"
11080 DevicePositionOnDesk = 0x982,
11081 /// Usage ID `0x983`: "Device Position: In Hand"
11082 DevicePositionInHand = 0x983,
11083 /// Usage ID `0x984`: "Device Position: Moving in Bag"
11084 DevicePositionMovinginBag = 0x984,
11085 /// Usage ID `0x985`: "Device Position: Stationary in Bag"
11086 DevicePositionStationaryinBag = 0x985,
11087 /// Usage ID `0x990`: "Step Type: Unknown"
11088 StepTypeUnknown = 0x990,
11089 /// Usage ID `0x991`: "Step Type: Walking"
11090 StepTypeWalking = 0x991,
11091 /// Usage ID `0x992`: "Step Type: Running"
11092 StepTypeRunning = 0x992,
11093 /// Usage ID `0x9A0`: "Gesture State: Unknown"
11094 GestureStateUnknown = 0x9A0,
11095 /// Usage ID `0x9A1`: "Gesture State: Started"
11096 GestureStateStarted = 0x9A1,
11097 /// Usage ID `0x9A2`: "Gesture State: Completed"
11098 GestureStateCompleted = 0x9A2,
11099 /// Usage ID `0x9A3`: "Gesture State: Cancelled"
11100 GestureStateCancelled = 0x9A3,
11101 /// Usage ID `0x9B0`: "Hinge Fold Contributing Panel: Unknown"
11102 HingeFoldContributingPanelUnknown = 0x9B0,
11103 /// Usage ID `0x9B1`: "Hinge Fold Contributing Panel: Panel 1"
11104 HingeFoldContributingPanelPanel1 = 0x9B1,
11105 /// Usage ID `0x9B2`: "Hinge Fold Contributing Panel: Panel 2"
11106 HingeFoldContributingPanelPanel2 = 0x9B2,
11107 /// Usage ID `0x9B3`: "Hinge Fold Contributing Panel: Both"
11108 HingeFoldContributingPanelBoth = 0x9B3,
11109 /// Usage ID `0x9B4`: "Hinge Fold Type: Unknown"
11110 HingeFoldTypeUnknown = 0x9B4,
11111 /// Usage ID `0x9B5`: "Hinge Fold Type: Increasing"
11112 HingeFoldTypeIncreasing = 0x9B5,
11113 /// Usage ID `0x9B6`: "Hinge Fold Type: Decreasing"
11114 HingeFoldTypeDecreasing = 0x9B6,
11115 /// Usage ID `0x9C0`: "Human Presence Detection Type: Vendor-Defined Non-Biometric"
11116 HumanPresenceDetectionTypeVendorDefinedNonBiometric = 0x9C0,
11117 /// Usage ID `0x9C1`: "Human Presence Detection Type: Vendor-Defined Biometric"
11118 HumanPresenceDetectionTypeVendorDefinedBiometric = 0x9C1,
11119 /// Usage ID `0x9C2`: "Human Presence Detection Type: Facial Biometric"
11120 HumanPresenceDetectionTypeFacialBiometric = 0x9C2,
11121 /// Usage ID `0x9C3`: "Human Presence Detection Type: Audio Biometric"
11122 HumanPresenceDetectionTypeAudioBiometric = 0x9C3,
11123 /// Usage ID `0x1000`: "Modifier: Change Sensitivity Absolute"
11124 ModifierChangeSensitivityAbsolute = 0x1000,
11125 /// Usage ID `0x2000`: "Modifier: Maximum"
11126 ModifierMaximum = 0x2000,
11127 /// Usage ID `0x3000`: "Modifier: Minimum"
11128 ModifierMinimum = 0x3000,
11129 /// Usage ID `0x4000`: "Modifier: Accuracy"
11130 ModifierAccuracy = 0x4000,
11131 /// Usage ID `0x5000`: "Modifier: Resolution"
11132 ModifierResolution = 0x5000,
11133 /// Usage ID `0x6000`: "Modifier: Threshold High"
11134 ModifierThresholdHigh = 0x6000,
11135 /// Usage ID `0x7000`: "Modifier: Threshold Low"
11136 ModifierThresholdLow = 0x7000,
11137 /// Usage ID `0x8000`: "Modifier: Calibration Offset"
11138 ModifierCalibrationOffset = 0x8000,
11139 /// Usage ID `0x9000`: "Modifier: Calibration Multiplier"
11140 ModifierCalibrationMultiplier = 0x9000,
11141 /// Usage ID `0xA000`: "Modifier: Report Interval"
11142 ModifierReportInterval = 0xA000,
11143 /// Usage ID `0xB000`: "Modifier: Frequency Max"
11144 ModifierFrequencyMax = 0xB000,
11145 /// Usage ID `0xC000`: "Modifier: Period Max"
11146 ModifierPeriodMax = 0xC000,
11147 /// Usage ID `0xD000`: "Modifier: Change Sensitivity Percent of Range"
11148 ModifierChangeSensitivityPercentofRange = 0xD000,
11149 /// Usage ID `0xE000`: "Modifier: Change Sensitivity Percent Relative"
11150 ModifierChangeSensitivityPercentRelative = 0xE000,
11151 /// Usage ID `0xF000`: "Modifier: Vendor Reserved"
11152 ModifierVendorReserved = 0xF000,
11153 }
11154
11155 impl Sensors {
11156 #[cfg(feature = "std")]
11157 pub fn name(&self) -> String {
11158 match self {
11159 Sensors::Sensor => "Sensor",
11160 Sensors::Biometric => "Biometric",
11161 Sensors::BiometricHumanPresence => "Biometric: Human Presence",
11162 Sensors::BiometricHumanProximity => "Biometric: Human Proximity",
11163 Sensors::BiometricHumanTouch => "Biometric: Human Touch",
11164 Sensors::BiometricBloodPressure => "Biometric: Blood Pressure",
11165 Sensors::BiometricBodyTemperature => "Biometric: Body Temperature",
11166 Sensors::BiometricHeartRate => "Biometric: Heart Rate",
11167 Sensors::BiometricHeartRateVariability => "Biometric: Heart Rate Variability",
11168 Sensors::BiometricPeripheralOxygenSaturation => {
11169 "Biometric: Peripheral Oxygen Saturation"
11170 }
11171 Sensors::BiometricRespiratoryRate => "Biometric: Respiratory Rate",
11172 Sensors::Electrical => "Electrical",
11173 Sensors::ElectricalCapacitance => "Electrical: Capacitance",
11174 Sensors::ElectricalCurrent => "Electrical: Current",
11175 Sensors::ElectricalPower => "Electrical: Power",
11176 Sensors::ElectricalInductance => "Electrical: Inductance",
11177 Sensors::ElectricalResistance => "Electrical: Resistance",
11178 Sensors::ElectricalVoltage => "Electrical: Voltage",
11179 Sensors::ElectricalPotentiometer => "Electrical: Potentiometer",
11180 Sensors::ElectricalFrequency => "Electrical: Frequency",
11181 Sensors::ElectricalPeriod => "Electrical: Period",
11182 Sensors::Environmental => "Environmental",
11183 Sensors::EnvironmentalAtmosphericPressure => "Environmental: Atmospheric Pressure",
11184 Sensors::EnvironmentalHumidity => "Environmental: Humidity",
11185 Sensors::EnvironmentalTemperature => "Environmental: Temperature",
11186 Sensors::EnvironmentalWindDirection => "Environmental: Wind Direction",
11187 Sensors::EnvironmentalWindSpeed => "Environmental: Wind Speed",
11188 Sensors::EnvironmentalAirQuality => "Environmental: Air Quality",
11189 Sensors::EnvironmentalHeatIndex => "Environmental: Heat Index",
11190 Sensors::EnvironmentalSurfaceTemperature => "Environmental: Surface Temperature",
11191 Sensors::EnvironmentalVolatileOrganicCompounds => {
11192 "Environmental: Volatile Organic Compounds"
11193 }
11194 Sensors::EnvironmentalObjectPresence => "Environmental: Object Presence",
11195 Sensors::EnvironmentalObjectProximity => "Environmental: Object Proximity",
11196 Sensors::Light => "Light",
11197 Sensors::LightAmbientLight => "Light: Ambient Light",
11198 Sensors::LightConsumerInfrared => "Light: Consumer Infrared",
11199 Sensors::LightInfraredLight => "Light: Infrared Light",
11200 Sensors::LightVisibleLight => "Light: Visible Light",
11201 Sensors::LightUltravioletLight => "Light: Ultraviolet Light",
11202 Sensors::Location => "Location",
11203 Sensors::LocationBroadcast => "Location: Broadcast",
11204 Sensors::LocationDeadReckoning => "Location: Dead Reckoning",
11205 Sensors::LocationGPSGlobalPositioningSystem => {
11206 "Location: GPS (Global Positioning System)"
11207 }
11208 Sensors::LocationLookup => "Location: Lookup",
11209 Sensors::LocationOther => "Location: Other",
11210 Sensors::LocationStatic => "Location: Static",
11211 Sensors::LocationTriangulation => "Location: Triangulation",
11212 Sensors::Mechanical => "Mechanical",
11213 Sensors::MechanicalBooleanSwitch => "Mechanical: Boolean Switch",
11214 Sensors::MechanicalBooleanSwitchArray => "Mechanical: Boolean Switch Array",
11215 Sensors::MechanicalMultivalueSwitch => "Mechanical: Multivalue Switch",
11216 Sensors::MechanicalForce => "Mechanical: Force",
11217 Sensors::MechanicalPressure => "Mechanical: Pressure",
11218 Sensors::MechanicalStrain => "Mechanical: Strain",
11219 Sensors::MechanicalWeight => "Mechanical: Weight",
11220 Sensors::MechanicalHapticVibrator => "Mechanical: Haptic Vibrator",
11221 Sensors::MechanicalHallEffectSwitch => "Mechanical: Hall Effect Switch",
11222 Sensors::Motion => "Motion",
11223 Sensors::MotionAccelerometer1D => "Motion: Accelerometer 1D",
11224 Sensors::MotionAccelerometer2D => "Motion: Accelerometer 2D",
11225 Sensors::MotionAccelerometer3D => "Motion: Accelerometer 3D",
11226 Sensors::MotionGyrometer1D => "Motion: Gyrometer 1D",
11227 Sensors::MotionGyrometer2D => "Motion: Gyrometer 2D",
11228 Sensors::MotionGyrometer3D => "Motion: Gyrometer 3D",
11229 Sensors::MotionMotionDetector => "Motion: Motion Detector",
11230 Sensors::MotionSpeedometer => "Motion: Speedometer",
11231 Sensors::MotionAccelerometer => "Motion: Accelerometer",
11232 Sensors::MotionGyrometer => "Motion: Gyrometer",
11233 Sensors::MotionGravityVector => "Motion: Gravity Vector",
11234 Sensors::MotionLinearAccelerometer => "Motion: Linear Accelerometer",
11235 Sensors::Orientation => "Orientation",
11236 Sensors::OrientationCompass1D => "Orientation: Compass 1D",
11237 Sensors::OrientationCompass2D => "Orientation: Compass 2D",
11238 Sensors::OrientationCompass3D => "Orientation: Compass 3D",
11239 Sensors::OrientationInclinometer1D => "Orientation: Inclinometer 1D",
11240 Sensors::OrientationInclinometer2D => "Orientation: Inclinometer 2D",
11241 Sensors::OrientationInclinometer3D => "Orientation: Inclinometer 3D",
11242 Sensors::OrientationDistance1D => "Orientation: Distance 1D",
11243 Sensors::OrientationDistance2D => "Orientation: Distance 2D",
11244 Sensors::OrientationDistance3D => "Orientation: Distance 3D",
11245 Sensors::OrientationDeviceOrientation => "Orientation: Device Orientation",
11246 Sensors::OrientationCompass => "Orientation: Compass",
11247 Sensors::OrientationInclinometer => "Orientation: Inclinometer",
11248 Sensors::OrientationDistance => "Orientation: Distance",
11249 Sensors::OrientationRelativeOrientation => "Orientation: Relative Orientation",
11250 Sensors::OrientationSimpleOrientation => "Orientation: Simple Orientation",
11251 Sensors::Scanner => "Scanner",
11252 Sensors::ScannerBarcode => "Scanner: Barcode",
11253 Sensors::ScannerRFID => "Scanner: RFID",
11254 Sensors::ScannerNFC => "Scanner: NFC",
11255 Sensors::Time => "Time",
11256 Sensors::TimeAlarmTimer => "Time: Alarm Timer",
11257 Sensors::TimeRealTimeClock => "Time: Real Time Clock",
11258 Sensors::PersonalActivity => "Personal Activity",
11259 Sensors::PersonalActivityActivityDetection => "Personal Activity: Activity Detection",
11260 Sensors::PersonalActivityDevicePosition => "Personal Activity: Device Position",
11261 Sensors::PersonalActivityFloorTracker => "Personal Activity: Floor Tracker",
11262 Sensors::PersonalActivityPedometer => "Personal Activity: Pedometer",
11263 Sensors::PersonalActivityStepDetection => "Personal Activity: Step Detection",
11264 Sensors::OrientationExtended => "Orientation Extended",
11265 Sensors::OrientationExtendedGeomagneticOrientation => {
11266 "Orientation Extended: Geomagnetic Orientation"
11267 }
11268 Sensors::OrientationExtendedMagnetometer => "Orientation Extended: Magnetometer",
11269 Sensors::Gesture => "Gesture",
11270 Sensors::GestureChassisFlipGesture => "Gesture: Chassis Flip Gesture",
11271 Sensors::GestureHingeFoldGesture => "Gesture: Hinge Fold Gesture",
11272 Sensors::Other => "Other",
11273 Sensors::OtherCustom => "Other: Custom",
11274 Sensors::OtherGeneric => "Other: Generic",
11275 Sensors::OtherGenericEnumerator => "Other: Generic Enumerator",
11276 Sensors::OtherHingeAngle => "Other: Hinge Angle",
11277 Sensors::VendorReserved1 => "Vendor Reserved 1",
11278 Sensors::VendorReserved2 => "Vendor Reserved 2",
11279 Sensors::VendorReserved3 => "Vendor Reserved 3",
11280 Sensors::VendorReserved4 => "Vendor Reserved 4",
11281 Sensors::VendorReserved5 => "Vendor Reserved 5",
11282 Sensors::VendorReserved6 => "Vendor Reserved 6",
11283 Sensors::VendorReserved7 => "Vendor Reserved 7",
11284 Sensors::VendorReserved8 => "Vendor Reserved 8",
11285 Sensors::VendorReserved9 => "Vendor Reserved 9",
11286 Sensors::VendorReserved10 => "Vendor Reserved 10",
11287 Sensors::VendorReserved11 => "Vendor Reserved 11",
11288 Sensors::VendorReserved12 => "Vendor Reserved 12",
11289 Sensors::VendorReserved13 => "Vendor Reserved 13",
11290 Sensors::VendorReserved14 => "Vendor Reserved 14",
11291 Sensors::VendorReserved15 => "Vendor Reserved 15",
11292 Sensors::VendorReserved16 => "Vendor Reserved 16",
11293 Sensors::Event => "Event",
11294 Sensors::EventSensorState => "Event: Sensor State",
11295 Sensors::EventSensorEvent => "Event: Sensor Event",
11296 Sensors::Property => "Property",
11297 Sensors::PropertyFriendlyName => "Property: Friendly Name",
11298 Sensors::PropertyPersistentUniqueID => "Property: Persistent Unique ID",
11299 Sensors::PropertySensorStatus => "Property: Sensor Status",
11300 Sensors::PropertyMinimumReportInterval => "Property: Minimum Report Interval",
11301 Sensors::PropertySensorManufacturer => "Property: Sensor Manufacturer",
11302 Sensors::PropertySensorModel => "Property: Sensor Model",
11303 Sensors::PropertySensorSerialNumber => "Property: Sensor Serial Number",
11304 Sensors::PropertySensorDescription => "Property: Sensor Description",
11305 Sensors::PropertySensorConnectionType => "Property: Sensor Connection Type",
11306 Sensors::PropertySensorDevicePath => "Property: Sensor Device Path",
11307 Sensors::PropertyHardwareRevision => "Property: Hardware Revision",
11308 Sensors::PropertyFirmwareVersion => "Property: Firmware Version",
11309 Sensors::PropertyReleaseDate => "Property: Release Date",
11310 Sensors::PropertyReportInterval => "Property: Report Interval",
11311 Sensors::PropertyChangeSensitivityAbsolute => "Property: Change Sensitivity Absolute",
11312 Sensors::PropertyChangeSensitivityPercentofRange => {
11313 "Property: Change Sensitivity Percent of Range"
11314 }
11315 Sensors::PropertyChangeSensitivityPercentRelative => {
11316 "Property: Change Sensitivity Percent Relative"
11317 }
11318 Sensors::PropertyAccuracy => "Property: Accuracy",
11319 Sensors::PropertyResolution => "Property: Resolution",
11320 Sensors::PropertyMaximum => "Property: Maximum",
11321 Sensors::PropertyMinimum => "Property: Minimum",
11322 Sensors::PropertyReportingState => "Property: Reporting State",
11323 Sensors::PropertySamplingRate => "Property: Sampling Rate",
11324 Sensors::PropertyResponseCurve => "Property: Response Curve",
11325 Sensors::PropertyPowerState => "Property: Power State",
11326 Sensors::PropertyMaximumFIFOEvents => "Property: Maximum FIFO Events",
11327 Sensors::PropertyReportLatency => "Property: Report Latency",
11328 Sensors::PropertyFlushFIFOEvents => "Property: Flush FIFO Events",
11329 Sensors::PropertyMaximumPowerConsumption => "Property: Maximum Power Consumption",
11330 Sensors::PropertyIsPrimary => "Property: Is Primary",
11331 Sensors::PropertyHumanPresenceDetectionType => {
11332 "Property: Human Presence Detection Type"
11333 }
11334 Sensors::DataFieldLocation => "Data Field: Location",
11335 Sensors::DataFieldAltitudeAntennaSeaLevel => "Data Field: Altitude Antenna Sea Level",
11336 Sensors::DataFieldDifferentialReferenceStationID => {
11337 "Data Field: Differential Reference Station ID"
11338 }
11339 Sensors::DataFieldAltitudeEllipsoidError => "Data Field: Altitude Ellipsoid Error",
11340 Sensors::DataFieldAltitudeEllipsoid => "Data Field: Altitude Ellipsoid",
11341 Sensors::DataFieldAltitudeSeaLevelError => "Data Field: Altitude Sea Level Error",
11342 Sensors::DataFieldAltitudeSeaLevel => "Data Field: Altitude Sea Level",
11343 Sensors::DataFieldDifferentialGPSDataAge => "Data Field: Differential GPS Data Age",
11344 Sensors::DataFieldErrorRadius => "Data Field: Error Radius",
11345 Sensors::DataFieldFixQuality => "Data Field: Fix Quality",
11346 Sensors::DataFieldFixType => "Data Field: Fix Type",
11347 Sensors::DataFieldGeoidalSeparation => "Data Field: Geoidal Separation",
11348 Sensors::DataFieldGPSOperationMode => "Data Field: GPS Operation Mode",
11349 Sensors::DataFieldGPSSelectionMode => "Data Field: GPS Selection Mode",
11350 Sensors::DataFieldGPSStatus => "Data Field: GPS Status",
11351 Sensors::DataFieldPositionDilutionofPrecision => {
11352 "Data Field: Position Dilution of Precision"
11353 }
11354 Sensors::DataFieldHorizontalDilutionofPrecision => {
11355 "Data Field: Horizontal Dilution of Precision"
11356 }
11357 Sensors::DataFieldVerticalDilutionofPrecision => {
11358 "Data Field: Vertical Dilution of Precision"
11359 }
11360 Sensors::DataFieldLatitude => "Data Field: Latitude",
11361 Sensors::DataFieldLongitude => "Data Field: Longitude",
11362 Sensors::DataFieldTrueHeading => "Data Field: True Heading",
11363 Sensors::DataFieldMagneticHeading => "Data Field: Magnetic Heading",
11364 Sensors::DataFieldMagneticVariation => "Data Field: Magnetic Variation",
11365 Sensors::DataFieldSpeed => "Data Field: Speed",
11366 Sensors::DataFieldSatellitesinView => "Data Field: Satellites in View",
11367 Sensors::DataFieldSatellitesinViewAzimuth => "Data Field: Satellites in View Azimuth",
11368 Sensors::DataFieldSatellitesinViewElevation => {
11369 "Data Field: Satellites in View Elevation"
11370 }
11371 Sensors::DataFieldSatellitesinViewIDs => "Data Field: Satellites in View IDs",
11372 Sensors::DataFieldSatellitesinViewPRNs => "Data Field: Satellites in View PRNs",
11373 Sensors::DataFieldSatellitesinViewSNRatios => {
11374 "Data Field: Satellites in View S/N Ratios"
11375 }
11376 Sensors::DataFieldSatellitesUsedCount => "Data Field: Satellites Used Count",
11377 Sensors::DataFieldSatellitesUsedPRNs => "Data Field: Satellites Used PRNs",
11378 Sensors::DataFieldNMEASentence => "Data Field: NMEA Sentence",
11379 Sensors::DataFieldAddressLine1 => "Data Field: Address Line 1",
11380 Sensors::DataFieldAddressLine2 => "Data Field: Address Line 2",
11381 Sensors::DataFieldCity => "Data Field: City",
11382 Sensors::DataFieldStateorProvince => "Data Field: State or Province",
11383 Sensors::DataFieldCountryorRegion => "Data Field: Country or Region",
11384 Sensors::DataFieldPostalCode => "Data Field: Postal Code",
11385 Sensors::PropertyLocation => "Property: Location",
11386 Sensors::PropertyLocationDesiredAccuracy => "Property: Location Desired Accuracy",
11387 Sensors::DataFieldEnvironmental => "Data Field: Environmental",
11388 Sensors::DataFieldAtmosphericPressure => "Data Field: Atmospheric Pressure",
11389 Sensors::DataFieldRelativeHumidity => "Data Field: Relative Humidity",
11390 Sensors::DataFieldTemperature => "Data Field: Temperature",
11391 Sensors::DataFieldWindDirection => "Data Field: Wind Direction",
11392 Sensors::DataFieldWindSpeed => "Data Field: Wind Speed",
11393 Sensors::DataFieldAirQualityIndex => "Data Field: Air Quality Index",
11394 Sensors::DataFieldEquivalentCO2 => "Data Field: Equivalent CO2",
11395 Sensors::DataFieldVolatileOrganicCompoundConcentration => {
11396 "Data Field: Volatile Organic Compound Concentration"
11397 }
11398 Sensors::DataFieldObjectPresence => "Data Field: Object Presence",
11399 Sensors::DataFieldObjectProximityRange => "Data Field: Object Proximity Range",
11400 Sensors::DataFieldObjectProximityOutofRange => {
11401 "Data Field: Object Proximity Out of Range"
11402 }
11403 Sensors::PropertyEnvironmental => "Property: Environmental",
11404 Sensors::PropertyReferencePressure => "Property: Reference Pressure",
11405 Sensors::DataFieldMotion => "Data Field: Motion",
11406 Sensors::DataFieldMotionState => "Data Field: Motion State",
11407 Sensors::DataFieldAcceleration => "Data Field: Acceleration",
11408 Sensors::DataFieldAccelerationAxisX => "Data Field: Acceleration Axis X",
11409 Sensors::DataFieldAccelerationAxisY => "Data Field: Acceleration Axis Y",
11410 Sensors::DataFieldAccelerationAxisZ => "Data Field: Acceleration Axis Z",
11411 Sensors::DataFieldAngularVelocity => "Data Field: Angular Velocity",
11412 Sensors::DataFieldAngularVelocityaboutXAxis => {
11413 "Data Field: Angular Velocity about X Axis"
11414 }
11415 Sensors::DataFieldAngularVelocityaboutYAxis => {
11416 "Data Field: Angular Velocity about Y Axis"
11417 }
11418 Sensors::DataFieldAngularVelocityaboutZAxis => {
11419 "Data Field: Angular Velocity about Z Axis"
11420 }
11421 Sensors::DataFieldAngularPosition => "Data Field: Angular Position",
11422 Sensors::DataFieldAngularPositionaboutXAxis => {
11423 "Data Field: Angular Position about X Axis"
11424 }
11425 Sensors::DataFieldAngularPositionaboutYAxis => {
11426 "Data Field: Angular Position about Y Axis"
11427 }
11428 Sensors::DataFieldAngularPositionaboutZAxis => {
11429 "Data Field: Angular Position about Z Axis"
11430 }
11431 Sensors::DataFieldMotionSpeed => "Data Field: Motion Speed",
11432 Sensors::DataFieldMotionIntensity => "Data Field: Motion Intensity",
11433 Sensors::DataFieldOrientation => "Data Field: Orientation",
11434 Sensors::DataFieldHeading => "Data Field: Heading",
11435 Sensors::DataFieldHeadingXAxis => "Data Field: Heading X Axis",
11436 Sensors::DataFieldHeadingYAxis => "Data Field: Heading Y Axis",
11437 Sensors::DataFieldHeadingZAxis => "Data Field: Heading Z Axis",
11438 Sensors::DataFieldHeadingCompensatedMagneticNorth => {
11439 "Data Field: Heading Compensated Magnetic North"
11440 }
11441 Sensors::DataFieldHeadingCompensatedTrueNorth => {
11442 "Data Field: Heading Compensated True North"
11443 }
11444 Sensors::DataFieldHeadingMagneticNorth => "Data Field: Heading Magnetic North",
11445 Sensors::DataFieldHeadingTrueNorth => "Data Field: Heading True North",
11446 Sensors::DataFieldDistance => "Data Field: Distance",
11447 Sensors::DataFieldDistanceXAxis => "Data Field: Distance X Axis",
11448 Sensors::DataFieldDistanceYAxis => "Data Field: Distance Y Axis",
11449 Sensors::DataFieldDistanceZAxis => "Data Field: Distance Z Axis",
11450 Sensors::DataFieldDistanceOutofRange => "Data Field: Distance Out-of-Range",
11451 Sensors::DataFieldTilt => "Data Field: Tilt",
11452 Sensors::DataFieldTiltXAxis => "Data Field: Tilt X Axis",
11453 Sensors::DataFieldTiltYAxis => "Data Field: Tilt Y Axis",
11454 Sensors::DataFieldTiltZAxis => "Data Field: Tilt Z Axis",
11455 Sensors::DataFieldRotationMatrix => "Data Field: Rotation Matrix",
11456 Sensors::DataFieldQuaternion => "Data Field: Quaternion",
11457 Sensors::DataFieldMagneticFlux => "Data Field: Magnetic Flux",
11458 Sensors::DataFieldMagneticFluxXAxis => "Data Field: Magnetic Flux X Axis",
11459 Sensors::DataFieldMagneticFluxYAxis => "Data Field: Magnetic Flux Y Axis",
11460 Sensors::DataFieldMagneticFluxZAxis => "Data Field: Magnetic Flux Z Axis",
11461 Sensors::DataFieldMagnetometerAccuracy => "Data Field: Magnetometer Accuracy",
11462 Sensors::DataFieldSimpleOrientationDirection => {
11463 "Data Field: Simple Orientation Direction"
11464 }
11465 Sensors::DataFieldMechanical => "Data Field: Mechanical",
11466 Sensors::DataFieldBooleanSwitchState => "Data Field: Boolean Switch State",
11467 Sensors::DataFieldBooleanSwitchArrayStates => "Data Field: Boolean Switch Array States",
11468 Sensors::DataFieldMultivalueSwitchValue => "Data Field: Multivalue Switch Value",
11469 Sensors::DataFieldForce => "Data Field: Force",
11470 Sensors::DataFieldAbsolutePressure => "Data Field: Absolute Pressure",
11471 Sensors::DataFieldGaugePressure => "Data Field: Gauge Pressure",
11472 Sensors::DataFieldStrain => "Data Field: Strain",
11473 Sensors::DataFieldWeight => "Data Field: Weight",
11474 Sensors::PropertyMechanical => "Property: Mechanical",
11475 Sensors::PropertyVibrationState => "Property: Vibration State",
11476 Sensors::PropertyForwardVibrationSpeed => "Property: Forward Vibration Speed",
11477 Sensors::PropertyBackwardVibrationSpeed => "Property: Backward Vibration Speed",
11478 Sensors::DataFieldBiometric => "Data Field: Biometric",
11479 Sensors::DataFieldHumanPresence => "Data Field: Human Presence",
11480 Sensors::DataFieldHumanProximityRange => "Data Field: Human Proximity Range",
11481 Sensors::DataFieldHumanProximityOutofRange => {
11482 "Data Field: Human Proximity Out of Range"
11483 }
11484 Sensors::DataFieldHumanTouchState => "Data Field: Human Touch State",
11485 Sensors::DataFieldBloodPressure => "Data Field: Blood Pressure",
11486 Sensors::DataFieldBloodPressureDiastolic => "Data Field: Blood Pressure Diastolic",
11487 Sensors::DataFieldBloodPressureSystolic => "Data Field: Blood Pressure Systolic",
11488 Sensors::DataFieldHeartRate => "Data Field: Heart Rate",
11489 Sensors::DataFieldRestingHeartRate => "Data Field: Resting Heart Rate",
11490 Sensors::DataFieldHeartbeatInterval => "Data Field: Heartbeat Interval",
11491 Sensors::DataFieldRespiratoryRate => "Data Field: Respiratory Rate",
11492 Sensors::DataFieldSpO2 => "Data Field: SpO2",
11493 Sensors::DataFieldHumanAttentionDetected => "Data Field: Human Attention Detected",
11494 Sensors::DataFieldHumanHeadAzimuth => "Data Field: Human Head Azimuth",
11495 Sensors::DataFieldHumanHeadAltitude => "Data Field: Human Head Altitude",
11496 Sensors::DataFieldHumanHeadRoll => "Data Field: Human Head Roll",
11497 Sensors::DataFieldHumanHeadPitch => "Data Field: Human Head Pitch",
11498 Sensors::DataFieldHumanHeadYaw => "Data Field: Human Head Yaw",
11499 Sensors::DataFieldHumanCorrelationId => "Data Field: Human Correlation Id",
11500 Sensors::DataFieldLight => "Data Field: Light",
11501 Sensors::DataFieldIlluminance => "Data Field: Illuminance",
11502 Sensors::DataFieldColorTemperature => "Data Field: Color Temperature",
11503 Sensors::DataFieldChromaticity => "Data Field: Chromaticity",
11504 Sensors::DataFieldChromaticityX => "Data Field: Chromaticity X",
11505 Sensors::DataFieldChromaticityY => "Data Field: Chromaticity Y",
11506 Sensors::DataFieldConsumerIRSentenceReceive => {
11507 "Data Field: Consumer IR Sentence Receive"
11508 }
11509 Sensors::DataFieldInfraredLight => "Data Field: Infrared Light",
11510 Sensors::DataFieldRedLight => "Data Field: Red Light",
11511 Sensors::DataFieldGreenLight => "Data Field: Green Light",
11512 Sensors::DataFieldBlueLight => "Data Field: Blue Light",
11513 Sensors::DataFieldUltravioletALight => "Data Field: Ultraviolet A Light",
11514 Sensors::DataFieldUltravioletBLight => "Data Field: Ultraviolet B Light",
11515 Sensors::DataFieldUltravioletIndex => "Data Field: Ultraviolet Index",
11516 Sensors::DataFieldNearInfraredLight => "Data Field: Near Infrared Light",
11517 Sensors::PropertyLight => "Property: Light",
11518 Sensors::PropertyConsumerIRSentenceSend => "Property: Consumer IR Sentence Send",
11519 Sensors::PropertyAutoBrightnessPreferred => "Property: Auto Brightness Preferred",
11520 Sensors::PropertyAutoColorPreferred => "Property: Auto Color Preferred",
11521 Sensors::DataFieldScanner => "Data Field: Scanner",
11522 Sensors::DataFieldRFIDTag40Bit => "Data Field: RFID Tag 40 Bit",
11523 Sensors::DataFieldNFCSentenceReceive => "Data Field: NFC Sentence Receive",
11524 Sensors::PropertyScanner => "Property: Scanner",
11525 Sensors::PropertyNFCSentenceSend => "Property: NFC Sentence Send",
11526 Sensors::DataFieldElectrical => "Data Field: Electrical",
11527 Sensors::DataFieldCapacitance => "Data Field: Capacitance",
11528 Sensors::DataFieldCurrent => "Data Field: Current",
11529 Sensors::DataFieldElectricalPower => "Data Field: Electrical Power",
11530 Sensors::DataFieldInductance => "Data Field: Inductance",
11531 Sensors::DataFieldResistance => "Data Field: Resistance",
11532 Sensors::DataFieldVoltage => "Data Field: Voltage",
11533 Sensors::DataFieldFrequency => "Data Field: Frequency",
11534 Sensors::DataFieldPeriod => "Data Field: Period",
11535 Sensors::DataFieldPercentofRange => "Data Field: Percent of Range",
11536 Sensors::DataFieldTime => "Data Field: Time",
11537 Sensors::DataFieldYear => "Data Field: Year",
11538 Sensors::DataFieldMonth => "Data Field: Month",
11539 Sensors::DataFieldDay => "Data Field: Day",
11540 Sensors::DataFieldDayofWeek => "Data Field: Day of Week",
11541 Sensors::DataFieldHour => "Data Field: Hour",
11542 Sensors::DataFieldMinute => "Data Field: Minute",
11543 Sensors::DataFieldSecond => "Data Field: Second",
11544 Sensors::DataFieldMillisecond => "Data Field: Millisecond",
11545 Sensors::DataFieldTimestamp => "Data Field: Timestamp",
11546 Sensors::DataFieldJulianDayofYear => "Data Field: Julian Day of Year",
11547 Sensors::DataFieldTimeSinceSystemBoot => "Data Field: Time Since System Boot",
11548 Sensors::PropertyTime => "Property: Time",
11549 Sensors::PropertyTimeZoneOffsetfromUTC => "Property: Time Zone Offset from UTC",
11550 Sensors::PropertyTimeZoneName => "Property: Time Zone Name",
11551 Sensors::PropertyDaylightSavingsTimeObserved => {
11552 "Property: Daylight Savings Time Observed"
11553 }
11554 Sensors::PropertyTimeTrimAdjustment => "Property: Time Trim Adjustment",
11555 Sensors::PropertyArmAlarm => "Property: Arm Alarm",
11556 Sensors::DataFieldCustom => "Data Field: Custom",
11557 Sensors::DataFieldCustomUsage => "Data Field: Custom Usage",
11558 Sensors::DataFieldCustomBooleanArray => "Data Field: Custom Boolean Array",
11559 Sensors::DataFieldCustomValue => "Data Field: Custom Value",
11560 Sensors::DataFieldCustomValue1 => "Data Field: Custom Value 1",
11561 Sensors::DataFieldCustomValue2 => "Data Field: Custom Value 2",
11562 Sensors::DataFieldCustomValue3 => "Data Field: Custom Value 3",
11563 Sensors::DataFieldCustomValue4 => "Data Field: Custom Value 4",
11564 Sensors::DataFieldCustomValue5 => "Data Field: Custom Value 5",
11565 Sensors::DataFieldCustomValue6 => "Data Field: Custom Value 6",
11566 Sensors::DataFieldCustomValue7 => "Data Field: Custom Value 7",
11567 Sensors::DataFieldCustomValue8 => "Data Field: Custom Value 8",
11568 Sensors::DataFieldCustomValue9 => "Data Field: Custom Value 9",
11569 Sensors::DataFieldCustomValue10 => "Data Field: Custom Value 10",
11570 Sensors::DataFieldCustomValue11 => "Data Field: Custom Value 11",
11571 Sensors::DataFieldCustomValue12 => "Data Field: Custom Value 12",
11572 Sensors::DataFieldCustomValue13 => "Data Field: Custom Value 13",
11573 Sensors::DataFieldCustomValue14 => "Data Field: Custom Value 14",
11574 Sensors::DataFieldCustomValue15 => "Data Field: Custom Value 15",
11575 Sensors::DataFieldCustomValue16 => "Data Field: Custom Value 16",
11576 Sensors::DataFieldCustomValue17 => "Data Field: Custom Value 17",
11577 Sensors::DataFieldCustomValue18 => "Data Field: Custom Value 18",
11578 Sensors::DataFieldCustomValue19 => "Data Field: Custom Value 19",
11579 Sensors::DataFieldCustomValue20 => "Data Field: Custom Value 20",
11580 Sensors::DataFieldCustomValue21 => "Data Field: Custom Value 21",
11581 Sensors::DataFieldCustomValue22 => "Data Field: Custom Value 22",
11582 Sensors::DataFieldCustomValue23 => "Data Field: Custom Value 23",
11583 Sensors::DataFieldCustomValue24 => "Data Field: Custom Value 24",
11584 Sensors::DataFieldCustomValue25 => "Data Field: Custom Value 25",
11585 Sensors::DataFieldCustomValue26 => "Data Field: Custom Value 26",
11586 Sensors::DataFieldCustomValue27 => "Data Field: Custom Value 27",
11587 Sensors::DataFieldCustomValue28 => "Data Field: Custom Value 28",
11588 Sensors::DataFieldGeneric => "Data Field: Generic",
11589 Sensors::DataFieldGenericGUIDorPROPERTYKEY => "Data Field: Generic GUID or PROPERTYKEY",
11590 Sensors::DataFieldGenericCategoryGUID => "Data Field: Generic Category GUID",
11591 Sensors::DataFieldGenericTypeGUID => "Data Field: Generic Type GUID",
11592 Sensors::DataFieldGenericEventPROPERTYKEY => "Data Field: Generic Event PROPERTYKEY",
11593 Sensors::DataFieldGenericPropertyPROPERTYKEY => {
11594 "Data Field: Generic Property PROPERTYKEY"
11595 }
11596 Sensors::DataFieldGenericDataFieldPROPERTYKEY => {
11597 "Data Field: Generic Data Field PROPERTYKEY"
11598 }
11599 Sensors::DataFieldGenericEvent => "Data Field: Generic Event",
11600 Sensors::DataFieldGenericProperty => "Data Field: Generic Property",
11601 Sensors::DataFieldGenericDataField => "Data Field: Generic Data Field",
11602 Sensors::DataFieldEnumeratorTableRowIndex => "Data Field: Enumerator Table Row Index",
11603 Sensors::DataFieldEnumeratorTableRowCount => "Data Field: Enumerator Table Row Count",
11604 Sensors::DataFieldGenericGUIDorPROPERTYKEYkind => {
11605 "Data Field: Generic GUID or PROPERTYKEY kind"
11606 }
11607 Sensors::DataFieldGenericGUID => "Data Field: Generic GUID",
11608 Sensors::DataFieldGenericPROPERTYKEY => "Data Field: Generic PROPERTYKEY",
11609 Sensors::DataFieldGenericTopLevelCollectionID => {
11610 "Data Field: Generic Top Level Collection ID"
11611 }
11612 Sensors::DataFieldGenericReportID => "Data Field: Generic Report ID",
11613 Sensors::DataFieldGenericReportItemPositionIndex => {
11614 "Data Field: Generic Report Item Position Index"
11615 }
11616 Sensors::DataFieldGenericFirmwareVARTYPE => "Data Field: Generic Firmware VARTYPE",
11617 Sensors::DataFieldGenericUnitofMeasure => "Data Field: Generic Unit of Measure",
11618 Sensors::DataFieldGenericUnitExponent => "Data Field: Generic Unit Exponent",
11619 Sensors::DataFieldGenericReportSize => "Data Field: Generic Report Size",
11620 Sensors::DataFieldGenericReportCount => "Data Field: Generic Report Count",
11621 Sensors::PropertyGeneric => "Property: Generic",
11622 Sensors::PropertyEnumeratorTableRowIndex => "Property: Enumerator Table Row Index",
11623 Sensors::PropertyEnumeratorTableRowCount => "Property: Enumerator Table Row Count",
11624 Sensors::DataFieldPersonalActivity => "Data Field: Personal Activity",
11625 Sensors::DataFieldActivityType => "Data Field: Activity Type",
11626 Sensors::DataFieldActivityState => "Data Field: Activity State",
11627 Sensors::DataFieldDevicePosition => "Data Field: Device Position",
11628 Sensors::DataFieldStepCount => "Data Field: Step Count",
11629 Sensors::DataFieldStepCountReset => "Data Field: Step Count Reset",
11630 Sensors::DataFieldStepDuration => "Data Field: Step Duration",
11631 Sensors::DataFieldStepType => "Data Field: Step Type",
11632 Sensors::PropertyMinimumActivityDetectionInterval => {
11633 "Property: Minimum Activity Detection Interval"
11634 }
11635 Sensors::PropertySupportedActivityTypes => "Property: Supported Activity Types",
11636 Sensors::PropertySubscribedActivityTypes => "Property: Subscribed Activity Types",
11637 Sensors::PropertySupportedStepTypes => "Property: Supported Step Types",
11638 Sensors::PropertySubscribedStepTypes => "Property: Subscribed Step Types",
11639 Sensors::PropertyFloorHeight => "Property: Floor Height",
11640 Sensors::DataFieldCustomTypeID => "Data Field: Custom Type ID",
11641 Sensors::PropertyCustom => "Property: Custom",
11642 Sensors::PropertyCustomValue1 => "Property: Custom Value 1",
11643 Sensors::PropertyCustomValue2 => "Property: Custom Value 2",
11644 Sensors::PropertyCustomValue3 => "Property: Custom Value 3",
11645 Sensors::PropertyCustomValue4 => "Property: Custom Value 4",
11646 Sensors::PropertyCustomValue5 => "Property: Custom Value 5",
11647 Sensors::PropertyCustomValue6 => "Property: Custom Value 6",
11648 Sensors::PropertyCustomValue7 => "Property: Custom Value 7",
11649 Sensors::PropertyCustomValue8 => "Property: Custom Value 8",
11650 Sensors::PropertyCustomValue9 => "Property: Custom Value 9",
11651 Sensors::PropertyCustomValue10 => "Property: Custom Value 10",
11652 Sensors::PropertyCustomValue11 => "Property: Custom Value 11",
11653 Sensors::PropertyCustomValue12 => "Property: Custom Value 12",
11654 Sensors::PropertyCustomValue13 => "Property: Custom Value 13",
11655 Sensors::PropertyCustomValue14 => "Property: Custom Value 14",
11656 Sensors::PropertyCustomValue15 => "Property: Custom Value 15",
11657 Sensors::PropertyCustomValue16 => "Property: Custom Value 16",
11658 Sensors::DataFieldHinge => "Data Field: Hinge",
11659 Sensors::DataFieldHingeAngle => "Data Field: Hinge Angle",
11660 Sensors::DataFieldGestureSensor => "Data Field: Gesture Sensor",
11661 Sensors::DataFieldGestureState => "Data Field: Gesture State",
11662 Sensors::DataFieldHingeFoldInitialAngle => "Data Field: Hinge Fold Initial Angle",
11663 Sensors::DataFieldHingeFoldFinalAngle => "Data Field: Hinge Fold Final Angle",
11664 Sensors::DataFieldHingeFoldContributingPanel => {
11665 "Data Field: Hinge Fold Contributing Panel"
11666 }
11667 Sensors::DataFieldHingeFoldType => "Data Field: Hinge Fold Type",
11668 Sensors::SensorStateUndefined => "Sensor State: Undefined",
11669 Sensors::SensorStateReady => "Sensor State: Ready",
11670 Sensors::SensorStateNotAvailable => "Sensor State: Not Available",
11671 Sensors::SensorStateNoData => "Sensor State: No Data",
11672 Sensors::SensorStateInitializing => "Sensor State: Initializing",
11673 Sensors::SensorStateAccessDenied => "Sensor State: Access Denied",
11674 Sensors::SensorStateError => "Sensor State: Error",
11675 Sensors::SensorEventUnknown => "Sensor Event: Unknown",
11676 Sensors::SensorEventStateChanged => "Sensor Event: State Changed",
11677 Sensors::SensorEventPropertyChanged => "Sensor Event: Property Changed",
11678 Sensors::SensorEventDataUpdated => "Sensor Event: Data Updated",
11679 Sensors::SensorEventPollResponse => "Sensor Event: Poll Response",
11680 Sensors::SensorEventChangeSensitivity => "Sensor Event: Change Sensitivity",
11681 Sensors::SensorEventRangeMaximumReached => "Sensor Event: Range Maximum Reached",
11682 Sensors::SensorEventRangeMinimumReached => "Sensor Event: Range Minimum Reached",
11683 Sensors::SensorEventHighThresholdCrossUpward => {
11684 "Sensor Event: High Threshold Cross Upward"
11685 }
11686 Sensors::SensorEventHighThresholdCrossDownward => {
11687 "Sensor Event: High Threshold Cross Downward"
11688 }
11689 Sensors::SensorEventLowThresholdCrossUpward => {
11690 "Sensor Event: Low Threshold Cross Upward"
11691 }
11692 Sensors::SensorEventLowThresholdCrossDownward => {
11693 "Sensor Event: Low Threshold Cross Downward"
11694 }
11695 Sensors::SensorEventZeroThresholdCrossUpward => {
11696 "Sensor Event: Zero Threshold Cross Upward"
11697 }
11698 Sensors::SensorEventZeroThresholdCrossDownward => {
11699 "Sensor Event: Zero Threshold Cross Downward"
11700 }
11701 Sensors::SensorEventPeriodExceeded => "Sensor Event: Period Exceeded",
11702 Sensors::SensorEventFrequencyExceeded => "Sensor Event: Frequency Exceeded",
11703 Sensors::SensorEventComplexTrigger => "Sensor Event: Complex Trigger",
11704 Sensors::ConnectionTypePCIntegrated => "Connection Type: PC Integrated",
11705 Sensors::ConnectionTypePCAttached => "Connection Type: PC Attached",
11706 Sensors::ConnectionTypePCExternal => "Connection Type: PC External",
11707 Sensors::ReportingStateReportNoEvents => "Reporting State: Report No Events",
11708 Sensors::ReportingStateReportAllEvents => "Reporting State: Report All Events",
11709 Sensors::ReportingStateReportThresholdEvents => {
11710 "Reporting State: Report Threshold Events"
11711 }
11712 Sensors::ReportingStateWakeOnNoEvents => "Reporting State: Wake On No Events",
11713 Sensors::ReportingStateWakeOnAllEvents => "Reporting State: Wake On All Events",
11714 Sensors::ReportingStateWakeOnThresholdEvents => {
11715 "Reporting State: Wake On Threshold Events"
11716 }
11717 Sensors::ReportingStateAnytime => "Reporting State: Anytime",
11718 Sensors::PowerStateUndefined => "Power State: Undefined",
11719 Sensors::PowerStateD0FullPower => "Power State: D0 Full Power",
11720 Sensors::PowerStateD1LowPower => "Power State: D1 Low Power",
11721 Sensors::PowerStateD2StandbyPowerwithWakeup => {
11722 "Power State: D2 Standby Power with Wakeup"
11723 }
11724 Sensors::PowerStateD3SleepwithWakeup => "Power State: D3 Sleep with Wakeup",
11725 Sensors::PowerStateD4PowerOff => "Power State: D4 Power Off",
11726 Sensors::AccuracyDefault => "Accuracy: Default",
11727 Sensors::AccuracyHigh => "Accuracy: High",
11728 Sensors::AccuracyMedium => "Accuracy: Medium",
11729 Sensors::AccuracyLow => "Accuracy: Low",
11730 Sensors::FixQualityNoFix => "Fix Quality: No Fix",
11731 Sensors::FixQualityGPS => "Fix Quality: GPS",
11732 Sensors::FixQualityDGPS => "Fix Quality: DGPS",
11733 Sensors::FixTypeNoFix => "Fix Type: No Fix",
11734 Sensors::FixTypeGPSSPSModeFixValid => "Fix Type: GPS SPS Mode, Fix Valid",
11735 Sensors::FixTypeDGPSSPSModeFixValid => "Fix Type: DGPS SPS Mode, Fix Valid",
11736 Sensors::FixTypeGPSPPSModeFixValid => "Fix Type: GPS PPS Mode, Fix Valid",
11737 Sensors::FixTypeRealTimeKinematic => "Fix Type: Real Time Kinematic",
11738 Sensors::FixTypeFloatRTK => "Fix Type: Float RTK",
11739 Sensors::FixTypeEstimateddeadreckoned => "Fix Type: Estimated (dead reckoned)",
11740 Sensors::FixTypeManualInputMode => "Fix Type: Manual Input Mode",
11741 Sensors::FixTypeSimulatorMode => "Fix Type: Simulator Mode",
11742 Sensors::GPSOperationModeManual => "GPS Operation Mode: Manual",
11743 Sensors::GPSOperationModeAutomatic => "GPS Operation Mode: Automatic",
11744 Sensors::GPSSelectionModeAutonomous => "GPS Selection Mode: Autonomous",
11745 Sensors::GPSSelectionModeDGPS => "GPS Selection Mode: DGPS",
11746 Sensors::GPSSelectionModeEstimateddeadreckoned => {
11747 "GPS Selection Mode: Estimated (dead reckoned)"
11748 }
11749 Sensors::GPSSelectionModeManualInput => "GPS Selection Mode: Manual Input",
11750 Sensors::GPSSelectionModeSimulator => "GPS Selection Mode: Simulator",
11751 Sensors::GPSSelectionModeDataNotValid => "GPS Selection Mode: Data Not Valid",
11752 Sensors::GPSStatusDataValid => "GPS Status Data: Valid",
11753 Sensors::GPSStatusDataNotValid => "GPS Status Data: Not Valid",
11754 Sensors::DayofWeekSunday => "Day of Week: Sunday",
11755 Sensors::DayofWeekMonday => "Day of Week: Monday",
11756 Sensors::DayofWeekTuesday => "Day of Week: Tuesday",
11757 Sensors::DayofWeekWednesday => "Day of Week: Wednesday",
11758 Sensors::DayofWeekThursday => "Day of Week: Thursday",
11759 Sensors::DayofWeekFriday => "Day of Week: Friday",
11760 Sensors::DayofWeekSaturday => "Day of Week: Saturday",
11761 Sensors::KindCategory => "Kind: Category",
11762 Sensors::KindType => "Kind: Type",
11763 Sensors::KindEvent => "Kind: Event",
11764 Sensors::KindProperty => "Kind: Property",
11765 Sensors::KindDataField => "Kind: Data Field",
11766 Sensors::MagnetometerAccuracyLow => "Magnetometer Accuracy: Low",
11767 Sensors::MagnetometerAccuracyMedium => "Magnetometer Accuracy: Medium",
11768 Sensors::MagnetometerAccuracyHigh => "Magnetometer Accuracy: High",
11769 Sensors::SimpleOrientationDirectionNotRotated => {
11770 "Simple Orientation Direction: Not Rotated"
11771 }
11772 Sensors::SimpleOrientationDirectionRotated90DegreesCCW => {
11773 "Simple Orientation Direction: Rotated 90 Degrees CCW"
11774 }
11775 Sensors::SimpleOrientationDirectionRotated180DegreesCCW => {
11776 "Simple Orientation Direction: Rotated 180 Degrees CCW"
11777 }
11778 Sensors::SimpleOrientationDirectionRotated270DegreesCCW => {
11779 "Simple Orientation Direction: Rotated 270 Degrees CCW"
11780 }
11781 Sensors::SimpleOrientationDirectionFaceUp => "Simple Orientation Direction: Face Up",
11782 Sensors::SimpleOrientationDirectionFaceDown => {
11783 "Simple Orientation Direction: Face Down"
11784 }
11785 Sensors::VT_NULL => "VT_NULL",
11786 Sensors::VT_BOOL => "VT_BOOL",
11787 Sensors::VT_UI1 => "VT_UI1",
11788 Sensors::VT_I1 => "VT_I1",
11789 Sensors::VT_UI2 => "VT_UI2",
11790 Sensors::VT_I2 => "VT_I2",
11791 Sensors::VT_UI4 => "VT_UI4",
11792 Sensors::VT_I4 => "VT_I4",
11793 Sensors::VT_UI8 => "VT_UI8",
11794 Sensors::VT_I8 => "VT_I8",
11795 Sensors::VT_R4 => "VT_R4",
11796 Sensors::VT_R8 => "VT_R8",
11797 Sensors::VT_WSTR => "VT_WSTR",
11798 Sensors::VT_STR => "VT_STR",
11799 Sensors::VT_CLSID => "VT_CLSID",
11800 Sensors::VT_VECTORVT_UI1 => "VT_VECTOR VT_UI1",
11801 Sensors::VT_F16E0 => "VT_F16E0",
11802 Sensors::VT_F16E1 => "VT_F16E1",
11803 Sensors::VT_F16E2 => "VT_F16E2",
11804 Sensors::VT_F16E3 => "VT_F16E3",
11805 Sensors::VT_F16E4 => "VT_F16E4",
11806 Sensors::VT_F16E5 => "VT_F16E5",
11807 Sensors::VT_F16E6 => "VT_F16E6",
11808 Sensors::VT_F16E7 => "VT_F16E7",
11809 Sensors::VT_F16E8 => "VT_F16E8",
11810 Sensors::VT_F16E9 => "VT_F16E9",
11811 Sensors::VT_F16EA => "VT_F16EA",
11812 Sensors::VT_F16EB => "VT_F16EB",
11813 Sensors::VT_F16EC => "VT_F16EC",
11814 Sensors::VT_F16ED => "VT_F16ED",
11815 Sensors::VT_F16EE => "VT_F16EE",
11816 Sensors::VT_F16EF => "VT_F16EF",
11817 Sensors::VT_F32E0 => "VT_F32E0",
11818 Sensors::VT_F32E1 => "VT_F32E1",
11819 Sensors::VT_F32E2 => "VT_F32E2",
11820 Sensors::VT_F32E3 => "VT_F32E3",
11821 Sensors::VT_F32E4 => "VT_F32E4",
11822 Sensors::VT_F32E5 => "VT_F32E5",
11823 Sensors::VT_F32E6 => "VT_F32E6",
11824 Sensors::VT_F32E7 => "VT_F32E7",
11825 Sensors::VT_F32E8 => "VT_F32E8",
11826 Sensors::VT_F32E9 => "VT_F32E9",
11827 Sensors::VT_F32EA => "VT_F32EA",
11828 Sensors::VT_F32EB => "VT_F32EB",
11829 Sensors::VT_F32EC => "VT_F32EC",
11830 Sensors::VT_F32ED => "VT_F32ED",
11831 Sensors::VT_F32EE => "VT_F32EE",
11832 Sensors::VT_F32EF => "VT_F32EF",
11833 Sensors::ActivityTypeUnknown => "Activity Type: Unknown",
11834 Sensors::ActivityTypeStationary => "Activity Type: Stationary",
11835 Sensors::ActivityTypeFidgeting => "Activity Type: Fidgeting",
11836 Sensors::ActivityTypeWalking => "Activity Type: Walking",
11837 Sensors::ActivityTypeRunning => "Activity Type: Running",
11838 Sensors::ActivityTypeInVehicle => "Activity Type: In Vehicle",
11839 Sensors::ActivityTypeBiking => "Activity Type: Biking",
11840 Sensors::ActivityTypeIdle => "Activity Type: Idle",
11841 Sensors::UnitNotSpecified => "Unit: Not Specified",
11842 Sensors::UnitLux => "Unit: Lux",
11843 Sensors::UnitDegreesKelvin => "Unit: Degrees Kelvin",
11844 Sensors::UnitDegreesCelsius => "Unit: Degrees Celsius",
11845 Sensors::UnitPascal => "Unit: Pascal",
11846 Sensors::UnitNewton => "Unit: Newton",
11847 Sensors::UnitMetersSecond => "Unit: Meters/Second",
11848 Sensors::UnitKilogram => "Unit: Kilogram",
11849 Sensors::UnitMeter => "Unit: Meter",
11850 Sensors::UnitMetersSecondSecond => "Unit: Meters/Second/Second",
11851 Sensors::UnitFarad => "Unit: Farad",
11852 Sensors::UnitAmpere => "Unit: Ampere",
11853 Sensors::UnitWatt => "Unit: Watt",
11854 Sensors::UnitHenry => "Unit: Henry",
11855 Sensors::UnitOhm => "Unit: Ohm",
11856 Sensors::UnitVolt => "Unit: Volt",
11857 Sensors::UnitHertz => "Unit: Hertz",
11858 Sensors::UnitBar => "Unit: Bar",
11859 Sensors::UnitDegreesAnticlockwise => "Unit: Degrees Anti-clockwise",
11860 Sensors::UnitDegreesClockwise => "Unit: Degrees Clockwise",
11861 Sensors::UnitDegrees => "Unit: Degrees",
11862 Sensors::UnitDegreesSecond => "Unit: Degrees/Second",
11863 Sensors::UnitDegreesSecondSecond => "Unit: Degrees/Second/Second",
11864 Sensors::UnitKnot => "Unit: Knot",
11865 Sensors::UnitPercent => "Unit: Percent",
11866 Sensors::UnitSecond => "Unit: Second",
11867 Sensors::UnitMillisecond => "Unit: Millisecond",
11868 Sensors::UnitG => "Unit: G",
11869 Sensors::UnitBytes => "Unit: Bytes",
11870 Sensors::UnitMilligauss => "Unit: Milligauss",
11871 Sensors::UnitBits => "Unit: Bits",
11872 Sensors::ActivityStateNoStateChange => "Activity State: No State Change",
11873 Sensors::ActivityStateStartActivity => "Activity State: Start Activity",
11874 Sensors::ActivityStateEndActivity => "Activity State: End Activity",
11875 Sensors::Exponent0 => "Exponent 0",
11876 Sensors::Exponent1 => "Exponent 1",
11877 Sensors::Exponent2 => "Exponent 2",
11878 Sensors::Exponent3 => "Exponent 3",
11879 Sensors::Exponent4 => "Exponent 4",
11880 Sensors::Exponent5 => "Exponent 5",
11881 Sensors::Exponent6 => "Exponent 6",
11882 Sensors::Exponent7 => "Exponent 7",
11883 Sensors::Exponent8 => "Exponent 8",
11884 Sensors::Exponent9 => "Exponent 9",
11885 Sensors::ExponentA => "Exponent A",
11886 Sensors::ExponentB => "Exponent B",
11887 Sensors::ExponentC => "Exponent C",
11888 Sensors::ExponentD => "Exponent D",
11889 Sensors::ExponentE => "Exponent E",
11890 Sensors::ExponentF => "Exponent F",
11891 Sensors::DevicePositionUnknown => "Device Position: Unknown",
11892 Sensors::DevicePositionUnchanged => "Device Position: Unchanged",
11893 Sensors::DevicePositionOnDesk => "Device Position: On Desk",
11894 Sensors::DevicePositionInHand => "Device Position: In Hand",
11895 Sensors::DevicePositionMovinginBag => "Device Position: Moving in Bag",
11896 Sensors::DevicePositionStationaryinBag => "Device Position: Stationary in Bag",
11897 Sensors::StepTypeUnknown => "Step Type: Unknown",
11898 Sensors::StepTypeWalking => "Step Type: Walking",
11899 Sensors::StepTypeRunning => "Step Type: Running",
11900 Sensors::GestureStateUnknown => "Gesture State: Unknown",
11901 Sensors::GestureStateStarted => "Gesture State: Started",
11902 Sensors::GestureStateCompleted => "Gesture State: Completed",
11903 Sensors::GestureStateCancelled => "Gesture State: Cancelled",
11904 Sensors::HingeFoldContributingPanelUnknown => "Hinge Fold Contributing Panel: Unknown",
11905 Sensors::HingeFoldContributingPanelPanel1 => "Hinge Fold Contributing Panel: Panel 1",
11906 Sensors::HingeFoldContributingPanelPanel2 => "Hinge Fold Contributing Panel: Panel 2",
11907 Sensors::HingeFoldContributingPanelBoth => "Hinge Fold Contributing Panel: Both",
11908 Sensors::HingeFoldTypeUnknown => "Hinge Fold Type: Unknown",
11909 Sensors::HingeFoldTypeIncreasing => "Hinge Fold Type: Increasing",
11910 Sensors::HingeFoldTypeDecreasing => "Hinge Fold Type: Decreasing",
11911 Sensors::HumanPresenceDetectionTypeVendorDefinedNonBiometric => {
11912 "Human Presence Detection Type: Vendor-Defined Non-Biometric"
11913 }
11914 Sensors::HumanPresenceDetectionTypeVendorDefinedBiometric => {
11915 "Human Presence Detection Type: Vendor-Defined Biometric"
11916 }
11917 Sensors::HumanPresenceDetectionTypeFacialBiometric => {
11918 "Human Presence Detection Type: Facial Biometric"
11919 }
11920 Sensors::HumanPresenceDetectionTypeAudioBiometric => {
11921 "Human Presence Detection Type: Audio Biometric"
11922 }
11923 Sensors::ModifierChangeSensitivityAbsolute => "Modifier: Change Sensitivity Absolute",
11924 Sensors::ModifierMaximum => "Modifier: Maximum",
11925 Sensors::ModifierMinimum => "Modifier: Minimum",
11926 Sensors::ModifierAccuracy => "Modifier: Accuracy",
11927 Sensors::ModifierResolution => "Modifier: Resolution",
11928 Sensors::ModifierThresholdHigh => "Modifier: Threshold High",
11929 Sensors::ModifierThresholdLow => "Modifier: Threshold Low",
11930 Sensors::ModifierCalibrationOffset => "Modifier: Calibration Offset",
11931 Sensors::ModifierCalibrationMultiplier => "Modifier: Calibration Multiplier",
11932 Sensors::ModifierReportInterval => "Modifier: Report Interval",
11933 Sensors::ModifierFrequencyMax => "Modifier: Frequency Max",
11934 Sensors::ModifierPeriodMax => "Modifier: Period Max",
11935 Sensors::ModifierChangeSensitivityPercentofRange => {
11936 "Modifier: Change Sensitivity Percent of Range"
11937 }
11938 Sensors::ModifierChangeSensitivityPercentRelative => {
11939 "Modifier: Change Sensitivity Percent Relative"
11940 }
11941 Sensors::ModifierVendorReserved => "Modifier: Vendor Reserved",
11942 }
11943 .into()
11944 }
11945 }
11946
11947 #[cfg(feature = "std")]
11948 impl fmt::Display for Sensors {
11949 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
11950 write!(f, "{}", self.name())
11951 }
11952 }
11953
11954 impl AsUsage for Sensors {
11955 /// Returns the 32 bit Usage value of this Usage
11956 fn usage_value(&self) -> u32 {
11957 u32::from(self)
11958 }
11959
11960 /// Returns the 16 bit Usage ID value of this Usage
11961 fn usage_id_value(&self) -> u16 {
11962 u16::from(self)
11963 }
11964
11965 /// Returns this usage as [Usage::Sensors(self)](Usage::Sensors)
11966 /// This is a convenience function to avoid having
11967 /// to implement `From` for every used type in the caller.
11968 ///
11969 /// ```
11970 /// # use hut::*;
11971 /// let gd_x = GenericDesktop::X;
11972 /// let usage = Usage::from(GenericDesktop::X);
11973 /// assert!(matches!(gd_x.usage(), usage));
11974 /// ```
11975 fn usage(&self) -> Usage {
11976 Usage::from(self)
11977 }
11978 }
11979
11980 impl AsUsagePage for Sensors {
11981 /// Returns the 16 bit value of this UsagePage
11982 ///
11983 /// This value is `0x20` for [Sensors]
11984 fn usage_page_value(&self) -> u16 {
11985 let up = UsagePage::from(self);
11986 u16::from(up)
11987 }
11988
11989 /// Returns [UsagePage::Sensors]]
11990 fn usage_page(&self) -> UsagePage {
11991 UsagePage::from(self)
11992 }
11993 }
11994
11995 impl From<&Sensors> for u16 {
11996 fn from(sensors: &Sensors) -> u16 {
11997 *sensors as u16
11998 }
11999 }
12000
12001 impl From<Sensors> for u16 {
12002 /// Returns the 16bit value of this usage. This is identical
12003 /// to [Sensors::usage_page_value()].
12004 fn from(sensors: Sensors) -> u16 {
12005 u16::from(&sensors)
12006 }
12007 }
12008
12009 impl From<&Sensors> for u32 {
12010 /// Returns the 32 bit value of this usage. This is identical
12011 /// to [Sensors::usage_value()].
12012 fn from(sensors: &Sensors) -> u32 {
12013 let up = UsagePage::from(sensors);
12014 let up = (u16::from(&up) as u32) << 16;
12015 let id = u16::from(sensors) as u32;
12016 up | id
12017 }
12018 }
12019
12020 impl From<&Sensors> for UsagePage {
12021 /// Always returns [UsagePage::Sensors] and is
12022 /// identical to [Sensors::usage_page()].
12023 fn from(_: &Sensors) -> UsagePage {
12024 UsagePage::Sensors
12025 }
12026 }
12027
12028 impl From<Sensors> for UsagePage {
12029 /// Always returns [UsagePage::Sensors] and is
12030 /// identical to [Sensors::usage_page()].
12031 fn from(_: Sensors) -> UsagePage {
12032 UsagePage::Sensors
12033 }
12034 }
12035
12036 impl From<&Sensors> for Usage {
12037 fn from(sensors: &Sensors) -> Usage {
12038 Usage::try_from(u32::from(sensors)).unwrap()
12039 }
12040 }
12041
12042 impl From<Sensors> for Usage {
12043 fn from(sensors: Sensors) -> Usage {
12044 Usage::from(&sensors)
12045 }
12046 }
12047
12048 impl TryFrom<u16> for Sensors {
12049 type Error = HutError;
12050
12051 fn try_from(usage_id: u16) -> Result<Sensors> {
12052 match usage_id {
12053 1 => Ok(Sensors::Sensor),
12054 16 => Ok(Sensors::Biometric),
12055 17 => Ok(Sensors::BiometricHumanPresence),
12056 18 => Ok(Sensors::BiometricHumanProximity),
12057 19 => Ok(Sensors::BiometricHumanTouch),
12058 20 => Ok(Sensors::BiometricBloodPressure),
12059 21 => Ok(Sensors::BiometricBodyTemperature),
12060 22 => Ok(Sensors::BiometricHeartRate),
12061 23 => Ok(Sensors::BiometricHeartRateVariability),
12062 24 => Ok(Sensors::BiometricPeripheralOxygenSaturation),
12063 25 => Ok(Sensors::BiometricRespiratoryRate),
12064 32 => Ok(Sensors::Electrical),
12065 33 => Ok(Sensors::ElectricalCapacitance),
12066 34 => Ok(Sensors::ElectricalCurrent),
12067 35 => Ok(Sensors::ElectricalPower),
12068 36 => Ok(Sensors::ElectricalInductance),
12069 37 => Ok(Sensors::ElectricalResistance),
12070 38 => Ok(Sensors::ElectricalVoltage),
12071 39 => Ok(Sensors::ElectricalPotentiometer),
12072 40 => Ok(Sensors::ElectricalFrequency),
12073 41 => Ok(Sensors::ElectricalPeriod),
12074 48 => Ok(Sensors::Environmental),
12075 49 => Ok(Sensors::EnvironmentalAtmosphericPressure),
12076 50 => Ok(Sensors::EnvironmentalHumidity),
12077 51 => Ok(Sensors::EnvironmentalTemperature),
12078 52 => Ok(Sensors::EnvironmentalWindDirection),
12079 53 => Ok(Sensors::EnvironmentalWindSpeed),
12080 54 => Ok(Sensors::EnvironmentalAirQuality),
12081 55 => Ok(Sensors::EnvironmentalHeatIndex),
12082 56 => Ok(Sensors::EnvironmentalSurfaceTemperature),
12083 57 => Ok(Sensors::EnvironmentalVolatileOrganicCompounds),
12084 58 => Ok(Sensors::EnvironmentalObjectPresence),
12085 59 => Ok(Sensors::EnvironmentalObjectProximity),
12086 64 => Ok(Sensors::Light),
12087 65 => Ok(Sensors::LightAmbientLight),
12088 66 => Ok(Sensors::LightConsumerInfrared),
12089 67 => Ok(Sensors::LightInfraredLight),
12090 68 => Ok(Sensors::LightVisibleLight),
12091 69 => Ok(Sensors::LightUltravioletLight),
12092 80 => Ok(Sensors::Location),
12093 81 => Ok(Sensors::LocationBroadcast),
12094 82 => Ok(Sensors::LocationDeadReckoning),
12095 83 => Ok(Sensors::LocationGPSGlobalPositioningSystem),
12096 84 => Ok(Sensors::LocationLookup),
12097 85 => Ok(Sensors::LocationOther),
12098 86 => Ok(Sensors::LocationStatic),
12099 87 => Ok(Sensors::LocationTriangulation),
12100 96 => Ok(Sensors::Mechanical),
12101 97 => Ok(Sensors::MechanicalBooleanSwitch),
12102 98 => Ok(Sensors::MechanicalBooleanSwitchArray),
12103 99 => Ok(Sensors::MechanicalMultivalueSwitch),
12104 100 => Ok(Sensors::MechanicalForce),
12105 101 => Ok(Sensors::MechanicalPressure),
12106 102 => Ok(Sensors::MechanicalStrain),
12107 103 => Ok(Sensors::MechanicalWeight),
12108 104 => Ok(Sensors::MechanicalHapticVibrator),
12109 105 => Ok(Sensors::MechanicalHallEffectSwitch),
12110 112 => Ok(Sensors::Motion),
12111 113 => Ok(Sensors::MotionAccelerometer1D),
12112 114 => Ok(Sensors::MotionAccelerometer2D),
12113 115 => Ok(Sensors::MotionAccelerometer3D),
12114 116 => Ok(Sensors::MotionGyrometer1D),
12115 117 => Ok(Sensors::MotionGyrometer2D),
12116 118 => Ok(Sensors::MotionGyrometer3D),
12117 119 => Ok(Sensors::MotionMotionDetector),
12118 120 => Ok(Sensors::MotionSpeedometer),
12119 121 => Ok(Sensors::MotionAccelerometer),
12120 122 => Ok(Sensors::MotionGyrometer),
12121 123 => Ok(Sensors::MotionGravityVector),
12122 124 => Ok(Sensors::MotionLinearAccelerometer),
12123 128 => Ok(Sensors::Orientation),
12124 129 => Ok(Sensors::OrientationCompass1D),
12125 130 => Ok(Sensors::OrientationCompass2D),
12126 131 => Ok(Sensors::OrientationCompass3D),
12127 132 => Ok(Sensors::OrientationInclinometer1D),
12128 133 => Ok(Sensors::OrientationInclinometer2D),
12129 134 => Ok(Sensors::OrientationInclinometer3D),
12130 135 => Ok(Sensors::OrientationDistance1D),
12131 136 => Ok(Sensors::OrientationDistance2D),
12132 137 => Ok(Sensors::OrientationDistance3D),
12133 138 => Ok(Sensors::OrientationDeviceOrientation),
12134 139 => Ok(Sensors::OrientationCompass),
12135 140 => Ok(Sensors::OrientationInclinometer),
12136 141 => Ok(Sensors::OrientationDistance),
12137 142 => Ok(Sensors::OrientationRelativeOrientation),
12138 143 => Ok(Sensors::OrientationSimpleOrientation),
12139 144 => Ok(Sensors::Scanner),
12140 145 => Ok(Sensors::ScannerBarcode),
12141 146 => Ok(Sensors::ScannerRFID),
12142 147 => Ok(Sensors::ScannerNFC),
12143 160 => Ok(Sensors::Time),
12144 161 => Ok(Sensors::TimeAlarmTimer),
12145 162 => Ok(Sensors::TimeRealTimeClock),
12146 176 => Ok(Sensors::PersonalActivity),
12147 177 => Ok(Sensors::PersonalActivityActivityDetection),
12148 178 => Ok(Sensors::PersonalActivityDevicePosition),
12149 179 => Ok(Sensors::PersonalActivityFloorTracker),
12150 180 => Ok(Sensors::PersonalActivityPedometer),
12151 181 => Ok(Sensors::PersonalActivityStepDetection),
12152 192 => Ok(Sensors::OrientationExtended),
12153 193 => Ok(Sensors::OrientationExtendedGeomagneticOrientation),
12154 194 => Ok(Sensors::OrientationExtendedMagnetometer),
12155 208 => Ok(Sensors::Gesture),
12156 209 => Ok(Sensors::GestureChassisFlipGesture),
12157 210 => Ok(Sensors::GestureHingeFoldGesture),
12158 224 => Ok(Sensors::Other),
12159 225 => Ok(Sensors::OtherCustom),
12160 226 => Ok(Sensors::OtherGeneric),
12161 227 => Ok(Sensors::OtherGenericEnumerator),
12162 228 => Ok(Sensors::OtherHingeAngle),
12163 240 => Ok(Sensors::VendorReserved1),
12164 241 => Ok(Sensors::VendorReserved2),
12165 242 => Ok(Sensors::VendorReserved3),
12166 243 => Ok(Sensors::VendorReserved4),
12167 244 => Ok(Sensors::VendorReserved5),
12168 245 => Ok(Sensors::VendorReserved6),
12169 246 => Ok(Sensors::VendorReserved7),
12170 247 => Ok(Sensors::VendorReserved8),
12171 248 => Ok(Sensors::VendorReserved9),
12172 249 => Ok(Sensors::VendorReserved10),
12173 250 => Ok(Sensors::VendorReserved11),
12174 251 => Ok(Sensors::VendorReserved12),
12175 252 => Ok(Sensors::VendorReserved13),
12176 253 => Ok(Sensors::VendorReserved14),
12177 254 => Ok(Sensors::VendorReserved15),
12178 255 => Ok(Sensors::VendorReserved16),
12179 512 => Ok(Sensors::Event),
12180 513 => Ok(Sensors::EventSensorState),
12181 514 => Ok(Sensors::EventSensorEvent),
12182 768 => Ok(Sensors::Property),
12183 769 => Ok(Sensors::PropertyFriendlyName),
12184 770 => Ok(Sensors::PropertyPersistentUniqueID),
12185 771 => Ok(Sensors::PropertySensorStatus),
12186 772 => Ok(Sensors::PropertyMinimumReportInterval),
12187 773 => Ok(Sensors::PropertySensorManufacturer),
12188 774 => Ok(Sensors::PropertySensorModel),
12189 775 => Ok(Sensors::PropertySensorSerialNumber),
12190 776 => Ok(Sensors::PropertySensorDescription),
12191 777 => Ok(Sensors::PropertySensorConnectionType),
12192 778 => Ok(Sensors::PropertySensorDevicePath),
12193 779 => Ok(Sensors::PropertyHardwareRevision),
12194 780 => Ok(Sensors::PropertyFirmwareVersion),
12195 781 => Ok(Sensors::PropertyReleaseDate),
12196 782 => Ok(Sensors::PropertyReportInterval),
12197 783 => Ok(Sensors::PropertyChangeSensitivityAbsolute),
12198 784 => Ok(Sensors::PropertyChangeSensitivityPercentofRange),
12199 785 => Ok(Sensors::PropertyChangeSensitivityPercentRelative),
12200 786 => Ok(Sensors::PropertyAccuracy),
12201 787 => Ok(Sensors::PropertyResolution),
12202 788 => Ok(Sensors::PropertyMaximum),
12203 789 => Ok(Sensors::PropertyMinimum),
12204 790 => Ok(Sensors::PropertyReportingState),
12205 791 => Ok(Sensors::PropertySamplingRate),
12206 792 => Ok(Sensors::PropertyResponseCurve),
12207 793 => Ok(Sensors::PropertyPowerState),
12208 794 => Ok(Sensors::PropertyMaximumFIFOEvents),
12209 795 => Ok(Sensors::PropertyReportLatency),
12210 796 => Ok(Sensors::PropertyFlushFIFOEvents),
12211 797 => Ok(Sensors::PropertyMaximumPowerConsumption),
12212 798 => Ok(Sensors::PropertyIsPrimary),
12213 799 => Ok(Sensors::PropertyHumanPresenceDetectionType),
12214 1024 => Ok(Sensors::DataFieldLocation),
12215 1026 => Ok(Sensors::DataFieldAltitudeAntennaSeaLevel),
12216 1027 => Ok(Sensors::DataFieldDifferentialReferenceStationID),
12217 1028 => Ok(Sensors::DataFieldAltitudeEllipsoidError),
12218 1029 => Ok(Sensors::DataFieldAltitudeEllipsoid),
12219 1030 => Ok(Sensors::DataFieldAltitudeSeaLevelError),
12220 1031 => Ok(Sensors::DataFieldAltitudeSeaLevel),
12221 1032 => Ok(Sensors::DataFieldDifferentialGPSDataAge),
12222 1033 => Ok(Sensors::DataFieldErrorRadius),
12223 1034 => Ok(Sensors::DataFieldFixQuality),
12224 1035 => Ok(Sensors::DataFieldFixType),
12225 1036 => Ok(Sensors::DataFieldGeoidalSeparation),
12226 1037 => Ok(Sensors::DataFieldGPSOperationMode),
12227 1038 => Ok(Sensors::DataFieldGPSSelectionMode),
12228 1039 => Ok(Sensors::DataFieldGPSStatus),
12229 1040 => Ok(Sensors::DataFieldPositionDilutionofPrecision),
12230 1041 => Ok(Sensors::DataFieldHorizontalDilutionofPrecision),
12231 1042 => Ok(Sensors::DataFieldVerticalDilutionofPrecision),
12232 1043 => Ok(Sensors::DataFieldLatitude),
12233 1044 => Ok(Sensors::DataFieldLongitude),
12234 1045 => Ok(Sensors::DataFieldTrueHeading),
12235 1046 => Ok(Sensors::DataFieldMagneticHeading),
12236 1047 => Ok(Sensors::DataFieldMagneticVariation),
12237 1048 => Ok(Sensors::DataFieldSpeed),
12238 1049 => Ok(Sensors::DataFieldSatellitesinView),
12239 1050 => Ok(Sensors::DataFieldSatellitesinViewAzimuth),
12240 1051 => Ok(Sensors::DataFieldSatellitesinViewElevation),
12241 1052 => Ok(Sensors::DataFieldSatellitesinViewIDs),
12242 1053 => Ok(Sensors::DataFieldSatellitesinViewPRNs),
12243 1054 => Ok(Sensors::DataFieldSatellitesinViewSNRatios),
12244 1055 => Ok(Sensors::DataFieldSatellitesUsedCount),
12245 1056 => Ok(Sensors::DataFieldSatellitesUsedPRNs),
12246 1057 => Ok(Sensors::DataFieldNMEASentence),
12247 1058 => Ok(Sensors::DataFieldAddressLine1),
12248 1059 => Ok(Sensors::DataFieldAddressLine2),
12249 1060 => Ok(Sensors::DataFieldCity),
12250 1061 => Ok(Sensors::DataFieldStateorProvince),
12251 1062 => Ok(Sensors::DataFieldCountryorRegion),
12252 1063 => Ok(Sensors::DataFieldPostalCode),
12253 1066 => Ok(Sensors::PropertyLocation),
12254 1067 => Ok(Sensors::PropertyLocationDesiredAccuracy),
12255 1072 => Ok(Sensors::DataFieldEnvironmental),
12256 1073 => Ok(Sensors::DataFieldAtmosphericPressure),
12257 1075 => Ok(Sensors::DataFieldRelativeHumidity),
12258 1076 => Ok(Sensors::DataFieldTemperature),
12259 1077 => Ok(Sensors::DataFieldWindDirection),
12260 1078 => Ok(Sensors::DataFieldWindSpeed),
12261 1079 => Ok(Sensors::DataFieldAirQualityIndex),
12262 1080 => Ok(Sensors::DataFieldEquivalentCO2),
12263 1081 => Ok(Sensors::DataFieldVolatileOrganicCompoundConcentration),
12264 1082 => Ok(Sensors::DataFieldObjectPresence),
12265 1083 => Ok(Sensors::DataFieldObjectProximityRange),
12266 1084 => Ok(Sensors::DataFieldObjectProximityOutofRange),
12267 1088 => Ok(Sensors::PropertyEnvironmental),
12268 1089 => Ok(Sensors::PropertyReferencePressure),
12269 1104 => Ok(Sensors::DataFieldMotion),
12270 1105 => Ok(Sensors::DataFieldMotionState),
12271 1106 => Ok(Sensors::DataFieldAcceleration),
12272 1107 => Ok(Sensors::DataFieldAccelerationAxisX),
12273 1108 => Ok(Sensors::DataFieldAccelerationAxisY),
12274 1109 => Ok(Sensors::DataFieldAccelerationAxisZ),
12275 1110 => Ok(Sensors::DataFieldAngularVelocity),
12276 1111 => Ok(Sensors::DataFieldAngularVelocityaboutXAxis),
12277 1112 => Ok(Sensors::DataFieldAngularVelocityaboutYAxis),
12278 1113 => Ok(Sensors::DataFieldAngularVelocityaboutZAxis),
12279 1114 => Ok(Sensors::DataFieldAngularPosition),
12280 1115 => Ok(Sensors::DataFieldAngularPositionaboutXAxis),
12281 1116 => Ok(Sensors::DataFieldAngularPositionaboutYAxis),
12282 1117 => Ok(Sensors::DataFieldAngularPositionaboutZAxis),
12283 1118 => Ok(Sensors::DataFieldMotionSpeed),
12284 1119 => Ok(Sensors::DataFieldMotionIntensity),
12285 1136 => Ok(Sensors::DataFieldOrientation),
12286 1137 => Ok(Sensors::DataFieldHeading),
12287 1138 => Ok(Sensors::DataFieldHeadingXAxis),
12288 1139 => Ok(Sensors::DataFieldHeadingYAxis),
12289 1140 => Ok(Sensors::DataFieldHeadingZAxis),
12290 1141 => Ok(Sensors::DataFieldHeadingCompensatedMagneticNorth),
12291 1142 => Ok(Sensors::DataFieldHeadingCompensatedTrueNorth),
12292 1143 => Ok(Sensors::DataFieldHeadingMagneticNorth),
12293 1144 => Ok(Sensors::DataFieldHeadingTrueNorth),
12294 1145 => Ok(Sensors::DataFieldDistance),
12295 1146 => Ok(Sensors::DataFieldDistanceXAxis),
12296 1147 => Ok(Sensors::DataFieldDistanceYAxis),
12297 1148 => Ok(Sensors::DataFieldDistanceZAxis),
12298 1149 => Ok(Sensors::DataFieldDistanceOutofRange),
12299 1150 => Ok(Sensors::DataFieldTilt),
12300 1151 => Ok(Sensors::DataFieldTiltXAxis),
12301 1152 => Ok(Sensors::DataFieldTiltYAxis),
12302 1153 => Ok(Sensors::DataFieldTiltZAxis),
12303 1154 => Ok(Sensors::DataFieldRotationMatrix),
12304 1155 => Ok(Sensors::DataFieldQuaternion),
12305 1156 => Ok(Sensors::DataFieldMagneticFlux),
12306 1157 => Ok(Sensors::DataFieldMagneticFluxXAxis),
12307 1158 => Ok(Sensors::DataFieldMagneticFluxYAxis),
12308 1159 => Ok(Sensors::DataFieldMagneticFluxZAxis),
12309 1160 => Ok(Sensors::DataFieldMagnetometerAccuracy),
12310 1161 => Ok(Sensors::DataFieldSimpleOrientationDirection),
12311 1168 => Ok(Sensors::DataFieldMechanical),
12312 1169 => Ok(Sensors::DataFieldBooleanSwitchState),
12313 1170 => Ok(Sensors::DataFieldBooleanSwitchArrayStates),
12314 1171 => Ok(Sensors::DataFieldMultivalueSwitchValue),
12315 1172 => Ok(Sensors::DataFieldForce),
12316 1173 => Ok(Sensors::DataFieldAbsolutePressure),
12317 1174 => Ok(Sensors::DataFieldGaugePressure),
12318 1175 => Ok(Sensors::DataFieldStrain),
12319 1176 => Ok(Sensors::DataFieldWeight),
12320 1184 => Ok(Sensors::PropertyMechanical),
12321 1185 => Ok(Sensors::PropertyVibrationState),
12322 1186 => Ok(Sensors::PropertyForwardVibrationSpeed),
12323 1187 => Ok(Sensors::PropertyBackwardVibrationSpeed),
12324 1200 => Ok(Sensors::DataFieldBiometric),
12325 1201 => Ok(Sensors::DataFieldHumanPresence),
12326 1202 => Ok(Sensors::DataFieldHumanProximityRange),
12327 1203 => Ok(Sensors::DataFieldHumanProximityOutofRange),
12328 1204 => Ok(Sensors::DataFieldHumanTouchState),
12329 1205 => Ok(Sensors::DataFieldBloodPressure),
12330 1206 => Ok(Sensors::DataFieldBloodPressureDiastolic),
12331 1207 => Ok(Sensors::DataFieldBloodPressureSystolic),
12332 1208 => Ok(Sensors::DataFieldHeartRate),
12333 1209 => Ok(Sensors::DataFieldRestingHeartRate),
12334 1210 => Ok(Sensors::DataFieldHeartbeatInterval),
12335 1211 => Ok(Sensors::DataFieldRespiratoryRate),
12336 1212 => Ok(Sensors::DataFieldSpO2),
12337 1213 => Ok(Sensors::DataFieldHumanAttentionDetected),
12338 1214 => Ok(Sensors::DataFieldHumanHeadAzimuth),
12339 1215 => Ok(Sensors::DataFieldHumanHeadAltitude),
12340 1216 => Ok(Sensors::DataFieldHumanHeadRoll),
12341 1217 => Ok(Sensors::DataFieldHumanHeadPitch),
12342 1218 => Ok(Sensors::DataFieldHumanHeadYaw),
12343 1219 => Ok(Sensors::DataFieldHumanCorrelationId),
12344 1232 => Ok(Sensors::DataFieldLight),
12345 1233 => Ok(Sensors::DataFieldIlluminance),
12346 1234 => Ok(Sensors::DataFieldColorTemperature),
12347 1235 => Ok(Sensors::DataFieldChromaticity),
12348 1236 => Ok(Sensors::DataFieldChromaticityX),
12349 1237 => Ok(Sensors::DataFieldChromaticityY),
12350 1238 => Ok(Sensors::DataFieldConsumerIRSentenceReceive),
12351 1239 => Ok(Sensors::DataFieldInfraredLight),
12352 1240 => Ok(Sensors::DataFieldRedLight),
12353 1241 => Ok(Sensors::DataFieldGreenLight),
12354 1242 => Ok(Sensors::DataFieldBlueLight),
12355 1243 => Ok(Sensors::DataFieldUltravioletALight),
12356 1244 => Ok(Sensors::DataFieldUltravioletBLight),
12357 1245 => Ok(Sensors::DataFieldUltravioletIndex),
12358 1246 => Ok(Sensors::DataFieldNearInfraredLight),
12359 1247 => Ok(Sensors::PropertyLight),
12360 1248 => Ok(Sensors::PropertyConsumerIRSentenceSend),
12361 1250 => Ok(Sensors::PropertyAutoBrightnessPreferred),
12362 1251 => Ok(Sensors::PropertyAutoColorPreferred),
12363 1264 => Ok(Sensors::DataFieldScanner),
12364 1265 => Ok(Sensors::DataFieldRFIDTag40Bit),
12365 1266 => Ok(Sensors::DataFieldNFCSentenceReceive),
12366 1272 => Ok(Sensors::PropertyScanner),
12367 1273 => Ok(Sensors::PropertyNFCSentenceSend),
12368 1280 => Ok(Sensors::DataFieldElectrical),
12369 1281 => Ok(Sensors::DataFieldCapacitance),
12370 1282 => Ok(Sensors::DataFieldCurrent),
12371 1283 => Ok(Sensors::DataFieldElectricalPower),
12372 1284 => Ok(Sensors::DataFieldInductance),
12373 1285 => Ok(Sensors::DataFieldResistance),
12374 1286 => Ok(Sensors::DataFieldVoltage),
12375 1287 => Ok(Sensors::DataFieldFrequency),
12376 1288 => Ok(Sensors::DataFieldPeriod),
12377 1289 => Ok(Sensors::DataFieldPercentofRange),
12378 1312 => Ok(Sensors::DataFieldTime),
12379 1313 => Ok(Sensors::DataFieldYear),
12380 1314 => Ok(Sensors::DataFieldMonth),
12381 1315 => Ok(Sensors::DataFieldDay),
12382 1316 => Ok(Sensors::DataFieldDayofWeek),
12383 1317 => Ok(Sensors::DataFieldHour),
12384 1318 => Ok(Sensors::DataFieldMinute),
12385 1319 => Ok(Sensors::DataFieldSecond),
12386 1320 => Ok(Sensors::DataFieldMillisecond),
12387 1321 => Ok(Sensors::DataFieldTimestamp),
12388 1322 => Ok(Sensors::DataFieldJulianDayofYear),
12389 1323 => Ok(Sensors::DataFieldTimeSinceSystemBoot),
12390 1328 => Ok(Sensors::PropertyTime),
12391 1329 => Ok(Sensors::PropertyTimeZoneOffsetfromUTC),
12392 1330 => Ok(Sensors::PropertyTimeZoneName),
12393 1331 => Ok(Sensors::PropertyDaylightSavingsTimeObserved),
12394 1332 => Ok(Sensors::PropertyTimeTrimAdjustment),
12395 1333 => Ok(Sensors::PropertyArmAlarm),
12396 1344 => Ok(Sensors::DataFieldCustom),
12397 1345 => Ok(Sensors::DataFieldCustomUsage),
12398 1346 => Ok(Sensors::DataFieldCustomBooleanArray),
12399 1347 => Ok(Sensors::DataFieldCustomValue),
12400 1348 => Ok(Sensors::DataFieldCustomValue1),
12401 1349 => Ok(Sensors::DataFieldCustomValue2),
12402 1350 => Ok(Sensors::DataFieldCustomValue3),
12403 1351 => Ok(Sensors::DataFieldCustomValue4),
12404 1352 => Ok(Sensors::DataFieldCustomValue5),
12405 1353 => Ok(Sensors::DataFieldCustomValue6),
12406 1354 => Ok(Sensors::DataFieldCustomValue7),
12407 1355 => Ok(Sensors::DataFieldCustomValue8),
12408 1356 => Ok(Sensors::DataFieldCustomValue9),
12409 1357 => Ok(Sensors::DataFieldCustomValue10),
12410 1358 => Ok(Sensors::DataFieldCustomValue11),
12411 1359 => Ok(Sensors::DataFieldCustomValue12),
12412 1360 => Ok(Sensors::DataFieldCustomValue13),
12413 1361 => Ok(Sensors::DataFieldCustomValue14),
12414 1362 => Ok(Sensors::DataFieldCustomValue15),
12415 1363 => Ok(Sensors::DataFieldCustomValue16),
12416 1364 => Ok(Sensors::DataFieldCustomValue17),
12417 1365 => Ok(Sensors::DataFieldCustomValue18),
12418 1366 => Ok(Sensors::DataFieldCustomValue19),
12419 1367 => Ok(Sensors::DataFieldCustomValue20),
12420 1368 => Ok(Sensors::DataFieldCustomValue21),
12421 1369 => Ok(Sensors::DataFieldCustomValue22),
12422 1370 => Ok(Sensors::DataFieldCustomValue23),
12423 1371 => Ok(Sensors::DataFieldCustomValue24),
12424 1372 => Ok(Sensors::DataFieldCustomValue25),
12425 1373 => Ok(Sensors::DataFieldCustomValue26),
12426 1374 => Ok(Sensors::DataFieldCustomValue27),
12427 1375 => Ok(Sensors::DataFieldCustomValue28),
12428 1376 => Ok(Sensors::DataFieldGeneric),
12429 1377 => Ok(Sensors::DataFieldGenericGUIDorPROPERTYKEY),
12430 1378 => Ok(Sensors::DataFieldGenericCategoryGUID),
12431 1379 => Ok(Sensors::DataFieldGenericTypeGUID),
12432 1380 => Ok(Sensors::DataFieldGenericEventPROPERTYKEY),
12433 1381 => Ok(Sensors::DataFieldGenericPropertyPROPERTYKEY),
12434 1382 => Ok(Sensors::DataFieldGenericDataFieldPROPERTYKEY),
12435 1383 => Ok(Sensors::DataFieldGenericEvent),
12436 1384 => Ok(Sensors::DataFieldGenericProperty),
12437 1385 => Ok(Sensors::DataFieldGenericDataField),
12438 1386 => Ok(Sensors::DataFieldEnumeratorTableRowIndex),
12439 1387 => Ok(Sensors::DataFieldEnumeratorTableRowCount),
12440 1388 => Ok(Sensors::DataFieldGenericGUIDorPROPERTYKEYkind),
12441 1389 => Ok(Sensors::DataFieldGenericGUID),
12442 1390 => Ok(Sensors::DataFieldGenericPROPERTYKEY),
12443 1391 => Ok(Sensors::DataFieldGenericTopLevelCollectionID),
12444 1392 => Ok(Sensors::DataFieldGenericReportID),
12445 1393 => Ok(Sensors::DataFieldGenericReportItemPositionIndex),
12446 1394 => Ok(Sensors::DataFieldGenericFirmwareVARTYPE),
12447 1395 => Ok(Sensors::DataFieldGenericUnitofMeasure),
12448 1396 => Ok(Sensors::DataFieldGenericUnitExponent),
12449 1397 => Ok(Sensors::DataFieldGenericReportSize),
12450 1398 => Ok(Sensors::DataFieldGenericReportCount),
12451 1408 => Ok(Sensors::PropertyGeneric),
12452 1409 => Ok(Sensors::PropertyEnumeratorTableRowIndex),
12453 1410 => Ok(Sensors::PropertyEnumeratorTableRowCount),
12454 1424 => Ok(Sensors::DataFieldPersonalActivity),
12455 1425 => Ok(Sensors::DataFieldActivityType),
12456 1426 => Ok(Sensors::DataFieldActivityState),
12457 1427 => Ok(Sensors::DataFieldDevicePosition),
12458 1428 => Ok(Sensors::DataFieldStepCount),
12459 1429 => Ok(Sensors::DataFieldStepCountReset),
12460 1430 => Ok(Sensors::DataFieldStepDuration),
12461 1431 => Ok(Sensors::DataFieldStepType),
12462 1440 => Ok(Sensors::PropertyMinimumActivityDetectionInterval),
12463 1441 => Ok(Sensors::PropertySupportedActivityTypes),
12464 1442 => Ok(Sensors::PropertySubscribedActivityTypes),
12465 1443 => Ok(Sensors::PropertySupportedStepTypes),
12466 1444 => Ok(Sensors::PropertySubscribedStepTypes),
12467 1445 => Ok(Sensors::PropertyFloorHeight),
12468 1456 => Ok(Sensors::DataFieldCustomTypeID),
12469 1472 => Ok(Sensors::PropertyCustom),
12470 1473 => Ok(Sensors::PropertyCustomValue1),
12471 1474 => Ok(Sensors::PropertyCustomValue2),
12472 1475 => Ok(Sensors::PropertyCustomValue3),
12473 1476 => Ok(Sensors::PropertyCustomValue4),
12474 1477 => Ok(Sensors::PropertyCustomValue5),
12475 1478 => Ok(Sensors::PropertyCustomValue6),
12476 1479 => Ok(Sensors::PropertyCustomValue7),
12477 1480 => Ok(Sensors::PropertyCustomValue8),
12478 1481 => Ok(Sensors::PropertyCustomValue9),
12479 1482 => Ok(Sensors::PropertyCustomValue10),
12480 1483 => Ok(Sensors::PropertyCustomValue11),
12481 1484 => Ok(Sensors::PropertyCustomValue12),
12482 1485 => Ok(Sensors::PropertyCustomValue13),
12483 1486 => Ok(Sensors::PropertyCustomValue14),
12484 1487 => Ok(Sensors::PropertyCustomValue15),
12485 1488 => Ok(Sensors::PropertyCustomValue16),
12486 1504 => Ok(Sensors::DataFieldHinge),
12487 1505 => Ok(Sensors::DataFieldHingeAngle),
12488 1520 => Ok(Sensors::DataFieldGestureSensor),
12489 1521 => Ok(Sensors::DataFieldGestureState),
12490 1522 => Ok(Sensors::DataFieldHingeFoldInitialAngle),
12491 1523 => Ok(Sensors::DataFieldHingeFoldFinalAngle),
12492 1524 => Ok(Sensors::DataFieldHingeFoldContributingPanel),
12493 1525 => Ok(Sensors::DataFieldHingeFoldType),
12494 2048 => Ok(Sensors::SensorStateUndefined),
12495 2049 => Ok(Sensors::SensorStateReady),
12496 2050 => Ok(Sensors::SensorStateNotAvailable),
12497 2051 => Ok(Sensors::SensorStateNoData),
12498 2052 => Ok(Sensors::SensorStateInitializing),
12499 2053 => Ok(Sensors::SensorStateAccessDenied),
12500 2054 => Ok(Sensors::SensorStateError),
12501 2064 => Ok(Sensors::SensorEventUnknown),
12502 2065 => Ok(Sensors::SensorEventStateChanged),
12503 2066 => Ok(Sensors::SensorEventPropertyChanged),
12504 2067 => Ok(Sensors::SensorEventDataUpdated),
12505 2068 => Ok(Sensors::SensorEventPollResponse),
12506 2069 => Ok(Sensors::SensorEventChangeSensitivity),
12507 2070 => Ok(Sensors::SensorEventRangeMaximumReached),
12508 2071 => Ok(Sensors::SensorEventRangeMinimumReached),
12509 2072 => Ok(Sensors::SensorEventHighThresholdCrossUpward),
12510 2073 => Ok(Sensors::SensorEventHighThresholdCrossDownward),
12511 2074 => Ok(Sensors::SensorEventLowThresholdCrossUpward),
12512 2075 => Ok(Sensors::SensorEventLowThresholdCrossDownward),
12513 2076 => Ok(Sensors::SensorEventZeroThresholdCrossUpward),
12514 2077 => Ok(Sensors::SensorEventZeroThresholdCrossDownward),
12515 2078 => Ok(Sensors::SensorEventPeriodExceeded),
12516 2079 => Ok(Sensors::SensorEventFrequencyExceeded),
12517 2080 => Ok(Sensors::SensorEventComplexTrigger),
12518 2096 => Ok(Sensors::ConnectionTypePCIntegrated),
12519 2097 => Ok(Sensors::ConnectionTypePCAttached),
12520 2098 => Ok(Sensors::ConnectionTypePCExternal),
12521 2112 => Ok(Sensors::ReportingStateReportNoEvents),
12522 2113 => Ok(Sensors::ReportingStateReportAllEvents),
12523 2114 => Ok(Sensors::ReportingStateReportThresholdEvents),
12524 2115 => Ok(Sensors::ReportingStateWakeOnNoEvents),
12525 2116 => Ok(Sensors::ReportingStateWakeOnAllEvents),
12526 2117 => Ok(Sensors::ReportingStateWakeOnThresholdEvents),
12527 2118 => Ok(Sensors::ReportingStateAnytime),
12528 2128 => Ok(Sensors::PowerStateUndefined),
12529 2129 => Ok(Sensors::PowerStateD0FullPower),
12530 2130 => Ok(Sensors::PowerStateD1LowPower),
12531 2131 => Ok(Sensors::PowerStateD2StandbyPowerwithWakeup),
12532 2132 => Ok(Sensors::PowerStateD3SleepwithWakeup),
12533 2133 => Ok(Sensors::PowerStateD4PowerOff),
12534 2144 => Ok(Sensors::AccuracyDefault),
12535 2145 => Ok(Sensors::AccuracyHigh),
12536 2146 => Ok(Sensors::AccuracyMedium),
12537 2147 => Ok(Sensors::AccuracyLow),
12538 2160 => Ok(Sensors::FixQualityNoFix),
12539 2161 => Ok(Sensors::FixQualityGPS),
12540 2162 => Ok(Sensors::FixQualityDGPS),
12541 2176 => Ok(Sensors::FixTypeNoFix),
12542 2177 => Ok(Sensors::FixTypeGPSSPSModeFixValid),
12543 2178 => Ok(Sensors::FixTypeDGPSSPSModeFixValid),
12544 2179 => Ok(Sensors::FixTypeGPSPPSModeFixValid),
12545 2180 => Ok(Sensors::FixTypeRealTimeKinematic),
12546 2181 => Ok(Sensors::FixTypeFloatRTK),
12547 2182 => Ok(Sensors::FixTypeEstimateddeadreckoned),
12548 2183 => Ok(Sensors::FixTypeManualInputMode),
12549 2184 => Ok(Sensors::FixTypeSimulatorMode),
12550 2192 => Ok(Sensors::GPSOperationModeManual),
12551 2193 => Ok(Sensors::GPSOperationModeAutomatic),
12552 2208 => Ok(Sensors::GPSSelectionModeAutonomous),
12553 2209 => Ok(Sensors::GPSSelectionModeDGPS),
12554 2210 => Ok(Sensors::GPSSelectionModeEstimateddeadreckoned),
12555 2211 => Ok(Sensors::GPSSelectionModeManualInput),
12556 2212 => Ok(Sensors::GPSSelectionModeSimulator),
12557 2213 => Ok(Sensors::GPSSelectionModeDataNotValid),
12558 2224 => Ok(Sensors::GPSStatusDataValid),
12559 2225 => Ok(Sensors::GPSStatusDataNotValid),
12560 2240 => Ok(Sensors::DayofWeekSunday),
12561 2241 => Ok(Sensors::DayofWeekMonday),
12562 2242 => Ok(Sensors::DayofWeekTuesday),
12563 2243 => Ok(Sensors::DayofWeekWednesday),
12564 2244 => Ok(Sensors::DayofWeekThursday),
12565 2245 => Ok(Sensors::DayofWeekFriday),
12566 2246 => Ok(Sensors::DayofWeekSaturday),
12567 2256 => Ok(Sensors::KindCategory),
12568 2257 => Ok(Sensors::KindType),
12569 2258 => Ok(Sensors::KindEvent),
12570 2259 => Ok(Sensors::KindProperty),
12571 2260 => Ok(Sensors::KindDataField),
12572 2272 => Ok(Sensors::MagnetometerAccuracyLow),
12573 2273 => Ok(Sensors::MagnetometerAccuracyMedium),
12574 2274 => Ok(Sensors::MagnetometerAccuracyHigh),
12575 2288 => Ok(Sensors::SimpleOrientationDirectionNotRotated),
12576 2289 => Ok(Sensors::SimpleOrientationDirectionRotated90DegreesCCW),
12577 2290 => Ok(Sensors::SimpleOrientationDirectionRotated180DegreesCCW),
12578 2291 => Ok(Sensors::SimpleOrientationDirectionRotated270DegreesCCW),
12579 2292 => Ok(Sensors::SimpleOrientationDirectionFaceUp),
12580 2293 => Ok(Sensors::SimpleOrientationDirectionFaceDown),
12581 2304 => Ok(Sensors::VT_NULL),
12582 2305 => Ok(Sensors::VT_BOOL),
12583 2306 => Ok(Sensors::VT_UI1),
12584 2307 => Ok(Sensors::VT_I1),
12585 2308 => Ok(Sensors::VT_UI2),
12586 2309 => Ok(Sensors::VT_I2),
12587 2310 => Ok(Sensors::VT_UI4),
12588 2311 => Ok(Sensors::VT_I4),
12589 2312 => Ok(Sensors::VT_UI8),
12590 2313 => Ok(Sensors::VT_I8),
12591 2314 => Ok(Sensors::VT_R4),
12592 2315 => Ok(Sensors::VT_R8),
12593 2316 => Ok(Sensors::VT_WSTR),
12594 2317 => Ok(Sensors::VT_STR),
12595 2318 => Ok(Sensors::VT_CLSID),
12596 2319 => Ok(Sensors::VT_VECTORVT_UI1),
12597 2320 => Ok(Sensors::VT_F16E0),
12598 2321 => Ok(Sensors::VT_F16E1),
12599 2322 => Ok(Sensors::VT_F16E2),
12600 2323 => Ok(Sensors::VT_F16E3),
12601 2324 => Ok(Sensors::VT_F16E4),
12602 2325 => Ok(Sensors::VT_F16E5),
12603 2326 => Ok(Sensors::VT_F16E6),
12604 2327 => Ok(Sensors::VT_F16E7),
12605 2328 => Ok(Sensors::VT_F16E8),
12606 2329 => Ok(Sensors::VT_F16E9),
12607 2330 => Ok(Sensors::VT_F16EA),
12608 2331 => Ok(Sensors::VT_F16EB),
12609 2332 => Ok(Sensors::VT_F16EC),
12610 2333 => Ok(Sensors::VT_F16ED),
12611 2334 => Ok(Sensors::VT_F16EE),
12612 2335 => Ok(Sensors::VT_F16EF),
12613 2336 => Ok(Sensors::VT_F32E0),
12614 2337 => Ok(Sensors::VT_F32E1),
12615 2338 => Ok(Sensors::VT_F32E2),
12616 2339 => Ok(Sensors::VT_F32E3),
12617 2340 => Ok(Sensors::VT_F32E4),
12618 2341 => Ok(Sensors::VT_F32E5),
12619 2342 => Ok(Sensors::VT_F32E6),
12620 2343 => Ok(Sensors::VT_F32E7),
12621 2344 => Ok(Sensors::VT_F32E8),
12622 2345 => Ok(Sensors::VT_F32E9),
12623 2346 => Ok(Sensors::VT_F32EA),
12624 2347 => Ok(Sensors::VT_F32EB),
12625 2348 => Ok(Sensors::VT_F32EC),
12626 2349 => Ok(Sensors::VT_F32ED),
12627 2350 => Ok(Sensors::VT_F32EE),
12628 2351 => Ok(Sensors::VT_F32EF),
12629 2352 => Ok(Sensors::ActivityTypeUnknown),
12630 2353 => Ok(Sensors::ActivityTypeStationary),
12631 2354 => Ok(Sensors::ActivityTypeFidgeting),
12632 2355 => Ok(Sensors::ActivityTypeWalking),
12633 2356 => Ok(Sensors::ActivityTypeRunning),
12634 2357 => Ok(Sensors::ActivityTypeInVehicle),
12635 2358 => Ok(Sensors::ActivityTypeBiking),
12636 2359 => Ok(Sensors::ActivityTypeIdle),
12637 2368 => Ok(Sensors::UnitNotSpecified),
12638 2369 => Ok(Sensors::UnitLux),
12639 2370 => Ok(Sensors::UnitDegreesKelvin),
12640 2371 => Ok(Sensors::UnitDegreesCelsius),
12641 2372 => Ok(Sensors::UnitPascal),
12642 2373 => Ok(Sensors::UnitNewton),
12643 2374 => Ok(Sensors::UnitMetersSecond),
12644 2375 => Ok(Sensors::UnitKilogram),
12645 2376 => Ok(Sensors::UnitMeter),
12646 2377 => Ok(Sensors::UnitMetersSecondSecond),
12647 2378 => Ok(Sensors::UnitFarad),
12648 2379 => Ok(Sensors::UnitAmpere),
12649 2380 => Ok(Sensors::UnitWatt),
12650 2381 => Ok(Sensors::UnitHenry),
12651 2382 => Ok(Sensors::UnitOhm),
12652 2383 => Ok(Sensors::UnitVolt),
12653 2384 => Ok(Sensors::UnitHertz),
12654 2385 => Ok(Sensors::UnitBar),
12655 2386 => Ok(Sensors::UnitDegreesAnticlockwise),
12656 2387 => Ok(Sensors::UnitDegreesClockwise),
12657 2388 => Ok(Sensors::UnitDegrees),
12658 2389 => Ok(Sensors::UnitDegreesSecond),
12659 2390 => Ok(Sensors::UnitDegreesSecondSecond),
12660 2391 => Ok(Sensors::UnitKnot),
12661 2392 => Ok(Sensors::UnitPercent),
12662 2393 => Ok(Sensors::UnitSecond),
12663 2394 => Ok(Sensors::UnitMillisecond),
12664 2395 => Ok(Sensors::UnitG),
12665 2396 => Ok(Sensors::UnitBytes),
12666 2397 => Ok(Sensors::UnitMilligauss),
12667 2398 => Ok(Sensors::UnitBits),
12668 2400 => Ok(Sensors::ActivityStateNoStateChange),
12669 2401 => Ok(Sensors::ActivityStateStartActivity),
12670 2402 => Ok(Sensors::ActivityStateEndActivity),
12671 2416 => Ok(Sensors::Exponent0),
12672 2417 => Ok(Sensors::Exponent1),
12673 2418 => Ok(Sensors::Exponent2),
12674 2419 => Ok(Sensors::Exponent3),
12675 2420 => Ok(Sensors::Exponent4),
12676 2421 => Ok(Sensors::Exponent5),
12677 2422 => Ok(Sensors::Exponent6),
12678 2423 => Ok(Sensors::Exponent7),
12679 2424 => Ok(Sensors::Exponent8),
12680 2425 => Ok(Sensors::Exponent9),
12681 2426 => Ok(Sensors::ExponentA),
12682 2427 => Ok(Sensors::ExponentB),
12683 2428 => Ok(Sensors::ExponentC),
12684 2429 => Ok(Sensors::ExponentD),
12685 2430 => Ok(Sensors::ExponentE),
12686 2431 => Ok(Sensors::ExponentF),
12687 2432 => Ok(Sensors::DevicePositionUnknown),
12688 2433 => Ok(Sensors::DevicePositionUnchanged),
12689 2434 => Ok(Sensors::DevicePositionOnDesk),
12690 2435 => Ok(Sensors::DevicePositionInHand),
12691 2436 => Ok(Sensors::DevicePositionMovinginBag),
12692 2437 => Ok(Sensors::DevicePositionStationaryinBag),
12693 2448 => Ok(Sensors::StepTypeUnknown),
12694 2449 => Ok(Sensors::StepTypeWalking),
12695 2450 => Ok(Sensors::StepTypeRunning),
12696 2464 => Ok(Sensors::GestureStateUnknown),
12697 2465 => Ok(Sensors::GestureStateStarted),
12698 2466 => Ok(Sensors::GestureStateCompleted),
12699 2467 => Ok(Sensors::GestureStateCancelled),
12700 2480 => Ok(Sensors::HingeFoldContributingPanelUnknown),
12701 2481 => Ok(Sensors::HingeFoldContributingPanelPanel1),
12702 2482 => Ok(Sensors::HingeFoldContributingPanelPanel2),
12703 2483 => Ok(Sensors::HingeFoldContributingPanelBoth),
12704 2484 => Ok(Sensors::HingeFoldTypeUnknown),
12705 2485 => Ok(Sensors::HingeFoldTypeIncreasing),
12706 2486 => Ok(Sensors::HingeFoldTypeDecreasing),
12707 2496 => Ok(Sensors::HumanPresenceDetectionTypeVendorDefinedNonBiometric),
12708 2497 => Ok(Sensors::HumanPresenceDetectionTypeVendorDefinedBiometric),
12709 2498 => Ok(Sensors::HumanPresenceDetectionTypeFacialBiometric),
12710 2499 => Ok(Sensors::HumanPresenceDetectionTypeAudioBiometric),
12711 4096 => Ok(Sensors::ModifierChangeSensitivityAbsolute),
12712 8192 => Ok(Sensors::ModifierMaximum),
12713 12288 => Ok(Sensors::ModifierMinimum),
12714 16384 => Ok(Sensors::ModifierAccuracy),
12715 20480 => Ok(Sensors::ModifierResolution),
12716 24576 => Ok(Sensors::ModifierThresholdHigh),
12717 28672 => Ok(Sensors::ModifierThresholdLow),
12718 32768 => Ok(Sensors::ModifierCalibrationOffset),
12719 36864 => Ok(Sensors::ModifierCalibrationMultiplier),
12720 40960 => Ok(Sensors::ModifierReportInterval),
12721 45056 => Ok(Sensors::ModifierFrequencyMax),
12722 49152 => Ok(Sensors::ModifierPeriodMax),
12723 53248 => Ok(Sensors::ModifierChangeSensitivityPercentofRange),
12724 57344 => Ok(Sensors::ModifierChangeSensitivityPercentRelative),
12725 61440 => Ok(Sensors::ModifierVendorReserved),
12726 n => Err(HutError::UnknownUsageId { usage_id: n }),
12727 }
12728 }
12729 }
12730
12731 impl BitOr<u16> for Sensors {
12732 type Output = Usage;
12733
12734 /// A convenience function to combine a Usage Page with
12735 /// a value.
12736 ///
12737 /// This function panics if the Usage ID value results in
12738 /// an unknown Usage. Where error checking is required,
12739 /// use [UsagePage::to_usage_from_value].
12740 fn bitor(self, usage: u16) -> Usage {
12741 let up = u16::from(self) as u32;
12742 let u = usage as u32;
12743 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
12744 }
12745 }
12746
12747 /// *Usage Page `0x40`: "Medical Instrument"*
12748 ///
12749 /// **This enum is autogenerated from the HID Usage Tables**.
12750 /// ```
12751 /// # use hut::*;
12752 /// let u1 = Usage::MedicalInstrument(MedicalInstrument::VCRAcquisition);
12753 /// let u2 = Usage::new_from_page_and_id(0x40, 0x20).unwrap();
12754 /// let u3 = Usage::from(MedicalInstrument::VCRAcquisition);
12755 /// let u4: Usage = MedicalInstrument::VCRAcquisition.into();
12756 /// assert_eq!(u1, u2);
12757 /// assert_eq!(u1, u3);
12758 /// assert_eq!(u1, u4);
12759 ///
12760 /// assert!(matches!(u1.usage_page(), UsagePage::MedicalInstrument));
12761 /// assert_eq!(0x40, u1.usage_page_value());
12762 /// assert_eq!(0x20, u1.usage_id_value());
12763 /// assert_eq!((0x40 << 16) | 0x20, u1.usage_value());
12764 /// assert_eq!("VCR/Acquisition", u1.name());
12765 /// ```
12766 ///
12767 #[allow(non_camel_case_types)]
12768 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
12769 #[non_exhaustive]
12770 #[repr(u16)]
12771 pub enum MedicalInstrument {
12772 /// Usage ID `0x1`: "Medical Ultrasound"
12773 MedicalUltrasound = 0x1,
12774 /// Usage ID `0x20`: "VCR/Acquisition"
12775 VCRAcquisition = 0x20,
12776 /// Usage ID `0x21`: "Freeze/Thaw"
12777 FreezeThaw = 0x21,
12778 /// Usage ID `0x22`: "Clip Store"
12779 ClipStore = 0x22,
12780 /// Usage ID `0x23`: "Update"
12781 Update = 0x23,
12782 /// Usage ID `0x24`: "Next"
12783 Next = 0x24,
12784 /// Usage ID `0x25`: "Save"
12785 Save = 0x25,
12786 /// Usage ID `0x26`: "Print"
12787 Print = 0x26,
12788 /// Usage ID `0x27`: "Microphone Enable"
12789 MicrophoneEnable = 0x27,
12790 /// Usage ID `0x40`: "Cine"
12791 Cine = 0x40,
12792 /// Usage ID `0x41`: "Transmit Power"
12793 TransmitPower = 0x41,
12794 /// Usage ID `0x42`: "Volume"
12795 Volume = 0x42,
12796 /// Usage ID `0x43`: "Focus"
12797 Focus = 0x43,
12798 /// Usage ID `0x44`: "Depth"
12799 Depth = 0x44,
12800 /// Usage ID `0x60`: "Soft Step - Primary"
12801 SoftStepPrimary = 0x60,
12802 /// Usage ID `0x61`: "Soft Step - Secondary"
12803 SoftStepSecondary = 0x61,
12804 /// Usage ID `0x70`: "Depth Gain Compensation"
12805 DepthGainCompensation = 0x70,
12806 /// Usage ID `0x80`: "Zoom Select"
12807 ZoomSelect = 0x80,
12808 /// Usage ID `0x81`: "Zoom Adjust"
12809 ZoomAdjust = 0x81,
12810 /// Usage ID `0x82`: "Spectral Doppler Mode Select"
12811 SpectralDopplerModeSelect = 0x82,
12812 /// Usage ID `0x83`: "Spectral Doppler Adjust"
12813 SpectralDopplerAdjust = 0x83,
12814 /// Usage ID `0x84`: "Color Doppler Mode Select"
12815 ColorDopplerModeSelect = 0x84,
12816 /// Usage ID `0x85`: "Color Doppler Adjust"
12817 ColorDopplerAdjust = 0x85,
12818 /// Usage ID `0x86`: "Motion Mode Select"
12819 MotionModeSelect = 0x86,
12820 /// Usage ID `0x87`: "Motion Mode Adjust"
12821 MotionModeAdjust = 0x87,
12822 /// Usage ID `0x88`: "2-D Mode Select"
12823 TwoDModeSelect = 0x88,
12824 /// Usage ID `0x89`: "2-D Mode Adjust"
12825 TwoDModeAdjust = 0x89,
12826 /// Usage ID `0xA0`: "Soft Control Select"
12827 SoftControlSelect = 0xA0,
12828 /// Usage ID `0xA1`: "Soft Control Adjust"
12829 SoftControlAdjust = 0xA1,
12830 }
12831
12832 impl MedicalInstrument {
12833 #[cfg(feature = "std")]
12834 pub fn name(&self) -> String {
12835 match self {
12836 MedicalInstrument::MedicalUltrasound => "Medical Ultrasound",
12837 MedicalInstrument::VCRAcquisition => "VCR/Acquisition",
12838 MedicalInstrument::FreezeThaw => "Freeze/Thaw",
12839 MedicalInstrument::ClipStore => "Clip Store",
12840 MedicalInstrument::Update => "Update",
12841 MedicalInstrument::Next => "Next",
12842 MedicalInstrument::Save => "Save",
12843 MedicalInstrument::Print => "Print",
12844 MedicalInstrument::MicrophoneEnable => "Microphone Enable",
12845 MedicalInstrument::Cine => "Cine",
12846 MedicalInstrument::TransmitPower => "Transmit Power",
12847 MedicalInstrument::Volume => "Volume",
12848 MedicalInstrument::Focus => "Focus",
12849 MedicalInstrument::Depth => "Depth",
12850 MedicalInstrument::SoftStepPrimary => "Soft Step - Primary",
12851 MedicalInstrument::SoftStepSecondary => "Soft Step - Secondary",
12852 MedicalInstrument::DepthGainCompensation => "Depth Gain Compensation",
12853 MedicalInstrument::ZoomSelect => "Zoom Select",
12854 MedicalInstrument::ZoomAdjust => "Zoom Adjust",
12855 MedicalInstrument::SpectralDopplerModeSelect => "Spectral Doppler Mode Select",
12856 MedicalInstrument::SpectralDopplerAdjust => "Spectral Doppler Adjust",
12857 MedicalInstrument::ColorDopplerModeSelect => "Color Doppler Mode Select",
12858 MedicalInstrument::ColorDopplerAdjust => "Color Doppler Adjust",
12859 MedicalInstrument::MotionModeSelect => "Motion Mode Select",
12860 MedicalInstrument::MotionModeAdjust => "Motion Mode Adjust",
12861 MedicalInstrument::TwoDModeSelect => "2-D Mode Select",
12862 MedicalInstrument::TwoDModeAdjust => "2-D Mode Adjust",
12863 MedicalInstrument::SoftControlSelect => "Soft Control Select",
12864 MedicalInstrument::SoftControlAdjust => "Soft Control Adjust",
12865 }
12866 .into()
12867 }
12868 }
12869
12870 #[cfg(feature = "std")]
12871 impl fmt::Display for MedicalInstrument {
12872 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
12873 write!(f, "{}", self.name())
12874 }
12875 }
12876
12877 impl AsUsage for MedicalInstrument {
12878 /// Returns the 32 bit Usage value of this Usage
12879 fn usage_value(&self) -> u32 {
12880 u32::from(self)
12881 }
12882
12883 /// Returns the 16 bit Usage ID value of this Usage
12884 fn usage_id_value(&self) -> u16 {
12885 u16::from(self)
12886 }
12887
12888 /// Returns this usage as [Usage::MedicalInstrument(self)](Usage::MedicalInstrument)
12889 /// This is a convenience function to avoid having
12890 /// to implement `From` for every used type in the caller.
12891 ///
12892 /// ```
12893 /// # use hut::*;
12894 /// let gd_x = GenericDesktop::X;
12895 /// let usage = Usage::from(GenericDesktop::X);
12896 /// assert!(matches!(gd_x.usage(), usage));
12897 /// ```
12898 fn usage(&self) -> Usage {
12899 Usage::from(self)
12900 }
12901 }
12902
12903 impl AsUsagePage for MedicalInstrument {
12904 /// Returns the 16 bit value of this UsagePage
12905 ///
12906 /// This value is `0x40` for [MedicalInstrument]
12907 fn usage_page_value(&self) -> u16 {
12908 let up = UsagePage::from(self);
12909 u16::from(up)
12910 }
12911
12912 /// Returns [UsagePage::MedicalInstrument]]
12913 fn usage_page(&self) -> UsagePage {
12914 UsagePage::from(self)
12915 }
12916 }
12917
12918 impl From<&MedicalInstrument> for u16 {
12919 fn from(medicalinstrument: &MedicalInstrument) -> u16 {
12920 *medicalinstrument as u16
12921 }
12922 }
12923
12924 impl From<MedicalInstrument> for u16 {
12925 /// Returns the 16bit value of this usage. This is identical
12926 /// to [MedicalInstrument::usage_page_value()].
12927 fn from(medicalinstrument: MedicalInstrument) -> u16 {
12928 u16::from(&medicalinstrument)
12929 }
12930 }
12931
12932 impl From<&MedicalInstrument> for u32 {
12933 /// Returns the 32 bit value of this usage. This is identical
12934 /// to [MedicalInstrument::usage_value()].
12935 fn from(medicalinstrument: &MedicalInstrument) -> u32 {
12936 let up = UsagePage::from(medicalinstrument);
12937 let up = (u16::from(&up) as u32) << 16;
12938 let id = u16::from(medicalinstrument) as u32;
12939 up | id
12940 }
12941 }
12942
12943 impl From<&MedicalInstrument> for UsagePage {
12944 /// Always returns [UsagePage::MedicalInstrument] and is
12945 /// identical to [MedicalInstrument::usage_page()].
12946 fn from(_: &MedicalInstrument) -> UsagePage {
12947 UsagePage::MedicalInstrument
12948 }
12949 }
12950
12951 impl From<MedicalInstrument> for UsagePage {
12952 /// Always returns [UsagePage::MedicalInstrument] and is
12953 /// identical to [MedicalInstrument::usage_page()].
12954 fn from(_: MedicalInstrument) -> UsagePage {
12955 UsagePage::MedicalInstrument
12956 }
12957 }
12958
12959 impl From<&MedicalInstrument> for Usage {
12960 fn from(medicalinstrument: &MedicalInstrument) -> Usage {
12961 Usage::try_from(u32::from(medicalinstrument)).unwrap()
12962 }
12963 }
12964
12965 impl From<MedicalInstrument> for Usage {
12966 fn from(medicalinstrument: MedicalInstrument) -> Usage {
12967 Usage::from(&medicalinstrument)
12968 }
12969 }
12970
12971 impl TryFrom<u16> for MedicalInstrument {
12972 type Error = HutError;
12973
12974 fn try_from(usage_id: u16) -> Result<MedicalInstrument> {
12975 match usage_id {
12976 1 => Ok(MedicalInstrument::MedicalUltrasound),
12977 32 => Ok(MedicalInstrument::VCRAcquisition),
12978 33 => Ok(MedicalInstrument::FreezeThaw),
12979 34 => Ok(MedicalInstrument::ClipStore),
12980 35 => Ok(MedicalInstrument::Update),
12981 36 => Ok(MedicalInstrument::Next),
12982 37 => Ok(MedicalInstrument::Save),
12983 38 => Ok(MedicalInstrument::Print),
12984 39 => Ok(MedicalInstrument::MicrophoneEnable),
12985 64 => Ok(MedicalInstrument::Cine),
12986 65 => Ok(MedicalInstrument::TransmitPower),
12987 66 => Ok(MedicalInstrument::Volume),
12988 67 => Ok(MedicalInstrument::Focus),
12989 68 => Ok(MedicalInstrument::Depth),
12990 96 => Ok(MedicalInstrument::SoftStepPrimary),
12991 97 => Ok(MedicalInstrument::SoftStepSecondary),
12992 112 => Ok(MedicalInstrument::DepthGainCompensation),
12993 128 => Ok(MedicalInstrument::ZoomSelect),
12994 129 => Ok(MedicalInstrument::ZoomAdjust),
12995 130 => Ok(MedicalInstrument::SpectralDopplerModeSelect),
12996 131 => Ok(MedicalInstrument::SpectralDopplerAdjust),
12997 132 => Ok(MedicalInstrument::ColorDopplerModeSelect),
12998 133 => Ok(MedicalInstrument::ColorDopplerAdjust),
12999 134 => Ok(MedicalInstrument::MotionModeSelect),
13000 135 => Ok(MedicalInstrument::MotionModeAdjust),
13001 136 => Ok(MedicalInstrument::TwoDModeSelect),
13002 137 => Ok(MedicalInstrument::TwoDModeAdjust),
13003 160 => Ok(MedicalInstrument::SoftControlSelect),
13004 161 => Ok(MedicalInstrument::SoftControlAdjust),
13005 n => Err(HutError::UnknownUsageId { usage_id: n }),
13006 }
13007 }
13008 }
13009
13010 impl BitOr<u16> for MedicalInstrument {
13011 type Output = Usage;
13012
13013 /// A convenience function to combine a Usage Page with
13014 /// a value.
13015 ///
13016 /// This function panics if the Usage ID value results in
13017 /// an unknown Usage. Where error checking is required,
13018 /// use [UsagePage::to_usage_from_value].
13019 fn bitor(self, usage: u16) -> Usage {
13020 let up = u16::from(self) as u32;
13021 let u = usage as u32;
13022 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
13023 }
13024 }
13025
13026 /// *Usage Page `0x41`: "Braille Display"*
13027 ///
13028 /// **This enum is autogenerated from the HID Usage Tables**.
13029 /// ```
13030 /// # use hut::*;
13031 /// let u1 = Usage::BrailleDisplay(BrailleDisplay::BrailleRow);
13032 /// let u2 = Usage::new_from_page_and_id(0x41, 0x2).unwrap();
13033 /// let u3 = Usage::from(BrailleDisplay::BrailleRow);
13034 /// let u4: Usage = BrailleDisplay::BrailleRow.into();
13035 /// assert_eq!(u1, u2);
13036 /// assert_eq!(u1, u3);
13037 /// assert_eq!(u1, u4);
13038 ///
13039 /// assert!(matches!(u1.usage_page(), UsagePage::BrailleDisplay));
13040 /// assert_eq!(0x41, u1.usage_page_value());
13041 /// assert_eq!(0x2, u1.usage_id_value());
13042 /// assert_eq!((0x41 << 16) | 0x2, u1.usage_value());
13043 /// assert_eq!("Braille Row", u1.name());
13044 /// ```
13045 ///
13046 #[allow(non_camel_case_types)]
13047 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
13048 #[non_exhaustive]
13049 #[repr(u16)]
13050 pub enum BrailleDisplay {
13051 /// Usage ID `0x1`: "Braille Display"
13052 BrailleDisplay = 0x1,
13053 /// Usage ID `0x2`: "Braille Row"
13054 BrailleRow = 0x2,
13055 /// Usage ID `0x3`: "8 Dot Braille Cell"
13056 EightDotBrailleCell = 0x3,
13057 /// Usage ID `0x4`: "6 Dot Braille Cell"
13058 SixDotBrailleCell = 0x4,
13059 /// Usage ID `0x5`: "Number of Braille Cells"
13060 NumberofBrailleCells = 0x5,
13061 /// Usage ID `0x6`: "Screen Reader Control"
13062 ScreenReaderControl = 0x6,
13063 /// Usage ID `0x7`: "Screen Reader Identifier"
13064 ScreenReaderIdentifier = 0x7,
13065 /// Usage ID `0xFA`: "Router Set 1"
13066 RouterSet1 = 0xFA,
13067 /// Usage ID `0xFB`: "Router Set 2"
13068 RouterSet2 = 0xFB,
13069 /// Usage ID `0xFC`: "Router Set 3"
13070 RouterSet3 = 0xFC,
13071 /// Usage ID `0x100`: "Router Key"
13072 RouterKey = 0x100,
13073 /// Usage ID `0x101`: "Row Router Key"
13074 RowRouterKey = 0x101,
13075 /// Usage ID `0x200`: "Braille Buttons"
13076 BrailleButtons = 0x200,
13077 /// Usage ID `0x201`: "Braille Keyboard Dot 1"
13078 BrailleKeyboardDot1 = 0x201,
13079 /// Usage ID `0x202`: "Braille Keyboard Dot 2"
13080 BrailleKeyboardDot2 = 0x202,
13081 /// Usage ID `0x203`: "Braille Keyboard Dot 3"
13082 BrailleKeyboardDot3 = 0x203,
13083 /// Usage ID `0x204`: "Braille Keyboard Dot 4"
13084 BrailleKeyboardDot4 = 0x204,
13085 /// Usage ID `0x205`: "Braille Keyboard Dot 5"
13086 BrailleKeyboardDot5 = 0x205,
13087 /// Usage ID `0x206`: "Braille Keyboard Dot 6"
13088 BrailleKeyboardDot6 = 0x206,
13089 /// Usage ID `0x207`: "Braille Keyboard Dot 7"
13090 BrailleKeyboardDot7 = 0x207,
13091 /// Usage ID `0x208`: "Braille Keyboard Dot 8"
13092 BrailleKeyboardDot8 = 0x208,
13093 /// Usage ID `0x209`: "Braille Keyboard Space"
13094 BrailleKeyboardSpace = 0x209,
13095 /// Usage ID `0x20A`: "Braille Keyboard Left Space"
13096 BrailleKeyboardLeftSpace = 0x20A,
13097 /// Usage ID `0x20B`: "Braille Keyboard Right Space"
13098 BrailleKeyboardRightSpace = 0x20B,
13099 /// Usage ID `0x20C`: "Braille Face Controls"
13100 BrailleFaceControls = 0x20C,
13101 /// Usage ID `0x20D`: "Braille Left Controls"
13102 BrailleLeftControls = 0x20D,
13103 /// Usage ID `0x20E`: "Braille Right Controls"
13104 BrailleRightControls = 0x20E,
13105 /// Usage ID `0x20F`: "Braille Top Controls"
13106 BrailleTopControls = 0x20F,
13107 /// Usage ID `0x210`: "Braille Joystick Center"
13108 BrailleJoystickCenter = 0x210,
13109 /// Usage ID `0x211`: "Braille Joystick Up"
13110 BrailleJoystickUp = 0x211,
13111 /// Usage ID `0x212`: "Braille Joystick Down"
13112 BrailleJoystickDown = 0x212,
13113 /// Usage ID `0x213`: "Braille Joystick Left"
13114 BrailleJoystickLeft = 0x213,
13115 /// Usage ID `0x214`: "Braille Joystick Right"
13116 BrailleJoystickRight = 0x214,
13117 /// Usage ID `0x215`: "Braille D-Pad Center"
13118 BrailleDPadCenter = 0x215,
13119 /// Usage ID `0x216`: "Braille D-Pad Up"
13120 BrailleDPadUp = 0x216,
13121 /// Usage ID `0x217`: "Braille D-Pad Down"
13122 BrailleDPadDown = 0x217,
13123 /// Usage ID `0x218`: "Braille D-Pad Left"
13124 BrailleDPadLeft = 0x218,
13125 /// Usage ID `0x219`: "Braille D-Pad Right"
13126 BrailleDPadRight = 0x219,
13127 /// Usage ID `0x21A`: "Braille Pan Left"
13128 BraillePanLeft = 0x21A,
13129 /// Usage ID `0x21B`: "Braille Pan Right"
13130 BraillePanRight = 0x21B,
13131 /// Usage ID `0x21C`: "Braille Rocker Up"
13132 BrailleRockerUp = 0x21C,
13133 /// Usage ID `0x21D`: "Braille Rocker Down"
13134 BrailleRockerDown = 0x21D,
13135 /// Usage ID `0x21E`: "Braille Rocker Press"
13136 BrailleRockerPress = 0x21E,
13137 }
13138
13139 impl BrailleDisplay {
13140 #[cfg(feature = "std")]
13141 pub fn name(&self) -> String {
13142 match self {
13143 BrailleDisplay::BrailleDisplay => "Braille Display",
13144 BrailleDisplay::BrailleRow => "Braille Row",
13145 BrailleDisplay::EightDotBrailleCell => "8 Dot Braille Cell",
13146 BrailleDisplay::SixDotBrailleCell => "6 Dot Braille Cell",
13147 BrailleDisplay::NumberofBrailleCells => "Number of Braille Cells",
13148 BrailleDisplay::ScreenReaderControl => "Screen Reader Control",
13149 BrailleDisplay::ScreenReaderIdentifier => "Screen Reader Identifier",
13150 BrailleDisplay::RouterSet1 => "Router Set 1",
13151 BrailleDisplay::RouterSet2 => "Router Set 2",
13152 BrailleDisplay::RouterSet3 => "Router Set 3",
13153 BrailleDisplay::RouterKey => "Router Key",
13154 BrailleDisplay::RowRouterKey => "Row Router Key",
13155 BrailleDisplay::BrailleButtons => "Braille Buttons",
13156 BrailleDisplay::BrailleKeyboardDot1 => "Braille Keyboard Dot 1",
13157 BrailleDisplay::BrailleKeyboardDot2 => "Braille Keyboard Dot 2",
13158 BrailleDisplay::BrailleKeyboardDot3 => "Braille Keyboard Dot 3",
13159 BrailleDisplay::BrailleKeyboardDot4 => "Braille Keyboard Dot 4",
13160 BrailleDisplay::BrailleKeyboardDot5 => "Braille Keyboard Dot 5",
13161 BrailleDisplay::BrailleKeyboardDot6 => "Braille Keyboard Dot 6",
13162 BrailleDisplay::BrailleKeyboardDot7 => "Braille Keyboard Dot 7",
13163 BrailleDisplay::BrailleKeyboardDot8 => "Braille Keyboard Dot 8",
13164 BrailleDisplay::BrailleKeyboardSpace => "Braille Keyboard Space",
13165 BrailleDisplay::BrailleKeyboardLeftSpace => "Braille Keyboard Left Space",
13166 BrailleDisplay::BrailleKeyboardRightSpace => "Braille Keyboard Right Space",
13167 BrailleDisplay::BrailleFaceControls => "Braille Face Controls",
13168 BrailleDisplay::BrailleLeftControls => "Braille Left Controls",
13169 BrailleDisplay::BrailleRightControls => "Braille Right Controls",
13170 BrailleDisplay::BrailleTopControls => "Braille Top Controls",
13171 BrailleDisplay::BrailleJoystickCenter => "Braille Joystick Center",
13172 BrailleDisplay::BrailleJoystickUp => "Braille Joystick Up",
13173 BrailleDisplay::BrailleJoystickDown => "Braille Joystick Down",
13174 BrailleDisplay::BrailleJoystickLeft => "Braille Joystick Left",
13175 BrailleDisplay::BrailleJoystickRight => "Braille Joystick Right",
13176 BrailleDisplay::BrailleDPadCenter => "Braille D-Pad Center",
13177 BrailleDisplay::BrailleDPadUp => "Braille D-Pad Up",
13178 BrailleDisplay::BrailleDPadDown => "Braille D-Pad Down",
13179 BrailleDisplay::BrailleDPadLeft => "Braille D-Pad Left",
13180 BrailleDisplay::BrailleDPadRight => "Braille D-Pad Right",
13181 BrailleDisplay::BraillePanLeft => "Braille Pan Left",
13182 BrailleDisplay::BraillePanRight => "Braille Pan Right",
13183 BrailleDisplay::BrailleRockerUp => "Braille Rocker Up",
13184 BrailleDisplay::BrailleRockerDown => "Braille Rocker Down",
13185 BrailleDisplay::BrailleRockerPress => "Braille Rocker Press",
13186 }
13187 .into()
13188 }
13189 }
13190
13191 #[cfg(feature = "std")]
13192 impl fmt::Display for BrailleDisplay {
13193 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
13194 write!(f, "{}", self.name())
13195 }
13196 }
13197
13198 impl AsUsage for BrailleDisplay {
13199 /// Returns the 32 bit Usage value of this Usage
13200 fn usage_value(&self) -> u32 {
13201 u32::from(self)
13202 }
13203
13204 /// Returns the 16 bit Usage ID value of this Usage
13205 fn usage_id_value(&self) -> u16 {
13206 u16::from(self)
13207 }
13208
13209 /// Returns this usage as [Usage::BrailleDisplay(self)](Usage::BrailleDisplay)
13210 /// This is a convenience function to avoid having
13211 /// to implement `From` for every used type in the caller.
13212 ///
13213 /// ```
13214 /// # use hut::*;
13215 /// let gd_x = GenericDesktop::X;
13216 /// let usage = Usage::from(GenericDesktop::X);
13217 /// assert!(matches!(gd_x.usage(), usage));
13218 /// ```
13219 fn usage(&self) -> Usage {
13220 Usage::from(self)
13221 }
13222 }
13223
13224 impl AsUsagePage for BrailleDisplay {
13225 /// Returns the 16 bit value of this UsagePage
13226 ///
13227 /// This value is `0x41` for [BrailleDisplay]
13228 fn usage_page_value(&self) -> u16 {
13229 let up = UsagePage::from(self);
13230 u16::from(up)
13231 }
13232
13233 /// Returns [UsagePage::BrailleDisplay]]
13234 fn usage_page(&self) -> UsagePage {
13235 UsagePage::from(self)
13236 }
13237 }
13238
13239 impl From<&BrailleDisplay> for u16 {
13240 fn from(brailledisplay: &BrailleDisplay) -> u16 {
13241 *brailledisplay as u16
13242 }
13243 }
13244
13245 impl From<BrailleDisplay> for u16 {
13246 /// Returns the 16bit value of this usage. This is identical
13247 /// to [BrailleDisplay::usage_page_value()].
13248 fn from(brailledisplay: BrailleDisplay) -> u16 {
13249 u16::from(&brailledisplay)
13250 }
13251 }
13252
13253 impl From<&BrailleDisplay> for u32 {
13254 /// Returns the 32 bit value of this usage. This is identical
13255 /// to [BrailleDisplay::usage_value()].
13256 fn from(brailledisplay: &BrailleDisplay) -> u32 {
13257 let up = UsagePage::from(brailledisplay);
13258 let up = (u16::from(&up) as u32) << 16;
13259 let id = u16::from(brailledisplay) as u32;
13260 up | id
13261 }
13262 }
13263
13264 impl From<&BrailleDisplay> for UsagePage {
13265 /// Always returns [UsagePage::BrailleDisplay] and is
13266 /// identical to [BrailleDisplay::usage_page()].
13267 fn from(_: &BrailleDisplay) -> UsagePage {
13268 UsagePage::BrailleDisplay
13269 }
13270 }
13271
13272 impl From<BrailleDisplay> for UsagePage {
13273 /// Always returns [UsagePage::BrailleDisplay] and is
13274 /// identical to [BrailleDisplay::usage_page()].
13275 fn from(_: BrailleDisplay) -> UsagePage {
13276 UsagePage::BrailleDisplay
13277 }
13278 }
13279
13280 impl From<&BrailleDisplay> for Usage {
13281 fn from(brailledisplay: &BrailleDisplay) -> Usage {
13282 Usage::try_from(u32::from(brailledisplay)).unwrap()
13283 }
13284 }
13285
13286 impl From<BrailleDisplay> for Usage {
13287 fn from(brailledisplay: BrailleDisplay) -> Usage {
13288 Usage::from(&brailledisplay)
13289 }
13290 }
13291
13292 impl TryFrom<u16> for BrailleDisplay {
13293 type Error = HutError;
13294
13295 fn try_from(usage_id: u16) -> Result<BrailleDisplay> {
13296 match usage_id {
13297 1 => Ok(BrailleDisplay::BrailleDisplay),
13298 2 => Ok(BrailleDisplay::BrailleRow),
13299 3 => Ok(BrailleDisplay::EightDotBrailleCell),
13300 4 => Ok(BrailleDisplay::SixDotBrailleCell),
13301 5 => Ok(BrailleDisplay::NumberofBrailleCells),
13302 6 => Ok(BrailleDisplay::ScreenReaderControl),
13303 7 => Ok(BrailleDisplay::ScreenReaderIdentifier),
13304 250 => Ok(BrailleDisplay::RouterSet1),
13305 251 => Ok(BrailleDisplay::RouterSet2),
13306 252 => Ok(BrailleDisplay::RouterSet3),
13307 256 => Ok(BrailleDisplay::RouterKey),
13308 257 => Ok(BrailleDisplay::RowRouterKey),
13309 512 => Ok(BrailleDisplay::BrailleButtons),
13310 513 => Ok(BrailleDisplay::BrailleKeyboardDot1),
13311 514 => Ok(BrailleDisplay::BrailleKeyboardDot2),
13312 515 => Ok(BrailleDisplay::BrailleKeyboardDot3),
13313 516 => Ok(BrailleDisplay::BrailleKeyboardDot4),
13314 517 => Ok(BrailleDisplay::BrailleKeyboardDot5),
13315 518 => Ok(BrailleDisplay::BrailleKeyboardDot6),
13316 519 => Ok(BrailleDisplay::BrailleKeyboardDot7),
13317 520 => Ok(BrailleDisplay::BrailleKeyboardDot8),
13318 521 => Ok(BrailleDisplay::BrailleKeyboardSpace),
13319 522 => Ok(BrailleDisplay::BrailleKeyboardLeftSpace),
13320 523 => Ok(BrailleDisplay::BrailleKeyboardRightSpace),
13321 524 => Ok(BrailleDisplay::BrailleFaceControls),
13322 525 => Ok(BrailleDisplay::BrailleLeftControls),
13323 526 => Ok(BrailleDisplay::BrailleRightControls),
13324 527 => Ok(BrailleDisplay::BrailleTopControls),
13325 528 => Ok(BrailleDisplay::BrailleJoystickCenter),
13326 529 => Ok(BrailleDisplay::BrailleJoystickUp),
13327 530 => Ok(BrailleDisplay::BrailleJoystickDown),
13328 531 => Ok(BrailleDisplay::BrailleJoystickLeft),
13329 532 => Ok(BrailleDisplay::BrailleJoystickRight),
13330 533 => Ok(BrailleDisplay::BrailleDPadCenter),
13331 534 => Ok(BrailleDisplay::BrailleDPadUp),
13332 535 => Ok(BrailleDisplay::BrailleDPadDown),
13333 536 => Ok(BrailleDisplay::BrailleDPadLeft),
13334 537 => Ok(BrailleDisplay::BrailleDPadRight),
13335 538 => Ok(BrailleDisplay::BraillePanLeft),
13336 539 => Ok(BrailleDisplay::BraillePanRight),
13337 540 => Ok(BrailleDisplay::BrailleRockerUp),
13338 541 => Ok(BrailleDisplay::BrailleRockerDown),
13339 542 => Ok(BrailleDisplay::BrailleRockerPress),
13340 n => Err(HutError::UnknownUsageId { usage_id: n }),
13341 }
13342 }
13343 }
13344
13345 impl BitOr<u16> for BrailleDisplay {
13346 type Output = Usage;
13347
13348 /// A convenience function to combine a Usage Page with
13349 /// a value.
13350 ///
13351 /// This function panics if the Usage ID value results in
13352 /// an unknown Usage. Where error checking is required,
13353 /// use [UsagePage::to_usage_from_value].
13354 fn bitor(self, usage: u16) -> Usage {
13355 let up = u16::from(self) as u32;
13356 let u = usage as u32;
13357 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
13358 }
13359 }
13360
13361 /// *Usage Page `0x59`: "Lighting And Illumination"*
13362 ///
13363 /// **This enum is autogenerated from the HID Usage Tables**.
13364 /// ```
13365 /// # use hut::*;
13366 /// let u1 = Usage::LightingAndIllumination(LightingAndIllumination::LampArrayAttributesReport);
13367 /// let u2 = Usage::new_from_page_and_id(0x59, 0x2).unwrap();
13368 /// let u3 = Usage::from(LightingAndIllumination::LampArrayAttributesReport);
13369 /// let u4: Usage = LightingAndIllumination::LampArrayAttributesReport.into();
13370 /// assert_eq!(u1, u2);
13371 /// assert_eq!(u1, u3);
13372 /// assert_eq!(u1, u4);
13373 ///
13374 /// assert!(matches!(u1.usage_page(), UsagePage::LightingAndIllumination));
13375 /// assert_eq!(0x59, u1.usage_page_value());
13376 /// assert_eq!(0x2, u1.usage_id_value());
13377 /// assert_eq!((0x59 << 16) | 0x2, u1.usage_value());
13378 /// assert_eq!("LampArrayAttributesReport", u1.name());
13379 /// ```
13380 ///
13381 #[allow(non_camel_case_types)]
13382 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
13383 #[non_exhaustive]
13384 #[repr(u16)]
13385 pub enum LightingAndIllumination {
13386 /// Usage ID `0x1`: "LampArray"
13387 LampArray = 0x1,
13388 /// Usage ID `0x2`: "LampArrayAttributesReport"
13389 LampArrayAttributesReport = 0x2,
13390 /// Usage ID `0x3`: "LampCount"
13391 LampCount = 0x3,
13392 /// Usage ID `0x4`: "BoundingBoxWidthInMicrometers"
13393 BoundingBoxWidthInMicrometers = 0x4,
13394 /// Usage ID `0x5`: "BoundingBoxHeightInMicrometers"
13395 BoundingBoxHeightInMicrometers = 0x5,
13396 /// Usage ID `0x6`: "BoundingBoxDepthInMicrometers"
13397 BoundingBoxDepthInMicrometers = 0x6,
13398 /// Usage ID `0x7`: "LampArrayKind"
13399 LampArrayKind = 0x7,
13400 /// Usage ID `0x8`: "MinUpdateIntervalInMicroseconds"
13401 MinUpdateIntervalInMicroseconds = 0x8,
13402 /// Usage ID `0x20`: "LampAttributesRequestReport"
13403 LampAttributesRequestReport = 0x20,
13404 /// Usage ID `0x21`: "LampId"
13405 LampId = 0x21,
13406 /// Usage ID `0x22`: "LampAttributesResponseReport"
13407 LampAttributesResponseReport = 0x22,
13408 /// Usage ID `0x23`: "PositionXInMicrometers"
13409 PositionXInMicrometers = 0x23,
13410 /// Usage ID `0x24`: "PositionYInMicrometers"
13411 PositionYInMicrometers = 0x24,
13412 /// Usage ID `0x25`: "PositionZInMicrometers"
13413 PositionZInMicrometers = 0x25,
13414 /// Usage ID `0x26`: "LampPurposes"
13415 LampPurposes = 0x26,
13416 /// Usage ID `0x27`: "UpdateLatencyInMicroseconds"
13417 UpdateLatencyInMicroseconds = 0x27,
13418 /// Usage ID `0x28`: "RedLevelCount"
13419 RedLevelCount = 0x28,
13420 /// Usage ID `0x29`: "GreenLevelCount"
13421 GreenLevelCount = 0x29,
13422 /// Usage ID `0x2A`: "BlueLevelCount"
13423 BlueLevelCount = 0x2A,
13424 /// Usage ID `0x2B`: "IntensityLevelCount"
13425 IntensityLevelCount = 0x2B,
13426 /// Usage ID `0x2C`: "IsProgrammable"
13427 IsProgrammable = 0x2C,
13428 /// Usage ID `0x2D`: "InputBinding"
13429 InputBinding = 0x2D,
13430 /// Usage ID `0x50`: "LampMultiUpdateReport"
13431 LampMultiUpdateReport = 0x50,
13432 /// Usage ID `0x51`: "RedUpdateChannel"
13433 RedUpdateChannel = 0x51,
13434 /// Usage ID `0x52`: "GreenUpdateChannel"
13435 GreenUpdateChannel = 0x52,
13436 /// Usage ID `0x53`: "BlueUpdateChannel"
13437 BlueUpdateChannel = 0x53,
13438 /// Usage ID `0x54`: "IntensityUpdateChannel"
13439 IntensityUpdateChannel = 0x54,
13440 /// Usage ID `0x55`: "LampUpdateFlags"
13441 LampUpdateFlags = 0x55,
13442 /// Usage ID `0x60`: "LampRangeUpdateReport"
13443 LampRangeUpdateReport = 0x60,
13444 /// Usage ID `0x61`: "LampIdStart"
13445 LampIdStart = 0x61,
13446 /// Usage ID `0x62`: "LampIdEnd"
13447 LampIdEnd = 0x62,
13448 /// Usage ID `0x70`: "LampArrayControlReport"
13449 LampArrayControlReport = 0x70,
13450 /// Usage ID `0x71`: "AutonomousMode"
13451 AutonomousMode = 0x71,
13452 }
13453
13454 impl LightingAndIllumination {
13455 #[cfg(feature = "std")]
13456 pub fn name(&self) -> String {
13457 match self {
13458 LightingAndIllumination::LampArray => "LampArray",
13459 LightingAndIllumination::LampArrayAttributesReport => "LampArrayAttributesReport",
13460 LightingAndIllumination::LampCount => "LampCount",
13461 LightingAndIllumination::BoundingBoxWidthInMicrometers => {
13462 "BoundingBoxWidthInMicrometers"
13463 }
13464 LightingAndIllumination::BoundingBoxHeightInMicrometers => {
13465 "BoundingBoxHeightInMicrometers"
13466 }
13467 LightingAndIllumination::BoundingBoxDepthInMicrometers => {
13468 "BoundingBoxDepthInMicrometers"
13469 }
13470 LightingAndIllumination::LampArrayKind => "LampArrayKind",
13471 LightingAndIllumination::MinUpdateIntervalInMicroseconds => {
13472 "MinUpdateIntervalInMicroseconds"
13473 }
13474 LightingAndIllumination::LampAttributesRequestReport => "LampAttributesRequestReport",
13475 LightingAndIllumination::LampId => "LampId",
13476 LightingAndIllumination::LampAttributesResponseReport => "LampAttributesResponseReport",
13477 LightingAndIllumination::PositionXInMicrometers => "PositionXInMicrometers",
13478 LightingAndIllumination::PositionYInMicrometers => "PositionYInMicrometers",
13479 LightingAndIllumination::PositionZInMicrometers => "PositionZInMicrometers",
13480 LightingAndIllumination::LampPurposes => "LampPurposes",
13481 LightingAndIllumination::UpdateLatencyInMicroseconds => "UpdateLatencyInMicroseconds",
13482 LightingAndIllumination::RedLevelCount => "RedLevelCount",
13483 LightingAndIllumination::GreenLevelCount => "GreenLevelCount",
13484 LightingAndIllumination::BlueLevelCount => "BlueLevelCount",
13485 LightingAndIllumination::IntensityLevelCount => "IntensityLevelCount",
13486 LightingAndIllumination::IsProgrammable => "IsProgrammable",
13487 LightingAndIllumination::InputBinding => "InputBinding",
13488 LightingAndIllumination::LampMultiUpdateReport => "LampMultiUpdateReport",
13489 LightingAndIllumination::RedUpdateChannel => "RedUpdateChannel",
13490 LightingAndIllumination::GreenUpdateChannel => "GreenUpdateChannel",
13491 LightingAndIllumination::BlueUpdateChannel => "BlueUpdateChannel",
13492 LightingAndIllumination::IntensityUpdateChannel => "IntensityUpdateChannel",
13493 LightingAndIllumination::LampUpdateFlags => "LampUpdateFlags",
13494 LightingAndIllumination::LampRangeUpdateReport => "LampRangeUpdateReport",
13495 LightingAndIllumination::LampIdStart => "LampIdStart",
13496 LightingAndIllumination::LampIdEnd => "LampIdEnd",
13497 LightingAndIllumination::LampArrayControlReport => "LampArrayControlReport",
13498 LightingAndIllumination::AutonomousMode => "AutonomousMode",
13499 }
13500 .into()
13501 }
13502 }
13503
13504 #[cfg(feature = "std")]
13505 impl fmt::Display for LightingAndIllumination {
13506 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
13507 write!(f, "{}", self.name())
13508 }
13509 }
13510
13511 impl AsUsage for LightingAndIllumination {
13512 /// Returns the 32 bit Usage value of this Usage
13513 fn usage_value(&self) -> u32 {
13514 u32::from(self)
13515 }
13516
13517 /// Returns the 16 bit Usage ID value of this Usage
13518 fn usage_id_value(&self) -> u16 {
13519 u16::from(self)
13520 }
13521
13522 /// Returns this usage as [Usage::LightingAndIllumination(self)](Usage::LightingAndIllumination)
13523 /// This is a convenience function to avoid having
13524 /// to implement `From` for every used type in the caller.
13525 ///
13526 /// ```
13527 /// # use hut::*;
13528 /// let gd_x = GenericDesktop::X;
13529 /// let usage = Usage::from(GenericDesktop::X);
13530 /// assert!(matches!(gd_x.usage(), usage));
13531 /// ```
13532 fn usage(&self) -> Usage {
13533 Usage::from(self)
13534 }
13535 }
13536
13537 impl AsUsagePage for LightingAndIllumination {
13538 /// Returns the 16 bit value of this UsagePage
13539 ///
13540 /// This value is `0x59` for [LightingAndIllumination]
13541 fn usage_page_value(&self) -> u16 {
13542 let up = UsagePage::from(self);
13543 u16::from(up)
13544 }
13545
13546 /// Returns [UsagePage::LightingAndIllumination]]
13547 fn usage_page(&self) -> UsagePage {
13548 UsagePage::from(self)
13549 }
13550 }
13551
13552 impl From<&LightingAndIllumination> for u16 {
13553 fn from(lightingandillumination: &LightingAndIllumination) -> u16 {
13554 *lightingandillumination as u16
13555 }
13556 }
13557
13558 impl From<LightingAndIllumination> for u16 {
13559 /// Returns the 16bit value of this usage. This is identical
13560 /// to [LightingAndIllumination::usage_page_value()].
13561 fn from(lightingandillumination: LightingAndIllumination) -> u16 {
13562 u16::from(&lightingandillumination)
13563 }
13564 }
13565
13566 impl From<&LightingAndIllumination> for u32 {
13567 /// Returns the 32 bit value of this usage. This is identical
13568 /// to [LightingAndIllumination::usage_value()].
13569 fn from(lightingandillumination: &LightingAndIllumination) -> u32 {
13570 let up = UsagePage::from(lightingandillumination);
13571 let up = (u16::from(&up) as u32) << 16;
13572 let id = u16::from(lightingandillumination) as u32;
13573 up | id
13574 }
13575 }
13576
13577 impl From<&LightingAndIllumination> for UsagePage {
13578 /// Always returns [UsagePage::LightingAndIllumination] and is
13579 /// identical to [LightingAndIllumination::usage_page()].
13580 fn from(_: &LightingAndIllumination) -> UsagePage {
13581 UsagePage::LightingAndIllumination
13582 }
13583 }
13584
13585 impl From<LightingAndIllumination> for UsagePage {
13586 /// Always returns [UsagePage::LightingAndIllumination] and is
13587 /// identical to [LightingAndIllumination::usage_page()].
13588 fn from(_: LightingAndIllumination) -> UsagePage {
13589 UsagePage::LightingAndIllumination
13590 }
13591 }
13592
13593 impl From<&LightingAndIllumination> for Usage {
13594 fn from(lightingandillumination: &LightingAndIllumination) -> Usage {
13595 Usage::try_from(u32::from(lightingandillumination)).unwrap()
13596 }
13597 }
13598
13599 impl From<LightingAndIllumination> for Usage {
13600 fn from(lightingandillumination: LightingAndIllumination) -> Usage {
13601 Usage::from(&lightingandillumination)
13602 }
13603 }
13604
13605 impl TryFrom<u16> for LightingAndIllumination {
13606 type Error = HutError;
13607
13608 fn try_from(usage_id: u16) -> Result<LightingAndIllumination> {
13609 match usage_id {
13610 1 => Ok(LightingAndIllumination::LampArray),
13611 2 => Ok(LightingAndIllumination::LampArrayAttributesReport),
13612 3 => Ok(LightingAndIllumination::LampCount),
13613 4 => Ok(LightingAndIllumination::BoundingBoxWidthInMicrometers),
13614 5 => Ok(LightingAndIllumination::BoundingBoxHeightInMicrometers),
13615 6 => Ok(LightingAndIllumination::BoundingBoxDepthInMicrometers),
13616 7 => Ok(LightingAndIllumination::LampArrayKind),
13617 8 => Ok(LightingAndIllumination::MinUpdateIntervalInMicroseconds),
13618 32 => Ok(LightingAndIllumination::LampAttributesRequestReport),
13619 33 => Ok(LightingAndIllumination::LampId),
13620 34 => Ok(LightingAndIllumination::LampAttributesResponseReport),
13621 35 => Ok(LightingAndIllumination::PositionXInMicrometers),
13622 36 => Ok(LightingAndIllumination::PositionYInMicrometers),
13623 37 => Ok(LightingAndIllumination::PositionZInMicrometers),
13624 38 => Ok(LightingAndIllumination::LampPurposes),
13625 39 => Ok(LightingAndIllumination::UpdateLatencyInMicroseconds),
13626 40 => Ok(LightingAndIllumination::RedLevelCount),
13627 41 => Ok(LightingAndIllumination::GreenLevelCount),
13628 42 => Ok(LightingAndIllumination::BlueLevelCount),
13629 43 => Ok(LightingAndIllumination::IntensityLevelCount),
13630 44 => Ok(LightingAndIllumination::IsProgrammable),
13631 45 => Ok(LightingAndIllumination::InputBinding),
13632 80 => Ok(LightingAndIllumination::LampMultiUpdateReport),
13633 81 => Ok(LightingAndIllumination::RedUpdateChannel),
13634 82 => Ok(LightingAndIllumination::GreenUpdateChannel),
13635 83 => Ok(LightingAndIllumination::BlueUpdateChannel),
13636 84 => Ok(LightingAndIllumination::IntensityUpdateChannel),
13637 85 => Ok(LightingAndIllumination::LampUpdateFlags),
13638 96 => Ok(LightingAndIllumination::LampRangeUpdateReport),
13639 97 => Ok(LightingAndIllumination::LampIdStart),
13640 98 => Ok(LightingAndIllumination::LampIdEnd),
13641 112 => Ok(LightingAndIllumination::LampArrayControlReport),
13642 113 => Ok(LightingAndIllumination::AutonomousMode),
13643 n => Err(HutError::UnknownUsageId { usage_id: n }),
13644 }
13645 }
13646 }
13647
13648 impl BitOr<u16> for LightingAndIllumination {
13649 type Output = Usage;
13650
13651 /// A convenience function to combine a Usage Page with
13652 /// a value.
13653 ///
13654 /// This function panics if the Usage ID value results in
13655 /// an unknown Usage. Where error checking is required,
13656 /// use [UsagePage::to_usage_from_value].
13657 fn bitor(self, usage: u16) -> Usage {
13658 let up = u16::from(self) as u32;
13659 let u = usage as u32;
13660 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
13661 }
13662 }
13663
13664 /// *Usage Page `0x80`: "Monitor"*
13665 ///
13666 /// **This enum is autogenerated from the HID Usage Tables**.
13667 /// ```
13668 /// # use hut::*;
13669 /// let u1 = Usage::Monitor(Monitor::EDIDInformation);
13670 /// let u2 = Usage::new_from_page_and_id(0x80, 0x2).unwrap();
13671 /// let u3 = Usage::from(Monitor::EDIDInformation);
13672 /// let u4: Usage = Monitor::EDIDInformation.into();
13673 /// assert_eq!(u1, u2);
13674 /// assert_eq!(u1, u3);
13675 /// assert_eq!(u1, u4);
13676 ///
13677 /// assert!(matches!(u1.usage_page(), UsagePage::Monitor));
13678 /// assert_eq!(0x80, u1.usage_page_value());
13679 /// assert_eq!(0x2, u1.usage_id_value());
13680 /// assert_eq!((0x80 << 16) | 0x2, u1.usage_value());
13681 /// assert_eq!("EDID Information", u1.name());
13682 /// ```
13683 ///
13684 #[allow(non_camel_case_types)]
13685 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
13686 #[non_exhaustive]
13687 #[repr(u16)]
13688 pub enum Monitor {
13689 /// Usage ID `0x1`: "Monitor Control"
13690 MonitorControl = 0x1,
13691 /// Usage ID `0x2`: "EDID Information"
13692 EDIDInformation = 0x2,
13693 /// Usage ID `0x3`: "VDIF Information"
13694 VDIFInformation = 0x3,
13695 /// Usage ID `0x4`: "VESA Version"
13696 VESAVersion = 0x4,
13697 }
13698
13699 impl Monitor {
13700 #[cfg(feature = "std")]
13701 pub fn name(&self) -> String {
13702 match self {
13703 Monitor::MonitorControl => "Monitor Control",
13704 Monitor::EDIDInformation => "EDID Information",
13705 Monitor::VDIFInformation => "VDIF Information",
13706 Monitor::VESAVersion => "VESA Version",
13707 }
13708 .into()
13709 }
13710 }
13711
13712 #[cfg(feature = "std")]
13713 impl fmt::Display for Monitor {
13714 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
13715 write!(f, "{}", self.name())
13716 }
13717 }
13718
13719 impl AsUsage for Monitor {
13720 /// Returns the 32 bit Usage value of this Usage
13721 fn usage_value(&self) -> u32 {
13722 u32::from(self)
13723 }
13724
13725 /// Returns the 16 bit Usage ID value of this Usage
13726 fn usage_id_value(&self) -> u16 {
13727 u16::from(self)
13728 }
13729
13730 /// Returns this usage as [Usage::Monitor(self)](Usage::Monitor)
13731 /// This is a convenience function to avoid having
13732 /// to implement `From` for every used type in the caller.
13733 ///
13734 /// ```
13735 /// # use hut::*;
13736 /// let gd_x = GenericDesktop::X;
13737 /// let usage = Usage::from(GenericDesktop::X);
13738 /// assert!(matches!(gd_x.usage(), usage));
13739 /// ```
13740 fn usage(&self) -> Usage {
13741 Usage::from(self)
13742 }
13743 }
13744
13745 impl AsUsagePage for Monitor {
13746 /// Returns the 16 bit value of this UsagePage
13747 ///
13748 /// This value is `0x80` for [Monitor]
13749 fn usage_page_value(&self) -> u16 {
13750 let up = UsagePage::from(self);
13751 u16::from(up)
13752 }
13753
13754 /// Returns [UsagePage::Monitor]]
13755 fn usage_page(&self) -> UsagePage {
13756 UsagePage::from(self)
13757 }
13758 }
13759
13760 impl From<&Monitor> for u16 {
13761 fn from(monitor: &Monitor) -> u16 {
13762 *monitor as u16
13763 }
13764 }
13765
13766 impl From<Monitor> for u16 {
13767 /// Returns the 16bit value of this usage. This is identical
13768 /// to [Monitor::usage_page_value()].
13769 fn from(monitor: Monitor) -> u16 {
13770 u16::from(&monitor)
13771 }
13772 }
13773
13774 impl From<&Monitor> for u32 {
13775 /// Returns the 32 bit value of this usage. This is identical
13776 /// to [Monitor::usage_value()].
13777 fn from(monitor: &Monitor) -> u32 {
13778 let up = UsagePage::from(monitor);
13779 let up = (u16::from(&up) as u32) << 16;
13780 let id = u16::from(monitor) as u32;
13781 up | id
13782 }
13783 }
13784
13785 impl From<&Monitor> for UsagePage {
13786 /// Always returns [UsagePage::Monitor] and is
13787 /// identical to [Monitor::usage_page()].
13788 fn from(_: &Monitor) -> UsagePage {
13789 UsagePage::Monitor
13790 }
13791 }
13792
13793 impl From<Monitor> for UsagePage {
13794 /// Always returns [UsagePage::Monitor] and is
13795 /// identical to [Monitor::usage_page()].
13796 fn from(_: Monitor) -> UsagePage {
13797 UsagePage::Monitor
13798 }
13799 }
13800
13801 impl From<&Monitor> for Usage {
13802 fn from(monitor: &Monitor) -> Usage {
13803 Usage::try_from(u32::from(monitor)).unwrap()
13804 }
13805 }
13806
13807 impl From<Monitor> for Usage {
13808 fn from(monitor: Monitor) -> Usage {
13809 Usage::from(&monitor)
13810 }
13811 }
13812
13813 impl TryFrom<u16> for Monitor {
13814 type Error = HutError;
13815
13816 fn try_from(usage_id: u16) -> Result<Monitor> {
13817 match usage_id {
13818 1 => Ok(Monitor::MonitorControl),
13819 2 => Ok(Monitor::EDIDInformation),
13820 3 => Ok(Monitor::VDIFInformation),
13821 4 => Ok(Monitor::VESAVersion),
13822 n => Err(HutError::UnknownUsageId { usage_id: n }),
13823 }
13824 }
13825 }
13826
13827 impl BitOr<u16> for Monitor {
13828 type Output = Usage;
13829
13830 /// A convenience function to combine a Usage Page with
13831 /// a value.
13832 ///
13833 /// This function panics if the Usage ID value results in
13834 /// an unknown Usage. Where error checking is required,
13835 /// use [UsagePage::to_usage_from_value].
13836 fn bitor(self, usage: u16) -> Usage {
13837 let up = u16::from(self) as u32;
13838 let u = usage as u32;
13839 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
13840 }
13841 }
13842
13843 /// *Usage Page `0x81`: "Monitor Enumerated"*
13844 ///
13845 /// **This enum is autogenerated from the HID Usage Tables**.
13846 ///
13847 /// This Usage Page is generated, not defined, any Usage IDs in this Usage
13848 /// Page are simply the enumerate number.
13849 ///
13850 /// ```
13851 /// # use hut::*;
13852 /// let u1 = Usage::MonitorEnumerated(MonitorEnumerated::MonitorEnumerated(3));
13853 /// let u2 = Usage::new_from_page_and_id(0x81, 3).unwrap();
13854 /// let u3 = Usage::from(MonitorEnumerated::MonitorEnumerated(3));
13855 /// let u4: Usage = MonitorEnumerated::MonitorEnumerated(3).into();
13856 /// assert_eq!(u1, u2);
13857 /// assert_eq!(u1, u3);
13858 /// assert_eq!(u1, u4);
13859 ///
13860 /// assert!(matches!(u1.usage_page(), UsagePage::MonitorEnumerated));
13861 /// assert_eq!(0x81, u1.usage_page_value());
13862 /// assert_eq!(3, u1.usage_id_value());
13863 /// assert_eq!((0x81 << 16) | 3, u1.usage_value());
13864 /// assert_eq!("Enumerate 3", u1.name());
13865 /// ```
13866 #[allow(non_camel_case_types)]
13867 #[derive(Debug)]
13868 #[non_exhaustive]
13869 pub enum MonitorEnumerated {
13870 MonitorEnumerated(u16),
13871 }
13872
13873 impl MonitorEnumerated {
13874 #[cfg(feature = "std")]
13875 pub fn name(&self) -> String {
13876 match self {
13877 MonitorEnumerated::MonitorEnumerated(enumerate) => format!("Enumerate {enumerate}"),
13878 }
13879 }
13880 }
13881
13882 #[cfg(feature = "std")]
13883 impl fmt::Display for MonitorEnumerated {
13884 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
13885 write!(f, "{}", self.name())
13886 }
13887 }
13888
13889 impl AsUsage for MonitorEnumerated {
13890 /// Returns the 32 bit Usage value of this Usage
13891 fn usage_value(&self) -> u32 {
13892 u32::from(self)
13893 }
13894
13895 /// Returns the 16 bit Usage ID value of this Usage
13896 fn usage_id_value(&self) -> u16 {
13897 u16::from(self)
13898 }
13899
13900 /// Returns this usage as [Usage::MonitorEnumerated(self)](Usage::MonitorEnumerated)
13901 /// This is a convenience function to avoid having
13902 /// to implement `From` for every used type in the caller.
13903 ///
13904 /// ```
13905 /// # use hut::*;
13906 /// let gd_x = GenericDesktop::X;
13907 /// let usage = Usage::from(GenericDesktop::X);
13908 /// assert!(matches!(gd_x.usage(), usage));
13909 /// ```
13910 fn usage(&self) -> Usage {
13911 Usage::from(self)
13912 }
13913 }
13914
13915 impl AsUsagePage for MonitorEnumerated {
13916 /// Returns the 16 bit value of this UsagePage
13917 ///
13918 /// This value is `0x81` for [MonitorEnumerated]
13919 fn usage_page_value(&self) -> u16 {
13920 let up = UsagePage::from(self);
13921 u16::from(up)
13922 }
13923
13924 /// Returns [UsagePage::MonitorEnumerated]]
13925 fn usage_page(&self) -> UsagePage {
13926 UsagePage::from(self)
13927 }
13928 }
13929
13930 impl From<&MonitorEnumerated> for u16 {
13931 fn from(monitorenumerated: &MonitorEnumerated) -> u16 {
13932 match *monitorenumerated {
13933 MonitorEnumerated::MonitorEnumerated(enumerate) => enumerate,
13934 }
13935 }
13936 }
13937
13938 impl From<MonitorEnumerated> for u16 {
13939 /// Returns the 16bit value of this usage. This is identical
13940 /// to [MonitorEnumerated::usage_page_value()].
13941 fn from(monitorenumerated: MonitorEnumerated) -> u16 {
13942 u16::from(&monitorenumerated)
13943 }
13944 }
13945
13946 impl From<&MonitorEnumerated> for u32 {
13947 /// Returns the 32 bit value of this usage. This is identical
13948 /// to [MonitorEnumerated::usage_value()].
13949 fn from(monitorenumerated: &MonitorEnumerated) -> u32 {
13950 let up = UsagePage::from(monitorenumerated);
13951 let up = (u16::from(&up) as u32) << 16;
13952 let id = u16::from(monitorenumerated) as u32;
13953 up | id
13954 }
13955 }
13956
13957 impl From<&MonitorEnumerated> for UsagePage {
13958 /// Always returns [UsagePage::MonitorEnumerated] and is
13959 /// identical to [MonitorEnumerated::usage_page()].
13960 fn from(_: &MonitorEnumerated) -> UsagePage {
13961 UsagePage::MonitorEnumerated
13962 }
13963 }
13964
13965 impl From<MonitorEnumerated> for UsagePage {
13966 /// Always returns [UsagePage::MonitorEnumerated] and is
13967 /// identical to [MonitorEnumerated::usage_page()].
13968 fn from(_: MonitorEnumerated) -> UsagePage {
13969 UsagePage::MonitorEnumerated
13970 }
13971 }
13972
13973 impl From<&MonitorEnumerated> for Usage {
13974 fn from(monitorenumerated: &MonitorEnumerated) -> Usage {
13975 Usage::try_from(u32::from(monitorenumerated)).unwrap()
13976 }
13977 }
13978
13979 impl From<MonitorEnumerated> for Usage {
13980 fn from(monitorenumerated: MonitorEnumerated) -> Usage {
13981 Usage::from(&monitorenumerated)
13982 }
13983 }
13984
13985 impl TryFrom<u16> for MonitorEnumerated {
13986 type Error = HutError;
13987
13988 fn try_from(usage_id: u16) -> Result<MonitorEnumerated> {
13989 match usage_id {
13990 n => Ok(MonitorEnumerated::MonitorEnumerated(n)),
13991 }
13992 }
13993 }
13994
13995 impl BitOr<u16> for MonitorEnumerated {
13996 type Output = Usage;
13997
13998 /// A convenience function to combine a Usage Page with
13999 /// a value.
14000 ///
14001 /// This function panics if the Usage ID value results in
14002 /// an unknown Usage. Where error checking is required,
14003 /// use [UsagePage::to_usage_from_value].
14004 fn bitor(self, usage: u16) -> Usage {
14005 let up = u16::from(self) as u32;
14006 let u = usage as u32;
14007 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
14008 }
14009 }
14010
14011 /// *Usage Page `0x82`: "VESA Virtual Controls"*
14012 ///
14013 /// **This enum is autogenerated from the HID Usage Tables**.
14014 /// ```
14015 /// # use hut::*;
14016 /// let u1 = Usage::VESAVirtualControls(VESAVirtualControls::Brightness);
14017 /// let u2 = Usage::new_from_page_and_id(0x82, 0x10).unwrap();
14018 /// let u3 = Usage::from(VESAVirtualControls::Brightness);
14019 /// let u4: Usage = VESAVirtualControls::Brightness.into();
14020 /// assert_eq!(u1, u2);
14021 /// assert_eq!(u1, u3);
14022 /// assert_eq!(u1, u4);
14023 ///
14024 /// assert!(matches!(u1.usage_page(), UsagePage::VESAVirtualControls));
14025 /// assert_eq!(0x82, u1.usage_page_value());
14026 /// assert_eq!(0x10, u1.usage_id_value());
14027 /// assert_eq!((0x82 << 16) | 0x10, u1.usage_value());
14028 /// assert_eq!("Brightness", u1.name());
14029 /// ```
14030 ///
14031 #[allow(non_camel_case_types)]
14032 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
14033 #[non_exhaustive]
14034 #[repr(u16)]
14035 pub enum VESAVirtualControls {
14036 /// Usage ID `0x1`: "Degauss"
14037 Degauss = 0x1,
14038 /// Usage ID `0x10`: "Brightness"
14039 Brightness = 0x10,
14040 /// Usage ID `0x12`: "Contrast"
14041 Contrast = 0x12,
14042 /// Usage ID `0x16`: "Red Video Gain"
14043 RedVideoGain = 0x16,
14044 /// Usage ID `0x18`: "Green Video Gain"
14045 GreenVideoGain = 0x18,
14046 /// Usage ID `0x1A`: "Blue Video Gain"
14047 BlueVideoGain = 0x1A,
14048 /// Usage ID `0x1C`: "Focus"
14049 Focus = 0x1C,
14050 /// Usage ID `0x20`: "Horizontal Position"
14051 HorizontalPosition = 0x20,
14052 /// Usage ID `0x22`: "Horizontal Size"
14053 HorizontalSize = 0x22,
14054 /// Usage ID `0x24`: "Horizontal Pincushion"
14055 HorizontalPincushion = 0x24,
14056 /// Usage ID `0x26`: "Horizontal Pincushion Balance"
14057 HorizontalPincushionBalance = 0x26,
14058 /// Usage ID `0x28`: "Horizontal Misconvergence"
14059 HorizontalMisconvergence = 0x28,
14060 /// Usage ID `0x2A`: "Horizontal Linearity"
14061 HorizontalLinearity = 0x2A,
14062 /// Usage ID `0x2C`: "Horizontal Linearity Balance"
14063 HorizontalLinearityBalance = 0x2C,
14064 /// Usage ID `0x30`: "Vertical Position"
14065 VerticalPosition = 0x30,
14066 /// Usage ID `0x32`: "Vertical Size"
14067 VerticalSize = 0x32,
14068 /// Usage ID `0x34`: "Vertical Pincushion"
14069 VerticalPincushion = 0x34,
14070 /// Usage ID `0x36`: "Vertical Pincushion Balance"
14071 VerticalPincushionBalance = 0x36,
14072 /// Usage ID `0x38`: "Vertical Misconvergence"
14073 VerticalMisconvergence = 0x38,
14074 /// Usage ID `0x3A`: "Vertical Linearity"
14075 VerticalLinearity = 0x3A,
14076 /// Usage ID `0x3C`: "Vertical Linearity Balance"
14077 VerticalLinearityBalance = 0x3C,
14078 /// Usage ID `0x40`: "Parallelogram Distortion (Key Balance)"
14079 ParallelogramDistortionKeyBalance = 0x40,
14080 /// Usage ID `0x42`: "Trapezoidal Distortion (Key)"
14081 TrapezoidalDistortionKey = 0x42,
14082 /// Usage ID `0x44`: "Tilt (Rotation)"
14083 TiltRotation = 0x44,
14084 /// Usage ID `0x46`: "Top Corner Distortion Control"
14085 TopCornerDistortionControl = 0x46,
14086 /// Usage ID `0x48`: "Top Corner Distortion Balance"
14087 TopCornerDistortionBalance = 0x48,
14088 /// Usage ID `0x4A`: "Bottom Corner Distortion Control"
14089 BottomCornerDistortionControl = 0x4A,
14090 /// Usage ID `0x4C`: "Bottom Corner Distortion Balance"
14091 BottomCornerDistortionBalance = 0x4C,
14092 /// Usage ID `0x56`: "Horizontal Moiré"
14093 HorizontalMoiré = 0x56,
14094 /// Usage ID `0x58`: "Vertical Moiré"
14095 VerticalMoiré = 0x58,
14096 /// Usage ID `0x5E`: "Input Level Select"
14097 InputLevelSelect = 0x5E,
14098 /// Usage ID `0x60`: "Input Source Select"
14099 InputSourceSelect = 0x60,
14100 /// Usage ID `0x6C`: "Red Video Black Level"
14101 RedVideoBlackLevel = 0x6C,
14102 /// Usage ID `0x6E`: "Green Video Black Level"
14103 GreenVideoBlackLevel = 0x6E,
14104 /// Usage ID `0x70`: "Blue Video Black Level"
14105 BlueVideoBlackLevel = 0x70,
14106 /// Usage ID `0xA2`: "Auto Size Center"
14107 AutoSizeCenter = 0xA2,
14108 /// Usage ID `0xA4`: "Polarity Horizontal Synchronization"
14109 PolarityHorizontalSynchronization = 0xA4,
14110 /// Usage ID `0xA6`: "Polarity Vertical Synchronization"
14111 PolarityVerticalSynchronization = 0xA6,
14112 /// Usage ID `0xA8`: "Synchronization Type"
14113 SynchronizationType = 0xA8,
14114 /// Usage ID `0xAA`: "Screen Orientation"
14115 ScreenOrientation = 0xAA,
14116 /// Usage ID `0xAC`: "Horizontal Frequency"
14117 HorizontalFrequency = 0xAC,
14118 /// Usage ID `0xAE`: "Vertical Frequency"
14119 VerticalFrequency = 0xAE,
14120 /// Usage ID `0xB0`: "Settings"
14121 Settings = 0xB0,
14122 /// Usage ID `0xCA`: "On Screen Display"
14123 OnScreenDisplay = 0xCA,
14124 /// Usage ID `0xD4`: "Stereo Mode"
14125 StereoMode = 0xD4,
14126 }
14127
14128 impl VESAVirtualControls {
14129 #[cfg(feature = "std")]
14130 pub fn name(&self) -> String {
14131 match self {
14132 VESAVirtualControls::Degauss => "Degauss",
14133 VESAVirtualControls::Brightness => "Brightness",
14134 VESAVirtualControls::Contrast => "Contrast",
14135 VESAVirtualControls::RedVideoGain => "Red Video Gain",
14136 VESAVirtualControls::GreenVideoGain => "Green Video Gain",
14137 VESAVirtualControls::BlueVideoGain => "Blue Video Gain",
14138 VESAVirtualControls::Focus => "Focus",
14139 VESAVirtualControls::HorizontalPosition => "Horizontal Position",
14140 VESAVirtualControls::HorizontalSize => "Horizontal Size",
14141 VESAVirtualControls::HorizontalPincushion => "Horizontal Pincushion",
14142 VESAVirtualControls::HorizontalPincushionBalance => "Horizontal Pincushion Balance",
14143 VESAVirtualControls::HorizontalMisconvergence => "Horizontal Misconvergence",
14144 VESAVirtualControls::HorizontalLinearity => "Horizontal Linearity",
14145 VESAVirtualControls::HorizontalLinearityBalance => "Horizontal Linearity Balance",
14146 VESAVirtualControls::VerticalPosition => "Vertical Position",
14147 VESAVirtualControls::VerticalSize => "Vertical Size",
14148 VESAVirtualControls::VerticalPincushion => "Vertical Pincushion",
14149 VESAVirtualControls::VerticalPincushionBalance => "Vertical Pincushion Balance",
14150 VESAVirtualControls::VerticalMisconvergence => "Vertical Misconvergence",
14151 VESAVirtualControls::VerticalLinearity => "Vertical Linearity",
14152 VESAVirtualControls::VerticalLinearityBalance => "Vertical Linearity Balance",
14153 VESAVirtualControls::ParallelogramDistortionKeyBalance => {
14154 "Parallelogram Distortion (Key Balance)"
14155 }
14156 VESAVirtualControls::TrapezoidalDistortionKey => "Trapezoidal Distortion (Key)",
14157 VESAVirtualControls::TiltRotation => "Tilt (Rotation)",
14158 VESAVirtualControls::TopCornerDistortionControl => "Top Corner Distortion Control",
14159 VESAVirtualControls::TopCornerDistortionBalance => "Top Corner Distortion Balance",
14160 VESAVirtualControls::BottomCornerDistortionControl => {
14161 "Bottom Corner Distortion Control"
14162 }
14163 VESAVirtualControls::BottomCornerDistortionBalance => {
14164 "Bottom Corner Distortion Balance"
14165 }
14166 VESAVirtualControls::HorizontalMoiré => "Horizontal Moiré",
14167 VESAVirtualControls::VerticalMoiré => "Vertical Moiré",
14168 VESAVirtualControls::InputLevelSelect => "Input Level Select",
14169 VESAVirtualControls::InputSourceSelect => "Input Source Select",
14170 VESAVirtualControls::RedVideoBlackLevel => "Red Video Black Level",
14171 VESAVirtualControls::GreenVideoBlackLevel => "Green Video Black Level",
14172 VESAVirtualControls::BlueVideoBlackLevel => "Blue Video Black Level",
14173 VESAVirtualControls::AutoSizeCenter => "Auto Size Center",
14174 VESAVirtualControls::PolarityHorizontalSynchronization => {
14175 "Polarity Horizontal Synchronization"
14176 }
14177 VESAVirtualControls::PolarityVerticalSynchronization => {
14178 "Polarity Vertical Synchronization"
14179 }
14180 VESAVirtualControls::SynchronizationType => "Synchronization Type",
14181 VESAVirtualControls::ScreenOrientation => "Screen Orientation",
14182 VESAVirtualControls::HorizontalFrequency => "Horizontal Frequency",
14183 VESAVirtualControls::VerticalFrequency => "Vertical Frequency",
14184 VESAVirtualControls::Settings => "Settings",
14185 VESAVirtualControls::OnScreenDisplay => "On Screen Display",
14186 VESAVirtualControls::StereoMode => "Stereo Mode",
14187 }
14188 .into()
14189 }
14190 }
14191
14192 #[cfg(feature = "std")]
14193 impl fmt::Display for VESAVirtualControls {
14194 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
14195 write!(f, "{}", self.name())
14196 }
14197 }
14198
14199 impl AsUsage for VESAVirtualControls {
14200 /// Returns the 32 bit Usage value of this Usage
14201 fn usage_value(&self) -> u32 {
14202 u32::from(self)
14203 }
14204
14205 /// Returns the 16 bit Usage ID value of this Usage
14206 fn usage_id_value(&self) -> u16 {
14207 u16::from(self)
14208 }
14209
14210 /// Returns this usage as [Usage::VESAVirtualControls(self)](Usage::VESAVirtualControls)
14211 /// This is a convenience function to avoid having
14212 /// to implement `From` for every used type in the caller.
14213 ///
14214 /// ```
14215 /// # use hut::*;
14216 /// let gd_x = GenericDesktop::X;
14217 /// let usage = Usage::from(GenericDesktop::X);
14218 /// assert!(matches!(gd_x.usage(), usage));
14219 /// ```
14220 fn usage(&self) -> Usage {
14221 Usage::from(self)
14222 }
14223 }
14224
14225 impl AsUsagePage for VESAVirtualControls {
14226 /// Returns the 16 bit value of this UsagePage
14227 ///
14228 /// This value is `0x82` for [VESAVirtualControls]
14229 fn usage_page_value(&self) -> u16 {
14230 let up = UsagePage::from(self);
14231 u16::from(up)
14232 }
14233
14234 /// Returns [UsagePage::VESAVirtualControls]]
14235 fn usage_page(&self) -> UsagePage {
14236 UsagePage::from(self)
14237 }
14238 }
14239
14240 impl From<&VESAVirtualControls> for u16 {
14241 fn from(vesavirtualcontrols: &VESAVirtualControls) -> u16 {
14242 *vesavirtualcontrols as u16
14243 }
14244 }
14245
14246 impl From<VESAVirtualControls> for u16 {
14247 /// Returns the 16bit value of this usage. This is identical
14248 /// to [VESAVirtualControls::usage_page_value()].
14249 fn from(vesavirtualcontrols: VESAVirtualControls) -> u16 {
14250 u16::from(&vesavirtualcontrols)
14251 }
14252 }
14253
14254 impl From<&VESAVirtualControls> for u32 {
14255 /// Returns the 32 bit value of this usage. This is identical
14256 /// to [VESAVirtualControls::usage_value()].
14257 fn from(vesavirtualcontrols: &VESAVirtualControls) -> u32 {
14258 let up = UsagePage::from(vesavirtualcontrols);
14259 let up = (u16::from(&up) as u32) << 16;
14260 let id = u16::from(vesavirtualcontrols) as u32;
14261 up | id
14262 }
14263 }
14264
14265 impl From<&VESAVirtualControls> for UsagePage {
14266 /// Always returns [UsagePage::VESAVirtualControls] and is
14267 /// identical to [VESAVirtualControls::usage_page()].
14268 fn from(_: &VESAVirtualControls) -> UsagePage {
14269 UsagePage::VESAVirtualControls
14270 }
14271 }
14272
14273 impl From<VESAVirtualControls> for UsagePage {
14274 /// Always returns [UsagePage::VESAVirtualControls] and is
14275 /// identical to [VESAVirtualControls::usage_page()].
14276 fn from(_: VESAVirtualControls) -> UsagePage {
14277 UsagePage::VESAVirtualControls
14278 }
14279 }
14280
14281 impl From<&VESAVirtualControls> for Usage {
14282 fn from(vesavirtualcontrols: &VESAVirtualControls) -> Usage {
14283 Usage::try_from(u32::from(vesavirtualcontrols)).unwrap()
14284 }
14285 }
14286
14287 impl From<VESAVirtualControls> for Usage {
14288 fn from(vesavirtualcontrols: VESAVirtualControls) -> Usage {
14289 Usage::from(&vesavirtualcontrols)
14290 }
14291 }
14292
14293 impl TryFrom<u16> for VESAVirtualControls {
14294 type Error = HutError;
14295
14296 fn try_from(usage_id: u16) -> Result<VESAVirtualControls> {
14297 match usage_id {
14298 1 => Ok(VESAVirtualControls::Degauss),
14299 16 => Ok(VESAVirtualControls::Brightness),
14300 18 => Ok(VESAVirtualControls::Contrast),
14301 22 => Ok(VESAVirtualControls::RedVideoGain),
14302 24 => Ok(VESAVirtualControls::GreenVideoGain),
14303 26 => Ok(VESAVirtualControls::BlueVideoGain),
14304 28 => Ok(VESAVirtualControls::Focus),
14305 32 => Ok(VESAVirtualControls::HorizontalPosition),
14306 34 => Ok(VESAVirtualControls::HorizontalSize),
14307 36 => Ok(VESAVirtualControls::HorizontalPincushion),
14308 38 => Ok(VESAVirtualControls::HorizontalPincushionBalance),
14309 40 => Ok(VESAVirtualControls::HorizontalMisconvergence),
14310 42 => Ok(VESAVirtualControls::HorizontalLinearity),
14311 44 => Ok(VESAVirtualControls::HorizontalLinearityBalance),
14312 48 => Ok(VESAVirtualControls::VerticalPosition),
14313 50 => Ok(VESAVirtualControls::VerticalSize),
14314 52 => Ok(VESAVirtualControls::VerticalPincushion),
14315 54 => Ok(VESAVirtualControls::VerticalPincushionBalance),
14316 56 => Ok(VESAVirtualControls::VerticalMisconvergence),
14317 58 => Ok(VESAVirtualControls::VerticalLinearity),
14318 60 => Ok(VESAVirtualControls::VerticalLinearityBalance),
14319 64 => Ok(VESAVirtualControls::ParallelogramDistortionKeyBalance),
14320 66 => Ok(VESAVirtualControls::TrapezoidalDistortionKey),
14321 68 => Ok(VESAVirtualControls::TiltRotation),
14322 70 => Ok(VESAVirtualControls::TopCornerDistortionControl),
14323 72 => Ok(VESAVirtualControls::TopCornerDistortionBalance),
14324 74 => Ok(VESAVirtualControls::BottomCornerDistortionControl),
14325 76 => Ok(VESAVirtualControls::BottomCornerDistortionBalance),
14326 86 => Ok(VESAVirtualControls::HorizontalMoiré),
14327 88 => Ok(VESAVirtualControls::VerticalMoiré),
14328 94 => Ok(VESAVirtualControls::InputLevelSelect),
14329 96 => Ok(VESAVirtualControls::InputSourceSelect),
14330 108 => Ok(VESAVirtualControls::RedVideoBlackLevel),
14331 110 => Ok(VESAVirtualControls::GreenVideoBlackLevel),
14332 112 => Ok(VESAVirtualControls::BlueVideoBlackLevel),
14333 162 => Ok(VESAVirtualControls::AutoSizeCenter),
14334 164 => Ok(VESAVirtualControls::PolarityHorizontalSynchronization),
14335 166 => Ok(VESAVirtualControls::PolarityVerticalSynchronization),
14336 168 => Ok(VESAVirtualControls::SynchronizationType),
14337 170 => Ok(VESAVirtualControls::ScreenOrientation),
14338 172 => Ok(VESAVirtualControls::HorizontalFrequency),
14339 174 => Ok(VESAVirtualControls::VerticalFrequency),
14340 176 => Ok(VESAVirtualControls::Settings),
14341 202 => Ok(VESAVirtualControls::OnScreenDisplay),
14342 212 => Ok(VESAVirtualControls::StereoMode),
14343 n => Err(HutError::UnknownUsageId { usage_id: n }),
14344 }
14345 }
14346 }
14347
14348 impl BitOr<u16> for VESAVirtualControls {
14349 type Output = Usage;
14350
14351 /// A convenience function to combine a Usage Page with
14352 /// a value.
14353 ///
14354 /// This function panics if the Usage ID value results in
14355 /// an unknown Usage. Where error checking is required,
14356 /// use [UsagePage::to_usage_from_value].
14357 fn bitor(self, usage: u16) -> Usage {
14358 let up = u16::from(self) as u32;
14359 let u = usage as u32;
14360 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
14361 }
14362 }
14363
14364 /// *Usage Page `0x84`: "Power"*
14365 ///
14366 /// **This enum is autogenerated from the HID Usage Tables**.
14367 /// ```
14368 /// # use hut::*;
14369 /// let u1 = Usage::Power(Power::PresentStatus);
14370 /// let u2 = Usage::new_from_page_and_id(0x84, 0x2).unwrap();
14371 /// let u3 = Usage::from(Power::PresentStatus);
14372 /// let u4: Usage = Power::PresentStatus.into();
14373 /// assert_eq!(u1, u2);
14374 /// assert_eq!(u1, u3);
14375 /// assert_eq!(u1, u4);
14376 ///
14377 /// assert!(matches!(u1.usage_page(), UsagePage::Power));
14378 /// assert_eq!(0x84, u1.usage_page_value());
14379 /// assert_eq!(0x2, u1.usage_id_value());
14380 /// assert_eq!((0x84 << 16) | 0x2, u1.usage_value());
14381 /// assert_eq!("Present Status", u1.name());
14382 /// ```
14383 ///
14384 #[allow(non_camel_case_types)]
14385 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
14386 #[non_exhaustive]
14387 #[repr(u16)]
14388 pub enum Power {
14389 /// Usage ID `0x1`: "iName"
14390 iName = 0x1,
14391 /// Usage ID `0x2`: "Present Status"
14392 PresentStatus = 0x2,
14393 /// Usage ID `0x3`: "Changed Status"
14394 ChangedStatus = 0x3,
14395 /// Usage ID `0x4`: "UPS"
14396 UPS = 0x4,
14397 /// Usage ID `0x5`: "Power Supply"
14398 PowerSupply = 0x5,
14399 /// Usage ID `0x10`: "Battery System"
14400 BatterySystem = 0x10,
14401 /// Usage ID `0x11`: "Battery System Id"
14402 BatterySystemId = 0x11,
14403 /// Usage ID `0x12`: "Battery"
14404 Battery = 0x12,
14405 /// Usage ID `0x13`: "Battery Id"
14406 BatteryId = 0x13,
14407 /// Usage ID `0x14`: "Charger"
14408 Charger = 0x14,
14409 /// Usage ID `0x15`: "Charger Id"
14410 ChargerId = 0x15,
14411 /// Usage ID `0x16`: "Power Converter"
14412 PowerConverter = 0x16,
14413 /// Usage ID `0x17`: "Power Converter Id"
14414 PowerConverterId = 0x17,
14415 /// Usage ID `0x18`: "Outlet System"
14416 OutletSystem = 0x18,
14417 /// Usage ID `0x19`: "Outlet System Id"
14418 OutletSystemId = 0x19,
14419 /// Usage ID `0x1A`: "Input"
14420 Input = 0x1A,
14421 /// Usage ID `0x1B`: "Input Id"
14422 InputId = 0x1B,
14423 /// Usage ID `0x1C`: "Output"
14424 Output = 0x1C,
14425 /// Usage ID `0x1D`: "Output Id"
14426 OutputId = 0x1D,
14427 /// Usage ID `0x1E`: "Flow"
14428 Flow = 0x1E,
14429 /// Usage ID `0x1F`: "Flow Id"
14430 FlowId = 0x1F,
14431 /// Usage ID `0x20`: "Outlet"
14432 Outlet = 0x20,
14433 /// Usage ID `0x21`: "Outlet Id"
14434 OutletId = 0x21,
14435 /// Usage ID `0x22`: "Gang"
14436 Gang = 0x22,
14437 /// Usage ID `0x23`: "Gang Id"
14438 GangId = 0x23,
14439 /// Usage ID `0x24`: "Power Summary"
14440 PowerSummary = 0x24,
14441 /// Usage ID `0x25`: "Power Summary Id"
14442 PowerSummaryId = 0x25,
14443 /// Usage ID `0x30`: "Voltage"
14444 Voltage = 0x30,
14445 /// Usage ID `0x31`: "Current"
14446 Current = 0x31,
14447 /// Usage ID `0x32`: "Frequency"
14448 Frequency = 0x32,
14449 /// Usage ID `0x33`: "Apparent Power"
14450 ApparentPower = 0x33,
14451 /// Usage ID `0x34`: "Active Power"
14452 ActivePower = 0x34,
14453 /// Usage ID `0x35`: "Percent Load"
14454 PercentLoad = 0x35,
14455 /// Usage ID `0x36`: "Temperature"
14456 Temperature = 0x36,
14457 /// Usage ID `0x37`: "Humidity"
14458 Humidity = 0x37,
14459 /// Usage ID `0x38`: "Bad Count"
14460 BadCount = 0x38,
14461 /// Usage ID `0x40`: "Config Voltage"
14462 ConfigVoltage = 0x40,
14463 /// Usage ID `0x41`: "Config Current"
14464 ConfigCurrent = 0x41,
14465 /// Usage ID `0x42`: "Config Frequency"
14466 ConfigFrequency = 0x42,
14467 /// Usage ID `0x43`: "Config Apparent Power"
14468 ConfigApparentPower = 0x43,
14469 /// Usage ID `0x44`: "Config Active Power"
14470 ConfigActivePower = 0x44,
14471 /// Usage ID `0x45`: "Config Percent Load"
14472 ConfigPercentLoad = 0x45,
14473 /// Usage ID `0x46`: "Config Temperature"
14474 ConfigTemperature = 0x46,
14475 /// Usage ID `0x47`: "Config Humidity"
14476 ConfigHumidity = 0x47,
14477 /// Usage ID `0x50`: "Switch On Control"
14478 SwitchOnControl = 0x50,
14479 /// Usage ID `0x51`: "Switch Off Control"
14480 SwitchOffControl = 0x51,
14481 /// Usage ID `0x52`: "Toggle Control"
14482 ToggleControl = 0x52,
14483 /// Usage ID `0x53`: "Low Voltage Transfer"
14484 LowVoltageTransfer = 0x53,
14485 /// Usage ID `0x54`: "High Voltage Transfer"
14486 HighVoltageTransfer = 0x54,
14487 /// Usage ID `0x55`: "Delay Before Reboot"
14488 DelayBeforeReboot = 0x55,
14489 /// Usage ID `0x56`: "Delay Before Startup"
14490 DelayBeforeStartup = 0x56,
14491 /// Usage ID `0x57`: "Delay Before Shutdown"
14492 DelayBeforeShutdown = 0x57,
14493 /// Usage ID `0x58`: "Test"
14494 Test = 0x58,
14495 /// Usage ID `0x59`: "Module Reset"
14496 ModuleReset = 0x59,
14497 /// Usage ID `0x5A`: "Audible Alarm Control"
14498 AudibleAlarmControl = 0x5A,
14499 /// Usage ID `0x60`: "Present"
14500 Present = 0x60,
14501 /// Usage ID `0x61`: "Good"
14502 Good = 0x61,
14503 /// Usage ID `0x62`: "Internal Failure"
14504 InternalFailure = 0x62,
14505 /// Usage ID `0x63`: "Voltag Out Of Range"
14506 VoltagOutOfRange = 0x63,
14507 /// Usage ID `0x64`: "Frequency Out Of Range"
14508 FrequencyOutOfRange = 0x64,
14509 /// Usage ID `0x65`: "Overload"
14510 Overload = 0x65,
14511 /// Usage ID `0x66`: "Over Charged"
14512 OverCharged = 0x66,
14513 /// Usage ID `0x67`: "Over Temperature"
14514 OverTemperature = 0x67,
14515 /// Usage ID `0x68`: "Shutdown Requested"
14516 ShutdownRequested = 0x68,
14517 /// Usage ID `0x69`: "Shutdown Imminent"
14518 ShutdownImminent = 0x69,
14519 /// Usage ID `0x6B`: "Switch On/Off"
14520 SwitchOnOff = 0x6B,
14521 /// Usage ID `0x6C`: "Switchable"
14522 Switchable = 0x6C,
14523 /// Usage ID `0x6D`: "Used"
14524 Used = 0x6D,
14525 /// Usage ID `0x6E`: "Boost"
14526 Boost = 0x6E,
14527 /// Usage ID `0x6F`: "Buck"
14528 Buck = 0x6F,
14529 /// Usage ID `0x70`: "Initialized"
14530 Initialized = 0x70,
14531 /// Usage ID `0x71`: "Tested"
14532 Tested = 0x71,
14533 /// Usage ID `0x72`: "Awaiting Power"
14534 AwaitingPower = 0x72,
14535 /// Usage ID `0x73`: "Communication Lost"
14536 CommunicationLost = 0x73,
14537 /// Usage ID `0xFD`: "iManufacturer"
14538 iManufacturer = 0xFD,
14539 /// Usage ID `0xFE`: "iProduct"
14540 iProduct = 0xFE,
14541 /// Usage ID `0xFF`: "iSerialNumber"
14542 iSerialNumber = 0xFF,
14543 }
14544
14545 impl Power {
14546 #[cfg(feature = "std")]
14547 pub fn name(&self) -> String {
14548 match self {
14549 Power::iName => "iName",
14550 Power::PresentStatus => "Present Status",
14551 Power::ChangedStatus => "Changed Status",
14552 Power::UPS => "UPS",
14553 Power::PowerSupply => "Power Supply",
14554 Power::BatterySystem => "Battery System",
14555 Power::BatterySystemId => "Battery System Id",
14556 Power::Battery => "Battery",
14557 Power::BatteryId => "Battery Id",
14558 Power::Charger => "Charger",
14559 Power::ChargerId => "Charger Id",
14560 Power::PowerConverter => "Power Converter",
14561 Power::PowerConverterId => "Power Converter Id",
14562 Power::OutletSystem => "Outlet System",
14563 Power::OutletSystemId => "Outlet System Id",
14564 Power::Input => "Input",
14565 Power::InputId => "Input Id",
14566 Power::Output => "Output",
14567 Power::OutputId => "Output Id",
14568 Power::Flow => "Flow",
14569 Power::FlowId => "Flow Id",
14570 Power::Outlet => "Outlet",
14571 Power::OutletId => "Outlet Id",
14572 Power::Gang => "Gang",
14573 Power::GangId => "Gang Id",
14574 Power::PowerSummary => "Power Summary",
14575 Power::PowerSummaryId => "Power Summary Id",
14576 Power::Voltage => "Voltage",
14577 Power::Current => "Current",
14578 Power::Frequency => "Frequency",
14579 Power::ApparentPower => "Apparent Power",
14580 Power::ActivePower => "Active Power",
14581 Power::PercentLoad => "Percent Load",
14582 Power::Temperature => "Temperature",
14583 Power::Humidity => "Humidity",
14584 Power::BadCount => "Bad Count",
14585 Power::ConfigVoltage => "Config Voltage",
14586 Power::ConfigCurrent => "Config Current",
14587 Power::ConfigFrequency => "Config Frequency",
14588 Power::ConfigApparentPower => "Config Apparent Power",
14589 Power::ConfigActivePower => "Config Active Power",
14590 Power::ConfigPercentLoad => "Config Percent Load",
14591 Power::ConfigTemperature => "Config Temperature",
14592 Power::ConfigHumidity => "Config Humidity",
14593 Power::SwitchOnControl => "Switch On Control",
14594 Power::SwitchOffControl => "Switch Off Control",
14595 Power::ToggleControl => "Toggle Control",
14596 Power::LowVoltageTransfer => "Low Voltage Transfer",
14597 Power::HighVoltageTransfer => "High Voltage Transfer",
14598 Power::DelayBeforeReboot => "Delay Before Reboot",
14599 Power::DelayBeforeStartup => "Delay Before Startup",
14600 Power::DelayBeforeShutdown => "Delay Before Shutdown",
14601 Power::Test => "Test",
14602 Power::ModuleReset => "Module Reset",
14603 Power::AudibleAlarmControl => "Audible Alarm Control",
14604 Power::Present => "Present",
14605 Power::Good => "Good",
14606 Power::InternalFailure => "Internal Failure",
14607 Power::VoltagOutOfRange => "Voltag Out Of Range",
14608 Power::FrequencyOutOfRange => "Frequency Out Of Range",
14609 Power::Overload => "Overload",
14610 Power::OverCharged => "Over Charged",
14611 Power::OverTemperature => "Over Temperature",
14612 Power::ShutdownRequested => "Shutdown Requested",
14613 Power::ShutdownImminent => "Shutdown Imminent",
14614 Power::SwitchOnOff => "Switch On/Off",
14615 Power::Switchable => "Switchable",
14616 Power::Used => "Used",
14617 Power::Boost => "Boost",
14618 Power::Buck => "Buck",
14619 Power::Initialized => "Initialized",
14620 Power::Tested => "Tested",
14621 Power::AwaitingPower => "Awaiting Power",
14622 Power::CommunicationLost => "Communication Lost",
14623 Power::iManufacturer => "iManufacturer",
14624 Power::iProduct => "iProduct",
14625 Power::iSerialNumber => "iSerialNumber",
14626 }
14627 .into()
14628 }
14629 }
14630
14631 #[cfg(feature = "std")]
14632 impl fmt::Display for Power {
14633 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
14634 write!(f, "{}", self.name())
14635 }
14636 }
14637
14638 impl AsUsage for Power {
14639 /// Returns the 32 bit Usage value of this Usage
14640 fn usage_value(&self) -> u32 {
14641 u32::from(self)
14642 }
14643
14644 /// Returns the 16 bit Usage ID value of this Usage
14645 fn usage_id_value(&self) -> u16 {
14646 u16::from(self)
14647 }
14648
14649 /// Returns this usage as [Usage::Power(self)](Usage::Power)
14650 /// This is a convenience function to avoid having
14651 /// to implement `From` for every used type in the caller.
14652 ///
14653 /// ```
14654 /// # use hut::*;
14655 /// let gd_x = GenericDesktop::X;
14656 /// let usage = Usage::from(GenericDesktop::X);
14657 /// assert!(matches!(gd_x.usage(), usage));
14658 /// ```
14659 fn usage(&self) -> Usage {
14660 Usage::from(self)
14661 }
14662 }
14663
14664 impl AsUsagePage for Power {
14665 /// Returns the 16 bit value of this UsagePage
14666 ///
14667 /// This value is `0x84` for [Power]
14668 fn usage_page_value(&self) -> u16 {
14669 let up = UsagePage::from(self);
14670 u16::from(up)
14671 }
14672
14673 /// Returns [UsagePage::Power]]
14674 fn usage_page(&self) -> UsagePage {
14675 UsagePage::from(self)
14676 }
14677 }
14678
14679 impl From<&Power> for u16 {
14680 fn from(power: &Power) -> u16 {
14681 *power as u16
14682 }
14683 }
14684
14685 impl From<Power> for u16 {
14686 /// Returns the 16bit value of this usage. This is identical
14687 /// to [Power::usage_page_value()].
14688 fn from(power: Power) -> u16 {
14689 u16::from(&power)
14690 }
14691 }
14692
14693 impl From<&Power> for u32 {
14694 /// Returns the 32 bit value of this usage. This is identical
14695 /// to [Power::usage_value()].
14696 fn from(power: &Power) -> u32 {
14697 let up = UsagePage::from(power);
14698 let up = (u16::from(&up) as u32) << 16;
14699 let id = u16::from(power) as u32;
14700 up | id
14701 }
14702 }
14703
14704 impl From<&Power> for UsagePage {
14705 /// Always returns [UsagePage::Power] and is
14706 /// identical to [Power::usage_page()].
14707 fn from(_: &Power) -> UsagePage {
14708 UsagePage::Power
14709 }
14710 }
14711
14712 impl From<Power> for UsagePage {
14713 /// Always returns [UsagePage::Power] and is
14714 /// identical to [Power::usage_page()].
14715 fn from(_: Power) -> UsagePage {
14716 UsagePage::Power
14717 }
14718 }
14719
14720 impl From<&Power> for Usage {
14721 fn from(power: &Power) -> Usage {
14722 Usage::try_from(u32::from(power)).unwrap()
14723 }
14724 }
14725
14726 impl From<Power> for Usage {
14727 fn from(power: Power) -> Usage {
14728 Usage::from(&power)
14729 }
14730 }
14731
14732 impl TryFrom<u16> for Power {
14733 type Error = HutError;
14734
14735 fn try_from(usage_id: u16) -> Result<Power> {
14736 match usage_id {
14737 1 => Ok(Power::iName),
14738 2 => Ok(Power::PresentStatus),
14739 3 => Ok(Power::ChangedStatus),
14740 4 => Ok(Power::UPS),
14741 5 => Ok(Power::PowerSupply),
14742 16 => Ok(Power::BatterySystem),
14743 17 => Ok(Power::BatterySystemId),
14744 18 => Ok(Power::Battery),
14745 19 => Ok(Power::BatteryId),
14746 20 => Ok(Power::Charger),
14747 21 => Ok(Power::ChargerId),
14748 22 => Ok(Power::PowerConverter),
14749 23 => Ok(Power::PowerConverterId),
14750 24 => Ok(Power::OutletSystem),
14751 25 => Ok(Power::OutletSystemId),
14752 26 => Ok(Power::Input),
14753 27 => Ok(Power::InputId),
14754 28 => Ok(Power::Output),
14755 29 => Ok(Power::OutputId),
14756 30 => Ok(Power::Flow),
14757 31 => Ok(Power::FlowId),
14758 32 => Ok(Power::Outlet),
14759 33 => Ok(Power::OutletId),
14760 34 => Ok(Power::Gang),
14761 35 => Ok(Power::GangId),
14762 36 => Ok(Power::PowerSummary),
14763 37 => Ok(Power::PowerSummaryId),
14764 48 => Ok(Power::Voltage),
14765 49 => Ok(Power::Current),
14766 50 => Ok(Power::Frequency),
14767 51 => Ok(Power::ApparentPower),
14768 52 => Ok(Power::ActivePower),
14769 53 => Ok(Power::PercentLoad),
14770 54 => Ok(Power::Temperature),
14771 55 => Ok(Power::Humidity),
14772 56 => Ok(Power::BadCount),
14773 64 => Ok(Power::ConfigVoltage),
14774 65 => Ok(Power::ConfigCurrent),
14775 66 => Ok(Power::ConfigFrequency),
14776 67 => Ok(Power::ConfigApparentPower),
14777 68 => Ok(Power::ConfigActivePower),
14778 69 => Ok(Power::ConfigPercentLoad),
14779 70 => Ok(Power::ConfigTemperature),
14780 71 => Ok(Power::ConfigHumidity),
14781 80 => Ok(Power::SwitchOnControl),
14782 81 => Ok(Power::SwitchOffControl),
14783 82 => Ok(Power::ToggleControl),
14784 83 => Ok(Power::LowVoltageTransfer),
14785 84 => Ok(Power::HighVoltageTransfer),
14786 85 => Ok(Power::DelayBeforeReboot),
14787 86 => Ok(Power::DelayBeforeStartup),
14788 87 => Ok(Power::DelayBeforeShutdown),
14789 88 => Ok(Power::Test),
14790 89 => Ok(Power::ModuleReset),
14791 90 => Ok(Power::AudibleAlarmControl),
14792 96 => Ok(Power::Present),
14793 97 => Ok(Power::Good),
14794 98 => Ok(Power::InternalFailure),
14795 99 => Ok(Power::VoltagOutOfRange),
14796 100 => Ok(Power::FrequencyOutOfRange),
14797 101 => Ok(Power::Overload),
14798 102 => Ok(Power::OverCharged),
14799 103 => Ok(Power::OverTemperature),
14800 104 => Ok(Power::ShutdownRequested),
14801 105 => Ok(Power::ShutdownImminent),
14802 107 => Ok(Power::SwitchOnOff),
14803 108 => Ok(Power::Switchable),
14804 109 => Ok(Power::Used),
14805 110 => Ok(Power::Boost),
14806 111 => Ok(Power::Buck),
14807 112 => Ok(Power::Initialized),
14808 113 => Ok(Power::Tested),
14809 114 => Ok(Power::AwaitingPower),
14810 115 => Ok(Power::CommunicationLost),
14811 253 => Ok(Power::iManufacturer),
14812 254 => Ok(Power::iProduct),
14813 255 => Ok(Power::iSerialNumber),
14814 n => Err(HutError::UnknownUsageId { usage_id: n }),
14815 }
14816 }
14817 }
14818
14819 impl BitOr<u16> for Power {
14820 type Output = Usage;
14821
14822 /// A convenience function to combine a Usage Page with
14823 /// a value.
14824 ///
14825 /// This function panics if the Usage ID value results in
14826 /// an unknown Usage. Where error checking is required,
14827 /// use [UsagePage::to_usage_from_value].
14828 fn bitor(self, usage: u16) -> Usage {
14829 let up = u16::from(self) as u32;
14830 let u = usage as u32;
14831 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
14832 }
14833 }
14834
14835 /// *Usage Page `0x85`: "Battery System"*
14836 ///
14837 /// **This enum is autogenerated from the HID Usage Tables**.
14838 /// ```
14839 /// # use hut::*;
14840 /// let u1 = Usage::BatterySystem(BatterySystem::SmartBatteryBatteryStatus);
14841 /// let u2 = Usage::new_from_page_and_id(0x85, 0x2).unwrap();
14842 /// let u3 = Usage::from(BatterySystem::SmartBatteryBatteryStatus);
14843 /// let u4: Usage = BatterySystem::SmartBatteryBatteryStatus.into();
14844 /// assert_eq!(u1, u2);
14845 /// assert_eq!(u1, u3);
14846 /// assert_eq!(u1, u4);
14847 ///
14848 /// assert!(matches!(u1.usage_page(), UsagePage::BatterySystem));
14849 /// assert_eq!(0x85, u1.usage_page_value());
14850 /// assert_eq!(0x2, u1.usage_id_value());
14851 /// assert_eq!((0x85 << 16) | 0x2, u1.usage_value());
14852 /// assert_eq!("Smart Battery Battery Status", u1.name());
14853 /// ```
14854 ///
14855 #[allow(non_camel_case_types)]
14856 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
14857 #[non_exhaustive]
14858 #[repr(u16)]
14859 pub enum BatterySystem {
14860 /// Usage ID `0x1`: "Smart Battery Battery Mode"
14861 SmartBatteryBatteryMode = 0x1,
14862 /// Usage ID `0x2`: "Smart Battery Battery Status"
14863 SmartBatteryBatteryStatus = 0x2,
14864 /// Usage ID `0x3`: "Smart Battery Alarm Warning"
14865 SmartBatteryAlarmWarning = 0x3,
14866 /// Usage ID `0x4`: "Smart Battery Charger Mode"
14867 SmartBatteryChargerMode = 0x4,
14868 /// Usage ID `0x5`: "Smart Battery Charger Status"
14869 SmartBatteryChargerStatus = 0x5,
14870 /// Usage ID `0x6`: "Smart Battery Charger Spec Info"
14871 SmartBatteryChargerSpecInfo = 0x6,
14872 /// Usage ID `0x7`: "Smart Battery Selector State"
14873 SmartBatterySelectorState = 0x7,
14874 /// Usage ID `0x8`: "Smart Battery Selector Presets"
14875 SmartBatterySelectorPresets = 0x8,
14876 /// Usage ID `0x9`: "Smart Battery Selector Info"
14877 SmartBatterySelectorInfo = 0x9,
14878 /// Usage ID `0x10`: "Optional Mfg Function 1"
14879 OptionalMfgFunction1 = 0x10,
14880 /// Usage ID `0x11`: "Optional Mfg Function 2"
14881 OptionalMfgFunction2 = 0x11,
14882 /// Usage ID `0x12`: "Optional Mfg Function 3"
14883 OptionalMfgFunction3 = 0x12,
14884 /// Usage ID `0x13`: "Optional Mfg Function 4"
14885 OptionalMfgFunction4 = 0x13,
14886 /// Usage ID `0x14`: "Optional Mfg Function 5"
14887 OptionalMfgFunction5 = 0x14,
14888 /// Usage ID `0x15`: "Connection To SM Bus"
14889 ConnectionToSMBus = 0x15,
14890 /// Usage ID `0x16`: "Output Connection"
14891 OutputConnection = 0x16,
14892 /// Usage ID `0x17`: "Charger Connection"
14893 ChargerConnection = 0x17,
14894 /// Usage ID `0x18`: "Battery Insertion"
14895 BatteryInsertion = 0x18,
14896 /// Usage ID `0x19`: "Use Next"
14897 UseNext = 0x19,
14898 /// Usage ID `0x1A`: "OK To Use"
14899 OKToUse = 0x1A,
14900 /// Usage ID `0x1B`: "Battery Supported"
14901 BatterySupported = 0x1B,
14902 /// Usage ID `0x1C`: "Selector Revision"
14903 SelectorRevision = 0x1C,
14904 /// Usage ID `0x1D`: "Charging Indicator"
14905 ChargingIndicator = 0x1D,
14906 /// Usage ID `0x28`: "Manufacturer Access"
14907 ManufacturerAccess = 0x28,
14908 /// Usage ID `0x29`: "Remaining Capacity Limit"
14909 RemainingCapacityLimit = 0x29,
14910 /// Usage ID `0x2A`: "Remaining Time Limit"
14911 RemainingTimeLimit = 0x2A,
14912 /// Usage ID `0x2B`: "At Rate"
14913 AtRate = 0x2B,
14914 /// Usage ID `0x2C`: "Capacity Mode"
14915 CapacityMode = 0x2C,
14916 /// Usage ID `0x2D`: "Broadcast To Charger"
14917 BroadcastToCharger = 0x2D,
14918 /// Usage ID `0x2E`: "Primary Battery"
14919 PrimaryBattery = 0x2E,
14920 /// Usage ID `0x2F`: "Charge Controller"
14921 ChargeController = 0x2F,
14922 /// Usage ID `0x40`: "Terminate Charge"
14923 TerminateCharge = 0x40,
14924 /// Usage ID `0x41`: "Terminate Discharge"
14925 TerminateDischarge = 0x41,
14926 /// Usage ID `0x42`: "Below Remaining Capacity Limit"
14927 BelowRemainingCapacityLimit = 0x42,
14928 /// Usage ID `0x43`: "Remaining Time Limit Expired"
14929 RemainingTimeLimitExpired = 0x43,
14930 /// Usage ID `0x44`: "Charging"
14931 Charging = 0x44,
14932 /// Usage ID `0x45`: "Discharging"
14933 Discharging = 0x45,
14934 /// Usage ID `0x46`: "Fully Charged"
14935 FullyCharged = 0x46,
14936 /// Usage ID `0x47`: "Fully Discharged"
14937 FullyDischarged = 0x47,
14938 /// Usage ID `0x48`: "Conditioning Flag"
14939 ConditioningFlag = 0x48,
14940 /// Usage ID `0x49`: "At Rate OK"
14941 AtRateOK = 0x49,
14942 /// Usage ID `0x4A`: "Smart Battery Error Code"
14943 SmartBatteryErrorCode = 0x4A,
14944 /// Usage ID `0x4B`: "Need Replacement"
14945 NeedReplacement = 0x4B,
14946 /// Usage ID `0x60`: "At Rate Time To Full"
14947 AtRateTimeToFull = 0x60,
14948 /// Usage ID `0x61`: "At Rate Time To Empty"
14949 AtRateTimeToEmpty = 0x61,
14950 /// Usage ID `0x62`: "Average Current"
14951 AverageCurrent = 0x62,
14952 /// Usage ID `0x63`: "Max Error"
14953 MaxError = 0x63,
14954 /// Usage ID `0x64`: "Relative State Of Charge"
14955 RelativeStateOfCharge = 0x64,
14956 /// Usage ID `0x65`: "Absolute State Of Charge"
14957 AbsoluteStateOfCharge = 0x65,
14958 /// Usage ID `0x66`: "Remaining Capacity"
14959 RemainingCapacity = 0x66,
14960 /// Usage ID `0x67`: "Full Charge Capacity"
14961 FullChargeCapacity = 0x67,
14962 /// Usage ID `0x68`: "Run Time To Empty"
14963 RunTimeToEmpty = 0x68,
14964 /// Usage ID `0x69`: "Average Time To Empty"
14965 AverageTimeToEmpty = 0x69,
14966 /// Usage ID `0x6A`: "Average Time To Full"
14967 AverageTimeToFull = 0x6A,
14968 /// Usage ID `0x6B`: "Cycle Count"
14969 CycleCount = 0x6B,
14970 /// Usage ID `0x80`: "Battery Pack Model Level"
14971 BatteryPackModelLevel = 0x80,
14972 /// Usage ID `0x81`: "Internal Charge Controller"
14973 InternalChargeController = 0x81,
14974 /// Usage ID `0x82`: "Primary Battery Support"
14975 PrimaryBatterySupport = 0x82,
14976 /// Usage ID `0x83`: "Design Capacity"
14977 DesignCapacity = 0x83,
14978 /// Usage ID `0x84`: "Specification Info"
14979 SpecificationInfo = 0x84,
14980 /// Usage ID `0x85`: "Manufacture Date"
14981 ManufactureDate = 0x85,
14982 /// Usage ID `0x86`: "Serial Number"
14983 SerialNumber = 0x86,
14984 /// Usage ID `0x87`: "iManufacturer Name"
14985 iManufacturerName = 0x87,
14986 /// Usage ID `0x88`: "iDevice Name"
14987 iDeviceName = 0x88,
14988 /// Usage ID `0x89`: "iDevice Chemistry"
14989 iDeviceChemistry = 0x89,
14990 /// Usage ID `0x8A`: "Manufacturer Data"
14991 ManufacturerData = 0x8A,
14992 /// Usage ID `0x8B`: "Rechargable"
14993 Rechargable = 0x8B,
14994 /// Usage ID `0x8C`: "Warning Capacity Limit"
14995 WarningCapacityLimit = 0x8C,
14996 /// Usage ID `0x8D`: "Capacity Granularity 1"
14997 CapacityGranularity1 = 0x8D,
14998 /// Usage ID `0x8E`: "Capacity Granularity 2"
14999 CapacityGranularity2 = 0x8E,
15000 /// Usage ID `0x8F`: "iOEM Information"
15001 iOEMInformation = 0x8F,
15002 /// Usage ID `0xC0`: "Inhibit Charge"
15003 InhibitCharge = 0xC0,
15004 /// Usage ID `0xC1`: "Enable Polling"
15005 EnablePolling = 0xC1,
15006 /// Usage ID `0xC2`: "Reset To Zero"
15007 ResetToZero = 0xC2,
15008 /// Usage ID `0xD0`: "AC Present"
15009 ACPresent = 0xD0,
15010 /// Usage ID `0xD1`: "Battery Present"
15011 BatteryPresent = 0xD1,
15012 /// Usage ID `0xD2`: "Power Fail"
15013 PowerFail = 0xD2,
15014 /// Usage ID `0xD3`: "Alarm Inhibited"
15015 AlarmInhibited = 0xD3,
15016 /// Usage ID `0xD4`: "Thermistor Under Range"
15017 ThermistorUnderRange = 0xD4,
15018 /// Usage ID `0xD5`: "Thermistor Hot"
15019 ThermistorHot = 0xD5,
15020 /// Usage ID `0xD6`: "Thermistor Cold"
15021 ThermistorCold = 0xD6,
15022 /// Usage ID `0xD7`: "Thermistor Over Range"
15023 ThermistorOverRange = 0xD7,
15024 /// Usage ID `0xD8`: "Voltage Out Of Range"
15025 VoltageOutOfRange = 0xD8,
15026 /// Usage ID `0xD9`: "Current Out Of Range"
15027 CurrentOutOfRange = 0xD9,
15028 /// Usage ID `0xDA`: "Current Not Regulated"
15029 CurrentNotRegulated = 0xDA,
15030 /// Usage ID `0xDB`: "Voltage Not Regulated"
15031 VoltageNotRegulated = 0xDB,
15032 /// Usage ID `0xDC`: "Master Mode"
15033 MasterMode = 0xDC,
15034 /// Usage ID `0xF0`: "Charger Selector Support"
15035 ChargerSelectorSupport = 0xF0,
15036 /// Usage ID `0xF1`: "Charger Spec"
15037 ChargerSpec = 0xF1,
15038 /// Usage ID `0xF2`: "Level 2"
15039 Level2 = 0xF2,
15040 /// Usage ID `0xF3`: "Level 3"
15041 Level3 = 0xF3,
15042 }
15043
15044 impl BatterySystem {
15045 #[cfg(feature = "std")]
15046 pub fn name(&self) -> String {
15047 match self {
15048 BatterySystem::SmartBatteryBatteryMode => "Smart Battery Battery Mode",
15049 BatterySystem::SmartBatteryBatteryStatus => "Smart Battery Battery Status",
15050 BatterySystem::SmartBatteryAlarmWarning => "Smart Battery Alarm Warning",
15051 BatterySystem::SmartBatteryChargerMode => "Smart Battery Charger Mode",
15052 BatterySystem::SmartBatteryChargerStatus => "Smart Battery Charger Status",
15053 BatterySystem::SmartBatteryChargerSpecInfo => "Smart Battery Charger Spec Info",
15054 BatterySystem::SmartBatterySelectorState => "Smart Battery Selector State",
15055 BatterySystem::SmartBatterySelectorPresets => "Smart Battery Selector Presets",
15056 BatterySystem::SmartBatterySelectorInfo => "Smart Battery Selector Info",
15057 BatterySystem::OptionalMfgFunction1 => "Optional Mfg Function 1",
15058 BatterySystem::OptionalMfgFunction2 => "Optional Mfg Function 2",
15059 BatterySystem::OptionalMfgFunction3 => "Optional Mfg Function 3",
15060 BatterySystem::OptionalMfgFunction4 => "Optional Mfg Function 4",
15061 BatterySystem::OptionalMfgFunction5 => "Optional Mfg Function 5",
15062 BatterySystem::ConnectionToSMBus => "Connection To SM Bus",
15063 BatterySystem::OutputConnection => "Output Connection",
15064 BatterySystem::ChargerConnection => "Charger Connection",
15065 BatterySystem::BatteryInsertion => "Battery Insertion",
15066 BatterySystem::UseNext => "Use Next",
15067 BatterySystem::OKToUse => "OK To Use",
15068 BatterySystem::BatterySupported => "Battery Supported",
15069 BatterySystem::SelectorRevision => "Selector Revision",
15070 BatterySystem::ChargingIndicator => "Charging Indicator",
15071 BatterySystem::ManufacturerAccess => "Manufacturer Access",
15072 BatterySystem::RemainingCapacityLimit => "Remaining Capacity Limit",
15073 BatterySystem::RemainingTimeLimit => "Remaining Time Limit",
15074 BatterySystem::AtRate => "At Rate",
15075 BatterySystem::CapacityMode => "Capacity Mode",
15076 BatterySystem::BroadcastToCharger => "Broadcast To Charger",
15077 BatterySystem::PrimaryBattery => "Primary Battery",
15078 BatterySystem::ChargeController => "Charge Controller",
15079 BatterySystem::TerminateCharge => "Terminate Charge",
15080 BatterySystem::TerminateDischarge => "Terminate Discharge",
15081 BatterySystem::BelowRemainingCapacityLimit => "Below Remaining Capacity Limit",
15082 BatterySystem::RemainingTimeLimitExpired => "Remaining Time Limit Expired",
15083 BatterySystem::Charging => "Charging",
15084 BatterySystem::Discharging => "Discharging",
15085 BatterySystem::FullyCharged => "Fully Charged",
15086 BatterySystem::FullyDischarged => "Fully Discharged",
15087 BatterySystem::ConditioningFlag => "Conditioning Flag",
15088 BatterySystem::AtRateOK => "At Rate OK",
15089 BatterySystem::SmartBatteryErrorCode => "Smart Battery Error Code",
15090 BatterySystem::NeedReplacement => "Need Replacement",
15091 BatterySystem::AtRateTimeToFull => "At Rate Time To Full",
15092 BatterySystem::AtRateTimeToEmpty => "At Rate Time To Empty",
15093 BatterySystem::AverageCurrent => "Average Current",
15094 BatterySystem::MaxError => "Max Error",
15095 BatterySystem::RelativeStateOfCharge => "Relative State Of Charge",
15096 BatterySystem::AbsoluteStateOfCharge => "Absolute State Of Charge",
15097 BatterySystem::RemainingCapacity => "Remaining Capacity",
15098 BatterySystem::FullChargeCapacity => "Full Charge Capacity",
15099 BatterySystem::RunTimeToEmpty => "Run Time To Empty",
15100 BatterySystem::AverageTimeToEmpty => "Average Time To Empty",
15101 BatterySystem::AverageTimeToFull => "Average Time To Full",
15102 BatterySystem::CycleCount => "Cycle Count",
15103 BatterySystem::BatteryPackModelLevel => "Battery Pack Model Level",
15104 BatterySystem::InternalChargeController => "Internal Charge Controller",
15105 BatterySystem::PrimaryBatterySupport => "Primary Battery Support",
15106 BatterySystem::DesignCapacity => "Design Capacity",
15107 BatterySystem::SpecificationInfo => "Specification Info",
15108 BatterySystem::ManufactureDate => "Manufacture Date",
15109 BatterySystem::SerialNumber => "Serial Number",
15110 BatterySystem::iManufacturerName => "iManufacturer Name",
15111 BatterySystem::iDeviceName => "iDevice Name",
15112 BatterySystem::iDeviceChemistry => "iDevice Chemistry",
15113 BatterySystem::ManufacturerData => "Manufacturer Data",
15114 BatterySystem::Rechargable => "Rechargable",
15115 BatterySystem::WarningCapacityLimit => "Warning Capacity Limit",
15116 BatterySystem::CapacityGranularity1 => "Capacity Granularity 1",
15117 BatterySystem::CapacityGranularity2 => "Capacity Granularity 2",
15118 BatterySystem::iOEMInformation => "iOEM Information",
15119 BatterySystem::InhibitCharge => "Inhibit Charge",
15120 BatterySystem::EnablePolling => "Enable Polling",
15121 BatterySystem::ResetToZero => "Reset To Zero",
15122 BatterySystem::ACPresent => "AC Present",
15123 BatterySystem::BatteryPresent => "Battery Present",
15124 BatterySystem::PowerFail => "Power Fail",
15125 BatterySystem::AlarmInhibited => "Alarm Inhibited",
15126 BatterySystem::ThermistorUnderRange => "Thermistor Under Range",
15127 BatterySystem::ThermistorHot => "Thermistor Hot",
15128 BatterySystem::ThermistorCold => "Thermistor Cold",
15129 BatterySystem::ThermistorOverRange => "Thermistor Over Range",
15130 BatterySystem::VoltageOutOfRange => "Voltage Out Of Range",
15131 BatterySystem::CurrentOutOfRange => "Current Out Of Range",
15132 BatterySystem::CurrentNotRegulated => "Current Not Regulated",
15133 BatterySystem::VoltageNotRegulated => "Voltage Not Regulated",
15134 BatterySystem::MasterMode => "Master Mode",
15135 BatterySystem::ChargerSelectorSupport => "Charger Selector Support",
15136 BatterySystem::ChargerSpec => "Charger Spec",
15137 BatterySystem::Level2 => "Level 2",
15138 BatterySystem::Level3 => "Level 3",
15139 }
15140 .into()
15141 }
15142 }
15143
15144 #[cfg(feature = "std")]
15145 impl fmt::Display for BatterySystem {
15146 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15147 write!(f, "{}", self.name())
15148 }
15149 }
15150
15151 impl AsUsage for BatterySystem {
15152 /// Returns the 32 bit Usage value of this Usage
15153 fn usage_value(&self) -> u32 {
15154 u32::from(self)
15155 }
15156
15157 /// Returns the 16 bit Usage ID value of this Usage
15158 fn usage_id_value(&self) -> u16 {
15159 u16::from(self)
15160 }
15161
15162 /// Returns this usage as [Usage::BatterySystem(self)](Usage::BatterySystem)
15163 /// This is a convenience function to avoid having
15164 /// to implement `From` for every used type in the caller.
15165 ///
15166 /// ```
15167 /// # use hut::*;
15168 /// let gd_x = GenericDesktop::X;
15169 /// let usage = Usage::from(GenericDesktop::X);
15170 /// assert!(matches!(gd_x.usage(), usage));
15171 /// ```
15172 fn usage(&self) -> Usage {
15173 Usage::from(self)
15174 }
15175 }
15176
15177 impl AsUsagePage for BatterySystem {
15178 /// Returns the 16 bit value of this UsagePage
15179 ///
15180 /// This value is `0x85` for [BatterySystem]
15181 fn usage_page_value(&self) -> u16 {
15182 let up = UsagePage::from(self);
15183 u16::from(up)
15184 }
15185
15186 /// Returns [UsagePage::BatterySystem]]
15187 fn usage_page(&self) -> UsagePage {
15188 UsagePage::from(self)
15189 }
15190 }
15191
15192 impl From<&BatterySystem> for u16 {
15193 fn from(batterysystem: &BatterySystem) -> u16 {
15194 *batterysystem as u16
15195 }
15196 }
15197
15198 impl From<BatterySystem> for u16 {
15199 /// Returns the 16bit value of this usage. This is identical
15200 /// to [BatterySystem::usage_page_value()].
15201 fn from(batterysystem: BatterySystem) -> u16 {
15202 u16::from(&batterysystem)
15203 }
15204 }
15205
15206 impl From<&BatterySystem> for u32 {
15207 /// Returns the 32 bit value of this usage. This is identical
15208 /// to [BatterySystem::usage_value()].
15209 fn from(batterysystem: &BatterySystem) -> u32 {
15210 let up = UsagePage::from(batterysystem);
15211 let up = (u16::from(&up) as u32) << 16;
15212 let id = u16::from(batterysystem) as u32;
15213 up | id
15214 }
15215 }
15216
15217 impl From<&BatterySystem> for UsagePage {
15218 /// Always returns [UsagePage::BatterySystem] and is
15219 /// identical to [BatterySystem::usage_page()].
15220 fn from(_: &BatterySystem) -> UsagePage {
15221 UsagePage::BatterySystem
15222 }
15223 }
15224
15225 impl From<BatterySystem> for UsagePage {
15226 /// Always returns [UsagePage::BatterySystem] and is
15227 /// identical to [BatterySystem::usage_page()].
15228 fn from(_: BatterySystem) -> UsagePage {
15229 UsagePage::BatterySystem
15230 }
15231 }
15232
15233 impl From<&BatterySystem> for Usage {
15234 fn from(batterysystem: &BatterySystem) -> Usage {
15235 Usage::try_from(u32::from(batterysystem)).unwrap()
15236 }
15237 }
15238
15239 impl From<BatterySystem> for Usage {
15240 fn from(batterysystem: BatterySystem) -> Usage {
15241 Usage::from(&batterysystem)
15242 }
15243 }
15244
15245 impl TryFrom<u16> for BatterySystem {
15246 type Error = HutError;
15247
15248 fn try_from(usage_id: u16) -> Result<BatterySystem> {
15249 match usage_id {
15250 1 => Ok(BatterySystem::SmartBatteryBatteryMode),
15251 2 => Ok(BatterySystem::SmartBatteryBatteryStatus),
15252 3 => Ok(BatterySystem::SmartBatteryAlarmWarning),
15253 4 => Ok(BatterySystem::SmartBatteryChargerMode),
15254 5 => Ok(BatterySystem::SmartBatteryChargerStatus),
15255 6 => Ok(BatterySystem::SmartBatteryChargerSpecInfo),
15256 7 => Ok(BatterySystem::SmartBatterySelectorState),
15257 8 => Ok(BatterySystem::SmartBatterySelectorPresets),
15258 9 => Ok(BatterySystem::SmartBatterySelectorInfo),
15259 16 => Ok(BatterySystem::OptionalMfgFunction1),
15260 17 => Ok(BatterySystem::OptionalMfgFunction2),
15261 18 => Ok(BatterySystem::OptionalMfgFunction3),
15262 19 => Ok(BatterySystem::OptionalMfgFunction4),
15263 20 => Ok(BatterySystem::OptionalMfgFunction5),
15264 21 => Ok(BatterySystem::ConnectionToSMBus),
15265 22 => Ok(BatterySystem::OutputConnection),
15266 23 => Ok(BatterySystem::ChargerConnection),
15267 24 => Ok(BatterySystem::BatteryInsertion),
15268 25 => Ok(BatterySystem::UseNext),
15269 26 => Ok(BatterySystem::OKToUse),
15270 27 => Ok(BatterySystem::BatterySupported),
15271 28 => Ok(BatterySystem::SelectorRevision),
15272 29 => Ok(BatterySystem::ChargingIndicator),
15273 40 => Ok(BatterySystem::ManufacturerAccess),
15274 41 => Ok(BatterySystem::RemainingCapacityLimit),
15275 42 => Ok(BatterySystem::RemainingTimeLimit),
15276 43 => Ok(BatterySystem::AtRate),
15277 44 => Ok(BatterySystem::CapacityMode),
15278 45 => Ok(BatterySystem::BroadcastToCharger),
15279 46 => Ok(BatterySystem::PrimaryBattery),
15280 47 => Ok(BatterySystem::ChargeController),
15281 64 => Ok(BatterySystem::TerminateCharge),
15282 65 => Ok(BatterySystem::TerminateDischarge),
15283 66 => Ok(BatterySystem::BelowRemainingCapacityLimit),
15284 67 => Ok(BatterySystem::RemainingTimeLimitExpired),
15285 68 => Ok(BatterySystem::Charging),
15286 69 => Ok(BatterySystem::Discharging),
15287 70 => Ok(BatterySystem::FullyCharged),
15288 71 => Ok(BatterySystem::FullyDischarged),
15289 72 => Ok(BatterySystem::ConditioningFlag),
15290 73 => Ok(BatterySystem::AtRateOK),
15291 74 => Ok(BatterySystem::SmartBatteryErrorCode),
15292 75 => Ok(BatterySystem::NeedReplacement),
15293 96 => Ok(BatterySystem::AtRateTimeToFull),
15294 97 => Ok(BatterySystem::AtRateTimeToEmpty),
15295 98 => Ok(BatterySystem::AverageCurrent),
15296 99 => Ok(BatterySystem::MaxError),
15297 100 => Ok(BatterySystem::RelativeStateOfCharge),
15298 101 => Ok(BatterySystem::AbsoluteStateOfCharge),
15299 102 => Ok(BatterySystem::RemainingCapacity),
15300 103 => Ok(BatterySystem::FullChargeCapacity),
15301 104 => Ok(BatterySystem::RunTimeToEmpty),
15302 105 => Ok(BatterySystem::AverageTimeToEmpty),
15303 106 => Ok(BatterySystem::AverageTimeToFull),
15304 107 => Ok(BatterySystem::CycleCount),
15305 128 => Ok(BatterySystem::BatteryPackModelLevel),
15306 129 => Ok(BatterySystem::InternalChargeController),
15307 130 => Ok(BatterySystem::PrimaryBatterySupport),
15308 131 => Ok(BatterySystem::DesignCapacity),
15309 132 => Ok(BatterySystem::SpecificationInfo),
15310 133 => Ok(BatterySystem::ManufactureDate),
15311 134 => Ok(BatterySystem::SerialNumber),
15312 135 => Ok(BatterySystem::iManufacturerName),
15313 136 => Ok(BatterySystem::iDeviceName),
15314 137 => Ok(BatterySystem::iDeviceChemistry),
15315 138 => Ok(BatterySystem::ManufacturerData),
15316 139 => Ok(BatterySystem::Rechargable),
15317 140 => Ok(BatterySystem::WarningCapacityLimit),
15318 141 => Ok(BatterySystem::CapacityGranularity1),
15319 142 => Ok(BatterySystem::CapacityGranularity2),
15320 143 => Ok(BatterySystem::iOEMInformation),
15321 192 => Ok(BatterySystem::InhibitCharge),
15322 193 => Ok(BatterySystem::EnablePolling),
15323 194 => Ok(BatterySystem::ResetToZero),
15324 208 => Ok(BatterySystem::ACPresent),
15325 209 => Ok(BatterySystem::BatteryPresent),
15326 210 => Ok(BatterySystem::PowerFail),
15327 211 => Ok(BatterySystem::AlarmInhibited),
15328 212 => Ok(BatterySystem::ThermistorUnderRange),
15329 213 => Ok(BatterySystem::ThermistorHot),
15330 214 => Ok(BatterySystem::ThermistorCold),
15331 215 => Ok(BatterySystem::ThermistorOverRange),
15332 216 => Ok(BatterySystem::VoltageOutOfRange),
15333 217 => Ok(BatterySystem::CurrentOutOfRange),
15334 218 => Ok(BatterySystem::CurrentNotRegulated),
15335 219 => Ok(BatterySystem::VoltageNotRegulated),
15336 220 => Ok(BatterySystem::MasterMode),
15337 240 => Ok(BatterySystem::ChargerSelectorSupport),
15338 241 => Ok(BatterySystem::ChargerSpec),
15339 242 => Ok(BatterySystem::Level2),
15340 243 => Ok(BatterySystem::Level3),
15341 n => Err(HutError::UnknownUsageId { usage_id: n }),
15342 }
15343 }
15344 }
15345
15346 impl BitOr<u16> for BatterySystem {
15347 type Output = Usage;
15348
15349 /// A convenience function to combine a Usage Page with
15350 /// a value.
15351 ///
15352 /// This function panics if the Usage ID value results in
15353 /// an unknown Usage. Where error checking is required,
15354 /// use [UsagePage::to_usage_from_value].
15355 fn bitor(self, usage: u16) -> Usage {
15356 let up = u16::from(self) as u32;
15357 let u = usage as u32;
15358 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
15359 }
15360 }
15361
15362 /// *Usage Page `0x8C`: "Barcode Scanner"*
15363 ///
15364 /// **This enum is autogenerated from the HID Usage Tables**.
15365 /// ```
15366 /// # use hut::*;
15367 /// let u1 = Usage::BarcodeScanner(BarcodeScanner::BarcodeScanner);
15368 /// let u2 = Usage::new_from_page_and_id(0x8C, 0x2).unwrap();
15369 /// let u3 = Usage::from(BarcodeScanner::BarcodeScanner);
15370 /// let u4: Usage = BarcodeScanner::BarcodeScanner.into();
15371 /// assert_eq!(u1, u2);
15372 /// assert_eq!(u1, u3);
15373 /// assert_eq!(u1, u4);
15374 ///
15375 /// assert!(matches!(u1.usage_page(), UsagePage::BarcodeScanner));
15376 /// assert_eq!(0x8C, u1.usage_page_value());
15377 /// assert_eq!(0x2, u1.usage_id_value());
15378 /// assert_eq!((0x8C << 16) | 0x2, u1.usage_value());
15379 /// assert_eq!("Barcode Scanner", u1.name());
15380 /// ```
15381 ///
15382 #[allow(non_camel_case_types)]
15383 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
15384 #[non_exhaustive]
15385 #[repr(u16)]
15386 pub enum BarcodeScanner {
15387 /// Usage ID `0x1`: "Barcode Badge Reader"
15388 BarcodeBadgeReader = 0x1,
15389 /// Usage ID `0x2`: "Barcode Scanner"
15390 BarcodeScanner = 0x2,
15391 /// Usage ID `0x3`: "Dumb Bar Code Scanner"
15392 DumbBarCodeScanner = 0x3,
15393 /// Usage ID `0x4`: "Cordless Scanner Base"
15394 CordlessScannerBase = 0x4,
15395 /// Usage ID `0x5`: "Bar Code Scanner Cradle"
15396 BarCodeScannerCradle = 0x5,
15397 /// Usage ID `0x10`: "Attribute Report"
15398 AttributeReport = 0x10,
15399 /// Usage ID `0x11`: "Settings Report"
15400 SettingsReport = 0x11,
15401 /// Usage ID `0x12`: "Scanned Data Report"
15402 ScannedDataReport = 0x12,
15403 /// Usage ID `0x13`: "Raw Scanned Data Report"
15404 RawScannedDataReport = 0x13,
15405 /// Usage ID `0x14`: "Trigger Report"
15406 TriggerReport = 0x14,
15407 /// Usage ID `0x15`: "Status Report"
15408 StatusReport = 0x15,
15409 /// Usage ID `0x16`: "UPC/EAN Control Report"
15410 UPCEANControlReport = 0x16,
15411 /// Usage ID `0x17`: "EAN 2/3 Label Control Report"
15412 EAN23LabelControlReport = 0x17,
15413 /// Usage ID `0x18`: "Code 39 Control Report"
15414 Code39ControlReport = 0x18,
15415 /// Usage ID `0x19`: "Interleaved 2 of 5 Control Report"
15416 Interleaved2of5ControlReport = 0x19,
15417 /// Usage ID `0x1A`: "Standard 2 of 5 Control Report"
15418 Standard2of5ControlReport = 0x1A,
15419 /// Usage ID `0x1B`: "MSI Plessey Control Report"
15420 MSIPlesseyControlReport = 0x1B,
15421 /// Usage ID `0x1C`: "Codabar Control Report"
15422 CodabarControlReport = 0x1C,
15423 /// Usage ID `0x1D`: "Code 128 Control Report"
15424 Code128ControlReport = 0x1D,
15425 /// Usage ID `0x1E`: "Misc 1D Control Report"
15426 Misc1DControlReport = 0x1E,
15427 /// Usage ID `0x1F`: "2D Control Report"
15428 TwoDControlReport = 0x1F,
15429 /// Usage ID `0x30`: "Aiming/Pointer Mode"
15430 AimingPointerMode = 0x30,
15431 /// Usage ID `0x31`: "Bar Code Present Sensor"
15432 BarCodePresentSensor = 0x31,
15433 /// Usage ID `0x32`: "Class 1A Laser"
15434 Class1ALaser = 0x32,
15435 /// Usage ID `0x33`: "Class 2 Laser"
15436 Class2Laser = 0x33,
15437 /// Usage ID `0x34`: "Heater Present"
15438 HeaterPresent = 0x34,
15439 /// Usage ID `0x35`: "Contact Scanner"
15440 ContactScanner = 0x35,
15441 /// Usage ID `0x36`: "Electronic Article Surveillance Notification"
15442 ElectronicArticleSurveillanceNotification = 0x36,
15443 /// Usage ID `0x37`: "Constant Electronic Article Surveillance"
15444 ConstantElectronicArticleSurveillance = 0x37,
15445 /// Usage ID `0x38`: "Error Indication"
15446 ErrorIndication = 0x38,
15447 /// Usage ID `0x39`: "Fixed Beeper"
15448 FixedBeeper = 0x39,
15449 /// Usage ID `0x3A`: "Good Decode Indication"
15450 GoodDecodeIndication = 0x3A,
15451 /// Usage ID `0x3B`: "Hands Free Scanning"
15452 HandsFreeScanning = 0x3B,
15453 /// Usage ID `0x3C`: "Intrinsically Safe"
15454 IntrinsicallySafe = 0x3C,
15455 /// Usage ID `0x3D`: "Klasse Eins Laser"
15456 KlasseEinsLaser = 0x3D,
15457 /// Usage ID `0x3E`: "Long Range Scanner"
15458 LongRangeScanner = 0x3E,
15459 /// Usage ID `0x3F`: "Mirror Speed Control"
15460 MirrorSpeedControl = 0x3F,
15461 /// Usage ID `0x40`: "Not On File Indication"
15462 NotOnFileIndication = 0x40,
15463 /// Usage ID `0x41`: "Programmable Beeper"
15464 ProgrammableBeeper = 0x41,
15465 /// Usage ID `0x42`: "Triggerless"
15466 Triggerless = 0x42,
15467 /// Usage ID `0x43`: "Wand"
15468 Wand = 0x43,
15469 /// Usage ID `0x44`: "Water Resistant"
15470 WaterResistant = 0x44,
15471 /// Usage ID `0x45`: "Multi-Range Scanner"
15472 MultiRangeScanner = 0x45,
15473 /// Usage ID `0x46`: "Proximity Sensor"
15474 ProximitySensor = 0x46,
15475 /// Usage ID `0x4D`: "Fragment Decoding"
15476 FragmentDecoding = 0x4D,
15477 /// Usage ID `0x4E`: "Scanner Read Confidence"
15478 ScannerReadConfidence = 0x4E,
15479 /// Usage ID `0x4F`: "Data Prefix"
15480 DataPrefix = 0x4F,
15481 /// Usage ID `0x50`: "Prefix AIMI"
15482 PrefixAIMI = 0x50,
15483 /// Usage ID `0x51`: "Prefix None"
15484 PrefixNone = 0x51,
15485 /// Usage ID `0x52`: "Prefix Proprietary"
15486 PrefixProprietary = 0x52,
15487 /// Usage ID `0x55`: "Active Time"
15488 ActiveTime = 0x55,
15489 /// Usage ID `0x56`: "Aiming Laser Pattern"
15490 AimingLaserPattern = 0x56,
15491 /// Usage ID `0x57`: "Bar Code Present"
15492 BarCodePresent = 0x57,
15493 /// Usage ID `0x58`: "Beeper State"
15494 BeeperState = 0x58,
15495 /// Usage ID `0x59`: "Laser On Time"
15496 LaserOnTime = 0x59,
15497 /// Usage ID `0x5A`: "Laser State"
15498 LaserState = 0x5A,
15499 /// Usage ID `0x5B`: "Lockout Time"
15500 LockoutTime = 0x5B,
15501 /// Usage ID `0x5C`: "Motor State"
15502 MotorState = 0x5C,
15503 /// Usage ID `0x5D`: "Motor Timeout"
15504 MotorTimeout = 0x5D,
15505 /// Usage ID `0x5E`: "Power On Reset Scanner"
15506 PowerOnResetScanner = 0x5E,
15507 /// Usage ID `0x5F`: "Prevent Read of Barcodes"
15508 PreventReadofBarcodes = 0x5F,
15509 /// Usage ID `0x60`: "Initiate Barcode Read"
15510 InitiateBarcodeRead = 0x60,
15511 /// Usage ID `0x61`: "Trigger State"
15512 TriggerState = 0x61,
15513 /// Usage ID `0x62`: "Trigger Mode"
15514 TriggerMode = 0x62,
15515 /// Usage ID `0x63`: "Trigger Mode Blinking Laser On"
15516 TriggerModeBlinkingLaserOn = 0x63,
15517 /// Usage ID `0x64`: "Trigger Mode Continuous Laser On"
15518 TriggerModeContinuousLaserOn = 0x64,
15519 /// Usage ID `0x65`: "Trigger Mode Laser on while Pulled"
15520 TriggerModeLaseronwhilePulled = 0x65,
15521 /// Usage ID `0x66`: "Trigger Mode Laser stays on after release"
15522 TriggerModeLaserstaysonafterrelease = 0x66,
15523 /// Usage ID `0x6D`: "Commit Parameters to NVM"
15524 CommitParameterstoNVM = 0x6D,
15525 /// Usage ID `0x6E`: "Parameter Scanning"
15526 ParameterScanning = 0x6E,
15527 /// Usage ID `0x6F`: "Parameters Changed"
15528 ParametersChanged = 0x6F,
15529 /// Usage ID `0x70`: "Set parameter default values"
15530 Setparameterdefaultvalues = 0x70,
15531 /// Usage ID `0x75`: "Scanner In Cradle"
15532 ScannerInCradle = 0x75,
15533 /// Usage ID `0x76`: "Scanner In Range"
15534 ScannerInRange = 0x76,
15535 /// Usage ID `0x7A`: "Aim Duration"
15536 AimDuration = 0x7A,
15537 /// Usage ID `0x7B`: "Good Read Lamp Duration"
15538 GoodReadLampDuration = 0x7B,
15539 /// Usage ID `0x7C`: "Good Read Lamp Intensity"
15540 GoodReadLampIntensity = 0x7C,
15541 /// Usage ID `0x7D`: "Good Read LED"
15542 GoodReadLED = 0x7D,
15543 /// Usage ID `0x7E`: "Good Read Tone Frequency"
15544 GoodReadToneFrequency = 0x7E,
15545 /// Usage ID `0x7F`: "Good Read Tone Length"
15546 GoodReadToneLength = 0x7F,
15547 /// Usage ID `0x80`: "Good Read Tone Volume"
15548 GoodReadToneVolume = 0x80,
15549 /// Usage ID `0x82`: "No Read Message"
15550 NoReadMessage = 0x82,
15551 /// Usage ID `0x83`: "Not on File Volume"
15552 NotonFileVolume = 0x83,
15553 /// Usage ID `0x84`: "Powerup Beep"
15554 PowerupBeep = 0x84,
15555 /// Usage ID `0x85`: "Sound Error Beep"
15556 SoundErrorBeep = 0x85,
15557 /// Usage ID `0x86`: "Sound Good Read Beep"
15558 SoundGoodReadBeep = 0x86,
15559 /// Usage ID `0x87`: "Sound Not On File Beep"
15560 SoundNotOnFileBeep = 0x87,
15561 /// Usage ID `0x88`: "Good Read When to Write"
15562 GoodReadWhentoWrite = 0x88,
15563 /// Usage ID `0x89`: "GRWTI After Decode"
15564 GRWTIAfterDecode = 0x89,
15565 /// Usage ID `0x8A`: "GRWTI Beep/Lamp after transmit"
15566 GRWTIBeepLampaftertransmit = 0x8A,
15567 /// Usage ID `0x8B`: "GRWTI No Beep/Lamp use at all"
15568 GRWTINoBeepLampuseatall = 0x8B,
15569 /// Usage ID `0x91`: "Bookland EAN"
15570 BooklandEAN = 0x91,
15571 /// Usage ID `0x92`: "Convert EAN 8 to 13 Type"
15572 ConvertEAN8to13Type = 0x92,
15573 /// Usage ID `0x93`: "Convert UPC A to EAN-13"
15574 ConvertUPCAtoEAN13 = 0x93,
15575 /// Usage ID `0x94`: "Convert UPC-E to A"
15576 ConvertUPCEtoA = 0x94,
15577 /// Usage ID `0x95`: "EAN-13"
15578 EAN13 = 0x95,
15579 /// Usage ID `0x96`: "EAN-8"
15580 EAN8 = 0x96,
15581 /// Usage ID `0x97`: "EAN-99 128 Mandatory"
15582 EAN99128Mandatory = 0x97,
15583 /// Usage ID `0x98`: "EAN-99 P5/128 Optional"
15584 EAN99P5128Optional = 0x98,
15585 /// Usage ID `0x99`: "Enable EAN Two Label"
15586 EnableEANTwoLabel = 0x99,
15587 /// Usage ID `0x9A`: "UPC/EAN"
15588 UPCEAN = 0x9A,
15589 /// Usage ID `0x9B`: "UPC/EAN Coupon Code"
15590 UPCEANCouponCode = 0x9B,
15591 /// Usage ID `0x9C`: "UPC/EAN Periodicals"
15592 UPCEANPeriodicals = 0x9C,
15593 /// Usage ID `0x9D`: "UPC-A"
15594 UPCA = 0x9D,
15595 /// Usage ID `0x9E`: "UPC-A with 128 Mandatory"
15596 UPCAwith128Mandatory = 0x9E,
15597 /// Usage ID `0x9F`: "UPC-A with 128 Optional"
15598 UPCAwith128Optional = 0x9F,
15599 /// Usage ID `0xA0`: "UPC-A with P5 Optional"
15600 UPCAwithP5Optional = 0xA0,
15601 /// Usage ID `0xA1`: "UPC-E"
15602 UPCE = 0xA1,
15603 /// Usage ID `0xA2`: "UPC-E1"
15604 UPCE1 = 0xA2,
15605 /// Usage ID `0xA9`: "Periodical"
15606 Periodical = 0xA9,
15607 /// Usage ID `0xAA`: "Periodical Auto-Discriminate +2"
15608 PeriodicalAutoDiscriminatePlus2 = 0xAA,
15609 /// Usage ID `0xAB`: "Periodical Only Decode with +2"
15610 PeriodicalOnlyDecodewithPlus2 = 0xAB,
15611 /// Usage ID `0xAC`: "Periodical Ignore +2"
15612 PeriodicalIgnorePlus2 = 0xAC,
15613 /// Usage ID `0xAD`: "Periodical Auto-Discriminate +5"
15614 PeriodicalAutoDiscriminatePlus5 = 0xAD,
15615 /// Usage ID `0xAE`: "Periodical Only Decode with +5"
15616 PeriodicalOnlyDecodewithPlus5 = 0xAE,
15617 /// Usage ID `0xAF`: "Periodical Ignore +5"
15618 PeriodicalIgnorePlus5 = 0xAF,
15619 /// Usage ID `0xB0`: "Check"
15620 Check = 0xB0,
15621 /// Usage ID `0xB1`: "Check Disable Price"
15622 CheckDisablePrice = 0xB1,
15623 /// Usage ID `0xB2`: "Check Enable 4 digit Price"
15624 CheckEnable4digitPrice = 0xB2,
15625 /// Usage ID `0xB3`: "Check Enable 5 digit Price"
15626 CheckEnable5digitPrice = 0xB3,
15627 /// Usage ID `0xB4`: "Check Enable European 4 digit Price"
15628 CheckEnableEuropean4digitPrice = 0xB4,
15629 /// Usage ID `0xB5`: "Check Enable European 5 digit Price"
15630 CheckEnableEuropean5digitPrice = 0xB5,
15631 /// Usage ID `0xB7`: "EAN Two Label"
15632 EANTwoLabel = 0xB7,
15633 /// Usage ID `0xB8`: "EAN Three Label"
15634 EANThreeLabel = 0xB8,
15635 /// Usage ID `0xB9`: "EAN 8 Flag Digit 1"
15636 EAN8FlagDigit1 = 0xB9,
15637 /// Usage ID `0xBA`: "EAN 8 Flag Digit 2"
15638 EAN8FlagDigit2 = 0xBA,
15639 /// Usage ID `0xBB`: "EAN 8 Flag Digit 3"
15640 EAN8FlagDigit3 = 0xBB,
15641 /// Usage ID `0xBC`: "EAN 13 Flag Digit 1"
15642 EAN13FlagDigit1 = 0xBC,
15643 /// Usage ID `0xBD`: "EAN 13 Flag Digit 2"
15644 EAN13FlagDigit2 = 0xBD,
15645 /// Usage ID `0xBE`: "EAN 13 Flag Digit 3"
15646 EAN13FlagDigit3 = 0xBE,
15647 /// Usage ID `0xBF`: "Add EAN 2/3 Label Definition"
15648 AddEAN23LabelDefinition = 0xBF,
15649 /// Usage ID `0xC0`: "Clear all EAN 2/3 Label Definitions"
15650 ClearallEAN23LabelDefinitions = 0xC0,
15651 /// Usage ID `0xC3`: "Codabar"
15652 Codabar = 0xC3,
15653 /// Usage ID `0xC4`: "Code 128"
15654 Code128 = 0xC4,
15655 /// Usage ID `0xC7`: "Code 39"
15656 Code39 = 0xC7,
15657 /// Usage ID `0xC8`: "Code 93"
15658 Code93 = 0xC8,
15659 /// Usage ID `0xC9`: "Full ASCII Conversion"
15660 FullASCIIConversion = 0xC9,
15661 /// Usage ID `0xCA`: "Interleaved 2 of 5"
15662 Interleaved2of5 = 0xCA,
15663 /// Usage ID `0xCB`: "Italian Pharmacy Code"
15664 ItalianPharmacyCode = 0xCB,
15665 /// Usage ID `0xCC`: "MSI/Plessey"
15666 MSIPlessey = 0xCC,
15667 /// Usage ID `0xCD`: "Standard 2 of 5 IATA"
15668 Standard2of5IATA = 0xCD,
15669 /// Usage ID `0xCE`: "Standard 2 of 5"
15670 Standard2of5 = 0xCE,
15671 /// Usage ID `0xD3`: "Transmit Start/Stop"
15672 TransmitStartStop = 0xD3,
15673 /// Usage ID `0xD4`: "Tri-Optic"
15674 TriOptic = 0xD4,
15675 /// Usage ID `0xD5`: "UCC/EAN-128"
15676 UCCEAN128 = 0xD5,
15677 /// Usage ID `0xD6`: "Check Digit"
15678 CheckDigit = 0xD6,
15679 /// Usage ID `0xD7`: "Check Digit Disable"
15680 CheckDigitDisable = 0xD7,
15681 /// Usage ID `0xD8`: "Check Digit Enable Interleaved 2 of 5 OPCC"
15682 CheckDigitEnableInterleaved2of5OPCC = 0xD8,
15683 /// Usage ID `0xD9`: "Check Digit Enable Interleaved 2 of 5 USS"
15684 CheckDigitEnableInterleaved2of5USS = 0xD9,
15685 /// Usage ID `0xDA`: "Check Digit Enable Standard 2 of 5 OPCC"
15686 CheckDigitEnableStandard2of5OPCC = 0xDA,
15687 /// Usage ID `0xDB`: "Check Digit Enable Standard 2 of 5 USS"
15688 CheckDigitEnableStandard2of5USS = 0xDB,
15689 /// Usage ID `0xDC`: "Check Digit Enable One MSI Plessey"
15690 CheckDigitEnableOneMSIPlessey = 0xDC,
15691 /// Usage ID `0xDD`: "Check Digit Enable Two MSI Plessey"
15692 CheckDigitEnableTwoMSIPlessey = 0xDD,
15693 /// Usage ID `0xDE`: "Check Digit Codabar Enable"
15694 CheckDigitCodabarEnable = 0xDE,
15695 /// Usage ID `0xDF`: "Check Digit Code 39 Enable"
15696 CheckDigitCode39Enable = 0xDF,
15697 /// Usage ID `0xF0`: "Transmit Check Digit"
15698 TransmitCheckDigit = 0xF0,
15699 /// Usage ID `0xF1`: "Disable Check Digit Transmit"
15700 DisableCheckDigitTransmit = 0xF1,
15701 /// Usage ID `0xF2`: "Enable Check Digit Transmit"
15702 EnableCheckDigitTransmit = 0xF2,
15703 /// Usage ID `0xFB`: "Symbology Identifier 1"
15704 SymbologyIdentifier1 = 0xFB,
15705 /// Usage ID `0xFC`: "Symbology Identifier 2"
15706 SymbologyIdentifier2 = 0xFC,
15707 /// Usage ID `0xFD`: "Symbology Identifier 3"
15708 SymbologyIdentifier3 = 0xFD,
15709 /// Usage ID `0xFE`: "Decoded Data"
15710 DecodedData = 0xFE,
15711 /// Usage ID `0xFF`: "Decode Data Continued"
15712 DecodeDataContinued = 0xFF,
15713 /// Usage ID `0x100`: "Bar Space Data"
15714 BarSpaceData = 0x100,
15715 /// Usage ID `0x101`: "Scanner Data Accuracy"
15716 ScannerDataAccuracy = 0x101,
15717 /// Usage ID `0x102`: "Raw Data Polarity"
15718 RawDataPolarity = 0x102,
15719 /// Usage ID `0x103`: "Polarity Inverted Bar Code"
15720 PolarityInvertedBarCode = 0x103,
15721 /// Usage ID `0x104`: "Polarity Normal Bar Code"
15722 PolarityNormalBarCode = 0x104,
15723 /// Usage ID `0x106`: "Minimum Length to Decode"
15724 MinimumLengthtoDecode = 0x106,
15725 /// Usage ID `0x107`: "Maximum Length to Decode"
15726 MaximumLengthtoDecode = 0x107,
15727 /// Usage ID `0x108`: "Discrete Length to Decode 1"
15728 DiscreteLengthtoDecode1 = 0x108,
15729 /// Usage ID `0x109`: "Discrete Length to Decode 2"
15730 DiscreteLengthtoDecode2 = 0x109,
15731 /// Usage ID `0x10A`: "Data Length Method"
15732 DataLengthMethod = 0x10A,
15733 /// Usage ID `0x10B`: "DL Method Read any"
15734 DLMethodReadany = 0x10B,
15735 /// Usage ID `0x10C`: "DL Method Check in Range"
15736 DLMethodCheckinRange = 0x10C,
15737 /// Usage ID `0x10D`: "DL Method Check for Discrete"
15738 DLMethodCheckforDiscrete = 0x10D,
15739 /// Usage ID `0x110`: "Aztec Code"
15740 AztecCode = 0x110,
15741 /// Usage ID `0x111`: "BC412"
15742 BC412 = 0x111,
15743 /// Usage ID `0x112`: "Channel Code"
15744 ChannelCode = 0x112,
15745 /// Usage ID `0x113`: "Code 16"
15746 Code16 = 0x113,
15747 /// Usage ID `0x114`: "Code 32"
15748 Code32 = 0x114,
15749 /// Usage ID `0x115`: "Code 49"
15750 Code49 = 0x115,
15751 /// Usage ID `0x116`: "Code One"
15752 CodeOne = 0x116,
15753 /// Usage ID `0x117`: "Colorcode"
15754 Colorcode = 0x117,
15755 /// Usage ID `0x118`: "Data Matrix"
15756 DataMatrix = 0x118,
15757 /// Usage ID `0x119`: "MaxiCode"
15758 MaxiCode = 0x119,
15759 /// Usage ID `0x11A`: "MicroPDF"
15760 MicroPDF = 0x11A,
15761 /// Usage ID `0x11B`: "PDF-417"
15762 PDF417 = 0x11B,
15763 /// Usage ID `0x11C`: "PosiCode"
15764 PosiCode = 0x11C,
15765 /// Usage ID `0x11D`: "QR Code"
15766 QRCode = 0x11D,
15767 /// Usage ID `0x11E`: "SuperCode"
15768 SuperCode = 0x11E,
15769 /// Usage ID `0x11F`: "UltraCode"
15770 UltraCode = 0x11F,
15771 /// Usage ID `0x120`: "USD-5 (Slug Code)"
15772 USD5SlugCode = 0x120,
15773 /// Usage ID `0x121`: "VeriCode"
15774 VeriCode = 0x121,
15775 }
15776
15777 impl BarcodeScanner {
15778 #[cfg(feature = "std")]
15779 pub fn name(&self) -> String {
15780 match self {
15781 BarcodeScanner::BarcodeBadgeReader => "Barcode Badge Reader",
15782 BarcodeScanner::BarcodeScanner => "Barcode Scanner",
15783 BarcodeScanner::DumbBarCodeScanner => "Dumb Bar Code Scanner",
15784 BarcodeScanner::CordlessScannerBase => "Cordless Scanner Base",
15785 BarcodeScanner::BarCodeScannerCradle => "Bar Code Scanner Cradle",
15786 BarcodeScanner::AttributeReport => "Attribute Report",
15787 BarcodeScanner::SettingsReport => "Settings Report",
15788 BarcodeScanner::ScannedDataReport => "Scanned Data Report",
15789 BarcodeScanner::RawScannedDataReport => "Raw Scanned Data Report",
15790 BarcodeScanner::TriggerReport => "Trigger Report",
15791 BarcodeScanner::StatusReport => "Status Report",
15792 BarcodeScanner::UPCEANControlReport => "UPC/EAN Control Report",
15793 BarcodeScanner::EAN23LabelControlReport => "EAN 2/3 Label Control Report",
15794 BarcodeScanner::Code39ControlReport => "Code 39 Control Report",
15795 BarcodeScanner::Interleaved2of5ControlReport => "Interleaved 2 of 5 Control Report",
15796 BarcodeScanner::Standard2of5ControlReport => "Standard 2 of 5 Control Report",
15797 BarcodeScanner::MSIPlesseyControlReport => "MSI Plessey Control Report",
15798 BarcodeScanner::CodabarControlReport => "Codabar Control Report",
15799 BarcodeScanner::Code128ControlReport => "Code 128 Control Report",
15800 BarcodeScanner::Misc1DControlReport => "Misc 1D Control Report",
15801 BarcodeScanner::TwoDControlReport => "2D Control Report",
15802 BarcodeScanner::AimingPointerMode => "Aiming/Pointer Mode",
15803 BarcodeScanner::BarCodePresentSensor => "Bar Code Present Sensor",
15804 BarcodeScanner::Class1ALaser => "Class 1A Laser",
15805 BarcodeScanner::Class2Laser => "Class 2 Laser",
15806 BarcodeScanner::HeaterPresent => "Heater Present",
15807 BarcodeScanner::ContactScanner => "Contact Scanner",
15808 BarcodeScanner::ElectronicArticleSurveillanceNotification => {
15809 "Electronic Article Surveillance Notification"
15810 }
15811 BarcodeScanner::ConstantElectronicArticleSurveillance => {
15812 "Constant Electronic Article Surveillance"
15813 }
15814 BarcodeScanner::ErrorIndication => "Error Indication",
15815 BarcodeScanner::FixedBeeper => "Fixed Beeper",
15816 BarcodeScanner::GoodDecodeIndication => "Good Decode Indication",
15817 BarcodeScanner::HandsFreeScanning => "Hands Free Scanning",
15818 BarcodeScanner::IntrinsicallySafe => "Intrinsically Safe",
15819 BarcodeScanner::KlasseEinsLaser => "Klasse Eins Laser",
15820 BarcodeScanner::LongRangeScanner => "Long Range Scanner",
15821 BarcodeScanner::MirrorSpeedControl => "Mirror Speed Control",
15822 BarcodeScanner::NotOnFileIndication => "Not On File Indication",
15823 BarcodeScanner::ProgrammableBeeper => "Programmable Beeper",
15824 BarcodeScanner::Triggerless => "Triggerless",
15825 BarcodeScanner::Wand => "Wand",
15826 BarcodeScanner::WaterResistant => "Water Resistant",
15827 BarcodeScanner::MultiRangeScanner => "Multi-Range Scanner",
15828 BarcodeScanner::ProximitySensor => "Proximity Sensor",
15829 BarcodeScanner::FragmentDecoding => "Fragment Decoding",
15830 BarcodeScanner::ScannerReadConfidence => "Scanner Read Confidence",
15831 BarcodeScanner::DataPrefix => "Data Prefix",
15832 BarcodeScanner::PrefixAIMI => "Prefix AIMI",
15833 BarcodeScanner::PrefixNone => "Prefix None",
15834 BarcodeScanner::PrefixProprietary => "Prefix Proprietary",
15835 BarcodeScanner::ActiveTime => "Active Time",
15836 BarcodeScanner::AimingLaserPattern => "Aiming Laser Pattern",
15837 BarcodeScanner::BarCodePresent => "Bar Code Present",
15838 BarcodeScanner::BeeperState => "Beeper State",
15839 BarcodeScanner::LaserOnTime => "Laser On Time",
15840 BarcodeScanner::LaserState => "Laser State",
15841 BarcodeScanner::LockoutTime => "Lockout Time",
15842 BarcodeScanner::MotorState => "Motor State",
15843 BarcodeScanner::MotorTimeout => "Motor Timeout",
15844 BarcodeScanner::PowerOnResetScanner => "Power On Reset Scanner",
15845 BarcodeScanner::PreventReadofBarcodes => "Prevent Read of Barcodes",
15846 BarcodeScanner::InitiateBarcodeRead => "Initiate Barcode Read",
15847 BarcodeScanner::TriggerState => "Trigger State",
15848 BarcodeScanner::TriggerMode => "Trigger Mode",
15849 BarcodeScanner::TriggerModeBlinkingLaserOn => "Trigger Mode Blinking Laser On",
15850 BarcodeScanner::TriggerModeContinuousLaserOn => "Trigger Mode Continuous Laser On",
15851 BarcodeScanner::TriggerModeLaseronwhilePulled => "Trigger Mode Laser on while Pulled",
15852 BarcodeScanner::TriggerModeLaserstaysonafterrelease => {
15853 "Trigger Mode Laser stays on after release"
15854 }
15855 BarcodeScanner::CommitParameterstoNVM => "Commit Parameters to NVM",
15856 BarcodeScanner::ParameterScanning => "Parameter Scanning",
15857 BarcodeScanner::ParametersChanged => "Parameters Changed",
15858 BarcodeScanner::Setparameterdefaultvalues => "Set parameter default values",
15859 BarcodeScanner::ScannerInCradle => "Scanner In Cradle",
15860 BarcodeScanner::ScannerInRange => "Scanner In Range",
15861 BarcodeScanner::AimDuration => "Aim Duration",
15862 BarcodeScanner::GoodReadLampDuration => "Good Read Lamp Duration",
15863 BarcodeScanner::GoodReadLampIntensity => "Good Read Lamp Intensity",
15864 BarcodeScanner::GoodReadLED => "Good Read LED",
15865 BarcodeScanner::GoodReadToneFrequency => "Good Read Tone Frequency",
15866 BarcodeScanner::GoodReadToneLength => "Good Read Tone Length",
15867 BarcodeScanner::GoodReadToneVolume => "Good Read Tone Volume",
15868 BarcodeScanner::NoReadMessage => "No Read Message",
15869 BarcodeScanner::NotonFileVolume => "Not on File Volume",
15870 BarcodeScanner::PowerupBeep => "Powerup Beep",
15871 BarcodeScanner::SoundErrorBeep => "Sound Error Beep",
15872 BarcodeScanner::SoundGoodReadBeep => "Sound Good Read Beep",
15873 BarcodeScanner::SoundNotOnFileBeep => "Sound Not On File Beep",
15874 BarcodeScanner::GoodReadWhentoWrite => "Good Read When to Write",
15875 BarcodeScanner::GRWTIAfterDecode => "GRWTI After Decode",
15876 BarcodeScanner::GRWTIBeepLampaftertransmit => "GRWTI Beep/Lamp after transmit",
15877 BarcodeScanner::GRWTINoBeepLampuseatall => "GRWTI No Beep/Lamp use at all",
15878 BarcodeScanner::BooklandEAN => "Bookland EAN",
15879 BarcodeScanner::ConvertEAN8to13Type => "Convert EAN 8 to 13 Type",
15880 BarcodeScanner::ConvertUPCAtoEAN13 => "Convert UPC A to EAN-13",
15881 BarcodeScanner::ConvertUPCEtoA => "Convert UPC-E to A",
15882 BarcodeScanner::EAN13 => "EAN-13",
15883 BarcodeScanner::EAN8 => "EAN-8",
15884 BarcodeScanner::EAN99128Mandatory => "EAN-99 128 Mandatory",
15885 BarcodeScanner::EAN99P5128Optional => "EAN-99 P5/128 Optional",
15886 BarcodeScanner::EnableEANTwoLabel => "Enable EAN Two Label",
15887 BarcodeScanner::UPCEAN => "UPC/EAN",
15888 BarcodeScanner::UPCEANCouponCode => "UPC/EAN Coupon Code",
15889 BarcodeScanner::UPCEANPeriodicals => "UPC/EAN Periodicals",
15890 BarcodeScanner::UPCA => "UPC-A",
15891 BarcodeScanner::UPCAwith128Mandatory => "UPC-A with 128 Mandatory",
15892 BarcodeScanner::UPCAwith128Optional => "UPC-A with 128 Optional",
15893 BarcodeScanner::UPCAwithP5Optional => "UPC-A with P5 Optional",
15894 BarcodeScanner::UPCE => "UPC-E",
15895 BarcodeScanner::UPCE1 => "UPC-E1",
15896 BarcodeScanner::Periodical => "Periodical",
15897 BarcodeScanner::PeriodicalAutoDiscriminatePlus2 => "Periodical Auto-Discriminate +2",
15898 BarcodeScanner::PeriodicalOnlyDecodewithPlus2 => "Periodical Only Decode with +2",
15899 BarcodeScanner::PeriodicalIgnorePlus2 => "Periodical Ignore +2",
15900 BarcodeScanner::PeriodicalAutoDiscriminatePlus5 => "Periodical Auto-Discriminate +5",
15901 BarcodeScanner::PeriodicalOnlyDecodewithPlus5 => "Periodical Only Decode with +5",
15902 BarcodeScanner::PeriodicalIgnorePlus5 => "Periodical Ignore +5",
15903 BarcodeScanner::Check => "Check",
15904 BarcodeScanner::CheckDisablePrice => "Check Disable Price",
15905 BarcodeScanner::CheckEnable4digitPrice => "Check Enable 4 digit Price",
15906 BarcodeScanner::CheckEnable5digitPrice => "Check Enable 5 digit Price",
15907 BarcodeScanner::CheckEnableEuropean4digitPrice => "Check Enable European 4 digit Price",
15908 BarcodeScanner::CheckEnableEuropean5digitPrice => "Check Enable European 5 digit Price",
15909 BarcodeScanner::EANTwoLabel => "EAN Two Label",
15910 BarcodeScanner::EANThreeLabel => "EAN Three Label",
15911 BarcodeScanner::EAN8FlagDigit1 => "EAN 8 Flag Digit 1",
15912 BarcodeScanner::EAN8FlagDigit2 => "EAN 8 Flag Digit 2",
15913 BarcodeScanner::EAN8FlagDigit3 => "EAN 8 Flag Digit 3",
15914 BarcodeScanner::EAN13FlagDigit1 => "EAN 13 Flag Digit 1",
15915 BarcodeScanner::EAN13FlagDigit2 => "EAN 13 Flag Digit 2",
15916 BarcodeScanner::EAN13FlagDigit3 => "EAN 13 Flag Digit 3",
15917 BarcodeScanner::AddEAN23LabelDefinition => "Add EAN 2/3 Label Definition",
15918 BarcodeScanner::ClearallEAN23LabelDefinitions => "Clear all EAN 2/3 Label Definitions",
15919 BarcodeScanner::Codabar => "Codabar",
15920 BarcodeScanner::Code128 => "Code 128",
15921 BarcodeScanner::Code39 => "Code 39",
15922 BarcodeScanner::Code93 => "Code 93",
15923 BarcodeScanner::FullASCIIConversion => "Full ASCII Conversion",
15924 BarcodeScanner::Interleaved2of5 => "Interleaved 2 of 5",
15925 BarcodeScanner::ItalianPharmacyCode => "Italian Pharmacy Code",
15926 BarcodeScanner::MSIPlessey => "MSI/Plessey",
15927 BarcodeScanner::Standard2of5IATA => "Standard 2 of 5 IATA",
15928 BarcodeScanner::Standard2of5 => "Standard 2 of 5",
15929 BarcodeScanner::TransmitStartStop => "Transmit Start/Stop",
15930 BarcodeScanner::TriOptic => "Tri-Optic",
15931 BarcodeScanner::UCCEAN128 => "UCC/EAN-128",
15932 BarcodeScanner::CheckDigit => "Check Digit",
15933 BarcodeScanner::CheckDigitDisable => "Check Digit Disable",
15934 BarcodeScanner::CheckDigitEnableInterleaved2of5OPCC => {
15935 "Check Digit Enable Interleaved 2 of 5 OPCC"
15936 }
15937 BarcodeScanner::CheckDigitEnableInterleaved2of5USS => {
15938 "Check Digit Enable Interleaved 2 of 5 USS"
15939 }
15940 BarcodeScanner::CheckDigitEnableStandard2of5OPCC => {
15941 "Check Digit Enable Standard 2 of 5 OPCC"
15942 }
15943 BarcodeScanner::CheckDigitEnableStandard2of5USS => {
15944 "Check Digit Enable Standard 2 of 5 USS"
15945 }
15946 BarcodeScanner::CheckDigitEnableOneMSIPlessey => "Check Digit Enable One MSI Plessey",
15947 BarcodeScanner::CheckDigitEnableTwoMSIPlessey => "Check Digit Enable Two MSI Plessey",
15948 BarcodeScanner::CheckDigitCodabarEnable => "Check Digit Codabar Enable",
15949 BarcodeScanner::CheckDigitCode39Enable => "Check Digit Code 39 Enable",
15950 BarcodeScanner::TransmitCheckDigit => "Transmit Check Digit",
15951 BarcodeScanner::DisableCheckDigitTransmit => "Disable Check Digit Transmit",
15952 BarcodeScanner::EnableCheckDigitTransmit => "Enable Check Digit Transmit",
15953 BarcodeScanner::SymbologyIdentifier1 => "Symbology Identifier 1",
15954 BarcodeScanner::SymbologyIdentifier2 => "Symbology Identifier 2",
15955 BarcodeScanner::SymbologyIdentifier3 => "Symbology Identifier 3",
15956 BarcodeScanner::DecodedData => "Decoded Data",
15957 BarcodeScanner::DecodeDataContinued => "Decode Data Continued",
15958 BarcodeScanner::BarSpaceData => "Bar Space Data",
15959 BarcodeScanner::ScannerDataAccuracy => "Scanner Data Accuracy",
15960 BarcodeScanner::RawDataPolarity => "Raw Data Polarity",
15961 BarcodeScanner::PolarityInvertedBarCode => "Polarity Inverted Bar Code",
15962 BarcodeScanner::PolarityNormalBarCode => "Polarity Normal Bar Code",
15963 BarcodeScanner::MinimumLengthtoDecode => "Minimum Length to Decode",
15964 BarcodeScanner::MaximumLengthtoDecode => "Maximum Length to Decode",
15965 BarcodeScanner::DiscreteLengthtoDecode1 => "Discrete Length to Decode 1",
15966 BarcodeScanner::DiscreteLengthtoDecode2 => "Discrete Length to Decode 2",
15967 BarcodeScanner::DataLengthMethod => "Data Length Method",
15968 BarcodeScanner::DLMethodReadany => "DL Method Read any",
15969 BarcodeScanner::DLMethodCheckinRange => "DL Method Check in Range",
15970 BarcodeScanner::DLMethodCheckforDiscrete => "DL Method Check for Discrete",
15971 BarcodeScanner::AztecCode => "Aztec Code",
15972 BarcodeScanner::BC412 => "BC412",
15973 BarcodeScanner::ChannelCode => "Channel Code",
15974 BarcodeScanner::Code16 => "Code 16",
15975 BarcodeScanner::Code32 => "Code 32",
15976 BarcodeScanner::Code49 => "Code 49",
15977 BarcodeScanner::CodeOne => "Code One",
15978 BarcodeScanner::Colorcode => "Colorcode",
15979 BarcodeScanner::DataMatrix => "Data Matrix",
15980 BarcodeScanner::MaxiCode => "MaxiCode",
15981 BarcodeScanner::MicroPDF => "MicroPDF",
15982 BarcodeScanner::PDF417 => "PDF-417",
15983 BarcodeScanner::PosiCode => "PosiCode",
15984 BarcodeScanner::QRCode => "QR Code",
15985 BarcodeScanner::SuperCode => "SuperCode",
15986 BarcodeScanner::UltraCode => "UltraCode",
15987 BarcodeScanner::USD5SlugCode => "USD-5 (Slug Code)",
15988 BarcodeScanner::VeriCode => "VeriCode",
15989 }
15990 .into()
15991 }
15992 }
15993
15994 #[cfg(feature = "std")]
15995 impl fmt::Display for BarcodeScanner {
15996 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15997 write!(f, "{}", self.name())
15998 }
15999 }
16000
16001 impl AsUsage for BarcodeScanner {
16002 /// Returns the 32 bit Usage value of this Usage
16003 fn usage_value(&self) -> u32 {
16004 u32::from(self)
16005 }
16006
16007 /// Returns the 16 bit Usage ID value of this Usage
16008 fn usage_id_value(&self) -> u16 {
16009 u16::from(self)
16010 }
16011
16012 /// Returns this usage as [Usage::BarcodeScanner(self)](Usage::BarcodeScanner)
16013 /// This is a convenience function to avoid having
16014 /// to implement `From` for every used type in the caller.
16015 ///
16016 /// ```
16017 /// # use hut::*;
16018 /// let gd_x = GenericDesktop::X;
16019 /// let usage = Usage::from(GenericDesktop::X);
16020 /// assert!(matches!(gd_x.usage(), usage));
16021 /// ```
16022 fn usage(&self) -> Usage {
16023 Usage::from(self)
16024 }
16025 }
16026
16027 impl AsUsagePage for BarcodeScanner {
16028 /// Returns the 16 bit value of this UsagePage
16029 ///
16030 /// This value is `0x8C` for [BarcodeScanner]
16031 fn usage_page_value(&self) -> u16 {
16032 let up = UsagePage::from(self);
16033 u16::from(up)
16034 }
16035
16036 /// Returns [UsagePage::BarcodeScanner]]
16037 fn usage_page(&self) -> UsagePage {
16038 UsagePage::from(self)
16039 }
16040 }
16041
16042 impl From<&BarcodeScanner> for u16 {
16043 fn from(barcodescanner: &BarcodeScanner) -> u16 {
16044 *barcodescanner as u16
16045 }
16046 }
16047
16048 impl From<BarcodeScanner> for u16 {
16049 /// Returns the 16bit value of this usage. This is identical
16050 /// to [BarcodeScanner::usage_page_value()].
16051 fn from(barcodescanner: BarcodeScanner) -> u16 {
16052 u16::from(&barcodescanner)
16053 }
16054 }
16055
16056 impl From<&BarcodeScanner> for u32 {
16057 /// Returns the 32 bit value of this usage. This is identical
16058 /// to [BarcodeScanner::usage_value()].
16059 fn from(barcodescanner: &BarcodeScanner) -> u32 {
16060 let up = UsagePage::from(barcodescanner);
16061 let up = (u16::from(&up) as u32) << 16;
16062 let id = u16::from(barcodescanner) as u32;
16063 up | id
16064 }
16065 }
16066
16067 impl From<&BarcodeScanner> for UsagePage {
16068 /// Always returns [UsagePage::BarcodeScanner] and is
16069 /// identical to [BarcodeScanner::usage_page()].
16070 fn from(_: &BarcodeScanner) -> UsagePage {
16071 UsagePage::BarcodeScanner
16072 }
16073 }
16074
16075 impl From<BarcodeScanner> for UsagePage {
16076 /// Always returns [UsagePage::BarcodeScanner] and is
16077 /// identical to [BarcodeScanner::usage_page()].
16078 fn from(_: BarcodeScanner) -> UsagePage {
16079 UsagePage::BarcodeScanner
16080 }
16081 }
16082
16083 impl From<&BarcodeScanner> for Usage {
16084 fn from(barcodescanner: &BarcodeScanner) -> Usage {
16085 Usage::try_from(u32::from(barcodescanner)).unwrap()
16086 }
16087 }
16088
16089 impl From<BarcodeScanner> for Usage {
16090 fn from(barcodescanner: BarcodeScanner) -> Usage {
16091 Usage::from(&barcodescanner)
16092 }
16093 }
16094
16095 impl TryFrom<u16> for BarcodeScanner {
16096 type Error = HutError;
16097
16098 fn try_from(usage_id: u16) -> Result<BarcodeScanner> {
16099 match usage_id {
16100 1 => Ok(BarcodeScanner::BarcodeBadgeReader),
16101 2 => Ok(BarcodeScanner::BarcodeScanner),
16102 3 => Ok(BarcodeScanner::DumbBarCodeScanner),
16103 4 => Ok(BarcodeScanner::CordlessScannerBase),
16104 5 => Ok(BarcodeScanner::BarCodeScannerCradle),
16105 16 => Ok(BarcodeScanner::AttributeReport),
16106 17 => Ok(BarcodeScanner::SettingsReport),
16107 18 => Ok(BarcodeScanner::ScannedDataReport),
16108 19 => Ok(BarcodeScanner::RawScannedDataReport),
16109 20 => Ok(BarcodeScanner::TriggerReport),
16110 21 => Ok(BarcodeScanner::StatusReport),
16111 22 => Ok(BarcodeScanner::UPCEANControlReport),
16112 23 => Ok(BarcodeScanner::EAN23LabelControlReport),
16113 24 => Ok(BarcodeScanner::Code39ControlReport),
16114 25 => Ok(BarcodeScanner::Interleaved2of5ControlReport),
16115 26 => Ok(BarcodeScanner::Standard2of5ControlReport),
16116 27 => Ok(BarcodeScanner::MSIPlesseyControlReport),
16117 28 => Ok(BarcodeScanner::CodabarControlReport),
16118 29 => Ok(BarcodeScanner::Code128ControlReport),
16119 30 => Ok(BarcodeScanner::Misc1DControlReport),
16120 31 => Ok(BarcodeScanner::TwoDControlReport),
16121 48 => Ok(BarcodeScanner::AimingPointerMode),
16122 49 => Ok(BarcodeScanner::BarCodePresentSensor),
16123 50 => Ok(BarcodeScanner::Class1ALaser),
16124 51 => Ok(BarcodeScanner::Class2Laser),
16125 52 => Ok(BarcodeScanner::HeaterPresent),
16126 53 => Ok(BarcodeScanner::ContactScanner),
16127 54 => Ok(BarcodeScanner::ElectronicArticleSurveillanceNotification),
16128 55 => Ok(BarcodeScanner::ConstantElectronicArticleSurveillance),
16129 56 => Ok(BarcodeScanner::ErrorIndication),
16130 57 => Ok(BarcodeScanner::FixedBeeper),
16131 58 => Ok(BarcodeScanner::GoodDecodeIndication),
16132 59 => Ok(BarcodeScanner::HandsFreeScanning),
16133 60 => Ok(BarcodeScanner::IntrinsicallySafe),
16134 61 => Ok(BarcodeScanner::KlasseEinsLaser),
16135 62 => Ok(BarcodeScanner::LongRangeScanner),
16136 63 => Ok(BarcodeScanner::MirrorSpeedControl),
16137 64 => Ok(BarcodeScanner::NotOnFileIndication),
16138 65 => Ok(BarcodeScanner::ProgrammableBeeper),
16139 66 => Ok(BarcodeScanner::Triggerless),
16140 67 => Ok(BarcodeScanner::Wand),
16141 68 => Ok(BarcodeScanner::WaterResistant),
16142 69 => Ok(BarcodeScanner::MultiRangeScanner),
16143 70 => Ok(BarcodeScanner::ProximitySensor),
16144 77 => Ok(BarcodeScanner::FragmentDecoding),
16145 78 => Ok(BarcodeScanner::ScannerReadConfidence),
16146 79 => Ok(BarcodeScanner::DataPrefix),
16147 80 => Ok(BarcodeScanner::PrefixAIMI),
16148 81 => Ok(BarcodeScanner::PrefixNone),
16149 82 => Ok(BarcodeScanner::PrefixProprietary),
16150 85 => Ok(BarcodeScanner::ActiveTime),
16151 86 => Ok(BarcodeScanner::AimingLaserPattern),
16152 87 => Ok(BarcodeScanner::BarCodePresent),
16153 88 => Ok(BarcodeScanner::BeeperState),
16154 89 => Ok(BarcodeScanner::LaserOnTime),
16155 90 => Ok(BarcodeScanner::LaserState),
16156 91 => Ok(BarcodeScanner::LockoutTime),
16157 92 => Ok(BarcodeScanner::MotorState),
16158 93 => Ok(BarcodeScanner::MotorTimeout),
16159 94 => Ok(BarcodeScanner::PowerOnResetScanner),
16160 95 => Ok(BarcodeScanner::PreventReadofBarcodes),
16161 96 => Ok(BarcodeScanner::InitiateBarcodeRead),
16162 97 => Ok(BarcodeScanner::TriggerState),
16163 98 => Ok(BarcodeScanner::TriggerMode),
16164 99 => Ok(BarcodeScanner::TriggerModeBlinkingLaserOn),
16165 100 => Ok(BarcodeScanner::TriggerModeContinuousLaserOn),
16166 101 => Ok(BarcodeScanner::TriggerModeLaseronwhilePulled),
16167 102 => Ok(BarcodeScanner::TriggerModeLaserstaysonafterrelease),
16168 109 => Ok(BarcodeScanner::CommitParameterstoNVM),
16169 110 => Ok(BarcodeScanner::ParameterScanning),
16170 111 => Ok(BarcodeScanner::ParametersChanged),
16171 112 => Ok(BarcodeScanner::Setparameterdefaultvalues),
16172 117 => Ok(BarcodeScanner::ScannerInCradle),
16173 118 => Ok(BarcodeScanner::ScannerInRange),
16174 122 => Ok(BarcodeScanner::AimDuration),
16175 123 => Ok(BarcodeScanner::GoodReadLampDuration),
16176 124 => Ok(BarcodeScanner::GoodReadLampIntensity),
16177 125 => Ok(BarcodeScanner::GoodReadLED),
16178 126 => Ok(BarcodeScanner::GoodReadToneFrequency),
16179 127 => Ok(BarcodeScanner::GoodReadToneLength),
16180 128 => Ok(BarcodeScanner::GoodReadToneVolume),
16181 130 => Ok(BarcodeScanner::NoReadMessage),
16182 131 => Ok(BarcodeScanner::NotonFileVolume),
16183 132 => Ok(BarcodeScanner::PowerupBeep),
16184 133 => Ok(BarcodeScanner::SoundErrorBeep),
16185 134 => Ok(BarcodeScanner::SoundGoodReadBeep),
16186 135 => Ok(BarcodeScanner::SoundNotOnFileBeep),
16187 136 => Ok(BarcodeScanner::GoodReadWhentoWrite),
16188 137 => Ok(BarcodeScanner::GRWTIAfterDecode),
16189 138 => Ok(BarcodeScanner::GRWTIBeepLampaftertransmit),
16190 139 => Ok(BarcodeScanner::GRWTINoBeepLampuseatall),
16191 145 => Ok(BarcodeScanner::BooklandEAN),
16192 146 => Ok(BarcodeScanner::ConvertEAN8to13Type),
16193 147 => Ok(BarcodeScanner::ConvertUPCAtoEAN13),
16194 148 => Ok(BarcodeScanner::ConvertUPCEtoA),
16195 149 => Ok(BarcodeScanner::EAN13),
16196 150 => Ok(BarcodeScanner::EAN8),
16197 151 => Ok(BarcodeScanner::EAN99128Mandatory),
16198 152 => Ok(BarcodeScanner::EAN99P5128Optional),
16199 153 => Ok(BarcodeScanner::EnableEANTwoLabel),
16200 154 => Ok(BarcodeScanner::UPCEAN),
16201 155 => Ok(BarcodeScanner::UPCEANCouponCode),
16202 156 => Ok(BarcodeScanner::UPCEANPeriodicals),
16203 157 => Ok(BarcodeScanner::UPCA),
16204 158 => Ok(BarcodeScanner::UPCAwith128Mandatory),
16205 159 => Ok(BarcodeScanner::UPCAwith128Optional),
16206 160 => Ok(BarcodeScanner::UPCAwithP5Optional),
16207 161 => Ok(BarcodeScanner::UPCE),
16208 162 => Ok(BarcodeScanner::UPCE1),
16209 169 => Ok(BarcodeScanner::Periodical),
16210 170 => Ok(BarcodeScanner::PeriodicalAutoDiscriminatePlus2),
16211 171 => Ok(BarcodeScanner::PeriodicalOnlyDecodewithPlus2),
16212 172 => Ok(BarcodeScanner::PeriodicalIgnorePlus2),
16213 173 => Ok(BarcodeScanner::PeriodicalAutoDiscriminatePlus5),
16214 174 => Ok(BarcodeScanner::PeriodicalOnlyDecodewithPlus5),
16215 175 => Ok(BarcodeScanner::PeriodicalIgnorePlus5),
16216 176 => Ok(BarcodeScanner::Check),
16217 177 => Ok(BarcodeScanner::CheckDisablePrice),
16218 178 => Ok(BarcodeScanner::CheckEnable4digitPrice),
16219 179 => Ok(BarcodeScanner::CheckEnable5digitPrice),
16220 180 => Ok(BarcodeScanner::CheckEnableEuropean4digitPrice),
16221 181 => Ok(BarcodeScanner::CheckEnableEuropean5digitPrice),
16222 183 => Ok(BarcodeScanner::EANTwoLabel),
16223 184 => Ok(BarcodeScanner::EANThreeLabel),
16224 185 => Ok(BarcodeScanner::EAN8FlagDigit1),
16225 186 => Ok(BarcodeScanner::EAN8FlagDigit2),
16226 187 => Ok(BarcodeScanner::EAN8FlagDigit3),
16227 188 => Ok(BarcodeScanner::EAN13FlagDigit1),
16228 189 => Ok(BarcodeScanner::EAN13FlagDigit2),
16229 190 => Ok(BarcodeScanner::EAN13FlagDigit3),
16230 191 => Ok(BarcodeScanner::AddEAN23LabelDefinition),
16231 192 => Ok(BarcodeScanner::ClearallEAN23LabelDefinitions),
16232 195 => Ok(BarcodeScanner::Codabar),
16233 196 => Ok(BarcodeScanner::Code128),
16234 199 => Ok(BarcodeScanner::Code39),
16235 200 => Ok(BarcodeScanner::Code93),
16236 201 => Ok(BarcodeScanner::FullASCIIConversion),
16237 202 => Ok(BarcodeScanner::Interleaved2of5),
16238 203 => Ok(BarcodeScanner::ItalianPharmacyCode),
16239 204 => Ok(BarcodeScanner::MSIPlessey),
16240 205 => Ok(BarcodeScanner::Standard2of5IATA),
16241 206 => Ok(BarcodeScanner::Standard2of5),
16242 211 => Ok(BarcodeScanner::TransmitStartStop),
16243 212 => Ok(BarcodeScanner::TriOptic),
16244 213 => Ok(BarcodeScanner::UCCEAN128),
16245 214 => Ok(BarcodeScanner::CheckDigit),
16246 215 => Ok(BarcodeScanner::CheckDigitDisable),
16247 216 => Ok(BarcodeScanner::CheckDigitEnableInterleaved2of5OPCC),
16248 217 => Ok(BarcodeScanner::CheckDigitEnableInterleaved2of5USS),
16249 218 => Ok(BarcodeScanner::CheckDigitEnableStandard2of5OPCC),
16250 219 => Ok(BarcodeScanner::CheckDigitEnableStandard2of5USS),
16251 220 => Ok(BarcodeScanner::CheckDigitEnableOneMSIPlessey),
16252 221 => Ok(BarcodeScanner::CheckDigitEnableTwoMSIPlessey),
16253 222 => Ok(BarcodeScanner::CheckDigitCodabarEnable),
16254 223 => Ok(BarcodeScanner::CheckDigitCode39Enable),
16255 240 => Ok(BarcodeScanner::TransmitCheckDigit),
16256 241 => Ok(BarcodeScanner::DisableCheckDigitTransmit),
16257 242 => Ok(BarcodeScanner::EnableCheckDigitTransmit),
16258 251 => Ok(BarcodeScanner::SymbologyIdentifier1),
16259 252 => Ok(BarcodeScanner::SymbologyIdentifier2),
16260 253 => Ok(BarcodeScanner::SymbologyIdentifier3),
16261 254 => Ok(BarcodeScanner::DecodedData),
16262 255 => Ok(BarcodeScanner::DecodeDataContinued),
16263 256 => Ok(BarcodeScanner::BarSpaceData),
16264 257 => Ok(BarcodeScanner::ScannerDataAccuracy),
16265 258 => Ok(BarcodeScanner::RawDataPolarity),
16266 259 => Ok(BarcodeScanner::PolarityInvertedBarCode),
16267 260 => Ok(BarcodeScanner::PolarityNormalBarCode),
16268 262 => Ok(BarcodeScanner::MinimumLengthtoDecode),
16269 263 => Ok(BarcodeScanner::MaximumLengthtoDecode),
16270 264 => Ok(BarcodeScanner::DiscreteLengthtoDecode1),
16271 265 => Ok(BarcodeScanner::DiscreteLengthtoDecode2),
16272 266 => Ok(BarcodeScanner::DataLengthMethod),
16273 267 => Ok(BarcodeScanner::DLMethodReadany),
16274 268 => Ok(BarcodeScanner::DLMethodCheckinRange),
16275 269 => Ok(BarcodeScanner::DLMethodCheckforDiscrete),
16276 272 => Ok(BarcodeScanner::AztecCode),
16277 273 => Ok(BarcodeScanner::BC412),
16278 274 => Ok(BarcodeScanner::ChannelCode),
16279 275 => Ok(BarcodeScanner::Code16),
16280 276 => Ok(BarcodeScanner::Code32),
16281 277 => Ok(BarcodeScanner::Code49),
16282 278 => Ok(BarcodeScanner::CodeOne),
16283 279 => Ok(BarcodeScanner::Colorcode),
16284 280 => Ok(BarcodeScanner::DataMatrix),
16285 281 => Ok(BarcodeScanner::MaxiCode),
16286 282 => Ok(BarcodeScanner::MicroPDF),
16287 283 => Ok(BarcodeScanner::PDF417),
16288 284 => Ok(BarcodeScanner::PosiCode),
16289 285 => Ok(BarcodeScanner::QRCode),
16290 286 => Ok(BarcodeScanner::SuperCode),
16291 287 => Ok(BarcodeScanner::UltraCode),
16292 288 => Ok(BarcodeScanner::USD5SlugCode),
16293 289 => Ok(BarcodeScanner::VeriCode),
16294 n => Err(HutError::UnknownUsageId { usage_id: n }),
16295 }
16296 }
16297 }
16298
16299 impl BitOr<u16> for BarcodeScanner {
16300 type Output = Usage;
16301
16302 /// A convenience function to combine a Usage Page with
16303 /// a value.
16304 ///
16305 /// This function panics if the Usage ID value results in
16306 /// an unknown Usage. Where error checking is required,
16307 /// use [UsagePage::to_usage_from_value].
16308 fn bitor(self, usage: u16) -> Usage {
16309 let up = u16::from(self) as u32;
16310 let u = usage as u32;
16311 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
16312 }
16313 }
16314
16315 /// *Usage Page `0x8D`: "Scales"*
16316 ///
16317 /// **This enum is autogenerated from the HID Usage Tables**.
16318 /// ```
16319 /// # use hut::*;
16320 /// let u1 = Usage::Scales(Scales::ScaleDevice);
16321 /// let u2 = Usage::new_from_page_and_id(0x8D, 0x20).unwrap();
16322 /// let u3 = Usage::from(Scales::ScaleDevice);
16323 /// let u4: Usage = Scales::ScaleDevice.into();
16324 /// assert_eq!(u1, u2);
16325 /// assert_eq!(u1, u3);
16326 /// assert_eq!(u1, u4);
16327 ///
16328 /// assert!(matches!(u1.usage_page(), UsagePage::Scales));
16329 /// assert_eq!(0x8D, u1.usage_page_value());
16330 /// assert_eq!(0x20, u1.usage_id_value());
16331 /// assert_eq!((0x8D << 16) | 0x20, u1.usage_value());
16332 /// assert_eq!("Scale Device", u1.name());
16333 /// ```
16334 ///
16335 #[allow(non_camel_case_types)]
16336 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
16337 #[non_exhaustive]
16338 #[repr(u16)]
16339 pub enum Scales {
16340 /// Usage ID `0x1`: "Scales"
16341 Scales = 0x1,
16342 /// Usage ID `0x20`: "Scale Device"
16343 ScaleDevice = 0x20,
16344 /// Usage ID `0x21`: "Scale Class"
16345 ScaleClass = 0x21,
16346 /// Usage ID `0x22`: "Scale Class I Metric"
16347 ScaleClassIMetric = 0x22,
16348 /// Usage ID `0x23`: "Scale Class II Metric"
16349 ScaleClassIIMetric = 0x23,
16350 /// Usage ID `0x24`: "Scale Class III Metric"
16351 ScaleClassIIIMetric = 0x24,
16352 /// Usage ID `0x25`: "Scale Class IIIL Metric"
16353 ScaleClassIIILMetric = 0x25,
16354 /// Usage ID `0x26`: "Scale Class IV Metric"
16355 ScaleClassIVMetric = 0x26,
16356 /// Usage ID `0x27`: "Scale Class III English"
16357 ScaleClassIIIEnglish = 0x27,
16358 /// Usage ID `0x28`: "Scale Class IIIL English"
16359 ScaleClassIIILEnglish = 0x28,
16360 /// Usage ID `0x29`: "Scale Class IV English"
16361 ScaleClassIVEnglish = 0x29,
16362 /// Usage ID `0x2A`: "Scale Class Generic"
16363 ScaleClassGeneric = 0x2A,
16364 /// Usage ID `0x30`: "Scale Attribute Report"
16365 ScaleAttributeReport = 0x30,
16366 /// Usage ID `0x31`: "Scale Control Report"
16367 ScaleControlReport = 0x31,
16368 /// Usage ID `0x32`: "Scale Data Report"
16369 ScaleDataReport = 0x32,
16370 /// Usage ID `0x33`: "Scale Status Report"
16371 ScaleStatusReport = 0x33,
16372 /// Usage ID `0x34`: "Scale Weight Limit Report"
16373 ScaleWeightLimitReport = 0x34,
16374 /// Usage ID `0x35`: "Scale Statistics Report"
16375 ScaleStatisticsReport = 0x35,
16376 /// Usage ID `0x40`: "Data Weight"
16377 DataWeight = 0x40,
16378 /// Usage ID `0x41`: "Data Scaling"
16379 DataScaling = 0x41,
16380 /// Usage ID `0x50`: "Weight Unit"
16381 WeightUnit = 0x50,
16382 /// Usage ID `0x51`: "Weight Unit Milligram"
16383 WeightUnitMilligram = 0x51,
16384 /// Usage ID `0x52`: "Weight Unit Gram"
16385 WeightUnitGram = 0x52,
16386 /// Usage ID `0x53`: "Weight Unit Kilogram"
16387 WeightUnitKilogram = 0x53,
16388 /// Usage ID `0x54`: "Weight Unit Carats"
16389 WeightUnitCarats = 0x54,
16390 /// Usage ID `0x55`: "Weight Unit Taels"
16391 WeightUnitTaels = 0x55,
16392 /// Usage ID `0x56`: "Weight Unit Grains"
16393 WeightUnitGrains = 0x56,
16394 /// Usage ID `0x57`: "Weight Unit Pennyweights"
16395 WeightUnitPennyweights = 0x57,
16396 /// Usage ID `0x58`: "Weight Unit Metric Ton"
16397 WeightUnitMetricTon = 0x58,
16398 /// Usage ID `0x59`: "Weight Unit Avoir Ton"
16399 WeightUnitAvoirTon = 0x59,
16400 /// Usage ID `0x5A`: "Weight Unit Troy Ounce"
16401 WeightUnitTroyOunce = 0x5A,
16402 /// Usage ID `0x5B`: "Weight Unit Ounce"
16403 WeightUnitOunce = 0x5B,
16404 /// Usage ID `0x5C`: "Weight Unit Pound"
16405 WeightUnitPound = 0x5C,
16406 /// Usage ID `0x60`: "Calibration Count"
16407 CalibrationCount = 0x60,
16408 /// Usage ID `0x61`: "Re-Zero Count"
16409 ReZeroCount = 0x61,
16410 /// Usage ID `0x70`: "Scale Status"
16411 ScaleStatus = 0x70,
16412 /// Usage ID `0x71`: "Scale Status Fault"
16413 ScaleStatusFault = 0x71,
16414 /// Usage ID `0x72`: "Scale Status Stable at Center of Zero"
16415 ScaleStatusStableatCenterofZero = 0x72,
16416 /// Usage ID `0x73`: "Scale Status In Motion"
16417 ScaleStatusInMotion = 0x73,
16418 /// Usage ID `0x74`: "Scale Status Weight Stable"
16419 ScaleStatusWeightStable = 0x74,
16420 /// Usage ID `0x75`: "Scale Status Under Zero"
16421 ScaleStatusUnderZero = 0x75,
16422 /// Usage ID `0x76`: "Scale Status Over Weight Limit"
16423 ScaleStatusOverWeightLimit = 0x76,
16424 /// Usage ID `0x77`: "Scale Status Requires Calibration"
16425 ScaleStatusRequiresCalibration = 0x77,
16426 /// Usage ID `0x78`: "Scale Status Requires Rezeroing"
16427 ScaleStatusRequiresRezeroing = 0x78,
16428 /// Usage ID `0x80`: "Zero Scale"
16429 ZeroScale = 0x80,
16430 /// Usage ID `0x81`: "Enforced Zero Return"
16431 EnforcedZeroReturn = 0x81,
16432 }
16433
16434 impl Scales {
16435 #[cfg(feature = "std")]
16436 pub fn name(&self) -> String {
16437 match self {
16438 Scales::Scales => "Scales",
16439 Scales::ScaleDevice => "Scale Device",
16440 Scales::ScaleClass => "Scale Class",
16441 Scales::ScaleClassIMetric => "Scale Class I Metric",
16442 Scales::ScaleClassIIMetric => "Scale Class II Metric",
16443 Scales::ScaleClassIIIMetric => "Scale Class III Metric",
16444 Scales::ScaleClassIIILMetric => "Scale Class IIIL Metric",
16445 Scales::ScaleClassIVMetric => "Scale Class IV Metric",
16446 Scales::ScaleClassIIIEnglish => "Scale Class III English",
16447 Scales::ScaleClassIIILEnglish => "Scale Class IIIL English",
16448 Scales::ScaleClassIVEnglish => "Scale Class IV English",
16449 Scales::ScaleClassGeneric => "Scale Class Generic",
16450 Scales::ScaleAttributeReport => "Scale Attribute Report",
16451 Scales::ScaleControlReport => "Scale Control Report",
16452 Scales::ScaleDataReport => "Scale Data Report",
16453 Scales::ScaleStatusReport => "Scale Status Report",
16454 Scales::ScaleWeightLimitReport => "Scale Weight Limit Report",
16455 Scales::ScaleStatisticsReport => "Scale Statistics Report",
16456 Scales::DataWeight => "Data Weight",
16457 Scales::DataScaling => "Data Scaling",
16458 Scales::WeightUnit => "Weight Unit",
16459 Scales::WeightUnitMilligram => "Weight Unit Milligram",
16460 Scales::WeightUnitGram => "Weight Unit Gram",
16461 Scales::WeightUnitKilogram => "Weight Unit Kilogram",
16462 Scales::WeightUnitCarats => "Weight Unit Carats",
16463 Scales::WeightUnitTaels => "Weight Unit Taels",
16464 Scales::WeightUnitGrains => "Weight Unit Grains",
16465 Scales::WeightUnitPennyweights => "Weight Unit Pennyweights",
16466 Scales::WeightUnitMetricTon => "Weight Unit Metric Ton",
16467 Scales::WeightUnitAvoirTon => "Weight Unit Avoir Ton",
16468 Scales::WeightUnitTroyOunce => "Weight Unit Troy Ounce",
16469 Scales::WeightUnitOunce => "Weight Unit Ounce",
16470 Scales::WeightUnitPound => "Weight Unit Pound",
16471 Scales::CalibrationCount => "Calibration Count",
16472 Scales::ReZeroCount => "Re-Zero Count",
16473 Scales::ScaleStatus => "Scale Status",
16474 Scales::ScaleStatusFault => "Scale Status Fault",
16475 Scales::ScaleStatusStableatCenterofZero => "Scale Status Stable at Center of Zero",
16476 Scales::ScaleStatusInMotion => "Scale Status In Motion",
16477 Scales::ScaleStatusWeightStable => "Scale Status Weight Stable",
16478 Scales::ScaleStatusUnderZero => "Scale Status Under Zero",
16479 Scales::ScaleStatusOverWeightLimit => "Scale Status Over Weight Limit",
16480 Scales::ScaleStatusRequiresCalibration => "Scale Status Requires Calibration",
16481 Scales::ScaleStatusRequiresRezeroing => "Scale Status Requires Rezeroing",
16482 Scales::ZeroScale => "Zero Scale",
16483 Scales::EnforcedZeroReturn => "Enforced Zero Return",
16484 }
16485 .into()
16486 }
16487 }
16488
16489 #[cfg(feature = "std")]
16490 impl fmt::Display for Scales {
16491 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16492 write!(f, "{}", self.name())
16493 }
16494 }
16495
16496 impl AsUsage for Scales {
16497 /// Returns the 32 bit Usage value of this Usage
16498 fn usage_value(&self) -> u32 {
16499 u32::from(self)
16500 }
16501
16502 /// Returns the 16 bit Usage ID value of this Usage
16503 fn usage_id_value(&self) -> u16 {
16504 u16::from(self)
16505 }
16506
16507 /// Returns this usage as [Usage::Scales(self)](Usage::Scales)
16508 /// This is a convenience function to avoid having
16509 /// to implement `From` for every used type in the caller.
16510 ///
16511 /// ```
16512 /// # use hut::*;
16513 /// let gd_x = GenericDesktop::X;
16514 /// let usage = Usage::from(GenericDesktop::X);
16515 /// assert!(matches!(gd_x.usage(), usage));
16516 /// ```
16517 fn usage(&self) -> Usage {
16518 Usage::from(self)
16519 }
16520 }
16521
16522 impl AsUsagePage for Scales {
16523 /// Returns the 16 bit value of this UsagePage
16524 ///
16525 /// This value is `0x8D` for [Scales]
16526 fn usage_page_value(&self) -> u16 {
16527 let up = UsagePage::from(self);
16528 u16::from(up)
16529 }
16530
16531 /// Returns [UsagePage::Scales]]
16532 fn usage_page(&self) -> UsagePage {
16533 UsagePage::from(self)
16534 }
16535 }
16536
16537 impl From<&Scales> for u16 {
16538 fn from(scales: &Scales) -> u16 {
16539 *scales as u16
16540 }
16541 }
16542
16543 impl From<Scales> for u16 {
16544 /// Returns the 16bit value of this usage. This is identical
16545 /// to [Scales::usage_page_value()].
16546 fn from(scales: Scales) -> u16 {
16547 u16::from(&scales)
16548 }
16549 }
16550
16551 impl From<&Scales> for u32 {
16552 /// Returns the 32 bit value of this usage. This is identical
16553 /// to [Scales::usage_value()].
16554 fn from(scales: &Scales) -> u32 {
16555 let up = UsagePage::from(scales);
16556 let up = (u16::from(&up) as u32) << 16;
16557 let id = u16::from(scales) as u32;
16558 up | id
16559 }
16560 }
16561
16562 impl From<&Scales> for UsagePage {
16563 /// Always returns [UsagePage::Scales] and is
16564 /// identical to [Scales::usage_page()].
16565 fn from(_: &Scales) -> UsagePage {
16566 UsagePage::Scales
16567 }
16568 }
16569
16570 impl From<Scales> for UsagePage {
16571 /// Always returns [UsagePage::Scales] and is
16572 /// identical to [Scales::usage_page()].
16573 fn from(_: Scales) -> UsagePage {
16574 UsagePage::Scales
16575 }
16576 }
16577
16578 impl From<&Scales> for Usage {
16579 fn from(scales: &Scales) -> Usage {
16580 Usage::try_from(u32::from(scales)).unwrap()
16581 }
16582 }
16583
16584 impl From<Scales> for Usage {
16585 fn from(scales: Scales) -> Usage {
16586 Usage::from(&scales)
16587 }
16588 }
16589
16590 impl TryFrom<u16> for Scales {
16591 type Error = HutError;
16592
16593 fn try_from(usage_id: u16) -> Result<Scales> {
16594 match usage_id {
16595 1 => Ok(Scales::Scales),
16596 32 => Ok(Scales::ScaleDevice),
16597 33 => Ok(Scales::ScaleClass),
16598 34 => Ok(Scales::ScaleClassIMetric),
16599 35 => Ok(Scales::ScaleClassIIMetric),
16600 36 => Ok(Scales::ScaleClassIIIMetric),
16601 37 => Ok(Scales::ScaleClassIIILMetric),
16602 38 => Ok(Scales::ScaleClassIVMetric),
16603 39 => Ok(Scales::ScaleClassIIIEnglish),
16604 40 => Ok(Scales::ScaleClassIIILEnglish),
16605 41 => Ok(Scales::ScaleClassIVEnglish),
16606 42 => Ok(Scales::ScaleClassGeneric),
16607 48 => Ok(Scales::ScaleAttributeReport),
16608 49 => Ok(Scales::ScaleControlReport),
16609 50 => Ok(Scales::ScaleDataReport),
16610 51 => Ok(Scales::ScaleStatusReport),
16611 52 => Ok(Scales::ScaleWeightLimitReport),
16612 53 => Ok(Scales::ScaleStatisticsReport),
16613 64 => Ok(Scales::DataWeight),
16614 65 => Ok(Scales::DataScaling),
16615 80 => Ok(Scales::WeightUnit),
16616 81 => Ok(Scales::WeightUnitMilligram),
16617 82 => Ok(Scales::WeightUnitGram),
16618 83 => Ok(Scales::WeightUnitKilogram),
16619 84 => Ok(Scales::WeightUnitCarats),
16620 85 => Ok(Scales::WeightUnitTaels),
16621 86 => Ok(Scales::WeightUnitGrains),
16622 87 => Ok(Scales::WeightUnitPennyweights),
16623 88 => Ok(Scales::WeightUnitMetricTon),
16624 89 => Ok(Scales::WeightUnitAvoirTon),
16625 90 => Ok(Scales::WeightUnitTroyOunce),
16626 91 => Ok(Scales::WeightUnitOunce),
16627 92 => Ok(Scales::WeightUnitPound),
16628 96 => Ok(Scales::CalibrationCount),
16629 97 => Ok(Scales::ReZeroCount),
16630 112 => Ok(Scales::ScaleStatus),
16631 113 => Ok(Scales::ScaleStatusFault),
16632 114 => Ok(Scales::ScaleStatusStableatCenterofZero),
16633 115 => Ok(Scales::ScaleStatusInMotion),
16634 116 => Ok(Scales::ScaleStatusWeightStable),
16635 117 => Ok(Scales::ScaleStatusUnderZero),
16636 118 => Ok(Scales::ScaleStatusOverWeightLimit),
16637 119 => Ok(Scales::ScaleStatusRequiresCalibration),
16638 120 => Ok(Scales::ScaleStatusRequiresRezeroing),
16639 128 => Ok(Scales::ZeroScale),
16640 129 => Ok(Scales::EnforcedZeroReturn),
16641 n => Err(HutError::UnknownUsageId { usage_id: n }),
16642 }
16643 }
16644 }
16645
16646 impl BitOr<u16> for Scales {
16647 type Output = Usage;
16648
16649 /// A convenience function to combine a Usage Page with
16650 /// a value.
16651 ///
16652 /// This function panics if the Usage ID value results in
16653 /// an unknown Usage. Where error checking is required,
16654 /// use [UsagePage::to_usage_from_value].
16655 fn bitor(self, usage: u16) -> Usage {
16656 let up = u16::from(self) as u32;
16657 let u = usage as u32;
16658 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
16659 }
16660 }
16661
16662 /// *Usage Page `0x8E`: "Magnetic Stripe Reader"*
16663 ///
16664 /// **This enum is autogenerated from the HID Usage Tables**.
16665 /// ```
16666 /// # use hut::*;
16667 /// let u1 = Usage::MagneticStripeReader(MagneticStripeReader::Track1Length);
16668 /// let u2 = Usage::new_from_page_and_id(0x8E, 0x11).unwrap();
16669 /// let u3 = Usage::from(MagneticStripeReader::Track1Length);
16670 /// let u4: Usage = MagneticStripeReader::Track1Length.into();
16671 /// assert_eq!(u1, u2);
16672 /// assert_eq!(u1, u3);
16673 /// assert_eq!(u1, u4);
16674 ///
16675 /// assert!(matches!(u1.usage_page(), UsagePage::MagneticStripeReader));
16676 /// assert_eq!(0x8E, u1.usage_page_value());
16677 /// assert_eq!(0x11, u1.usage_id_value());
16678 /// assert_eq!((0x8E << 16) | 0x11, u1.usage_value());
16679 /// assert_eq!("Track 1 Length", u1.name());
16680 /// ```
16681 ///
16682 #[allow(non_camel_case_types)]
16683 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
16684 #[non_exhaustive]
16685 #[repr(u16)]
16686 pub enum MagneticStripeReader {
16687 /// Usage ID `0x1`: "MSR Device Read-Only"
16688 MSRDeviceReadOnly = 0x1,
16689 /// Usage ID `0x11`: "Track 1 Length"
16690 Track1Length = 0x11,
16691 /// Usage ID `0x12`: "Track 2 Length"
16692 Track2Length = 0x12,
16693 /// Usage ID `0x13`: "Track 3 Length"
16694 Track3Length = 0x13,
16695 /// Usage ID `0x14`: "Track JIS Length"
16696 TrackJISLength = 0x14,
16697 /// Usage ID `0x20`: "Track Data"
16698 TrackData = 0x20,
16699 /// Usage ID `0x21`: "Track 1 Data"
16700 Track1Data = 0x21,
16701 /// Usage ID `0x22`: "Track 2 Data"
16702 Track2Data = 0x22,
16703 /// Usage ID `0x23`: "Track 3 Data"
16704 Track3Data = 0x23,
16705 /// Usage ID `0x24`: "Track JIS Data"
16706 TrackJISData = 0x24,
16707 }
16708
16709 impl MagneticStripeReader {
16710 #[cfg(feature = "std")]
16711 pub fn name(&self) -> String {
16712 match self {
16713 MagneticStripeReader::MSRDeviceReadOnly => "MSR Device Read-Only",
16714 MagneticStripeReader::Track1Length => "Track 1 Length",
16715 MagneticStripeReader::Track2Length => "Track 2 Length",
16716 MagneticStripeReader::Track3Length => "Track 3 Length",
16717 MagneticStripeReader::TrackJISLength => "Track JIS Length",
16718 MagneticStripeReader::TrackData => "Track Data",
16719 MagneticStripeReader::Track1Data => "Track 1 Data",
16720 MagneticStripeReader::Track2Data => "Track 2 Data",
16721 MagneticStripeReader::Track3Data => "Track 3 Data",
16722 MagneticStripeReader::TrackJISData => "Track JIS Data",
16723 }
16724 .into()
16725 }
16726 }
16727
16728 #[cfg(feature = "std")]
16729 impl fmt::Display for MagneticStripeReader {
16730 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16731 write!(f, "{}", self.name())
16732 }
16733 }
16734
16735 impl AsUsage for MagneticStripeReader {
16736 /// Returns the 32 bit Usage value of this Usage
16737 fn usage_value(&self) -> u32 {
16738 u32::from(self)
16739 }
16740
16741 /// Returns the 16 bit Usage ID value of this Usage
16742 fn usage_id_value(&self) -> u16 {
16743 u16::from(self)
16744 }
16745
16746 /// Returns this usage as [Usage::MagneticStripeReader(self)](Usage::MagneticStripeReader)
16747 /// This is a convenience function to avoid having
16748 /// to implement `From` for every used type in the caller.
16749 ///
16750 /// ```
16751 /// # use hut::*;
16752 /// let gd_x = GenericDesktop::X;
16753 /// let usage = Usage::from(GenericDesktop::X);
16754 /// assert!(matches!(gd_x.usage(), usage));
16755 /// ```
16756 fn usage(&self) -> Usage {
16757 Usage::from(self)
16758 }
16759 }
16760
16761 impl AsUsagePage for MagneticStripeReader {
16762 /// Returns the 16 bit value of this UsagePage
16763 ///
16764 /// This value is `0x8E` for [MagneticStripeReader]
16765 fn usage_page_value(&self) -> u16 {
16766 let up = UsagePage::from(self);
16767 u16::from(up)
16768 }
16769
16770 /// Returns [UsagePage::MagneticStripeReader]]
16771 fn usage_page(&self) -> UsagePage {
16772 UsagePage::from(self)
16773 }
16774 }
16775
16776 impl From<&MagneticStripeReader> for u16 {
16777 fn from(magneticstripereader: &MagneticStripeReader) -> u16 {
16778 *magneticstripereader as u16
16779 }
16780 }
16781
16782 impl From<MagneticStripeReader> for u16 {
16783 /// Returns the 16bit value of this usage. This is identical
16784 /// to [MagneticStripeReader::usage_page_value()].
16785 fn from(magneticstripereader: MagneticStripeReader) -> u16 {
16786 u16::from(&magneticstripereader)
16787 }
16788 }
16789
16790 impl From<&MagneticStripeReader> for u32 {
16791 /// Returns the 32 bit value of this usage. This is identical
16792 /// to [MagneticStripeReader::usage_value()].
16793 fn from(magneticstripereader: &MagneticStripeReader) -> u32 {
16794 let up = UsagePage::from(magneticstripereader);
16795 let up = (u16::from(&up) as u32) << 16;
16796 let id = u16::from(magneticstripereader) as u32;
16797 up | id
16798 }
16799 }
16800
16801 impl From<&MagneticStripeReader> for UsagePage {
16802 /// Always returns [UsagePage::MagneticStripeReader] and is
16803 /// identical to [MagneticStripeReader::usage_page()].
16804 fn from(_: &MagneticStripeReader) -> UsagePage {
16805 UsagePage::MagneticStripeReader
16806 }
16807 }
16808
16809 impl From<MagneticStripeReader> for UsagePage {
16810 /// Always returns [UsagePage::MagneticStripeReader] and is
16811 /// identical to [MagneticStripeReader::usage_page()].
16812 fn from(_: MagneticStripeReader) -> UsagePage {
16813 UsagePage::MagneticStripeReader
16814 }
16815 }
16816
16817 impl From<&MagneticStripeReader> for Usage {
16818 fn from(magneticstripereader: &MagneticStripeReader) -> Usage {
16819 Usage::try_from(u32::from(magneticstripereader)).unwrap()
16820 }
16821 }
16822
16823 impl From<MagneticStripeReader> for Usage {
16824 fn from(magneticstripereader: MagneticStripeReader) -> Usage {
16825 Usage::from(&magneticstripereader)
16826 }
16827 }
16828
16829 impl TryFrom<u16> for MagneticStripeReader {
16830 type Error = HutError;
16831
16832 fn try_from(usage_id: u16) -> Result<MagneticStripeReader> {
16833 match usage_id {
16834 1 => Ok(MagneticStripeReader::MSRDeviceReadOnly),
16835 17 => Ok(MagneticStripeReader::Track1Length),
16836 18 => Ok(MagneticStripeReader::Track2Length),
16837 19 => Ok(MagneticStripeReader::Track3Length),
16838 20 => Ok(MagneticStripeReader::TrackJISLength),
16839 32 => Ok(MagneticStripeReader::TrackData),
16840 33 => Ok(MagneticStripeReader::Track1Data),
16841 34 => Ok(MagneticStripeReader::Track2Data),
16842 35 => Ok(MagneticStripeReader::Track3Data),
16843 36 => Ok(MagneticStripeReader::TrackJISData),
16844 n => Err(HutError::UnknownUsageId { usage_id: n }),
16845 }
16846 }
16847 }
16848
16849 impl BitOr<u16> for MagneticStripeReader {
16850 type Output = Usage;
16851
16852 /// A convenience function to combine a Usage Page with
16853 /// a value.
16854 ///
16855 /// This function panics if the Usage ID value results in
16856 /// an unknown Usage. Where error checking is required,
16857 /// use [UsagePage::to_usage_from_value].
16858 fn bitor(self, usage: u16) -> Usage {
16859 let up = u16::from(self) as u32;
16860 let u = usage as u32;
16861 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
16862 }
16863 }
16864
16865 /// *Usage Page `0x90`: "Camera Control"*
16866 ///
16867 /// **This enum is autogenerated from the HID Usage Tables**.
16868 /// ```
16869 /// # use hut::*;
16870 /// let u1 = Usage::CameraControl(CameraControl::CameraShutter);
16871 /// let u2 = Usage::new_from_page_and_id(0x90, 0x21).unwrap();
16872 /// let u3 = Usage::from(CameraControl::CameraShutter);
16873 /// let u4: Usage = CameraControl::CameraShutter.into();
16874 /// assert_eq!(u1, u2);
16875 /// assert_eq!(u1, u3);
16876 /// assert_eq!(u1, u4);
16877 ///
16878 /// assert!(matches!(u1.usage_page(), UsagePage::CameraControl));
16879 /// assert_eq!(0x90, u1.usage_page_value());
16880 /// assert_eq!(0x21, u1.usage_id_value());
16881 /// assert_eq!((0x90 << 16) | 0x21, u1.usage_value());
16882 /// assert_eq!("Camera Shutter", u1.name());
16883 /// ```
16884 ///
16885 #[allow(non_camel_case_types)]
16886 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
16887 #[non_exhaustive]
16888 #[repr(u16)]
16889 pub enum CameraControl {
16890 /// Usage ID `0x20`: "Camera Auto-focus"
16891 CameraAutofocus = 0x20,
16892 /// Usage ID `0x21`: "Camera Shutter"
16893 CameraShutter = 0x21,
16894 }
16895
16896 impl CameraControl {
16897 #[cfg(feature = "std")]
16898 pub fn name(&self) -> String {
16899 match self {
16900 CameraControl::CameraAutofocus => "Camera Auto-focus",
16901 CameraControl::CameraShutter => "Camera Shutter",
16902 }
16903 .into()
16904 }
16905 }
16906
16907 #[cfg(feature = "std")]
16908 impl fmt::Display for CameraControl {
16909 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16910 write!(f, "{}", self.name())
16911 }
16912 }
16913
16914 impl AsUsage for CameraControl {
16915 /// Returns the 32 bit Usage value of this Usage
16916 fn usage_value(&self) -> u32 {
16917 u32::from(self)
16918 }
16919
16920 /// Returns the 16 bit Usage ID value of this Usage
16921 fn usage_id_value(&self) -> u16 {
16922 u16::from(self)
16923 }
16924
16925 /// Returns this usage as [Usage::CameraControl(self)](Usage::CameraControl)
16926 /// This is a convenience function to avoid having
16927 /// to implement `From` for every used type in the caller.
16928 ///
16929 /// ```
16930 /// # use hut::*;
16931 /// let gd_x = GenericDesktop::X;
16932 /// let usage = Usage::from(GenericDesktop::X);
16933 /// assert!(matches!(gd_x.usage(), usage));
16934 /// ```
16935 fn usage(&self) -> Usage {
16936 Usage::from(self)
16937 }
16938 }
16939
16940 impl AsUsagePage for CameraControl {
16941 /// Returns the 16 bit value of this UsagePage
16942 ///
16943 /// This value is `0x90` for [CameraControl]
16944 fn usage_page_value(&self) -> u16 {
16945 let up = UsagePage::from(self);
16946 u16::from(up)
16947 }
16948
16949 /// Returns [UsagePage::CameraControl]]
16950 fn usage_page(&self) -> UsagePage {
16951 UsagePage::from(self)
16952 }
16953 }
16954
16955 impl From<&CameraControl> for u16 {
16956 fn from(cameracontrol: &CameraControl) -> u16 {
16957 *cameracontrol as u16
16958 }
16959 }
16960
16961 impl From<CameraControl> for u16 {
16962 /// Returns the 16bit value of this usage. This is identical
16963 /// to [CameraControl::usage_page_value()].
16964 fn from(cameracontrol: CameraControl) -> u16 {
16965 u16::from(&cameracontrol)
16966 }
16967 }
16968
16969 impl From<&CameraControl> for u32 {
16970 /// Returns the 32 bit value of this usage. This is identical
16971 /// to [CameraControl::usage_value()].
16972 fn from(cameracontrol: &CameraControl) -> u32 {
16973 let up = UsagePage::from(cameracontrol);
16974 let up = (u16::from(&up) as u32) << 16;
16975 let id = u16::from(cameracontrol) as u32;
16976 up | id
16977 }
16978 }
16979
16980 impl From<&CameraControl> for UsagePage {
16981 /// Always returns [UsagePage::CameraControl] and is
16982 /// identical to [CameraControl::usage_page()].
16983 fn from(_: &CameraControl) -> UsagePage {
16984 UsagePage::CameraControl
16985 }
16986 }
16987
16988 impl From<CameraControl> for UsagePage {
16989 /// Always returns [UsagePage::CameraControl] and is
16990 /// identical to [CameraControl::usage_page()].
16991 fn from(_: CameraControl) -> UsagePage {
16992 UsagePage::CameraControl
16993 }
16994 }
16995
16996 impl From<&CameraControl> for Usage {
16997 fn from(cameracontrol: &CameraControl) -> Usage {
16998 Usage::try_from(u32::from(cameracontrol)).unwrap()
16999 }
17000 }
17001
17002 impl From<CameraControl> for Usage {
17003 fn from(cameracontrol: CameraControl) -> Usage {
17004 Usage::from(&cameracontrol)
17005 }
17006 }
17007
17008 impl TryFrom<u16> for CameraControl {
17009 type Error = HutError;
17010
17011 fn try_from(usage_id: u16) -> Result<CameraControl> {
17012 match usage_id {
17013 32 => Ok(CameraControl::CameraAutofocus),
17014 33 => Ok(CameraControl::CameraShutter),
17015 n => Err(HutError::UnknownUsageId { usage_id: n }),
17016 }
17017 }
17018 }
17019
17020 impl BitOr<u16> for CameraControl {
17021 type Output = Usage;
17022
17023 /// A convenience function to combine a Usage Page with
17024 /// a value.
17025 ///
17026 /// This function panics if the Usage ID value results in
17027 /// an unknown Usage. Where error checking is required,
17028 /// use [UsagePage::to_usage_from_value].
17029 fn bitor(self, usage: u16) -> Usage {
17030 let up = u16::from(self) as u32;
17031 let u = usage as u32;
17032 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
17033 }
17034 }
17035
17036 /// *Usage Page `0x91`: "Arcade"*
17037 ///
17038 /// **This enum is autogenerated from the HID Usage Tables**.
17039 /// ```
17040 /// # use hut::*;
17041 /// let u1 = Usage::Arcade(Arcade::CoinDoor);
17042 /// let u2 = Usage::new_from_page_and_id(0x91, 0x2).unwrap();
17043 /// let u3 = Usage::from(Arcade::CoinDoor);
17044 /// let u4: Usage = Arcade::CoinDoor.into();
17045 /// assert_eq!(u1, u2);
17046 /// assert_eq!(u1, u3);
17047 /// assert_eq!(u1, u4);
17048 ///
17049 /// assert!(matches!(u1.usage_page(), UsagePage::Arcade));
17050 /// assert_eq!(0x91, u1.usage_page_value());
17051 /// assert_eq!(0x2, u1.usage_id_value());
17052 /// assert_eq!((0x91 << 16) | 0x2, u1.usage_value());
17053 /// assert_eq!("Coin Door", u1.name());
17054 /// ```
17055 ///
17056 #[allow(non_camel_case_types)]
17057 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
17058 #[non_exhaustive]
17059 #[repr(u16)]
17060 pub enum Arcade {
17061 /// Usage ID `0x1`: "General Purpose IO Card"
17062 GeneralPurposeIOCard = 0x1,
17063 /// Usage ID `0x2`: "Coin Door"
17064 CoinDoor = 0x2,
17065 /// Usage ID `0x3`: "Watchdog Timer"
17066 WatchdogTimer = 0x3,
17067 /// Usage ID `0x30`: "General Purpose Analog Input State"
17068 GeneralPurposeAnalogInputState = 0x30,
17069 /// Usage ID `0x31`: "General Purpose Digital Input State"
17070 GeneralPurposeDigitalInputState = 0x31,
17071 /// Usage ID `0x32`: "General Purpose Optical Input State"
17072 GeneralPurposeOpticalInputState = 0x32,
17073 /// Usage ID `0x33`: "General Purpose Digital Output State"
17074 GeneralPurposeDigitalOutputState = 0x33,
17075 /// Usage ID `0x34`: "Number of Coin Doors"
17076 NumberofCoinDoors = 0x34,
17077 /// Usage ID `0x35`: "Coin Drawer Drop Count"
17078 CoinDrawerDropCount = 0x35,
17079 /// Usage ID `0x36`: "Coin Drawer Start"
17080 CoinDrawerStart = 0x36,
17081 /// Usage ID `0x37`: "Coin Drawer Service"
17082 CoinDrawerService = 0x37,
17083 /// Usage ID `0x38`: "Coin Drawer Tilt"
17084 CoinDrawerTilt = 0x38,
17085 /// Usage ID `0x39`: "Coin Door Test"
17086 CoinDoorTest = 0x39,
17087 /// Usage ID `0x40`: "Coin Door Lockout"
17088 CoinDoorLockout = 0x40,
17089 /// Usage ID `0x41`: "Watchdog Timeout"
17090 WatchdogTimeout = 0x41,
17091 /// Usage ID `0x42`: "Watchdog Action"
17092 WatchdogAction = 0x42,
17093 /// Usage ID `0x43`: "Watchdog Reboot"
17094 WatchdogReboot = 0x43,
17095 /// Usage ID `0x44`: "Watchdog Restart"
17096 WatchdogRestart = 0x44,
17097 /// Usage ID `0x45`: "Alarm Input"
17098 AlarmInput = 0x45,
17099 /// Usage ID `0x46`: "Coin Door Counter"
17100 CoinDoorCounter = 0x46,
17101 /// Usage ID `0x47`: "I/O Direction Mapping"
17102 IODirectionMapping = 0x47,
17103 /// Usage ID `0x48`: "Set I/O Direction Mapping"
17104 SetIODirectionMapping = 0x48,
17105 /// Usage ID `0x49`: "Extended Optical Input State"
17106 ExtendedOpticalInputState = 0x49,
17107 /// Usage ID `0x4A`: "Pin Pad Input State"
17108 PinPadInputState = 0x4A,
17109 /// Usage ID `0x4B`: "Pin Pad Status"
17110 PinPadStatus = 0x4B,
17111 /// Usage ID `0x4C`: "Pin Pad Output"
17112 PinPadOutput = 0x4C,
17113 /// Usage ID `0x4D`: "Pin Pad Command"
17114 PinPadCommand = 0x4D,
17115 }
17116
17117 impl Arcade {
17118 #[cfg(feature = "std")]
17119 pub fn name(&self) -> String {
17120 match self {
17121 Arcade::GeneralPurposeIOCard => "General Purpose IO Card",
17122 Arcade::CoinDoor => "Coin Door",
17123 Arcade::WatchdogTimer => "Watchdog Timer",
17124 Arcade::GeneralPurposeAnalogInputState => "General Purpose Analog Input State",
17125 Arcade::GeneralPurposeDigitalInputState => "General Purpose Digital Input State",
17126 Arcade::GeneralPurposeOpticalInputState => "General Purpose Optical Input State",
17127 Arcade::GeneralPurposeDigitalOutputState => "General Purpose Digital Output State",
17128 Arcade::NumberofCoinDoors => "Number of Coin Doors",
17129 Arcade::CoinDrawerDropCount => "Coin Drawer Drop Count",
17130 Arcade::CoinDrawerStart => "Coin Drawer Start",
17131 Arcade::CoinDrawerService => "Coin Drawer Service",
17132 Arcade::CoinDrawerTilt => "Coin Drawer Tilt",
17133 Arcade::CoinDoorTest => "Coin Door Test",
17134 Arcade::CoinDoorLockout => "Coin Door Lockout",
17135 Arcade::WatchdogTimeout => "Watchdog Timeout",
17136 Arcade::WatchdogAction => "Watchdog Action",
17137 Arcade::WatchdogReboot => "Watchdog Reboot",
17138 Arcade::WatchdogRestart => "Watchdog Restart",
17139 Arcade::AlarmInput => "Alarm Input",
17140 Arcade::CoinDoorCounter => "Coin Door Counter",
17141 Arcade::IODirectionMapping => "I/O Direction Mapping",
17142 Arcade::SetIODirectionMapping => "Set I/O Direction Mapping",
17143 Arcade::ExtendedOpticalInputState => "Extended Optical Input State",
17144 Arcade::PinPadInputState => "Pin Pad Input State",
17145 Arcade::PinPadStatus => "Pin Pad Status",
17146 Arcade::PinPadOutput => "Pin Pad Output",
17147 Arcade::PinPadCommand => "Pin Pad Command",
17148 }
17149 .into()
17150 }
17151 }
17152
17153 #[cfg(feature = "std")]
17154 impl fmt::Display for Arcade {
17155 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
17156 write!(f, "{}", self.name())
17157 }
17158 }
17159
17160 impl AsUsage for Arcade {
17161 /// Returns the 32 bit Usage value of this Usage
17162 fn usage_value(&self) -> u32 {
17163 u32::from(self)
17164 }
17165
17166 /// Returns the 16 bit Usage ID value of this Usage
17167 fn usage_id_value(&self) -> u16 {
17168 u16::from(self)
17169 }
17170
17171 /// Returns this usage as [Usage::Arcade(self)](Usage::Arcade)
17172 /// This is a convenience function to avoid having
17173 /// to implement `From` for every used type in the caller.
17174 ///
17175 /// ```
17176 /// # use hut::*;
17177 /// let gd_x = GenericDesktop::X;
17178 /// let usage = Usage::from(GenericDesktop::X);
17179 /// assert!(matches!(gd_x.usage(), usage));
17180 /// ```
17181 fn usage(&self) -> Usage {
17182 Usage::from(self)
17183 }
17184 }
17185
17186 impl AsUsagePage for Arcade {
17187 /// Returns the 16 bit value of this UsagePage
17188 ///
17189 /// This value is `0x91` for [Arcade]
17190 fn usage_page_value(&self) -> u16 {
17191 let up = UsagePage::from(self);
17192 u16::from(up)
17193 }
17194
17195 /// Returns [UsagePage::Arcade]]
17196 fn usage_page(&self) -> UsagePage {
17197 UsagePage::from(self)
17198 }
17199 }
17200
17201 impl From<&Arcade> for u16 {
17202 fn from(arcade: &Arcade) -> u16 {
17203 *arcade as u16
17204 }
17205 }
17206
17207 impl From<Arcade> for u16 {
17208 /// Returns the 16bit value of this usage. This is identical
17209 /// to [Arcade::usage_page_value()].
17210 fn from(arcade: Arcade) -> u16 {
17211 u16::from(&arcade)
17212 }
17213 }
17214
17215 impl From<&Arcade> for u32 {
17216 /// Returns the 32 bit value of this usage. This is identical
17217 /// to [Arcade::usage_value()].
17218 fn from(arcade: &Arcade) -> u32 {
17219 let up = UsagePage::from(arcade);
17220 let up = (u16::from(&up) as u32) << 16;
17221 let id = u16::from(arcade) as u32;
17222 up | id
17223 }
17224 }
17225
17226 impl From<&Arcade> for UsagePage {
17227 /// Always returns [UsagePage::Arcade] and is
17228 /// identical to [Arcade::usage_page()].
17229 fn from(_: &Arcade) -> UsagePage {
17230 UsagePage::Arcade
17231 }
17232 }
17233
17234 impl From<Arcade> for UsagePage {
17235 /// Always returns [UsagePage::Arcade] and is
17236 /// identical to [Arcade::usage_page()].
17237 fn from(_: Arcade) -> UsagePage {
17238 UsagePage::Arcade
17239 }
17240 }
17241
17242 impl From<&Arcade> for Usage {
17243 fn from(arcade: &Arcade) -> Usage {
17244 Usage::try_from(u32::from(arcade)).unwrap()
17245 }
17246 }
17247
17248 impl From<Arcade> for Usage {
17249 fn from(arcade: Arcade) -> Usage {
17250 Usage::from(&arcade)
17251 }
17252 }
17253
17254 impl TryFrom<u16> for Arcade {
17255 type Error = HutError;
17256
17257 fn try_from(usage_id: u16) -> Result<Arcade> {
17258 match usage_id {
17259 1 => Ok(Arcade::GeneralPurposeIOCard),
17260 2 => Ok(Arcade::CoinDoor),
17261 3 => Ok(Arcade::WatchdogTimer),
17262 48 => Ok(Arcade::GeneralPurposeAnalogInputState),
17263 49 => Ok(Arcade::GeneralPurposeDigitalInputState),
17264 50 => Ok(Arcade::GeneralPurposeOpticalInputState),
17265 51 => Ok(Arcade::GeneralPurposeDigitalOutputState),
17266 52 => Ok(Arcade::NumberofCoinDoors),
17267 53 => Ok(Arcade::CoinDrawerDropCount),
17268 54 => Ok(Arcade::CoinDrawerStart),
17269 55 => Ok(Arcade::CoinDrawerService),
17270 56 => Ok(Arcade::CoinDrawerTilt),
17271 57 => Ok(Arcade::CoinDoorTest),
17272 64 => Ok(Arcade::CoinDoorLockout),
17273 65 => Ok(Arcade::WatchdogTimeout),
17274 66 => Ok(Arcade::WatchdogAction),
17275 67 => Ok(Arcade::WatchdogReboot),
17276 68 => Ok(Arcade::WatchdogRestart),
17277 69 => Ok(Arcade::AlarmInput),
17278 70 => Ok(Arcade::CoinDoorCounter),
17279 71 => Ok(Arcade::IODirectionMapping),
17280 72 => Ok(Arcade::SetIODirectionMapping),
17281 73 => Ok(Arcade::ExtendedOpticalInputState),
17282 74 => Ok(Arcade::PinPadInputState),
17283 75 => Ok(Arcade::PinPadStatus),
17284 76 => Ok(Arcade::PinPadOutput),
17285 77 => Ok(Arcade::PinPadCommand),
17286 n => Err(HutError::UnknownUsageId { usage_id: n }),
17287 }
17288 }
17289 }
17290
17291 impl BitOr<u16> for Arcade {
17292 type Output = Usage;
17293
17294 /// A convenience function to combine a Usage Page with
17295 /// a value.
17296 ///
17297 /// This function panics if the Usage ID value results in
17298 /// an unknown Usage. Where error checking is required,
17299 /// use [UsagePage::to_usage_from_value].
17300 fn bitor(self, usage: u16) -> Usage {
17301 let up = u16::from(self) as u32;
17302 let u = usage as u32;
17303 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
17304 }
17305 }
17306
17307 /// *Usage Page `0xF1D0`: "FIDO Alliance"*
17308 ///
17309 /// **This enum is autogenerated from the HID Usage Tables**.
17310 /// ```
17311 /// # use hut::*;
17312 /// let u1 = Usage::FIDOAlliance(FIDOAlliance::InputReportData);
17313 /// let u2 = Usage::new_from_page_and_id(0xF1D0, 0x20).unwrap();
17314 /// let u3 = Usage::from(FIDOAlliance::InputReportData);
17315 /// let u4: Usage = FIDOAlliance::InputReportData.into();
17316 /// assert_eq!(u1, u2);
17317 /// assert_eq!(u1, u3);
17318 /// assert_eq!(u1, u4);
17319 ///
17320 /// assert!(matches!(u1.usage_page(), UsagePage::FIDOAlliance));
17321 /// assert_eq!(0xF1D0, u1.usage_page_value());
17322 /// assert_eq!(0x20, u1.usage_id_value());
17323 /// assert_eq!((0xF1D0 << 16) | 0x20, u1.usage_value());
17324 /// assert_eq!("Input Report Data", u1.name());
17325 /// ```
17326 ///
17327 #[allow(non_camel_case_types)]
17328 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
17329 #[non_exhaustive]
17330 #[repr(u16)]
17331 pub enum FIDOAlliance {
17332 /// Usage ID `0x1`: "U2F Authenticator Device"
17333 U2FAuthenticatorDevice = 0x1,
17334 /// Usage ID `0x20`: "Input Report Data"
17335 InputReportData = 0x20,
17336 /// Usage ID `0x21`: "Output Report Data"
17337 OutputReportData = 0x21,
17338 }
17339
17340 impl FIDOAlliance {
17341 #[cfg(feature = "std")]
17342 pub fn name(&self) -> String {
17343 match self {
17344 FIDOAlliance::U2FAuthenticatorDevice => "U2F Authenticator Device",
17345 FIDOAlliance::InputReportData => "Input Report Data",
17346 FIDOAlliance::OutputReportData => "Output Report Data",
17347 }
17348 .into()
17349 }
17350 }
17351
17352 #[cfg(feature = "std")]
17353 impl fmt::Display for FIDOAlliance {
17354 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
17355 write!(f, "{}", self.name())
17356 }
17357 }
17358
17359 impl AsUsage for FIDOAlliance {
17360 /// Returns the 32 bit Usage value of this Usage
17361 fn usage_value(&self) -> u32 {
17362 u32::from(self)
17363 }
17364
17365 /// Returns the 16 bit Usage ID value of this Usage
17366 fn usage_id_value(&self) -> u16 {
17367 u16::from(self)
17368 }
17369
17370 /// Returns this usage as [Usage::FIDOAlliance(self)](Usage::FIDOAlliance)
17371 /// This is a convenience function to avoid having
17372 /// to implement `From` for every used type in the caller.
17373 ///
17374 /// ```
17375 /// # use hut::*;
17376 /// let gd_x = GenericDesktop::X;
17377 /// let usage = Usage::from(GenericDesktop::X);
17378 /// assert!(matches!(gd_x.usage(), usage));
17379 /// ```
17380 fn usage(&self) -> Usage {
17381 Usage::from(self)
17382 }
17383 }
17384
17385 impl AsUsagePage for FIDOAlliance {
17386 /// Returns the 16 bit value of this UsagePage
17387 ///
17388 /// This value is `0xF1D0` for [FIDOAlliance]
17389 fn usage_page_value(&self) -> u16 {
17390 let up = UsagePage::from(self);
17391 u16::from(up)
17392 }
17393
17394 /// Returns [UsagePage::FIDOAlliance]]
17395 fn usage_page(&self) -> UsagePage {
17396 UsagePage::from(self)
17397 }
17398 }
17399
17400 impl From<&FIDOAlliance> for u16 {
17401 fn from(fidoalliance: &FIDOAlliance) -> u16 {
17402 *fidoalliance as u16
17403 }
17404 }
17405
17406 impl From<FIDOAlliance> for u16 {
17407 /// Returns the 16bit value of this usage. This is identical
17408 /// to [FIDOAlliance::usage_page_value()].
17409 fn from(fidoalliance: FIDOAlliance) -> u16 {
17410 u16::from(&fidoalliance)
17411 }
17412 }
17413
17414 impl From<&FIDOAlliance> for u32 {
17415 /// Returns the 32 bit value of this usage. This is identical
17416 /// to [FIDOAlliance::usage_value()].
17417 fn from(fidoalliance: &FIDOAlliance) -> u32 {
17418 let up = UsagePage::from(fidoalliance);
17419 let up = (u16::from(&up) as u32) << 16;
17420 let id = u16::from(fidoalliance) as u32;
17421 up | id
17422 }
17423 }
17424
17425 impl From<&FIDOAlliance> for UsagePage {
17426 /// Always returns [UsagePage::FIDOAlliance] and is
17427 /// identical to [FIDOAlliance::usage_page()].
17428 fn from(_: &FIDOAlliance) -> UsagePage {
17429 UsagePage::FIDOAlliance
17430 }
17431 }
17432
17433 impl From<FIDOAlliance> for UsagePage {
17434 /// Always returns [UsagePage::FIDOAlliance] and is
17435 /// identical to [FIDOAlliance::usage_page()].
17436 fn from(_: FIDOAlliance) -> UsagePage {
17437 UsagePage::FIDOAlliance
17438 }
17439 }
17440
17441 impl From<&FIDOAlliance> for Usage {
17442 fn from(fidoalliance: &FIDOAlliance) -> Usage {
17443 Usage::try_from(u32::from(fidoalliance)).unwrap()
17444 }
17445 }
17446
17447 impl From<FIDOAlliance> for Usage {
17448 fn from(fidoalliance: FIDOAlliance) -> Usage {
17449 Usage::from(&fidoalliance)
17450 }
17451 }
17452
17453 impl TryFrom<u16> for FIDOAlliance {
17454 type Error = HutError;
17455
17456 fn try_from(usage_id: u16) -> Result<FIDOAlliance> {
17457 match usage_id {
17458 1 => Ok(FIDOAlliance::U2FAuthenticatorDevice),
17459 32 => Ok(FIDOAlliance::InputReportData),
17460 33 => Ok(FIDOAlliance::OutputReportData),
17461 n => Err(HutError::UnknownUsageId { usage_id: n }),
17462 }
17463 }
17464 }
17465
17466 impl BitOr<u16> for FIDOAlliance {
17467 type Output = Usage;
17468
17469 /// A convenience function to combine a Usage Page with
17470 /// a value.
17471 ///
17472 /// This function panics if the Usage ID value results in
17473 /// an unknown Usage. Where error checking is required,
17474 /// use [UsagePage::to_usage_from_value].
17475 fn bitor(self, usage: u16) -> Usage {
17476 let up = u16::from(self) as u32;
17477 let u = usage as u32;
17478 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
17479 }
17480 }
17481
17482 /// *Usage Page `0xFF0D`: "Wacom"*
17483 ///
17484 /// **This enum is autogenerated from the HID Usage Tables**.
17485 /// ```
17486 /// # use hut::*;
17487 /// let u1 = Usage::Wacom(Wacom::WacomPen);
17488 /// let u2 = Usage::new_from_page_and_id(0xFF0D, 0x2).unwrap();
17489 /// let u3 = Usage::from(Wacom::WacomPen);
17490 /// let u4: Usage = Wacom::WacomPen.into();
17491 /// assert_eq!(u1, u2);
17492 /// assert_eq!(u1, u3);
17493 /// assert_eq!(u1, u4);
17494 ///
17495 /// assert!(matches!(u1.usage_page(), UsagePage::Wacom));
17496 /// assert_eq!(0xFF0D, u1.usage_page_value());
17497 /// assert_eq!(0x2, u1.usage_id_value());
17498 /// assert_eq!((0xFF0D << 16) | 0x2, u1.usage_value());
17499 /// assert_eq!("Wacom Pen", u1.name());
17500 /// ```
17501 ///
17502 #[allow(non_camel_case_types)]
17503 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
17504 #[non_exhaustive]
17505 #[repr(u16)]
17506 pub enum Wacom {
17507 /// Usage ID `0x1`: "Wacom Digitizer"
17508 WacomDigitizer = 0x1,
17509 /// Usage ID `0x2`: "Wacom Pen"
17510 WacomPen = 0x2,
17511 /// Usage ID `0x3`: "Light Pen"
17512 LightPen = 0x3,
17513 /// Usage ID `0x4`: "Touch Screen"
17514 TouchScreen = 0x4,
17515 /// Usage ID `0x5`: "Touch Pad"
17516 TouchPad = 0x5,
17517 /// Usage ID `0x6`: "White Board"
17518 WhiteBoard = 0x6,
17519 /// Usage ID `0x7`: "Coordinate Measuring Machine"
17520 CoordinateMeasuringMachine = 0x7,
17521 /// Usage ID `0x8`: "3-D Digitizer"
17522 ThreeDDigitizer = 0x8,
17523 /// Usage ID `0x9`: "Stereo Plotter"
17524 StereoPlotter = 0x9,
17525 /// Usage ID `0xA`: "Articulated Arm"
17526 ArticulatedArm = 0xA,
17527 /// Usage ID `0xB`: "Armature"
17528 Armature = 0xB,
17529 /// Usage ID `0xC`: "Multiple Point Digitizer"
17530 MultiplePointDigitizer = 0xC,
17531 /// Usage ID `0xD`: "Free Space Wand"
17532 FreeSpaceWand = 0xD,
17533 /// Usage ID `0xE`: "Device Configuration"
17534 DeviceConfiguration = 0xE,
17535 /// Usage ID `0x20`: "Stylus"
17536 Stylus = 0x20,
17537 /// Usage ID `0x21`: "Puck"
17538 Puck = 0x21,
17539 /// Usage ID `0x22`: "Finger"
17540 Finger = 0x22,
17541 /// Usage ID `0x23`: "Device Settings"
17542 DeviceSettings = 0x23,
17543 /// Usage ID `0x30`: "Tip Pressure"
17544 TipPressure = 0x30,
17545 /// Usage ID `0x31`: "Barrel Pressure"
17546 BarrelPressure = 0x31,
17547 /// Usage ID `0x32`: "In Range"
17548 InRange = 0x32,
17549 /// Usage ID `0x33`: "Touch"
17550 Touch = 0x33,
17551 /// Usage ID `0x34`: "Untouch"
17552 Untouch = 0x34,
17553 /// Usage ID `0x35`: "Tap"
17554 Tap = 0x35,
17555 /// Usage ID `0x36`: "Wacom Sense"
17556 WacomSense = 0x36,
17557 /// Usage ID `0x37`: "Data Valid"
17558 DataValid = 0x37,
17559 /// Usage ID `0x38`: "Transducer Index"
17560 TransducerIndex = 0x38,
17561 /// Usage ID `0x39`: "Wacom DigitizerFnKeys"
17562 WacomDigitizerFnKeys = 0x39,
17563 /// Usage ID `0x3A`: "Program Change Keys"
17564 ProgramChangeKeys = 0x3A,
17565 /// Usage ID `0x3B`: "Battery Strength"
17566 BatteryStrength = 0x3B,
17567 /// Usage ID `0x3C`: "Invert"
17568 Invert = 0x3C,
17569 /// Usage ID `0x3D`: "X Tilt"
17570 XTilt = 0x3D,
17571 /// Usage ID `0x3E`: "Y Tilt"
17572 YTilt = 0x3E,
17573 /// Usage ID `0x3F`: "Azimuth"
17574 Azimuth = 0x3F,
17575 /// Usage ID `0x40`: "Altitude"
17576 Altitude = 0x40,
17577 /// Usage ID `0x41`: "Twist"
17578 Twist = 0x41,
17579 /// Usage ID `0x42`: "Tip Switch"
17580 TipSwitch = 0x42,
17581 /// Usage ID `0x43`: "Secondary Tip Switch"
17582 SecondaryTipSwitch = 0x43,
17583 /// Usage ID `0x44`: "Barrel Switch"
17584 BarrelSwitch = 0x44,
17585 /// Usage ID `0x45`: "Eraser"
17586 Eraser = 0x45,
17587 /// Usage ID `0x46`: "Tablet Pick"
17588 TabletPick = 0x46,
17589 /// Usage ID `0x47`: "Confidence"
17590 Confidence = 0x47,
17591 /// Usage ID `0x48`: "Width"
17592 Width = 0x48,
17593 /// Usage ID `0x49`: "Height"
17594 Height = 0x49,
17595 /// Usage ID `0x51`: "Contact Id"
17596 ContactId = 0x51,
17597 /// Usage ID `0x52`: "Inputmode"
17598 Inputmode = 0x52,
17599 /// Usage ID `0x53`: "Device Index"
17600 DeviceIndex = 0x53,
17601 /// Usage ID `0x54`: "Contact Count"
17602 ContactCount = 0x54,
17603 /// Usage ID `0x55`: "Contact Max"
17604 ContactMax = 0x55,
17605 /// Usage ID `0x56`: "Scan Time"
17606 ScanTime = 0x56,
17607 /// Usage ID `0x57`: "Surface Switch"
17608 SurfaceSwitch = 0x57,
17609 /// Usage ID `0x58`: "Button Switch"
17610 ButtonSwitch = 0x58,
17611 /// Usage ID `0x59`: "Button Type"
17612 ButtonType = 0x59,
17613 /// Usage ID `0x5A`: "Secondary Barrel Switch"
17614 SecondaryBarrelSwitch = 0x5A,
17615 /// Usage ID `0x5B`: "Transducer Serial Number"
17616 TransducerSerialNumber = 0x5B,
17617 /// Usage ID `0x5C`: "Wacom SerialHi"
17618 WacomSerialHi = 0x5C,
17619 /// Usage ID `0x5D`: "Preferred Color is Locked"
17620 PreferredColorisLocked = 0x5D,
17621 /// Usage ID `0x5E`: "Preferred Line Width"
17622 PreferredLineWidth = 0x5E,
17623 /// Usage ID `0x5F`: "Preferred Line Width is Locked"
17624 PreferredLineWidthisLocked = 0x5F,
17625 /// Usage ID `0x70`: "Preferred Line Style"
17626 PreferredLineStyle = 0x70,
17627 /// Usage ID `0x71`: "Preferred Line Style is Locked"
17628 PreferredLineStyleisLocked = 0x71,
17629 /// Usage ID `0x72`: "Ink"
17630 Ink = 0x72,
17631 /// Usage ID `0x73`: "Pencil"
17632 Pencil = 0x73,
17633 /// Usage ID `0x74`: "Highlighter"
17634 Highlighter = 0x74,
17635 /// Usage ID `0x75`: "Chisel Marker"
17636 ChiselMarker = 0x75,
17637 /// Usage ID `0x76`: "Brush"
17638 Brush = 0x76,
17639 /// Usage ID `0x77`: "Wacom ToolType"
17640 WacomToolType = 0x77,
17641 /// Usage ID `0x80`: "Digitizer Diagnostic"
17642 DigitizerDiagnostic = 0x80,
17643 /// Usage ID `0x81`: "Digitizer Error"
17644 DigitizerError = 0x81,
17645 /// Usage ID `0x82`: "Err Normal Status"
17646 ErrNormalStatus = 0x82,
17647 /// Usage ID `0x83`: "Err Transducers Exceeded"
17648 ErrTransducersExceeded = 0x83,
17649 /// Usage ID `0x84`: "Err Full Trans Features Unavail"
17650 ErrFullTransFeaturesUnavail = 0x84,
17651 /// Usage ID `0x85`: "Err Charge Low"
17652 ErrChargeLow = 0x85,
17653 /// Usage ID `0x130`: "X"
17654 X = 0x130,
17655 /// Usage ID `0x131`: "Y"
17656 Y = 0x131,
17657 /// Usage ID `0x132`: "Wacom Distance"
17658 WacomDistance = 0x132,
17659 /// Usage ID `0x136`: "Wacom TouchStrip"
17660 WacomTouchStrip = 0x136,
17661 /// Usage ID `0x137`: "Wacom TouchStrip2"
17662 WacomTouchStrip2 = 0x137,
17663 /// Usage ID `0x138`: "Wacom TouchRing"
17664 WacomTouchRing = 0x138,
17665 /// Usage ID `0x139`: "Wacom TouchRingStatus"
17666 WacomTouchRingStatus = 0x139,
17667 /// Usage ID `0x401`: "Wacom Accelerometer X"
17668 WacomAccelerometerX = 0x401,
17669 /// Usage ID `0x402`: "Wacom Accelerometer Y"
17670 WacomAccelerometerY = 0x402,
17671 /// Usage ID `0x403`: "Wacom Accelerometer Z"
17672 WacomAccelerometerZ = 0x403,
17673 /// Usage ID `0x404`: "Wacom Battery Charging"
17674 WacomBatteryCharging = 0x404,
17675 /// Usage ID `0x43B`: "Wacom Battery Level"
17676 WacomBatteryLevel = 0x43B,
17677 /// Usage ID `0x454`: "Wacom TouchOnOff"
17678 WacomTouchOnOff = 0x454,
17679 /// Usage ID `0x910`: "Wacom ExpressKey00"
17680 WacomExpressKey00 = 0x910,
17681 /// Usage ID `0x950`: "Wacom ExpressKeyCap00"
17682 WacomExpressKeyCap00 = 0x950,
17683 /// Usage ID `0x980`: "Wacom Mode Change"
17684 WacomModeChange = 0x980,
17685 /// Usage ID `0x981`: "Wacom Button Desktop Center"
17686 WacomButtonDesktopCenter = 0x981,
17687 /// Usage ID `0x982`: "Wacom Button On Screen Keyboard"
17688 WacomButtonOnScreenKeyboard = 0x982,
17689 /// Usage ID `0x983`: "Wacom Button Display Setting"
17690 WacomButtonDisplaySetting = 0x983,
17691 /// Usage ID `0x986`: "Wacom Button Touch On/Off"
17692 WacomButtonTouchOnOff = 0x986,
17693 /// Usage ID `0x990`: "Wacom Button Home"
17694 WacomButtonHome = 0x990,
17695 /// Usage ID `0x991`: "Wacom Button Up"
17696 WacomButtonUp = 0x991,
17697 /// Usage ID `0x992`: "Wacom Button Down"
17698 WacomButtonDown = 0x992,
17699 /// Usage ID `0x993`: "Wacom Button Left"
17700 WacomButtonLeft = 0x993,
17701 /// Usage ID `0x994`: "Wacom Button Right"
17702 WacomButtonRight = 0x994,
17703 /// Usage ID `0x995`: "Wacom Button Center"
17704 WacomButtonCenter = 0x995,
17705 /// Usage ID `0xD03`: "Wacom FingerWheel"
17706 WacomFingerWheel = 0xD03,
17707 /// Usage ID `0xD30`: "Wacom Offset Left"
17708 WacomOffsetLeft = 0xD30,
17709 /// Usage ID `0xD31`: "Wacom Offset Top"
17710 WacomOffsetTop = 0xD31,
17711 /// Usage ID `0xD32`: "Wacom Offset Right"
17712 WacomOffsetRight = 0xD32,
17713 /// Usage ID `0xD33`: "Wacom Offset Bottom"
17714 WacomOffsetBottom = 0xD33,
17715 /// Usage ID `0x1002`: "Wacom DataMode"
17716 WacomDataMode = 0x1002,
17717 /// Usage ID `0x1013`: "Wacom Digitizer Info"
17718 WacomDigitizerInfo = 0x1013,
17719 }
17720
17721 impl Wacom {
17722 #[cfg(feature = "std")]
17723 pub fn name(&self) -> String {
17724 match self {
17725 Wacom::WacomDigitizer => "Wacom Digitizer",
17726 Wacom::WacomPen => "Wacom Pen",
17727 Wacom::LightPen => "Light Pen",
17728 Wacom::TouchScreen => "Touch Screen",
17729 Wacom::TouchPad => "Touch Pad",
17730 Wacom::WhiteBoard => "White Board",
17731 Wacom::CoordinateMeasuringMachine => "Coordinate Measuring Machine",
17732 Wacom::ThreeDDigitizer => "3-D Digitizer",
17733 Wacom::StereoPlotter => "Stereo Plotter",
17734 Wacom::ArticulatedArm => "Articulated Arm",
17735 Wacom::Armature => "Armature",
17736 Wacom::MultiplePointDigitizer => "Multiple Point Digitizer",
17737 Wacom::FreeSpaceWand => "Free Space Wand",
17738 Wacom::DeviceConfiguration => "Device Configuration",
17739 Wacom::Stylus => "Stylus",
17740 Wacom::Puck => "Puck",
17741 Wacom::Finger => "Finger",
17742 Wacom::DeviceSettings => "Device Settings",
17743 Wacom::TipPressure => "Tip Pressure",
17744 Wacom::BarrelPressure => "Barrel Pressure",
17745 Wacom::InRange => "In Range",
17746 Wacom::Touch => "Touch",
17747 Wacom::Untouch => "Untouch",
17748 Wacom::Tap => "Tap",
17749 Wacom::WacomSense => "Wacom Sense",
17750 Wacom::DataValid => "Data Valid",
17751 Wacom::TransducerIndex => "Transducer Index",
17752 Wacom::WacomDigitizerFnKeys => "Wacom DigitizerFnKeys",
17753 Wacom::ProgramChangeKeys => "Program Change Keys",
17754 Wacom::BatteryStrength => "Battery Strength",
17755 Wacom::Invert => "Invert",
17756 Wacom::XTilt => "X Tilt",
17757 Wacom::YTilt => "Y Tilt",
17758 Wacom::Azimuth => "Azimuth",
17759 Wacom::Altitude => "Altitude",
17760 Wacom::Twist => "Twist",
17761 Wacom::TipSwitch => "Tip Switch",
17762 Wacom::SecondaryTipSwitch => "Secondary Tip Switch",
17763 Wacom::BarrelSwitch => "Barrel Switch",
17764 Wacom::Eraser => "Eraser",
17765 Wacom::TabletPick => "Tablet Pick",
17766 Wacom::Confidence => "Confidence",
17767 Wacom::Width => "Width",
17768 Wacom::Height => "Height",
17769 Wacom::ContactId => "Contact Id",
17770 Wacom::Inputmode => "Inputmode",
17771 Wacom::DeviceIndex => "Device Index",
17772 Wacom::ContactCount => "Contact Count",
17773 Wacom::ContactMax => "Contact Max",
17774 Wacom::ScanTime => "Scan Time",
17775 Wacom::SurfaceSwitch => "Surface Switch",
17776 Wacom::ButtonSwitch => "Button Switch",
17777 Wacom::ButtonType => "Button Type",
17778 Wacom::SecondaryBarrelSwitch => "Secondary Barrel Switch",
17779 Wacom::TransducerSerialNumber => "Transducer Serial Number",
17780 Wacom::WacomSerialHi => "Wacom SerialHi",
17781 Wacom::PreferredColorisLocked => "Preferred Color is Locked",
17782 Wacom::PreferredLineWidth => "Preferred Line Width",
17783 Wacom::PreferredLineWidthisLocked => "Preferred Line Width is Locked",
17784 Wacom::PreferredLineStyle => "Preferred Line Style",
17785 Wacom::PreferredLineStyleisLocked => "Preferred Line Style is Locked",
17786 Wacom::Ink => "Ink",
17787 Wacom::Pencil => "Pencil",
17788 Wacom::Highlighter => "Highlighter",
17789 Wacom::ChiselMarker => "Chisel Marker",
17790 Wacom::Brush => "Brush",
17791 Wacom::WacomToolType => "Wacom ToolType",
17792 Wacom::DigitizerDiagnostic => "Digitizer Diagnostic",
17793 Wacom::DigitizerError => "Digitizer Error",
17794 Wacom::ErrNormalStatus => "Err Normal Status",
17795 Wacom::ErrTransducersExceeded => "Err Transducers Exceeded",
17796 Wacom::ErrFullTransFeaturesUnavail => "Err Full Trans Features Unavail",
17797 Wacom::ErrChargeLow => "Err Charge Low",
17798 Wacom::X => "X",
17799 Wacom::Y => "Y",
17800 Wacom::WacomDistance => "Wacom Distance",
17801 Wacom::WacomTouchStrip => "Wacom TouchStrip",
17802 Wacom::WacomTouchStrip2 => "Wacom TouchStrip2",
17803 Wacom::WacomTouchRing => "Wacom TouchRing",
17804 Wacom::WacomTouchRingStatus => "Wacom TouchRingStatus",
17805 Wacom::WacomAccelerometerX => "Wacom Accelerometer X",
17806 Wacom::WacomAccelerometerY => "Wacom Accelerometer Y",
17807 Wacom::WacomAccelerometerZ => "Wacom Accelerometer Z",
17808 Wacom::WacomBatteryCharging => "Wacom Battery Charging",
17809 Wacom::WacomBatteryLevel => "Wacom Battery Level",
17810 Wacom::WacomTouchOnOff => "Wacom TouchOnOff",
17811 Wacom::WacomExpressKey00 => "Wacom ExpressKey00",
17812 Wacom::WacomExpressKeyCap00 => "Wacom ExpressKeyCap00",
17813 Wacom::WacomModeChange => "Wacom Mode Change",
17814 Wacom::WacomButtonDesktopCenter => "Wacom Button Desktop Center",
17815 Wacom::WacomButtonOnScreenKeyboard => "Wacom Button On Screen Keyboard",
17816 Wacom::WacomButtonDisplaySetting => "Wacom Button Display Setting",
17817 Wacom::WacomButtonTouchOnOff => "Wacom Button Touch On/Off",
17818 Wacom::WacomButtonHome => "Wacom Button Home",
17819 Wacom::WacomButtonUp => "Wacom Button Up",
17820 Wacom::WacomButtonDown => "Wacom Button Down",
17821 Wacom::WacomButtonLeft => "Wacom Button Left",
17822 Wacom::WacomButtonRight => "Wacom Button Right",
17823 Wacom::WacomButtonCenter => "Wacom Button Center",
17824 Wacom::WacomFingerWheel => "Wacom FingerWheel",
17825 Wacom::WacomOffsetLeft => "Wacom Offset Left",
17826 Wacom::WacomOffsetTop => "Wacom Offset Top",
17827 Wacom::WacomOffsetRight => "Wacom Offset Right",
17828 Wacom::WacomOffsetBottom => "Wacom Offset Bottom",
17829 Wacom::WacomDataMode => "Wacom DataMode",
17830 Wacom::WacomDigitizerInfo => "Wacom Digitizer Info",
17831 }
17832 .into()
17833 }
17834 }
17835
17836 #[cfg(feature = "std")]
17837 impl fmt::Display for Wacom {
17838 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
17839 write!(f, "{}", self.name())
17840 }
17841 }
17842
17843 impl AsUsage for Wacom {
17844 /// Returns the 32 bit Usage value of this Usage
17845 fn usage_value(&self) -> u32 {
17846 u32::from(self)
17847 }
17848
17849 /// Returns the 16 bit Usage ID value of this Usage
17850 fn usage_id_value(&self) -> u16 {
17851 u16::from(self)
17852 }
17853
17854 /// Returns this usage as [Usage::Wacom(self)](Usage::Wacom)
17855 /// This is a convenience function to avoid having
17856 /// to implement `From` for every used type in the caller.
17857 ///
17858 /// ```
17859 /// # use hut::*;
17860 /// let gd_x = GenericDesktop::X;
17861 /// let usage = Usage::from(GenericDesktop::X);
17862 /// assert!(matches!(gd_x.usage(), usage));
17863 /// ```
17864 fn usage(&self) -> Usage {
17865 Usage::from(self)
17866 }
17867 }
17868
17869 impl AsUsagePage for Wacom {
17870 /// Returns the 16 bit value of this UsagePage
17871 ///
17872 /// This value is `0xFF0D` for [Wacom]
17873 fn usage_page_value(&self) -> u16 {
17874 let up = UsagePage::from(self);
17875 u16::from(up)
17876 }
17877
17878 /// Returns [UsagePage::Wacom]]
17879 fn usage_page(&self) -> UsagePage {
17880 UsagePage::from(self)
17881 }
17882 }
17883
17884 impl From<&Wacom> for u16 {
17885 fn from(wacom: &Wacom) -> u16 {
17886 *wacom as u16
17887 }
17888 }
17889
17890 impl From<Wacom> for u16 {
17891 /// Returns the 16bit value of this usage. This is identical
17892 /// to [Wacom::usage_page_value()].
17893 fn from(wacom: Wacom) -> u16 {
17894 u16::from(&wacom)
17895 }
17896 }
17897
17898 impl From<&Wacom> for u32 {
17899 /// Returns the 32 bit value of this usage. This is identical
17900 /// to [Wacom::usage_value()].
17901 fn from(wacom: &Wacom) -> u32 {
17902 let up = UsagePage::from(wacom);
17903 let up = (u16::from(&up) as u32) << 16;
17904 let id = u16::from(wacom) as u32;
17905 up | id
17906 }
17907 }
17908
17909 impl From<&Wacom> for UsagePage {
17910 /// Always returns [UsagePage::Wacom] and is
17911 /// identical to [Wacom::usage_page()].
17912 fn from(_: &Wacom) -> UsagePage {
17913 UsagePage::Wacom
17914 }
17915 }
17916
17917 impl From<Wacom> for UsagePage {
17918 /// Always returns [UsagePage::Wacom] and is
17919 /// identical to [Wacom::usage_page()].
17920 fn from(_: Wacom) -> UsagePage {
17921 UsagePage::Wacom
17922 }
17923 }
17924
17925 impl From<&Wacom> for Usage {
17926 fn from(wacom: &Wacom) -> Usage {
17927 Usage::try_from(u32::from(wacom)).unwrap()
17928 }
17929 }
17930
17931 impl From<Wacom> for Usage {
17932 fn from(wacom: Wacom) -> Usage {
17933 Usage::from(&wacom)
17934 }
17935 }
17936
17937 impl TryFrom<u16> for Wacom {
17938 type Error = HutError;
17939
17940 fn try_from(usage_id: u16) -> Result<Wacom> {
17941 match usage_id {
17942 1 => Ok(Wacom::WacomDigitizer),
17943 2 => Ok(Wacom::WacomPen),
17944 3 => Ok(Wacom::LightPen),
17945 4 => Ok(Wacom::TouchScreen),
17946 5 => Ok(Wacom::TouchPad),
17947 6 => Ok(Wacom::WhiteBoard),
17948 7 => Ok(Wacom::CoordinateMeasuringMachine),
17949 8 => Ok(Wacom::ThreeDDigitizer),
17950 9 => Ok(Wacom::StereoPlotter),
17951 10 => Ok(Wacom::ArticulatedArm),
17952 11 => Ok(Wacom::Armature),
17953 12 => Ok(Wacom::MultiplePointDigitizer),
17954 13 => Ok(Wacom::FreeSpaceWand),
17955 14 => Ok(Wacom::DeviceConfiguration),
17956 32 => Ok(Wacom::Stylus),
17957 33 => Ok(Wacom::Puck),
17958 34 => Ok(Wacom::Finger),
17959 35 => Ok(Wacom::DeviceSettings),
17960 48 => Ok(Wacom::TipPressure),
17961 49 => Ok(Wacom::BarrelPressure),
17962 50 => Ok(Wacom::InRange),
17963 51 => Ok(Wacom::Touch),
17964 52 => Ok(Wacom::Untouch),
17965 53 => Ok(Wacom::Tap),
17966 54 => Ok(Wacom::WacomSense),
17967 55 => Ok(Wacom::DataValid),
17968 56 => Ok(Wacom::TransducerIndex),
17969 57 => Ok(Wacom::WacomDigitizerFnKeys),
17970 58 => Ok(Wacom::ProgramChangeKeys),
17971 59 => Ok(Wacom::BatteryStrength),
17972 60 => Ok(Wacom::Invert),
17973 61 => Ok(Wacom::XTilt),
17974 62 => Ok(Wacom::YTilt),
17975 63 => Ok(Wacom::Azimuth),
17976 64 => Ok(Wacom::Altitude),
17977 65 => Ok(Wacom::Twist),
17978 66 => Ok(Wacom::TipSwitch),
17979 67 => Ok(Wacom::SecondaryTipSwitch),
17980 68 => Ok(Wacom::BarrelSwitch),
17981 69 => Ok(Wacom::Eraser),
17982 70 => Ok(Wacom::TabletPick),
17983 71 => Ok(Wacom::Confidence),
17984 72 => Ok(Wacom::Width),
17985 73 => Ok(Wacom::Height),
17986 81 => Ok(Wacom::ContactId),
17987 82 => Ok(Wacom::Inputmode),
17988 83 => Ok(Wacom::DeviceIndex),
17989 84 => Ok(Wacom::ContactCount),
17990 85 => Ok(Wacom::ContactMax),
17991 86 => Ok(Wacom::ScanTime),
17992 87 => Ok(Wacom::SurfaceSwitch),
17993 88 => Ok(Wacom::ButtonSwitch),
17994 89 => Ok(Wacom::ButtonType),
17995 90 => Ok(Wacom::SecondaryBarrelSwitch),
17996 91 => Ok(Wacom::TransducerSerialNumber),
17997 92 => Ok(Wacom::WacomSerialHi),
17998 93 => Ok(Wacom::PreferredColorisLocked),
17999 94 => Ok(Wacom::PreferredLineWidth),
18000 95 => Ok(Wacom::PreferredLineWidthisLocked),
18001 112 => Ok(Wacom::PreferredLineStyle),
18002 113 => Ok(Wacom::PreferredLineStyleisLocked),
18003 114 => Ok(Wacom::Ink),
18004 115 => Ok(Wacom::Pencil),
18005 116 => Ok(Wacom::Highlighter),
18006 117 => Ok(Wacom::ChiselMarker),
18007 118 => Ok(Wacom::Brush),
18008 119 => Ok(Wacom::WacomToolType),
18009 128 => Ok(Wacom::DigitizerDiagnostic),
18010 129 => Ok(Wacom::DigitizerError),
18011 130 => Ok(Wacom::ErrNormalStatus),
18012 131 => Ok(Wacom::ErrTransducersExceeded),
18013 132 => Ok(Wacom::ErrFullTransFeaturesUnavail),
18014 133 => Ok(Wacom::ErrChargeLow),
18015 304 => Ok(Wacom::X),
18016 305 => Ok(Wacom::Y),
18017 306 => Ok(Wacom::WacomDistance),
18018 310 => Ok(Wacom::WacomTouchStrip),
18019 311 => Ok(Wacom::WacomTouchStrip2),
18020 312 => Ok(Wacom::WacomTouchRing),
18021 313 => Ok(Wacom::WacomTouchRingStatus),
18022 1025 => Ok(Wacom::WacomAccelerometerX),
18023 1026 => Ok(Wacom::WacomAccelerometerY),
18024 1027 => Ok(Wacom::WacomAccelerometerZ),
18025 1028 => Ok(Wacom::WacomBatteryCharging),
18026 1083 => Ok(Wacom::WacomBatteryLevel),
18027 1108 => Ok(Wacom::WacomTouchOnOff),
18028 2320 => Ok(Wacom::WacomExpressKey00),
18029 2384 => Ok(Wacom::WacomExpressKeyCap00),
18030 2432 => Ok(Wacom::WacomModeChange),
18031 2433 => Ok(Wacom::WacomButtonDesktopCenter),
18032 2434 => Ok(Wacom::WacomButtonOnScreenKeyboard),
18033 2435 => Ok(Wacom::WacomButtonDisplaySetting),
18034 2438 => Ok(Wacom::WacomButtonTouchOnOff),
18035 2448 => Ok(Wacom::WacomButtonHome),
18036 2449 => Ok(Wacom::WacomButtonUp),
18037 2450 => Ok(Wacom::WacomButtonDown),
18038 2451 => Ok(Wacom::WacomButtonLeft),
18039 2452 => Ok(Wacom::WacomButtonRight),
18040 2453 => Ok(Wacom::WacomButtonCenter),
18041 3331 => Ok(Wacom::WacomFingerWheel),
18042 3376 => Ok(Wacom::WacomOffsetLeft),
18043 3377 => Ok(Wacom::WacomOffsetTop),
18044 3378 => Ok(Wacom::WacomOffsetRight),
18045 3379 => Ok(Wacom::WacomOffsetBottom),
18046 4098 => Ok(Wacom::WacomDataMode),
18047 4115 => Ok(Wacom::WacomDigitizerInfo),
18048 n => Err(HutError::UnknownUsageId { usage_id: n }),
18049 }
18050 }
18051 }
18052
18053 impl BitOr<u16> for Wacom {
18054 type Output = Usage;
18055
18056 /// A convenience function to combine a Usage Page with
18057 /// a value.
18058 ///
18059 /// This function panics if the Usage ID value results in
18060 /// an unknown Usage. Where error checking is required,
18061 /// use [UsagePage::to_usage_from_value].
18062 fn bitor(self, usage: u16) -> Usage {
18063 let up = u16::from(self) as u32;
18064 let u = usage as u32;
18065 Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
18066 }
18067 }
18068
18069 /// *Reserved Usage Pages*
18070 ///
18071 /// This Usage Page has no named Usage IDs, any Usages in this Usage Page are
18072 /// reserved implementation. In a future version of the HUT standard a reserved
18073 /// Usage Page may become a defined Usage Page.
18074 #[allow(non_camel_case_types)]
18075 #[derive(Debug)]
18076 #[non_exhaustive]
18077 pub enum ReservedUsagePage {
18078 Undefined,
18079 ReservedUsage { usage_id: u16 },
18080 }
18081
18082 impl ReservedUsagePage {
18083 #[cfg(feature = "std")]
18084 fn name(&self) -> String {
18085 match self {
18086 ReservedUsagePage::Undefined => "Reserved Usage Undefined".to_string(),
18087 ReservedUsagePage::ReservedUsage { usage_id } => {
18088 format!("Reserved Usage 0x{usage_id:02x}")
18089 }
18090 }
18091 }
18092 }
18093
18094 #[cfg(feature = "std")]
18095 impl fmt::Display for ReservedUsagePage {
18096 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18097 write!(f, "{}", self.name())
18098 }
18099 }
18100
18101 impl From<&ReservedUsagePage> for u16 {
18102 fn from(v: &ReservedUsagePage) -> u16 {
18103 match v {
18104 ReservedUsagePage::Undefined => 0x00,
18105 ReservedUsagePage::ReservedUsage { usage_id } => *usage_id,
18106 }
18107 }
18108 }
18109
18110 /// *Usage Page `0xFF00` to `0xFFFF`: The Vendor Defined Pages*
18111 ///
18112 /// This Usage Page has no named Usage IDs, any Usages in this Usage Page are
18113 /// private to a vendor implementation.
18114 #[allow(non_camel_case_types)]
18115 #[derive(Debug)]
18116 #[non_exhaustive]
18117 pub enum VendorDefinedPage {
18118 Undefined,
18119 VendorUsage { usage_id: u16 },
18120 }
18121
18122 impl VendorDefinedPage {
18123 #[cfg(feature = "std")]
18124 fn name(&self) -> String {
18125 match self {
18126 VendorDefinedPage::Undefined => "Vendor Usage Undefined".to_string(),
18127 VendorDefinedPage::VendorUsage { usage_id } => {
18128 format!("Vendor Usage 0x{usage_id:02x}")
18129 }
18130 }
18131 }
18132 }
18133
18134 #[cfg(feature = "std")]
18135 impl fmt::Display for VendorDefinedPage {
18136 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18137 write!(f, "{}", self.name())
18138 }
18139 }
18140
18141 impl From<&VendorDefinedPage> for u16 {
18142 fn from(v: &VendorDefinedPage) -> u16 {
18143 match v {
18144 VendorDefinedPage::Undefined => 0x00,
18145 VendorDefinedPage::VendorUsage { usage_id } => *usage_id,
18146 }
18147 }
18148 }
18149
18150 impl From<&Usage> for UsagePage {
18151 #[allow(clippy::unneeded_struct_pattern)]
18152 fn from(usage: &Usage) -> UsagePage {
18153 match usage {
18154 Usage::GenericDesktop { .. } => UsagePage::GenericDesktop,
18155 Usage::SimulationControls { .. } => UsagePage::SimulationControls,
18156 Usage::VRControls { .. } => UsagePage::VRControls,
18157 Usage::SportControls { .. } => UsagePage::SportControls,
18158 Usage::GameControls { .. } => UsagePage::GameControls,
18159 Usage::GenericDeviceControls { .. } => UsagePage::GenericDeviceControls,
18160 Usage::KeyboardKeypad { .. } => UsagePage::KeyboardKeypad,
18161 Usage::LED { .. } => UsagePage::LED,
18162 Usage::Button { .. } => UsagePage::Button,
18163 Usage::Ordinal { .. } => UsagePage::Ordinal,
18164 Usage::TelephonyDevice { .. } => UsagePage::TelephonyDevice,
18165 Usage::Consumer { .. } => UsagePage::Consumer,
18166 Usage::Digitizers { .. } => UsagePage::Digitizers,
18167 Usage::Haptics { .. } => UsagePage::Haptics,
18168 Usage::PhysicalInputDevice { .. } => UsagePage::PhysicalInputDevice,
18169 Usage::Unicode { .. } => UsagePage::Unicode,
18170 Usage::SoC { .. } => UsagePage::SoC,
18171 Usage::EyeandHeadTrackers { .. } => UsagePage::EyeandHeadTrackers,
18172 Usage::AuxiliaryDisplay { .. } => UsagePage::AuxiliaryDisplay,
18173 Usage::Sensors { .. } => UsagePage::Sensors,
18174 Usage::MedicalInstrument { .. } => UsagePage::MedicalInstrument,
18175 Usage::BrailleDisplay { .. } => UsagePage::BrailleDisplay,
18176 Usage::LightingAndIllumination { .. } => UsagePage::LightingAndIllumination,
18177 Usage::Monitor { .. } => UsagePage::Monitor,
18178 Usage::MonitorEnumerated { .. } => UsagePage::MonitorEnumerated,
18179 Usage::VESAVirtualControls { .. } => UsagePage::VESAVirtualControls,
18180 Usage::Power { .. } => UsagePage::Power,
18181 Usage::BatterySystem { .. } => UsagePage::BatterySystem,
18182 Usage::BarcodeScanner { .. } => UsagePage::BarcodeScanner,
18183 Usage::Scales { .. } => UsagePage::Scales,
18184 Usage::MagneticStripeReader { .. } => UsagePage::MagneticStripeReader,
18185 Usage::CameraControl { .. } => UsagePage::CameraControl,
18186 Usage::Arcade { .. } => UsagePage::Arcade,
18187 Usage::FIDOAlliance { .. } => UsagePage::FIDOAlliance,
18188 Usage::Wacom { .. } => UsagePage::Wacom,
18189 Usage::ReservedUsagePage { reserved_page, .. } => {
18190 UsagePage::ReservedUsagePage(*reserved_page)
18191 }
18192 Usage::VendorDefinedPage { vendor_page, .. } => {
18193 UsagePage::VendorDefinedPage(*vendor_page)
18194 }
18195 }
18196 }
18197 }
18198
18199 impl From<&UsagePage> for u16 {
18200 /// Returns the UsagePage as 16-bit value. This is equivalent to the
18201 /// upper 16 bits of a full 32-bit Usage value shifted down.
18202 #[allow(clippy::unneeded_struct_pattern)]
18203 fn from(usage_page: &UsagePage) -> u16 {
18204 match usage_page {
18205 UsagePage::GenericDesktop { .. } => 1,
18206 UsagePage::SimulationControls { .. } => 2,
18207 UsagePage::VRControls { .. } => 3,
18208 UsagePage::SportControls { .. } => 4,
18209 UsagePage::GameControls { .. } => 5,
18210 UsagePage::GenericDeviceControls { .. } => 6,
18211 UsagePage::KeyboardKeypad { .. } => 7,
18212 UsagePage::LED { .. } => 8,
18213 UsagePage::Button { .. } => 9,
18214 UsagePage::Ordinal { .. } => 10,
18215 UsagePage::TelephonyDevice { .. } => 11,
18216 UsagePage::Consumer { .. } => 12,
18217 UsagePage::Digitizers { .. } => 13,
18218 UsagePage::Haptics { .. } => 14,
18219 UsagePage::PhysicalInputDevice { .. } => 15,
18220 UsagePage::Unicode { .. } => 16,
18221 UsagePage::SoC { .. } => 17,
18222 UsagePage::EyeandHeadTrackers { .. } => 18,
18223 UsagePage::AuxiliaryDisplay { .. } => 20,
18224 UsagePage::Sensors { .. } => 32,
18225 UsagePage::MedicalInstrument { .. } => 64,
18226 UsagePage::BrailleDisplay { .. } => 65,
18227 UsagePage::LightingAndIllumination { .. } => 89,
18228 UsagePage::Monitor { .. } => 128,
18229 UsagePage::MonitorEnumerated { .. } => 129,
18230 UsagePage::VESAVirtualControls { .. } => 130,
18231 UsagePage::Power { .. } => 132,
18232 UsagePage::BatterySystem { .. } => 133,
18233 UsagePage::BarcodeScanner { .. } => 140,
18234 UsagePage::Scales { .. } => 141,
18235 UsagePage::MagneticStripeReader { .. } => 142,
18236 UsagePage::CameraControl { .. } => 144,
18237 UsagePage::Arcade { .. } => 145,
18238 UsagePage::FIDOAlliance { .. } => 61904,
18239 UsagePage::Wacom { .. } => 65293,
18240 UsagePage::ReservedUsagePage(reserved_page) => u16::from(reserved_page),
18241 UsagePage::VendorDefinedPage(vendor_page) => u16::from(vendor_page),
18242 }
18243 }
18244 }
18245
18246 impl From<UsagePage> for u16 {
18247 fn from(usage_page: UsagePage) -> u16 {
18248 u16::from(&usage_page)
18249 }
18250 }
18251
18252 impl TryFrom<u16> for UsagePage {
18253 type Error = HutError;
18254
18255 fn try_from(usage_page: u16) -> Result<UsagePage> {
18256 match usage_page {
18257 1 => Ok(UsagePage::GenericDesktop),
18258 2 => Ok(UsagePage::SimulationControls),
18259 3 => Ok(UsagePage::VRControls),
18260 4 => Ok(UsagePage::SportControls),
18261 5 => Ok(UsagePage::GameControls),
18262 6 => Ok(UsagePage::GenericDeviceControls),
18263 7 => Ok(UsagePage::KeyboardKeypad),
18264 8 => Ok(UsagePage::LED),
18265 9 => Ok(UsagePage::Button),
18266 10 => Ok(UsagePage::Ordinal),
18267 11 => Ok(UsagePage::TelephonyDevice),
18268 12 => Ok(UsagePage::Consumer),
18269 13 => Ok(UsagePage::Digitizers),
18270 14 => Ok(UsagePage::Haptics),
18271 15 => Ok(UsagePage::PhysicalInputDevice),
18272 16 => Ok(UsagePage::Unicode),
18273 17 => Ok(UsagePage::SoC),
18274 18 => Ok(UsagePage::EyeandHeadTrackers),
18275 20 => Ok(UsagePage::AuxiliaryDisplay),
18276 32 => Ok(UsagePage::Sensors),
18277 64 => Ok(UsagePage::MedicalInstrument),
18278 65 => Ok(UsagePage::BrailleDisplay),
18279 89 => Ok(UsagePage::LightingAndIllumination),
18280 128 => Ok(UsagePage::Monitor),
18281 129 => Ok(UsagePage::MonitorEnumerated),
18282 130 => Ok(UsagePage::VESAVirtualControls),
18283 132 => Ok(UsagePage::Power),
18284 133 => Ok(UsagePage::BatterySystem),
18285 140 => Ok(UsagePage::BarcodeScanner),
18286 141 => Ok(UsagePage::Scales),
18287 142 => Ok(UsagePage::MagneticStripeReader),
18288 144 => Ok(UsagePage::CameraControl),
18289 145 => Ok(UsagePage::Arcade),
18290 61904 => Ok(UsagePage::FIDOAlliance),
18291 65293 => Ok(UsagePage::Wacom),
18292 page @ 0xff00..=0xffff => Ok(UsagePage::VendorDefinedPage(VendorPage(page))),
18293 n => match ReservedPage::try_from(n) {
18294 Ok(r) => Ok(UsagePage::ReservedUsagePage(r)),
18295 Err(_) => Err(HutError::UnknownUsagePage { usage_page: n }),
18296 },
18297 }
18298 }
18299 }
18300
18301 impl TryFrom<u32> for UsagePage {
18302 type Error = HutError;
18303
18304 fn try_from(usage_page: u32) -> Result<UsagePage> {
18305 UsagePage::try_from((usage_page >> 16) as u16)
18306 }
18307 }
18308
18309 #[cfg(feature = "std")]
18310 impl fmt::Display for UsagePage {
18311 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18312 write!(f, "{}", self.name())
18313 }
18314 }
18315
18316 /// An enum wrapping all known Usages in the HUT.
18317 /// ```
18318 /// # use hut::*;
18319 /// let u1 = Usage::GenericDesktop(GenericDesktop::Mouse);
18320 /// let u2 = Usage::new_from_page_and_id(0x01, 0x02).unwrap();
18321 /// let u3 = Usage::from(GenericDesktop::Mouse);
18322 /// assert_eq!(u1, u2);
18323 /// assert_eq!(u1, u3);
18324 ///
18325 /// assert_eq!(0x1, u1.usage_page_value());
18326 /// assert_eq!(0x2, u1.usage_id_value());
18327 /// assert_eq!((0x1 << 16) | 0x2, u1.usage_value());
18328 /// ```
18329 /// Note: this enum is generated from the HUT documents.
18330 #[allow(non_camel_case_types)]
18331 #[derive(Debug)]
18332 #[non_exhaustive]
18333 pub enum Usage {
18334 /// "Generic Desktop"
18335 GenericDesktop(GenericDesktop),
18336 /// "Simulation Controls"
18337 SimulationControls(SimulationControls),
18338 /// "VR Controls"
18339 VRControls(VRControls),
18340 /// "Sport Controls"
18341 SportControls(SportControls),
18342 /// "Game Controls"
18343 GameControls(GameControls),
18344 /// "Generic Device Controls"
18345 GenericDeviceControls(GenericDeviceControls),
18346 /// "Keyboard/Keypad"
18347 KeyboardKeypad(KeyboardKeypad),
18348 /// "LED"
18349 LED(LED),
18350 /// "Button"
18351 Button(Button),
18352 /// "Ordinal"
18353 Ordinal(Ordinal),
18354 /// "Telephony Device"
18355 TelephonyDevice(TelephonyDevice),
18356 /// "Consumer"
18357 Consumer(Consumer),
18358 /// "Digitizers"
18359 Digitizers(Digitizers),
18360 /// "Haptics"
18361 Haptics(Haptics),
18362 /// "Physical Input Device"
18363 PhysicalInputDevice(PhysicalInputDevice),
18364 /// "Unicode"
18365 Unicode(Unicode),
18366 /// "SoC"
18367 SoC(SoC),
18368 /// "Eye and Head Trackers"
18369 EyeandHeadTrackers(EyeandHeadTrackers),
18370 /// "Auxiliary Display"
18371 AuxiliaryDisplay(AuxiliaryDisplay),
18372 /// "Sensors"
18373 Sensors(Sensors),
18374 /// "Medical Instrument"
18375 MedicalInstrument(MedicalInstrument),
18376 /// "Braille Display"
18377 BrailleDisplay(BrailleDisplay),
18378 /// "Lighting And Illumination"
18379 LightingAndIllumination(LightingAndIllumination),
18380 /// "Monitor"
18381 Monitor(Monitor),
18382 /// "Monitor Enumerated"
18383 MonitorEnumerated(MonitorEnumerated),
18384 /// "VESA Virtual Controls"
18385 VESAVirtualControls(VESAVirtualControls),
18386 /// "Power"
18387 Power(Power),
18388 /// "Battery System"
18389 BatterySystem(BatterySystem),
18390 /// "Barcode Scanner"
18391 BarcodeScanner(BarcodeScanner),
18392 /// "Scales"
18393 Scales(Scales),
18394 /// "Magnetic Stripe Reader"
18395 MagneticStripeReader(MagneticStripeReader),
18396 /// "Camera Control"
18397 CameraControl(CameraControl),
18398 /// "Arcade"
18399 Arcade(Arcade),
18400 /// "FIDO Alliance"
18401 FIDOAlliance(FIDOAlliance),
18402 /// "Wacom"
18403 Wacom(Wacom),
18404 ReservedUsagePage {
18405 reserved_page: ReservedPage,
18406 usage: ReservedUsagePage,
18407 },
18408 VendorDefinedPage {
18409 vendor_page: VendorPage,
18410 usage: VendorDefinedPage,
18411 },
18412 }
18413
18414 impl Usage {
18415 #[cfg(feature = "std")]
18416 pub fn new_from_page_and_id(usage_page: u16, usage_id: u16) -> Result<Usage> {
18417 Usage::try_from(((usage_page as u32) << 16) | usage_id as u32)
18418 }
18419
18420 #[cfg(feature = "std")]
18421 pub fn name(&self) -> String {
18422 match self {
18423 Usage::GenericDesktop(usage) => usage.name(),
18424 Usage::SimulationControls(usage) => usage.name(),
18425 Usage::VRControls(usage) => usage.name(),
18426 Usage::SportControls(usage) => usage.name(),
18427 Usage::GameControls(usage) => usage.name(),
18428 Usage::GenericDeviceControls(usage) => usage.name(),
18429 Usage::KeyboardKeypad(usage) => usage.name(),
18430 Usage::LED(usage) => usage.name(),
18431 Usage::Button(usage) => usage.name(),
18432 Usage::Ordinal(usage) => usage.name(),
18433 Usage::TelephonyDevice(usage) => usage.name(),
18434 Usage::Consumer(usage) => usage.name(),
18435 Usage::Digitizers(usage) => usage.name(),
18436 Usage::Haptics(usage) => usage.name(),
18437 Usage::PhysicalInputDevice(usage) => usage.name(),
18438 Usage::Unicode(usage) => usage.name(),
18439 Usage::SoC(usage) => usage.name(),
18440 Usage::EyeandHeadTrackers(usage) => usage.name(),
18441 Usage::AuxiliaryDisplay(usage) => usage.name(),
18442 Usage::Sensors(usage) => usage.name(),
18443 Usage::MedicalInstrument(usage) => usage.name(),
18444 Usage::BrailleDisplay(usage) => usage.name(),
18445 Usage::LightingAndIllumination(usage) => usage.name(),
18446 Usage::Monitor(usage) => usage.name(),
18447 Usage::MonitorEnumerated(usage) => usage.name(),
18448 Usage::VESAVirtualControls(usage) => usage.name(),
18449 Usage::Power(usage) => usage.name(),
18450 Usage::BatterySystem(usage) => usage.name(),
18451 Usage::BarcodeScanner(usage) => usage.name(),
18452 Usage::Scales(usage) => usage.name(),
18453 Usage::MagneticStripeReader(usage) => usage.name(),
18454 Usage::CameraControl(usage) => usage.name(),
18455 Usage::Arcade(usage) => usage.name(),
18456 Usage::FIDOAlliance(usage) => usage.name(),
18457 Usage::Wacom(usage) => usage.name(),
18458 Usage::ReservedUsagePage { usage, .. } => usage.name(),
18459 Usage::VendorDefinedPage { usage, .. } => usage.name(),
18460 }
18461 }
18462 }
18463
18464 impl AsUsage for Usage {
18465 /// Returns the 32 bit Usage value for this usage.
18466 fn usage_value(&self) -> u32 {
18467 self.into()
18468 }
18469
18470 /// Returns the 16-bit Usage ID value for this usage.
18471 fn usage_id_value(&self) -> u16 {
18472 self.into()
18473 }
18474
18475 /// Returns [Self]
18476 fn usage(&self) -> Usage {
18477 Usage::try_from(self.usage_value()).unwrap()
18478 }
18479 }
18480
18481 impl PartialEq for Usage {
18482 fn eq(&self, other: &Self) -> bool {
18483 u32::from(self) == u32::from(other)
18484 }
18485 }
18486
18487 impl AsUsagePage for Usage {
18488 fn usage_page_value(&self) -> u16 {
18489 UsagePage::from(self).into()
18490 }
18491
18492 fn usage_page(&self) -> UsagePage {
18493 match self {
18494 Usage::GenericDesktop(_) => UsagePage::GenericDesktop,
18495 Usage::SimulationControls(_) => UsagePage::SimulationControls,
18496 Usage::VRControls(_) => UsagePage::VRControls,
18497 Usage::SportControls(_) => UsagePage::SportControls,
18498 Usage::GameControls(_) => UsagePage::GameControls,
18499 Usage::GenericDeviceControls(_) => UsagePage::GenericDeviceControls,
18500 Usage::KeyboardKeypad(_) => UsagePage::KeyboardKeypad,
18501 Usage::LED(_) => UsagePage::LED,
18502 Usage::Button(_) => UsagePage::Button,
18503 Usage::Ordinal(_) => UsagePage::Ordinal,
18504 Usage::TelephonyDevice(_) => UsagePage::TelephonyDevice,
18505 Usage::Consumer(_) => UsagePage::Consumer,
18506 Usage::Digitizers(_) => UsagePage::Digitizers,
18507 Usage::Haptics(_) => UsagePage::Haptics,
18508 Usage::PhysicalInputDevice(_) => UsagePage::PhysicalInputDevice,
18509 Usage::Unicode(_) => UsagePage::Unicode,
18510 Usage::SoC(_) => UsagePage::SoC,
18511 Usage::EyeandHeadTrackers(_) => UsagePage::EyeandHeadTrackers,
18512 Usage::AuxiliaryDisplay(_) => UsagePage::AuxiliaryDisplay,
18513 Usage::Sensors(_) => UsagePage::Sensors,
18514 Usage::MedicalInstrument(_) => UsagePage::MedicalInstrument,
18515 Usage::BrailleDisplay(_) => UsagePage::BrailleDisplay,
18516 Usage::LightingAndIllumination(_) => UsagePage::LightingAndIllumination,
18517 Usage::Monitor(_) => UsagePage::Monitor,
18518 Usage::MonitorEnumerated(_) => UsagePage::MonitorEnumerated,
18519 Usage::VESAVirtualControls(_) => UsagePage::VESAVirtualControls,
18520 Usage::Power(_) => UsagePage::Power,
18521 Usage::BatterySystem(_) => UsagePage::BatterySystem,
18522 Usage::BarcodeScanner(_) => UsagePage::BarcodeScanner,
18523 Usage::Scales(_) => UsagePage::Scales,
18524 Usage::MagneticStripeReader(_) => UsagePage::MagneticStripeReader,
18525 Usage::CameraControl(_) => UsagePage::CameraControl,
18526 Usage::Arcade(_) => UsagePage::Arcade,
18527 Usage::FIDOAlliance(_) => UsagePage::FIDOAlliance,
18528 Usage::Wacom(_) => UsagePage::Wacom,
18529 Usage::ReservedUsagePage { reserved_page, .. } => {
18530 UsagePage::ReservedUsagePage(*reserved_page)
18531 }
18532 Usage::VendorDefinedPage { vendor_page, .. } => {
18533 UsagePage::VendorDefinedPage(*vendor_page)
18534 }
18535 }
18536 }
18537 }
18538
18539 #[cfg(feature = "std")]
18540 impl fmt::Display for Usage {
18541 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18542 write!(f, "{}", self.name())
18543 }
18544 }
18545
18546 impl From<&Usage> for u16 {
18547 fn from(usage: &Usage) -> u16 {
18548 let u: u32 = u32::from(usage);
18549 (u & 0xFFFF) as u16
18550 }
18551 }
18552
18553 impl From<Usage> for u16 {
18554 fn from(usage: Usage) -> u16 {
18555 u16::from(&usage)
18556 }
18557 }
18558
18559 impl From<&Usage> for u32 {
18560 fn from(usage: &Usage) -> u32 {
18561 match usage {
18562 Usage::GenericDesktop(usage) => (1 << 16) | u16::from(usage) as u32,
18563 Usage::SimulationControls(usage) => (2 << 16) | u16::from(usage) as u32,
18564 Usage::VRControls(usage) => (3 << 16) | u16::from(usage) as u32,
18565 Usage::SportControls(usage) => (4 << 16) | u16::from(usage) as u32,
18566 Usage::GameControls(usage) => (5 << 16) | u16::from(usage) as u32,
18567 Usage::GenericDeviceControls(usage) => (6 << 16) | u16::from(usage) as u32,
18568 Usage::KeyboardKeypad(usage) => (7 << 16) | u16::from(usage) as u32,
18569 Usage::LED(usage) => (8 << 16) | u16::from(usage) as u32,
18570 Usage::Button(usage) => (9 << 16) | u16::from(usage) as u32,
18571 Usage::Ordinal(usage) => (10 << 16) | u16::from(usage) as u32,
18572 Usage::TelephonyDevice(usage) => (11 << 16) | u16::from(usage) as u32,
18573 Usage::Consumer(usage) => (12 << 16) | u16::from(usage) as u32,
18574 Usage::Digitizers(usage) => (13 << 16) | u16::from(usage) as u32,
18575 Usage::Haptics(usage) => (14 << 16) | u16::from(usage) as u32,
18576 Usage::PhysicalInputDevice(usage) => (15 << 16) | u16::from(usage) as u32,
18577 Usage::Unicode(usage) => (16 << 16) | u16::from(usage) as u32,
18578 Usage::SoC(usage) => (17 << 16) | u16::from(usage) as u32,
18579 Usage::EyeandHeadTrackers(usage) => (18 << 16) | u16::from(usage) as u32,
18580 Usage::AuxiliaryDisplay(usage) => (20 << 16) | u16::from(usage) as u32,
18581 Usage::Sensors(usage) => (32 << 16) | u16::from(usage) as u32,
18582 Usage::MedicalInstrument(usage) => (64 << 16) | u16::from(usage) as u32,
18583 Usage::BrailleDisplay(usage) => (65 << 16) | u16::from(usage) as u32,
18584 Usage::LightingAndIllumination(usage) => (89 << 16) | u16::from(usage) as u32,
18585 Usage::Monitor(usage) => (128 << 16) | u16::from(usage) as u32,
18586 Usage::MonitorEnumerated(usage) => (129 << 16) | u16::from(usage) as u32,
18587 Usage::VESAVirtualControls(usage) => (130 << 16) | u16::from(usage) as u32,
18588 Usage::Power(usage) => (132 << 16) | u16::from(usage) as u32,
18589 Usage::BatterySystem(usage) => (133 << 16) | u16::from(usage) as u32,
18590 Usage::BarcodeScanner(usage) => (140 << 16) | u16::from(usage) as u32,
18591 Usage::Scales(usage) => (141 << 16) | u16::from(usage) as u32,
18592 Usage::MagneticStripeReader(usage) => (142 << 16) | u16::from(usage) as u32,
18593 Usage::CameraControl(usage) => (144 << 16) | u16::from(usage) as u32,
18594 Usage::Arcade(usage) => (145 << 16) | u16::from(usage) as u32,
18595 Usage::FIDOAlliance(usage) => (61904 << 16) | u16::from(usage) as u32,
18596 Usage::Wacom(usage) => (65293 << 16) | u16::from(usage) as u32,
18597 Usage::ReservedUsagePage {
18598 reserved_page,
18599 usage,
18600 } => ((u16::from(reserved_page) as u32) << 16) | u16::from(usage) as u32,
18601 Usage::VendorDefinedPage { vendor_page, usage } => {
18602 ((u16::from(vendor_page) as u32) << 16) | u16::from(usage) as u32
18603 }
18604 }
18605 }
18606 }
18607
18608 impl TryFrom<u32> for Usage {
18609 type Error = HutError;
18610
18611 fn try_from(up: u32) -> Result<Usage> {
18612 match (up >> 16, up & 0xFFFF) {
18613 (1, n) => Ok(Usage::GenericDesktop(GenericDesktop::try_from(n as u16)?)),
18614 (2, n) => Ok(Usage::SimulationControls(SimulationControls::try_from(
18615 n as u16,
18616 )?)),
18617 (3, n) => Ok(Usage::VRControls(VRControls::try_from(n as u16)?)),
18618 (4, n) => Ok(Usage::SportControls(SportControls::try_from(n as u16)?)),
18619 (5, n) => Ok(Usage::GameControls(GameControls::try_from(n as u16)?)),
18620 (6, n) => Ok(Usage::GenericDeviceControls(
18621 GenericDeviceControls::try_from(n as u16)?,
18622 )),
18623 (7, n) => Ok(Usage::KeyboardKeypad(KeyboardKeypad::try_from(n as u16)?)),
18624 (8, n) => Ok(Usage::LED(LED::try_from(n as u16)?)),
18625 (9, n) => Ok(Usage::Button(Button::try_from(n as u16)?)),
18626 (10, n) => Ok(Usage::Ordinal(Ordinal::try_from(n as u16)?)),
18627 (11, n) => Ok(Usage::TelephonyDevice(TelephonyDevice::try_from(n as u16)?)),
18628 (12, n) => Ok(Usage::Consumer(Consumer::try_from(n as u16)?)),
18629 (13, n) => Ok(Usage::Digitizers(Digitizers::try_from(n as u16)?)),
18630 (14, n) => Ok(Usage::Haptics(Haptics::try_from(n as u16)?)),
18631 (15, n) => Ok(Usage::PhysicalInputDevice(PhysicalInputDevice::try_from(
18632 n as u16,
18633 )?)),
18634 (16, n) => Ok(Usage::Unicode(Unicode::try_from(n as u16)?)),
18635 (17, n) => Ok(Usage::SoC(SoC::try_from(n as u16)?)),
18636 (18, n) => Ok(Usage::EyeandHeadTrackers(EyeandHeadTrackers::try_from(
18637 n as u16,
18638 )?)),
18639 (20, n) => Ok(Usage::AuxiliaryDisplay(AuxiliaryDisplay::try_from(
18640 n as u16,
18641 )?)),
18642 (32, n) => Ok(Usage::Sensors(Sensors::try_from(n as u16)?)),
18643 (64, n) => Ok(Usage::MedicalInstrument(MedicalInstrument::try_from(
18644 n as u16,
18645 )?)),
18646 (65, n) => Ok(Usage::BrailleDisplay(BrailleDisplay::try_from(n as u16)?)),
18647 (89, n) => Ok(Usage::LightingAndIllumination(
18648 LightingAndIllumination::try_from(n as u16)?,
18649 )),
18650 (128, n) => Ok(Usage::Monitor(Monitor::try_from(n as u16)?)),
18651 (129, n) => Ok(Usage::MonitorEnumerated(MonitorEnumerated::try_from(
18652 n as u16,
18653 )?)),
18654 (130, n) => Ok(Usage::VESAVirtualControls(VESAVirtualControls::try_from(
18655 n as u16,
18656 )?)),
18657 (132, n) => Ok(Usage::Power(Power::try_from(n as u16)?)),
18658 (133, n) => Ok(Usage::BatterySystem(BatterySystem::try_from(n as u16)?)),
18659 (140, n) => Ok(Usage::BarcodeScanner(BarcodeScanner::try_from(n as u16)?)),
18660 (141, n) => Ok(Usage::Scales(Scales::try_from(n as u16)?)),
18661 (142, n) => Ok(Usage::MagneticStripeReader(MagneticStripeReader::try_from(
18662 n as u16,
18663 )?)),
18664 (144, n) => Ok(Usage::CameraControl(CameraControl::try_from(n as u16)?)),
18665 (145, n) => Ok(Usage::Arcade(Arcade::try_from(n as u16)?)),
18666 (61904, n) => Ok(Usage::FIDOAlliance(FIDOAlliance::try_from(n as u16)?)),
18667 (65293, n) => Ok(Usage::Wacom(Wacom::try_from(n as u16)?)),
18668 (p @ 0xff00..=0xffff, n) => Ok(Usage::VendorDefinedPage {
18669 vendor_page: VendorPage(p as u16),
18670 usage: VendorDefinedPage::VendorUsage { usage_id: n as u16 },
18671 }),
18672 (p, n) => match ReservedPage::try_from(p as u16) {
18673 Ok(r) => Ok(Usage::ReservedUsagePage {
18674 reserved_page: r,
18675 usage: ReservedUsagePage::ReservedUsage { usage_id: n as u16 },
18676 }),
18677 _ => Err(HutError::UnknownUsage),
18678 },
18679 }
18680 }
18681 }
18682
18683 #[cfg(test)]
18684 mod tests {
18685 use super::*;
18686
18687 #[test]
18688 fn conversions() {
18689 let hid_usage_page: u16 = 0x01; // Generic Desktop
18690 let hid_usage_id: u16 = 0x02; // Mouse
18691 let hid_usage: u32 = ((hid_usage_page as u32) << 16) | hid_usage_id as u32;
18692
18693 let u = GenericDesktop::Mouse;
18694 // 32 bit usage to enum
18695 assert!(matches!(
18696 Usage::try_from(hid_usage).unwrap(),
18697 Usage::GenericDesktop(_)
18698 ));
18699
18700 // Usage to u32
18701 assert_eq!(u32::from(&u), hid_usage);
18702 assert_eq!(u.usage_value(), hid_usage);
18703
18704 // Usage to u16 usage_id
18705 assert_eq!(hid_usage_id, u16::from(&u));
18706 assert_eq!(hid_usage_id, u.usage_id_value());
18707
18708 // Usage to UsagePage
18709 assert!(matches!(UsagePage::from(&u), UsagePage::GenericDesktop));
18710
18711 // UsagePage to u16
18712 let up = UsagePage::from(&u);
18713 assert_eq!(hid_usage_page, u16::from(&up));
18714
18715 // UsagePage to u16 via AsUsagePage trait
18716 assert_eq!(hid_usage_page, up.usage_page_value());
18717 }
18718
18719 #[test]
18720 fn buttons() {
18721 let hid_usage_page: u16 = 0x9;
18722 let hid_usage_id: u16 = 0x5;
18723 let hid_usage: u32 = ((hid_usage_page as u32) << 16) | hid_usage_id as u32;
18724
18725 let u = Button::Button(5);
18726 assert!(matches!(
18727 Usage::try_from(hid_usage).unwrap(),
18728 Usage::Button(_)
18729 ));
18730
18731 // Usage to u32
18732 assert_eq!(u32::from(&u), hid_usage);
18733 assert_eq!(u.usage_value(), hid_usage);
18734
18735 // Usage to u16 usage_id
18736 assert_eq!(hid_usage_id, u16::from(&u));
18737 assert_eq!(hid_usage_id, u.usage_id_value());
18738
18739 // Usage to UsagePage
18740 assert!(matches!(UsagePage::from(&u), UsagePage::Button));
18741
18742 // UsagePage to u16
18743 let up = UsagePage::from(&u);
18744 assert_eq!(hid_usage_page, u16::from(&up));
18745
18746 // UsagePage to u16 via AsUsagePage trait
18747 assert_eq!(hid_usage_page, up.usage_page_value());
18748 }
18749
18750 #[test]
18751 fn ordinals() {
18752 let hid_usage_page: u16 = 0xA;
18753 let hid_usage_id: u16 = 0x8;
18754 let hid_usage: u32 = ((hid_usage_page as u32) << 16) | hid_usage_id as u32;
18755
18756 let u = Ordinal::Ordinal(8);
18757 assert!(matches!(
18758 Usage::try_from(hid_usage).unwrap(),
18759 Usage::Ordinal(_)
18760 ));
18761
18762 // Usage to u32
18763 assert_eq!(u32::from(&u), hid_usage);
18764 assert_eq!(u.usage_value(), hid_usage);
18765
18766 // Usage to u16 usage_id
18767 assert_eq!(hid_usage_id, u16::from(&u));
18768 assert_eq!(hid_usage_id, u.usage_id_value());
18769
18770 // Usage to UsagePage
18771 assert!(matches!(UsagePage::from(&u), UsagePage::Ordinal));
18772
18773 // UsagePage to u16
18774 let up = UsagePage::from(&u);
18775 assert_eq!(hid_usage_page, u16::from(&up));
18776
18777 // UsagePage to u16 via AsUsagePage trait
18778 assert_eq!(hid_usage_page, up.usage_page_value());
18779 }
18780
18781 #[cfg(feature = "std")]
18782 #[test]
18783 fn names() {
18784 assert_eq!(UsagePage::GenericDesktop.name().as_str(), "Generic Desktop");
18785 assert_eq!(
18786 UsagePage::PhysicalInputDevice.name().as_str(),
18787 "Physical Input Device"
18788 );
18789 assert_eq!(GenericDesktop::CallMuteLED.name().as_str(), "Call Mute LED");
18790 assert_eq!(VRControls::HeadTracker.name().as_str(), "Head Tracker");
18791 }
18792
18793 #[test]
18794 fn usages() {
18795 let mouse = GenericDesktop::Mouse;
18796 let usage = Usage::GenericDesktop(GenericDesktop::Mouse);
18797 assert_eq!(mouse.usage(), usage);
18798 }
18799 }