hut/
lib.rs

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")]
217extern crate std;
218
219use core::ops::BitOr;
220#[cfg(feature = "std")]
221use std::{fmt, format, string::String, string::ToString};
222
223/// Error raised if conversion between HUT elements fails.
224#[derive(Debug)]
225pub 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
244impl core::error::Error for HutError {}
245
246impl core::fmt::Display for HutError {
247    fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
248        match self {
249            HutError::UnknownUsagePage { usage_page } => {
250                write!(fmt, "Unknown Usage Page {}", usage_page)
251            }
252            HutError::UnknownUsageId { usage_id } => write!(fmt, "Unknown Usage ID {}", usage_id),
253            HutError::InvalidVendorPage { vendor_page } => {
254                write!(fmt, "Invalid Vendor Page {}", vendor_page)
255            }
256            HutError::InvalidReservedPage { reserved_page } => {
257                write!(fmt, "Invalid Reserved Page {}", reserved_page)
258            }
259            HutError::UnknownUsage => write!(fmt, "Unknown Usage"),
260        }
261    }
262}
263
264type Result<T> = core::result::Result<T, HutError>;
265
266/// A trait to return the Usage and Usage ID as numeric value
267pub 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
279pub 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]
301pub 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)]
427pub struct ReservedPage(u16);
428
429impl From<&ReservedPage> for ReservedPage {
430    fn from(v: &ReservedPage) -> ReservedPage {
431        ReservedPage(v.0)
432    }
433}
434
435impl From<&ReservedPage> for u16 {
436    fn from(v: &ReservedPage) -> u16 {
437        v.0
438    }
439}
440
441impl From<ReservedPage> for u16 {
442    fn from(v: ReservedPage) -> u16 {
443        u16::from(&v)
444    }
445}
446
447impl From<&ReservedPage> for u32 {
448    fn from(v: &ReservedPage) -> u32 {
449        (v.0 as u32) << 16
450    }
451}
452
453impl From<ReservedPage> for u32 {
454    fn from(v: ReservedPage) -> u32 {
455        u32::from(&v)
456    }
457}
458
459impl TryFrom<u16> for ReservedPage {
460    type Error = HutError;
461
462    fn try_from(v: u16) -> Result<ReservedPage> {
463        match v {
464            p @ 0x13 => Ok(ReservedPage(p)),
465            p @ 0x15..=0x1F => Ok(ReservedPage(p)),
466            p @ 0x21..=0x3F => Ok(ReservedPage(p)),
467            p @ 0x42..=0x58 => Ok(ReservedPage(p)),
468            p @ 0x5A..=0x7F => Ok(ReservedPage(p)),
469            p @ 0x83..=0x83 => Ok(ReservedPage(p)),
470            p @ 0x86..=0x8B => Ok(ReservedPage(p)),
471            p @ 0x8F..=0x8F => Ok(ReservedPage(p)),
472            p @ 0x93..=0xF1CF => Ok(ReservedPage(p)),
473            p @ 0xF1D1..=0xFEFF => Ok(ReservedPage(p)),
474            n => Err(HutError::InvalidReservedPage { reserved_page: n }),
475        }
476    }
477}
478
479impl TryFrom<u32> for ReservedPage {
480    type Error = HutError;
481
482    fn try_from(v: u32) -> Result<ReservedPage> {
483        ReservedPage::try_from((v >> 16) as u16)
484    }
485}
486
487/// 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)]
501pub struct VendorPage(u16);
502
503impl From<&VendorPage> for VendorPage {
504    fn from(v: &VendorPage) -> VendorPage {
505        VendorPage(v.0)
506    }
507}
508
509impl From<&VendorPage> for u16 {
510    fn from(v: &VendorPage) -> u16 {
511        v.0
512    }
513}
514
515impl From<VendorPage> for u16 {
516    fn from(v: VendorPage) -> u16 {
517        u16::from(&v)
518    }
519}
520
521impl From<&VendorPage> for u32 {
522    fn from(v: &VendorPage) -> u32 {
523        (v.0 as u32) << 16
524    }
525}
526
527impl From<VendorPage> for u32 {
528    fn from(v: VendorPage) -> u32 {
529        u32::from(&v)
530    }
531}
532
533impl TryFrom<u16> for VendorPage {
534    type Error = HutError;
535
536    fn try_from(v: u16) -> Result<VendorPage> {
537        match v {
538            p @ 0xff00..=0xffff => Ok(VendorPage(p)),
539            n => Err(HutError::InvalidVendorPage { vendor_page: n }),
540        }
541    }
542}
543
544impl TryFrom<u32> for VendorPage {
545    type Error = HutError;
546
547    fn try_from(v: u32) -> Result<VendorPage> {
548        VendorPage::try_from((v >> 16) as u16)
549    }
550}
551
552impl UsagePage {
553    /// 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
650impl 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)]
698#[non_exhaustive]
699pub enum GenericDesktop {
700    /// Usage ID `0x1`: "Pointer"
701    Pointer,
702    /// Usage ID `0x2`: "Mouse"
703    Mouse,
704    /// Usage ID `0x4`: "Joystick"
705    Joystick,
706    /// Usage ID `0x5`: "Gamepad"
707    Gamepad,
708    /// Usage ID `0x6`: "Keyboard"
709    Keyboard,
710    /// Usage ID `0x7`: "Keypad"
711    Keypad,
712    /// Usage ID `0x8`: "Multi-axis Controller"
713    MultiaxisController,
714    /// Usage ID `0x9`: "Tablet PC System Controls"
715    TabletPCSystemControls,
716    /// Usage ID `0xA`: "Water Cooling Device"
717    WaterCoolingDevice,
718    /// Usage ID `0xB`: "Computer Chassis Device"
719    ComputerChassisDevice,
720    /// Usage ID `0xC`: "Wireless Radio Controls"
721    WirelessRadioControls,
722    /// Usage ID `0xD`: "Portable Device Control"
723    PortableDeviceControl,
724    /// Usage ID `0xE`: "System Multi-Axis Controller"
725    SystemMultiAxisController,
726    /// Usage ID `0xF`: "Spatial Controller"
727    SpatialController,
728    /// Usage ID `0x10`: "Assistive Control"
729    AssistiveControl,
730    /// Usage ID `0x11`: "Device Dock"
731    DeviceDock,
732    /// Usage ID `0x12`: "Dockable Device"
733    DockableDevice,
734    /// Usage ID `0x13`: "Call State Management Control"
735    CallStateManagementControl,
736    /// Usage ID `0x30`: "X"
737    X,
738    /// Usage ID `0x31`: "Y"
739    Y,
740    /// Usage ID `0x32`: "Z"
741    Z,
742    /// Usage ID `0x33`: "Rx"
743    Rx,
744    /// Usage ID `0x34`: "Ry"
745    Ry,
746    /// Usage ID `0x35`: "Rz"
747    Rz,
748    /// Usage ID `0x36`: "Slider"
749    Slider,
750    /// Usage ID `0x37`: "Dial"
751    Dial,
752    /// Usage ID `0x38`: "Wheel"
753    Wheel,
754    /// Usage ID `0x39`: "Hat Switch"
755    HatSwitch,
756    /// Usage ID `0x3A`: "Counted Buffer"
757    CountedBuffer,
758    /// Usage ID `0x3B`: "Byte Count"
759    ByteCount,
760    /// Usage ID `0x3C`: "Motion Wakeup"
761    MotionWakeup,
762    /// Usage ID `0x3D`: "Start"
763    Start,
764    /// Usage ID `0x3E`: "Select"
765    Select,
766    /// Usage ID `0x40`: "Vx"
767    Vx,
768    /// Usage ID `0x41`: "Vy"
769    Vy,
770    /// Usage ID `0x42`: "Vz"
771    Vz,
772    /// Usage ID `0x43`: "Vbrx"
773    Vbrx,
774    /// Usage ID `0x44`: "Vbry"
775    Vbry,
776    /// Usage ID `0x45`: "Vbrz"
777    Vbrz,
778    /// Usage ID `0x46`: "Vno"
779    Vno,
780    /// Usage ID `0x47`: "Feature Notification"
781    FeatureNotification,
782    /// Usage ID `0x48`: "Resolution Multiplier"
783    ResolutionMultiplier,
784    /// Usage ID `0x49`: "Qx"
785    Qx,
786    /// Usage ID `0x4A`: "Qy"
787    Qy,
788    /// Usage ID `0x4B`: "Qz"
789    Qz,
790    /// Usage ID `0x4C`: "Qw"
791    Qw,
792    /// Usage ID `0x80`: "System Control"
793    SystemControl,
794    /// Usage ID `0x81`: "System Power Down"
795    SystemPowerDown,
796    /// Usage ID `0x82`: "System Sleep"
797    SystemSleep,
798    /// Usage ID `0x83`: "System Wake Up"
799    SystemWakeUp,
800    /// Usage ID `0x84`: "System Context Menu"
801    SystemContextMenu,
802    /// Usage ID `0x85`: "System Main Menu"
803    SystemMainMenu,
804    /// Usage ID `0x86`: "System App Menu"
805    SystemAppMenu,
806    /// Usage ID `0x87`: "System Menu Help"
807    SystemMenuHelp,
808    /// Usage ID `0x88`: "System Menu Exit"
809    SystemMenuExit,
810    /// Usage ID `0x89`: "System Menu Select"
811    SystemMenuSelect,
812    /// Usage ID `0x8A`: "System Menu Right"
813    SystemMenuRight,
814    /// Usage ID `0x8B`: "System Menu Left"
815    SystemMenuLeft,
816    /// Usage ID `0x8C`: "System Menu Up"
817    SystemMenuUp,
818    /// Usage ID `0x8D`: "System Menu Down"
819    SystemMenuDown,
820    /// Usage ID `0x8E`: "System Cold Restart"
821    SystemColdRestart,
822    /// Usage ID `0x8F`: "System Warm Restart"
823    SystemWarmRestart,
824    /// Usage ID `0x90`: "D-pad Up"
825    DpadUp,
826    /// Usage ID `0x91`: "D-pad Down"
827    DpadDown,
828    /// Usage ID `0x92`: "D-pad Right"
829    DpadRight,
830    /// Usage ID `0x93`: "D-pad Left"
831    DpadLeft,
832    /// Usage ID `0x94`: "Index Trigger"
833    IndexTrigger,
834    /// Usage ID `0x95`: "Palm Trigger"
835    PalmTrigger,
836    /// Usage ID `0x96`: "Thumbstick"
837    Thumbstick,
838    /// Usage ID `0x97`: "System Function Shift"
839    SystemFunctionShift,
840    /// Usage ID `0x98`: "System Function Shift Lock"
841    SystemFunctionShiftLock,
842    /// Usage ID `0x99`: "System Function Shift Lock Indicator"
843    SystemFunctionShiftLockIndicator,
844    /// Usage ID `0x9A`: "System Dismiss Notification"
845    SystemDismissNotification,
846    /// Usage ID `0x9B`: "System Do Not Disturb"
847    SystemDoNotDisturb,
848    /// Usage ID `0xA0`: "System Dock"
849    SystemDock,
850    /// Usage ID `0xA1`: "System Undock"
851    SystemUndock,
852    /// Usage ID `0xA2`: "System Setup"
853    SystemSetup,
854    /// Usage ID `0xA3`: "System Break"
855    SystemBreak,
856    /// Usage ID `0xA4`: "System Debugger Break"
857    SystemDebuggerBreak,
858    /// Usage ID `0xA5`: "Application Break"
859    ApplicationBreak,
860    /// Usage ID `0xA6`: "Application Debugger Break"
861    ApplicationDebuggerBreak,
862    /// Usage ID `0xA7`: "System Speaker Mute"
863    SystemSpeakerMute,
864    /// Usage ID `0xA8`: "System Hibernate"
865    SystemHibernate,
866    /// Usage ID `0xA9`: "System Microphone Mute"
867    SystemMicrophoneMute,
868    /// Usage ID `0xAA`: "System Accessibility Binding"
869    SystemAccessibilityBinding,
870    /// Usage ID `0xB0`: "System Display Invert"
871    SystemDisplayInvert,
872    /// Usage ID `0xB1`: "System Display Internal"
873    SystemDisplayInternal,
874    /// Usage ID `0xB2`: "System Display External"
875    SystemDisplayExternal,
876    /// Usage ID `0xB3`: "System Display Both"
877    SystemDisplayBoth,
878    /// Usage ID `0xB4`: "System Display Dual"
879    SystemDisplayDual,
880    /// Usage ID `0xB5`: "System Display Toggle Int/Ext Mode"
881    SystemDisplayToggleIntExtMode,
882    /// Usage ID `0xB6`: "System Display Swap Primary/Secondary"
883    SystemDisplaySwapPrimarySecondary,
884    /// Usage ID `0xB7`: "System Display Toggle LCD Autoscale"
885    SystemDisplayToggleLCDAutoscale,
886    /// Usage ID `0xC0`: "Sensor Zone"
887    SensorZone,
888    /// Usage ID `0xC1`: "RPM"
889    RPM,
890    /// Usage ID `0xC2`: "Coolant Level"
891    CoolantLevel,
892    /// Usage ID `0xC3`: "Coolant Critical Level"
893    CoolantCriticalLevel,
894    /// Usage ID `0xC4`: "Coolant Pump"
895    CoolantPump,
896    /// Usage ID `0xC5`: "Chassis Enclosure"
897    ChassisEnclosure,
898    /// Usage ID `0xC6`: "Wireless Radio Button"
899    WirelessRadioButton,
900    /// Usage ID `0xC7`: "Wireless Radio LED"
901    WirelessRadioLED,
902    /// Usage ID `0xC8`: "Wireless Radio Slider Switch"
903    WirelessRadioSliderSwitch,
904    /// Usage ID `0xC9`: "System Display Rotation Lock Button"
905    SystemDisplayRotationLockButton,
906    /// Usage ID `0xCA`: "System Display Rotation Lock Slider Switch"
907    SystemDisplayRotationLockSliderSwitch,
908    /// Usage ID `0xCB`: "Control Enable"
909    ControlEnable,
910    /// Usage ID `0xD0`: "Dockable Device Unique ID"
911    DockableDeviceUniqueID,
912    /// Usage ID `0xD1`: "Dockable Device Vendor ID"
913    DockableDeviceVendorID,
914    /// Usage ID `0xD2`: "Dockable Device Primary Usage Page"
915    DockableDevicePrimaryUsagePage,
916    /// Usage ID `0xD3`: "Dockable Device Primary Usage ID"
917    DockableDevicePrimaryUsageID,
918    /// Usage ID `0xD4`: "Dockable Device Docking State"
919    DockableDeviceDockingState,
920    /// Usage ID `0xD5`: "Dockable Device Display Occlusion"
921    DockableDeviceDisplayOcclusion,
922    /// Usage ID `0xD6`: "Dockable Device Object Type"
923    DockableDeviceObjectType,
924    /// Usage ID `0xE0`: "Call Active LED"
925    CallActiveLED,
926    /// Usage ID `0xE1`: "Call Mute Toggle"
927    CallMuteToggle,
928    /// Usage ID `0xE2`: "Call Mute LED"
929    CallMuteLED,
930}
931
932impl GenericDesktop {
933    #[cfg(feature = "std")]
934    pub fn name(&self) -> String {
935        match self {
936            GenericDesktop::Pointer => "Pointer",
937            GenericDesktop::Mouse => "Mouse",
938            GenericDesktop::Joystick => "Joystick",
939            GenericDesktop::Gamepad => "Gamepad",
940            GenericDesktop::Keyboard => "Keyboard",
941            GenericDesktop::Keypad => "Keypad",
942            GenericDesktop::MultiaxisController => "Multi-axis Controller",
943            GenericDesktop::TabletPCSystemControls => "Tablet PC System Controls",
944            GenericDesktop::WaterCoolingDevice => "Water Cooling Device",
945            GenericDesktop::ComputerChassisDevice => "Computer Chassis Device",
946            GenericDesktop::WirelessRadioControls => "Wireless Radio Controls",
947            GenericDesktop::PortableDeviceControl => "Portable Device Control",
948            GenericDesktop::SystemMultiAxisController => "System Multi-Axis Controller",
949            GenericDesktop::SpatialController => "Spatial Controller",
950            GenericDesktop::AssistiveControl => "Assistive Control",
951            GenericDesktop::DeviceDock => "Device Dock",
952            GenericDesktop::DockableDevice => "Dockable Device",
953            GenericDesktop::CallStateManagementControl => "Call State Management Control",
954            GenericDesktop::X => "X",
955            GenericDesktop::Y => "Y",
956            GenericDesktop::Z => "Z",
957            GenericDesktop::Rx => "Rx",
958            GenericDesktop::Ry => "Ry",
959            GenericDesktop::Rz => "Rz",
960            GenericDesktop::Slider => "Slider",
961            GenericDesktop::Dial => "Dial",
962            GenericDesktop::Wheel => "Wheel",
963            GenericDesktop::HatSwitch => "Hat Switch",
964            GenericDesktop::CountedBuffer => "Counted Buffer",
965            GenericDesktop::ByteCount => "Byte Count",
966            GenericDesktop::MotionWakeup => "Motion Wakeup",
967            GenericDesktop::Start => "Start",
968            GenericDesktop::Select => "Select",
969            GenericDesktop::Vx => "Vx",
970            GenericDesktop::Vy => "Vy",
971            GenericDesktop::Vz => "Vz",
972            GenericDesktop::Vbrx => "Vbrx",
973            GenericDesktop::Vbry => "Vbry",
974            GenericDesktop::Vbrz => "Vbrz",
975            GenericDesktop::Vno => "Vno",
976            GenericDesktop::FeatureNotification => "Feature Notification",
977            GenericDesktop::ResolutionMultiplier => "Resolution Multiplier",
978            GenericDesktop::Qx => "Qx",
979            GenericDesktop::Qy => "Qy",
980            GenericDesktop::Qz => "Qz",
981            GenericDesktop::Qw => "Qw",
982            GenericDesktop::SystemControl => "System Control",
983            GenericDesktop::SystemPowerDown => "System Power Down",
984            GenericDesktop::SystemSleep => "System Sleep",
985            GenericDesktop::SystemWakeUp => "System Wake Up",
986            GenericDesktop::SystemContextMenu => "System Context Menu",
987            GenericDesktop::SystemMainMenu => "System Main Menu",
988            GenericDesktop::SystemAppMenu => "System App Menu",
989            GenericDesktop::SystemMenuHelp => "System Menu Help",
990            GenericDesktop::SystemMenuExit => "System Menu Exit",
991            GenericDesktop::SystemMenuSelect => "System Menu Select",
992            GenericDesktop::SystemMenuRight => "System Menu Right",
993            GenericDesktop::SystemMenuLeft => "System Menu Left",
994            GenericDesktop::SystemMenuUp => "System Menu Up",
995            GenericDesktop::SystemMenuDown => "System Menu Down",
996            GenericDesktop::SystemColdRestart => "System Cold Restart",
997            GenericDesktop::SystemWarmRestart => "System Warm Restart",
998            GenericDesktop::DpadUp => "D-pad Up",
999            GenericDesktop::DpadDown => "D-pad Down",
1000            GenericDesktop::DpadRight => "D-pad Right",
1001            GenericDesktop::DpadLeft => "D-pad Left",
1002            GenericDesktop::IndexTrigger => "Index Trigger",
1003            GenericDesktop::PalmTrigger => "Palm Trigger",
1004            GenericDesktop::Thumbstick => "Thumbstick",
1005            GenericDesktop::SystemFunctionShift => "System Function Shift",
1006            GenericDesktop::SystemFunctionShiftLock => "System Function Shift Lock",
1007            GenericDesktop::SystemFunctionShiftLockIndicator => {
1008                "System Function Shift Lock Indicator"
1009            }
1010            GenericDesktop::SystemDismissNotification => "System Dismiss Notification",
1011            GenericDesktop::SystemDoNotDisturb => "System Do Not Disturb",
1012            GenericDesktop::SystemDock => "System Dock",
1013            GenericDesktop::SystemUndock => "System Undock",
1014            GenericDesktop::SystemSetup => "System Setup",
1015            GenericDesktop::SystemBreak => "System Break",
1016            GenericDesktop::SystemDebuggerBreak => "System Debugger Break",
1017            GenericDesktop::ApplicationBreak => "Application Break",
1018            GenericDesktop::ApplicationDebuggerBreak => "Application Debugger Break",
1019            GenericDesktop::SystemSpeakerMute => "System Speaker Mute",
1020            GenericDesktop::SystemHibernate => "System Hibernate",
1021            GenericDesktop::SystemMicrophoneMute => "System Microphone Mute",
1022            GenericDesktop::SystemAccessibilityBinding => "System Accessibility Binding",
1023            GenericDesktop::SystemDisplayInvert => "System Display Invert",
1024            GenericDesktop::SystemDisplayInternal => "System Display Internal",
1025            GenericDesktop::SystemDisplayExternal => "System Display External",
1026            GenericDesktop::SystemDisplayBoth => "System Display Both",
1027            GenericDesktop::SystemDisplayDual => "System Display Dual",
1028            GenericDesktop::SystemDisplayToggleIntExtMode => "System Display Toggle Int/Ext Mode",
1029            GenericDesktop::SystemDisplaySwapPrimarySecondary => {
1030                "System Display Swap Primary/Secondary"
1031            }
1032            GenericDesktop::SystemDisplayToggleLCDAutoscale => {
1033                "System Display Toggle LCD Autoscale"
1034            }
1035            GenericDesktop::SensorZone => "Sensor Zone",
1036            GenericDesktop::RPM => "RPM",
1037            GenericDesktop::CoolantLevel => "Coolant Level",
1038            GenericDesktop::CoolantCriticalLevel => "Coolant Critical Level",
1039            GenericDesktop::CoolantPump => "Coolant Pump",
1040            GenericDesktop::ChassisEnclosure => "Chassis Enclosure",
1041            GenericDesktop::WirelessRadioButton => "Wireless Radio Button",
1042            GenericDesktop::WirelessRadioLED => "Wireless Radio LED",
1043            GenericDesktop::WirelessRadioSliderSwitch => "Wireless Radio Slider Switch",
1044            GenericDesktop::SystemDisplayRotationLockButton => {
1045                "System Display Rotation Lock Button"
1046            }
1047            GenericDesktop::SystemDisplayRotationLockSliderSwitch => {
1048                "System Display Rotation Lock Slider Switch"
1049            }
1050            GenericDesktop::ControlEnable => "Control Enable",
1051            GenericDesktop::DockableDeviceUniqueID => "Dockable Device Unique ID",
1052            GenericDesktop::DockableDeviceVendorID => "Dockable Device Vendor ID",
1053            GenericDesktop::DockableDevicePrimaryUsagePage => "Dockable Device Primary Usage Page",
1054            GenericDesktop::DockableDevicePrimaryUsageID => "Dockable Device Primary Usage ID",
1055            GenericDesktop::DockableDeviceDockingState => "Dockable Device Docking State",
1056            GenericDesktop::DockableDeviceDisplayOcclusion => "Dockable Device Display Occlusion",
1057            GenericDesktop::DockableDeviceObjectType => "Dockable Device Object Type",
1058            GenericDesktop::CallActiveLED => "Call Active LED",
1059            GenericDesktop::CallMuteToggle => "Call Mute Toggle",
1060            GenericDesktop::CallMuteLED => "Call Mute LED",
1061        }
1062        .into()
1063    }
1064}
1065
1066#[cfg(feature = "std")]
1067impl fmt::Display for GenericDesktop {
1068    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1069        write!(f, "{}", self.name())
1070    }
1071}
1072
1073impl AsUsage for GenericDesktop {
1074    /// Returns the 32 bit Usage value of this Usage
1075    fn usage_value(&self) -> u32 {
1076        u32::from(self)
1077    }
1078
1079    /// Returns the 16 bit Usage ID value of this Usage
1080    fn usage_id_value(&self) -> u16 {
1081        u16::from(self)
1082    }
1083
1084    /// Returns this usage as [Usage::GenericDesktop(self)](Usage::GenericDesktop)
1085    /// This is a convenience function to avoid having
1086    /// to implement `From` for every used type in the caller.
1087    ///
1088    /// ```
1089    /// # use hut::*;
1090    /// let gd_x = GenericDesktop::X;
1091    /// let usage = Usage::from(GenericDesktop::X);
1092    /// assert!(matches!(gd_x.usage(), usage));
1093    /// ```
1094    fn usage(&self) -> Usage {
1095        Usage::from(self)
1096    }
1097}
1098
1099impl AsUsagePage for GenericDesktop {
1100    /// Returns the 16 bit value of this UsagePage
1101    ///
1102    /// This value is `0x1` for [GenericDesktop]
1103    fn usage_page_value(&self) -> u16 {
1104        let up = UsagePage::from(self);
1105        u16::from(up)
1106    }
1107
1108    /// Returns [UsagePage::GenericDesktop]]
1109    fn usage_page(&self) -> UsagePage {
1110        UsagePage::from(self)
1111    }
1112}
1113
1114impl From<&GenericDesktop> for u16 {
1115    fn from(genericdesktop: &GenericDesktop) -> u16 {
1116        match *genericdesktop {
1117            GenericDesktop::Pointer => 1,
1118            GenericDesktop::Mouse => 2,
1119            GenericDesktop::Joystick => 4,
1120            GenericDesktop::Gamepad => 5,
1121            GenericDesktop::Keyboard => 6,
1122            GenericDesktop::Keypad => 7,
1123            GenericDesktop::MultiaxisController => 8,
1124            GenericDesktop::TabletPCSystemControls => 9,
1125            GenericDesktop::WaterCoolingDevice => 10,
1126            GenericDesktop::ComputerChassisDevice => 11,
1127            GenericDesktop::WirelessRadioControls => 12,
1128            GenericDesktop::PortableDeviceControl => 13,
1129            GenericDesktop::SystemMultiAxisController => 14,
1130            GenericDesktop::SpatialController => 15,
1131            GenericDesktop::AssistiveControl => 16,
1132            GenericDesktop::DeviceDock => 17,
1133            GenericDesktop::DockableDevice => 18,
1134            GenericDesktop::CallStateManagementControl => 19,
1135            GenericDesktop::X => 48,
1136            GenericDesktop::Y => 49,
1137            GenericDesktop::Z => 50,
1138            GenericDesktop::Rx => 51,
1139            GenericDesktop::Ry => 52,
1140            GenericDesktop::Rz => 53,
1141            GenericDesktop::Slider => 54,
1142            GenericDesktop::Dial => 55,
1143            GenericDesktop::Wheel => 56,
1144            GenericDesktop::HatSwitch => 57,
1145            GenericDesktop::CountedBuffer => 58,
1146            GenericDesktop::ByteCount => 59,
1147            GenericDesktop::MotionWakeup => 60,
1148            GenericDesktop::Start => 61,
1149            GenericDesktop::Select => 62,
1150            GenericDesktop::Vx => 64,
1151            GenericDesktop::Vy => 65,
1152            GenericDesktop::Vz => 66,
1153            GenericDesktop::Vbrx => 67,
1154            GenericDesktop::Vbry => 68,
1155            GenericDesktop::Vbrz => 69,
1156            GenericDesktop::Vno => 70,
1157            GenericDesktop::FeatureNotification => 71,
1158            GenericDesktop::ResolutionMultiplier => 72,
1159            GenericDesktop::Qx => 73,
1160            GenericDesktop::Qy => 74,
1161            GenericDesktop::Qz => 75,
1162            GenericDesktop::Qw => 76,
1163            GenericDesktop::SystemControl => 128,
1164            GenericDesktop::SystemPowerDown => 129,
1165            GenericDesktop::SystemSleep => 130,
1166            GenericDesktop::SystemWakeUp => 131,
1167            GenericDesktop::SystemContextMenu => 132,
1168            GenericDesktop::SystemMainMenu => 133,
1169            GenericDesktop::SystemAppMenu => 134,
1170            GenericDesktop::SystemMenuHelp => 135,
1171            GenericDesktop::SystemMenuExit => 136,
1172            GenericDesktop::SystemMenuSelect => 137,
1173            GenericDesktop::SystemMenuRight => 138,
1174            GenericDesktop::SystemMenuLeft => 139,
1175            GenericDesktop::SystemMenuUp => 140,
1176            GenericDesktop::SystemMenuDown => 141,
1177            GenericDesktop::SystemColdRestart => 142,
1178            GenericDesktop::SystemWarmRestart => 143,
1179            GenericDesktop::DpadUp => 144,
1180            GenericDesktop::DpadDown => 145,
1181            GenericDesktop::DpadRight => 146,
1182            GenericDesktop::DpadLeft => 147,
1183            GenericDesktop::IndexTrigger => 148,
1184            GenericDesktop::PalmTrigger => 149,
1185            GenericDesktop::Thumbstick => 150,
1186            GenericDesktop::SystemFunctionShift => 151,
1187            GenericDesktop::SystemFunctionShiftLock => 152,
1188            GenericDesktop::SystemFunctionShiftLockIndicator => 153,
1189            GenericDesktop::SystemDismissNotification => 154,
1190            GenericDesktop::SystemDoNotDisturb => 155,
1191            GenericDesktop::SystemDock => 160,
1192            GenericDesktop::SystemUndock => 161,
1193            GenericDesktop::SystemSetup => 162,
1194            GenericDesktop::SystemBreak => 163,
1195            GenericDesktop::SystemDebuggerBreak => 164,
1196            GenericDesktop::ApplicationBreak => 165,
1197            GenericDesktop::ApplicationDebuggerBreak => 166,
1198            GenericDesktop::SystemSpeakerMute => 167,
1199            GenericDesktop::SystemHibernate => 168,
1200            GenericDesktop::SystemMicrophoneMute => 169,
1201            GenericDesktop::SystemAccessibilityBinding => 170,
1202            GenericDesktop::SystemDisplayInvert => 176,
1203            GenericDesktop::SystemDisplayInternal => 177,
1204            GenericDesktop::SystemDisplayExternal => 178,
1205            GenericDesktop::SystemDisplayBoth => 179,
1206            GenericDesktop::SystemDisplayDual => 180,
1207            GenericDesktop::SystemDisplayToggleIntExtMode => 181,
1208            GenericDesktop::SystemDisplaySwapPrimarySecondary => 182,
1209            GenericDesktop::SystemDisplayToggleLCDAutoscale => 183,
1210            GenericDesktop::SensorZone => 192,
1211            GenericDesktop::RPM => 193,
1212            GenericDesktop::CoolantLevel => 194,
1213            GenericDesktop::CoolantCriticalLevel => 195,
1214            GenericDesktop::CoolantPump => 196,
1215            GenericDesktop::ChassisEnclosure => 197,
1216            GenericDesktop::WirelessRadioButton => 198,
1217            GenericDesktop::WirelessRadioLED => 199,
1218            GenericDesktop::WirelessRadioSliderSwitch => 200,
1219            GenericDesktop::SystemDisplayRotationLockButton => 201,
1220            GenericDesktop::SystemDisplayRotationLockSliderSwitch => 202,
1221            GenericDesktop::ControlEnable => 203,
1222            GenericDesktop::DockableDeviceUniqueID => 208,
1223            GenericDesktop::DockableDeviceVendorID => 209,
1224            GenericDesktop::DockableDevicePrimaryUsagePage => 210,
1225            GenericDesktop::DockableDevicePrimaryUsageID => 211,
1226            GenericDesktop::DockableDeviceDockingState => 212,
1227            GenericDesktop::DockableDeviceDisplayOcclusion => 213,
1228            GenericDesktop::DockableDeviceObjectType => 214,
1229            GenericDesktop::CallActiveLED => 224,
1230            GenericDesktop::CallMuteToggle => 225,
1231            GenericDesktop::CallMuteLED => 226,
1232        }
1233    }
1234}
1235
1236impl From<GenericDesktop> for u16 {
1237    /// Returns the 16bit value of this usage. This is identical
1238    /// to [GenericDesktop::usage_page_value()].
1239    fn from(genericdesktop: GenericDesktop) -> u16 {
1240        u16::from(&genericdesktop)
1241    }
1242}
1243
1244impl From<&GenericDesktop> for u32 {
1245    /// Returns the 32 bit value of this usage. This is identical
1246    /// to [GenericDesktop::usage_value()].
1247    fn from(genericdesktop: &GenericDesktop) -> u32 {
1248        let up = UsagePage::from(genericdesktop);
1249        let up = (u16::from(&up) as u32) << 16;
1250        let id = u16::from(genericdesktop) as u32;
1251        up | id
1252    }
1253}
1254
1255impl From<&GenericDesktop> for UsagePage {
1256    /// Always returns [UsagePage::GenericDesktop] and is
1257    /// identical to [GenericDesktop::usage_page()].
1258    fn from(_: &GenericDesktop) -> UsagePage {
1259        UsagePage::GenericDesktop
1260    }
1261}
1262
1263impl From<GenericDesktop> for UsagePage {
1264    /// Always returns [UsagePage::GenericDesktop] and is
1265    /// identical to [GenericDesktop::usage_page()].
1266    fn from(_: GenericDesktop) -> UsagePage {
1267        UsagePage::GenericDesktop
1268    }
1269}
1270
1271impl From<&GenericDesktop> for Usage {
1272    fn from(genericdesktop: &GenericDesktop) -> Usage {
1273        Usage::try_from(u32::from(genericdesktop)).unwrap()
1274    }
1275}
1276
1277impl From<GenericDesktop> for Usage {
1278    fn from(genericdesktop: GenericDesktop) -> Usage {
1279        Usage::from(&genericdesktop)
1280    }
1281}
1282
1283impl TryFrom<u16> for GenericDesktop {
1284    type Error = HutError;
1285
1286    fn try_from(usage_id: u16) -> Result<GenericDesktop> {
1287        match usage_id {
1288            1 => Ok(GenericDesktop::Pointer),
1289            2 => Ok(GenericDesktop::Mouse),
1290            4 => Ok(GenericDesktop::Joystick),
1291            5 => Ok(GenericDesktop::Gamepad),
1292            6 => Ok(GenericDesktop::Keyboard),
1293            7 => Ok(GenericDesktop::Keypad),
1294            8 => Ok(GenericDesktop::MultiaxisController),
1295            9 => Ok(GenericDesktop::TabletPCSystemControls),
1296            10 => Ok(GenericDesktop::WaterCoolingDevice),
1297            11 => Ok(GenericDesktop::ComputerChassisDevice),
1298            12 => Ok(GenericDesktop::WirelessRadioControls),
1299            13 => Ok(GenericDesktop::PortableDeviceControl),
1300            14 => Ok(GenericDesktop::SystemMultiAxisController),
1301            15 => Ok(GenericDesktop::SpatialController),
1302            16 => Ok(GenericDesktop::AssistiveControl),
1303            17 => Ok(GenericDesktop::DeviceDock),
1304            18 => Ok(GenericDesktop::DockableDevice),
1305            19 => Ok(GenericDesktop::CallStateManagementControl),
1306            48 => Ok(GenericDesktop::X),
1307            49 => Ok(GenericDesktop::Y),
1308            50 => Ok(GenericDesktop::Z),
1309            51 => Ok(GenericDesktop::Rx),
1310            52 => Ok(GenericDesktop::Ry),
1311            53 => Ok(GenericDesktop::Rz),
1312            54 => Ok(GenericDesktop::Slider),
1313            55 => Ok(GenericDesktop::Dial),
1314            56 => Ok(GenericDesktop::Wheel),
1315            57 => Ok(GenericDesktop::HatSwitch),
1316            58 => Ok(GenericDesktop::CountedBuffer),
1317            59 => Ok(GenericDesktop::ByteCount),
1318            60 => Ok(GenericDesktop::MotionWakeup),
1319            61 => Ok(GenericDesktop::Start),
1320            62 => Ok(GenericDesktop::Select),
1321            64 => Ok(GenericDesktop::Vx),
1322            65 => Ok(GenericDesktop::Vy),
1323            66 => Ok(GenericDesktop::Vz),
1324            67 => Ok(GenericDesktop::Vbrx),
1325            68 => Ok(GenericDesktop::Vbry),
1326            69 => Ok(GenericDesktop::Vbrz),
1327            70 => Ok(GenericDesktop::Vno),
1328            71 => Ok(GenericDesktop::FeatureNotification),
1329            72 => Ok(GenericDesktop::ResolutionMultiplier),
1330            73 => Ok(GenericDesktop::Qx),
1331            74 => Ok(GenericDesktop::Qy),
1332            75 => Ok(GenericDesktop::Qz),
1333            76 => Ok(GenericDesktop::Qw),
1334            128 => Ok(GenericDesktop::SystemControl),
1335            129 => Ok(GenericDesktop::SystemPowerDown),
1336            130 => Ok(GenericDesktop::SystemSleep),
1337            131 => Ok(GenericDesktop::SystemWakeUp),
1338            132 => Ok(GenericDesktop::SystemContextMenu),
1339            133 => Ok(GenericDesktop::SystemMainMenu),
1340            134 => Ok(GenericDesktop::SystemAppMenu),
1341            135 => Ok(GenericDesktop::SystemMenuHelp),
1342            136 => Ok(GenericDesktop::SystemMenuExit),
1343            137 => Ok(GenericDesktop::SystemMenuSelect),
1344            138 => Ok(GenericDesktop::SystemMenuRight),
1345            139 => Ok(GenericDesktop::SystemMenuLeft),
1346            140 => Ok(GenericDesktop::SystemMenuUp),
1347            141 => Ok(GenericDesktop::SystemMenuDown),
1348            142 => Ok(GenericDesktop::SystemColdRestart),
1349            143 => Ok(GenericDesktop::SystemWarmRestart),
1350            144 => Ok(GenericDesktop::DpadUp),
1351            145 => Ok(GenericDesktop::DpadDown),
1352            146 => Ok(GenericDesktop::DpadRight),
1353            147 => Ok(GenericDesktop::DpadLeft),
1354            148 => Ok(GenericDesktop::IndexTrigger),
1355            149 => Ok(GenericDesktop::PalmTrigger),
1356            150 => Ok(GenericDesktop::Thumbstick),
1357            151 => Ok(GenericDesktop::SystemFunctionShift),
1358            152 => Ok(GenericDesktop::SystemFunctionShiftLock),
1359            153 => Ok(GenericDesktop::SystemFunctionShiftLockIndicator),
1360            154 => Ok(GenericDesktop::SystemDismissNotification),
1361            155 => Ok(GenericDesktop::SystemDoNotDisturb),
1362            160 => Ok(GenericDesktop::SystemDock),
1363            161 => Ok(GenericDesktop::SystemUndock),
1364            162 => Ok(GenericDesktop::SystemSetup),
1365            163 => Ok(GenericDesktop::SystemBreak),
1366            164 => Ok(GenericDesktop::SystemDebuggerBreak),
1367            165 => Ok(GenericDesktop::ApplicationBreak),
1368            166 => Ok(GenericDesktop::ApplicationDebuggerBreak),
1369            167 => Ok(GenericDesktop::SystemSpeakerMute),
1370            168 => Ok(GenericDesktop::SystemHibernate),
1371            169 => Ok(GenericDesktop::SystemMicrophoneMute),
1372            170 => Ok(GenericDesktop::SystemAccessibilityBinding),
1373            176 => Ok(GenericDesktop::SystemDisplayInvert),
1374            177 => Ok(GenericDesktop::SystemDisplayInternal),
1375            178 => Ok(GenericDesktop::SystemDisplayExternal),
1376            179 => Ok(GenericDesktop::SystemDisplayBoth),
1377            180 => Ok(GenericDesktop::SystemDisplayDual),
1378            181 => Ok(GenericDesktop::SystemDisplayToggleIntExtMode),
1379            182 => Ok(GenericDesktop::SystemDisplaySwapPrimarySecondary),
1380            183 => Ok(GenericDesktop::SystemDisplayToggleLCDAutoscale),
1381            192 => Ok(GenericDesktop::SensorZone),
1382            193 => Ok(GenericDesktop::RPM),
1383            194 => Ok(GenericDesktop::CoolantLevel),
1384            195 => Ok(GenericDesktop::CoolantCriticalLevel),
1385            196 => Ok(GenericDesktop::CoolantPump),
1386            197 => Ok(GenericDesktop::ChassisEnclosure),
1387            198 => Ok(GenericDesktop::WirelessRadioButton),
1388            199 => Ok(GenericDesktop::WirelessRadioLED),
1389            200 => Ok(GenericDesktop::WirelessRadioSliderSwitch),
1390            201 => Ok(GenericDesktop::SystemDisplayRotationLockButton),
1391            202 => Ok(GenericDesktop::SystemDisplayRotationLockSliderSwitch),
1392            203 => Ok(GenericDesktop::ControlEnable),
1393            208 => Ok(GenericDesktop::DockableDeviceUniqueID),
1394            209 => Ok(GenericDesktop::DockableDeviceVendorID),
1395            210 => Ok(GenericDesktop::DockableDevicePrimaryUsagePage),
1396            211 => Ok(GenericDesktop::DockableDevicePrimaryUsageID),
1397            212 => Ok(GenericDesktop::DockableDeviceDockingState),
1398            213 => Ok(GenericDesktop::DockableDeviceDisplayOcclusion),
1399            214 => Ok(GenericDesktop::DockableDeviceObjectType),
1400            224 => Ok(GenericDesktop::CallActiveLED),
1401            225 => Ok(GenericDesktop::CallMuteToggle),
1402            226 => Ok(GenericDesktop::CallMuteLED),
1403            n => Err(HutError::UnknownUsageId { usage_id: n }),
1404        }
1405    }
1406}
1407
1408impl BitOr<u16> for GenericDesktop {
1409    type Output = Usage;
1410
1411    /// A convenience function to combine a Usage Page with
1412    /// a value.
1413    ///
1414    /// This function panics if the Usage ID value results in
1415    /// an unknown Usage. Where error checking is required,
1416    /// use [UsagePage::to_usage_from_value].
1417    fn bitor(self, usage: u16) -> Usage {
1418        let up = u16::from(self) as u32;
1419        let u = usage as u32;
1420        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
1421    }
1422}
1423
1424/// *Usage Page `0x2`: "Simulation Controls"*
1425///
1426/// **This enum is autogenerated from the HID Usage Tables**.
1427/// ```
1428/// # use hut::*;
1429/// let u1 = Usage::SimulationControls(SimulationControls::AutomobileSimulationDevice);
1430/// let u2 = Usage::new_from_page_and_id(0x2, 0x2).unwrap();
1431/// let u3 = Usage::from(SimulationControls::AutomobileSimulationDevice);
1432/// let u4: Usage = SimulationControls::AutomobileSimulationDevice.into();
1433/// assert_eq!(u1, u2);
1434/// assert_eq!(u1, u3);
1435/// assert_eq!(u1, u4);
1436///
1437/// assert!(matches!(u1.usage_page(), UsagePage::SimulationControls));
1438/// assert_eq!(0x2, u1.usage_page_value());
1439/// assert_eq!(0x2, u1.usage_id_value());
1440/// assert_eq!((0x2 << 16) | 0x2, u1.usage_value());
1441/// assert_eq!("Automobile Simulation Device", u1.name());
1442/// ```
1443///
1444#[allow(non_camel_case_types)]
1445#[derive(Debug)]
1446#[non_exhaustive]
1447pub enum SimulationControls {
1448    /// Usage ID `0x1`: "Flight Simulation Device"
1449    FlightSimulationDevice,
1450    /// Usage ID `0x2`: "Automobile Simulation Device"
1451    AutomobileSimulationDevice,
1452    /// Usage ID `0x3`: "Tank Simulation Device"
1453    TankSimulationDevice,
1454    /// Usage ID `0x4`: "Spaceship Simulation Device"
1455    SpaceshipSimulationDevice,
1456    /// Usage ID `0x5`: "Submarine Simulation Device"
1457    SubmarineSimulationDevice,
1458    /// Usage ID `0x6`: "Sailing Simulation Device"
1459    SailingSimulationDevice,
1460    /// Usage ID `0x7`: "Motorcycle Simulation Device"
1461    MotorcycleSimulationDevice,
1462    /// Usage ID `0x8`: "Sports Simulation Device"
1463    SportsSimulationDevice,
1464    /// Usage ID `0x9`: "Airplane Simulation Device"
1465    AirplaneSimulationDevice,
1466    /// Usage ID `0xA`: "Helicopter Simulation Device"
1467    HelicopterSimulationDevice,
1468    /// Usage ID `0xB`: "Magic Carpet Simulation Device"
1469    MagicCarpetSimulationDevice,
1470    /// Usage ID `0xC`: "Bicycle Simulation Device"
1471    BicycleSimulationDevice,
1472    /// Usage ID `0x20`: "Flight Control Stick"
1473    FlightControlStick,
1474    /// Usage ID `0x21`: "Flight Stick"
1475    FlightStick,
1476    /// Usage ID `0x22`: "Cyclic Control"
1477    CyclicControl,
1478    /// Usage ID `0x23`: "Cyclic Trim"
1479    CyclicTrim,
1480    /// Usage ID `0x24`: "Flight Yoke"
1481    FlightYoke,
1482    /// Usage ID `0x25`: "Track Control"
1483    TrackControl,
1484    /// Usage ID `0xB0`: "Aileron"
1485    Aileron,
1486    /// Usage ID `0xB1`: "Aileron Trim"
1487    AileronTrim,
1488    /// Usage ID `0xB2`: "Anti-Torque Control"
1489    AntiTorqueControl,
1490    /// Usage ID `0xB3`: "Autopilot Enable"
1491    AutopilotEnable,
1492    /// Usage ID `0xB4`: "Chaff Release"
1493    ChaffRelease,
1494    /// Usage ID `0xB5`: "Collective Control"
1495    CollectiveControl,
1496    /// Usage ID `0xB6`: "Dive Brake"
1497    DiveBrake,
1498    /// Usage ID `0xB7`: "Electronic Countermeasures"
1499    ElectronicCountermeasures,
1500    /// Usage ID `0xB8`: "Elevator"
1501    Elevator,
1502    /// Usage ID `0xB9`: "Elevator Trim"
1503    ElevatorTrim,
1504    /// Usage ID `0xBA`: "Rudder"
1505    Rudder,
1506    /// Usage ID `0xBB`: "Throttle"
1507    Throttle,
1508    /// Usage ID `0xBC`: "Flight Communications"
1509    FlightCommunications,
1510    /// Usage ID `0xBD`: "Flare Release"
1511    FlareRelease,
1512    /// Usage ID `0xBE`: "Landing Gear"
1513    LandingGear,
1514    /// Usage ID `0xBF`: "Toe Brake"
1515    ToeBrake,
1516    /// Usage ID `0xC0`: "Trigger"
1517    Trigger,
1518    /// Usage ID `0xC1`: "Weapons Arm"
1519    WeaponsArm,
1520    /// Usage ID `0xC2`: "Weapons Select"
1521    WeaponsSelect,
1522    /// Usage ID `0xC3`: "Wing Flaps"
1523    WingFlaps,
1524    /// Usage ID `0xC4`: "Accelerator"
1525    Accelerator,
1526    /// Usage ID `0xC5`: "Brake"
1527    Brake,
1528    /// Usage ID `0xC6`: "Clutch"
1529    Clutch,
1530    /// Usage ID `0xC7`: "Shifter"
1531    Shifter,
1532    /// Usage ID `0xC8`: "Steering"
1533    Steering,
1534    /// Usage ID `0xC9`: "Turret Direction"
1535    TurretDirection,
1536    /// Usage ID `0xCA`: "Barrel Elevation"
1537    BarrelElevation,
1538    /// Usage ID `0xCB`: "Dive Plane"
1539    DivePlane,
1540    /// Usage ID `0xCC`: "Ballast"
1541    Ballast,
1542    /// Usage ID `0xCD`: "Bicycle Crank"
1543    BicycleCrank,
1544    /// Usage ID `0xCE`: "Handle Bars"
1545    HandleBars,
1546    /// Usage ID `0xCF`: "Front Brake"
1547    FrontBrake,
1548    /// Usage ID `0xD0`: "Rear Brake"
1549    RearBrake,
1550}
1551
1552impl SimulationControls {
1553    #[cfg(feature = "std")]
1554    pub fn name(&self) -> String {
1555        match self {
1556            SimulationControls::FlightSimulationDevice => "Flight Simulation Device",
1557            SimulationControls::AutomobileSimulationDevice => "Automobile Simulation Device",
1558            SimulationControls::TankSimulationDevice => "Tank Simulation Device",
1559            SimulationControls::SpaceshipSimulationDevice => "Spaceship Simulation Device",
1560            SimulationControls::SubmarineSimulationDevice => "Submarine Simulation Device",
1561            SimulationControls::SailingSimulationDevice => "Sailing Simulation Device",
1562            SimulationControls::MotorcycleSimulationDevice => "Motorcycle Simulation Device",
1563            SimulationControls::SportsSimulationDevice => "Sports Simulation Device",
1564            SimulationControls::AirplaneSimulationDevice => "Airplane Simulation Device",
1565            SimulationControls::HelicopterSimulationDevice => "Helicopter Simulation Device",
1566            SimulationControls::MagicCarpetSimulationDevice => "Magic Carpet Simulation Device",
1567            SimulationControls::BicycleSimulationDevice => "Bicycle Simulation Device",
1568            SimulationControls::FlightControlStick => "Flight Control Stick",
1569            SimulationControls::FlightStick => "Flight Stick",
1570            SimulationControls::CyclicControl => "Cyclic Control",
1571            SimulationControls::CyclicTrim => "Cyclic Trim",
1572            SimulationControls::FlightYoke => "Flight Yoke",
1573            SimulationControls::TrackControl => "Track Control",
1574            SimulationControls::Aileron => "Aileron",
1575            SimulationControls::AileronTrim => "Aileron Trim",
1576            SimulationControls::AntiTorqueControl => "Anti-Torque Control",
1577            SimulationControls::AutopilotEnable => "Autopilot Enable",
1578            SimulationControls::ChaffRelease => "Chaff Release",
1579            SimulationControls::CollectiveControl => "Collective Control",
1580            SimulationControls::DiveBrake => "Dive Brake",
1581            SimulationControls::ElectronicCountermeasures => "Electronic Countermeasures",
1582            SimulationControls::Elevator => "Elevator",
1583            SimulationControls::ElevatorTrim => "Elevator Trim",
1584            SimulationControls::Rudder => "Rudder",
1585            SimulationControls::Throttle => "Throttle",
1586            SimulationControls::FlightCommunications => "Flight Communications",
1587            SimulationControls::FlareRelease => "Flare Release",
1588            SimulationControls::LandingGear => "Landing Gear",
1589            SimulationControls::ToeBrake => "Toe Brake",
1590            SimulationControls::Trigger => "Trigger",
1591            SimulationControls::WeaponsArm => "Weapons Arm",
1592            SimulationControls::WeaponsSelect => "Weapons Select",
1593            SimulationControls::WingFlaps => "Wing Flaps",
1594            SimulationControls::Accelerator => "Accelerator",
1595            SimulationControls::Brake => "Brake",
1596            SimulationControls::Clutch => "Clutch",
1597            SimulationControls::Shifter => "Shifter",
1598            SimulationControls::Steering => "Steering",
1599            SimulationControls::TurretDirection => "Turret Direction",
1600            SimulationControls::BarrelElevation => "Barrel Elevation",
1601            SimulationControls::DivePlane => "Dive Plane",
1602            SimulationControls::Ballast => "Ballast",
1603            SimulationControls::BicycleCrank => "Bicycle Crank",
1604            SimulationControls::HandleBars => "Handle Bars",
1605            SimulationControls::FrontBrake => "Front Brake",
1606            SimulationControls::RearBrake => "Rear Brake",
1607        }
1608        .into()
1609    }
1610}
1611
1612#[cfg(feature = "std")]
1613impl fmt::Display for SimulationControls {
1614    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1615        write!(f, "{}", self.name())
1616    }
1617}
1618
1619impl AsUsage for SimulationControls {
1620    /// Returns the 32 bit Usage value of this Usage
1621    fn usage_value(&self) -> u32 {
1622        u32::from(self)
1623    }
1624
1625    /// Returns the 16 bit Usage ID value of this Usage
1626    fn usage_id_value(&self) -> u16 {
1627        u16::from(self)
1628    }
1629
1630    /// Returns this usage as [Usage::SimulationControls(self)](Usage::SimulationControls)
1631    /// This is a convenience function to avoid having
1632    /// to implement `From` for every used type in the caller.
1633    ///
1634    /// ```
1635    /// # use hut::*;
1636    /// let gd_x = GenericDesktop::X;
1637    /// let usage = Usage::from(GenericDesktop::X);
1638    /// assert!(matches!(gd_x.usage(), usage));
1639    /// ```
1640    fn usage(&self) -> Usage {
1641        Usage::from(self)
1642    }
1643}
1644
1645impl AsUsagePage for SimulationControls {
1646    /// Returns the 16 bit value of this UsagePage
1647    ///
1648    /// This value is `0x2` for [SimulationControls]
1649    fn usage_page_value(&self) -> u16 {
1650        let up = UsagePage::from(self);
1651        u16::from(up)
1652    }
1653
1654    /// Returns [UsagePage::SimulationControls]]
1655    fn usage_page(&self) -> UsagePage {
1656        UsagePage::from(self)
1657    }
1658}
1659
1660impl From<&SimulationControls> for u16 {
1661    fn from(simulationcontrols: &SimulationControls) -> u16 {
1662        match *simulationcontrols {
1663            SimulationControls::FlightSimulationDevice => 1,
1664            SimulationControls::AutomobileSimulationDevice => 2,
1665            SimulationControls::TankSimulationDevice => 3,
1666            SimulationControls::SpaceshipSimulationDevice => 4,
1667            SimulationControls::SubmarineSimulationDevice => 5,
1668            SimulationControls::SailingSimulationDevice => 6,
1669            SimulationControls::MotorcycleSimulationDevice => 7,
1670            SimulationControls::SportsSimulationDevice => 8,
1671            SimulationControls::AirplaneSimulationDevice => 9,
1672            SimulationControls::HelicopterSimulationDevice => 10,
1673            SimulationControls::MagicCarpetSimulationDevice => 11,
1674            SimulationControls::BicycleSimulationDevice => 12,
1675            SimulationControls::FlightControlStick => 32,
1676            SimulationControls::FlightStick => 33,
1677            SimulationControls::CyclicControl => 34,
1678            SimulationControls::CyclicTrim => 35,
1679            SimulationControls::FlightYoke => 36,
1680            SimulationControls::TrackControl => 37,
1681            SimulationControls::Aileron => 176,
1682            SimulationControls::AileronTrim => 177,
1683            SimulationControls::AntiTorqueControl => 178,
1684            SimulationControls::AutopilotEnable => 179,
1685            SimulationControls::ChaffRelease => 180,
1686            SimulationControls::CollectiveControl => 181,
1687            SimulationControls::DiveBrake => 182,
1688            SimulationControls::ElectronicCountermeasures => 183,
1689            SimulationControls::Elevator => 184,
1690            SimulationControls::ElevatorTrim => 185,
1691            SimulationControls::Rudder => 186,
1692            SimulationControls::Throttle => 187,
1693            SimulationControls::FlightCommunications => 188,
1694            SimulationControls::FlareRelease => 189,
1695            SimulationControls::LandingGear => 190,
1696            SimulationControls::ToeBrake => 191,
1697            SimulationControls::Trigger => 192,
1698            SimulationControls::WeaponsArm => 193,
1699            SimulationControls::WeaponsSelect => 194,
1700            SimulationControls::WingFlaps => 195,
1701            SimulationControls::Accelerator => 196,
1702            SimulationControls::Brake => 197,
1703            SimulationControls::Clutch => 198,
1704            SimulationControls::Shifter => 199,
1705            SimulationControls::Steering => 200,
1706            SimulationControls::TurretDirection => 201,
1707            SimulationControls::BarrelElevation => 202,
1708            SimulationControls::DivePlane => 203,
1709            SimulationControls::Ballast => 204,
1710            SimulationControls::BicycleCrank => 205,
1711            SimulationControls::HandleBars => 206,
1712            SimulationControls::FrontBrake => 207,
1713            SimulationControls::RearBrake => 208,
1714        }
1715    }
1716}
1717
1718impl From<SimulationControls> for u16 {
1719    /// Returns the 16bit value of this usage. This is identical
1720    /// to [SimulationControls::usage_page_value()].
1721    fn from(simulationcontrols: SimulationControls) -> u16 {
1722        u16::from(&simulationcontrols)
1723    }
1724}
1725
1726impl From<&SimulationControls> for u32 {
1727    /// Returns the 32 bit value of this usage. This is identical
1728    /// to [SimulationControls::usage_value()].
1729    fn from(simulationcontrols: &SimulationControls) -> u32 {
1730        let up = UsagePage::from(simulationcontrols);
1731        let up = (u16::from(&up) as u32) << 16;
1732        let id = u16::from(simulationcontrols) as u32;
1733        up | id
1734    }
1735}
1736
1737impl From<&SimulationControls> for UsagePage {
1738    /// Always returns [UsagePage::SimulationControls] and is
1739    /// identical to [SimulationControls::usage_page()].
1740    fn from(_: &SimulationControls) -> UsagePage {
1741        UsagePage::SimulationControls
1742    }
1743}
1744
1745impl From<SimulationControls> for UsagePage {
1746    /// Always returns [UsagePage::SimulationControls] and is
1747    /// identical to [SimulationControls::usage_page()].
1748    fn from(_: SimulationControls) -> UsagePage {
1749        UsagePage::SimulationControls
1750    }
1751}
1752
1753impl From<&SimulationControls> for Usage {
1754    fn from(simulationcontrols: &SimulationControls) -> Usage {
1755        Usage::try_from(u32::from(simulationcontrols)).unwrap()
1756    }
1757}
1758
1759impl From<SimulationControls> for Usage {
1760    fn from(simulationcontrols: SimulationControls) -> Usage {
1761        Usage::from(&simulationcontrols)
1762    }
1763}
1764
1765impl TryFrom<u16> for SimulationControls {
1766    type Error = HutError;
1767
1768    fn try_from(usage_id: u16) -> Result<SimulationControls> {
1769        match usage_id {
1770            1 => Ok(SimulationControls::FlightSimulationDevice),
1771            2 => Ok(SimulationControls::AutomobileSimulationDevice),
1772            3 => Ok(SimulationControls::TankSimulationDevice),
1773            4 => Ok(SimulationControls::SpaceshipSimulationDevice),
1774            5 => Ok(SimulationControls::SubmarineSimulationDevice),
1775            6 => Ok(SimulationControls::SailingSimulationDevice),
1776            7 => Ok(SimulationControls::MotorcycleSimulationDevice),
1777            8 => Ok(SimulationControls::SportsSimulationDevice),
1778            9 => Ok(SimulationControls::AirplaneSimulationDevice),
1779            10 => Ok(SimulationControls::HelicopterSimulationDevice),
1780            11 => Ok(SimulationControls::MagicCarpetSimulationDevice),
1781            12 => Ok(SimulationControls::BicycleSimulationDevice),
1782            32 => Ok(SimulationControls::FlightControlStick),
1783            33 => Ok(SimulationControls::FlightStick),
1784            34 => Ok(SimulationControls::CyclicControl),
1785            35 => Ok(SimulationControls::CyclicTrim),
1786            36 => Ok(SimulationControls::FlightYoke),
1787            37 => Ok(SimulationControls::TrackControl),
1788            176 => Ok(SimulationControls::Aileron),
1789            177 => Ok(SimulationControls::AileronTrim),
1790            178 => Ok(SimulationControls::AntiTorqueControl),
1791            179 => Ok(SimulationControls::AutopilotEnable),
1792            180 => Ok(SimulationControls::ChaffRelease),
1793            181 => Ok(SimulationControls::CollectiveControl),
1794            182 => Ok(SimulationControls::DiveBrake),
1795            183 => Ok(SimulationControls::ElectronicCountermeasures),
1796            184 => Ok(SimulationControls::Elevator),
1797            185 => Ok(SimulationControls::ElevatorTrim),
1798            186 => Ok(SimulationControls::Rudder),
1799            187 => Ok(SimulationControls::Throttle),
1800            188 => Ok(SimulationControls::FlightCommunications),
1801            189 => Ok(SimulationControls::FlareRelease),
1802            190 => Ok(SimulationControls::LandingGear),
1803            191 => Ok(SimulationControls::ToeBrake),
1804            192 => Ok(SimulationControls::Trigger),
1805            193 => Ok(SimulationControls::WeaponsArm),
1806            194 => Ok(SimulationControls::WeaponsSelect),
1807            195 => Ok(SimulationControls::WingFlaps),
1808            196 => Ok(SimulationControls::Accelerator),
1809            197 => Ok(SimulationControls::Brake),
1810            198 => Ok(SimulationControls::Clutch),
1811            199 => Ok(SimulationControls::Shifter),
1812            200 => Ok(SimulationControls::Steering),
1813            201 => Ok(SimulationControls::TurretDirection),
1814            202 => Ok(SimulationControls::BarrelElevation),
1815            203 => Ok(SimulationControls::DivePlane),
1816            204 => Ok(SimulationControls::Ballast),
1817            205 => Ok(SimulationControls::BicycleCrank),
1818            206 => Ok(SimulationControls::HandleBars),
1819            207 => Ok(SimulationControls::FrontBrake),
1820            208 => Ok(SimulationControls::RearBrake),
1821            n => Err(HutError::UnknownUsageId { usage_id: n }),
1822        }
1823    }
1824}
1825
1826impl BitOr<u16> for SimulationControls {
1827    type Output = Usage;
1828
1829    /// A convenience function to combine a Usage Page with
1830    /// a value.
1831    ///
1832    /// This function panics if the Usage ID value results in
1833    /// an unknown Usage. Where error checking is required,
1834    /// use [UsagePage::to_usage_from_value].
1835    fn bitor(self, usage: u16) -> Usage {
1836        let up = u16::from(self) as u32;
1837        let u = usage as u32;
1838        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
1839    }
1840}
1841
1842/// *Usage Page `0x3`: "VR Controls"*
1843///
1844/// **This enum is autogenerated from the HID Usage Tables**.
1845/// ```
1846/// # use hut::*;
1847/// let u1 = Usage::VRControls(VRControls::BodySuit);
1848/// let u2 = Usage::new_from_page_and_id(0x3, 0x2).unwrap();
1849/// let u3 = Usage::from(VRControls::BodySuit);
1850/// let u4: Usage = VRControls::BodySuit.into();
1851/// assert_eq!(u1, u2);
1852/// assert_eq!(u1, u3);
1853/// assert_eq!(u1, u4);
1854///
1855/// assert!(matches!(u1.usage_page(), UsagePage::VRControls));
1856/// assert_eq!(0x3, u1.usage_page_value());
1857/// assert_eq!(0x2, u1.usage_id_value());
1858/// assert_eq!((0x3 << 16) | 0x2, u1.usage_value());
1859/// assert_eq!("Body Suit", u1.name());
1860/// ```
1861///
1862#[allow(non_camel_case_types)]
1863#[derive(Debug)]
1864#[non_exhaustive]
1865pub enum VRControls {
1866    /// Usage ID `0x1`: "Belt"
1867    Belt,
1868    /// Usage ID `0x2`: "Body Suit"
1869    BodySuit,
1870    /// Usage ID `0x3`: "Flexor"
1871    Flexor,
1872    /// Usage ID `0x4`: "Glove"
1873    Glove,
1874    /// Usage ID `0x5`: "Head Tracker"
1875    HeadTracker,
1876    /// Usage ID `0x6`: "Head Mounted Display"
1877    HeadMountedDisplay,
1878    /// Usage ID `0x7`: "Hand Tracker"
1879    HandTracker,
1880    /// Usage ID `0x8`: "Oculometer"
1881    Oculometer,
1882    /// Usage ID `0x9`: "Vest"
1883    Vest,
1884    /// Usage ID `0xA`: "Animatronic Device"
1885    AnimatronicDevice,
1886    /// Usage ID `0x20`: "Stereo Enable"
1887    StereoEnable,
1888    /// Usage ID `0x21`: "Display Enable"
1889    DisplayEnable,
1890}
1891
1892impl VRControls {
1893    #[cfg(feature = "std")]
1894    pub fn name(&self) -> String {
1895        match self {
1896            VRControls::Belt => "Belt",
1897            VRControls::BodySuit => "Body Suit",
1898            VRControls::Flexor => "Flexor",
1899            VRControls::Glove => "Glove",
1900            VRControls::HeadTracker => "Head Tracker",
1901            VRControls::HeadMountedDisplay => "Head Mounted Display",
1902            VRControls::HandTracker => "Hand Tracker",
1903            VRControls::Oculometer => "Oculometer",
1904            VRControls::Vest => "Vest",
1905            VRControls::AnimatronicDevice => "Animatronic Device",
1906            VRControls::StereoEnable => "Stereo Enable",
1907            VRControls::DisplayEnable => "Display Enable",
1908        }
1909        .into()
1910    }
1911}
1912
1913#[cfg(feature = "std")]
1914impl fmt::Display for VRControls {
1915    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1916        write!(f, "{}", self.name())
1917    }
1918}
1919
1920impl AsUsage for VRControls {
1921    /// Returns the 32 bit Usage value of this Usage
1922    fn usage_value(&self) -> u32 {
1923        u32::from(self)
1924    }
1925
1926    /// Returns the 16 bit Usage ID value of this Usage
1927    fn usage_id_value(&self) -> u16 {
1928        u16::from(self)
1929    }
1930
1931    /// Returns this usage as [Usage::VRControls(self)](Usage::VRControls)
1932    /// This is a convenience function to avoid having
1933    /// to implement `From` for every used type in the caller.
1934    ///
1935    /// ```
1936    /// # use hut::*;
1937    /// let gd_x = GenericDesktop::X;
1938    /// let usage = Usage::from(GenericDesktop::X);
1939    /// assert!(matches!(gd_x.usage(), usage));
1940    /// ```
1941    fn usage(&self) -> Usage {
1942        Usage::from(self)
1943    }
1944}
1945
1946impl AsUsagePage for VRControls {
1947    /// Returns the 16 bit value of this UsagePage
1948    ///
1949    /// This value is `0x3` for [VRControls]
1950    fn usage_page_value(&self) -> u16 {
1951        let up = UsagePage::from(self);
1952        u16::from(up)
1953    }
1954
1955    /// Returns [UsagePage::VRControls]]
1956    fn usage_page(&self) -> UsagePage {
1957        UsagePage::from(self)
1958    }
1959}
1960
1961impl From<&VRControls> for u16 {
1962    fn from(vrcontrols: &VRControls) -> u16 {
1963        match *vrcontrols {
1964            VRControls::Belt => 1,
1965            VRControls::BodySuit => 2,
1966            VRControls::Flexor => 3,
1967            VRControls::Glove => 4,
1968            VRControls::HeadTracker => 5,
1969            VRControls::HeadMountedDisplay => 6,
1970            VRControls::HandTracker => 7,
1971            VRControls::Oculometer => 8,
1972            VRControls::Vest => 9,
1973            VRControls::AnimatronicDevice => 10,
1974            VRControls::StereoEnable => 32,
1975            VRControls::DisplayEnable => 33,
1976        }
1977    }
1978}
1979
1980impl From<VRControls> for u16 {
1981    /// Returns the 16bit value of this usage. This is identical
1982    /// to [VRControls::usage_page_value()].
1983    fn from(vrcontrols: VRControls) -> u16 {
1984        u16::from(&vrcontrols)
1985    }
1986}
1987
1988impl From<&VRControls> for u32 {
1989    /// Returns the 32 bit value of this usage. This is identical
1990    /// to [VRControls::usage_value()].
1991    fn from(vrcontrols: &VRControls) -> u32 {
1992        let up = UsagePage::from(vrcontrols);
1993        let up = (u16::from(&up) as u32) << 16;
1994        let id = u16::from(vrcontrols) as u32;
1995        up | id
1996    }
1997}
1998
1999impl From<&VRControls> for UsagePage {
2000    /// Always returns [UsagePage::VRControls] and is
2001    /// identical to [VRControls::usage_page()].
2002    fn from(_: &VRControls) -> UsagePage {
2003        UsagePage::VRControls
2004    }
2005}
2006
2007impl From<VRControls> for UsagePage {
2008    /// Always returns [UsagePage::VRControls] and is
2009    /// identical to [VRControls::usage_page()].
2010    fn from(_: VRControls) -> UsagePage {
2011        UsagePage::VRControls
2012    }
2013}
2014
2015impl From<&VRControls> for Usage {
2016    fn from(vrcontrols: &VRControls) -> Usage {
2017        Usage::try_from(u32::from(vrcontrols)).unwrap()
2018    }
2019}
2020
2021impl From<VRControls> for Usage {
2022    fn from(vrcontrols: VRControls) -> Usage {
2023        Usage::from(&vrcontrols)
2024    }
2025}
2026
2027impl TryFrom<u16> for VRControls {
2028    type Error = HutError;
2029
2030    fn try_from(usage_id: u16) -> Result<VRControls> {
2031        match usage_id {
2032            1 => Ok(VRControls::Belt),
2033            2 => Ok(VRControls::BodySuit),
2034            3 => Ok(VRControls::Flexor),
2035            4 => Ok(VRControls::Glove),
2036            5 => Ok(VRControls::HeadTracker),
2037            6 => Ok(VRControls::HeadMountedDisplay),
2038            7 => Ok(VRControls::HandTracker),
2039            8 => Ok(VRControls::Oculometer),
2040            9 => Ok(VRControls::Vest),
2041            10 => Ok(VRControls::AnimatronicDevice),
2042            32 => Ok(VRControls::StereoEnable),
2043            33 => Ok(VRControls::DisplayEnable),
2044            n => Err(HutError::UnknownUsageId { usage_id: n }),
2045        }
2046    }
2047}
2048
2049impl BitOr<u16> for VRControls {
2050    type Output = Usage;
2051
2052    /// A convenience function to combine a Usage Page with
2053    /// a value.
2054    ///
2055    /// This function panics if the Usage ID value results in
2056    /// an unknown Usage. Where error checking is required,
2057    /// use [UsagePage::to_usage_from_value].
2058    fn bitor(self, usage: u16) -> Usage {
2059        let up = u16::from(self) as u32;
2060        let u = usage as u32;
2061        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
2062    }
2063}
2064
2065/// *Usage Page `0x4`: "Sport Controls"*
2066///
2067/// **This enum is autogenerated from the HID Usage Tables**.
2068/// ```
2069/// # use hut::*;
2070/// let u1 = Usage::SportControls(SportControls::GolfClub);
2071/// let u2 = Usage::new_from_page_and_id(0x4, 0x2).unwrap();
2072/// let u3 = Usage::from(SportControls::GolfClub);
2073/// let u4: Usage = SportControls::GolfClub.into();
2074/// assert_eq!(u1, u2);
2075/// assert_eq!(u1, u3);
2076/// assert_eq!(u1, u4);
2077///
2078/// assert!(matches!(u1.usage_page(), UsagePage::SportControls));
2079/// assert_eq!(0x4, u1.usage_page_value());
2080/// assert_eq!(0x2, u1.usage_id_value());
2081/// assert_eq!((0x4 << 16) | 0x2, u1.usage_value());
2082/// assert_eq!("Golf Club", u1.name());
2083/// ```
2084///
2085#[allow(non_camel_case_types)]
2086#[derive(Debug)]
2087#[non_exhaustive]
2088pub enum SportControls {
2089    /// Usage ID `0x1`: "Baseball Bat"
2090    BaseballBat,
2091    /// Usage ID `0x2`: "Golf Club"
2092    GolfClub,
2093    /// Usage ID `0x3`: "Rowing Machine"
2094    RowingMachine,
2095    /// Usage ID `0x4`: "Treadmill"
2096    Treadmill,
2097    /// Usage ID `0x30`: "Oar"
2098    Oar,
2099    /// Usage ID `0x31`: "Slope"
2100    Slope,
2101    /// Usage ID `0x32`: "Rate"
2102    Rate,
2103    /// Usage ID `0x33`: "Stick Speed"
2104    StickSpeed,
2105    /// Usage ID `0x34`: "Stick Face Angle"
2106    StickFaceAngle,
2107    /// Usage ID `0x35`: "Stick Heel/Toe"
2108    StickHeelToe,
2109    /// Usage ID `0x36`: "Stick Follow Through"
2110    StickFollowThrough,
2111    /// Usage ID `0x37`: "Stick Tempo"
2112    StickTempo,
2113    /// Usage ID `0x38`: "Stick Type"
2114    StickType,
2115    /// Usage ID `0x39`: "Stick Height"
2116    StickHeight,
2117    /// Usage ID `0x50`: "Putter"
2118    Putter,
2119    /// Usage ID `0x51`: "1 Iron"
2120    OneIron,
2121    /// Usage ID `0x52`: "2 Iron"
2122    TwoIron,
2123    /// Usage ID `0x53`: "3 Iron"
2124    ThreeIron,
2125    /// Usage ID `0x54`: "4 Iron"
2126    FourIron,
2127    /// Usage ID `0x55`: "5 Iron"
2128    FiveIron,
2129    /// Usage ID `0x56`: "6 Iron"
2130    SixIron,
2131    /// Usage ID `0x57`: "7 Iron"
2132    SevenIron,
2133    /// Usage ID `0x58`: "8 Iron"
2134    EightIron,
2135    /// Usage ID `0x59`: "9 Iron"
2136    NineIron,
2137    /// Usage ID `0x5A`: "10 Iron"
2138    One0Iron,
2139    /// Usage ID `0x5B`: "11 Iron"
2140    One1Iron,
2141    /// Usage ID `0x5C`: "Sand Wedge"
2142    SandWedge,
2143    /// Usage ID `0x5D`: "Loft Wedge"
2144    LoftWedge,
2145    /// Usage ID `0x5E`: "Power Wedge"
2146    PowerWedge,
2147    /// Usage ID `0x5F`: "1 Wood"
2148    OneWood,
2149    /// Usage ID `0x60`: "3 Wood"
2150    ThreeWood,
2151    /// Usage ID `0x61`: "5 Wood"
2152    FiveWood,
2153    /// Usage ID `0x62`: "7 Wood"
2154    SevenWood,
2155    /// Usage ID `0x63`: "9 Wood"
2156    NineWood,
2157}
2158
2159impl SportControls {
2160    #[cfg(feature = "std")]
2161    pub fn name(&self) -> String {
2162        match self {
2163            SportControls::BaseballBat => "Baseball Bat",
2164            SportControls::GolfClub => "Golf Club",
2165            SportControls::RowingMachine => "Rowing Machine",
2166            SportControls::Treadmill => "Treadmill",
2167            SportControls::Oar => "Oar",
2168            SportControls::Slope => "Slope",
2169            SportControls::Rate => "Rate",
2170            SportControls::StickSpeed => "Stick Speed",
2171            SportControls::StickFaceAngle => "Stick Face Angle",
2172            SportControls::StickHeelToe => "Stick Heel/Toe",
2173            SportControls::StickFollowThrough => "Stick Follow Through",
2174            SportControls::StickTempo => "Stick Tempo",
2175            SportControls::StickType => "Stick Type",
2176            SportControls::StickHeight => "Stick Height",
2177            SportControls::Putter => "Putter",
2178            SportControls::OneIron => "1 Iron",
2179            SportControls::TwoIron => "2 Iron",
2180            SportControls::ThreeIron => "3 Iron",
2181            SportControls::FourIron => "4 Iron",
2182            SportControls::FiveIron => "5 Iron",
2183            SportControls::SixIron => "6 Iron",
2184            SportControls::SevenIron => "7 Iron",
2185            SportControls::EightIron => "8 Iron",
2186            SportControls::NineIron => "9 Iron",
2187            SportControls::One0Iron => "10 Iron",
2188            SportControls::One1Iron => "11 Iron",
2189            SportControls::SandWedge => "Sand Wedge",
2190            SportControls::LoftWedge => "Loft Wedge",
2191            SportControls::PowerWedge => "Power Wedge",
2192            SportControls::OneWood => "1 Wood",
2193            SportControls::ThreeWood => "3 Wood",
2194            SportControls::FiveWood => "5 Wood",
2195            SportControls::SevenWood => "7 Wood",
2196            SportControls::NineWood => "9 Wood",
2197        }
2198        .into()
2199    }
2200}
2201
2202#[cfg(feature = "std")]
2203impl fmt::Display for SportControls {
2204    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2205        write!(f, "{}", self.name())
2206    }
2207}
2208
2209impl AsUsage for SportControls {
2210    /// Returns the 32 bit Usage value of this Usage
2211    fn usage_value(&self) -> u32 {
2212        u32::from(self)
2213    }
2214
2215    /// Returns the 16 bit Usage ID value of this Usage
2216    fn usage_id_value(&self) -> u16 {
2217        u16::from(self)
2218    }
2219
2220    /// Returns this usage as [Usage::SportControls(self)](Usage::SportControls)
2221    /// This is a convenience function to avoid having
2222    /// to implement `From` for every used type in the caller.
2223    ///
2224    /// ```
2225    /// # use hut::*;
2226    /// let gd_x = GenericDesktop::X;
2227    /// let usage = Usage::from(GenericDesktop::X);
2228    /// assert!(matches!(gd_x.usage(), usage));
2229    /// ```
2230    fn usage(&self) -> Usage {
2231        Usage::from(self)
2232    }
2233}
2234
2235impl AsUsagePage for SportControls {
2236    /// Returns the 16 bit value of this UsagePage
2237    ///
2238    /// This value is `0x4` for [SportControls]
2239    fn usage_page_value(&self) -> u16 {
2240        let up = UsagePage::from(self);
2241        u16::from(up)
2242    }
2243
2244    /// Returns [UsagePage::SportControls]]
2245    fn usage_page(&self) -> UsagePage {
2246        UsagePage::from(self)
2247    }
2248}
2249
2250impl From<&SportControls> for u16 {
2251    fn from(sportcontrols: &SportControls) -> u16 {
2252        match *sportcontrols {
2253            SportControls::BaseballBat => 1,
2254            SportControls::GolfClub => 2,
2255            SportControls::RowingMachine => 3,
2256            SportControls::Treadmill => 4,
2257            SportControls::Oar => 48,
2258            SportControls::Slope => 49,
2259            SportControls::Rate => 50,
2260            SportControls::StickSpeed => 51,
2261            SportControls::StickFaceAngle => 52,
2262            SportControls::StickHeelToe => 53,
2263            SportControls::StickFollowThrough => 54,
2264            SportControls::StickTempo => 55,
2265            SportControls::StickType => 56,
2266            SportControls::StickHeight => 57,
2267            SportControls::Putter => 80,
2268            SportControls::OneIron => 81,
2269            SportControls::TwoIron => 82,
2270            SportControls::ThreeIron => 83,
2271            SportControls::FourIron => 84,
2272            SportControls::FiveIron => 85,
2273            SportControls::SixIron => 86,
2274            SportControls::SevenIron => 87,
2275            SportControls::EightIron => 88,
2276            SportControls::NineIron => 89,
2277            SportControls::One0Iron => 90,
2278            SportControls::One1Iron => 91,
2279            SportControls::SandWedge => 92,
2280            SportControls::LoftWedge => 93,
2281            SportControls::PowerWedge => 94,
2282            SportControls::OneWood => 95,
2283            SportControls::ThreeWood => 96,
2284            SportControls::FiveWood => 97,
2285            SportControls::SevenWood => 98,
2286            SportControls::NineWood => 99,
2287        }
2288    }
2289}
2290
2291impl From<SportControls> for u16 {
2292    /// Returns the 16bit value of this usage. This is identical
2293    /// to [SportControls::usage_page_value()].
2294    fn from(sportcontrols: SportControls) -> u16 {
2295        u16::from(&sportcontrols)
2296    }
2297}
2298
2299impl From<&SportControls> for u32 {
2300    /// Returns the 32 bit value of this usage. This is identical
2301    /// to [SportControls::usage_value()].
2302    fn from(sportcontrols: &SportControls) -> u32 {
2303        let up = UsagePage::from(sportcontrols);
2304        let up = (u16::from(&up) as u32) << 16;
2305        let id = u16::from(sportcontrols) as u32;
2306        up | id
2307    }
2308}
2309
2310impl From<&SportControls> for UsagePage {
2311    /// Always returns [UsagePage::SportControls] and is
2312    /// identical to [SportControls::usage_page()].
2313    fn from(_: &SportControls) -> UsagePage {
2314        UsagePage::SportControls
2315    }
2316}
2317
2318impl From<SportControls> for UsagePage {
2319    /// Always returns [UsagePage::SportControls] and is
2320    /// identical to [SportControls::usage_page()].
2321    fn from(_: SportControls) -> UsagePage {
2322        UsagePage::SportControls
2323    }
2324}
2325
2326impl From<&SportControls> for Usage {
2327    fn from(sportcontrols: &SportControls) -> Usage {
2328        Usage::try_from(u32::from(sportcontrols)).unwrap()
2329    }
2330}
2331
2332impl From<SportControls> for Usage {
2333    fn from(sportcontrols: SportControls) -> Usage {
2334        Usage::from(&sportcontrols)
2335    }
2336}
2337
2338impl TryFrom<u16> for SportControls {
2339    type Error = HutError;
2340
2341    fn try_from(usage_id: u16) -> Result<SportControls> {
2342        match usage_id {
2343            1 => Ok(SportControls::BaseballBat),
2344            2 => Ok(SportControls::GolfClub),
2345            3 => Ok(SportControls::RowingMachine),
2346            4 => Ok(SportControls::Treadmill),
2347            48 => Ok(SportControls::Oar),
2348            49 => Ok(SportControls::Slope),
2349            50 => Ok(SportControls::Rate),
2350            51 => Ok(SportControls::StickSpeed),
2351            52 => Ok(SportControls::StickFaceAngle),
2352            53 => Ok(SportControls::StickHeelToe),
2353            54 => Ok(SportControls::StickFollowThrough),
2354            55 => Ok(SportControls::StickTempo),
2355            56 => Ok(SportControls::StickType),
2356            57 => Ok(SportControls::StickHeight),
2357            80 => Ok(SportControls::Putter),
2358            81 => Ok(SportControls::OneIron),
2359            82 => Ok(SportControls::TwoIron),
2360            83 => Ok(SportControls::ThreeIron),
2361            84 => Ok(SportControls::FourIron),
2362            85 => Ok(SportControls::FiveIron),
2363            86 => Ok(SportControls::SixIron),
2364            87 => Ok(SportControls::SevenIron),
2365            88 => Ok(SportControls::EightIron),
2366            89 => Ok(SportControls::NineIron),
2367            90 => Ok(SportControls::One0Iron),
2368            91 => Ok(SportControls::One1Iron),
2369            92 => Ok(SportControls::SandWedge),
2370            93 => Ok(SportControls::LoftWedge),
2371            94 => Ok(SportControls::PowerWedge),
2372            95 => Ok(SportControls::OneWood),
2373            96 => Ok(SportControls::ThreeWood),
2374            97 => Ok(SportControls::FiveWood),
2375            98 => Ok(SportControls::SevenWood),
2376            99 => Ok(SportControls::NineWood),
2377            n => Err(HutError::UnknownUsageId { usage_id: n }),
2378        }
2379    }
2380}
2381
2382impl BitOr<u16> for SportControls {
2383    type Output = Usage;
2384
2385    /// A convenience function to combine a Usage Page with
2386    /// a value.
2387    ///
2388    /// This function panics if the Usage ID value results in
2389    /// an unknown Usage. Where error checking is required,
2390    /// use [UsagePage::to_usage_from_value].
2391    fn bitor(self, usage: u16) -> Usage {
2392        let up = u16::from(self) as u32;
2393        let u = usage as u32;
2394        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
2395    }
2396}
2397
2398/// *Usage Page `0x5`: "Game Controls"*
2399///
2400/// **This enum is autogenerated from the HID Usage Tables**.
2401/// ```
2402/// # use hut::*;
2403/// let u1 = Usage::GameControls(GameControls::PinballDevice);
2404/// let u2 = Usage::new_from_page_and_id(0x5, 0x2).unwrap();
2405/// let u3 = Usage::from(GameControls::PinballDevice);
2406/// let u4: Usage = GameControls::PinballDevice.into();
2407/// assert_eq!(u1, u2);
2408/// assert_eq!(u1, u3);
2409/// assert_eq!(u1, u4);
2410///
2411/// assert!(matches!(u1.usage_page(), UsagePage::GameControls));
2412/// assert_eq!(0x5, u1.usage_page_value());
2413/// assert_eq!(0x2, u1.usage_id_value());
2414/// assert_eq!((0x5 << 16) | 0x2, u1.usage_value());
2415/// assert_eq!("Pinball Device", u1.name());
2416/// ```
2417///
2418#[allow(non_camel_case_types)]
2419#[derive(Debug)]
2420#[non_exhaustive]
2421pub enum GameControls {
2422    /// Usage ID `0x1`: "3D Game Controller"
2423    ThreeDGameController,
2424    /// Usage ID `0x2`: "Pinball Device"
2425    PinballDevice,
2426    /// Usage ID `0x3`: "Gun Device"
2427    GunDevice,
2428    /// Usage ID `0x20`: "Point of View"
2429    PointofView,
2430    /// Usage ID `0x21`: "Turn Right/Left"
2431    TurnRightLeft,
2432    /// Usage ID `0x22`: "Pitch Forward/Backward"
2433    PitchForwardBackward,
2434    /// Usage ID `0x23`: "Roll Right/Left"
2435    RollRightLeft,
2436    /// Usage ID `0x24`: "Move Right/Left"
2437    MoveRightLeft,
2438    /// Usage ID `0x25`: "Move Forward/Backward"
2439    MoveForwardBackward,
2440    /// Usage ID `0x26`: "Move Up/Down"
2441    MoveUpDown,
2442    /// Usage ID `0x27`: "Lean Right/Left"
2443    LeanRightLeft,
2444    /// Usage ID `0x28`: "Lean Forward/Backward"
2445    LeanForwardBackward,
2446    /// Usage ID `0x29`: "Height of POV"
2447    HeightofPOV,
2448    /// Usage ID `0x2A`: "Flipper"
2449    Flipper,
2450    /// Usage ID `0x2B`: "Secondary Flipper"
2451    SecondaryFlipper,
2452    /// Usage ID `0x2C`: "Bump"
2453    Bump,
2454    /// Usage ID `0x2D`: "New Game"
2455    NewGame,
2456    /// Usage ID `0x2E`: "Shoot Ball"
2457    ShootBall,
2458    /// Usage ID `0x2F`: "Player"
2459    Player,
2460    /// Usage ID `0x30`: "Gun Bolt"
2461    GunBolt,
2462    /// Usage ID `0x31`: "Gun Clip"
2463    GunClip,
2464    /// Usage ID `0x32`: "Gun Selector"
2465    GunSelector,
2466    /// Usage ID `0x33`: "Gun Single Shot"
2467    GunSingleShot,
2468    /// Usage ID `0x34`: "Gun Burst"
2469    GunBurst,
2470    /// Usage ID `0x35`: "Gun Automatic"
2471    GunAutomatic,
2472    /// Usage ID `0x36`: "Gun Safety"
2473    GunSafety,
2474    /// Usage ID `0x37`: "Gamepad Fire/Jump"
2475    GamepadFireJump,
2476    /// Usage ID `0x39`: "Gamepad Trigger"
2477    GamepadTrigger,
2478    /// Usage ID `0x3A`: "Form-fitting Gamepad"
2479    FormfittingGamepad,
2480}
2481
2482impl GameControls {
2483    #[cfg(feature = "std")]
2484    pub fn name(&self) -> String {
2485        match self {
2486            GameControls::ThreeDGameController => "3D Game Controller",
2487            GameControls::PinballDevice => "Pinball Device",
2488            GameControls::GunDevice => "Gun Device",
2489            GameControls::PointofView => "Point of View",
2490            GameControls::TurnRightLeft => "Turn Right/Left",
2491            GameControls::PitchForwardBackward => "Pitch Forward/Backward",
2492            GameControls::RollRightLeft => "Roll Right/Left",
2493            GameControls::MoveRightLeft => "Move Right/Left",
2494            GameControls::MoveForwardBackward => "Move Forward/Backward",
2495            GameControls::MoveUpDown => "Move Up/Down",
2496            GameControls::LeanRightLeft => "Lean Right/Left",
2497            GameControls::LeanForwardBackward => "Lean Forward/Backward",
2498            GameControls::HeightofPOV => "Height of POV",
2499            GameControls::Flipper => "Flipper",
2500            GameControls::SecondaryFlipper => "Secondary Flipper",
2501            GameControls::Bump => "Bump",
2502            GameControls::NewGame => "New Game",
2503            GameControls::ShootBall => "Shoot Ball",
2504            GameControls::Player => "Player",
2505            GameControls::GunBolt => "Gun Bolt",
2506            GameControls::GunClip => "Gun Clip",
2507            GameControls::GunSelector => "Gun Selector",
2508            GameControls::GunSingleShot => "Gun Single Shot",
2509            GameControls::GunBurst => "Gun Burst",
2510            GameControls::GunAutomatic => "Gun Automatic",
2511            GameControls::GunSafety => "Gun Safety",
2512            GameControls::GamepadFireJump => "Gamepad Fire/Jump",
2513            GameControls::GamepadTrigger => "Gamepad Trigger",
2514            GameControls::FormfittingGamepad => "Form-fitting Gamepad",
2515        }
2516        .into()
2517    }
2518}
2519
2520#[cfg(feature = "std")]
2521impl fmt::Display for GameControls {
2522    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2523        write!(f, "{}", self.name())
2524    }
2525}
2526
2527impl AsUsage for GameControls {
2528    /// Returns the 32 bit Usage value of this Usage
2529    fn usage_value(&self) -> u32 {
2530        u32::from(self)
2531    }
2532
2533    /// Returns the 16 bit Usage ID value of this Usage
2534    fn usage_id_value(&self) -> u16 {
2535        u16::from(self)
2536    }
2537
2538    /// Returns this usage as [Usage::GameControls(self)](Usage::GameControls)
2539    /// This is a convenience function to avoid having
2540    /// to implement `From` for every used type in the caller.
2541    ///
2542    /// ```
2543    /// # use hut::*;
2544    /// let gd_x = GenericDesktop::X;
2545    /// let usage = Usage::from(GenericDesktop::X);
2546    /// assert!(matches!(gd_x.usage(), usage));
2547    /// ```
2548    fn usage(&self) -> Usage {
2549        Usage::from(self)
2550    }
2551}
2552
2553impl AsUsagePage for GameControls {
2554    /// Returns the 16 bit value of this UsagePage
2555    ///
2556    /// This value is `0x5` for [GameControls]
2557    fn usage_page_value(&self) -> u16 {
2558        let up = UsagePage::from(self);
2559        u16::from(up)
2560    }
2561
2562    /// Returns [UsagePage::GameControls]]
2563    fn usage_page(&self) -> UsagePage {
2564        UsagePage::from(self)
2565    }
2566}
2567
2568impl From<&GameControls> for u16 {
2569    fn from(gamecontrols: &GameControls) -> u16 {
2570        match *gamecontrols {
2571            GameControls::ThreeDGameController => 1,
2572            GameControls::PinballDevice => 2,
2573            GameControls::GunDevice => 3,
2574            GameControls::PointofView => 32,
2575            GameControls::TurnRightLeft => 33,
2576            GameControls::PitchForwardBackward => 34,
2577            GameControls::RollRightLeft => 35,
2578            GameControls::MoveRightLeft => 36,
2579            GameControls::MoveForwardBackward => 37,
2580            GameControls::MoveUpDown => 38,
2581            GameControls::LeanRightLeft => 39,
2582            GameControls::LeanForwardBackward => 40,
2583            GameControls::HeightofPOV => 41,
2584            GameControls::Flipper => 42,
2585            GameControls::SecondaryFlipper => 43,
2586            GameControls::Bump => 44,
2587            GameControls::NewGame => 45,
2588            GameControls::ShootBall => 46,
2589            GameControls::Player => 47,
2590            GameControls::GunBolt => 48,
2591            GameControls::GunClip => 49,
2592            GameControls::GunSelector => 50,
2593            GameControls::GunSingleShot => 51,
2594            GameControls::GunBurst => 52,
2595            GameControls::GunAutomatic => 53,
2596            GameControls::GunSafety => 54,
2597            GameControls::GamepadFireJump => 55,
2598            GameControls::GamepadTrigger => 57,
2599            GameControls::FormfittingGamepad => 58,
2600        }
2601    }
2602}
2603
2604impl From<GameControls> for u16 {
2605    /// Returns the 16bit value of this usage. This is identical
2606    /// to [GameControls::usage_page_value()].
2607    fn from(gamecontrols: GameControls) -> u16 {
2608        u16::from(&gamecontrols)
2609    }
2610}
2611
2612impl From<&GameControls> for u32 {
2613    /// Returns the 32 bit value of this usage. This is identical
2614    /// to [GameControls::usage_value()].
2615    fn from(gamecontrols: &GameControls) -> u32 {
2616        let up = UsagePage::from(gamecontrols);
2617        let up = (u16::from(&up) as u32) << 16;
2618        let id = u16::from(gamecontrols) as u32;
2619        up | id
2620    }
2621}
2622
2623impl From<&GameControls> for UsagePage {
2624    /// Always returns [UsagePage::GameControls] and is
2625    /// identical to [GameControls::usage_page()].
2626    fn from(_: &GameControls) -> UsagePage {
2627        UsagePage::GameControls
2628    }
2629}
2630
2631impl From<GameControls> for UsagePage {
2632    /// Always returns [UsagePage::GameControls] and is
2633    /// identical to [GameControls::usage_page()].
2634    fn from(_: GameControls) -> UsagePage {
2635        UsagePage::GameControls
2636    }
2637}
2638
2639impl From<&GameControls> for Usage {
2640    fn from(gamecontrols: &GameControls) -> Usage {
2641        Usage::try_from(u32::from(gamecontrols)).unwrap()
2642    }
2643}
2644
2645impl From<GameControls> for Usage {
2646    fn from(gamecontrols: GameControls) -> Usage {
2647        Usage::from(&gamecontrols)
2648    }
2649}
2650
2651impl TryFrom<u16> for GameControls {
2652    type Error = HutError;
2653
2654    fn try_from(usage_id: u16) -> Result<GameControls> {
2655        match usage_id {
2656            1 => Ok(GameControls::ThreeDGameController),
2657            2 => Ok(GameControls::PinballDevice),
2658            3 => Ok(GameControls::GunDevice),
2659            32 => Ok(GameControls::PointofView),
2660            33 => Ok(GameControls::TurnRightLeft),
2661            34 => Ok(GameControls::PitchForwardBackward),
2662            35 => Ok(GameControls::RollRightLeft),
2663            36 => Ok(GameControls::MoveRightLeft),
2664            37 => Ok(GameControls::MoveForwardBackward),
2665            38 => Ok(GameControls::MoveUpDown),
2666            39 => Ok(GameControls::LeanRightLeft),
2667            40 => Ok(GameControls::LeanForwardBackward),
2668            41 => Ok(GameControls::HeightofPOV),
2669            42 => Ok(GameControls::Flipper),
2670            43 => Ok(GameControls::SecondaryFlipper),
2671            44 => Ok(GameControls::Bump),
2672            45 => Ok(GameControls::NewGame),
2673            46 => Ok(GameControls::ShootBall),
2674            47 => Ok(GameControls::Player),
2675            48 => Ok(GameControls::GunBolt),
2676            49 => Ok(GameControls::GunClip),
2677            50 => Ok(GameControls::GunSelector),
2678            51 => Ok(GameControls::GunSingleShot),
2679            52 => Ok(GameControls::GunBurst),
2680            53 => Ok(GameControls::GunAutomatic),
2681            54 => Ok(GameControls::GunSafety),
2682            55 => Ok(GameControls::GamepadFireJump),
2683            57 => Ok(GameControls::GamepadTrigger),
2684            58 => Ok(GameControls::FormfittingGamepad),
2685            n => Err(HutError::UnknownUsageId { usage_id: n }),
2686        }
2687    }
2688}
2689
2690impl BitOr<u16> for GameControls {
2691    type Output = Usage;
2692
2693    /// A convenience function to combine a Usage Page with
2694    /// a value.
2695    ///
2696    /// This function panics if the Usage ID value results in
2697    /// an unknown Usage. Where error checking is required,
2698    /// use [UsagePage::to_usage_from_value].
2699    fn bitor(self, usage: u16) -> Usage {
2700        let up = u16::from(self) as u32;
2701        let u = usage as u32;
2702        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
2703    }
2704}
2705
2706/// *Usage Page `0x6`: "Generic Device Controls"*
2707///
2708/// **This enum is autogenerated from the HID Usage Tables**.
2709/// ```
2710/// # use hut::*;
2711/// let u1 = Usage::GenericDeviceControls(GenericDeviceControls::BatteryStrength);
2712/// let u2 = Usage::new_from_page_and_id(0x6, 0x20).unwrap();
2713/// let u3 = Usage::from(GenericDeviceControls::BatteryStrength);
2714/// let u4: Usage = GenericDeviceControls::BatteryStrength.into();
2715/// assert_eq!(u1, u2);
2716/// assert_eq!(u1, u3);
2717/// assert_eq!(u1, u4);
2718///
2719/// assert!(matches!(u1.usage_page(), UsagePage::GenericDeviceControls));
2720/// assert_eq!(0x6, u1.usage_page_value());
2721/// assert_eq!(0x20, u1.usage_id_value());
2722/// assert_eq!((0x6 << 16) | 0x20, u1.usage_value());
2723/// assert_eq!("Battery Strength", u1.name());
2724/// ```
2725///
2726#[allow(non_camel_case_types)]
2727#[derive(Debug)]
2728#[non_exhaustive]
2729pub enum GenericDeviceControls {
2730    /// Usage ID `0x1`: "Background/Nonuser Controls"
2731    BackgroundNonuserControls,
2732    /// Usage ID `0x20`: "Battery Strength"
2733    BatteryStrength,
2734    /// Usage ID `0x21`: "Wireless Channel"
2735    WirelessChannel,
2736    /// Usage ID `0x22`: "Wireless ID"
2737    WirelessID,
2738    /// Usage ID `0x23`: "Discover Wireless Control"
2739    DiscoverWirelessControl,
2740    /// Usage ID `0x24`: "Security Code Character Entered"
2741    SecurityCodeCharacterEntered,
2742    /// Usage ID `0x25`: "Security Code Character Erased"
2743    SecurityCodeCharacterErased,
2744    /// Usage ID `0x26`: "Security Code Cleared"
2745    SecurityCodeCleared,
2746    /// Usage ID `0x27`: "Sequence ID"
2747    SequenceID,
2748    /// Usage ID `0x28`: "Sequence ID Reset"
2749    SequenceIDReset,
2750    /// Usage ID `0x29`: "RF Signal Strength"
2751    RFSignalStrength,
2752    /// Usage ID `0x2A`: "Software Version"
2753    SoftwareVersion,
2754    /// Usage ID `0x2B`: "Protocol Version"
2755    ProtocolVersion,
2756    /// Usage ID `0x2C`: "Hardware Version"
2757    HardwareVersion,
2758    /// Usage ID `0x2D`: "Major"
2759    Major,
2760    /// Usage ID `0x2E`: "Minor"
2761    Minor,
2762    /// Usage ID `0x2F`: "Revision"
2763    Revision,
2764    /// Usage ID `0x30`: "Handedness"
2765    Handedness,
2766    /// Usage ID `0x31`: "Either Hand"
2767    EitherHand,
2768    /// Usage ID `0x32`: "Left Hand"
2769    LeftHand,
2770    /// Usage ID `0x33`: "Right Hand"
2771    RightHand,
2772    /// Usage ID `0x34`: "Both Hands"
2773    BothHands,
2774    /// Usage ID `0x40`: "Grip Pose Offset"
2775    GripPoseOffset,
2776    /// Usage ID `0x41`: "Pointer Pose Offset"
2777    PointerPoseOffset,
2778}
2779
2780impl GenericDeviceControls {
2781    #[cfg(feature = "std")]
2782    pub fn name(&self) -> String {
2783        match self {
2784            GenericDeviceControls::BackgroundNonuserControls => "Background/Nonuser Controls",
2785            GenericDeviceControls::BatteryStrength => "Battery Strength",
2786            GenericDeviceControls::WirelessChannel => "Wireless Channel",
2787            GenericDeviceControls::WirelessID => "Wireless ID",
2788            GenericDeviceControls::DiscoverWirelessControl => "Discover Wireless Control",
2789            GenericDeviceControls::SecurityCodeCharacterEntered => {
2790                "Security Code Character Entered"
2791            }
2792            GenericDeviceControls::SecurityCodeCharacterErased => "Security Code Character Erased",
2793            GenericDeviceControls::SecurityCodeCleared => "Security Code Cleared",
2794            GenericDeviceControls::SequenceID => "Sequence ID",
2795            GenericDeviceControls::SequenceIDReset => "Sequence ID Reset",
2796            GenericDeviceControls::RFSignalStrength => "RF Signal Strength",
2797            GenericDeviceControls::SoftwareVersion => "Software Version",
2798            GenericDeviceControls::ProtocolVersion => "Protocol Version",
2799            GenericDeviceControls::HardwareVersion => "Hardware Version",
2800            GenericDeviceControls::Major => "Major",
2801            GenericDeviceControls::Minor => "Minor",
2802            GenericDeviceControls::Revision => "Revision",
2803            GenericDeviceControls::Handedness => "Handedness",
2804            GenericDeviceControls::EitherHand => "Either Hand",
2805            GenericDeviceControls::LeftHand => "Left Hand",
2806            GenericDeviceControls::RightHand => "Right Hand",
2807            GenericDeviceControls::BothHands => "Both Hands",
2808            GenericDeviceControls::GripPoseOffset => "Grip Pose Offset",
2809            GenericDeviceControls::PointerPoseOffset => "Pointer Pose Offset",
2810        }
2811        .into()
2812    }
2813}
2814
2815#[cfg(feature = "std")]
2816impl fmt::Display for GenericDeviceControls {
2817    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2818        write!(f, "{}", self.name())
2819    }
2820}
2821
2822impl AsUsage for GenericDeviceControls {
2823    /// Returns the 32 bit Usage value of this Usage
2824    fn usage_value(&self) -> u32 {
2825        u32::from(self)
2826    }
2827
2828    /// Returns the 16 bit Usage ID value of this Usage
2829    fn usage_id_value(&self) -> u16 {
2830        u16::from(self)
2831    }
2832
2833    /// Returns this usage as [Usage::GenericDeviceControls(self)](Usage::GenericDeviceControls)
2834    /// This is a convenience function to avoid having
2835    /// to implement `From` for every used type in the caller.
2836    ///
2837    /// ```
2838    /// # use hut::*;
2839    /// let gd_x = GenericDesktop::X;
2840    /// let usage = Usage::from(GenericDesktop::X);
2841    /// assert!(matches!(gd_x.usage(), usage));
2842    /// ```
2843    fn usage(&self) -> Usage {
2844        Usage::from(self)
2845    }
2846}
2847
2848impl AsUsagePage for GenericDeviceControls {
2849    /// Returns the 16 bit value of this UsagePage
2850    ///
2851    /// This value is `0x6` for [GenericDeviceControls]
2852    fn usage_page_value(&self) -> u16 {
2853        let up = UsagePage::from(self);
2854        u16::from(up)
2855    }
2856
2857    /// Returns [UsagePage::GenericDeviceControls]]
2858    fn usage_page(&self) -> UsagePage {
2859        UsagePage::from(self)
2860    }
2861}
2862
2863impl From<&GenericDeviceControls> for u16 {
2864    fn from(genericdevicecontrols: &GenericDeviceControls) -> u16 {
2865        match *genericdevicecontrols {
2866            GenericDeviceControls::BackgroundNonuserControls => 1,
2867            GenericDeviceControls::BatteryStrength => 32,
2868            GenericDeviceControls::WirelessChannel => 33,
2869            GenericDeviceControls::WirelessID => 34,
2870            GenericDeviceControls::DiscoverWirelessControl => 35,
2871            GenericDeviceControls::SecurityCodeCharacterEntered => 36,
2872            GenericDeviceControls::SecurityCodeCharacterErased => 37,
2873            GenericDeviceControls::SecurityCodeCleared => 38,
2874            GenericDeviceControls::SequenceID => 39,
2875            GenericDeviceControls::SequenceIDReset => 40,
2876            GenericDeviceControls::RFSignalStrength => 41,
2877            GenericDeviceControls::SoftwareVersion => 42,
2878            GenericDeviceControls::ProtocolVersion => 43,
2879            GenericDeviceControls::HardwareVersion => 44,
2880            GenericDeviceControls::Major => 45,
2881            GenericDeviceControls::Minor => 46,
2882            GenericDeviceControls::Revision => 47,
2883            GenericDeviceControls::Handedness => 48,
2884            GenericDeviceControls::EitherHand => 49,
2885            GenericDeviceControls::LeftHand => 50,
2886            GenericDeviceControls::RightHand => 51,
2887            GenericDeviceControls::BothHands => 52,
2888            GenericDeviceControls::GripPoseOffset => 64,
2889            GenericDeviceControls::PointerPoseOffset => 65,
2890        }
2891    }
2892}
2893
2894impl From<GenericDeviceControls> for u16 {
2895    /// Returns the 16bit value of this usage. This is identical
2896    /// to [GenericDeviceControls::usage_page_value()].
2897    fn from(genericdevicecontrols: GenericDeviceControls) -> u16 {
2898        u16::from(&genericdevicecontrols)
2899    }
2900}
2901
2902impl From<&GenericDeviceControls> for u32 {
2903    /// Returns the 32 bit value of this usage. This is identical
2904    /// to [GenericDeviceControls::usage_value()].
2905    fn from(genericdevicecontrols: &GenericDeviceControls) -> u32 {
2906        let up = UsagePage::from(genericdevicecontrols);
2907        let up = (u16::from(&up) as u32) << 16;
2908        let id = u16::from(genericdevicecontrols) as u32;
2909        up | id
2910    }
2911}
2912
2913impl From<&GenericDeviceControls> for UsagePage {
2914    /// Always returns [UsagePage::GenericDeviceControls] and is
2915    /// identical to [GenericDeviceControls::usage_page()].
2916    fn from(_: &GenericDeviceControls) -> UsagePage {
2917        UsagePage::GenericDeviceControls
2918    }
2919}
2920
2921impl From<GenericDeviceControls> for UsagePage {
2922    /// Always returns [UsagePage::GenericDeviceControls] and is
2923    /// identical to [GenericDeviceControls::usage_page()].
2924    fn from(_: GenericDeviceControls) -> UsagePage {
2925        UsagePage::GenericDeviceControls
2926    }
2927}
2928
2929impl From<&GenericDeviceControls> for Usage {
2930    fn from(genericdevicecontrols: &GenericDeviceControls) -> Usage {
2931        Usage::try_from(u32::from(genericdevicecontrols)).unwrap()
2932    }
2933}
2934
2935impl From<GenericDeviceControls> for Usage {
2936    fn from(genericdevicecontrols: GenericDeviceControls) -> Usage {
2937        Usage::from(&genericdevicecontrols)
2938    }
2939}
2940
2941impl TryFrom<u16> for GenericDeviceControls {
2942    type Error = HutError;
2943
2944    fn try_from(usage_id: u16) -> Result<GenericDeviceControls> {
2945        match usage_id {
2946            1 => Ok(GenericDeviceControls::BackgroundNonuserControls),
2947            32 => Ok(GenericDeviceControls::BatteryStrength),
2948            33 => Ok(GenericDeviceControls::WirelessChannel),
2949            34 => Ok(GenericDeviceControls::WirelessID),
2950            35 => Ok(GenericDeviceControls::DiscoverWirelessControl),
2951            36 => Ok(GenericDeviceControls::SecurityCodeCharacterEntered),
2952            37 => Ok(GenericDeviceControls::SecurityCodeCharacterErased),
2953            38 => Ok(GenericDeviceControls::SecurityCodeCleared),
2954            39 => Ok(GenericDeviceControls::SequenceID),
2955            40 => Ok(GenericDeviceControls::SequenceIDReset),
2956            41 => Ok(GenericDeviceControls::RFSignalStrength),
2957            42 => Ok(GenericDeviceControls::SoftwareVersion),
2958            43 => Ok(GenericDeviceControls::ProtocolVersion),
2959            44 => Ok(GenericDeviceControls::HardwareVersion),
2960            45 => Ok(GenericDeviceControls::Major),
2961            46 => Ok(GenericDeviceControls::Minor),
2962            47 => Ok(GenericDeviceControls::Revision),
2963            48 => Ok(GenericDeviceControls::Handedness),
2964            49 => Ok(GenericDeviceControls::EitherHand),
2965            50 => Ok(GenericDeviceControls::LeftHand),
2966            51 => Ok(GenericDeviceControls::RightHand),
2967            52 => Ok(GenericDeviceControls::BothHands),
2968            64 => Ok(GenericDeviceControls::GripPoseOffset),
2969            65 => Ok(GenericDeviceControls::PointerPoseOffset),
2970            n => Err(HutError::UnknownUsageId { usage_id: n }),
2971        }
2972    }
2973}
2974
2975impl BitOr<u16> for GenericDeviceControls {
2976    type Output = Usage;
2977
2978    /// A convenience function to combine a Usage Page with
2979    /// a value.
2980    ///
2981    /// This function panics if the Usage ID value results in
2982    /// an unknown Usage. Where error checking is required,
2983    /// use [UsagePage::to_usage_from_value].
2984    fn bitor(self, usage: u16) -> Usage {
2985        let up = u16::from(self) as u32;
2986        let u = usage as u32;
2987        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
2988    }
2989}
2990
2991/// *Usage Page `0x7`: "Keyboard/Keypad"*
2992///
2993/// **This enum is autogenerated from the HID Usage Tables**.
2994/// ```
2995/// # use hut::*;
2996/// let u1 = Usage::KeyboardKeypad(KeyboardKeypad::POSTFail);
2997/// let u2 = Usage::new_from_page_and_id(0x7, 0x2).unwrap();
2998/// let u3 = Usage::from(KeyboardKeypad::POSTFail);
2999/// let u4: Usage = KeyboardKeypad::POSTFail.into();
3000/// assert_eq!(u1, u2);
3001/// assert_eq!(u1, u3);
3002/// assert_eq!(u1, u4);
3003///
3004/// assert!(matches!(u1.usage_page(), UsagePage::KeyboardKeypad));
3005/// assert_eq!(0x7, u1.usage_page_value());
3006/// assert_eq!(0x2, u1.usage_id_value());
3007/// assert_eq!((0x7 << 16) | 0x2, u1.usage_value());
3008/// assert_eq!("POSTFail", u1.name());
3009/// ```
3010///
3011#[allow(non_camel_case_types)]
3012#[derive(Debug)]
3013#[non_exhaustive]
3014pub enum KeyboardKeypad {
3015    /// Usage ID `0x1`: "ErrorRollOver"
3016    ErrorRollOver,
3017    /// Usage ID `0x2`: "POSTFail"
3018    POSTFail,
3019    /// Usage ID `0x3`: "ErrorUndefined"
3020    ErrorUndefined,
3021    /// Usage ID `0x4`: "Keyboard A"
3022    KeyboardA,
3023    /// Usage ID `0x5`: "Keyboard B"
3024    KeyboardB,
3025    /// Usage ID `0x6`: "Keyboard C"
3026    KeyboardC,
3027    /// Usage ID `0x7`: "Keyboard D"
3028    KeyboardD,
3029    /// Usage ID `0x8`: "Keyboard E"
3030    KeyboardE,
3031    /// Usage ID `0x9`: "Keyboard F"
3032    KeyboardF,
3033    /// Usage ID `0xA`: "Keyboard G"
3034    KeyboardG,
3035    /// Usage ID `0xB`: "Keyboard H"
3036    KeyboardH,
3037    /// Usage ID `0xC`: "Keyboard I"
3038    KeyboardI,
3039    /// Usage ID `0xD`: "Keyboard J"
3040    KeyboardJ,
3041    /// Usage ID `0xE`: "Keyboard K"
3042    KeyboardK,
3043    /// Usage ID `0xF`: "Keyboard L"
3044    KeyboardL,
3045    /// Usage ID `0x10`: "Keyboard M"
3046    KeyboardM,
3047    /// Usage ID `0x11`: "Keyboard N"
3048    KeyboardN,
3049    /// Usage ID `0x12`: "Keyboard O"
3050    KeyboardO,
3051    /// Usage ID `0x13`: "Keyboard P"
3052    KeyboardP,
3053    /// Usage ID `0x14`: "Keyboard Q"
3054    KeyboardQ,
3055    /// Usage ID `0x15`: "Keyboard R"
3056    KeyboardR,
3057    /// Usage ID `0x16`: "Keyboard S"
3058    KeyboardS,
3059    /// Usage ID `0x17`: "Keyboard T"
3060    KeyboardT,
3061    /// Usage ID `0x18`: "Keyboard U"
3062    KeyboardU,
3063    /// Usage ID `0x19`: "Keyboard V"
3064    KeyboardV,
3065    /// Usage ID `0x1A`: "Keyboard W"
3066    KeyboardW,
3067    /// Usage ID `0x1B`: "Keyboard X"
3068    KeyboardX,
3069    /// Usage ID `0x1C`: "Keyboard Y"
3070    KeyboardY,
3071    /// Usage ID `0x1D`: "Keyboard Z"
3072    KeyboardZ,
3073    /// Usage ID `0x1E`: "Keyboard 1 and Bang"
3074    Keyboard1andBang,
3075    /// Usage ID `0x1F`: "Keyboard 2 and At"
3076    Keyboard2andAt,
3077    /// Usage ID `0x20`: "Keyboard 3 and Hash"
3078    Keyboard3andHash,
3079    /// Usage ID `0x21`: "Keyboard 4 and Dollar"
3080    Keyboard4andDollar,
3081    /// Usage ID `0x22`: "Keyboard 5 and Percent"
3082    Keyboard5andPercent,
3083    /// Usage ID `0x23`: "Keyboard 6 and Caret"
3084    Keyboard6andCaret,
3085    /// Usage ID `0x24`: "Keyboard 7 and Ampersand"
3086    Keyboard7andAmpersand,
3087    /// Usage ID `0x25`: "Keyboard 8 and Star"
3088    Keyboard8andStar,
3089    /// Usage ID `0x26`: "Keyboard 9 and Left Bracket"
3090    Keyboard9andLeftBracket,
3091    /// Usage ID `0x27`: "Keyboard 0 and Right Bracket"
3092    Keyboard0andRightBracket,
3093    /// Usage ID `0x28`: "Keyboard Return Enter"
3094    KeyboardReturnEnter,
3095    /// Usage ID `0x29`: "Keyboard Escape"
3096    KeyboardEscape,
3097    /// Usage ID `0x2A`: "Keyboard Delete"
3098    KeyboardDelete,
3099    /// Usage ID `0x2B`: "Keyboard Tab"
3100    KeyboardTab,
3101    /// Usage ID `0x2C`: "Keyboard Spacebar"
3102    KeyboardSpacebar,
3103    /// Usage ID `0x2D`: "Keyboard Dash and Underscore"
3104    KeyboardDashandUnderscore,
3105    /// Usage ID `0x2E`: "Keyboard Equals and Plus"
3106    KeyboardEqualsandPlus,
3107    /// Usage ID `0x2F`: "Keyboard Left Brace"
3108    KeyboardLeftBrace,
3109    /// Usage ID `0x30`: "Keyboard Right Brace"
3110    KeyboardRightBrace,
3111    /// Usage ID `0x31`: "Keyboard Backslash and Pipe"
3112    KeyboardBackslashandPipe,
3113    /// Usage ID `0x32`: "Keyboard Non-US Hash and Tilde"
3114    KeyboardNonUSHashandTilde,
3115    /// Usage ID `0x33`: "Keyboard SemiColon and Colon"
3116    KeyboardSemiColonandColon,
3117    /// Usage ID `0x34`: "Keyboard Left Apos and Double"
3118    KeyboardLeftAposandDouble,
3119    /// Usage ID `0x35`: "Keyboard Grave Accent and Tilde"
3120    KeyboardGraveAccentandTilde,
3121    /// Usage ID `0x36`: "Keyboard Comma and LessThan"
3122    KeyboardCommaandLessThan,
3123    /// Usage ID `0x37`: "Keyboard Period and GreaterThan"
3124    KeyboardPeriodandGreaterThan,
3125    /// Usage ID `0x38`: "Keyboard ForwardSlash and QuestionMark"
3126    KeyboardForwardSlashandQuestionMark,
3127    /// Usage ID `0x39`: "Keyboard Caps Lock"
3128    KeyboardCapsLock,
3129    /// Usage ID `0x3A`: "Keyboard F1"
3130    KeyboardF1,
3131    /// Usage ID `0x3B`: "Keyboard F2"
3132    KeyboardF2,
3133    /// Usage ID `0x3C`: "Keyboard F3"
3134    KeyboardF3,
3135    /// Usage ID `0x3D`: "Keyboard F4"
3136    KeyboardF4,
3137    /// Usage ID `0x3E`: "Keyboard F5"
3138    KeyboardF5,
3139    /// Usage ID `0x3F`: "Keyboard F6"
3140    KeyboardF6,
3141    /// Usage ID `0x40`: "Keyboard F7"
3142    KeyboardF7,
3143    /// Usage ID `0x41`: "Keyboard F8"
3144    KeyboardF8,
3145    /// Usage ID `0x42`: "Keyboard F9"
3146    KeyboardF9,
3147    /// Usage ID `0x43`: "Keyboard F10"
3148    KeyboardF10,
3149    /// Usage ID `0x44`: "Keyboard F11"
3150    KeyboardF11,
3151    /// Usage ID `0x45`: "Keyboard F12"
3152    KeyboardF12,
3153    /// Usage ID `0x46`: "Keyboard PrintScreen"
3154    KeyboardPrintScreen,
3155    /// Usage ID `0x47`: "Keyboard Scroll Lock"
3156    KeyboardScrollLock,
3157    /// Usage ID `0x48`: "Keyboard Pause"
3158    KeyboardPause,
3159    /// Usage ID `0x49`: "Keyboard Insert"
3160    KeyboardInsert,
3161    /// Usage ID `0x4A`: "Keyboard Home"
3162    KeyboardHome,
3163    /// Usage ID `0x4B`: "Keyboard PageUp"
3164    KeyboardPageUp,
3165    /// Usage ID `0x4C`: "Keyboard Delete Forward"
3166    KeyboardDeleteForward,
3167    /// Usage ID `0x4D`: "Keyboard End"
3168    KeyboardEnd,
3169    /// Usage ID `0x4E`: "Keyboard PageDown"
3170    KeyboardPageDown,
3171    /// Usage ID `0x4F`: "Keyboard RightArrow"
3172    KeyboardRightArrow,
3173    /// Usage ID `0x50`: "Keyboard LeftArrow"
3174    KeyboardLeftArrow,
3175    /// Usage ID `0x51`: "Keyboard DownArrow"
3176    KeyboardDownArrow,
3177    /// Usage ID `0x52`: "Keyboard UpArrow"
3178    KeyboardUpArrow,
3179    /// Usage ID `0x53`: "Keypad Num Lock and Clear"
3180    KeypadNumLockandClear,
3181    /// Usage ID `0x54`: "Keypad ForwardSlash"
3182    KeypadForwardSlash,
3183    /// Usage ID `0x55`: "Keypad Star"
3184    KeypadStar,
3185    /// Usage ID `0x56`: "Keypad Dash"
3186    KeypadDash,
3187    /// Usage ID `0x57`: "Keypad Plus"
3188    KeypadPlus,
3189    /// Usage ID `0x58`: "Keypad ENTER"
3190    KeypadENTER,
3191    /// Usage ID `0x59`: "Keypad 1 and End"
3192    Keypad1andEnd,
3193    /// Usage ID `0x5A`: "Keypad 2 and Down Arrow"
3194    Keypad2andDownArrow,
3195    /// Usage ID `0x5B`: "Keypad 3 and PageDn"
3196    Keypad3andPageDn,
3197    /// Usage ID `0x5C`: "Keypad 4 and Left Arrow"
3198    Keypad4andLeftArrow,
3199    /// Usage ID `0x5D`: "Keypad 5"
3200    Keypad5,
3201    /// Usage ID `0x5E`: "Keypad 6 and Right Arrow"
3202    Keypad6andRightArrow,
3203    /// Usage ID `0x5F`: "Keypad 7 and Home"
3204    Keypad7andHome,
3205    /// Usage ID `0x60`: "Keypad 8 and Up Arrow"
3206    Keypad8andUpArrow,
3207    /// Usage ID `0x61`: "Keypad 9 and PageUp"
3208    Keypad9andPageUp,
3209    /// Usage ID `0x62`: "Keypad 0 and Insert"
3210    Keypad0andInsert,
3211    /// Usage ID `0x63`: "Keypad Period and Delete"
3212    KeypadPeriodandDelete,
3213    /// Usage ID `0x64`: "Keyboard Non-US Backslash and Pipe"
3214    KeyboardNonUSBackslashandPipe,
3215    /// Usage ID `0x65`: "Keyboard Application"
3216    KeyboardApplication,
3217    /// Usage ID `0x66`: "Keyboard Power"
3218    KeyboardPower,
3219    /// Usage ID `0x67`: "Keypad Equals"
3220    KeypadEquals,
3221    /// Usage ID `0x68`: "Keyboard F13"
3222    KeyboardF13,
3223    /// Usage ID `0x69`: "Keyboard F14"
3224    KeyboardF14,
3225    /// Usage ID `0x6A`: "Keyboard F15"
3226    KeyboardF15,
3227    /// Usage ID `0x6B`: "Keyboard F16"
3228    KeyboardF16,
3229    /// Usage ID `0x6C`: "Keyboard F17"
3230    KeyboardF17,
3231    /// Usage ID `0x6D`: "Keyboard F18"
3232    KeyboardF18,
3233    /// Usage ID `0x6E`: "Keyboard F19"
3234    KeyboardF19,
3235    /// Usage ID `0x6F`: "Keyboard F20"
3236    KeyboardF20,
3237    /// Usage ID `0x70`: "Keyboard F21"
3238    KeyboardF21,
3239    /// Usage ID `0x71`: "Keyboard F22"
3240    KeyboardF22,
3241    /// Usage ID `0x72`: "Keyboard F23"
3242    KeyboardF23,
3243    /// Usage ID `0x73`: "Keyboard F24"
3244    KeyboardF24,
3245    /// Usage ID `0x74`: "Keyboard Execute"
3246    KeyboardExecute,
3247    /// Usage ID `0x75`: "Keyboard Help"
3248    KeyboardHelp,
3249    /// Usage ID `0x76`: "Keyboard Menu"
3250    KeyboardMenu,
3251    /// Usage ID `0x77`: "Keyboard Select"
3252    KeyboardSelect,
3253    /// Usage ID `0x78`: "Keyboard Stop"
3254    KeyboardStop,
3255    /// Usage ID `0x79`: "Keyboard Again"
3256    KeyboardAgain,
3257    /// Usage ID `0x7A`: "Keyboard Undo"
3258    KeyboardUndo,
3259    /// Usage ID `0x7B`: "Keyboard Cut"
3260    KeyboardCut,
3261    /// Usage ID `0x7C`: "Keyboard Copy"
3262    KeyboardCopy,
3263    /// Usage ID `0x7D`: "Keyboard Paste"
3264    KeyboardPaste,
3265    /// Usage ID `0x7E`: "Keyboard Find"
3266    KeyboardFind,
3267    /// Usage ID `0x7F`: "Keyboard Mute"
3268    KeyboardMute,
3269    /// Usage ID `0x80`: "Keyboard Volume Up"
3270    KeyboardVolumeUp,
3271    /// Usage ID `0x81`: "Keyboard Volume Down"
3272    KeyboardVolumeDown,
3273    /// Usage ID `0x82`: "Keyboard Locking Caps Lock"
3274    KeyboardLockingCapsLock,
3275    /// Usage ID `0x83`: "Keyboard Locking Num Lock"
3276    KeyboardLockingNumLock,
3277    /// Usage ID `0x84`: "Keyboard Locking Scroll Lock"
3278    KeyboardLockingScrollLock,
3279    /// Usage ID `0x85`: "Keypad Comma"
3280    KeypadComma,
3281    /// Usage ID `0x86`: "Keypad Equal Sign"
3282    KeypadEqualSign,
3283    /// Usage ID `0x87`: "Keyboard International1"
3284    KeyboardInternational1,
3285    /// Usage ID `0x88`: "Keyboard International2"
3286    KeyboardInternational2,
3287    /// Usage ID `0x89`: "Keyboard International3"
3288    KeyboardInternational3,
3289    /// Usage ID `0x8A`: "Keyboard International4"
3290    KeyboardInternational4,
3291    /// Usage ID `0x8B`: "Keyboard International5"
3292    KeyboardInternational5,
3293    /// Usage ID `0x8C`: "Keyboard International6"
3294    KeyboardInternational6,
3295    /// Usage ID `0x8D`: "Keyboard International7"
3296    KeyboardInternational7,
3297    /// Usage ID `0x8E`: "Keyboard International8"
3298    KeyboardInternational8,
3299    /// Usage ID `0x8F`: "Keyboard International9"
3300    KeyboardInternational9,
3301    /// Usage ID `0x90`: "Keyboard LANG1"
3302    KeyboardLANG1,
3303    /// Usage ID `0x91`: "Keyboard LANG2"
3304    KeyboardLANG2,
3305    /// Usage ID `0x92`: "Keyboard LANG3"
3306    KeyboardLANG3,
3307    /// Usage ID `0x93`: "Keyboard LANG4"
3308    KeyboardLANG4,
3309    /// Usage ID `0x94`: "Keyboard LANG5"
3310    KeyboardLANG5,
3311    /// Usage ID `0x95`: "Keyboard LANG6"
3312    KeyboardLANG6,
3313    /// Usage ID `0x96`: "Keyboard LANG7"
3314    KeyboardLANG7,
3315    /// Usage ID `0x97`: "Keyboard LANG8"
3316    KeyboardLANG8,
3317    /// Usage ID `0x98`: "Keyboard LANG9"
3318    KeyboardLANG9,
3319    /// Usage ID `0x99`: "Keyboard Alternate Erase"
3320    KeyboardAlternateErase,
3321    /// Usage ID `0x9A`: "Keyboard SysReq Attention"
3322    KeyboardSysReqAttention,
3323    /// Usage ID `0x9B`: "Keyboard Cancel"
3324    KeyboardCancel,
3325    /// Usage ID `0x9C`: "Keyboard Clear"
3326    KeyboardClear,
3327    /// Usage ID `0x9D`: "Keyboard Prior"
3328    KeyboardPrior,
3329    /// Usage ID `0x9E`: "Keyboard Return"
3330    KeyboardReturn,
3331    /// Usage ID `0x9F`: "Keyboard Separator"
3332    KeyboardSeparator,
3333    /// Usage ID `0xA0`: "Keyboard Out"
3334    KeyboardOut,
3335    /// Usage ID `0xA1`: "Keyboard Oper"
3336    KeyboardOper,
3337    /// Usage ID `0xA2`: "Keyboard Clear Again"
3338    KeyboardClearAgain,
3339    /// Usage ID `0xA3`: "Keyboard CrSel Props"
3340    KeyboardCrSelProps,
3341    /// Usage ID `0xA4`: "Keyboard ExSel"
3342    KeyboardExSel,
3343    /// Usage ID `0xB0`: "Keypad Double 0"
3344    KeypadDouble0,
3345    /// Usage ID `0xB1`: "Keypad Triple 0"
3346    KeypadTriple0,
3347    /// Usage ID `0xB2`: "Thousands Separator"
3348    ThousandsSeparator,
3349    /// Usage ID `0xB3`: "Decimal Separator"
3350    DecimalSeparator,
3351    /// Usage ID `0xB4`: "Currency Unit"
3352    CurrencyUnit,
3353    /// Usage ID `0xB5`: "Currency Sub-unit"
3354    CurrencySubunit,
3355    /// Usage ID `0xB6`: "Keypad Left Bracket"
3356    KeypadLeftBracket,
3357    /// Usage ID `0xB7`: "Keypad Right Bracket"
3358    KeypadRightBracket,
3359    /// Usage ID `0xB8`: "Keypad Left Brace"
3360    KeypadLeftBrace,
3361    /// Usage ID `0xB9`: "Keypad Right Brace"
3362    KeypadRightBrace,
3363    /// Usage ID `0xBA`: "Keypad Tab"
3364    KeypadTab,
3365    /// Usage ID `0xBB`: "Keypad Backspace"
3366    KeypadBackspace,
3367    /// Usage ID `0xBC`: "Keypad A"
3368    KeypadA,
3369    /// Usage ID `0xBD`: "Keypad B"
3370    KeypadB,
3371    /// Usage ID `0xBE`: "Keypad C"
3372    KeypadC,
3373    /// Usage ID `0xBF`: "Keypad D"
3374    KeypadD,
3375    /// Usage ID `0xC0`: "Keypad E"
3376    KeypadE,
3377    /// Usage ID `0xC1`: "Keypad F"
3378    KeypadF,
3379    /// Usage ID `0xC2`: "Keypad XOR"
3380    KeypadXOR,
3381    /// Usage ID `0xC3`: "Keypad Caret"
3382    KeypadCaret,
3383    /// Usage ID `0xC4`: "Keypad Percentage"
3384    KeypadPercentage,
3385    /// Usage ID `0xC5`: "Keypad Less"
3386    KeypadLess,
3387    /// Usage ID `0xC6`: "Keypad Greater"
3388    KeypadGreater,
3389    /// Usage ID `0xC7`: "Keypad Ampersand"
3390    KeypadAmpersand,
3391    /// Usage ID `0xC8`: "Keypad Double Ampersand"
3392    KeypadDoubleAmpersand,
3393    /// Usage ID `0xC9`: "Keypad Bar"
3394    KeypadBar,
3395    /// Usage ID `0xCA`: "Keypad Double Bar"
3396    KeypadDoubleBar,
3397    /// Usage ID `0xCB`: "Keypad Colon"
3398    KeypadColon,
3399    /// Usage ID `0xCC`: "Keypad Hash"
3400    KeypadHash,
3401    /// Usage ID `0xCD`: "Keypad Space"
3402    KeypadSpace,
3403    /// Usage ID `0xCE`: "Keypad At"
3404    KeypadAt,
3405    /// Usage ID `0xCF`: "Keypad Bang"
3406    KeypadBang,
3407    /// Usage ID `0xD0`: "Keypad Memory Store"
3408    KeypadMemoryStore,
3409    /// Usage ID `0xD1`: "Keypad Memory Recall"
3410    KeypadMemoryRecall,
3411    /// Usage ID `0xD2`: "Keypad Memory Clear"
3412    KeypadMemoryClear,
3413    /// Usage ID `0xD3`: "Keypad Memory Add"
3414    KeypadMemoryAdd,
3415    /// Usage ID `0xD4`: "Keypad Memory Subtract"
3416    KeypadMemorySubtract,
3417    /// Usage ID `0xD5`: "Keypad Memory Multiply"
3418    KeypadMemoryMultiply,
3419    /// Usage ID `0xD6`: "Keypad Memory Divide"
3420    KeypadMemoryDivide,
3421    /// Usage ID `0xD7`: "Keypad Plus Minus"
3422    KeypadPlusMinus,
3423    /// Usage ID `0xD8`: "Keypad Clear"
3424    KeypadClear,
3425    /// Usage ID `0xD9`: "Keypad Clear Entry"
3426    KeypadClearEntry,
3427    /// Usage ID `0xDA`: "Keypad Binary"
3428    KeypadBinary,
3429    /// Usage ID `0xDB`: "Keypad Octal"
3430    KeypadOctal,
3431    /// Usage ID `0xDC`: "Keypad Decimal"
3432    KeypadDecimal,
3433    /// Usage ID `0xDD`: "Keypad Hexadecimal"
3434    KeypadHexadecimal,
3435    /// Usage ID `0xE0`: "Keyboard LeftControl"
3436    KeyboardLeftControl,
3437    /// Usage ID `0xE1`: "Keyboard LeftShift"
3438    KeyboardLeftShift,
3439    /// Usage ID `0xE2`: "Keyboard LeftAlt"
3440    KeyboardLeftAlt,
3441    /// Usage ID `0xE3`: "Keyboard Left GUI"
3442    KeyboardLeftGUI,
3443    /// Usage ID `0xE4`: "Keyboard RightControl"
3444    KeyboardRightControl,
3445    /// Usage ID `0xE5`: "Keyboard RightShift"
3446    KeyboardRightShift,
3447    /// Usage ID `0xE6`: "Keyboard RightAlt"
3448    KeyboardRightAlt,
3449    /// Usage ID `0xE7`: "Keyboard Right GUI"
3450    KeyboardRightGUI,
3451}
3452
3453impl KeyboardKeypad {
3454    #[cfg(feature = "std")]
3455    pub fn name(&self) -> String {
3456        match self {
3457            KeyboardKeypad::ErrorRollOver => "ErrorRollOver",
3458            KeyboardKeypad::POSTFail => "POSTFail",
3459            KeyboardKeypad::ErrorUndefined => "ErrorUndefined",
3460            KeyboardKeypad::KeyboardA => "Keyboard A",
3461            KeyboardKeypad::KeyboardB => "Keyboard B",
3462            KeyboardKeypad::KeyboardC => "Keyboard C",
3463            KeyboardKeypad::KeyboardD => "Keyboard D",
3464            KeyboardKeypad::KeyboardE => "Keyboard E",
3465            KeyboardKeypad::KeyboardF => "Keyboard F",
3466            KeyboardKeypad::KeyboardG => "Keyboard G",
3467            KeyboardKeypad::KeyboardH => "Keyboard H",
3468            KeyboardKeypad::KeyboardI => "Keyboard I",
3469            KeyboardKeypad::KeyboardJ => "Keyboard J",
3470            KeyboardKeypad::KeyboardK => "Keyboard K",
3471            KeyboardKeypad::KeyboardL => "Keyboard L",
3472            KeyboardKeypad::KeyboardM => "Keyboard M",
3473            KeyboardKeypad::KeyboardN => "Keyboard N",
3474            KeyboardKeypad::KeyboardO => "Keyboard O",
3475            KeyboardKeypad::KeyboardP => "Keyboard P",
3476            KeyboardKeypad::KeyboardQ => "Keyboard Q",
3477            KeyboardKeypad::KeyboardR => "Keyboard R",
3478            KeyboardKeypad::KeyboardS => "Keyboard S",
3479            KeyboardKeypad::KeyboardT => "Keyboard T",
3480            KeyboardKeypad::KeyboardU => "Keyboard U",
3481            KeyboardKeypad::KeyboardV => "Keyboard V",
3482            KeyboardKeypad::KeyboardW => "Keyboard W",
3483            KeyboardKeypad::KeyboardX => "Keyboard X",
3484            KeyboardKeypad::KeyboardY => "Keyboard Y",
3485            KeyboardKeypad::KeyboardZ => "Keyboard Z",
3486            KeyboardKeypad::Keyboard1andBang => "Keyboard 1 and Bang",
3487            KeyboardKeypad::Keyboard2andAt => "Keyboard 2 and At",
3488            KeyboardKeypad::Keyboard3andHash => "Keyboard 3 and Hash",
3489            KeyboardKeypad::Keyboard4andDollar => "Keyboard 4 and Dollar",
3490            KeyboardKeypad::Keyboard5andPercent => "Keyboard 5 and Percent",
3491            KeyboardKeypad::Keyboard6andCaret => "Keyboard 6 and Caret",
3492            KeyboardKeypad::Keyboard7andAmpersand => "Keyboard 7 and Ampersand",
3493            KeyboardKeypad::Keyboard8andStar => "Keyboard 8 and Star",
3494            KeyboardKeypad::Keyboard9andLeftBracket => "Keyboard 9 and Left Bracket",
3495            KeyboardKeypad::Keyboard0andRightBracket => "Keyboard 0 and Right Bracket",
3496            KeyboardKeypad::KeyboardReturnEnter => "Keyboard Return Enter",
3497            KeyboardKeypad::KeyboardEscape => "Keyboard Escape",
3498            KeyboardKeypad::KeyboardDelete => "Keyboard Delete",
3499            KeyboardKeypad::KeyboardTab => "Keyboard Tab",
3500            KeyboardKeypad::KeyboardSpacebar => "Keyboard Spacebar",
3501            KeyboardKeypad::KeyboardDashandUnderscore => "Keyboard Dash and Underscore",
3502            KeyboardKeypad::KeyboardEqualsandPlus => "Keyboard Equals and Plus",
3503            KeyboardKeypad::KeyboardLeftBrace => "Keyboard Left Brace",
3504            KeyboardKeypad::KeyboardRightBrace => "Keyboard Right Brace",
3505            KeyboardKeypad::KeyboardBackslashandPipe => "Keyboard Backslash and Pipe",
3506            KeyboardKeypad::KeyboardNonUSHashandTilde => "Keyboard Non-US Hash and Tilde",
3507            KeyboardKeypad::KeyboardSemiColonandColon => "Keyboard SemiColon and Colon",
3508            KeyboardKeypad::KeyboardLeftAposandDouble => "Keyboard Left Apos and Double",
3509            KeyboardKeypad::KeyboardGraveAccentandTilde => "Keyboard Grave Accent and Tilde",
3510            KeyboardKeypad::KeyboardCommaandLessThan => "Keyboard Comma and LessThan",
3511            KeyboardKeypad::KeyboardPeriodandGreaterThan => "Keyboard Period and GreaterThan",
3512            KeyboardKeypad::KeyboardForwardSlashandQuestionMark => {
3513                "Keyboard ForwardSlash and QuestionMark"
3514            }
3515            KeyboardKeypad::KeyboardCapsLock => "Keyboard Caps Lock",
3516            KeyboardKeypad::KeyboardF1 => "Keyboard F1",
3517            KeyboardKeypad::KeyboardF2 => "Keyboard F2",
3518            KeyboardKeypad::KeyboardF3 => "Keyboard F3",
3519            KeyboardKeypad::KeyboardF4 => "Keyboard F4",
3520            KeyboardKeypad::KeyboardF5 => "Keyboard F5",
3521            KeyboardKeypad::KeyboardF6 => "Keyboard F6",
3522            KeyboardKeypad::KeyboardF7 => "Keyboard F7",
3523            KeyboardKeypad::KeyboardF8 => "Keyboard F8",
3524            KeyboardKeypad::KeyboardF9 => "Keyboard F9",
3525            KeyboardKeypad::KeyboardF10 => "Keyboard F10",
3526            KeyboardKeypad::KeyboardF11 => "Keyboard F11",
3527            KeyboardKeypad::KeyboardF12 => "Keyboard F12",
3528            KeyboardKeypad::KeyboardPrintScreen => "Keyboard PrintScreen",
3529            KeyboardKeypad::KeyboardScrollLock => "Keyboard Scroll Lock",
3530            KeyboardKeypad::KeyboardPause => "Keyboard Pause",
3531            KeyboardKeypad::KeyboardInsert => "Keyboard Insert",
3532            KeyboardKeypad::KeyboardHome => "Keyboard Home",
3533            KeyboardKeypad::KeyboardPageUp => "Keyboard PageUp",
3534            KeyboardKeypad::KeyboardDeleteForward => "Keyboard Delete Forward",
3535            KeyboardKeypad::KeyboardEnd => "Keyboard End",
3536            KeyboardKeypad::KeyboardPageDown => "Keyboard PageDown",
3537            KeyboardKeypad::KeyboardRightArrow => "Keyboard RightArrow",
3538            KeyboardKeypad::KeyboardLeftArrow => "Keyboard LeftArrow",
3539            KeyboardKeypad::KeyboardDownArrow => "Keyboard DownArrow",
3540            KeyboardKeypad::KeyboardUpArrow => "Keyboard UpArrow",
3541            KeyboardKeypad::KeypadNumLockandClear => "Keypad Num Lock and Clear",
3542            KeyboardKeypad::KeypadForwardSlash => "Keypad ForwardSlash",
3543            KeyboardKeypad::KeypadStar => "Keypad Star",
3544            KeyboardKeypad::KeypadDash => "Keypad Dash",
3545            KeyboardKeypad::KeypadPlus => "Keypad Plus",
3546            KeyboardKeypad::KeypadENTER => "Keypad ENTER",
3547            KeyboardKeypad::Keypad1andEnd => "Keypad 1 and End",
3548            KeyboardKeypad::Keypad2andDownArrow => "Keypad 2 and Down Arrow",
3549            KeyboardKeypad::Keypad3andPageDn => "Keypad 3 and PageDn",
3550            KeyboardKeypad::Keypad4andLeftArrow => "Keypad 4 and Left Arrow",
3551            KeyboardKeypad::Keypad5 => "Keypad 5",
3552            KeyboardKeypad::Keypad6andRightArrow => "Keypad 6 and Right Arrow",
3553            KeyboardKeypad::Keypad7andHome => "Keypad 7 and Home",
3554            KeyboardKeypad::Keypad8andUpArrow => "Keypad 8 and Up Arrow",
3555            KeyboardKeypad::Keypad9andPageUp => "Keypad 9 and PageUp",
3556            KeyboardKeypad::Keypad0andInsert => "Keypad 0 and Insert",
3557            KeyboardKeypad::KeypadPeriodandDelete => "Keypad Period and Delete",
3558            KeyboardKeypad::KeyboardNonUSBackslashandPipe => "Keyboard Non-US Backslash and Pipe",
3559            KeyboardKeypad::KeyboardApplication => "Keyboard Application",
3560            KeyboardKeypad::KeyboardPower => "Keyboard Power",
3561            KeyboardKeypad::KeypadEquals => "Keypad Equals",
3562            KeyboardKeypad::KeyboardF13 => "Keyboard F13",
3563            KeyboardKeypad::KeyboardF14 => "Keyboard F14",
3564            KeyboardKeypad::KeyboardF15 => "Keyboard F15",
3565            KeyboardKeypad::KeyboardF16 => "Keyboard F16",
3566            KeyboardKeypad::KeyboardF17 => "Keyboard F17",
3567            KeyboardKeypad::KeyboardF18 => "Keyboard F18",
3568            KeyboardKeypad::KeyboardF19 => "Keyboard F19",
3569            KeyboardKeypad::KeyboardF20 => "Keyboard F20",
3570            KeyboardKeypad::KeyboardF21 => "Keyboard F21",
3571            KeyboardKeypad::KeyboardF22 => "Keyboard F22",
3572            KeyboardKeypad::KeyboardF23 => "Keyboard F23",
3573            KeyboardKeypad::KeyboardF24 => "Keyboard F24",
3574            KeyboardKeypad::KeyboardExecute => "Keyboard Execute",
3575            KeyboardKeypad::KeyboardHelp => "Keyboard Help",
3576            KeyboardKeypad::KeyboardMenu => "Keyboard Menu",
3577            KeyboardKeypad::KeyboardSelect => "Keyboard Select",
3578            KeyboardKeypad::KeyboardStop => "Keyboard Stop",
3579            KeyboardKeypad::KeyboardAgain => "Keyboard Again",
3580            KeyboardKeypad::KeyboardUndo => "Keyboard Undo",
3581            KeyboardKeypad::KeyboardCut => "Keyboard Cut",
3582            KeyboardKeypad::KeyboardCopy => "Keyboard Copy",
3583            KeyboardKeypad::KeyboardPaste => "Keyboard Paste",
3584            KeyboardKeypad::KeyboardFind => "Keyboard Find",
3585            KeyboardKeypad::KeyboardMute => "Keyboard Mute",
3586            KeyboardKeypad::KeyboardVolumeUp => "Keyboard Volume Up",
3587            KeyboardKeypad::KeyboardVolumeDown => "Keyboard Volume Down",
3588            KeyboardKeypad::KeyboardLockingCapsLock => "Keyboard Locking Caps Lock",
3589            KeyboardKeypad::KeyboardLockingNumLock => "Keyboard Locking Num Lock",
3590            KeyboardKeypad::KeyboardLockingScrollLock => "Keyboard Locking Scroll Lock",
3591            KeyboardKeypad::KeypadComma => "Keypad Comma",
3592            KeyboardKeypad::KeypadEqualSign => "Keypad Equal Sign",
3593            KeyboardKeypad::KeyboardInternational1 => "Keyboard International1",
3594            KeyboardKeypad::KeyboardInternational2 => "Keyboard International2",
3595            KeyboardKeypad::KeyboardInternational3 => "Keyboard International3",
3596            KeyboardKeypad::KeyboardInternational4 => "Keyboard International4",
3597            KeyboardKeypad::KeyboardInternational5 => "Keyboard International5",
3598            KeyboardKeypad::KeyboardInternational6 => "Keyboard International6",
3599            KeyboardKeypad::KeyboardInternational7 => "Keyboard International7",
3600            KeyboardKeypad::KeyboardInternational8 => "Keyboard International8",
3601            KeyboardKeypad::KeyboardInternational9 => "Keyboard International9",
3602            KeyboardKeypad::KeyboardLANG1 => "Keyboard LANG1",
3603            KeyboardKeypad::KeyboardLANG2 => "Keyboard LANG2",
3604            KeyboardKeypad::KeyboardLANG3 => "Keyboard LANG3",
3605            KeyboardKeypad::KeyboardLANG4 => "Keyboard LANG4",
3606            KeyboardKeypad::KeyboardLANG5 => "Keyboard LANG5",
3607            KeyboardKeypad::KeyboardLANG6 => "Keyboard LANG6",
3608            KeyboardKeypad::KeyboardLANG7 => "Keyboard LANG7",
3609            KeyboardKeypad::KeyboardLANG8 => "Keyboard LANG8",
3610            KeyboardKeypad::KeyboardLANG9 => "Keyboard LANG9",
3611            KeyboardKeypad::KeyboardAlternateErase => "Keyboard Alternate Erase",
3612            KeyboardKeypad::KeyboardSysReqAttention => "Keyboard SysReq Attention",
3613            KeyboardKeypad::KeyboardCancel => "Keyboard Cancel",
3614            KeyboardKeypad::KeyboardClear => "Keyboard Clear",
3615            KeyboardKeypad::KeyboardPrior => "Keyboard Prior",
3616            KeyboardKeypad::KeyboardReturn => "Keyboard Return",
3617            KeyboardKeypad::KeyboardSeparator => "Keyboard Separator",
3618            KeyboardKeypad::KeyboardOut => "Keyboard Out",
3619            KeyboardKeypad::KeyboardOper => "Keyboard Oper",
3620            KeyboardKeypad::KeyboardClearAgain => "Keyboard Clear Again",
3621            KeyboardKeypad::KeyboardCrSelProps => "Keyboard CrSel Props",
3622            KeyboardKeypad::KeyboardExSel => "Keyboard ExSel",
3623            KeyboardKeypad::KeypadDouble0 => "Keypad Double 0",
3624            KeyboardKeypad::KeypadTriple0 => "Keypad Triple 0",
3625            KeyboardKeypad::ThousandsSeparator => "Thousands Separator",
3626            KeyboardKeypad::DecimalSeparator => "Decimal Separator",
3627            KeyboardKeypad::CurrencyUnit => "Currency Unit",
3628            KeyboardKeypad::CurrencySubunit => "Currency Sub-unit",
3629            KeyboardKeypad::KeypadLeftBracket => "Keypad Left Bracket",
3630            KeyboardKeypad::KeypadRightBracket => "Keypad Right Bracket",
3631            KeyboardKeypad::KeypadLeftBrace => "Keypad Left Brace",
3632            KeyboardKeypad::KeypadRightBrace => "Keypad Right Brace",
3633            KeyboardKeypad::KeypadTab => "Keypad Tab",
3634            KeyboardKeypad::KeypadBackspace => "Keypad Backspace",
3635            KeyboardKeypad::KeypadA => "Keypad A",
3636            KeyboardKeypad::KeypadB => "Keypad B",
3637            KeyboardKeypad::KeypadC => "Keypad C",
3638            KeyboardKeypad::KeypadD => "Keypad D",
3639            KeyboardKeypad::KeypadE => "Keypad E",
3640            KeyboardKeypad::KeypadF => "Keypad F",
3641            KeyboardKeypad::KeypadXOR => "Keypad XOR",
3642            KeyboardKeypad::KeypadCaret => "Keypad Caret",
3643            KeyboardKeypad::KeypadPercentage => "Keypad Percentage",
3644            KeyboardKeypad::KeypadLess => "Keypad Less",
3645            KeyboardKeypad::KeypadGreater => "Keypad Greater",
3646            KeyboardKeypad::KeypadAmpersand => "Keypad Ampersand",
3647            KeyboardKeypad::KeypadDoubleAmpersand => "Keypad Double Ampersand",
3648            KeyboardKeypad::KeypadBar => "Keypad Bar",
3649            KeyboardKeypad::KeypadDoubleBar => "Keypad Double Bar",
3650            KeyboardKeypad::KeypadColon => "Keypad Colon",
3651            KeyboardKeypad::KeypadHash => "Keypad Hash",
3652            KeyboardKeypad::KeypadSpace => "Keypad Space",
3653            KeyboardKeypad::KeypadAt => "Keypad At",
3654            KeyboardKeypad::KeypadBang => "Keypad Bang",
3655            KeyboardKeypad::KeypadMemoryStore => "Keypad Memory Store",
3656            KeyboardKeypad::KeypadMemoryRecall => "Keypad Memory Recall",
3657            KeyboardKeypad::KeypadMemoryClear => "Keypad Memory Clear",
3658            KeyboardKeypad::KeypadMemoryAdd => "Keypad Memory Add",
3659            KeyboardKeypad::KeypadMemorySubtract => "Keypad Memory Subtract",
3660            KeyboardKeypad::KeypadMemoryMultiply => "Keypad Memory Multiply",
3661            KeyboardKeypad::KeypadMemoryDivide => "Keypad Memory Divide",
3662            KeyboardKeypad::KeypadPlusMinus => "Keypad Plus Minus",
3663            KeyboardKeypad::KeypadClear => "Keypad Clear",
3664            KeyboardKeypad::KeypadClearEntry => "Keypad Clear Entry",
3665            KeyboardKeypad::KeypadBinary => "Keypad Binary",
3666            KeyboardKeypad::KeypadOctal => "Keypad Octal",
3667            KeyboardKeypad::KeypadDecimal => "Keypad Decimal",
3668            KeyboardKeypad::KeypadHexadecimal => "Keypad Hexadecimal",
3669            KeyboardKeypad::KeyboardLeftControl => "Keyboard LeftControl",
3670            KeyboardKeypad::KeyboardLeftShift => "Keyboard LeftShift",
3671            KeyboardKeypad::KeyboardLeftAlt => "Keyboard LeftAlt",
3672            KeyboardKeypad::KeyboardLeftGUI => "Keyboard Left GUI",
3673            KeyboardKeypad::KeyboardRightControl => "Keyboard RightControl",
3674            KeyboardKeypad::KeyboardRightShift => "Keyboard RightShift",
3675            KeyboardKeypad::KeyboardRightAlt => "Keyboard RightAlt",
3676            KeyboardKeypad::KeyboardRightGUI => "Keyboard Right GUI",
3677        }
3678        .into()
3679    }
3680}
3681
3682#[cfg(feature = "std")]
3683impl fmt::Display for KeyboardKeypad {
3684    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
3685        write!(f, "{}", self.name())
3686    }
3687}
3688
3689impl AsUsage for KeyboardKeypad {
3690    /// Returns the 32 bit Usage value of this Usage
3691    fn usage_value(&self) -> u32 {
3692        u32::from(self)
3693    }
3694
3695    /// Returns the 16 bit Usage ID value of this Usage
3696    fn usage_id_value(&self) -> u16 {
3697        u16::from(self)
3698    }
3699
3700    /// Returns this usage as [Usage::KeyboardKeypad(self)](Usage::KeyboardKeypad)
3701    /// This is a convenience function to avoid having
3702    /// to implement `From` for every used type in the caller.
3703    ///
3704    /// ```
3705    /// # use hut::*;
3706    /// let gd_x = GenericDesktop::X;
3707    /// let usage = Usage::from(GenericDesktop::X);
3708    /// assert!(matches!(gd_x.usage(), usage));
3709    /// ```
3710    fn usage(&self) -> Usage {
3711        Usage::from(self)
3712    }
3713}
3714
3715impl AsUsagePage for KeyboardKeypad {
3716    /// Returns the 16 bit value of this UsagePage
3717    ///
3718    /// This value is `0x7` for [KeyboardKeypad]
3719    fn usage_page_value(&self) -> u16 {
3720        let up = UsagePage::from(self);
3721        u16::from(up)
3722    }
3723
3724    /// Returns [UsagePage::KeyboardKeypad]]
3725    fn usage_page(&self) -> UsagePage {
3726        UsagePage::from(self)
3727    }
3728}
3729
3730impl From<&KeyboardKeypad> for u16 {
3731    fn from(keyboardkeypad: &KeyboardKeypad) -> u16 {
3732        match *keyboardkeypad {
3733            KeyboardKeypad::ErrorRollOver => 1,
3734            KeyboardKeypad::POSTFail => 2,
3735            KeyboardKeypad::ErrorUndefined => 3,
3736            KeyboardKeypad::KeyboardA => 4,
3737            KeyboardKeypad::KeyboardB => 5,
3738            KeyboardKeypad::KeyboardC => 6,
3739            KeyboardKeypad::KeyboardD => 7,
3740            KeyboardKeypad::KeyboardE => 8,
3741            KeyboardKeypad::KeyboardF => 9,
3742            KeyboardKeypad::KeyboardG => 10,
3743            KeyboardKeypad::KeyboardH => 11,
3744            KeyboardKeypad::KeyboardI => 12,
3745            KeyboardKeypad::KeyboardJ => 13,
3746            KeyboardKeypad::KeyboardK => 14,
3747            KeyboardKeypad::KeyboardL => 15,
3748            KeyboardKeypad::KeyboardM => 16,
3749            KeyboardKeypad::KeyboardN => 17,
3750            KeyboardKeypad::KeyboardO => 18,
3751            KeyboardKeypad::KeyboardP => 19,
3752            KeyboardKeypad::KeyboardQ => 20,
3753            KeyboardKeypad::KeyboardR => 21,
3754            KeyboardKeypad::KeyboardS => 22,
3755            KeyboardKeypad::KeyboardT => 23,
3756            KeyboardKeypad::KeyboardU => 24,
3757            KeyboardKeypad::KeyboardV => 25,
3758            KeyboardKeypad::KeyboardW => 26,
3759            KeyboardKeypad::KeyboardX => 27,
3760            KeyboardKeypad::KeyboardY => 28,
3761            KeyboardKeypad::KeyboardZ => 29,
3762            KeyboardKeypad::Keyboard1andBang => 30,
3763            KeyboardKeypad::Keyboard2andAt => 31,
3764            KeyboardKeypad::Keyboard3andHash => 32,
3765            KeyboardKeypad::Keyboard4andDollar => 33,
3766            KeyboardKeypad::Keyboard5andPercent => 34,
3767            KeyboardKeypad::Keyboard6andCaret => 35,
3768            KeyboardKeypad::Keyboard7andAmpersand => 36,
3769            KeyboardKeypad::Keyboard8andStar => 37,
3770            KeyboardKeypad::Keyboard9andLeftBracket => 38,
3771            KeyboardKeypad::Keyboard0andRightBracket => 39,
3772            KeyboardKeypad::KeyboardReturnEnter => 40,
3773            KeyboardKeypad::KeyboardEscape => 41,
3774            KeyboardKeypad::KeyboardDelete => 42,
3775            KeyboardKeypad::KeyboardTab => 43,
3776            KeyboardKeypad::KeyboardSpacebar => 44,
3777            KeyboardKeypad::KeyboardDashandUnderscore => 45,
3778            KeyboardKeypad::KeyboardEqualsandPlus => 46,
3779            KeyboardKeypad::KeyboardLeftBrace => 47,
3780            KeyboardKeypad::KeyboardRightBrace => 48,
3781            KeyboardKeypad::KeyboardBackslashandPipe => 49,
3782            KeyboardKeypad::KeyboardNonUSHashandTilde => 50,
3783            KeyboardKeypad::KeyboardSemiColonandColon => 51,
3784            KeyboardKeypad::KeyboardLeftAposandDouble => 52,
3785            KeyboardKeypad::KeyboardGraveAccentandTilde => 53,
3786            KeyboardKeypad::KeyboardCommaandLessThan => 54,
3787            KeyboardKeypad::KeyboardPeriodandGreaterThan => 55,
3788            KeyboardKeypad::KeyboardForwardSlashandQuestionMark => 56,
3789            KeyboardKeypad::KeyboardCapsLock => 57,
3790            KeyboardKeypad::KeyboardF1 => 58,
3791            KeyboardKeypad::KeyboardF2 => 59,
3792            KeyboardKeypad::KeyboardF3 => 60,
3793            KeyboardKeypad::KeyboardF4 => 61,
3794            KeyboardKeypad::KeyboardF5 => 62,
3795            KeyboardKeypad::KeyboardF6 => 63,
3796            KeyboardKeypad::KeyboardF7 => 64,
3797            KeyboardKeypad::KeyboardF8 => 65,
3798            KeyboardKeypad::KeyboardF9 => 66,
3799            KeyboardKeypad::KeyboardF10 => 67,
3800            KeyboardKeypad::KeyboardF11 => 68,
3801            KeyboardKeypad::KeyboardF12 => 69,
3802            KeyboardKeypad::KeyboardPrintScreen => 70,
3803            KeyboardKeypad::KeyboardScrollLock => 71,
3804            KeyboardKeypad::KeyboardPause => 72,
3805            KeyboardKeypad::KeyboardInsert => 73,
3806            KeyboardKeypad::KeyboardHome => 74,
3807            KeyboardKeypad::KeyboardPageUp => 75,
3808            KeyboardKeypad::KeyboardDeleteForward => 76,
3809            KeyboardKeypad::KeyboardEnd => 77,
3810            KeyboardKeypad::KeyboardPageDown => 78,
3811            KeyboardKeypad::KeyboardRightArrow => 79,
3812            KeyboardKeypad::KeyboardLeftArrow => 80,
3813            KeyboardKeypad::KeyboardDownArrow => 81,
3814            KeyboardKeypad::KeyboardUpArrow => 82,
3815            KeyboardKeypad::KeypadNumLockandClear => 83,
3816            KeyboardKeypad::KeypadForwardSlash => 84,
3817            KeyboardKeypad::KeypadStar => 85,
3818            KeyboardKeypad::KeypadDash => 86,
3819            KeyboardKeypad::KeypadPlus => 87,
3820            KeyboardKeypad::KeypadENTER => 88,
3821            KeyboardKeypad::Keypad1andEnd => 89,
3822            KeyboardKeypad::Keypad2andDownArrow => 90,
3823            KeyboardKeypad::Keypad3andPageDn => 91,
3824            KeyboardKeypad::Keypad4andLeftArrow => 92,
3825            KeyboardKeypad::Keypad5 => 93,
3826            KeyboardKeypad::Keypad6andRightArrow => 94,
3827            KeyboardKeypad::Keypad7andHome => 95,
3828            KeyboardKeypad::Keypad8andUpArrow => 96,
3829            KeyboardKeypad::Keypad9andPageUp => 97,
3830            KeyboardKeypad::Keypad0andInsert => 98,
3831            KeyboardKeypad::KeypadPeriodandDelete => 99,
3832            KeyboardKeypad::KeyboardNonUSBackslashandPipe => 100,
3833            KeyboardKeypad::KeyboardApplication => 101,
3834            KeyboardKeypad::KeyboardPower => 102,
3835            KeyboardKeypad::KeypadEquals => 103,
3836            KeyboardKeypad::KeyboardF13 => 104,
3837            KeyboardKeypad::KeyboardF14 => 105,
3838            KeyboardKeypad::KeyboardF15 => 106,
3839            KeyboardKeypad::KeyboardF16 => 107,
3840            KeyboardKeypad::KeyboardF17 => 108,
3841            KeyboardKeypad::KeyboardF18 => 109,
3842            KeyboardKeypad::KeyboardF19 => 110,
3843            KeyboardKeypad::KeyboardF20 => 111,
3844            KeyboardKeypad::KeyboardF21 => 112,
3845            KeyboardKeypad::KeyboardF22 => 113,
3846            KeyboardKeypad::KeyboardF23 => 114,
3847            KeyboardKeypad::KeyboardF24 => 115,
3848            KeyboardKeypad::KeyboardExecute => 116,
3849            KeyboardKeypad::KeyboardHelp => 117,
3850            KeyboardKeypad::KeyboardMenu => 118,
3851            KeyboardKeypad::KeyboardSelect => 119,
3852            KeyboardKeypad::KeyboardStop => 120,
3853            KeyboardKeypad::KeyboardAgain => 121,
3854            KeyboardKeypad::KeyboardUndo => 122,
3855            KeyboardKeypad::KeyboardCut => 123,
3856            KeyboardKeypad::KeyboardCopy => 124,
3857            KeyboardKeypad::KeyboardPaste => 125,
3858            KeyboardKeypad::KeyboardFind => 126,
3859            KeyboardKeypad::KeyboardMute => 127,
3860            KeyboardKeypad::KeyboardVolumeUp => 128,
3861            KeyboardKeypad::KeyboardVolumeDown => 129,
3862            KeyboardKeypad::KeyboardLockingCapsLock => 130,
3863            KeyboardKeypad::KeyboardLockingNumLock => 131,
3864            KeyboardKeypad::KeyboardLockingScrollLock => 132,
3865            KeyboardKeypad::KeypadComma => 133,
3866            KeyboardKeypad::KeypadEqualSign => 134,
3867            KeyboardKeypad::KeyboardInternational1 => 135,
3868            KeyboardKeypad::KeyboardInternational2 => 136,
3869            KeyboardKeypad::KeyboardInternational3 => 137,
3870            KeyboardKeypad::KeyboardInternational4 => 138,
3871            KeyboardKeypad::KeyboardInternational5 => 139,
3872            KeyboardKeypad::KeyboardInternational6 => 140,
3873            KeyboardKeypad::KeyboardInternational7 => 141,
3874            KeyboardKeypad::KeyboardInternational8 => 142,
3875            KeyboardKeypad::KeyboardInternational9 => 143,
3876            KeyboardKeypad::KeyboardLANG1 => 144,
3877            KeyboardKeypad::KeyboardLANG2 => 145,
3878            KeyboardKeypad::KeyboardLANG3 => 146,
3879            KeyboardKeypad::KeyboardLANG4 => 147,
3880            KeyboardKeypad::KeyboardLANG5 => 148,
3881            KeyboardKeypad::KeyboardLANG6 => 149,
3882            KeyboardKeypad::KeyboardLANG7 => 150,
3883            KeyboardKeypad::KeyboardLANG8 => 151,
3884            KeyboardKeypad::KeyboardLANG9 => 152,
3885            KeyboardKeypad::KeyboardAlternateErase => 153,
3886            KeyboardKeypad::KeyboardSysReqAttention => 154,
3887            KeyboardKeypad::KeyboardCancel => 155,
3888            KeyboardKeypad::KeyboardClear => 156,
3889            KeyboardKeypad::KeyboardPrior => 157,
3890            KeyboardKeypad::KeyboardReturn => 158,
3891            KeyboardKeypad::KeyboardSeparator => 159,
3892            KeyboardKeypad::KeyboardOut => 160,
3893            KeyboardKeypad::KeyboardOper => 161,
3894            KeyboardKeypad::KeyboardClearAgain => 162,
3895            KeyboardKeypad::KeyboardCrSelProps => 163,
3896            KeyboardKeypad::KeyboardExSel => 164,
3897            KeyboardKeypad::KeypadDouble0 => 176,
3898            KeyboardKeypad::KeypadTriple0 => 177,
3899            KeyboardKeypad::ThousandsSeparator => 178,
3900            KeyboardKeypad::DecimalSeparator => 179,
3901            KeyboardKeypad::CurrencyUnit => 180,
3902            KeyboardKeypad::CurrencySubunit => 181,
3903            KeyboardKeypad::KeypadLeftBracket => 182,
3904            KeyboardKeypad::KeypadRightBracket => 183,
3905            KeyboardKeypad::KeypadLeftBrace => 184,
3906            KeyboardKeypad::KeypadRightBrace => 185,
3907            KeyboardKeypad::KeypadTab => 186,
3908            KeyboardKeypad::KeypadBackspace => 187,
3909            KeyboardKeypad::KeypadA => 188,
3910            KeyboardKeypad::KeypadB => 189,
3911            KeyboardKeypad::KeypadC => 190,
3912            KeyboardKeypad::KeypadD => 191,
3913            KeyboardKeypad::KeypadE => 192,
3914            KeyboardKeypad::KeypadF => 193,
3915            KeyboardKeypad::KeypadXOR => 194,
3916            KeyboardKeypad::KeypadCaret => 195,
3917            KeyboardKeypad::KeypadPercentage => 196,
3918            KeyboardKeypad::KeypadLess => 197,
3919            KeyboardKeypad::KeypadGreater => 198,
3920            KeyboardKeypad::KeypadAmpersand => 199,
3921            KeyboardKeypad::KeypadDoubleAmpersand => 200,
3922            KeyboardKeypad::KeypadBar => 201,
3923            KeyboardKeypad::KeypadDoubleBar => 202,
3924            KeyboardKeypad::KeypadColon => 203,
3925            KeyboardKeypad::KeypadHash => 204,
3926            KeyboardKeypad::KeypadSpace => 205,
3927            KeyboardKeypad::KeypadAt => 206,
3928            KeyboardKeypad::KeypadBang => 207,
3929            KeyboardKeypad::KeypadMemoryStore => 208,
3930            KeyboardKeypad::KeypadMemoryRecall => 209,
3931            KeyboardKeypad::KeypadMemoryClear => 210,
3932            KeyboardKeypad::KeypadMemoryAdd => 211,
3933            KeyboardKeypad::KeypadMemorySubtract => 212,
3934            KeyboardKeypad::KeypadMemoryMultiply => 213,
3935            KeyboardKeypad::KeypadMemoryDivide => 214,
3936            KeyboardKeypad::KeypadPlusMinus => 215,
3937            KeyboardKeypad::KeypadClear => 216,
3938            KeyboardKeypad::KeypadClearEntry => 217,
3939            KeyboardKeypad::KeypadBinary => 218,
3940            KeyboardKeypad::KeypadOctal => 219,
3941            KeyboardKeypad::KeypadDecimal => 220,
3942            KeyboardKeypad::KeypadHexadecimal => 221,
3943            KeyboardKeypad::KeyboardLeftControl => 224,
3944            KeyboardKeypad::KeyboardLeftShift => 225,
3945            KeyboardKeypad::KeyboardLeftAlt => 226,
3946            KeyboardKeypad::KeyboardLeftGUI => 227,
3947            KeyboardKeypad::KeyboardRightControl => 228,
3948            KeyboardKeypad::KeyboardRightShift => 229,
3949            KeyboardKeypad::KeyboardRightAlt => 230,
3950            KeyboardKeypad::KeyboardRightGUI => 231,
3951        }
3952    }
3953}
3954
3955impl From<KeyboardKeypad> for u16 {
3956    /// Returns the 16bit value of this usage. This is identical
3957    /// to [KeyboardKeypad::usage_page_value()].
3958    fn from(keyboardkeypad: KeyboardKeypad) -> u16 {
3959        u16::from(&keyboardkeypad)
3960    }
3961}
3962
3963impl From<&KeyboardKeypad> for u32 {
3964    /// Returns the 32 bit value of this usage. This is identical
3965    /// to [KeyboardKeypad::usage_value()].
3966    fn from(keyboardkeypad: &KeyboardKeypad) -> u32 {
3967        let up = UsagePage::from(keyboardkeypad);
3968        let up = (u16::from(&up) as u32) << 16;
3969        let id = u16::from(keyboardkeypad) as u32;
3970        up | id
3971    }
3972}
3973
3974impl From<&KeyboardKeypad> for UsagePage {
3975    /// Always returns [UsagePage::KeyboardKeypad] and is
3976    /// identical to [KeyboardKeypad::usage_page()].
3977    fn from(_: &KeyboardKeypad) -> UsagePage {
3978        UsagePage::KeyboardKeypad
3979    }
3980}
3981
3982impl From<KeyboardKeypad> for UsagePage {
3983    /// Always returns [UsagePage::KeyboardKeypad] and is
3984    /// identical to [KeyboardKeypad::usage_page()].
3985    fn from(_: KeyboardKeypad) -> UsagePage {
3986        UsagePage::KeyboardKeypad
3987    }
3988}
3989
3990impl From<&KeyboardKeypad> for Usage {
3991    fn from(keyboardkeypad: &KeyboardKeypad) -> Usage {
3992        Usage::try_from(u32::from(keyboardkeypad)).unwrap()
3993    }
3994}
3995
3996impl From<KeyboardKeypad> for Usage {
3997    fn from(keyboardkeypad: KeyboardKeypad) -> Usage {
3998        Usage::from(&keyboardkeypad)
3999    }
4000}
4001
4002impl TryFrom<u16> for KeyboardKeypad {
4003    type Error = HutError;
4004
4005    fn try_from(usage_id: u16) -> Result<KeyboardKeypad> {
4006        match usage_id {
4007            1 => Ok(KeyboardKeypad::ErrorRollOver),
4008            2 => Ok(KeyboardKeypad::POSTFail),
4009            3 => Ok(KeyboardKeypad::ErrorUndefined),
4010            4 => Ok(KeyboardKeypad::KeyboardA),
4011            5 => Ok(KeyboardKeypad::KeyboardB),
4012            6 => Ok(KeyboardKeypad::KeyboardC),
4013            7 => Ok(KeyboardKeypad::KeyboardD),
4014            8 => Ok(KeyboardKeypad::KeyboardE),
4015            9 => Ok(KeyboardKeypad::KeyboardF),
4016            10 => Ok(KeyboardKeypad::KeyboardG),
4017            11 => Ok(KeyboardKeypad::KeyboardH),
4018            12 => Ok(KeyboardKeypad::KeyboardI),
4019            13 => Ok(KeyboardKeypad::KeyboardJ),
4020            14 => Ok(KeyboardKeypad::KeyboardK),
4021            15 => Ok(KeyboardKeypad::KeyboardL),
4022            16 => Ok(KeyboardKeypad::KeyboardM),
4023            17 => Ok(KeyboardKeypad::KeyboardN),
4024            18 => Ok(KeyboardKeypad::KeyboardO),
4025            19 => Ok(KeyboardKeypad::KeyboardP),
4026            20 => Ok(KeyboardKeypad::KeyboardQ),
4027            21 => Ok(KeyboardKeypad::KeyboardR),
4028            22 => Ok(KeyboardKeypad::KeyboardS),
4029            23 => Ok(KeyboardKeypad::KeyboardT),
4030            24 => Ok(KeyboardKeypad::KeyboardU),
4031            25 => Ok(KeyboardKeypad::KeyboardV),
4032            26 => Ok(KeyboardKeypad::KeyboardW),
4033            27 => Ok(KeyboardKeypad::KeyboardX),
4034            28 => Ok(KeyboardKeypad::KeyboardY),
4035            29 => Ok(KeyboardKeypad::KeyboardZ),
4036            30 => Ok(KeyboardKeypad::Keyboard1andBang),
4037            31 => Ok(KeyboardKeypad::Keyboard2andAt),
4038            32 => Ok(KeyboardKeypad::Keyboard3andHash),
4039            33 => Ok(KeyboardKeypad::Keyboard4andDollar),
4040            34 => Ok(KeyboardKeypad::Keyboard5andPercent),
4041            35 => Ok(KeyboardKeypad::Keyboard6andCaret),
4042            36 => Ok(KeyboardKeypad::Keyboard7andAmpersand),
4043            37 => Ok(KeyboardKeypad::Keyboard8andStar),
4044            38 => Ok(KeyboardKeypad::Keyboard9andLeftBracket),
4045            39 => Ok(KeyboardKeypad::Keyboard0andRightBracket),
4046            40 => Ok(KeyboardKeypad::KeyboardReturnEnter),
4047            41 => Ok(KeyboardKeypad::KeyboardEscape),
4048            42 => Ok(KeyboardKeypad::KeyboardDelete),
4049            43 => Ok(KeyboardKeypad::KeyboardTab),
4050            44 => Ok(KeyboardKeypad::KeyboardSpacebar),
4051            45 => Ok(KeyboardKeypad::KeyboardDashandUnderscore),
4052            46 => Ok(KeyboardKeypad::KeyboardEqualsandPlus),
4053            47 => Ok(KeyboardKeypad::KeyboardLeftBrace),
4054            48 => Ok(KeyboardKeypad::KeyboardRightBrace),
4055            49 => Ok(KeyboardKeypad::KeyboardBackslashandPipe),
4056            50 => Ok(KeyboardKeypad::KeyboardNonUSHashandTilde),
4057            51 => Ok(KeyboardKeypad::KeyboardSemiColonandColon),
4058            52 => Ok(KeyboardKeypad::KeyboardLeftAposandDouble),
4059            53 => Ok(KeyboardKeypad::KeyboardGraveAccentandTilde),
4060            54 => Ok(KeyboardKeypad::KeyboardCommaandLessThan),
4061            55 => Ok(KeyboardKeypad::KeyboardPeriodandGreaterThan),
4062            56 => Ok(KeyboardKeypad::KeyboardForwardSlashandQuestionMark),
4063            57 => Ok(KeyboardKeypad::KeyboardCapsLock),
4064            58 => Ok(KeyboardKeypad::KeyboardF1),
4065            59 => Ok(KeyboardKeypad::KeyboardF2),
4066            60 => Ok(KeyboardKeypad::KeyboardF3),
4067            61 => Ok(KeyboardKeypad::KeyboardF4),
4068            62 => Ok(KeyboardKeypad::KeyboardF5),
4069            63 => Ok(KeyboardKeypad::KeyboardF6),
4070            64 => Ok(KeyboardKeypad::KeyboardF7),
4071            65 => Ok(KeyboardKeypad::KeyboardF8),
4072            66 => Ok(KeyboardKeypad::KeyboardF9),
4073            67 => Ok(KeyboardKeypad::KeyboardF10),
4074            68 => Ok(KeyboardKeypad::KeyboardF11),
4075            69 => Ok(KeyboardKeypad::KeyboardF12),
4076            70 => Ok(KeyboardKeypad::KeyboardPrintScreen),
4077            71 => Ok(KeyboardKeypad::KeyboardScrollLock),
4078            72 => Ok(KeyboardKeypad::KeyboardPause),
4079            73 => Ok(KeyboardKeypad::KeyboardInsert),
4080            74 => Ok(KeyboardKeypad::KeyboardHome),
4081            75 => Ok(KeyboardKeypad::KeyboardPageUp),
4082            76 => Ok(KeyboardKeypad::KeyboardDeleteForward),
4083            77 => Ok(KeyboardKeypad::KeyboardEnd),
4084            78 => Ok(KeyboardKeypad::KeyboardPageDown),
4085            79 => Ok(KeyboardKeypad::KeyboardRightArrow),
4086            80 => Ok(KeyboardKeypad::KeyboardLeftArrow),
4087            81 => Ok(KeyboardKeypad::KeyboardDownArrow),
4088            82 => Ok(KeyboardKeypad::KeyboardUpArrow),
4089            83 => Ok(KeyboardKeypad::KeypadNumLockandClear),
4090            84 => Ok(KeyboardKeypad::KeypadForwardSlash),
4091            85 => Ok(KeyboardKeypad::KeypadStar),
4092            86 => Ok(KeyboardKeypad::KeypadDash),
4093            87 => Ok(KeyboardKeypad::KeypadPlus),
4094            88 => Ok(KeyboardKeypad::KeypadENTER),
4095            89 => Ok(KeyboardKeypad::Keypad1andEnd),
4096            90 => Ok(KeyboardKeypad::Keypad2andDownArrow),
4097            91 => Ok(KeyboardKeypad::Keypad3andPageDn),
4098            92 => Ok(KeyboardKeypad::Keypad4andLeftArrow),
4099            93 => Ok(KeyboardKeypad::Keypad5),
4100            94 => Ok(KeyboardKeypad::Keypad6andRightArrow),
4101            95 => Ok(KeyboardKeypad::Keypad7andHome),
4102            96 => Ok(KeyboardKeypad::Keypad8andUpArrow),
4103            97 => Ok(KeyboardKeypad::Keypad9andPageUp),
4104            98 => Ok(KeyboardKeypad::Keypad0andInsert),
4105            99 => Ok(KeyboardKeypad::KeypadPeriodandDelete),
4106            100 => Ok(KeyboardKeypad::KeyboardNonUSBackslashandPipe),
4107            101 => Ok(KeyboardKeypad::KeyboardApplication),
4108            102 => Ok(KeyboardKeypad::KeyboardPower),
4109            103 => Ok(KeyboardKeypad::KeypadEquals),
4110            104 => Ok(KeyboardKeypad::KeyboardF13),
4111            105 => Ok(KeyboardKeypad::KeyboardF14),
4112            106 => Ok(KeyboardKeypad::KeyboardF15),
4113            107 => Ok(KeyboardKeypad::KeyboardF16),
4114            108 => Ok(KeyboardKeypad::KeyboardF17),
4115            109 => Ok(KeyboardKeypad::KeyboardF18),
4116            110 => Ok(KeyboardKeypad::KeyboardF19),
4117            111 => Ok(KeyboardKeypad::KeyboardF20),
4118            112 => Ok(KeyboardKeypad::KeyboardF21),
4119            113 => Ok(KeyboardKeypad::KeyboardF22),
4120            114 => Ok(KeyboardKeypad::KeyboardF23),
4121            115 => Ok(KeyboardKeypad::KeyboardF24),
4122            116 => Ok(KeyboardKeypad::KeyboardExecute),
4123            117 => Ok(KeyboardKeypad::KeyboardHelp),
4124            118 => Ok(KeyboardKeypad::KeyboardMenu),
4125            119 => Ok(KeyboardKeypad::KeyboardSelect),
4126            120 => Ok(KeyboardKeypad::KeyboardStop),
4127            121 => Ok(KeyboardKeypad::KeyboardAgain),
4128            122 => Ok(KeyboardKeypad::KeyboardUndo),
4129            123 => Ok(KeyboardKeypad::KeyboardCut),
4130            124 => Ok(KeyboardKeypad::KeyboardCopy),
4131            125 => Ok(KeyboardKeypad::KeyboardPaste),
4132            126 => Ok(KeyboardKeypad::KeyboardFind),
4133            127 => Ok(KeyboardKeypad::KeyboardMute),
4134            128 => Ok(KeyboardKeypad::KeyboardVolumeUp),
4135            129 => Ok(KeyboardKeypad::KeyboardVolumeDown),
4136            130 => Ok(KeyboardKeypad::KeyboardLockingCapsLock),
4137            131 => Ok(KeyboardKeypad::KeyboardLockingNumLock),
4138            132 => Ok(KeyboardKeypad::KeyboardLockingScrollLock),
4139            133 => Ok(KeyboardKeypad::KeypadComma),
4140            134 => Ok(KeyboardKeypad::KeypadEqualSign),
4141            135 => Ok(KeyboardKeypad::KeyboardInternational1),
4142            136 => Ok(KeyboardKeypad::KeyboardInternational2),
4143            137 => Ok(KeyboardKeypad::KeyboardInternational3),
4144            138 => Ok(KeyboardKeypad::KeyboardInternational4),
4145            139 => Ok(KeyboardKeypad::KeyboardInternational5),
4146            140 => Ok(KeyboardKeypad::KeyboardInternational6),
4147            141 => Ok(KeyboardKeypad::KeyboardInternational7),
4148            142 => Ok(KeyboardKeypad::KeyboardInternational8),
4149            143 => Ok(KeyboardKeypad::KeyboardInternational9),
4150            144 => Ok(KeyboardKeypad::KeyboardLANG1),
4151            145 => Ok(KeyboardKeypad::KeyboardLANG2),
4152            146 => Ok(KeyboardKeypad::KeyboardLANG3),
4153            147 => Ok(KeyboardKeypad::KeyboardLANG4),
4154            148 => Ok(KeyboardKeypad::KeyboardLANG5),
4155            149 => Ok(KeyboardKeypad::KeyboardLANG6),
4156            150 => Ok(KeyboardKeypad::KeyboardLANG7),
4157            151 => Ok(KeyboardKeypad::KeyboardLANG8),
4158            152 => Ok(KeyboardKeypad::KeyboardLANG9),
4159            153 => Ok(KeyboardKeypad::KeyboardAlternateErase),
4160            154 => Ok(KeyboardKeypad::KeyboardSysReqAttention),
4161            155 => Ok(KeyboardKeypad::KeyboardCancel),
4162            156 => Ok(KeyboardKeypad::KeyboardClear),
4163            157 => Ok(KeyboardKeypad::KeyboardPrior),
4164            158 => Ok(KeyboardKeypad::KeyboardReturn),
4165            159 => Ok(KeyboardKeypad::KeyboardSeparator),
4166            160 => Ok(KeyboardKeypad::KeyboardOut),
4167            161 => Ok(KeyboardKeypad::KeyboardOper),
4168            162 => Ok(KeyboardKeypad::KeyboardClearAgain),
4169            163 => Ok(KeyboardKeypad::KeyboardCrSelProps),
4170            164 => Ok(KeyboardKeypad::KeyboardExSel),
4171            176 => Ok(KeyboardKeypad::KeypadDouble0),
4172            177 => Ok(KeyboardKeypad::KeypadTriple0),
4173            178 => Ok(KeyboardKeypad::ThousandsSeparator),
4174            179 => Ok(KeyboardKeypad::DecimalSeparator),
4175            180 => Ok(KeyboardKeypad::CurrencyUnit),
4176            181 => Ok(KeyboardKeypad::CurrencySubunit),
4177            182 => Ok(KeyboardKeypad::KeypadLeftBracket),
4178            183 => Ok(KeyboardKeypad::KeypadRightBracket),
4179            184 => Ok(KeyboardKeypad::KeypadLeftBrace),
4180            185 => Ok(KeyboardKeypad::KeypadRightBrace),
4181            186 => Ok(KeyboardKeypad::KeypadTab),
4182            187 => Ok(KeyboardKeypad::KeypadBackspace),
4183            188 => Ok(KeyboardKeypad::KeypadA),
4184            189 => Ok(KeyboardKeypad::KeypadB),
4185            190 => Ok(KeyboardKeypad::KeypadC),
4186            191 => Ok(KeyboardKeypad::KeypadD),
4187            192 => Ok(KeyboardKeypad::KeypadE),
4188            193 => Ok(KeyboardKeypad::KeypadF),
4189            194 => Ok(KeyboardKeypad::KeypadXOR),
4190            195 => Ok(KeyboardKeypad::KeypadCaret),
4191            196 => Ok(KeyboardKeypad::KeypadPercentage),
4192            197 => Ok(KeyboardKeypad::KeypadLess),
4193            198 => Ok(KeyboardKeypad::KeypadGreater),
4194            199 => Ok(KeyboardKeypad::KeypadAmpersand),
4195            200 => Ok(KeyboardKeypad::KeypadDoubleAmpersand),
4196            201 => Ok(KeyboardKeypad::KeypadBar),
4197            202 => Ok(KeyboardKeypad::KeypadDoubleBar),
4198            203 => Ok(KeyboardKeypad::KeypadColon),
4199            204 => Ok(KeyboardKeypad::KeypadHash),
4200            205 => Ok(KeyboardKeypad::KeypadSpace),
4201            206 => Ok(KeyboardKeypad::KeypadAt),
4202            207 => Ok(KeyboardKeypad::KeypadBang),
4203            208 => Ok(KeyboardKeypad::KeypadMemoryStore),
4204            209 => Ok(KeyboardKeypad::KeypadMemoryRecall),
4205            210 => Ok(KeyboardKeypad::KeypadMemoryClear),
4206            211 => Ok(KeyboardKeypad::KeypadMemoryAdd),
4207            212 => Ok(KeyboardKeypad::KeypadMemorySubtract),
4208            213 => Ok(KeyboardKeypad::KeypadMemoryMultiply),
4209            214 => Ok(KeyboardKeypad::KeypadMemoryDivide),
4210            215 => Ok(KeyboardKeypad::KeypadPlusMinus),
4211            216 => Ok(KeyboardKeypad::KeypadClear),
4212            217 => Ok(KeyboardKeypad::KeypadClearEntry),
4213            218 => Ok(KeyboardKeypad::KeypadBinary),
4214            219 => Ok(KeyboardKeypad::KeypadOctal),
4215            220 => Ok(KeyboardKeypad::KeypadDecimal),
4216            221 => Ok(KeyboardKeypad::KeypadHexadecimal),
4217            224 => Ok(KeyboardKeypad::KeyboardLeftControl),
4218            225 => Ok(KeyboardKeypad::KeyboardLeftShift),
4219            226 => Ok(KeyboardKeypad::KeyboardLeftAlt),
4220            227 => Ok(KeyboardKeypad::KeyboardLeftGUI),
4221            228 => Ok(KeyboardKeypad::KeyboardRightControl),
4222            229 => Ok(KeyboardKeypad::KeyboardRightShift),
4223            230 => Ok(KeyboardKeypad::KeyboardRightAlt),
4224            231 => Ok(KeyboardKeypad::KeyboardRightGUI),
4225            n => Err(HutError::UnknownUsageId { usage_id: n }),
4226        }
4227    }
4228}
4229
4230impl BitOr<u16> for KeyboardKeypad {
4231    type Output = Usage;
4232
4233    /// A convenience function to combine a Usage Page with
4234    /// a value.
4235    ///
4236    /// This function panics if the Usage ID value results in
4237    /// an unknown Usage. Where error checking is required,
4238    /// use [UsagePage::to_usage_from_value].
4239    fn bitor(self, usage: u16) -> Usage {
4240        let up = u16::from(self) as u32;
4241        let u = usage as u32;
4242        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
4243    }
4244}
4245
4246/// *Usage Page `0x8`: "LED"*
4247///
4248/// **This enum is autogenerated from the HID Usage Tables**.
4249/// ```
4250/// # use hut::*;
4251/// let u1 = Usage::LED(LED::CapsLock);
4252/// let u2 = Usage::new_from_page_and_id(0x8, 0x2).unwrap();
4253/// let u3 = Usage::from(LED::CapsLock);
4254/// let u4: Usage = LED::CapsLock.into();
4255/// assert_eq!(u1, u2);
4256/// assert_eq!(u1, u3);
4257/// assert_eq!(u1, u4);
4258///
4259/// assert!(matches!(u1.usage_page(), UsagePage::LED));
4260/// assert_eq!(0x8, u1.usage_page_value());
4261/// assert_eq!(0x2, u1.usage_id_value());
4262/// assert_eq!((0x8 << 16) | 0x2, u1.usage_value());
4263/// assert_eq!("Caps Lock", u1.name());
4264/// ```
4265///
4266#[allow(non_camel_case_types)]
4267#[derive(Debug)]
4268#[non_exhaustive]
4269pub enum LED {
4270    /// Usage ID `0x1`: "Num Lock"
4271    NumLock,
4272    /// Usage ID `0x2`: "Caps Lock"
4273    CapsLock,
4274    /// Usage ID `0x3`: "Scroll Lock"
4275    ScrollLock,
4276    /// Usage ID `0x4`: "Compose"
4277    Compose,
4278    /// Usage ID `0x5`: "Kana"
4279    Kana,
4280    /// Usage ID `0x6`: "Power"
4281    Power,
4282    /// Usage ID `0x7`: "Shift"
4283    Shift,
4284    /// Usage ID `0x8`: "Do Not Disturb"
4285    DoNotDisturb,
4286    /// Usage ID `0x9`: "Mute"
4287    Mute,
4288    /// Usage ID `0xA`: "Tone Enable"
4289    ToneEnable,
4290    /// Usage ID `0xB`: "High Cut Filter"
4291    HighCutFilter,
4292    /// Usage ID `0xC`: "Low Cut Filter"
4293    LowCutFilter,
4294    /// Usage ID `0xD`: "Equalizer Enable"
4295    EqualizerEnable,
4296    /// Usage ID `0xE`: "Sound Field On"
4297    SoundFieldOn,
4298    /// Usage ID `0xF`: "Surround On"
4299    SurroundOn,
4300    /// Usage ID `0x10`: "Repeat"
4301    Repeat,
4302    /// Usage ID `0x11`: "Stereo"
4303    Stereo,
4304    /// Usage ID `0x12`: "Sampling Rate Detect"
4305    SamplingRateDetect,
4306    /// Usage ID `0x13`: "Spinning"
4307    Spinning,
4308    /// Usage ID `0x14`: "CAV"
4309    CAV,
4310    /// Usage ID `0x15`: "CLV"
4311    CLV,
4312    /// Usage ID `0x16`: "Recording Format Detect"
4313    RecordingFormatDetect,
4314    /// Usage ID `0x17`: "Off-Hook"
4315    OffHook,
4316    /// Usage ID `0x18`: "Ring"
4317    Ring,
4318    /// Usage ID `0x19`: "Message Waiting"
4319    MessageWaiting,
4320    /// Usage ID `0x1A`: "Data Mode"
4321    DataMode,
4322    /// Usage ID `0x1B`: "Battery Operation"
4323    BatteryOperation,
4324    /// Usage ID `0x1C`: "Battery OK"
4325    BatteryOK,
4326    /// Usage ID `0x1D`: "Battery Low"
4327    BatteryLow,
4328    /// Usage ID `0x1E`: "Speaker"
4329    Speaker,
4330    /// Usage ID `0x1F`: "Headset"
4331    Headset,
4332    /// Usage ID `0x20`: "Hold"
4333    Hold,
4334    /// Usage ID `0x21`: "Microphone"
4335    Microphone,
4336    /// Usage ID `0x22`: "Coverage"
4337    Coverage,
4338    /// Usage ID `0x23`: "Night Mode"
4339    NightMode,
4340    /// Usage ID `0x24`: "Send Calls"
4341    SendCalls,
4342    /// Usage ID `0x25`: "Call Pickup"
4343    CallPickup,
4344    /// Usage ID `0x26`: "Conference"
4345    Conference,
4346    /// Usage ID `0x27`: "Stand-by"
4347    Standby,
4348    /// Usage ID `0x28`: "Camera On"
4349    CameraOn,
4350    /// Usage ID `0x29`: "Camera Off"
4351    CameraOff,
4352    /// Usage ID `0x2A`: "On-Line"
4353    OnLine,
4354    /// Usage ID `0x2B`: "Off-Line"
4355    OffLine,
4356    /// Usage ID `0x2C`: "Busy"
4357    Busy,
4358    /// Usage ID `0x2D`: "Ready"
4359    Ready,
4360    /// Usage ID `0x2E`: "Paper-Out"
4361    PaperOut,
4362    /// Usage ID `0x2F`: "Paper-Jam"
4363    PaperJam,
4364    /// Usage ID `0x30`: "Remote"
4365    Remote,
4366    /// Usage ID `0x31`: "Forward"
4367    Forward,
4368    /// Usage ID `0x32`: "Reverse"
4369    Reverse,
4370    /// Usage ID `0x33`: "Stop"
4371    Stop,
4372    /// Usage ID `0x34`: "Rewind"
4373    Rewind,
4374    /// Usage ID `0x35`: "Fast Forward"
4375    FastForward,
4376    /// Usage ID `0x36`: "Play"
4377    Play,
4378    /// Usage ID `0x37`: "Pause"
4379    Pause,
4380    /// Usage ID `0x38`: "Record"
4381    Record,
4382    /// Usage ID `0x39`: "Error"
4383    Error,
4384    /// Usage ID `0x3A`: "Usage Selected Indicator"
4385    UsageSelectedIndicator,
4386    /// Usage ID `0x3B`: "Usage In Use Indicator"
4387    UsageInUseIndicator,
4388    /// Usage ID `0x3C`: "Usage Multi Mode Indicator"
4389    UsageMultiModeIndicator,
4390    /// Usage ID `0x3D`: "Indicator On"
4391    IndicatorOn,
4392    /// Usage ID `0x3E`: "Indicator Flash"
4393    IndicatorFlash,
4394    /// Usage ID `0x3F`: "Indicator Slow Blink"
4395    IndicatorSlowBlink,
4396    /// Usage ID `0x40`: "Indicator Fast Blink"
4397    IndicatorFastBlink,
4398    /// Usage ID `0x41`: "Indicator Off"
4399    IndicatorOff,
4400    /// Usage ID `0x42`: "Flash On Time"
4401    FlashOnTime,
4402    /// Usage ID `0x43`: "Slow Blink On Time"
4403    SlowBlinkOnTime,
4404    /// Usage ID `0x44`: "Slow Blink Off Time"
4405    SlowBlinkOffTime,
4406    /// Usage ID `0x45`: "Fast Blink On Time"
4407    FastBlinkOnTime,
4408    /// Usage ID `0x46`: "Fast Blink Off Time"
4409    FastBlinkOffTime,
4410    /// Usage ID `0x47`: "Usage Indicator Color"
4411    UsageIndicatorColor,
4412    /// Usage ID `0x48`: "Indicator Red"
4413    IndicatorRed,
4414    /// Usage ID `0x49`: "Indicator Green"
4415    IndicatorGreen,
4416    /// Usage ID `0x4A`: "Indicator Amber"
4417    IndicatorAmber,
4418    /// Usage ID `0x4B`: "Generic Indicator"
4419    GenericIndicator,
4420    /// Usage ID `0x4C`: "System Suspend"
4421    SystemSuspend,
4422    /// Usage ID `0x4D`: "External Power Connected"
4423    ExternalPowerConnected,
4424    /// Usage ID `0x4E`: "Indicator Blue"
4425    IndicatorBlue,
4426    /// Usage ID `0x4F`: "Indicator Orange"
4427    IndicatorOrange,
4428    /// Usage ID `0x50`: "Good Status"
4429    GoodStatus,
4430    /// Usage ID `0x51`: "Warning Status"
4431    WarningStatus,
4432    /// Usage ID `0x52`: "RGB LED"
4433    RGBLED,
4434    /// Usage ID `0x53`: "Red LED Channel"
4435    RedLEDChannel,
4436    /// Usage ID `0x54`: "Blue LED Channel"
4437    BlueLEDChannel,
4438    /// Usage ID `0x55`: "Green LED Channel"
4439    GreenLEDChannel,
4440    /// Usage ID `0x56`: "LED Intensity"
4441    LEDIntensity,
4442    /// Usage ID `0x57`: "System Microphone Mute"
4443    SystemMicrophoneMute,
4444    /// Usage ID `0x60`: "Player Indicator"
4445    PlayerIndicator,
4446    /// Usage ID `0x61`: "Player 1"
4447    Player1,
4448    /// Usage ID `0x62`: "Player 2"
4449    Player2,
4450    /// Usage ID `0x63`: "Player 3"
4451    Player3,
4452    /// Usage ID `0x64`: "Player 4"
4453    Player4,
4454    /// Usage ID `0x65`: "Player 5"
4455    Player5,
4456    /// Usage ID `0x66`: "Player 6"
4457    Player6,
4458    /// Usage ID `0x67`: "Player 7"
4459    Player7,
4460    /// Usage ID `0x68`: "Player 8"
4461    Player8,
4462}
4463
4464impl LED {
4465    #[cfg(feature = "std")]
4466    pub fn name(&self) -> String {
4467        match self {
4468            LED::NumLock => "Num Lock",
4469            LED::CapsLock => "Caps Lock",
4470            LED::ScrollLock => "Scroll Lock",
4471            LED::Compose => "Compose",
4472            LED::Kana => "Kana",
4473            LED::Power => "Power",
4474            LED::Shift => "Shift",
4475            LED::DoNotDisturb => "Do Not Disturb",
4476            LED::Mute => "Mute",
4477            LED::ToneEnable => "Tone Enable",
4478            LED::HighCutFilter => "High Cut Filter",
4479            LED::LowCutFilter => "Low Cut Filter",
4480            LED::EqualizerEnable => "Equalizer Enable",
4481            LED::SoundFieldOn => "Sound Field On",
4482            LED::SurroundOn => "Surround On",
4483            LED::Repeat => "Repeat",
4484            LED::Stereo => "Stereo",
4485            LED::SamplingRateDetect => "Sampling Rate Detect",
4486            LED::Spinning => "Spinning",
4487            LED::CAV => "CAV",
4488            LED::CLV => "CLV",
4489            LED::RecordingFormatDetect => "Recording Format Detect",
4490            LED::OffHook => "Off-Hook",
4491            LED::Ring => "Ring",
4492            LED::MessageWaiting => "Message Waiting",
4493            LED::DataMode => "Data Mode",
4494            LED::BatteryOperation => "Battery Operation",
4495            LED::BatteryOK => "Battery OK",
4496            LED::BatteryLow => "Battery Low",
4497            LED::Speaker => "Speaker",
4498            LED::Headset => "Headset",
4499            LED::Hold => "Hold",
4500            LED::Microphone => "Microphone",
4501            LED::Coverage => "Coverage",
4502            LED::NightMode => "Night Mode",
4503            LED::SendCalls => "Send Calls",
4504            LED::CallPickup => "Call Pickup",
4505            LED::Conference => "Conference",
4506            LED::Standby => "Stand-by",
4507            LED::CameraOn => "Camera On",
4508            LED::CameraOff => "Camera Off",
4509            LED::OnLine => "On-Line",
4510            LED::OffLine => "Off-Line",
4511            LED::Busy => "Busy",
4512            LED::Ready => "Ready",
4513            LED::PaperOut => "Paper-Out",
4514            LED::PaperJam => "Paper-Jam",
4515            LED::Remote => "Remote",
4516            LED::Forward => "Forward",
4517            LED::Reverse => "Reverse",
4518            LED::Stop => "Stop",
4519            LED::Rewind => "Rewind",
4520            LED::FastForward => "Fast Forward",
4521            LED::Play => "Play",
4522            LED::Pause => "Pause",
4523            LED::Record => "Record",
4524            LED::Error => "Error",
4525            LED::UsageSelectedIndicator => "Usage Selected Indicator",
4526            LED::UsageInUseIndicator => "Usage In Use Indicator",
4527            LED::UsageMultiModeIndicator => "Usage Multi Mode Indicator",
4528            LED::IndicatorOn => "Indicator On",
4529            LED::IndicatorFlash => "Indicator Flash",
4530            LED::IndicatorSlowBlink => "Indicator Slow Blink",
4531            LED::IndicatorFastBlink => "Indicator Fast Blink",
4532            LED::IndicatorOff => "Indicator Off",
4533            LED::FlashOnTime => "Flash On Time",
4534            LED::SlowBlinkOnTime => "Slow Blink On Time",
4535            LED::SlowBlinkOffTime => "Slow Blink Off Time",
4536            LED::FastBlinkOnTime => "Fast Blink On Time",
4537            LED::FastBlinkOffTime => "Fast Blink Off Time",
4538            LED::UsageIndicatorColor => "Usage Indicator Color",
4539            LED::IndicatorRed => "Indicator Red",
4540            LED::IndicatorGreen => "Indicator Green",
4541            LED::IndicatorAmber => "Indicator Amber",
4542            LED::GenericIndicator => "Generic Indicator",
4543            LED::SystemSuspend => "System Suspend",
4544            LED::ExternalPowerConnected => "External Power Connected",
4545            LED::IndicatorBlue => "Indicator Blue",
4546            LED::IndicatorOrange => "Indicator Orange",
4547            LED::GoodStatus => "Good Status",
4548            LED::WarningStatus => "Warning Status",
4549            LED::RGBLED => "RGB LED",
4550            LED::RedLEDChannel => "Red LED Channel",
4551            LED::BlueLEDChannel => "Blue LED Channel",
4552            LED::GreenLEDChannel => "Green LED Channel",
4553            LED::LEDIntensity => "LED Intensity",
4554            LED::SystemMicrophoneMute => "System Microphone Mute",
4555            LED::PlayerIndicator => "Player Indicator",
4556            LED::Player1 => "Player 1",
4557            LED::Player2 => "Player 2",
4558            LED::Player3 => "Player 3",
4559            LED::Player4 => "Player 4",
4560            LED::Player5 => "Player 5",
4561            LED::Player6 => "Player 6",
4562            LED::Player7 => "Player 7",
4563            LED::Player8 => "Player 8",
4564        }
4565        .into()
4566    }
4567}
4568
4569#[cfg(feature = "std")]
4570impl fmt::Display for LED {
4571    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
4572        write!(f, "{}", self.name())
4573    }
4574}
4575
4576impl AsUsage for LED {
4577    /// Returns the 32 bit Usage value of this Usage
4578    fn usage_value(&self) -> u32 {
4579        u32::from(self)
4580    }
4581
4582    /// Returns the 16 bit Usage ID value of this Usage
4583    fn usage_id_value(&self) -> u16 {
4584        u16::from(self)
4585    }
4586
4587    /// Returns this usage as [Usage::LED(self)](Usage::LED)
4588    /// This is a convenience function to avoid having
4589    /// to implement `From` for every used type in the caller.
4590    ///
4591    /// ```
4592    /// # use hut::*;
4593    /// let gd_x = GenericDesktop::X;
4594    /// let usage = Usage::from(GenericDesktop::X);
4595    /// assert!(matches!(gd_x.usage(), usage));
4596    /// ```
4597    fn usage(&self) -> Usage {
4598        Usage::from(self)
4599    }
4600}
4601
4602impl AsUsagePage for LED {
4603    /// Returns the 16 bit value of this UsagePage
4604    ///
4605    /// This value is `0x8` for [LED]
4606    fn usage_page_value(&self) -> u16 {
4607        let up = UsagePage::from(self);
4608        u16::from(up)
4609    }
4610
4611    /// Returns [UsagePage::LED]]
4612    fn usage_page(&self) -> UsagePage {
4613        UsagePage::from(self)
4614    }
4615}
4616
4617impl From<&LED> for u16 {
4618    fn from(led: &LED) -> u16 {
4619        match *led {
4620            LED::NumLock => 1,
4621            LED::CapsLock => 2,
4622            LED::ScrollLock => 3,
4623            LED::Compose => 4,
4624            LED::Kana => 5,
4625            LED::Power => 6,
4626            LED::Shift => 7,
4627            LED::DoNotDisturb => 8,
4628            LED::Mute => 9,
4629            LED::ToneEnable => 10,
4630            LED::HighCutFilter => 11,
4631            LED::LowCutFilter => 12,
4632            LED::EqualizerEnable => 13,
4633            LED::SoundFieldOn => 14,
4634            LED::SurroundOn => 15,
4635            LED::Repeat => 16,
4636            LED::Stereo => 17,
4637            LED::SamplingRateDetect => 18,
4638            LED::Spinning => 19,
4639            LED::CAV => 20,
4640            LED::CLV => 21,
4641            LED::RecordingFormatDetect => 22,
4642            LED::OffHook => 23,
4643            LED::Ring => 24,
4644            LED::MessageWaiting => 25,
4645            LED::DataMode => 26,
4646            LED::BatteryOperation => 27,
4647            LED::BatteryOK => 28,
4648            LED::BatteryLow => 29,
4649            LED::Speaker => 30,
4650            LED::Headset => 31,
4651            LED::Hold => 32,
4652            LED::Microphone => 33,
4653            LED::Coverage => 34,
4654            LED::NightMode => 35,
4655            LED::SendCalls => 36,
4656            LED::CallPickup => 37,
4657            LED::Conference => 38,
4658            LED::Standby => 39,
4659            LED::CameraOn => 40,
4660            LED::CameraOff => 41,
4661            LED::OnLine => 42,
4662            LED::OffLine => 43,
4663            LED::Busy => 44,
4664            LED::Ready => 45,
4665            LED::PaperOut => 46,
4666            LED::PaperJam => 47,
4667            LED::Remote => 48,
4668            LED::Forward => 49,
4669            LED::Reverse => 50,
4670            LED::Stop => 51,
4671            LED::Rewind => 52,
4672            LED::FastForward => 53,
4673            LED::Play => 54,
4674            LED::Pause => 55,
4675            LED::Record => 56,
4676            LED::Error => 57,
4677            LED::UsageSelectedIndicator => 58,
4678            LED::UsageInUseIndicator => 59,
4679            LED::UsageMultiModeIndicator => 60,
4680            LED::IndicatorOn => 61,
4681            LED::IndicatorFlash => 62,
4682            LED::IndicatorSlowBlink => 63,
4683            LED::IndicatorFastBlink => 64,
4684            LED::IndicatorOff => 65,
4685            LED::FlashOnTime => 66,
4686            LED::SlowBlinkOnTime => 67,
4687            LED::SlowBlinkOffTime => 68,
4688            LED::FastBlinkOnTime => 69,
4689            LED::FastBlinkOffTime => 70,
4690            LED::UsageIndicatorColor => 71,
4691            LED::IndicatorRed => 72,
4692            LED::IndicatorGreen => 73,
4693            LED::IndicatorAmber => 74,
4694            LED::GenericIndicator => 75,
4695            LED::SystemSuspend => 76,
4696            LED::ExternalPowerConnected => 77,
4697            LED::IndicatorBlue => 78,
4698            LED::IndicatorOrange => 79,
4699            LED::GoodStatus => 80,
4700            LED::WarningStatus => 81,
4701            LED::RGBLED => 82,
4702            LED::RedLEDChannel => 83,
4703            LED::BlueLEDChannel => 84,
4704            LED::GreenLEDChannel => 85,
4705            LED::LEDIntensity => 86,
4706            LED::SystemMicrophoneMute => 87,
4707            LED::PlayerIndicator => 96,
4708            LED::Player1 => 97,
4709            LED::Player2 => 98,
4710            LED::Player3 => 99,
4711            LED::Player4 => 100,
4712            LED::Player5 => 101,
4713            LED::Player6 => 102,
4714            LED::Player7 => 103,
4715            LED::Player8 => 104,
4716        }
4717    }
4718}
4719
4720impl From<LED> for u16 {
4721    /// Returns the 16bit value of this usage. This is identical
4722    /// to [LED::usage_page_value()].
4723    fn from(led: LED) -> u16 {
4724        u16::from(&led)
4725    }
4726}
4727
4728impl From<&LED> for u32 {
4729    /// Returns the 32 bit value of this usage. This is identical
4730    /// to [LED::usage_value()].
4731    fn from(led: &LED) -> u32 {
4732        let up = UsagePage::from(led);
4733        let up = (u16::from(&up) as u32) << 16;
4734        let id = u16::from(led) as u32;
4735        up | id
4736    }
4737}
4738
4739impl From<&LED> for UsagePage {
4740    /// Always returns [UsagePage::LED] and is
4741    /// identical to [LED::usage_page()].
4742    fn from(_: &LED) -> UsagePage {
4743        UsagePage::LED
4744    }
4745}
4746
4747impl From<LED> for UsagePage {
4748    /// Always returns [UsagePage::LED] and is
4749    /// identical to [LED::usage_page()].
4750    fn from(_: LED) -> UsagePage {
4751        UsagePage::LED
4752    }
4753}
4754
4755impl From<&LED> for Usage {
4756    fn from(led: &LED) -> Usage {
4757        Usage::try_from(u32::from(led)).unwrap()
4758    }
4759}
4760
4761impl From<LED> for Usage {
4762    fn from(led: LED) -> Usage {
4763        Usage::from(&led)
4764    }
4765}
4766
4767impl TryFrom<u16> for LED {
4768    type Error = HutError;
4769
4770    fn try_from(usage_id: u16) -> Result<LED> {
4771        match usage_id {
4772            1 => Ok(LED::NumLock),
4773            2 => Ok(LED::CapsLock),
4774            3 => Ok(LED::ScrollLock),
4775            4 => Ok(LED::Compose),
4776            5 => Ok(LED::Kana),
4777            6 => Ok(LED::Power),
4778            7 => Ok(LED::Shift),
4779            8 => Ok(LED::DoNotDisturb),
4780            9 => Ok(LED::Mute),
4781            10 => Ok(LED::ToneEnable),
4782            11 => Ok(LED::HighCutFilter),
4783            12 => Ok(LED::LowCutFilter),
4784            13 => Ok(LED::EqualizerEnable),
4785            14 => Ok(LED::SoundFieldOn),
4786            15 => Ok(LED::SurroundOn),
4787            16 => Ok(LED::Repeat),
4788            17 => Ok(LED::Stereo),
4789            18 => Ok(LED::SamplingRateDetect),
4790            19 => Ok(LED::Spinning),
4791            20 => Ok(LED::CAV),
4792            21 => Ok(LED::CLV),
4793            22 => Ok(LED::RecordingFormatDetect),
4794            23 => Ok(LED::OffHook),
4795            24 => Ok(LED::Ring),
4796            25 => Ok(LED::MessageWaiting),
4797            26 => Ok(LED::DataMode),
4798            27 => Ok(LED::BatteryOperation),
4799            28 => Ok(LED::BatteryOK),
4800            29 => Ok(LED::BatteryLow),
4801            30 => Ok(LED::Speaker),
4802            31 => Ok(LED::Headset),
4803            32 => Ok(LED::Hold),
4804            33 => Ok(LED::Microphone),
4805            34 => Ok(LED::Coverage),
4806            35 => Ok(LED::NightMode),
4807            36 => Ok(LED::SendCalls),
4808            37 => Ok(LED::CallPickup),
4809            38 => Ok(LED::Conference),
4810            39 => Ok(LED::Standby),
4811            40 => Ok(LED::CameraOn),
4812            41 => Ok(LED::CameraOff),
4813            42 => Ok(LED::OnLine),
4814            43 => Ok(LED::OffLine),
4815            44 => Ok(LED::Busy),
4816            45 => Ok(LED::Ready),
4817            46 => Ok(LED::PaperOut),
4818            47 => Ok(LED::PaperJam),
4819            48 => Ok(LED::Remote),
4820            49 => Ok(LED::Forward),
4821            50 => Ok(LED::Reverse),
4822            51 => Ok(LED::Stop),
4823            52 => Ok(LED::Rewind),
4824            53 => Ok(LED::FastForward),
4825            54 => Ok(LED::Play),
4826            55 => Ok(LED::Pause),
4827            56 => Ok(LED::Record),
4828            57 => Ok(LED::Error),
4829            58 => Ok(LED::UsageSelectedIndicator),
4830            59 => Ok(LED::UsageInUseIndicator),
4831            60 => Ok(LED::UsageMultiModeIndicator),
4832            61 => Ok(LED::IndicatorOn),
4833            62 => Ok(LED::IndicatorFlash),
4834            63 => Ok(LED::IndicatorSlowBlink),
4835            64 => Ok(LED::IndicatorFastBlink),
4836            65 => Ok(LED::IndicatorOff),
4837            66 => Ok(LED::FlashOnTime),
4838            67 => Ok(LED::SlowBlinkOnTime),
4839            68 => Ok(LED::SlowBlinkOffTime),
4840            69 => Ok(LED::FastBlinkOnTime),
4841            70 => Ok(LED::FastBlinkOffTime),
4842            71 => Ok(LED::UsageIndicatorColor),
4843            72 => Ok(LED::IndicatorRed),
4844            73 => Ok(LED::IndicatorGreen),
4845            74 => Ok(LED::IndicatorAmber),
4846            75 => Ok(LED::GenericIndicator),
4847            76 => Ok(LED::SystemSuspend),
4848            77 => Ok(LED::ExternalPowerConnected),
4849            78 => Ok(LED::IndicatorBlue),
4850            79 => Ok(LED::IndicatorOrange),
4851            80 => Ok(LED::GoodStatus),
4852            81 => Ok(LED::WarningStatus),
4853            82 => Ok(LED::RGBLED),
4854            83 => Ok(LED::RedLEDChannel),
4855            84 => Ok(LED::BlueLEDChannel),
4856            85 => Ok(LED::GreenLEDChannel),
4857            86 => Ok(LED::LEDIntensity),
4858            87 => Ok(LED::SystemMicrophoneMute),
4859            96 => Ok(LED::PlayerIndicator),
4860            97 => Ok(LED::Player1),
4861            98 => Ok(LED::Player2),
4862            99 => Ok(LED::Player3),
4863            100 => Ok(LED::Player4),
4864            101 => Ok(LED::Player5),
4865            102 => Ok(LED::Player6),
4866            103 => Ok(LED::Player7),
4867            104 => Ok(LED::Player8),
4868            n => Err(HutError::UnknownUsageId { usage_id: n }),
4869        }
4870    }
4871}
4872
4873impl BitOr<u16> for LED {
4874    type Output = Usage;
4875
4876    /// A convenience function to combine a Usage Page with
4877    /// a value.
4878    ///
4879    /// This function panics if the Usage ID value results in
4880    /// an unknown Usage. Where error checking is required,
4881    /// use [UsagePage::to_usage_from_value].
4882    fn bitor(self, usage: u16) -> Usage {
4883        let up = u16::from(self) as u32;
4884        let u = usage as u32;
4885        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
4886    }
4887}
4888
4889/// *Usage Page `0x9`: "Button"*
4890///
4891/// **This enum is autogenerated from the HID Usage Tables**.
4892///
4893/// This Usage Page is generated, not defined, any Usage IDs in this Usage
4894/// Page are simply the button number.
4895///
4896/// ```
4897/// # use hut::*;
4898/// let u1 = Usage::Button(Button::Button(3));
4899/// let u2 = Usage::new_from_page_and_id(0x9, 3).unwrap();
4900/// let u3 = Usage::from(Button::Button(3));
4901/// let u4: Usage = Button::Button(3).into();
4902/// assert_eq!(u1, u2);
4903/// assert_eq!(u1, u3);
4904/// assert_eq!(u1, u4);
4905///
4906/// assert!(matches!(u1.usage_page(), UsagePage::Button));
4907/// assert_eq!(0x9, u1.usage_page_value());
4908/// assert_eq!(3, u1.usage_id_value());
4909/// assert_eq!((0x9 << 16) | 3, u1.usage_value());
4910/// assert_eq!("Button 3", u1.name());
4911/// ```
4912#[allow(non_camel_case_types)]
4913#[derive(Debug)]
4914#[non_exhaustive]
4915pub enum Button {
4916    Button(u16),
4917}
4918
4919impl Button {
4920    #[cfg(feature = "std")]
4921    pub fn name(&self) -> String {
4922        match self {
4923            Button::Button(button) => format!("Button {button}"),
4924        }
4925    }
4926}
4927
4928#[cfg(feature = "std")]
4929impl fmt::Display for Button {
4930    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
4931        write!(f, "{}", self.name())
4932    }
4933}
4934
4935impl AsUsage for Button {
4936    /// Returns the 32 bit Usage value of this Usage
4937    fn usage_value(&self) -> u32 {
4938        u32::from(self)
4939    }
4940
4941    /// Returns the 16 bit Usage ID value of this Usage
4942    fn usage_id_value(&self) -> u16 {
4943        u16::from(self)
4944    }
4945
4946    /// Returns this usage as [Usage::Button(self)](Usage::Button)
4947    /// This is a convenience function to avoid having
4948    /// to implement `From` for every used type in the caller.
4949    ///
4950    /// ```
4951    /// # use hut::*;
4952    /// let gd_x = GenericDesktop::X;
4953    /// let usage = Usage::from(GenericDesktop::X);
4954    /// assert!(matches!(gd_x.usage(), usage));
4955    /// ```
4956    fn usage(&self) -> Usage {
4957        Usage::from(self)
4958    }
4959}
4960
4961impl AsUsagePage for Button {
4962    /// Returns the 16 bit value of this UsagePage
4963    ///
4964    /// This value is `0x9` for [Button]
4965    fn usage_page_value(&self) -> u16 {
4966        let up = UsagePage::from(self);
4967        u16::from(up)
4968    }
4969
4970    /// Returns [UsagePage::Button]]
4971    fn usage_page(&self) -> UsagePage {
4972        UsagePage::from(self)
4973    }
4974}
4975
4976impl From<&Button> for u16 {
4977    fn from(button: &Button) -> u16 {
4978        match *button {
4979            Button::Button(button) => button,
4980        }
4981    }
4982}
4983
4984impl From<Button> for u16 {
4985    /// Returns the 16bit value of this usage. This is identical
4986    /// to [Button::usage_page_value()].
4987    fn from(button: Button) -> u16 {
4988        u16::from(&button)
4989    }
4990}
4991
4992impl From<&Button> for u32 {
4993    /// Returns the 32 bit value of this usage. This is identical
4994    /// to [Button::usage_value()].
4995    fn from(button: &Button) -> u32 {
4996        let up = UsagePage::from(button);
4997        let up = (u16::from(&up) as u32) << 16;
4998        let id = u16::from(button) as u32;
4999        up | id
5000    }
5001}
5002
5003impl From<&Button> for UsagePage {
5004    /// Always returns [UsagePage::Button] and is
5005    /// identical to [Button::usage_page()].
5006    fn from(_: &Button) -> UsagePage {
5007        UsagePage::Button
5008    }
5009}
5010
5011impl From<Button> for UsagePage {
5012    /// Always returns [UsagePage::Button] and is
5013    /// identical to [Button::usage_page()].
5014    fn from(_: Button) -> UsagePage {
5015        UsagePage::Button
5016    }
5017}
5018
5019impl From<&Button> for Usage {
5020    fn from(button: &Button) -> Usage {
5021        Usage::try_from(u32::from(button)).unwrap()
5022    }
5023}
5024
5025impl From<Button> for Usage {
5026    fn from(button: Button) -> Usage {
5027        Usage::from(&button)
5028    }
5029}
5030
5031impl TryFrom<u16> for Button {
5032    type Error = HutError;
5033
5034    fn try_from(usage_id: u16) -> Result<Button> {
5035        match usage_id {
5036            n => Ok(Button::Button(n)),
5037        }
5038    }
5039}
5040
5041impl BitOr<u16> for Button {
5042    type Output = Usage;
5043
5044    /// A convenience function to combine a Usage Page with
5045    /// a value.
5046    ///
5047    /// This function panics if the Usage ID value results in
5048    /// an unknown Usage. Where error checking is required,
5049    /// use [UsagePage::to_usage_from_value].
5050    fn bitor(self, usage: u16) -> Usage {
5051        let up = u16::from(self) as u32;
5052        let u = usage as u32;
5053        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
5054    }
5055}
5056
5057/// *Usage Page `0xA`: "Ordinal"*
5058///
5059/// **This enum is autogenerated from the HID Usage Tables**.
5060///
5061/// This Usage Page is generated, not defined, any Usage IDs in this Usage
5062/// Page are simply the instance number.
5063///
5064/// ```
5065/// # use hut::*;
5066/// let u1 = Usage::Ordinal(Ordinal::Ordinal(3));
5067/// let u2 = Usage::new_from_page_and_id(0xA, 3).unwrap();
5068/// let u3 = Usage::from(Ordinal::Ordinal(3));
5069/// let u4: Usage = Ordinal::Ordinal(3).into();
5070/// assert_eq!(u1, u2);
5071/// assert_eq!(u1, u3);
5072/// assert_eq!(u1, u4);
5073///
5074/// assert!(matches!(u1.usage_page(), UsagePage::Ordinal));
5075/// assert_eq!(0xA, u1.usage_page_value());
5076/// assert_eq!(3, u1.usage_id_value());
5077/// assert_eq!((0xA << 16) | 3, u1.usage_value());
5078/// assert_eq!("Instance 3", u1.name());
5079/// ```
5080#[allow(non_camel_case_types)]
5081#[derive(Debug)]
5082#[non_exhaustive]
5083pub enum Ordinal {
5084    Ordinal(u16),
5085}
5086
5087impl Ordinal {
5088    #[cfg(feature = "std")]
5089    pub fn name(&self) -> String {
5090        match self {
5091            Ordinal::Ordinal(instance) => format!("Instance {instance}"),
5092        }
5093    }
5094}
5095
5096#[cfg(feature = "std")]
5097impl fmt::Display for Ordinal {
5098    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
5099        write!(f, "{}", self.name())
5100    }
5101}
5102
5103impl AsUsage for Ordinal {
5104    /// Returns the 32 bit Usage value of this Usage
5105    fn usage_value(&self) -> u32 {
5106        u32::from(self)
5107    }
5108
5109    /// Returns the 16 bit Usage ID value of this Usage
5110    fn usage_id_value(&self) -> u16 {
5111        u16::from(self)
5112    }
5113
5114    /// Returns this usage as [Usage::Ordinal(self)](Usage::Ordinal)
5115    /// This is a convenience function to avoid having
5116    /// to implement `From` for every used type in the caller.
5117    ///
5118    /// ```
5119    /// # use hut::*;
5120    /// let gd_x = GenericDesktop::X;
5121    /// let usage = Usage::from(GenericDesktop::X);
5122    /// assert!(matches!(gd_x.usage(), usage));
5123    /// ```
5124    fn usage(&self) -> Usage {
5125        Usage::from(self)
5126    }
5127}
5128
5129impl AsUsagePage for Ordinal {
5130    /// Returns the 16 bit value of this UsagePage
5131    ///
5132    /// This value is `0xA` for [Ordinal]
5133    fn usage_page_value(&self) -> u16 {
5134        let up = UsagePage::from(self);
5135        u16::from(up)
5136    }
5137
5138    /// Returns [UsagePage::Ordinal]]
5139    fn usage_page(&self) -> UsagePage {
5140        UsagePage::from(self)
5141    }
5142}
5143
5144impl From<&Ordinal> for u16 {
5145    fn from(ordinal: &Ordinal) -> u16 {
5146        match *ordinal {
5147            Ordinal::Ordinal(instance) => instance,
5148        }
5149    }
5150}
5151
5152impl From<Ordinal> for u16 {
5153    /// Returns the 16bit value of this usage. This is identical
5154    /// to [Ordinal::usage_page_value()].
5155    fn from(ordinal: Ordinal) -> u16 {
5156        u16::from(&ordinal)
5157    }
5158}
5159
5160impl From<&Ordinal> for u32 {
5161    /// Returns the 32 bit value of this usage. This is identical
5162    /// to [Ordinal::usage_value()].
5163    fn from(ordinal: &Ordinal) -> u32 {
5164        let up = UsagePage::from(ordinal);
5165        let up = (u16::from(&up) as u32) << 16;
5166        let id = u16::from(ordinal) as u32;
5167        up | id
5168    }
5169}
5170
5171impl From<&Ordinal> for UsagePage {
5172    /// Always returns [UsagePage::Ordinal] and is
5173    /// identical to [Ordinal::usage_page()].
5174    fn from(_: &Ordinal) -> UsagePage {
5175        UsagePage::Ordinal
5176    }
5177}
5178
5179impl From<Ordinal> for UsagePage {
5180    /// Always returns [UsagePage::Ordinal] and is
5181    /// identical to [Ordinal::usage_page()].
5182    fn from(_: Ordinal) -> UsagePage {
5183        UsagePage::Ordinal
5184    }
5185}
5186
5187impl From<&Ordinal> for Usage {
5188    fn from(ordinal: &Ordinal) -> Usage {
5189        Usage::try_from(u32::from(ordinal)).unwrap()
5190    }
5191}
5192
5193impl From<Ordinal> for Usage {
5194    fn from(ordinal: Ordinal) -> Usage {
5195        Usage::from(&ordinal)
5196    }
5197}
5198
5199impl TryFrom<u16> for Ordinal {
5200    type Error = HutError;
5201
5202    fn try_from(usage_id: u16) -> Result<Ordinal> {
5203        match usage_id {
5204            n => Ok(Ordinal::Ordinal(n)),
5205        }
5206    }
5207}
5208
5209impl BitOr<u16> for Ordinal {
5210    type Output = Usage;
5211
5212    /// A convenience function to combine a Usage Page with
5213    /// a value.
5214    ///
5215    /// This function panics if the Usage ID value results in
5216    /// an unknown Usage. Where error checking is required,
5217    /// use [UsagePage::to_usage_from_value].
5218    fn bitor(self, usage: u16) -> Usage {
5219        let up = u16::from(self) as u32;
5220        let u = usage as u32;
5221        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
5222    }
5223}
5224
5225/// *Usage Page `0xB`: "Telephony Device"*
5226///
5227/// **This enum is autogenerated from the HID Usage Tables**.
5228/// ```
5229/// # use hut::*;
5230/// let u1 = Usage::TelephonyDevice(TelephonyDevice::AnsweringMachine);
5231/// let u2 = Usage::new_from_page_and_id(0xB, 0x2).unwrap();
5232/// let u3 = Usage::from(TelephonyDevice::AnsweringMachine);
5233/// let u4: Usage = TelephonyDevice::AnsweringMachine.into();
5234/// assert_eq!(u1, u2);
5235/// assert_eq!(u1, u3);
5236/// assert_eq!(u1, u4);
5237///
5238/// assert!(matches!(u1.usage_page(), UsagePage::TelephonyDevice));
5239/// assert_eq!(0xB, u1.usage_page_value());
5240/// assert_eq!(0x2, u1.usage_id_value());
5241/// assert_eq!((0xB << 16) | 0x2, u1.usage_value());
5242/// assert_eq!("Answering Machine", u1.name());
5243/// ```
5244///
5245#[allow(non_camel_case_types)]
5246#[derive(Debug)]
5247#[non_exhaustive]
5248pub enum TelephonyDevice {
5249    /// Usage ID `0x1`: "Phone"
5250    Phone,
5251    /// Usage ID `0x2`: "Answering Machine"
5252    AnsweringMachine,
5253    /// Usage ID `0x3`: "Message Controls"
5254    MessageControls,
5255    /// Usage ID `0x4`: "Handset"
5256    Handset,
5257    /// Usage ID `0x5`: "Headset"
5258    Headset,
5259    /// Usage ID `0x6`: "Telephony Key Pad"
5260    TelephonyKeyPad,
5261    /// Usage ID `0x7`: "Programmable Button"
5262    ProgrammableButton,
5263    /// Usage ID `0x20`: "Hook Switch"
5264    HookSwitch,
5265    /// Usage ID `0x21`: "Flash"
5266    Flash,
5267    /// Usage ID `0x22`: "Feature"
5268    Feature,
5269    /// Usage ID `0x23`: "Hold"
5270    Hold,
5271    /// Usage ID `0x24`: "Redial"
5272    Redial,
5273    /// Usage ID `0x25`: "Transfer"
5274    Transfer,
5275    /// Usage ID `0x26`: "Drop"
5276    Drop,
5277    /// Usage ID `0x27`: "Park"
5278    Park,
5279    /// Usage ID `0x28`: "Forward Calls"
5280    ForwardCalls,
5281    /// Usage ID `0x29`: "Alternate Function"
5282    AlternateFunction,
5283    /// Usage ID `0x2A`: "Line"
5284    Line,
5285    /// Usage ID `0x2B`: "Speaker Phone"
5286    SpeakerPhone,
5287    /// Usage ID `0x2C`: "Conference"
5288    Conference,
5289    /// Usage ID `0x2D`: "Ring Enable"
5290    RingEnable,
5291    /// Usage ID `0x2E`: "Ring Select"
5292    RingSelect,
5293    /// Usage ID `0x2F`: "Phone Mute"
5294    PhoneMute,
5295    /// Usage ID `0x30`: "Caller ID"
5296    CallerID,
5297    /// Usage ID `0x31`: "Send"
5298    Send,
5299    /// Usage ID `0x50`: "Speed Dial"
5300    SpeedDial,
5301    /// Usage ID `0x51`: "Store Number"
5302    StoreNumber,
5303    /// Usage ID `0x52`: "Recall Number"
5304    RecallNumber,
5305    /// Usage ID `0x53`: "Phone Directory"
5306    PhoneDirectory,
5307    /// Usage ID `0x70`: "Voice Mail"
5308    VoiceMail,
5309    /// Usage ID `0x71`: "Screen Calls"
5310    ScreenCalls,
5311    /// Usage ID `0x72`: "Do Not Disturb"
5312    DoNotDisturb,
5313    /// Usage ID `0x73`: "Message"
5314    Message,
5315    /// Usage ID `0x74`: "Answer On/Off"
5316    AnswerOnOff,
5317    /// Usage ID `0x90`: "Inside Dial Tone"
5318    InsideDialTone,
5319    /// Usage ID `0x91`: "Outside Dial Tone"
5320    OutsideDialTone,
5321    /// Usage ID `0x92`: "Inside Ring Tone"
5322    InsideRingTone,
5323    /// Usage ID `0x93`: "Outside Ring Tone"
5324    OutsideRingTone,
5325    /// Usage ID `0x94`: "Priority Ring Tone"
5326    PriorityRingTone,
5327    /// Usage ID `0x95`: "Inside Ringback"
5328    InsideRingback,
5329    /// Usage ID `0x96`: "Priority Ringback"
5330    PriorityRingback,
5331    /// Usage ID `0x97`: "Line Busy Tone"
5332    LineBusyTone,
5333    /// Usage ID `0x98`: "Reorder Tone"
5334    ReorderTone,
5335    /// Usage ID `0x99`: "Call Waiting Tone"
5336    CallWaitingTone,
5337    /// Usage ID `0x9A`: "Confirmation Tone 1"
5338    ConfirmationTone1,
5339    /// Usage ID `0x9B`: "Confirmation Tone 2"
5340    ConfirmationTone2,
5341    /// Usage ID `0x9C`: "Tones Off"
5342    TonesOff,
5343    /// Usage ID `0x9D`: "Outside Ringback"
5344    OutsideRingback,
5345    /// Usage ID `0x9E`: "Ringer"
5346    Ringer,
5347    /// Usage ID `0xB0`: "Phone Key 0"
5348    PhoneKey0,
5349    /// Usage ID `0xB1`: "Phone Key 1"
5350    PhoneKey1,
5351    /// Usage ID `0xB2`: "Phone Key 2"
5352    PhoneKey2,
5353    /// Usage ID `0xB3`: "Phone Key 3"
5354    PhoneKey3,
5355    /// Usage ID `0xB4`: "Phone Key 4"
5356    PhoneKey4,
5357    /// Usage ID `0xB5`: "Phone Key 5"
5358    PhoneKey5,
5359    /// Usage ID `0xB6`: "Phone Key 6"
5360    PhoneKey6,
5361    /// Usage ID `0xB7`: "Phone Key 7"
5362    PhoneKey7,
5363    /// Usage ID `0xB8`: "Phone Key 8"
5364    PhoneKey8,
5365    /// Usage ID `0xB9`: "Phone Key 9"
5366    PhoneKey9,
5367    /// Usage ID `0xBA`: "Phone Key Star"
5368    PhoneKeyStar,
5369    /// Usage ID `0xBB`: "Phone Key Pound"
5370    PhoneKeyPound,
5371    /// Usage ID `0xBC`: "Phone Key A"
5372    PhoneKeyA,
5373    /// Usage ID `0xBD`: "Phone Key B"
5374    PhoneKeyB,
5375    /// Usage ID `0xBE`: "Phone Key C"
5376    PhoneKeyC,
5377    /// Usage ID `0xBF`: "Phone Key D"
5378    PhoneKeyD,
5379    /// Usage ID `0xC0`: "Phone Call History Key"
5380    PhoneCallHistoryKey,
5381    /// Usage ID `0xC1`: "Phone Caller ID Key"
5382    PhoneCallerIDKey,
5383    /// Usage ID `0xC2`: "Phone Settings Key"
5384    PhoneSettingsKey,
5385    /// Usage ID `0xF0`: "Host Control"
5386    HostControl,
5387    /// Usage ID `0xF1`: "Host Available"
5388    HostAvailable,
5389    /// Usage ID `0xF2`: "Host Call Active"
5390    HostCallActive,
5391    /// Usage ID `0xF3`: "Activate Handset Audio"
5392    ActivateHandsetAudio,
5393    /// Usage ID `0xF4`: "Ring Type"
5394    RingType,
5395    /// Usage ID `0xF5`: "Re-dialable Phone Number"
5396    RedialablePhoneNumber,
5397    /// Usage ID `0xF8`: "Stop Ring Tone"
5398    StopRingTone,
5399    /// Usage ID `0xF9`: "PSTN Ring Tone"
5400    PSTNRingTone,
5401    /// Usage ID `0xFA`: "Host Ring Tone"
5402    HostRingTone,
5403    /// Usage ID `0xFB`: "Alert Sound Error"
5404    AlertSoundError,
5405    /// Usage ID `0xFC`: "Alert Sound Confirm"
5406    AlertSoundConfirm,
5407    /// Usage ID `0xFD`: "Alert Sound Notification"
5408    AlertSoundNotification,
5409    /// Usage ID `0xFE`: "Silent Ring"
5410    SilentRing,
5411    /// Usage ID `0x108`: "Email Message Waiting"
5412    EmailMessageWaiting,
5413    /// Usage ID `0x109`: "Voicemail Message Waiting"
5414    VoicemailMessageWaiting,
5415    /// Usage ID `0x10A`: "Host Hold"
5416    HostHold,
5417    /// Usage ID `0x110`: "Incoming Call History Count"
5418    IncomingCallHistoryCount,
5419    /// Usage ID `0x111`: "Outgoing Call History Count"
5420    OutgoingCallHistoryCount,
5421    /// Usage ID `0x112`: "Incoming Call History"
5422    IncomingCallHistory,
5423    /// Usage ID `0x113`: "Outgoing Call History"
5424    OutgoingCallHistory,
5425    /// Usage ID `0x114`: "Phone Locale"
5426    PhoneLocale,
5427    /// Usage ID `0x140`: "Phone Time Second"
5428    PhoneTimeSecond,
5429    /// Usage ID `0x141`: "Phone Time Minute"
5430    PhoneTimeMinute,
5431    /// Usage ID `0x142`: "Phone Time Hour"
5432    PhoneTimeHour,
5433    /// Usage ID `0x143`: "Phone Date Day"
5434    PhoneDateDay,
5435    /// Usage ID `0x144`: "Phone Date Month"
5436    PhoneDateMonth,
5437    /// Usage ID `0x145`: "Phone Date Year"
5438    PhoneDateYear,
5439    /// Usage ID `0x146`: "Handset Nickname"
5440    HandsetNickname,
5441    /// Usage ID `0x147`: "Address Book ID"
5442    AddressBookID,
5443    /// Usage ID `0x14A`: "Call Duration"
5444    CallDuration,
5445    /// Usage ID `0x14B`: "Dual Mode Phone"
5446    DualModePhone,
5447}
5448
5449impl TelephonyDevice {
5450    #[cfg(feature = "std")]
5451    pub fn name(&self) -> String {
5452        match self {
5453            TelephonyDevice::Phone => "Phone",
5454            TelephonyDevice::AnsweringMachine => "Answering Machine",
5455            TelephonyDevice::MessageControls => "Message Controls",
5456            TelephonyDevice::Handset => "Handset",
5457            TelephonyDevice::Headset => "Headset",
5458            TelephonyDevice::TelephonyKeyPad => "Telephony Key Pad",
5459            TelephonyDevice::ProgrammableButton => "Programmable Button",
5460            TelephonyDevice::HookSwitch => "Hook Switch",
5461            TelephonyDevice::Flash => "Flash",
5462            TelephonyDevice::Feature => "Feature",
5463            TelephonyDevice::Hold => "Hold",
5464            TelephonyDevice::Redial => "Redial",
5465            TelephonyDevice::Transfer => "Transfer",
5466            TelephonyDevice::Drop => "Drop",
5467            TelephonyDevice::Park => "Park",
5468            TelephonyDevice::ForwardCalls => "Forward Calls",
5469            TelephonyDevice::AlternateFunction => "Alternate Function",
5470            TelephonyDevice::Line => "Line",
5471            TelephonyDevice::SpeakerPhone => "Speaker Phone",
5472            TelephonyDevice::Conference => "Conference",
5473            TelephonyDevice::RingEnable => "Ring Enable",
5474            TelephonyDevice::RingSelect => "Ring Select",
5475            TelephonyDevice::PhoneMute => "Phone Mute",
5476            TelephonyDevice::CallerID => "Caller ID",
5477            TelephonyDevice::Send => "Send",
5478            TelephonyDevice::SpeedDial => "Speed Dial",
5479            TelephonyDevice::StoreNumber => "Store Number",
5480            TelephonyDevice::RecallNumber => "Recall Number",
5481            TelephonyDevice::PhoneDirectory => "Phone Directory",
5482            TelephonyDevice::VoiceMail => "Voice Mail",
5483            TelephonyDevice::ScreenCalls => "Screen Calls",
5484            TelephonyDevice::DoNotDisturb => "Do Not Disturb",
5485            TelephonyDevice::Message => "Message",
5486            TelephonyDevice::AnswerOnOff => "Answer On/Off",
5487            TelephonyDevice::InsideDialTone => "Inside Dial Tone",
5488            TelephonyDevice::OutsideDialTone => "Outside Dial Tone",
5489            TelephonyDevice::InsideRingTone => "Inside Ring Tone",
5490            TelephonyDevice::OutsideRingTone => "Outside Ring Tone",
5491            TelephonyDevice::PriorityRingTone => "Priority Ring Tone",
5492            TelephonyDevice::InsideRingback => "Inside Ringback",
5493            TelephonyDevice::PriorityRingback => "Priority Ringback",
5494            TelephonyDevice::LineBusyTone => "Line Busy Tone",
5495            TelephonyDevice::ReorderTone => "Reorder Tone",
5496            TelephonyDevice::CallWaitingTone => "Call Waiting Tone",
5497            TelephonyDevice::ConfirmationTone1 => "Confirmation Tone 1",
5498            TelephonyDevice::ConfirmationTone2 => "Confirmation Tone 2",
5499            TelephonyDevice::TonesOff => "Tones Off",
5500            TelephonyDevice::OutsideRingback => "Outside Ringback",
5501            TelephonyDevice::Ringer => "Ringer",
5502            TelephonyDevice::PhoneKey0 => "Phone Key 0",
5503            TelephonyDevice::PhoneKey1 => "Phone Key 1",
5504            TelephonyDevice::PhoneKey2 => "Phone Key 2",
5505            TelephonyDevice::PhoneKey3 => "Phone Key 3",
5506            TelephonyDevice::PhoneKey4 => "Phone Key 4",
5507            TelephonyDevice::PhoneKey5 => "Phone Key 5",
5508            TelephonyDevice::PhoneKey6 => "Phone Key 6",
5509            TelephonyDevice::PhoneKey7 => "Phone Key 7",
5510            TelephonyDevice::PhoneKey8 => "Phone Key 8",
5511            TelephonyDevice::PhoneKey9 => "Phone Key 9",
5512            TelephonyDevice::PhoneKeyStar => "Phone Key Star",
5513            TelephonyDevice::PhoneKeyPound => "Phone Key Pound",
5514            TelephonyDevice::PhoneKeyA => "Phone Key A",
5515            TelephonyDevice::PhoneKeyB => "Phone Key B",
5516            TelephonyDevice::PhoneKeyC => "Phone Key C",
5517            TelephonyDevice::PhoneKeyD => "Phone Key D",
5518            TelephonyDevice::PhoneCallHistoryKey => "Phone Call History Key",
5519            TelephonyDevice::PhoneCallerIDKey => "Phone Caller ID Key",
5520            TelephonyDevice::PhoneSettingsKey => "Phone Settings Key",
5521            TelephonyDevice::HostControl => "Host Control",
5522            TelephonyDevice::HostAvailable => "Host Available",
5523            TelephonyDevice::HostCallActive => "Host Call Active",
5524            TelephonyDevice::ActivateHandsetAudio => "Activate Handset Audio",
5525            TelephonyDevice::RingType => "Ring Type",
5526            TelephonyDevice::RedialablePhoneNumber => "Re-dialable Phone Number",
5527            TelephonyDevice::StopRingTone => "Stop Ring Tone",
5528            TelephonyDevice::PSTNRingTone => "PSTN Ring Tone",
5529            TelephonyDevice::HostRingTone => "Host Ring Tone",
5530            TelephonyDevice::AlertSoundError => "Alert Sound Error",
5531            TelephonyDevice::AlertSoundConfirm => "Alert Sound Confirm",
5532            TelephonyDevice::AlertSoundNotification => "Alert Sound Notification",
5533            TelephonyDevice::SilentRing => "Silent Ring",
5534            TelephonyDevice::EmailMessageWaiting => "Email Message Waiting",
5535            TelephonyDevice::VoicemailMessageWaiting => "Voicemail Message Waiting",
5536            TelephonyDevice::HostHold => "Host Hold",
5537            TelephonyDevice::IncomingCallHistoryCount => "Incoming Call History Count",
5538            TelephonyDevice::OutgoingCallHistoryCount => "Outgoing Call History Count",
5539            TelephonyDevice::IncomingCallHistory => "Incoming Call History",
5540            TelephonyDevice::OutgoingCallHistory => "Outgoing Call History",
5541            TelephonyDevice::PhoneLocale => "Phone Locale",
5542            TelephonyDevice::PhoneTimeSecond => "Phone Time Second",
5543            TelephonyDevice::PhoneTimeMinute => "Phone Time Minute",
5544            TelephonyDevice::PhoneTimeHour => "Phone Time Hour",
5545            TelephonyDevice::PhoneDateDay => "Phone Date Day",
5546            TelephonyDevice::PhoneDateMonth => "Phone Date Month",
5547            TelephonyDevice::PhoneDateYear => "Phone Date Year",
5548            TelephonyDevice::HandsetNickname => "Handset Nickname",
5549            TelephonyDevice::AddressBookID => "Address Book ID",
5550            TelephonyDevice::CallDuration => "Call Duration",
5551            TelephonyDevice::DualModePhone => "Dual Mode Phone",
5552        }
5553        .into()
5554    }
5555}
5556
5557#[cfg(feature = "std")]
5558impl fmt::Display for TelephonyDevice {
5559    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
5560        write!(f, "{}", self.name())
5561    }
5562}
5563
5564impl AsUsage for TelephonyDevice {
5565    /// Returns the 32 bit Usage value of this Usage
5566    fn usage_value(&self) -> u32 {
5567        u32::from(self)
5568    }
5569
5570    /// Returns the 16 bit Usage ID value of this Usage
5571    fn usage_id_value(&self) -> u16 {
5572        u16::from(self)
5573    }
5574
5575    /// Returns this usage as [Usage::TelephonyDevice(self)](Usage::TelephonyDevice)
5576    /// This is a convenience function to avoid having
5577    /// to implement `From` for every used type in the caller.
5578    ///
5579    /// ```
5580    /// # use hut::*;
5581    /// let gd_x = GenericDesktop::X;
5582    /// let usage = Usage::from(GenericDesktop::X);
5583    /// assert!(matches!(gd_x.usage(), usage));
5584    /// ```
5585    fn usage(&self) -> Usage {
5586        Usage::from(self)
5587    }
5588}
5589
5590impl AsUsagePage for TelephonyDevice {
5591    /// Returns the 16 bit value of this UsagePage
5592    ///
5593    /// This value is `0xB` for [TelephonyDevice]
5594    fn usage_page_value(&self) -> u16 {
5595        let up = UsagePage::from(self);
5596        u16::from(up)
5597    }
5598
5599    /// Returns [UsagePage::TelephonyDevice]]
5600    fn usage_page(&self) -> UsagePage {
5601        UsagePage::from(self)
5602    }
5603}
5604
5605impl From<&TelephonyDevice> for u16 {
5606    fn from(telephonydevice: &TelephonyDevice) -> u16 {
5607        match *telephonydevice {
5608            TelephonyDevice::Phone => 1,
5609            TelephonyDevice::AnsweringMachine => 2,
5610            TelephonyDevice::MessageControls => 3,
5611            TelephonyDevice::Handset => 4,
5612            TelephonyDevice::Headset => 5,
5613            TelephonyDevice::TelephonyKeyPad => 6,
5614            TelephonyDevice::ProgrammableButton => 7,
5615            TelephonyDevice::HookSwitch => 32,
5616            TelephonyDevice::Flash => 33,
5617            TelephonyDevice::Feature => 34,
5618            TelephonyDevice::Hold => 35,
5619            TelephonyDevice::Redial => 36,
5620            TelephonyDevice::Transfer => 37,
5621            TelephonyDevice::Drop => 38,
5622            TelephonyDevice::Park => 39,
5623            TelephonyDevice::ForwardCalls => 40,
5624            TelephonyDevice::AlternateFunction => 41,
5625            TelephonyDevice::Line => 42,
5626            TelephonyDevice::SpeakerPhone => 43,
5627            TelephonyDevice::Conference => 44,
5628            TelephonyDevice::RingEnable => 45,
5629            TelephonyDevice::RingSelect => 46,
5630            TelephonyDevice::PhoneMute => 47,
5631            TelephonyDevice::CallerID => 48,
5632            TelephonyDevice::Send => 49,
5633            TelephonyDevice::SpeedDial => 80,
5634            TelephonyDevice::StoreNumber => 81,
5635            TelephonyDevice::RecallNumber => 82,
5636            TelephonyDevice::PhoneDirectory => 83,
5637            TelephonyDevice::VoiceMail => 112,
5638            TelephonyDevice::ScreenCalls => 113,
5639            TelephonyDevice::DoNotDisturb => 114,
5640            TelephonyDevice::Message => 115,
5641            TelephonyDevice::AnswerOnOff => 116,
5642            TelephonyDevice::InsideDialTone => 144,
5643            TelephonyDevice::OutsideDialTone => 145,
5644            TelephonyDevice::InsideRingTone => 146,
5645            TelephonyDevice::OutsideRingTone => 147,
5646            TelephonyDevice::PriorityRingTone => 148,
5647            TelephonyDevice::InsideRingback => 149,
5648            TelephonyDevice::PriorityRingback => 150,
5649            TelephonyDevice::LineBusyTone => 151,
5650            TelephonyDevice::ReorderTone => 152,
5651            TelephonyDevice::CallWaitingTone => 153,
5652            TelephonyDevice::ConfirmationTone1 => 154,
5653            TelephonyDevice::ConfirmationTone2 => 155,
5654            TelephonyDevice::TonesOff => 156,
5655            TelephonyDevice::OutsideRingback => 157,
5656            TelephonyDevice::Ringer => 158,
5657            TelephonyDevice::PhoneKey0 => 176,
5658            TelephonyDevice::PhoneKey1 => 177,
5659            TelephonyDevice::PhoneKey2 => 178,
5660            TelephonyDevice::PhoneKey3 => 179,
5661            TelephonyDevice::PhoneKey4 => 180,
5662            TelephonyDevice::PhoneKey5 => 181,
5663            TelephonyDevice::PhoneKey6 => 182,
5664            TelephonyDevice::PhoneKey7 => 183,
5665            TelephonyDevice::PhoneKey8 => 184,
5666            TelephonyDevice::PhoneKey9 => 185,
5667            TelephonyDevice::PhoneKeyStar => 186,
5668            TelephonyDevice::PhoneKeyPound => 187,
5669            TelephonyDevice::PhoneKeyA => 188,
5670            TelephonyDevice::PhoneKeyB => 189,
5671            TelephonyDevice::PhoneKeyC => 190,
5672            TelephonyDevice::PhoneKeyD => 191,
5673            TelephonyDevice::PhoneCallHistoryKey => 192,
5674            TelephonyDevice::PhoneCallerIDKey => 193,
5675            TelephonyDevice::PhoneSettingsKey => 194,
5676            TelephonyDevice::HostControl => 240,
5677            TelephonyDevice::HostAvailable => 241,
5678            TelephonyDevice::HostCallActive => 242,
5679            TelephonyDevice::ActivateHandsetAudio => 243,
5680            TelephonyDevice::RingType => 244,
5681            TelephonyDevice::RedialablePhoneNumber => 245,
5682            TelephonyDevice::StopRingTone => 248,
5683            TelephonyDevice::PSTNRingTone => 249,
5684            TelephonyDevice::HostRingTone => 250,
5685            TelephonyDevice::AlertSoundError => 251,
5686            TelephonyDevice::AlertSoundConfirm => 252,
5687            TelephonyDevice::AlertSoundNotification => 253,
5688            TelephonyDevice::SilentRing => 254,
5689            TelephonyDevice::EmailMessageWaiting => 264,
5690            TelephonyDevice::VoicemailMessageWaiting => 265,
5691            TelephonyDevice::HostHold => 266,
5692            TelephonyDevice::IncomingCallHistoryCount => 272,
5693            TelephonyDevice::OutgoingCallHistoryCount => 273,
5694            TelephonyDevice::IncomingCallHistory => 274,
5695            TelephonyDevice::OutgoingCallHistory => 275,
5696            TelephonyDevice::PhoneLocale => 276,
5697            TelephonyDevice::PhoneTimeSecond => 320,
5698            TelephonyDevice::PhoneTimeMinute => 321,
5699            TelephonyDevice::PhoneTimeHour => 322,
5700            TelephonyDevice::PhoneDateDay => 323,
5701            TelephonyDevice::PhoneDateMonth => 324,
5702            TelephonyDevice::PhoneDateYear => 325,
5703            TelephonyDevice::HandsetNickname => 326,
5704            TelephonyDevice::AddressBookID => 327,
5705            TelephonyDevice::CallDuration => 330,
5706            TelephonyDevice::DualModePhone => 331,
5707        }
5708    }
5709}
5710
5711impl From<TelephonyDevice> for u16 {
5712    /// Returns the 16bit value of this usage. This is identical
5713    /// to [TelephonyDevice::usage_page_value()].
5714    fn from(telephonydevice: TelephonyDevice) -> u16 {
5715        u16::from(&telephonydevice)
5716    }
5717}
5718
5719impl From<&TelephonyDevice> for u32 {
5720    /// Returns the 32 bit value of this usage. This is identical
5721    /// to [TelephonyDevice::usage_value()].
5722    fn from(telephonydevice: &TelephonyDevice) -> u32 {
5723        let up = UsagePage::from(telephonydevice);
5724        let up = (u16::from(&up) as u32) << 16;
5725        let id = u16::from(telephonydevice) as u32;
5726        up | id
5727    }
5728}
5729
5730impl From<&TelephonyDevice> for UsagePage {
5731    /// Always returns [UsagePage::TelephonyDevice] and is
5732    /// identical to [TelephonyDevice::usage_page()].
5733    fn from(_: &TelephonyDevice) -> UsagePage {
5734        UsagePage::TelephonyDevice
5735    }
5736}
5737
5738impl From<TelephonyDevice> for UsagePage {
5739    /// Always returns [UsagePage::TelephonyDevice] and is
5740    /// identical to [TelephonyDevice::usage_page()].
5741    fn from(_: TelephonyDevice) -> UsagePage {
5742        UsagePage::TelephonyDevice
5743    }
5744}
5745
5746impl From<&TelephonyDevice> for Usage {
5747    fn from(telephonydevice: &TelephonyDevice) -> Usage {
5748        Usage::try_from(u32::from(telephonydevice)).unwrap()
5749    }
5750}
5751
5752impl From<TelephonyDevice> for Usage {
5753    fn from(telephonydevice: TelephonyDevice) -> Usage {
5754        Usage::from(&telephonydevice)
5755    }
5756}
5757
5758impl TryFrom<u16> for TelephonyDevice {
5759    type Error = HutError;
5760
5761    fn try_from(usage_id: u16) -> Result<TelephonyDevice> {
5762        match usage_id {
5763            1 => Ok(TelephonyDevice::Phone),
5764            2 => Ok(TelephonyDevice::AnsweringMachine),
5765            3 => Ok(TelephonyDevice::MessageControls),
5766            4 => Ok(TelephonyDevice::Handset),
5767            5 => Ok(TelephonyDevice::Headset),
5768            6 => Ok(TelephonyDevice::TelephonyKeyPad),
5769            7 => Ok(TelephonyDevice::ProgrammableButton),
5770            32 => Ok(TelephonyDevice::HookSwitch),
5771            33 => Ok(TelephonyDevice::Flash),
5772            34 => Ok(TelephonyDevice::Feature),
5773            35 => Ok(TelephonyDevice::Hold),
5774            36 => Ok(TelephonyDevice::Redial),
5775            37 => Ok(TelephonyDevice::Transfer),
5776            38 => Ok(TelephonyDevice::Drop),
5777            39 => Ok(TelephonyDevice::Park),
5778            40 => Ok(TelephonyDevice::ForwardCalls),
5779            41 => Ok(TelephonyDevice::AlternateFunction),
5780            42 => Ok(TelephonyDevice::Line),
5781            43 => Ok(TelephonyDevice::SpeakerPhone),
5782            44 => Ok(TelephonyDevice::Conference),
5783            45 => Ok(TelephonyDevice::RingEnable),
5784            46 => Ok(TelephonyDevice::RingSelect),
5785            47 => Ok(TelephonyDevice::PhoneMute),
5786            48 => Ok(TelephonyDevice::CallerID),
5787            49 => Ok(TelephonyDevice::Send),
5788            80 => Ok(TelephonyDevice::SpeedDial),
5789            81 => Ok(TelephonyDevice::StoreNumber),
5790            82 => Ok(TelephonyDevice::RecallNumber),
5791            83 => Ok(TelephonyDevice::PhoneDirectory),
5792            112 => Ok(TelephonyDevice::VoiceMail),
5793            113 => Ok(TelephonyDevice::ScreenCalls),
5794            114 => Ok(TelephonyDevice::DoNotDisturb),
5795            115 => Ok(TelephonyDevice::Message),
5796            116 => Ok(TelephonyDevice::AnswerOnOff),
5797            144 => Ok(TelephonyDevice::InsideDialTone),
5798            145 => Ok(TelephonyDevice::OutsideDialTone),
5799            146 => Ok(TelephonyDevice::InsideRingTone),
5800            147 => Ok(TelephonyDevice::OutsideRingTone),
5801            148 => Ok(TelephonyDevice::PriorityRingTone),
5802            149 => Ok(TelephonyDevice::InsideRingback),
5803            150 => Ok(TelephonyDevice::PriorityRingback),
5804            151 => Ok(TelephonyDevice::LineBusyTone),
5805            152 => Ok(TelephonyDevice::ReorderTone),
5806            153 => Ok(TelephonyDevice::CallWaitingTone),
5807            154 => Ok(TelephonyDevice::ConfirmationTone1),
5808            155 => Ok(TelephonyDevice::ConfirmationTone2),
5809            156 => Ok(TelephonyDevice::TonesOff),
5810            157 => Ok(TelephonyDevice::OutsideRingback),
5811            158 => Ok(TelephonyDevice::Ringer),
5812            176 => Ok(TelephonyDevice::PhoneKey0),
5813            177 => Ok(TelephonyDevice::PhoneKey1),
5814            178 => Ok(TelephonyDevice::PhoneKey2),
5815            179 => Ok(TelephonyDevice::PhoneKey3),
5816            180 => Ok(TelephonyDevice::PhoneKey4),
5817            181 => Ok(TelephonyDevice::PhoneKey5),
5818            182 => Ok(TelephonyDevice::PhoneKey6),
5819            183 => Ok(TelephonyDevice::PhoneKey7),
5820            184 => Ok(TelephonyDevice::PhoneKey8),
5821            185 => Ok(TelephonyDevice::PhoneKey9),
5822            186 => Ok(TelephonyDevice::PhoneKeyStar),
5823            187 => Ok(TelephonyDevice::PhoneKeyPound),
5824            188 => Ok(TelephonyDevice::PhoneKeyA),
5825            189 => Ok(TelephonyDevice::PhoneKeyB),
5826            190 => Ok(TelephonyDevice::PhoneKeyC),
5827            191 => Ok(TelephonyDevice::PhoneKeyD),
5828            192 => Ok(TelephonyDevice::PhoneCallHistoryKey),
5829            193 => Ok(TelephonyDevice::PhoneCallerIDKey),
5830            194 => Ok(TelephonyDevice::PhoneSettingsKey),
5831            240 => Ok(TelephonyDevice::HostControl),
5832            241 => Ok(TelephonyDevice::HostAvailable),
5833            242 => Ok(TelephonyDevice::HostCallActive),
5834            243 => Ok(TelephonyDevice::ActivateHandsetAudio),
5835            244 => Ok(TelephonyDevice::RingType),
5836            245 => Ok(TelephonyDevice::RedialablePhoneNumber),
5837            248 => Ok(TelephonyDevice::StopRingTone),
5838            249 => Ok(TelephonyDevice::PSTNRingTone),
5839            250 => Ok(TelephonyDevice::HostRingTone),
5840            251 => Ok(TelephonyDevice::AlertSoundError),
5841            252 => Ok(TelephonyDevice::AlertSoundConfirm),
5842            253 => Ok(TelephonyDevice::AlertSoundNotification),
5843            254 => Ok(TelephonyDevice::SilentRing),
5844            264 => Ok(TelephonyDevice::EmailMessageWaiting),
5845            265 => Ok(TelephonyDevice::VoicemailMessageWaiting),
5846            266 => Ok(TelephonyDevice::HostHold),
5847            272 => Ok(TelephonyDevice::IncomingCallHistoryCount),
5848            273 => Ok(TelephonyDevice::OutgoingCallHistoryCount),
5849            274 => Ok(TelephonyDevice::IncomingCallHistory),
5850            275 => Ok(TelephonyDevice::OutgoingCallHistory),
5851            276 => Ok(TelephonyDevice::PhoneLocale),
5852            320 => Ok(TelephonyDevice::PhoneTimeSecond),
5853            321 => Ok(TelephonyDevice::PhoneTimeMinute),
5854            322 => Ok(TelephonyDevice::PhoneTimeHour),
5855            323 => Ok(TelephonyDevice::PhoneDateDay),
5856            324 => Ok(TelephonyDevice::PhoneDateMonth),
5857            325 => Ok(TelephonyDevice::PhoneDateYear),
5858            326 => Ok(TelephonyDevice::HandsetNickname),
5859            327 => Ok(TelephonyDevice::AddressBookID),
5860            330 => Ok(TelephonyDevice::CallDuration),
5861            331 => Ok(TelephonyDevice::DualModePhone),
5862            n => Err(HutError::UnknownUsageId { usage_id: n }),
5863        }
5864    }
5865}
5866
5867impl BitOr<u16> for TelephonyDevice {
5868    type Output = Usage;
5869
5870    /// A convenience function to combine a Usage Page with
5871    /// a value.
5872    ///
5873    /// This function panics if the Usage ID value results in
5874    /// an unknown Usage. Where error checking is required,
5875    /// use [UsagePage::to_usage_from_value].
5876    fn bitor(self, usage: u16) -> Usage {
5877        let up = u16::from(self) as u32;
5878        let u = usage as u32;
5879        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
5880    }
5881}
5882
5883/// *Usage Page `0xC`: "Consumer"*
5884///
5885/// **This enum is autogenerated from the HID Usage Tables**.
5886/// ```
5887/// # use hut::*;
5888/// let u1 = Usage::Consumer(Consumer::NumericKeyPad);
5889/// let u2 = Usage::new_from_page_and_id(0xC, 0x2).unwrap();
5890/// let u3 = Usage::from(Consumer::NumericKeyPad);
5891/// let u4: Usage = Consumer::NumericKeyPad.into();
5892/// assert_eq!(u1, u2);
5893/// assert_eq!(u1, u3);
5894/// assert_eq!(u1, u4);
5895///
5896/// assert!(matches!(u1.usage_page(), UsagePage::Consumer));
5897/// assert_eq!(0xC, u1.usage_page_value());
5898/// assert_eq!(0x2, u1.usage_id_value());
5899/// assert_eq!((0xC << 16) | 0x2, u1.usage_value());
5900/// assert_eq!("Numeric Key Pad", u1.name());
5901/// ```
5902///
5903#[allow(non_camel_case_types)]
5904#[derive(Debug)]
5905#[non_exhaustive]
5906pub enum Consumer {
5907    /// Usage ID `0x1`: "Consumer Control"
5908    ConsumerControl,
5909    /// Usage ID `0x2`: "Numeric Key Pad"
5910    NumericKeyPad,
5911    /// Usage ID `0x3`: "Programmable Buttons"
5912    ProgrammableButtons,
5913    /// Usage ID `0x4`: "Microphone"
5914    Microphone,
5915    /// Usage ID `0x5`: "Headphone"
5916    Headphone,
5917    /// Usage ID `0x6`: "Graphic Equalizer"
5918    GraphicEqualizer,
5919    /// Usage ID `0x20`: "+10"
5920    Plus10,
5921    /// Usage ID `0x21`: "+100"
5922    Plus100,
5923    /// Usage ID `0x22`: "AM/PM"
5924    AMPM,
5925    /// Usage ID `0x30`: "Power"
5926    Power,
5927    /// Usage ID `0x31`: "Reset"
5928    Reset,
5929    /// Usage ID `0x32`: "Sleep"
5930    Sleep,
5931    /// Usage ID `0x33`: "Sleep After"
5932    SleepAfter,
5933    /// Usage ID `0x34`: "Sleep Mode"
5934    SleepMode,
5935    /// Usage ID `0x35`: "Illumination"
5936    Illumination,
5937    /// Usage ID `0x36`: "Function Buttons"
5938    FunctionButtons,
5939    /// Usage ID `0x40`: "Menu"
5940    Menu,
5941    /// Usage ID `0x41`: "Menu Pick"
5942    MenuPick,
5943    /// Usage ID `0x42`: "Menu Up"
5944    MenuUp,
5945    /// Usage ID `0x43`: "Menu Down"
5946    MenuDown,
5947    /// Usage ID `0x44`: "Menu Left"
5948    MenuLeft,
5949    /// Usage ID `0x45`: "Menu Right"
5950    MenuRight,
5951    /// Usage ID `0x46`: "Menu Escape"
5952    MenuEscape,
5953    /// Usage ID `0x47`: "Menu Value Increase"
5954    MenuValueIncrease,
5955    /// Usage ID `0x48`: "Menu Value Decrease"
5956    MenuValueDecrease,
5957    /// Usage ID `0x60`: "Data On Screen"
5958    DataOnScreen,
5959    /// Usage ID `0x61`: "Closed Caption"
5960    ClosedCaption,
5961    /// Usage ID `0x62`: "Closed Caption Select"
5962    ClosedCaptionSelect,
5963    /// Usage ID `0x63`: "VCR/TV"
5964    VCRTV,
5965    /// Usage ID `0x64`: "Broadcast Mode"
5966    BroadcastMode,
5967    /// Usage ID `0x65`: "Snapshot"
5968    Snapshot,
5969    /// Usage ID `0x66`: "Still"
5970    Still,
5971    /// Usage ID `0x67`: "Picture-in-Picture Toggle"
5972    PictureinPictureToggle,
5973    /// Usage ID `0x68`: "Picture-in-Picture Swap"
5974    PictureinPictureSwap,
5975    /// Usage ID `0x69`: "Red Menu Button"
5976    RedMenuButton,
5977    /// Usage ID `0x6A`: "Green Menu Button"
5978    GreenMenuButton,
5979    /// Usage ID `0x6B`: "Blue Menu Button"
5980    BlueMenuButton,
5981    /// Usage ID `0x6C`: "Yellow Menu Button"
5982    YellowMenuButton,
5983    /// Usage ID `0x6D`: "Aspect"
5984    Aspect,
5985    /// Usage ID `0x6E`: "3D Mode Select"
5986    ThreeDModeSelect,
5987    /// Usage ID `0x6F`: "Display Brightness Increment"
5988    DisplayBrightnessIncrement,
5989    /// Usage ID `0x70`: "Display Brightness Decrement"
5990    DisplayBrightnessDecrement,
5991    /// Usage ID `0x71`: "Display Brightness"
5992    DisplayBrightness,
5993    /// Usage ID `0x72`: "Display Backlight Toggle"
5994    DisplayBacklightToggle,
5995    /// Usage ID `0x73`: "Display Set Brightness to Minimum"
5996    DisplaySetBrightnesstoMinimum,
5997    /// Usage ID `0x74`: "Display Set Brightness to Maximum"
5998    DisplaySetBrightnesstoMaximum,
5999    /// Usage ID `0x75`: "Display Set Auto Brightness"
6000    DisplaySetAutoBrightness,
6001    /// Usage ID `0x76`: "Camera Access Enabled"
6002    CameraAccessEnabled,
6003    /// Usage ID `0x77`: "Camera Access Disabled"
6004    CameraAccessDisabled,
6005    /// Usage ID `0x78`: "Camera Access Toggle"
6006    CameraAccessToggle,
6007    /// Usage ID `0x79`: "Keyboard Brightness Increment"
6008    KeyboardBrightnessIncrement,
6009    /// Usage ID `0x7A`: "Keyboard Brightness Decrement"
6010    KeyboardBrightnessDecrement,
6011    /// Usage ID `0x7B`: "Keyboard Backlight Set Level"
6012    KeyboardBacklightSetLevel,
6013    /// Usage ID `0x7C`: "Keyboard Backlight OOC"
6014    KeyboardBacklightOOC,
6015    /// Usage ID `0x7D`: "Keyboard Backlight Set Minimum"
6016    KeyboardBacklightSetMinimum,
6017    /// Usage ID `0x7E`: "Keyboard Backlight Set Maximum"
6018    KeyboardBacklightSetMaximum,
6019    /// Usage ID `0x7F`: "Keyboard Backlight Auto"
6020    KeyboardBacklightAuto,
6021    /// Usage ID `0x80`: "Selection"
6022    Selection,
6023    /// Usage ID `0x81`: "Assign Selection"
6024    AssignSelection,
6025    /// Usage ID `0x82`: "Mode Step"
6026    ModeStep,
6027    /// Usage ID `0x83`: "Recall Last"
6028    RecallLast,
6029    /// Usage ID `0x84`: "Enter Channel"
6030    EnterChannel,
6031    /// Usage ID `0x85`: "Order Movie"
6032    OrderMovie,
6033    /// Usage ID `0x86`: "Channel"
6034    Channel,
6035    /// Usage ID `0x87`: "Media Selection"
6036    MediaSelection,
6037    /// Usage ID `0x88`: "Media Select Computer"
6038    MediaSelectComputer,
6039    /// Usage ID `0x89`: "Media Select TV"
6040    MediaSelectTV,
6041    /// Usage ID `0x8A`: "Media Select WWW"
6042    MediaSelectWWW,
6043    /// Usage ID `0x8B`: "Media Select DVD"
6044    MediaSelectDVD,
6045    /// Usage ID `0x8C`: "Media Select Telephone"
6046    MediaSelectTelephone,
6047    /// Usage ID `0x8D`: "Media Select Program Guide"
6048    MediaSelectProgramGuide,
6049    /// Usage ID `0x8E`: "Media Select Video Phone"
6050    MediaSelectVideoPhone,
6051    /// Usage ID `0x8F`: "Media Select Games"
6052    MediaSelectGames,
6053    /// Usage ID `0x90`: "Media Select Messages"
6054    MediaSelectMessages,
6055    /// Usage ID `0x91`: "Media Select CD"
6056    MediaSelectCD,
6057    /// Usage ID `0x92`: "Media Select VCR"
6058    MediaSelectVCR,
6059    /// Usage ID `0x93`: "Media Select Tuner"
6060    MediaSelectTuner,
6061    /// Usage ID `0x94`: "Quit"
6062    Quit,
6063    /// Usage ID `0x95`: "Help"
6064    Help,
6065    /// Usage ID `0x96`: "Media Select Tape"
6066    MediaSelectTape,
6067    /// Usage ID `0x97`: "Media Select Cable"
6068    MediaSelectCable,
6069    /// Usage ID `0x98`: "Media Select Satellite"
6070    MediaSelectSatellite,
6071    /// Usage ID `0x99`: "Media Select Security"
6072    MediaSelectSecurity,
6073    /// Usage ID `0x9A`: "Media Select Home"
6074    MediaSelectHome,
6075    /// Usage ID `0x9B`: "Media Select Call"
6076    MediaSelectCall,
6077    /// Usage ID `0x9C`: "Channel Increment"
6078    ChannelIncrement,
6079    /// Usage ID `0x9D`: "Channel Decrement"
6080    ChannelDecrement,
6081    /// Usage ID `0x9E`: "Media Select SAP"
6082    MediaSelectSAP,
6083    /// Usage ID `0xA0`: "VCR Plus"
6084    VCRPlus,
6085    /// Usage ID `0xA1`: "Once"
6086    Once,
6087    /// Usage ID `0xA2`: "Daily"
6088    Daily,
6089    /// Usage ID `0xA3`: "Weekly"
6090    Weekly,
6091    /// Usage ID `0xA4`: "Monthly"
6092    Monthly,
6093    /// Usage ID `0xB0`: "Play"
6094    Play,
6095    /// Usage ID `0xB1`: "Pause"
6096    Pause,
6097    /// Usage ID `0xB2`: "Record"
6098    Record,
6099    /// Usage ID `0xB3`: "Fast Forward"
6100    FastForward,
6101    /// Usage ID `0xB4`: "Rewind"
6102    Rewind,
6103    /// Usage ID `0xB5`: "Scan Next Track"
6104    ScanNextTrack,
6105    /// Usage ID `0xB6`: "Scan Previous Track"
6106    ScanPreviousTrack,
6107    /// Usage ID `0xB7`: "Stop"
6108    Stop,
6109    /// Usage ID `0xB8`: "Eject"
6110    Eject,
6111    /// Usage ID `0xB9`: "Random Play"
6112    RandomPlay,
6113    /// Usage ID `0xBA`: "Select Disc"
6114    SelectDisc,
6115    /// Usage ID `0xBB`: "Enter Disc"
6116    EnterDisc,
6117    /// Usage ID `0xBC`: "Repeat"
6118    Repeat,
6119    /// Usage ID `0xBD`: "Tracking"
6120    Tracking,
6121    /// Usage ID `0xBE`: "Track Normal"
6122    TrackNormal,
6123    /// Usage ID `0xBF`: "Slow Tracking"
6124    SlowTracking,
6125    /// Usage ID `0xC0`: "Frame Forward"
6126    FrameForward,
6127    /// Usage ID `0xC1`: "Frame Back"
6128    FrameBack,
6129    /// Usage ID `0xC2`: "Mark"
6130    Mark,
6131    /// Usage ID `0xC3`: "Clear Mark"
6132    ClearMark,
6133    /// Usage ID `0xC4`: "Repeat From Mark"
6134    RepeatFromMark,
6135    /// Usage ID `0xC5`: "Return To Mark"
6136    ReturnToMark,
6137    /// Usage ID `0xC6`: "Search Mark Forward"
6138    SearchMarkForward,
6139    /// Usage ID `0xC7`: "Search Mark Backwards"
6140    SearchMarkBackwards,
6141    /// Usage ID `0xC8`: "Counter Reset"
6142    CounterReset,
6143    /// Usage ID `0xC9`: "Show Counter"
6144    ShowCounter,
6145    /// Usage ID `0xCA`: "Tracking Increment"
6146    TrackingIncrement,
6147    /// Usage ID `0xCB`: "Tracking Decrement"
6148    TrackingDecrement,
6149    /// Usage ID `0xCC`: "Stop/Eject"
6150    StopEject,
6151    /// Usage ID `0xCD`: "Play/Pause"
6152    PlayPause,
6153    /// Usage ID `0xCE`: "Play/Skip"
6154    PlaySkip,
6155    /// Usage ID `0xCF`: "Voice Command"
6156    VoiceCommand,
6157    /// Usage ID `0xD0`: "Invoke Capture Interface"
6158    InvokeCaptureInterface,
6159    /// Usage ID `0xD1`: "Start or Stop Game Recording"
6160    StartorStopGameRecording,
6161    /// Usage ID `0xD2`: "Historical Game Capture"
6162    HistoricalGameCapture,
6163    /// Usage ID `0xD3`: "Capture Game Screenshot"
6164    CaptureGameScreenshot,
6165    /// Usage ID `0xD4`: "Show or Hide Recording Indicator"
6166    ShoworHideRecordingIndicator,
6167    /// Usage ID `0xD5`: "Start or Stop Microphone Capture"
6168    StartorStopMicrophoneCapture,
6169    /// Usage ID `0xD6`: "Start or Stop Camera Capture"
6170    StartorStopCameraCapture,
6171    /// Usage ID `0xD7`: "Start or Stop Game Broadcast"
6172    StartorStopGameBroadcast,
6173    /// Usage ID `0xD8`: "Start or Stop Voice Dictation Session"
6174    StartorStopVoiceDictationSession,
6175    /// Usage ID `0xD9`: "Invoke/Dismiss Emoji Picker"
6176    InvokeDismissEmojiPicker,
6177    /// Usage ID `0xE0`: "Volume"
6178    Volume,
6179    /// Usage ID `0xE1`: "Balance"
6180    Balance,
6181    /// Usage ID `0xE2`: "Mute"
6182    Mute,
6183    /// Usage ID `0xE3`: "Bass"
6184    Bass,
6185    /// Usage ID `0xE4`: "Treble"
6186    Treble,
6187    /// Usage ID `0xE5`: "Bass Boost"
6188    BassBoost,
6189    /// Usage ID `0xE6`: "Surround Mode"
6190    SurroundMode,
6191    /// Usage ID `0xE7`: "Loudness"
6192    Loudness,
6193    /// Usage ID `0xE8`: "MPX"
6194    MPX,
6195    /// Usage ID `0xE9`: "Volume Increment"
6196    VolumeIncrement,
6197    /// Usage ID `0xEA`: "Volume Decrement"
6198    VolumeDecrement,
6199    /// Usage ID `0xF0`: "Speed Select"
6200    SpeedSelect,
6201    /// Usage ID `0xF1`: "Playback Speed"
6202    PlaybackSpeed,
6203    /// Usage ID `0xF2`: "Standard Play"
6204    StandardPlay,
6205    /// Usage ID `0xF3`: "Long Play"
6206    LongPlay,
6207    /// Usage ID `0xF4`: "Extended Play"
6208    ExtendedPlay,
6209    /// Usage ID `0xF5`: "Slow"
6210    Slow,
6211    /// Usage ID `0x100`: "Fan Enable"
6212    FanEnable,
6213    /// Usage ID `0x101`: "Fan Speed"
6214    FanSpeed,
6215    /// Usage ID `0x102`: "Light Enable"
6216    LightEnable,
6217    /// Usage ID `0x103`: "Light Illumination Level"
6218    LightIlluminationLevel,
6219    /// Usage ID `0x104`: "Climate Control Enable"
6220    ClimateControlEnable,
6221    /// Usage ID `0x105`: "Room Temperature"
6222    RoomTemperature,
6223    /// Usage ID `0x106`: "Security Enable"
6224    SecurityEnable,
6225    /// Usage ID `0x107`: "Fire Alarm"
6226    FireAlarm,
6227    /// Usage ID `0x108`: "Police Alarm"
6228    PoliceAlarm,
6229    /// Usage ID `0x109`: "Proximity"
6230    Proximity,
6231    /// Usage ID `0x10A`: "Motion"
6232    Motion,
6233    /// Usage ID `0x10B`: "Duress Alarm"
6234    DuressAlarm,
6235    /// Usage ID `0x10C`: "Holdup Alarm"
6236    HoldupAlarm,
6237    /// Usage ID `0x10D`: "Medical Alarm"
6238    MedicalAlarm,
6239    /// Usage ID `0x150`: "Balance Right"
6240    BalanceRight,
6241    /// Usage ID `0x151`: "Balance Left"
6242    BalanceLeft,
6243    /// Usage ID `0x152`: "Bass Increment"
6244    BassIncrement,
6245    /// Usage ID `0x153`: "Bass Decrement"
6246    BassDecrement,
6247    /// Usage ID `0x154`: "Treble Increment"
6248    TrebleIncrement,
6249    /// Usage ID `0x155`: "Treble Decrement"
6250    TrebleDecrement,
6251    /// Usage ID `0x160`: "Speaker System"
6252    SpeakerSystem,
6253    /// Usage ID `0x161`: "Channel Left"
6254    ChannelLeft,
6255    /// Usage ID `0x162`: "Channel Right"
6256    ChannelRight,
6257    /// Usage ID `0x163`: "Channel Center"
6258    ChannelCenter,
6259    /// Usage ID `0x164`: "Channel Front"
6260    ChannelFront,
6261    /// Usage ID `0x165`: "Channel Center Front"
6262    ChannelCenterFront,
6263    /// Usage ID `0x166`: "Channel Side"
6264    ChannelSide,
6265    /// Usage ID `0x167`: "Channel Surround"
6266    ChannelSurround,
6267    /// Usage ID `0x168`: "Channel Low Frequency Enhancement"
6268    ChannelLowFrequencyEnhancement,
6269    /// Usage ID `0x169`: "Channel Top"
6270    ChannelTop,
6271    /// Usage ID `0x16A`: "Channel Unknown"
6272    ChannelUnknown,
6273    /// Usage ID `0x170`: "Sub-channel"
6274    Subchannel,
6275    /// Usage ID `0x171`: "Sub-channel Increment"
6276    SubchannelIncrement,
6277    /// Usage ID `0x172`: "Sub-channel Decrement"
6278    SubchannelDecrement,
6279    /// Usage ID `0x173`: "Alternate Audio Increment"
6280    AlternateAudioIncrement,
6281    /// Usage ID `0x174`: "Alternate Audio Decrement"
6282    AlternateAudioDecrement,
6283    /// Usage ID `0x180`: "Application Launch Buttons"
6284    ApplicationLaunchButtons,
6285    /// Usage ID `0x181`: "AL Launch Button Configuration Tool"
6286    ALLaunchButtonConfigurationTool,
6287    /// Usage ID `0x182`: "AL Programmable Button Configuration"
6288    ALProgrammableButtonConfiguration,
6289    /// Usage ID `0x183`: "AL Consumer Control Configuration"
6290    ALConsumerControlConfiguration,
6291    /// Usage ID `0x184`: "AL Word Processor"
6292    ALWordProcessor,
6293    /// Usage ID `0x185`: "AL Text Editor"
6294    ALTextEditor,
6295    /// Usage ID `0x186`: "AL Spreadsheet"
6296    ALSpreadsheet,
6297    /// Usage ID `0x187`: "AL Graphics Editor"
6298    ALGraphicsEditor,
6299    /// Usage ID `0x188`: "AL Presentation App"
6300    ALPresentationApp,
6301    /// Usage ID `0x189`: "AL Database App"
6302    ALDatabaseApp,
6303    /// Usage ID `0x18A`: "AL Email Reader"
6304    ALEmailReader,
6305    /// Usage ID `0x18B`: "AL Newsreader"
6306    ALNewsreader,
6307    /// Usage ID `0x18C`: "AL Voicemail"
6308    ALVoicemail,
6309    /// Usage ID `0x18D`: "AL Contacts/Address Book"
6310    ALContactsAddressBook,
6311    /// Usage ID `0x18E`: "AL Calendar/Schedule"
6312    ALCalendarSchedule,
6313    /// Usage ID `0x18F`: "AL Task/Project Manager"
6314    ALTaskProjectManager,
6315    /// Usage ID `0x190`: "AL Log/Journal/Timecard"
6316    ALLogJournalTimecard,
6317    /// Usage ID `0x191`: "AL Checkbook/Finance"
6318    ALCheckbookFinance,
6319    /// Usage ID `0x192`: "AL Calculator"
6320    ALCalculator,
6321    /// Usage ID `0x193`: "AL A/V Capture/Playback"
6322    ALAVCapturePlayback,
6323    /// Usage ID `0x194`: "AL Local Machine Browser"
6324    ALLocalMachineBrowser,
6325    /// Usage ID `0x195`: "AL LAN/WAN Browser"
6326    ALLANWANBrowser,
6327    /// Usage ID `0x196`: "AL Internet Browser"
6328    ALInternetBrowser,
6329    /// Usage ID `0x197`: "AL Remote Networking/ISP Connect"
6330    ALRemoteNetworkingISPConnect,
6331    /// Usage ID `0x198`: "AL Network Conference"
6332    ALNetworkConference,
6333    /// Usage ID `0x199`: "AL Network Chat"
6334    ALNetworkChat,
6335    /// Usage ID `0x19A`: "AL Telephony/Dialer"
6336    ALTelephonyDialer,
6337    /// Usage ID `0x19B`: "AL Logon"
6338    ALLogon,
6339    /// Usage ID `0x19C`: "AL Logoff"
6340    ALLogoff,
6341    /// Usage ID `0x19D`: "AL Logon/Logoff"
6342    ALLogonLogoff,
6343    /// Usage ID `0x19E`: "AL Terminal Lock/Screensaver"
6344    ALTerminalLockScreensaver,
6345    /// Usage ID `0x19F`: "AL Control Panel"
6346    ALControlPanel,
6347    /// Usage ID `0x1A0`: "AL Command Line Processor/Run"
6348    ALCommandLineProcessorRun,
6349    /// Usage ID `0x1A1`: "AL Process/Task Manager"
6350    ALProcessTaskManager,
6351    /// Usage ID `0x1A2`: "AL Select Task/Application"
6352    ALSelectTaskApplication,
6353    /// Usage ID `0x1A3`: "AL Next Task/Application"
6354    ALNextTaskApplication,
6355    /// Usage ID `0x1A4`: "AL Previous Task/Application"
6356    ALPreviousTaskApplication,
6357    /// Usage ID `0x1A5`: "AL Preemptive Halt Task/Application"
6358    ALPreemptiveHaltTaskApplication,
6359    /// Usage ID `0x1A6`: "AL Integrated Help Center"
6360    ALIntegratedHelpCenter,
6361    /// Usage ID `0x1A7`: "AL Documents"
6362    ALDocuments,
6363    /// Usage ID `0x1A8`: "AL Thesaurus"
6364    ALThesaurus,
6365    /// Usage ID `0x1A9`: "AL Dictionary"
6366    ALDictionary,
6367    /// Usage ID `0x1AA`: "AL Desktop"
6368    ALDesktop,
6369    /// Usage ID `0x1AB`: "AL Spell Check"
6370    ALSpellCheck,
6371    /// Usage ID `0x1AC`: "AL Grammar Check"
6372    ALGrammarCheck,
6373    /// Usage ID `0x1AD`: "AL Wireless Status"
6374    ALWirelessStatus,
6375    /// Usage ID `0x1AE`: "AL Keyboard Layout"
6376    ALKeyboardLayout,
6377    /// Usage ID `0x1AF`: "AL Virus Protection"
6378    ALVirusProtection,
6379    /// Usage ID `0x1B0`: "AL Encryption"
6380    ALEncryption,
6381    /// Usage ID `0x1B1`: "AL Screen Saver"
6382    ALScreenSaver,
6383    /// Usage ID `0x1B2`: "AL Alarms"
6384    ALAlarms,
6385    /// Usage ID `0x1B3`: "AL Clock"
6386    ALClock,
6387    /// Usage ID `0x1B4`: "AL File Browser"
6388    ALFileBrowser,
6389    /// Usage ID `0x1B5`: "AL Power Status"
6390    ALPowerStatus,
6391    /// Usage ID `0x1B6`: "AL Image Browser"
6392    ALImageBrowser,
6393    /// Usage ID `0x1B7`: "AL Audio Browser"
6394    ALAudioBrowser,
6395    /// Usage ID `0x1B8`: "AL Movie Browser"
6396    ALMovieBrowser,
6397    /// Usage ID `0x1B9`: "AL Digital Rights Manager"
6398    ALDigitalRightsManager,
6399    /// Usage ID `0x1BA`: "AL Digital Wallet"
6400    ALDigitalWallet,
6401    /// Usage ID `0x1BC`: "AL Instant Messaging"
6402    ALInstantMessaging,
6403    /// Usage ID `0x1BD`: "AL OEM Features/ Tips/Tutorial Browser"
6404    ALOEMFeaturesTipsTutorialBrowser,
6405    /// Usage ID `0x1BE`: "AL OEM Help"
6406    ALOEMHelp,
6407    /// Usage ID `0x1BF`: "AL Online Community"
6408    ALOnlineCommunity,
6409    /// Usage ID `0x1C0`: "AL Entertainment Content Browser"
6410    ALEntertainmentContentBrowser,
6411    /// Usage ID `0x1C1`: "AL Online Shopping Browser"
6412    ALOnlineShoppingBrowser,
6413    /// Usage ID `0x1C2`: "AL SmartCard Information/Help"
6414    ALSmartCardInformationHelp,
6415    /// Usage ID `0x1C3`: "AL Market Monitor/Finance Browser"
6416    ALMarketMonitorFinanceBrowser,
6417    /// Usage ID `0x1C4`: "AL Customized Corporate News Browser"
6418    ALCustomizedCorporateNewsBrowser,
6419    /// Usage ID `0x1C5`: "AL Online Activity Browser"
6420    ALOnlineActivityBrowser,
6421    /// Usage ID `0x1C6`: "AL Research/Search Browser"
6422    ALResearchSearchBrowser,
6423    /// Usage ID `0x1C7`: "AL Audio Player"
6424    ALAudioPlayer,
6425    /// Usage ID `0x1C8`: "AL Message Status"
6426    ALMessageStatus,
6427    /// Usage ID `0x1C9`: "AL Contact Sync"
6428    ALContactSync,
6429    /// Usage ID `0x1CA`: "AL Navigation"
6430    ALNavigation,
6431    /// Usage ID `0x1CB`: "AL Context‐aware Desktop Assistant"
6432    ALContextawareDesktopAssistant,
6433    /// Usage ID `0x200`: "Generic GUI Application Controls"
6434    GenericGUIApplicationControls,
6435    /// Usage ID `0x201`: "AC New"
6436    ACNew,
6437    /// Usage ID `0x202`: "AC Open"
6438    ACOpen,
6439    /// Usage ID `0x203`: "AC Close"
6440    ACClose,
6441    /// Usage ID `0x204`: "AC Exit"
6442    ACExit,
6443    /// Usage ID `0x205`: "AC Maximize"
6444    ACMaximize,
6445    /// Usage ID `0x206`: "AC Minimize"
6446    ACMinimize,
6447    /// Usage ID `0x207`: "AC Save"
6448    ACSave,
6449    /// Usage ID `0x208`: "AC Print"
6450    ACPrint,
6451    /// Usage ID `0x209`: "AC Properties"
6452    ACProperties,
6453    /// Usage ID `0x21A`: "AC Undo"
6454    ACUndo,
6455    /// Usage ID `0x21B`: "AC Copy"
6456    ACCopy,
6457    /// Usage ID `0x21C`: "AC Cut"
6458    ACCut,
6459    /// Usage ID `0x21D`: "AC Paste"
6460    ACPaste,
6461    /// Usage ID `0x21E`: "AC Select All"
6462    ACSelectAll,
6463    /// Usage ID `0x21F`: "AC Find"
6464    ACFind,
6465    /// Usage ID `0x220`: "AC Find and Replace"
6466    ACFindandReplace,
6467    /// Usage ID `0x221`: "AC Search"
6468    ACSearch,
6469    /// Usage ID `0x222`: "AC Go To"
6470    ACGoTo,
6471    /// Usage ID `0x223`: "AC Home"
6472    ACHome,
6473    /// Usage ID `0x224`: "AC Back"
6474    ACBack,
6475    /// Usage ID `0x225`: "AC Forward"
6476    ACForward,
6477    /// Usage ID `0x226`: "AC Stop"
6478    ACStop,
6479    /// Usage ID `0x227`: "AC Refresh"
6480    ACRefresh,
6481    /// Usage ID `0x228`: "AC Previous Link"
6482    ACPreviousLink,
6483    /// Usage ID `0x229`: "AC Next Link"
6484    ACNextLink,
6485    /// Usage ID `0x22A`: "AC Bookmarks"
6486    ACBookmarks,
6487    /// Usage ID `0x22B`: "AC History"
6488    ACHistory,
6489    /// Usage ID `0x22C`: "AC Subscriptions"
6490    ACSubscriptions,
6491    /// Usage ID `0x22D`: "AC Zoom In"
6492    ACZoomIn,
6493    /// Usage ID `0x22E`: "AC Zoom Out"
6494    ACZoomOut,
6495    /// Usage ID `0x22F`: "AC Zoom"
6496    ACZoom,
6497    /// Usage ID `0x230`: "AC Full Screen View"
6498    ACFullScreenView,
6499    /// Usage ID `0x231`: "AC Normal View"
6500    ACNormalView,
6501    /// Usage ID `0x232`: "AC View Toggle"
6502    ACViewToggle,
6503    /// Usage ID `0x233`: "AC Scroll Up"
6504    ACScrollUp,
6505    /// Usage ID `0x234`: "AC Scroll Down"
6506    ACScrollDown,
6507    /// Usage ID `0x235`: "AC Scroll"
6508    ACScroll,
6509    /// Usage ID `0x236`: "AC Pan Left"
6510    ACPanLeft,
6511    /// Usage ID `0x237`: "AC Pan Right"
6512    ACPanRight,
6513    /// Usage ID `0x238`: "AC Pan"
6514    ACPan,
6515    /// Usage ID `0x239`: "AC New Window"
6516    ACNewWindow,
6517    /// Usage ID `0x23A`: "AC Tile Horizontally"
6518    ACTileHorizontally,
6519    /// Usage ID `0x23B`: "AC Tile Vertically"
6520    ACTileVertically,
6521    /// Usage ID `0x23C`: "AC Format"
6522    ACFormat,
6523    /// Usage ID `0x23D`: "AC Edit"
6524    ACEdit,
6525    /// Usage ID `0x23E`: "AC Bold"
6526    ACBold,
6527    /// Usage ID `0x23F`: "AC Italics"
6528    ACItalics,
6529    /// Usage ID `0x240`: "AC Underline"
6530    ACUnderline,
6531    /// Usage ID `0x241`: "AC Strikethrough"
6532    ACStrikethrough,
6533    /// Usage ID `0x242`: "AC Subscript"
6534    ACSubscript,
6535    /// Usage ID `0x243`: "AC Superscript"
6536    ACSuperscript,
6537    /// Usage ID `0x244`: "AC All Caps"
6538    ACAllCaps,
6539    /// Usage ID `0x245`: "AC Rotate"
6540    ACRotate,
6541    /// Usage ID `0x246`: "AC Resize"
6542    ACResize,
6543    /// Usage ID `0x247`: "AC Flip Horizontal"
6544    ACFlipHorizontal,
6545    /// Usage ID `0x248`: "AC Flip Vertical"
6546    ACFlipVertical,
6547    /// Usage ID `0x249`: "AC Mirror Horizontal"
6548    ACMirrorHorizontal,
6549    /// Usage ID `0x24A`: "AC Mirror Vertical"
6550    ACMirrorVertical,
6551    /// Usage ID `0x24B`: "AC Font Select"
6552    ACFontSelect,
6553    /// Usage ID `0x24C`: "AC Font Color"
6554    ACFontColor,
6555    /// Usage ID `0x24D`: "AC Font Size"
6556    ACFontSize,
6557    /// Usage ID `0x24E`: "AC Justify Left"
6558    ACJustifyLeft,
6559    /// Usage ID `0x24F`: "AC Justify Center H"
6560    ACJustifyCenterH,
6561    /// Usage ID `0x250`: "AC Justify Right"
6562    ACJustifyRight,
6563    /// Usage ID `0x251`: "AC Justify Block H"
6564    ACJustifyBlockH,
6565    /// Usage ID `0x252`: "AC Justify Top"
6566    ACJustifyTop,
6567    /// Usage ID `0x253`: "AC Justify Center V"
6568    ACJustifyCenterV,
6569    /// Usage ID `0x254`: "AC Justify Bottom"
6570    ACJustifyBottom,
6571    /// Usage ID `0x255`: "AC Justify Block V"
6572    ACJustifyBlockV,
6573    /// Usage ID `0x256`: "AC Indent Decrease"
6574    ACIndentDecrease,
6575    /// Usage ID `0x257`: "AC Indent Increase"
6576    ACIndentIncrease,
6577    /// Usage ID `0x258`: "AC Numbered List"
6578    ACNumberedList,
6579    /// Usage ID `0x259`: "AC Restart Numbering"
6580    ACRestartNumbering,
6581    /// Usage ID `0x25A`: "AC Bulleted List"
6582    ACBulletedList,
6583    /// Usage ID `0x25B`: "AC Promote"
6584    ACPromote,
6585    /// Usage ID `0x25C`: "AC Demote"
6586    ACDemote,
6587    /// Usage ID `0x25D`: "AC Yes"
6588    ACYes,
6589    /// Usage ID `0x25E`: "AC No"
6590    ACNo,
6591    /// Usage ID `0x25F`: "AC Cancel"
6592    ACCancel,
6593    /// Usage ID `0x260`: "AC Catalog"
6594    ACCatalog,
6595    /// Usage ID `0x261`: "AC Buy/Checkout"
6596    ACBuyCheckout,
6597    /// Usage ID `0x262`: "AC Add to Cart"
6598    ACAddtoCart,
6599    /// Usage ID `0x263`: "AC Expand"
6600    ACExpand,
6601    /// Usage ID `0x264`: "AC Expand All"
6602    ACExpandAll,
6603    /// Usage ID `0x265`: "AC Collapse"
6604    ACCollapse,
6605    /// Usage ID `0x266`: "AC Collapse All"
6606    ACCollapseAll,
6607    /// Usage ID `0x267`: "AC Print Preview"
6608    ACPrintPreview,
6609    /// Usage ID `0x268`: "AC Paste Special"
6610    ACPasteSpecial,
6611    /// Usage ID `0x269`: "AC Insert Mode"
6612    ACInsertMode,
6613    /// Usage ID `0x26A`: "AC Delete"
6614    ACDelete,
6615    /// Usage ID `0x26B`: "AC Lock"
6616    ACLock,
6617    /// Usage ID `0x26C`: "AC Unlock"
6618    ACUnlock,
6619    /// Usage ID `0x26D`: "AC Protect"
6620    ACProtect,
6621    /// Usage ID `0x26E`: "AC Unprotect"
6622    ACUnprotect,
6623    /// Usage ID `0x26F`: "AC Attach Comment"
6624    ACAttachComment,
6625    /// Usage ID `0x270`: "AC Delete Comment"
6626    ACDeleteComment,
6627    /// Usage ID `0x271`: "AC View Comment"
6628    ACViewComment,
6629    /// Usage ID `0x272`: "AC Select Word"
6630    ACSelectWord,
6631    /// Usage ID `0x273`: "AC Select Sentence"
6632    ACSelectSentence,
6633    /// Usage ID `0x274`: "AC Select Paragraph"
6634    ACSelectParagraph,
6635    /// Usage ID `0x275`: "AC Select Column"
6636    ACSelectColumn,
6637    /// Usage ID `0x276`: "AC Select Row"
6638    ACSelectRow,
6639    /// Usage ID `0x277`: "AC Select Table"
6640    ACSelectTable,
6641    /// Usage ID `0x278`: "AC Select Object"
6642    ACSelectObject,
6643    /// Usage ID `0x279`: "AC Redo/Repeat"
6644    ACRedoRepeat,
6645    /// Usage ID `0x27A`: "AC Sort"
6646    ACSort,
6647    /// Usage ID `0x27B`: "AC Sort Ascending"
6648    ACSortAscending,
6649    /// Usage ID `0x27C`: "AC Sort Descending"
6650    ACSortDescending,
6651    /// Usage ID `0x27D`: "AC Filter"
6652    ACFilter,
6653    /// Usage ID `0x27E`: "AC Set Clock"
6654    ACSetClock,
6655    /// Usage ID `0x27F`: "AC View Clock"
6656    ACViewClock,
6657    /// Usage ID `0x280`: "AC Select Time Zone"
6658    ACSelectTimeZone,
6659    /// Usage ID `0x281`: "AC Edit Time Zones"
6660    ACEditTimeZones,
6661    /// Usage ID `0x282`: "AC Set Alarm"
6662    ACSetAlarm,
6663    /// Usage ID `0x283`: "AC Clear Alarm"
6664    ACClearAlarm,
6665    /// Usage ID `0x284`: "AC Snooze Alarm"
6666    ACSnoozeAlarm,
6667    /// Usage ID `0x285`: "AC Reset Alarm"
6668    ACResetAlarm,
6669    /// Usage ID `0x286`: "AC Synchronize"
6670    ACSynchronize,
6671    /// Usage ID `0x287`: "AC Send/Receive"
6672    ACSendReceive,
6673    /// Usage ID `0x288`: "AC Send To"
6674    ACSendTo,
6675    /// Usage ID `0x289`: "AC Reply"
6676    ACReply,
6677    /// Usage ID `0x28A`: "AC Reply All"
6678    ACReplyAll,
6679    /// Usage ID `0x28B`: "AC Forward Msg"
6680    ACForwardMsg,
6681    /// Usage ID `0x28C`: "AC Send"
6682    ACSend,
6683    /// Usage ID `0x28D`: "AC Attach File"
6684    ACAttachFile,
6685    /// Usage ID `0x28E`: "AC Upload"
6686    ACUpload,
6687    /// Usage ID `0x28F`: "AC Download (Save Target As)"
6688    ACDownloadSaveTargetAs,
6689    /// Usage ID `0x290`: "AC Set Borders"
6690    ACSetBorders,
6691    /// Usage ID `0x291`: "AC Insert Row"
6692    ACInsertRow,
6693    /// Usage ID `0x292`: "AC Insert Column"
6694    ACInsertColumn,
6695    /// Usage ID `0x293`: "AC Insert File"
6696    ACInsertFile,
6697    /// Usage ID `0x294`: "AC Insert Picture"
6698    ACInsertPicture,
6699    /// Usage ID `0x295`: "AC Insert Object"
6700    ACInsertObject,
6701    /// Usage ID `0x296`: "AC Insert Symbol"
6702    ACInsertSymbol,
6703    /// Usage ID `0x297`: "AC Save and Close"
6704    ACSaveandClose,
6705    /// Usage ID `0x298`: "AC Rename"
6706    ACRename,
6707    /// Usage ID `0x299`: "AC Merge"
6708    ACMerge,
6709    /// Usage ID `0x29A`: "AC Split"
6710    ACSplit,
6711    /// Usage ID `0x29B`: "AC Disribute Horizontally"
6712    ACDisributeHorizontally,
6713    /// Usage ID `0x29C`: "AC Distribute Vertically"
6714    ACDistributeVertically,
6715    /// Usage ID `0x29D`: "AC Next Keyboard Layout Select"
6716    ACNextKeyboardLayoutSelect,
6717    /// Usage ID `0x29E`: "AC Navigation Guidance"
6718    ACNavigationGuidance,
6719    /// Usage ID `0x29F`: "AC Desktop Show All Windows"
6720    ACDesktopShowAllWindows,
6721    /// Usage ID `0x2A0`: "AC Soft Key Left"
6722    ACSoftKeyLeft,
6723    /// Usage ID `0x2A1`: "AC Soft Key Right"
6724    ACSoftKeyRight,
6725    /// Usage ID `0x2A2`: "AC Desktop Show All Applications"
6726    ACDesktopShowAllApplications,
6727    /// Usage ID `0x2B0`: "AC Idle Keep Alive"
6728    ACIdleKeepAlive,
6729    /// Usage ID `0x2C0`: "Extended Keyboard Attributes Collection"
6730    ExtendedKeyboardAttributesCollection,
6731    /// Usage ID `0x2C1`: "Keyboard Form Factor"
6732    KeyboardFormFactor,
6733    /// Usage ID `0x2C2`: "Keyboard Key Type"
6734    KeyboardKeyType,
6735    /// Usage ID `0x2C3`: "Keyboard Physical Layout"
6736    KeyboardPhysicalLayout,
6737    /// Usage ID `0x2C4`: "Vendor‐Specific Keyboard Physical Layout"
6738    VendorSpecificKeyboardPhysicalLayout,
6739    /// Usage ID `0x2C5`: "Keyboard IETF Language Tag Index"
6740    KeyboardIETFLanguageTagIndex,
6741    /// Usage ID `0x2C6`: "Implemented Keyboard Input Assist Controls"
6742    ImplementedKeyboardInputAssistControls,
6743    /// Usage ID `0x2C7`: "Keyboard Input Assist Previous"
6744    KeyboardInputAssistPrevious,
6745    /// Usage ID `0x2C8`: "Keyboard Input Assist Next"
6746    KeyboardInputAssistNext,
6747    /// Usage ID `0x2C9`: "Keyboard Input Assist Previous Group"
6748    KeyboardInputAssistPreviousGroup,
6749    /// Usage ID `0x2CA`: "Keyboard Input Assist Next Group"
6750    KeyboardInputAssistNextGroup,
6751    /// Usage ID `0x2CB`: "Keyboard Input Assist Accept"
6752    KeyboardInputAssistAccept,
6753    /// Usage ID `0x2CC`: "Keyboard Input Assist Cancel"
6754    KeyboardInputAssistCancel,
6755    /// Usage ID `0x2D0`: "Privacy Screen Toggle"
6756    PrivacyScreenToggle,
6757    /// Usage ID `0x2D1`: "Privacy Screen Level Decrement"
6758    PrivacyScreenLevelDecrement,
6759    /// Usage ID `0x2D2`: "Privacy Screen Level Increment"
6760    PrivacyScreenLevelIncrement,
6761    /// Usage ID `0x2D3`: "Privacy Screen Level Minimum"
6762    PrivacyScreenLevelMinimum,
6763    /// Usage ID `0x2D4`: "Privacy Screen Level Maximum"
6764    PrivacyScreenLevelMaximum,
6765    /// Usage ID `0x500`: "Contact Edited"
6766    ContactEdited,
6767    /// Usage ID `0x501`: "Contact Added"
6768    ContactAdded,
6769    /// Usage ID `0x502`: "Contact Record Active"
6770    ContactRecordActive,
6771    /// Usage ID `0x503`: "Contact Index"
6772    ContactIndex,
6773    /// Usage ID `0x504`: "Contact Nickname"
6774    ContactNickname,
6775    /// Usage ID `0x505`: "Contact First Name"
6776    ContactFirstName,
6777    /// Usage ID `0x506`: "Contact Last Name"
6778    ContactLastName,
6779    /// Usage ID `0x507`: "Contact Full Name"
6780    ContactFullName,
6781    /// Usage ID `0x508`: "Contact Phone Number Personal"
6782    ContactPhoneNumberPersonal,
6783    /// Usage ID `0x509`: "Contact Phone Number Business"
6784    ContactPhoneNumberBusiness,
6785    /// Usage ID `0x50A`: "Contact Phone Number Mobile"
6786    ContactPhoneNumberMobile,
6787    /// Usage ID `0x50B`: "Contact Phone Number Pager"
6788    ContactPhoneNumberPager,
6789    /// Usage ID `0x50C`: "Contact Phone Number Fax"
6790    ContactPhoneNumberFax,
6791    /// Usage ID `0x50D`: "Contact Phone Number Other"
6792    ContactPhoneNumberOther,
6793    /// Usage ID `0x50E`: "Contact Email Personal"
6794    ContactEmailPersonal,
6795    /// Usage ID `0x50F`: "Contact Email Business"
6796    ContactEmailBusiness,
6797    /// Usage ID `0x510`: "Contact Email Other"
6798    ContactEmailOther,
6799    /// Usage ID `0x511`: "Contact Email Main"
6800    ContactEmailMain,
6801    /// Usage ID `0x512`: "Contact Speed Dial Number"
6802    ContactSpeedDialNumber,
6803    /// Usage ID `0x513`: "Contact Status Flag"
6804    ContactStatusFlag,
6805    /// Usage ID `0x514`: "Contact Misc."
6806    ContactMisc,
6807}
6808
6809impl Consumer {
6810    #[cfg(feature = "std")]
6811    pub fn name(&self) -> String {
6812        match self {
6813            Consumer::ConsumerControl => "Consumer Control",
6814            Consumer::NumericKeyPad => "Numeric Key Pad",
6815            Consumer::ProgrammableButtons => "Programmable Buttons",
6816            Consumer::Microphone => "Microphone",
6817            Consumer::Headphone => "Headphone",
6818            Consumer::GraphicEqualizer => "Graphic Equalizer",
6819            Consumer::Plus10 => "+10",
6820            Consumer::Plus100 => "+100",
6821            Consumer::AMPM => "AM/PM",
6822            Consumer::Power => "Power",
6823            Consumer::Reset => "Reset",
6824            Consumer::Sleep => "Sleep",
6825            Consumer::SleepAfter => "Sleep After",
6826            Consumer::SleepMode => "Sleep Mode",
6827            Consumer::Illumination => "Illumination",
6828            Consumer::FunctionButtons => "Function Buttons",
6829            Consumer::Menu => "Menu",
6830            Consumer::MenuPick => "Menu Pick",
6831            Consumer::MenuUp => "Menu Up",
6832            Consumer::MenuDown => "Menu Down",
6833            Consumer::MenuLeft => "Menu Left",
6834            Consumer::MenuRight => "Menu Right",
6835            Consumer::MenuEscape => "Menu Escape",
6836            Consumer::MenuValueIncrease => "Menu Value Increase",
6837            Consumer::MenuValueDecrease => "Menu Value Decrease",
6838            Consumer::DataOnScreen => "Data On Screen",
6839            Consumer::ClosedCaption => "Closed Caption",
6840            Consumer::ClosedCaptionSelect => "Closed Caption Select",
6841            Consumer::VCRTV => "VCR/TV",
6842            Consumer::BroadcastMode => "Broadcast Mode",
6843            Consumer::Snapshot => "Snapshot",
6844            Consumer::Still => "Still",
6845            Consumer::PictureinPictureToggle => "Picture-in-Picture Toggle",
6846            Consumer::PictureinPictureSwap => "Picture-in-Picture Swap",
6847            Consumer::RedMenuButton => "Red Menu Button",
6848            Consumer::GreenMenuButton => "Green Menu Button",
6849            Consumer::BlueMenuButton => "Blue Menu Button",
6850            Consumer::YellowMenuButton => "Yellow Menu Button",
6851            Consumer::Aspect => "Aspect",
6852            Consumer::ThreeDModeSelect => "3D Mode Select",
6853            Consumer::DisplayBrightnessIncrement => "Display Brightness Increment",
6854            Consumer::DisplayBrightnessDecrement => "Display Brightness Decrement",
6855            Consumer::DisplayBrightness => "Display Brightness",
6856            Consumer::DisplayBacklightToggle => "Display Backlight Toggle",
6857            Consumer::DisplaySetBrightnesstoMinimum => "Display Set Brightness to Minimum",
6858            Consumer::DisplaySetBrightnesstoMaximum => "Display Set Brightness to Maximum",
6859            Consumer::DisplaySetAutoBrightness => "Display Set Auto Brightness",
6860            Consumer::CameraAccessEnabled => "Camera Access Enabled",
6861            Consumer::CameraAccessDisabled => "Camera Access Disabled",
6862            Consumer::CameraAccessToggle => "Camera Access Toggle",
6863            Consumer::KeyboardBrightnessIncrement => "Keyboard Brightness Increment",
6864            Consumer::KeyboardBrightnessDecrement => "Keyboard Brightness Decrement",
6865            Consumer::KeyboardBacklightSetLevel => "Keyboard Backlight Set Level",
6866            Consumer::KeyboardBacklightOOC => "Keyboard Backlight OOC",
6867            Consumer::KeyboardBacklightSetMinimum => "Keyboard Backlight Set Minimum",
6868            Consumer::KeyboardBacklightSetMaximum => "Keyboard Backlight Set Maximum",
6869            Consumer::KeyboardBacklightAuto => "Keyboard Backlight Auto",
6870            Consumer::Selection => "Selection",
6871            Consumer::AssignSelection => "Assign Selection",
6872            Consumer::ModeStep => "Mode Step",
6873            Consumer::RecallLast => "Recall Last",
6874            Consumer::EnterChannel => "Enter Channel",
6875            Consumer::OrderMovie => "Order Movie",
6876            Consumer::Channel => "Channel",
6877            Consumer::MediaSelection => "Media Selection",
6878            Consumer::MediaSelectComputer => "Media Select Computer",
6879            Consumer::MediaSelectTV => "Media Select TV",
6880            Consumer::MediaSelectWWW => "Media Select WWW",
6881            Consumer::MediaSelectDVD => "Media Select DVD",
6882            Consumer::MediaSelectTelephone => "Media Select Telephone",
6883            Consumer::MediaSelectProgramGuide => "Media Select Program Guide",
6884            Consumer::MediaSelectVideoPhone => "Media Select Video Phone",
6885            Consumer::MediaSelectGames => "Media Select Games",
6886            Consumer::MediaSelectMessages => "Media Select Messages",
6887            Consumer::MediaSelectCD => "Media Select CD",
6888            Consumer::MediaSelectVCR => "Media Select VCR",
6889            Consumer::MediaSelectTuner => "Media Select Tuner",
6890            Consumer::Quit => "Quit",
6891            Consumer::Help => "Help",
6892            Consumer::MediaSelectTape => "Media Select Tape",
6893            Consumer::MediaSelectCable => "Media Select Cable",
6894            Consumer::MediaSelectSatellite => "Media Select Satellite",
6895            Consumer::MediaSelectSecurity => "Media Select Security",
6896            Consumer::MediaSelectHome => "Media Select Home",
6897            Consumer::MediaSelectCall => "Media Select Call",
6898            Consumer::ChannelIncrement => "Channel Increment",
6899            Consumer::ChannelDecrement => "Channel Decrement",
6900            Consumer::MediaSelectSAP => "Media Select SAP",
6901            Consumer::VCRPlus => "VCR Plus",
6902            Consumer::Once => "Once",
6903            Consumer::Daily => "Daily",
6904            Consumer::Weekly => "Weekly",
6905            Consumer::Monthly => "Monthly",
6906            Consumer::Play => "Play",
6907            Consumer::Pause => "Pause",
6908            Consumer::Record => "Record",
6909            Consumer::FastForward => "Fast Forward",
6910            Consumer::Rewind => "Rewind",
6911            Consumer::ScanNextTrack => "Scan Next Track",
6912            Consumer::ScanPreviousTrack => "Scan Previous Track",
6913            Consumer::Stop => "Stop",
6914            Consumer::Eject => "Eject",
6915            Consumer::RandomPlay => "Random Play",
6916            Consumer::SelectDisc => "Select Disc",
6917            Consumer::EnterDisc => "Enter Disc",
6918            Consumer::Repeat => "Repeat",
6919            Consumer::Tracking => "Tracking",
6920            Consumer::TrackNormal => "Track Normal",
6921            Consumer::SlowTracking => "Slow Tracking",
6922            Consumer::FrameForward => "Frame Forward",
6923            Consumer::FrameBack => "Frame Back",
6924            Consumer::Mark => "Mark",
6925            Consumer::ClearMark => "Clear Mark",
6926            Consumer::RepeatFromMark => "Repeat From Mark",
6927            Consumer::ReturnToMark => "Return To Mark",
6928            Consumer::SearchMarkForward => "Search Mark Forward",
6929            Consumer::SearchMarkBackwards => "Search Mark Backwards",
6930            Consumer::CounterReset => "Counter Reset",
6931            Consumer::ShowCounter => "Show Counter",
6932            Consumer::TrackingIncrement => "Tracking Increment",
6933            Consumer::TrackingDecrement => "Tracking Decrement",
6934            Consumer::StopEject => "Stop/Eject",
6935            Consumer::PlayPause => "Play/Pause",
6936            Consumer::PlaySkip => "Play/Skip",
6937            Consumer::VoiceCommand => "Voice Command",
6938            Consumer::InvokeCaptureInterface => "Invoke Capture Interface",
6939            Consumer::StartorStopGameRecording => "Start or Stop Game Recording",
6940            Consumer::HistoricalGameCapture => "Historical Game Capture",
6941            Consumer::CaptureGameScreenshot => "Capture Game Screenshot",
6942            Consumer::ShoworHideRecordingIndicator => "Show or Hide Recording Indicator",
6943            Consumer::StartorStopMicrophoneCapture => "Start or Stop Microphone Capture",
6944            Consumer::StartorStopCameraCapture => "Start or Stop Camera Capture",
6945            Consumer::StartorStopGameBroadcast => "Start or Stop Game Broadcast",
6946            Consumer::StartorStopVoiceDictationSession => "Start or Stop Voice Dictation Session",
6947            Consumer::InvokeDismissEmojiPicker => "Invoke/Dismiss Emoji Picker",
6948            Consumer::Volume => "Volume",
6949            Consumer::Balance => "Balance",
6950            Consumer::Mute => "Mute",
6951            Consumer::Bass => "Bass",
6952            Consumer::Treble => "Treble",
6953            Consumer::BassBoost => "Bass Boost",
6954            Consumer::SurroundMode => "Surround Mode",
6955            Consumer::Loudness => "Loudness",
6956            Consumer::MPX => "MPX",
6957            Consumer::VolumeIncrement => "Volume Increment",
6958            Consumer::VolumeDecrement => "Volume Decrement",
6959            Consumer::SpeedSelect => "Speed Select",
6960            Consumer::PlaybackSpeed => "Playback Speed",
6961            Consumer::StandardPlay => "Standard Play",
6962            Consumer::LongPlay => "Long Play",
6963            Consumer::ExtendedPlay => "Extended Play",
6964            Consumer::Slow => "Slow",
6965            Consumer::FanEnable => "Fan Enable",
6966            Consumer::FanSpeed => "Fan Speed",
6967            Consumer::LightEnable => "Light Enable",
6968            Consumer::LightIlluminationLevel => "Light Illumination Level",
6969            Consumer::ClimateControlEnable => "Climate Control Enable",
6970            Consumer::RoomTemperature => "Room Temperature",
6971            Consumer::SecurityEnable => "Security Enable",
6972            Consumer::FireAlarm => "Fire Alarm",
6973            Consumer::PoliceAlarm => "Police Alarm",
6974            Consumer::Proximity => "Proximity",
6975            Consumer::Motion => "Motion",
6976            Consumer::DuressAlarm => "Duress Alarm",
6977            Consumer::HoldupAlarm => "Holdup Alarm",
6978            Consumer::MedicalAlarm => "Medical Alarm",
6979            Consumer::BalanceRight => "Balance Right",
6980            Consumer::BalanceLeft => "Balance Left",
6981            Consumer::BassIncrement => "Bass Increment",
6982            Consumer::BassDecrement => "Bass Decrement",
6983            Consumer::TrebleIncrement => "Treble Increment",
6984            Consumer::TrebleDecrement => "Treble Decrement",
6985            Consumer::SpeakerSystem => "Speaker System",
6986            Consumer::ChannelLeft => "Channel Left",
6987            Consumer::ChannelRight => "Channel Right",
6988            Consumer::ChannelCenter => "Channel Center",
6989            Consumer::ChannelFront => "Channel Front",
6990            Consumer::ChannelCenterFront => "Channel Center Front",
6991            Consumer::ChannelSide => "Channel Side",
6992            Consumer::ChannelSurround => "Channel Surround",
6993            Consumer::ChannelLowFrequencyEnhancement => "Channel Low Frequency Enhancement",
6994            Consumer::ChannelTop => "Channel Top",
6995            Consumer::ChannelUnknown => "Channel Unknown",
6996            Consumer::Subchannel => "Sub-channel",
6997            Consumer::SubchannelIncrement => "Sub-channel Increment",
6998            Consumer::SubchannelDecrement => "Sub-channel Decrement",
6999            Consumer::AlternateAudioIncrement => "Alternate Audio Increment",
7000            Consumer::AlternateAudioDecrement => "Alternate Audio Decrement",
7001            Consumer::ApplicationLaunchButtons => "Application Launch Buttons",
7002            Consumer::ALLaunchButtonConfigurationTool => "AL Launch Button Configuration Tool",
7003            Consumer::ALProgrammableButtonConfiguration => "AL Programmable Button Configuration",
7004            Consumer::ALConsumerControlConfiguration => "AL Consumer Control Configuration",
7005            Consumer::ALWordProcessor => "AL Word Processor",
7006            Consumer::ALTextEditor => "AL Text Editor",
7007            Consumer::ALSpreadsheet => "AL Spreadsheet",
7008            Consumer::ALGraphicsEditor => "AL Graphics Editor",
7009            Consumer::ALPresentationApp => "AL Presentation App",
7010            Consumer::ALDatabaseApp => "AL Database App",
7011            Consumer::ALEmailReader => "AL Email Reader",
7012            Consumer::ALNewsreader => "AL Newsreader",
7013            Consumer::ALVoicemail => "AL Voicemail",
7014            Consumer::ALContactsAddressBook => "AL Contacts/Address Book",
7015            Consumer::ALCalendarSchedule => "AL Calendar/Schedule",
7016            Consumer::ALTaskProjectManager => "AL Task/Project Manager",
7017            Consumer::ALLogJournalTimecard => "AL Log/Journal/Timecard",
7018            Consumer::ALCheckbookFinance => "AL Checkbook/Finance",
7019            Consumer::ALCalculator => "AL Calculator",
7020            Consumer::ALAVCapturePlayback => "AL A/V Capture/Playback",
7021            Consumer::ALLocalMachineBrowser => "AL Local Machine Browser",
7022            Consumer::ALLANWANBrowser => "AL LAN/WAN Browser",
7023            Consumer::ALInternetBrowser => "AL Internet Browser",
7024            Consumer::ALRemoteNetworkingISPConnect => "AL Remote Networking/ISP Connect",
7025            Consumer::ALNetworkConference => "AL Network Conference",
7026            Consumer::ALNetworkChat => "AL Network Chat",
7027            Consumer::ALTelephonyDialer => "AL Telephony/Dialer",
7028            Consumer::ALLogon => "AL Logon",
7029            Consumer::ALLogoff => "AL Logoff",
7030            Consumer::ALLogonLogoff => "AL Logon/Logoff",
7031            Consumer::ALTerminalLockScreensaver => "AL Terminal Lock/Screensaver",
7032            Consumer::ALControlPanel => "AL Control Panel",
7033            Consumer::ALCommandLineProcessorRun => "AL Command Line Processor/Run",
7034            Consumer::ALProcessTaskManager => "AL Process/Task Manager",
7035            Consumer::ALSelectTaskApplication => "AL Select Task/Application",
7036            Consumer::ALNextTaskApplication => "AL Next Task/Application",
7037            Consumer::ALPreviousTaskApplication => "AL Previous Task/Application",
7038            Consumer::ALPreemptiveHaltTaskApplication => "AL Preemptive Halt Task/Application",
7039            Consumer::ALIntegratedHelpCenter => "AL Integrated Help Center",
7040            Consumer::ALDocuments => "AL Documents",
7041            Consumer::ALThesaurus => "AL Thesaurus",
7042            Consumer::ALDictionary => "AL Dictionary",
7043            Consumer::ALDesktop => "AL Desktop",
7044            Consumer::ALSpellCheck => "AL Spell Check",
7045            Consumer::ALGrammarCheck => "AL Grammar Check",
7046            Consumer::ALWirelessStatus => "AL Wireless Status",
7047            Consumer::ALKeyboardLayout => "AL Keyboard Layout",
7048            Consumer::ALVirusProtection => "AL Virus Protection",
7049            Consumer::ALEncryption => "AL Encryption",
7050            Consumer::ALScreenSaver => "AL Screen Saver",
7051            Consumer::ALAlarms => "AL Alarms",
7052            Consumer::ALClock => "AL Clock",
7053            Consumer::ALFileBrowser => "AL File Browser",
7054            Consumer::ALPowerStatus => "AL Power Status",
7055            Consumer::ALImageBrowser => "AL Image Browser",
7056            Consumer::ALAudioBrowser => "AL Audio Browser",
7057            Consumer::ALMovieBrowser => "AL Movie Browser",
7058            Consumer::ALDigitalRightsManager => "AL Digital Rights Manager",
7059            Consumer::ALDigitalWallet => "AL Digital Wallet",
7060            Consumer::ALInstantMessaging => "AL Instant Messaging",
7061            Consumer::ALOEMFeaturesTipsTutorialBrowser => "AL OEM Features/ Tips/Tutorial Browser",
7062            Consumer::ALOEMHelp => "AL OEM Help",
7063            Consumer::ALOnlineCommunity => "AL Online Community",
7064            Consumer::ALEntertainmentContentBrowser => "AL Entertainment Content Browser",
7065            Consumer::ALOnlineShoppingBrowser => "AL Online Shopping Browser",
7066            Consumer::ALSmartCardInformationHelp => "AL SmartCard Information/Help",
7067            Consumer::ALMarketMonitorFinanceBrowser => "AL Market Monitor/Finance Browser",
7068            Consumer::ALCustomizedCorporateNewsBrowser => "AL Customized Corporate News Browser",
7069            Consumer::ALOnlineActivityBrowser => "AL Online Activity Browser",
7070            Consumer::ALResearchSearchBrowser => "AL Research/Search Browser",
7071            Consumer::ALAudioPlayer => "AL Audio Player",
7072            Consumer::ALMessageStatus => "AL Message Status",
7073            Consumer::ALContactSync => "AL Contact Sync",
7074            Consumer::ALNavigation => "AL Navigation",
7075            Consumer::ALContextawareDesktopAssistant => "AL Context‐aware Desktop Assistant",
7076            Consumer::GenericGUIApplicationControls => "Generic GUI Application Controls",
7077            Consumer::ACNew => "AC New",
7078            Consumer::ACOpen => "AC Open",
7079            Consumer::ACClose => "AC Close",
7080            Consumer::ACExit => "AC Exit",
7081            Consumer::ACMaximize => "AC Maximize",
7082            Consumer::ACMinimize => "AC Minimize",
7083            Consumer::ACSave => "AC Save",
7084            Consumer::ACPrint => "AC Print",
7085            Consumer::ACProperties => "AC Properties",
7086            Consumer::ACUndo => "AC Undo",
7087            Consumer::ACCopy => "AC Copy",
7088            Consumer::ACCut => "AC Cut",
7089            Consumer::ACPaste => "AC Paste",
7090            Consumer::ACSelectAll => "AC Select All",
7091            Consumer::ACFind => "AC Find",
7092            Consumer::ACFindandReplace => "AC Find and Replace",
7093            Consumer::ACSearch => "AC Search",
7094            Consumer::ACGoTo => "AC Go To",
7095            Consumer::ACHome => "AC Home",
7096            Consumer::ACBack => "AC Back",
7097            Consumer::ACForward => "AC Forward",
7098            Consumer::ACStop => "AC Stop",
7099            Consumer::ACRefresh => "AC Refresh",
7100            Consumer::ACPreviousLink => "AC Previous Link",
7101            Consumer::ACNextLink => "AC Next Link",
7102            Consumer::ACBookmarks => "AC Bookmarks",
7103            Consumer::ACHistory => "AC History",
7104            Consumer::ACSubscriptions => "AC Subscriptions",
7105            Consumer::ACZoomIn => "AC Zoom In",
7106            Consumer::ACZoomOut => "AC Zoom Out",
7107            Consumer::ACZoom => "AC Zoom",
7108            Consumer::ACFullScreenView => "AC Full Screen View",
7109            Consumer::ACNormalView => "AC Normal View",
7110            Consumer::ACViewToggle => "AC View Toggle",
7111            Consumer::ACScrollUp => "AC Scroll Up",
7112            Consumer::ACScrollDown => "AC Scroll Down",
7113            Consumer::ACScroll => "AC Scroll",
7114            Consumer::ACPanLeft => "AC Pan Left",
7115            Consumer::ACPanRight => "AC Pan Right",
7116            Consumer::ACPan => "AC Pan",
7117            Consumer::ACNewWindow => "AC New Window",
7118            Consumer::ACTileHorizontally => "AC Tile Horizontally",
7119            Consumer::ACTileVertically => "AC Tile Vertically",
7120            Consumer::ACFormat => "AC Format",
7121            Consumer::ACEdit => "AC Edit",
7122            Consumer::ACBold => "AC Bold",
7123            Consumer::ACItalics => "AC Italics",
7124            Consumer::ACUnderline => "AC Underline",
7125            Consumer::ACStrikethrough => "AC Strikethrough",
7126            Consumer::ACSubscript => "AC Subscript",
7127            Consumer::ACSuperscript => "AC Superscript",
7128            Consumer::ACAllCaps => "AC All Caps",
7129            Consumer::ACRotate => "AC Rotate",
7130            Consumer::ACResize => "AC Resize",
7131            Consumer::ACFlipHorizontal => "AC Flip Horizontal",
7132            Consumer::ACFlipVertical => "AC Flip Vertical",
7133            Consumer::ACMirrorHorizontal => "AC Mirror Horizontal",
7134            Consumer::ACMirrorVertical => "AC Mirror Vertical",
7135            Consumer::ACFontSelect => "AC Font Select",
7136            Consumer::ACFontColor => "AC Font Color",
7137            Consumer::ACFontSize => "AC Font Size",
7138            Consumer::ACJustifyLeft => "AC Justify Left",
7139            Consumer::ACJustifyCenterH => "AC Justify Center H",
7140            Consumer::ACJustifyRight => "AC Justify Right",
7141            Consumer::ACJustifyBlockH => "AC Justify Block H",
7142            Consumer::ACJustifyTop => "AC Justify Top",
7143            Consumer::ACJustifyCenterV => "AC Justify Center V",
7144            Consumer::ACJustifyBottom => "AC Justify Bottom",
7145            Consumer::ACJustifyBlockV => "AC Justify Block V",
7146            Consumer::ACIndentDecrease => "AC Indent Decrease",
7147            Consumer::ACIndentIncrease => "AC Indent Increase",
7148            Consumer::ACNumberedList => "AC Numbered List",
7149            Consumer::ACRestartNumbering => "AC Restart Numbering",
7150            Consumer::ACBulletedList => "AC Bulleted List",
7151            Consumer::ACPromote => "AC Promote",
7152            Consumer::ACDemote => "AC Demote",
7153            Consumer::ACYes => "AC Yes",
7154            Consumer::ACNo => "AC No",
7155            Consumer::ACCancel => "AC Cancel",
7156            Consumer::ACCatalog => "AC Catalog",
7157            Consumer::ACBuyCheckout => "AC Buy/Checkout",
7158            Consumer::ACAddtoCart => "AC Add to Cart",
7159            Consumer::ACExpand => "AC Expand",
7160            Consumer::ACExpandAll => "AC Expand All",
7161            Consumer::ACCollapse => "AC Collapse",
7162            Consumer::ACCollapseAll => "AC Collapse All",
7163            Consumer::ACPrintPreview => "AC Print Preview",
7164            Consumer::ACPasteSpecial => "AC Paste Special",
7165            Consumer::ACInsertMode => "AC Insert Mode",
7166            Consumer::ACDelete => "AC Delete",
7167            Consumer::ACLock => "AC Lock",
7168            Consumer::ACUnlock => "AC Unlock",
7169            Consumer::ACProtect => "AC Protect",
7170            Consumer::ACUnprotect => "AC Unprotect",
7171            Consumer::ACAttachComment => "AC Attach Comment",
7172            Consumer::ACDeleteComment => "AC Delete Comment",
7173            Consumer::ACViewComment => "AC View Comment",
7174            Consumer::ACSelectWord => "AC Select Word",
7175            Consumer::ACSelectSentence => "AC Select Sentence",
7176            Consumer::ACSelectParagraph => "AC Select Paragraph",
7177            Consumer::ACSelectColumn => "AC Select Column",
7178            Consumer::ACSelectRow => "AC Select Row",
7179            Consumer::ACSelectTable => "AC Select Table",
7180            Consumer::ACSelectObject => "AC Select Object",
7181            Consumer::ACRedoRepeat => "AC Redo/Repeat",
7182            Consumer::ACSort => "AC Sort",
7183            Consumer::ACSortAscending => "AC Sort Ascending",
7184            Consumer::ACSortDescending => "AC Sort Descending",
7185            Consumer::ACFilter => "AC Filter",
7186            Consumer::ACSetClock => "AC Set Clock",
7187            Consumer::ACViewClock => "AC View Clock",
7188            Consumer::ACSelectTimeZone => "AC Select Time Zone",
7189            Consumer::ACEditTimeZones => "AC Edit Time Zones",
7190            Consumer::ACSetAlarm => "AC Set Alarm",
7191            Consumer::ACClearAlarm => "AC Clear Alarm",
7192            Consumer::ACSnoozeAlarm => "AC Snooze Alarm",
7193            Consumer::ACResetAlarm => "AC Reset Alarm",
7194            Consumer::ACSynchronize => "AC Synchronize",
7195            Consumer::ACSendReceive => "AC Send/Receive",
7196            Consumer::ACSendTo => "AC Send To",
7197            Consumer::ACReply => "AC Reply",
7198            Consumer::ACReplyAll => "AC Reply All",
7199            Consumer::ACForwardMsg => "AC Forward Msg",
7200            Consumer::ACSend => "AC Send",
7201            Consumer::ACAttachFile => "AC Attach File",
7202            Consumer::ACUpload => "AC Upload",
7203            Consumer::ACDownloadSaveTargetAs => "AC Download (Save Target As)",
7204            Consumer::ACSetBorders => "AC Set Borders",
7205            Consumer::ACInsertRow => "AC Insert Row",
7206            Consumer::ACInsertColumn => "AC Insert Column",
7207            Consumer::ACInsertFile => "AC Insert File",
7208            Consumer::ACInsertPicture => "AC Insert Picture",
7209            Consumer::ACInsertObject => "AC Insert Object",
7210            Consumer::ACInsertSymbol => "AC Insert Symbol",
7211            Consumer::ACSaveandClose => "AC Save and Close",
7212            Consumer::ACRename => "AC Rename",
7213            Consumer::ACMerge => "AC Merge",
7214            Consumer::ACSplit => "AC Split",
7215            Consumer::ACDisributeHorizontally => "AC Disribute Horizontally",
7216            Consumer::ACDistributeVertically => "AC Distribute Vertically",
7217            Consumer::ACNextKeyboardLayoutSelect => "AC Next Keyboard Layout Select",
7218            Consumer::ACNavigationGuidance => "AC Navigation Guidance",
7219            Consumer::ACDesktopShowAllWindows => "AC Desktop Show All Windows",
7220            Consumer::ACSoftKeyLeft => "AC Soft Key Left",
7221            Consumer::ACSoftKeyRight => "AC Soft Key Right",
7222            Consumer::ACDesktopShowAllApplications => "AC Desktop Show All Applications",
7223            Consumer::ACIdleKeepAlive => "AC Idle Keep Alive",
7224            Consumer::ExtendedKeyboardAttributesCollection => {
7225                "Extended Keyboard Attributes Collection"
7226            }
7227            Consumer::KeyboardFormFactor => "Keyboard Form Factor",
7228            Consumer::KeyboardKeyType => "Keyboard Key Type",
7229            Consumer::KeyboardPhysicalLayout => "Keyboard Physical Layout",
7230            Consumer::VendorSpecificKeyboardPhysicalLayout => {
7231                "Vendor‐Specific Keyboard Physical Layout"
7232            }
7233            Consumer::KeyboardIETFLanguageTagIndex => "Keyboard IETF Language Tag Index",
7234            Consumer::ImplementedKeyboardInputAssistControls => {
7235                "Implemented Keyboard Input Assist Controls"
7236            }
7237            Consumer::KeyboardInputAssistPrevious => "Keyboard Input Assist Previous",
7238            Consumer::KeyboardInputAssistNext => "Keyboard Input Assist Next",
7239            Consumer::KeyboardInputAssistPreviousGroup => "Keyboard Input Assist Previous Group",
7240            Consumer::KeyboardInputAssistNextGroup => "Keyboard Input Assist Next Group",
7241            Consumer::KeyboardInputAssistAccept => "Keyboard Input Assist Accept",
7242            Consumer::KeyboardInputAssistCancel => "Keyboard Input Assist Cancel",
7243            Consumer::PrivacyScreenToggle => "Privacy Screen Toggle",
7244            Consumer::PrivacyScreenLevelDecrement => "Privacy Screen Level Decrement",
7245            Consumer::PrivacyScreenLevelIncrement => "Privacy Screen Level Increment",
7246            Consumer::PrivacyScreenLevelMinimum => "Privacy Screen Level Minimum",
7247            Consumer::PrivacyScreenLevelMaximum => "Privacy Screen Level Maximum",
7248            Consumer::ContactEdited => "Contact Edited",
7249            Consumer::ContactAdded => "Contact Added",
7250            Consumer::ContactRecordActive => "Contact Record Active",
7251            Consumer::ContactIndex => "Contact Index",
7252            Consumer::ContactNickname => "Contact Nickname",
7253            Consumer::ContactFirstName => "Contact First Name",
7254            Consumer::ContactLastName => "Contact Last Name",
7255            Consumer::ContactFullName => "Contact Full Name",
7256            Consumer::ContactPhoneNumberPersonal => "Contact Phone Number Personal",
7257            Consumer::ContactPhoneNumberBusiness => "Contact Phone Number Business",
7258            Consumer::ContactPhoneNumberMobile => "Contact Phone Number Mobile",
7259            Consumer::ContactPhoneNumberPager => "Contact Phone Number Pager",
7260            Consumer::ContactPhoneNumberFax => "Contact Phone Number Fax",
7261            Consumer::ContactPhoneNumberOther => "Contact Phone Number Other",
7262            Consumer::ContactEmailPersonal => "Contact Email Personal",
7263            Consumer::ContactEmailBusiness => "Contact Email Business",
7264            Consumer::ContactEmailOther => "Contact Email Other",
7265            Consumer::ContactEmailMain => "Contact Email Main",
7266            Consumer::ContactSpeedDialNumber => "Contact Speed Dial Number",
7267            Consumer::ContactStatusFlag => "Contact Status Flag",
7268            Consumer::ContactMisc => "Contact Misc.",
7269        }
7270        .into()
7271    }
7272}
7273
7274#[cfg(feature = "std")]
7275impl fmt::Display for Consumer {
7276    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
7277        write!(f, "{}", self.name())
7278    }
7279}
7280
7281impl AsUsage for Consumer {
7282    /// Returns the 32 bit Usage value of this Usage
7283    fn usage_value(&self) -> u32 {
7284        u32::from(self)
7285    }
7286
7287    /// Returns the 16 bit Usage ID value of this Usage
7288    fn usage_id_value(&self) -> u16 {
7289        u16::from(self)
7290    }
7291
7292    /// Returns this usage as [Usage::Consumer(self)](Usage::Consumer)
7293    /// This is a convenience function to avoid having
7294    /// to implement `From` for every used type in the caller.
7295    ///
7296    /// ```
7297    /// # use hut::*;
7298    /// let gd_x = GenericDesktop::X;
7299    /// let usage = Usage::from(GenericDesktop::X);
7300    /// assert!(matches!(gd_x.usage(), usage));
7301    /// ```
7302    fn usage(&self) -> Usage {
7303        Usage::from(self)
7304    }
7305}
7306
7307impl AsUsagePage for Consumer {
7308    /// Returns the 16 bit value of this UsagePage
7309    ///
7310    /// This value is `0xC` for [Consumer]
7311    fn usage_page_value(&self) -> u16 {
7312        let up = UsagePage::from(self);
7313        u16::from(up)
7314    }
7315
7316    /// Returns [UsagePage::Consumer]]
7317    fn usage_page(&self) -> UsagePage {
7318        UsagePage::from(self)
7319    }
7320}
7321
7322impl From<&Consumer> for u16 {
7323    fn from(consumer: &Consumer) -> u16 {
7324        match *consumer {
7325            Consumer::ConsumerControl => 1,
7326            Consumer::NumericKeyPad => 2,
7327            Consumer::ProgrammableButtons => 3,
7328            Consumer::Microphone => 4,
7329            Consumer::Headphone => 5,
7330            Consumer::GraphicEqualizer => 6,
7331            Consumer::Plus10 => 32,
7332            Consumer::Plus100 => 33,
7333            Consumer::AMPM => 34,
7334            Consumer::Power => 48,
7335            Consumer::Reset => 49,
7336            Consumer::Sleep => 50,
7337            Consumer::SleepAfter => 51,
7338            Consumer::SleepMode => 52,
7339            Consumer::Illumination => 53,
7340            Consumer::FunctionButtons => 54,
7341            Consumer::Menu => 64,
7342            Consumer::MenuPick => 65,
7343            Consumer::MenuUp => 66,
7344            Consumer::MenuDown => 67,
7345            Consumer::MenuLeft => 68,
7346            Consumer::MenuRight => 69,
7347            Consumer::MenuEscape => 70,
7348            Consumer::MenuValueIncrease => 71,
7349            Consumer::MenuValueDecrease => 72,
7350            Consumer::DataOnScreen => 96,
7351            Consumer::ClosedCaption => 97,
7352            Consumer::ClosedCaptionSelect => 98,
7353            Consumer::VCRTV => 99,
7354            Consumer::BroadcastMode => 100,
7355            Consumer::Snapshot => 101,
7356            Consumer::Still => 102,
7357            Consumer::PictureinPictureToggle => 103,
7358            Consumer::PictureinPictureSwap => 104,
7359            Consumer::RedMenuButton => 105,
7360            Consumer::GreenMenuButton => 106,
7361            Consumer::BlueMenuButton => 107,
7362            Consumer::YellowMenuButton => 108,
7363            Consumer::Aspect => 109,
7364            Consumer::ThreeDModeSelect => 110,
7365            Consumer::DisplayBrightnessIncrement => 111,
7366            Consumer::DisplayBrightnessDecrement => 112,
7367            Consumer::DisplayBrightness => 113,
7368            Consumer::DisplayBacklightToggle => 114,
7369            Consumer::DisplaySetBrightnesstoMinimum => 115,
7370            Consumer::DisplaySetBrightnesstoMaximum => 116,
7371            Consumer::DisplaySetAutoBrightness => 117,
7372            Consumer::CameraAccessEnabled => 118,
7373            Consumer::CameraAccessDisabled => 119,
7374            Consumer::CameraAccessToggle => 120,
7375            Consumer::KeyboardBrightnessIncrement => 121,
7376            Consumer::KeyboardBrightnessDecrement => 122,
7377            Consumer::KeyboardBacklightSetLevel => 123,
7378            Consumer::KeyboardBacklightOOC => 124,
7379            Consumer::KeyboardBacklightSetMinimum => 125,
7380            Consumer::KeyboardBacklightSetMaximum => 126,
7381            Consumer::KeyboardBacklightAuto => 127,
7382            Consumer::Selection => 128,
7383            Consumer::AssignSelection => 129,
7384            Consumer::ModeStep => 130,
7385            Consumer::RecallLast => 131,
7386            Consumer::EnterChannel => 132,
7387            Consumer::OrderMovie => 133,
7388            Consumer::Channel => 134,
7389            Consumer::MediaSelection => 135,
7390            Consumer::MediaSelectComputer => 136,
7391            Consumer::MediaSelectTV => 137,
7392            Consumer::MediaSelectWWW => 138,
7393            Consumer::MediaSelectDVD => 139,
7394            Consumer::MediaSelectTelephone => 140,
7395            Consumer::MediaSelectProgramGuide => 141,
7396            Consumer::MediaSelectVideoPhone => 142,
7397            Consumer::MediaSelectGames => 143,
7398            Consumer::MediaSelectMessages => 144,
7399            Consumer::MediaSelectCD => 145,
7400            Consumer::MediaSelectVCR => 146,
7401            Consumer::MediaSelectTuner => 147,
7402            Consumer::Quit => 148,
7403            Consumer::Help => 149,
7404            Consumer::MediaSelectTape => 150,
7405            Consumer::MediaSelectCable => 151,
7406            Consumer::MediaSelectSatellite => 152,
7407            Consumer::MediaSelectSecurity => 153,
7408            Consumer::MediaSelectHome => 154,
7409            Consumer::MediaSelectCall => 155,
7410            Consumer::ChannelIncrement => 156,
7411            Consumer::ChannelDecrement => 157,
7412            Consumer::MediaSelectSAP => 158,
7413            Consumer::VCRPlus => 160,
7414            Consumer::Once => 161,
7415            Consumer::Daily => 162,
7416            Consumer::Weekly => 163,
7417            Consumer::Monthly => 164,
7418            Consumer::Play => 176,
7419            Consumer::Pause => 177,
7420            Consumer::Record => 178,
7421            Consumer::FastForward => 179,
7422            Consumer::Rewind => 180,
7423            Consumer::ScanNextTrack => 181,
7424            Consumer::ScanPreviousTrack => 182,
7425            Consumer::Stop => 183,
7426            Consumer::Eject => 184,
7427            Consumer::RandomPlay => 185,
7428            Consumer::SelectDisc => 186,
7429            Consumer::EnterDisc => 187,
7430            Consumer::Repeat => 188,
7431            Consumer::Tracking => 189,
7432            Consumer::TrackNormal => 190,
7433            Consumer::SlowTracking => 191,
7434            Consumer::FrameForward => 192,
7435            Consumer::FrameBack => 193,
7436            Consumer::Mark => 194,
7437            Consumer::ClearMark => 195,
7438            Consumer::RepeatFromMark => 196,
7439            Consumer::ReturnToMark => 197,
7440            Consumer::SearchMarkForward => 198,
7441            Consumer::SearchMarkBackwards => 199,
7442            Consumer::CounterReset => 200,
7443            Consumer::ShowCounter => 201,
7444            Consumer::TrackingIncrement => 202,
7445            Consumer::TrackingDecrement => 203,
7446            Consumer::StopEject => 204,
7447            Consumer::PlayPause => 205,
7448            Consumer::PlaySkip => 206,
7449            Consumer::VoiceCommand => 207,
7450            Consumer::InvokeCaptureInterface => 208,
7451            Consumer::StartorStopGameRecording => 209,
7452            Consumer::HistoricalGameCapture => 210,
7453            Consumer::CaptureGameScreenshot => 211,
7454            Consumer::ShoworHideRecordingIndicator => 212,
7455            Consumer::StartorStopMicrophoneCapture => 213,
7456            Consumer::StartorStopCameraCapture => 214,
7457            Consumer::StartorStopGameBroadcast => 215,
7458            Consumer::StartorStopVoiceDictationSession => 216,
7459            Consumer::InvokeDismissEmojiPicker => 217,
7460            Consumer::Volume => 224,
7461            Consumer::Balance => 225,
7462            Consumer::Mute => 226,
7463            Consumer::Bass => 227,
7464            Consumer::Treble => 228,
7465            Consumer::BassBoost => 229,
7466            Consumer::SurroundMode => 230,
7467            Consumer::Loudness => 231,
7468            Consumer::MPX => 232,
7469            Consumer::VolumeIncrement => 233,
7470            Consumer::VolumeDecrement => 234,
7471            Consumer::SpeedSelect => 240,
7472            Consumer::PlaybackSpeed => 241,
7473            Consumer::StandardPlay => 242,
7474            Consumer::LongPlay => 243,
7475            Consumer::ExtendedPlay => 244,
7476            Consumer::Slow => 245,
7477            Consumer::FanEnable => 256,
7478            Consumer::FanSpeed => 257,
7479            Consumer::LightEnable => 258,
7480            Consumer::LightIlluminationLevel => 259,
7481            Consumer::ClimateControlEnable => 260,
7482            Consumer::RoomTemperature => 261,
7483            Consumer::SecurityEnable => 262,
7484            Consumer::FireAlarm => 263,
7485            Consumer::PoliceAlarm => 264,
7486            Consumer::Proximity => 265,
7487            Consumer::Motion => 266,
7488            Consumer::DuressAlarm => 267,
7489            Consumer::HoldupAlarm => 268,
7490            Consumer::MedicalAlarm => 269,
7491            Consumer::BalanceRight => 336,
7492            Consumer::BalanceLeft => 337,
7493            Consumer::BassIncrement => 338,
7494            Consumer::BassDecrement => 339,
7495            Consumer::TrebleIncrement => 340,
7496            Consumer::TrebleDecrement => 341,
7497            Consumer::SpeakerSystem => 352,
7498            Consumer::ChannelLeft => 353,
7499            Consumer::ChannelRight => 354,
7500            Consumer::ChannelCenter => 355,
7501            Consumer::ChannelFront => 356,
7502            Consumer::ChannelCenterFront => 357,
7503            Consumer::ChannelSide => 358,
7504            Consumer::ChannelSurround => 359,
7505            Consumer::ChannelLowFrequencyEnhancement => 360,
7506            Consumer::ChannelTop => 361,
7507            Consumer::ChannelUnknown => 362,
7508            Consumer::Subchannel => 368,
7509            Consumer::SubchannelIncrement => 369,
7510            Consumer::SubchannelDecrement => 370,
7511            Consumer::AlternateAudioIncrement => 371,
7512            Consumer::AlternateAudioDecrement => 372,
7513            Consumer::ApplicationLaunchButtons => 384,
7514            Consumer::ALLaunchButtonConfigurationTool => 385,
7515            Consumer::ALProgrammableButtonConfiguration => 386,
7516            Consumer::ALConsumerControlConfiguration => 387,
7517            Consumer::ALWordProcessor => 388,
7518            Consumer::ALTextEditor => 389,
7519            Consumer::ALSpreadsheet => 390,
7520            Consumer::ALGraphicsEditor => 391,
7521            Consumer::ALPresentationApp => 392,
7522            Consumer::ALDatabaseApp => 393,
7523            Consumer::ALEmailReader => 394,
7524            Consumer::ALNewsreader => 395,
7525            Consumer::ALVoicemail => 396,
7526            Consumer::ALContactsAddressBook => 397,
7527            Consumer::ALCalendarSchedule => 398,
7528            Consumer::ALTaskProjectManager => 399,
7529            Consumer::ALLogJournalTimecard => 400,
7530            Consumer::ALCheckbookFinance => 401,
7531            Consumer::ALCalculator => 402,
7532            Consumer::ALAVCapturePlayback => 403,
7533            Consumer::ALLocalMachineBrowser => 404,
7534            Consumer::ALLANWANBrowser => 405,
7535            Consumer::ALInternetBrowser => 406,
7536            Consumer::ALRemoteNetworkingISPConnect => 407,
7537            Consumer::ALNetworkConference => 408,
7538            Consumer::ALNetworkChat => 409,
7539            Consumer::ALTelephonyDialer => 410,
7540            Consumer::ALLogon => 411,
7541            Consumer::ALLogoff => 412,
7542            Consumer::ALLogonLogoff => 413,
7543            Consumer::ALTerminalLockScreensaver => 414,
7544            Consumer::ALControlPanel => 415,
7545            Consumer::ALCommandLineProcessorRun => 416,
7546            Consumer::ALProcessTaskManager => 417,
7547            Consumer::ALSelectTaskApplication => 418,
7548            Consumer::ALNextTaskApplication => 419,
7549            Consumer::ALPreviousTaskApplication => 420,
7550            Consumer::ALPreemptiveHaltTaskApplication => 421,
7551            Consumer::ALIntegratedHelpCenter => 422,
7552            Consumer::ALDocuments => 423,
7553            Consumer::ALThesaurus => 424,
7554            Consumer::ALDictionary => 425,
7555            Consumer::ALDesktop => 426,
7556            Consumer::ALSpellCheck => 427,
7557            Consumer::ALGrammarCheck => 428,
7558            Consumer::ALWirelessStatus => 429,
7559            Consumer::ALKeyboardLayout => 430,
7560            Consumer::ALVirusProtection => 431,
7561            Consumer::ALEncryption => 432,
7562            Consumer::ALScreenSaver => 433,
7563            Consumer::ALAlarms => 434,
7564            Consumer::ALClock => 435,
7565            Consumer::ALFileBrowser => 436,
7566            Consumer::ALPowerStatus => 437,
7567            Consumer::ALImageBrowser => 438,
7568            Consumer::ALAudioBrowser => 439,
7569            Consumer::ALMovieBrowser => 440,
7570            Consumer::ALDigitalRightsManager => 441,
7571            Consumer::ALDigitalWallet => 442,
7572            Consumer::ALInstantMessaging => 444,
7573            Consumer::ALOEMFeaturesTipsTutorialBrowser => 445,
7574            Consumer::ALOEMHelp => 446,
7575            Consumer::ALOnlineCommunity => 447,
7576            Consumer::ALEntertainmentContentBrowser => 448,
7577            Consumer::ALOnlineShoppingBrowser => 449,
7578            Consumer::ALSmartCardInformationHelp => 450,
7579            Consumer::ALMarketMonitorFinanceBrowser => 451,
7580            Consumer::ALCustomizedCorporateNewsBrowser => 452,
7581            Consumer::ALOnlineActivityBrowser => 453,
7582            Consumer::ALResearchSearchBrowser => 454,
7583            Consumer::ALAudioPlayer => 455,
7584            Consumer::ALMessageStatus => 456,
7585            Consumer::ALContactSync => 457,
7586            Consumer::ALNavigation => 458,
7587            Consumer::ALContextawareDesktopAssistant => 459,
7588            Consumer::GenericGUIApplicationControls => 512,
7589            Consumer::ACNew => 513,
7590            Consumer::ACOpen => 514,
7591            Consumer::ACClose => 515,
7592            Consumer::ACExit => 516,
7593            Consumer::ACMaximize => 517,
7594            Consumer::ACMinimize => 518,
7595            Consumer::ACSave => 519,
7596            Consumer::ACPrint => 520,
7597            Consumer::ACProperties => 521,
7598            Consumer::ACUndo => 538,
7599            Consumer::ACCopy => 539,
7600            Consumer::ACCut => 540,
7601            Consumer::ACPaste => 541,
7602            Consumer::ACSelectAll => 542,
7603            Consumer::ACFind => 543,
7604            Consumer::ACFindandReplace => 544,
7605            Consumer::ACSearch => 545,
7606            Consumer::ACGoTo => 546,
7607            Consumer::ACHome => 547,
7608            Consumer::ACBack => 548,
7609            Consumer::ACForward => 549,
7610            Consumer::ACStop => 550,
7611            Consumer::ACRefresh => 551,
7612            Consumer::ACPreviousLink => 552,
7613            Consumer::ACNextLink => 553,
7614            Consumer::ACBookmarks => 554,
7615            Consumer::ACHistory => 555,
7616            Consumer::ACSubscriptions => 556,
7617            Consumer::ACZoomIn => 557,
7618            Consumer::ACZoomOut => 558,
7619            Consumer::ACZoom => 559,
7620            Consumer::ACFullScreenView => 560,
7621            Consumer::ACNormalView => 561,
7622            Consumer::ACViewToggle => 562,
7623            Consumer::ACScrollUp => 563,
7624            Consumer::ACScrollDown => 564,
7625            Consumer::ACScroll => 565,
7626            Consumer::ACPanLeft => 566,
7627            Consumer::ACPanRight => 567,
7628            Consumer::ACPan => 568,
7629            Consumer::ACNewWindow => 569,
7630            Consumer::ACTileHorizontally => 570,
7631            Consumer::ACTileVertically => 571,
7632            Consumer::ACFormat => 572,
7633            Consumer::ACEdit => 573,
7634            Consumer::ACBold => 574,
7635            Consumer::ACItalics => 575,
7636            Consumer::ACUnderline => 576,
7637            Consumer::ACStrikethrough => 577,
7638            Consumer::ACSubscript => 578,
7639            Consumer::ACSuperscript => 579,
7640            Consumer::ACAllCaps => 580,
7641            Consumer::ACRotate => 581,
7642            Consumer::ACResize => 582,
7643            Consumer::ACFlipHorizontal => 583,
7644            Consumer::ACFlipVertical => 584,
7645            Consumer::ACMirrorHorizontal => 585,
7646            Consumer::ACMirrorVertical => 586,
7647            Consumer::ACFontSelect => 587,
7648            Consumer::ACFontColor => 588,
7649            Consumer::ACFontSize => 589,
7650            Consumer::ACJustifyLeft => 590,
7651            Consumer::ACJustifyCenterH => 591,
7652            Consumer::ACJustifyRight => 592,
7653            Consumer::ACJustifyBlockH => 593,
7654            Consumer::ACJustifyTop => 594,
7655            Consumer::ACJustifyCenterV => 595,
7656            Consumer::ACJustifyBottom => 596,
7657            Consumer::ACJustifyBlockV => 597,
7658            Consumer::ACIndentDecrease => 598,
7659            Consumer::ACIndentIncrease => 599,
7660            Consumer::ACNumberedList => 600,
7661            Consumer::ACRestartNumbering => 601,
7662            Consumer::ACBulletedList => 602,
7663            Consumer::ACPromote => 603,
7664            Consumer::ACDemote => 604,
7665            Consumer::ACYes => 605,
7666            Consumer::ACNo => 606,
7667            Consumer::ACCancel => 607,
7668            Consumer::ACCatalog => 608,
7669            Consumer::ACBuyCheckout => 609,
7670            Consumer::ACAddtoCart => 610,
7671            Consumer::ACExpand => 611,
7672            Consumer::ACExpandAll => 612,
7673            Consumer::ACCollapse => 613,
7674            Consumer::ACCollapseAll => 614,
7675            Consumer::ACPrintPreview => 615,
7676            Consumer::ACPasteSpecial => 616,
7677            Consumer::ACInsertMode => 617,
7678            Consumer::ACDelete => 618,
7679            Consumer::ACLock => 619,
7680            Consumer::ACUnlock => 620,
7681            Consumer::ACProtect => 621,
7682            Consumer::ACUnprotect => 622,
7683            Consumer::ACAttachComment => 623,
7684            Consumer::ACDeleteComment => 624,
7685            Consumer::ACViewComment => 625,
7686            Consumer::ACSelectWord => 626,
7687            Consumer::ACSelectSentence => 627,
7688            Consumer::ACSelectParagraph => 628,
7689            Consumer::ACSelectColumn => 629,
7690            Consumer::ACSelectRow => 630,
7691            Consumer::ACSelectTable => 631,
7692            Consumer::ACSelectObject => 632,
7693            Consumer::ACRedoRepeat => 633,
7694            Consumer::ACSort => 634,
7695            Consumer::ACSortAscending => 635,
7696            Consumer::ACSortDescending => 636,
7697            Consumer::ACFilter => 637,
7698            Consumer::ACSetClock => 638,
7699            Consumer::ACViewClock => 639,
7700            Consumer::ACSelectTimeZone => 640,
7701            Consumer::ACEditTimeZones => 641,
7702            Consumer::ACSetAlarm => 642,
7703            Consumer::ACClearAlarm => 643,
7704            Consumer::ACSnoozeAlarm => 644,
7705            Consumer::ACResetAlarm => 645,
7706            Consumer::ACSynchronize => 646,
7707            Consumer::ACSendReceive => 647,
7708            Consumer::ACSendTo => 648,
7709            Consumer::ACReply => 649,
7710            Consumer::ACReplyAll => 650,
7711            Consumer::ACForwardMsg => 651,
7712            Consumer::ACSend => 652,
7713            Consumer::ACAttachFile => 653,
7714            Consumer::ACUpload => 654,
7715            Consumer::ACDownloadSaveTargetAs => 655,
7716            Consumer::ACSetBorders => 656,
7717            Consumer::ACInsertRow => 657,
7718            Consumer::ACInsertColumn => 658,
7719            Consumer::ACInsertFile => 659,
7720            Consumer::ACInsertPicture => 660,
7721            Consumer::ACInsertObject => 661,
7722            Consumer::ACInsertSymbol => 662,
7723            Consumer::ACSaveandClose => 663,
7724            Consumer::ACRename => 664,
7725            Consumer::ACMerge => 665,
7726            Consumer::ACSplit => 666,
7727            Consumer::ACDisributeHorizontally => 667,
7728            Consumer::ACDistributeVertically => 668,
7729            Consumer::ACNextKeyboardLayoutSelect => 669,
7730            Consumer::ACNavigationGuidance => 670,
7731            Consumer::ACDesktopShowAllWindows => 671,
7732            Consumer::ACSoftKeyLeft => 672,
7733            Consumer::ACSoftKeyRight => 673,
7734            Consumer::ACDesktopShowAllApplications => 674,
7735            Consumer::ACIdleKeepAlive => 688,
7736            Consumer::ExtendedKeyboardAttributesCollection => 704,
7737            Consumer::KeyboardFormFactor => 705,
7738            Consumer::KeyboardKeyType => 706,
7739            Consumer::KeyboardPhysicalLayout => 707,
7740            Consumer::VendorSpecificKeyboardPhysicalLayout => 708,
7741            Consumer::KeyboardIETFLanguageTagIndex => 709,
7742            Consumer::ImplementedKeyboardInputAssistControls => 710,
7743            Consumer::KeyboardInputAssistPrevious => 711,
7744            Consumer::KeyboardInputAssistNext => 712,
7745            Consumer::KeyboardInputAssistPreviousGroup => 713,
7746            Consumer::KeyboardInputAssistNextGroup => 714,
7747            Consumer::KeyboardInputAssistAccept => 715,
7748            Consumer::KeyboardInputAssistCancel => 716,
7749            Consumer::PrivacyScreenToggle => 720,
7750            Consumer::PrivacyScreenLevelDecrement => 721,
7751            Consumer::PrivacyScreenLevelIncrement => 722,
7752            Consumer::PrivacyScreenLevelMinimum => 723,
7753            Consumer::PrivacyScreenLevelMaximum => 724,
7754            Consumer::ContactEdited => 1280,
7755            Consumer::ContactAdded => 1281,
7756            Consumer::ContactRecordActive => 1282,
7757            Consumer::ContactIndex => 1283,
7758            Consumer::ContactNickname => 1284,
7759            Consumer::ContactFirstName => 1285,
7760            Consumer::ContactLastName => 1286,
7761            Consumer::ContactFullName => 1287,
7762            Consumer::ContactPhoneNumberPersonal => 1288,
7763            Consumer::ContactPhoneNumberBusiness => 1289,
7764            Consumer::ContactPhoneNumberMobile => 1290,
7765            Consumer::ContactPhoneNumberPager => 1291,
7766            Consumer::ContactPhoneNumberFax => 1292,
7767            Consumer::ContactPhoneNumberOther => 1293,
7768            Consumer::ContactEmailPersonal => 1294,
7769            Consumer::ContactEmailBusiness => 1295,
7770            Consumer::ContactEmailOther => 1296,
7771            Consumer::ContactEmailMain => 1297,
7772            Consumer::ContactSpeedDialNumber => 1298,
7773            Consumer::ContactStatusFlag => 1299,
7774            Consumer::ContactMisc => 1300,
7775        }
7776    }
7777}
7778
7779impl From<Consumer> for u16 {
7780    /// Returns the 16bit value of this usage. This is identical
7781    /// to [Consumer::usage_page_value()].
7782    fn from(consumer: Consumer) -> u16 {
7783        u16::from(&consumer)
7784    }
7785}
7786
7787impl From<&Consumer> for u32 {
7788    /// Returns the 32 bit value of this usage. This is identical
7789    /// to [Consumer::usage_value()].
7790    fn from(consumer: &Consumer) -> u32 {
7791        let up = UsagePage::from(consumer);
7792        let up = (u16::from(&up) as u32) << 16;
7793        let id = u16::from(consumer) as u32;
7794        up | id
7795    }
7796}
7797
7798impl From<&Consumer> for UsagePage {
7799    /// Always returns [UsagePage::Consumer] and is
7800    /// identical to [Consumer::usage_page()].
7801    fn from(_: &Consumer) -> UsagePage {
7802        UsagePage::Consumer
7803    }
7804}
7805
7806impl From<Consumer> for UsagePage {
7807    /// Always returns [UsagePage::Consumer] and is
7808    /// identical to [Consumer::usage_page()].
7809    fn from(_: Consumer) -> UsagePage {
7810        UsagePage::Consumer
7811    }
7812}
7813
7814impl From<&Consumer> for Usage {
7815    fn from(consumer: &Consumer) -> Usage {
7816        Usage::try_from(u32::from(consumer)).unwrap()
7817    }
7818}
7819
7820impl From<Consumer> for Usage {
7821    fn from(consumer: Consumer) -> Usage {
7822        Usage::from(&consumer)
7823    }
7824}
7825
7826impl TryFrom<u16> for Consumer {
7827    type Error = HutError;
7828
7829    fn try_from(usage_id: u16) -> Result<Consumer> {
7830        match usage_id {
7831            1 => Ok(Consumer::ConsumerControl),
7832            2 => Ok(Consumer::NumericKeyPad),
7833            3 => Ok(Consumer::ProgrammableButtons),
7834            4 => Ok(Consumer::Microphone),
7835            5 => Ok(Consumer::Headphone),
7836            6 => Ok(Consumer::GraphicEqualizer),
7837            32 => Ok(Consumer::Plus10),
7838            33 => Ok(Consumer::Plus100),
7839            34 => Ok(Consumer::AMPM),
7840            48 => Ok(Consumer::Power),
7841            49 => Ok(Consumer::Reset),
7842            50 => Ok(Consumer::Sleep),
7843            51 => Ok(Consumer::SleepAfter),
7844            52 => Ok(Consumer::SleepMode),
7845            53 => Ok(Consumer::Illumination),
7846            54 => Ok(Consumer::FunctionButtons),
7847            64 => Ok(Consumer::Menu),
7848            65 => Ok(Consumer::MenuPick),
7849            66 => Ok(Consumer::MenuUp),
7850            67 => Ok(Consumer::MenuDown),
7851            68 => Ok(Consumer::MenuLeft),
7852            69 => Ok(Consumer::MenuRight),
7853            70 => Ok(Consumer::MenuEscape),
7854            71 => Ok(Consumer::MenuValueIncrease),
7855            72 => Ok(Consumer::MenuValueDecrease),
7856            96 => Ok(Consumer::DataOnScreen),
7857            97 => Ok(Consumer::ClosedCaption),
7858            98 => Ok(Consumer::ClosedCaptionSelect),
7859            99 => Ok(Consumer::VCRTV),
7860            100 => Ok(Consumer::BroadcastMode),
7861            101 => Ok(Consumer::Snapshot),
7862            102 => Ok(Consumer::Still),
7863            103 => Ok(Consumer::PictureinPictureToggle),
7864            104 => Ok(Consumer::PictureinPictureSwap),
7865            105 => Ok(Consumer::RedMenuButton),
7866            106 => Ok(Consumer::GreenMenuButton),
7867            107 => Ok(Consumer::BlueMenuButton),
7868            108 => Ok(Consumer::YellowMenuButton),
7869            109 => Ok(Consumer::Aspect),
7870            110 => Ok(Consumer::ThreeDModeSelect),
7871            111 => Ok(Consumer::DisplayBrightnessIncrement),
7872            112 => Ok(Consumer::DisplayBrightnessDecrement),
7873            113 => Ok(Consumer::DisplayBrightness),
7874            114 => Ok(Consumer::DisplayBacklightToggle),
7875            115 => Ok(Consumer::DisplaySetBrightnesstoMinimum),
7876            116 => Ok(Consumer::DisplaySetBrightnesstoMaximum),
7877            117 => Ok(Consumer::DisplaySetAutoBrightness),
7878            118 => Ok(Consumer::CameraAccessEnabled),
7879            119 => Ok(Consumer::CameraAccessDisabled),
7880            120 => Ok(Consumer::CameraAccessToggle),
7881            121 => Ok(Consumer::KeyboardBrightnessIncrement),
7882            122 => Ok(Consumer::KeyboardBrightnessDecrement),
7883            123 => Ok(Consumer::KeyboardBacklightSetLevel),
7884            124 => Ok(Consumer::KeyboardBacklightOOC),
7885            125 => Ok(Consumer::KeyboardBacklightSetMinimum),
7886            126 => Ok(Consumer::KeyboardBacklightSetMaximum),
7887            127 => Ok(Consumer::KeyboardBacklightAuto),
7888            128 => Ok(Consumer::Selection),
7889            129 => Ok(Consumer::AssignSelection),
7890            130 => Ok(Consumer::ModeStep),
7891            131 => Ok(Consumer::RecallLast),
7892            132 => Ok(Consumer::EnterChannel),
7893            133 => Ok(Consumer::OrderMovie),
7894            134 => Ok(Consumer::Channel),
7895            135 => Ok(Consumer::MediaSelection),
7896            136 => Ok(Consumer::MediaSelectComputer),
7897            137 => Ok(Consumer::MediaSelectTV),
7898            138 => Ok(Consumer::MediaSelectWWW),
7899            139 => Ok(Consumer::MediaSelectDVD),
7900            140 => Ok(Consumer::MediaSelectTelephone),
7901            141 => Ok(Consumer::MediaSelectProgramGuide),
7902            142 => Ok(Consumer::MediaSelectVideoPhone),
7903            143 => Ok(Consumer::MediaSelectGames),
7904            144 => Ok(Consumer::MediaSelectMessages),
7905            145 => Ok(Consumer::MediaSelectCD),
7906            146 => Ok(Consumer::MediaSelectVCR),
7907            147 => Ok(Consumer::MediaSelectTuner),
7908            148 => Ok(Consumer::Quit),
7909            149 => Ok(Consumer::Help),
7910            150 => Ok(Consumer::MediaSelectTape),
7911            151 => Ok(Consumer::MediaSelectCable),
7912            152 => Ok(Consumer::MediaSelectSatellite),
7913            153 => Ok(Consumer::MediaSelectSecurity),
7914            154 => Ok(Consumer::MediaSelectHome),
7915            155 => Ok(Consumer::MediaSelectCall),
7916            156 => Ok(Consumer::ChannelIncrement),
7917            157 => Ok(Consumer::ChannelDecrement),
7918            158 => Ok(Consumer::MediaSelectSAP),
7919            160 => Ok(Consumer::VCRPlus),
7920            161 => Ok(Consumer::Once),
7921            162 => Ok(Consumer::Daily),
7922            163 => Ok(Consumer::Weekly),
7923            164 => Ok(Consumer::Monthly),
7924            176 => Ok(Consumer::Play),
7925            177 => Ok(Consumer::Pause),
7926            178 => Ok(Consumer::Record),
7927            179 => Ok(Consumer::FastForward),
7928            180 => Ok(Consumer::Rewind),
7929            181 => Ok(Consumer::ScanNextTrack),
7930            182 => Ok(Consumer::ScanPreviousTrack),
7931            183 => Ok(Consumer::Stop),
7932            184 => Ok(Consumer::Eject),
7933            185 => Ok(Consumer::RandomPlay),
7934            186 => Ok(Consumer::SelectDisc),
7935            187 => Ok(Consumer::EnterDisc),
7936            188 => Ok(Consumer::Repeat),
7937            189 => Ok(Consumer::Tracking),
7938            190 => Ok(Consumer::TrackNormal),
7939            191 => Ok(Consumer::SlowTracking),
7940            192 => Ok(Consumer::FrameForward),
7941            193 => Ok(Consumer::FrameBack),
7942            194 => Ok(Consumer::Mark),
7943            195 => Ok(Consumer::ClearMark),
7944            196 => Ok(Consumer::RepeatFromMark),
7945            197 => Ok(Consumer::ReturnToMark),
7946            198 => Ok(Consumer::SearchMarkForward),
7947            199 => Ok(Consumer::SearchMarkBackwards),
7948            200 => Ok(Consumer::CounterReset),
7949            201 => Ok(Consumer::ShowCounter),
7950            202 => Ok(Consumer::TrackingIncrement),
7951            203 => Ok(Consumer::TrackingDecrement),
7952            204 => Ok(Consumer::StopEject),
7953            205 => Ok(Consumer::PlayPause),
7954            206 => Ok(Consumer::PlaySkip),
7955            207 => Ok(Consumer::VoiceCommand),
7956            208 => Ok(Consumer::InvokeCaptureInterface),
7957            209 => Ok(Consumer::StartorStopGameRecording),
7958            210 => Ok(Consumer::HistoricalGameCapture),
7959            211 => Ok(Consumer::CaptureGameScreenshot),
7960            212 => Ok(Consumer::ShoworHideRecordingIndicator),
7961            213 => Ok(Consumer::StartorStopMicrophoneCapture),
7962            214 => Ok(Consumer::StartorStopCameraCapture),
7963            215 => Ok(Consumer::StartorStopGameBroadcast),
7964            216 => Ok(Consumer::StartorStopVoiceDictationSession),
7965            217 => Ok(Consumer::InvokeDismissEmojiPicker),
7966            224 => Ok(Consumer::Volume),
7967            225 => Ok(Consumer::Balance),
7968            226 => Ok(Consumer::Mute),
7969            227 => Ok(Consumer::Bass),
7970            228 => Ok(Consumer::Treble),
7971            229 => Ok(Consumer::BassBoost),
7972            230 => Ok(Consumer::SurroundMode),
7973            231 => Ok(Consumer::Loudness),
7974            232 => Ok(Consumer::MPX),
7975            233 => Ok(Consumer::VolumeIncrement),
7976            234 => Ok(Consumer::VolumeDecrement),
7977            240 => Ok(Consumer::SpeedSelect),
7978            241 => Ok(Consumer::PlaybackSpeed),
7979            242 => Ok(Consumer::StandardPlay),
7980            243 => Ok(Consumer::LongPlay),
7981            244 => Ok(Consumer::ExtendedPlay),
7982            245 => Ok(Consumer::Slow),
7983            256 => Ok(Consumer::FanEnable),
7984            257 => Ok(Consumer::FanSpeed),
7985            258 => Ok(Consumer::LightEnable),
7986            259 => Ok(Consumer::LightIlluminationLevel),
7987            260 => Ok(Consumer::ClimateControlEnable),
7988            261 => Ok(Consumer::RoomTemperature),
7989            262 => Ok(Consumer::SecurityEnable),
7990            263 => Ok(Consumer::FireAlarm),
7991            264 => Ok(Consumer::PoliceAlarm),
7992            265 => Ok(Consumer::Proximity),
7993            266 => Ok(Consumer::Motion),
7994            267 => Ok(Consumer::DuressAlarm),
7995            268 => Ok(Consumer::HoldupAlarm),
7996            269 => Ok(Consumer::MedicalAlarm),
7997            336 => Ok(Consumer::BalanceRight),
7998            337 => Ok(Consumer::BalanceLeft),
7999            338 => Ok(Consumer::BassIncrement),
8000            339 => Ok(Consumer::BassDecrement),
8001            340 => Ok(Consumer::TrebleIncrement),
8002            341 => Ok(Consumer::TrebleDecrement),
8003            352 => Ok(Consumer::SpeakerSystem),
8004            353 => Ok(Consumer::ChannelLeft),
8005            354 => Ok(Consumer::ChannelRight),
8006            355 => Ok(Consumer::ChannelCenter),
8007            356 => Ok(Consumer::ChannelFront),
8008            357 => Ok(Consumer::ChannelCenterFront),
8009            358 => Ok(Consumer::ChannelSide),
8010            359 => Ok(Consumer::ChannelSurround),
8011            360 => Ok(Consumer::ChannelLowFrequencyEnhancement),
8012            361 => Ok(Consumer::ChannelTop),
8013            362 => Ok(Consumer::ChannelUnknown),
8014            368 => Ok(Consumer::Subchannel),
8015            369 => Ok(Consumer::SubchannelIncrement),
8016            370 => Ok(Consumer::SubchannelDecrement),
8017            371 => Ok(Consumer::AlternateAudioIncrement),
8018            372 => Ok(Consumer::AlternateAudioDecrement),
8019            384 => Ok(Consumer::ApplicationLaunchButtons),
8020            385 => Ok(Consumer::ALLaunchButtonConfigurationTool),
8021            386 => Ok(Consumer::ALProgrammableButtonConfiguration),
8022            387 => Ok(Consumer::ALConsumerControlConfiguration),
8023            388 => Ok(Consumer::ALWordProcessor),
8024            389 => Ok(Consumer::ALTextEditor),
8025            390 => Ok(Consumer::ALSpreadsheet),
8026            391 => Ok(Consumer::ALGraphicsEditor),
8027            392 => Ok(Consumer::ALPresentationApp),
8028            393 => Ok(Consumer::ALDatabaseApp),
8029            394 => Ok(Consumer::ALEmailReader),
8030            395 => Ok(Consumer::ALNewsreader),
8031            396 => Ok(Consumer::ALVoicemail),
8032            397 => Ok(Consumer::ALContactsAddressBook),
8033            398 => Ok(Consumer::ALCalendarSchedule),
8034            399 => Ok(Consumer::ALTaskProjectManager),
8035            400 => Ok(Consumer::ALLogJournalTimecard),
8036            401 => Ok(Consumer::ALCheckbookFinance),
8037            402 => Ok(Consumer::ALCalculator),
8038            403 => Ok(Consumer::ALAVCapturePlayback),
8039            404 => Ok(Consumer::ALLocalMachineBrowser),
8040            405 => Ok(Consumer::ALLANWANBrowser),
8041            406 => Ok(Consumer::ALInternetBrowser),
8042            407 => Ok(Consumer::ALRemoteNetworkingISPConnect),
8043            408 => Ok(Consumer::ALNetworkConference),
8044            409 => Ok(Consumer::ALNetworkChat),
8045            410 => Ok(Consumer::ALTelephonyDialer),
8046            411 => Ok(Consumer::ALLogon),
8047            412 => Ok(Consumer::ALLogoff),
8048            413 => Ok(Consumer::ALLogonLogoff),
8049            414 => Ok(Consumer::ALTerminalLockScreensaver),
8050            415 => Ok(Consumer::ALControlPanel),
8051            416 => Ok(Consumer::ALCommandLineProcessorRun),
8052            417 => Ok(Consumer::ALProcessTaskManager),
8053            418 => Ok(Consumer::ALSelectTaskApplication),
8054            419 => Ok(Consumer::ALNextTaskApplication),
8055            420 => Ok(Consumer::ALPreviousTaskApplication),
8056            421 => Ok(Consumer::ALPreemptiveHaltTaskApplication),
8057            422 => Ok(Consumer::ALIntegratedHelpCenter),
8058            423 => Ok(Consumer::ALDocuments),
8059            424 => Ok(Consumer::ALThesaurus),
8060            425 => Ok(Consumer::ALDictionary),
8061            426 => Ok(Consumer::ALDesktop),
8062            427 => Ok(Consumer::ALSpellCheck),
8063            428 => Ok(Consumer::ALGrammarCheck),
8064            429 => Ok(Consumer::ALWirelessStatus),
8065            430 => Ok(Consumer::ALKeyboardLayout),
8066            431 => Ok(Consumer::ALVirusProtection),
8067            432 => Ok(Consumer::ALEncryption),
8068            433 => Ok(Consumer::ALScreenSaver),
8069            434 => Ok(Consumer::ALAlarms),
8070            435 => Ok(Consumer::ALClock),
8071            436 => Ok(Consumer::ALFileBrowser),
8072            437 => Ok(Consumer::ALPowerStatus),
8073            438 => Ok(Consumer::ALImageBrowser),
8074            439 => Ok(Consumer::ALAudioBrowser),
8075            440 => Ok(Consumer::ALMovieBrowser),
8076            441 => Ok(Consumer::ALDigitalRightsManager),
8077            442 => Ok(Consumer::ALDigitalWallet),
8078            444 => Ok(Consumer::ALInstantMessaging),
8079            445 => Ok(Consumer::ALOEMFeaturesTipsTutorialBrowser),
8080            446 => Ok(Consumer::ALOEMHelp),
8081            447 => Ok(Consumer::ALOnlineCommunity),
8082            448 => Ok(Consumer::ALEntertainmentContentBrowser),
8083            449 => Ok(Consumer::ALOnlineShoppingBrowser),
8084            450 => Ok(Consumer::ALSmartCardInformationHelp),
8085            451 => Ok(Consumer::ALMarketMonitorFinanceBrowser),
8086            452 => Ok(Consumer::ALCustomizedCorporateNewsBrowser),
8087            453 => Ok(Consumer::ALOnlineActivityBrowser),
8088            454 => Ok(Consumer::ALResearchSearchBrowser),
8089            455 => Ok(Consumer::ALAudioPlayer),
8090            456 => Ok(Consumer::ALMessageStatus),
8091            457 => Ok(Consumer::ALContactSync),
8092            458 => Ok(Consumer::ALNavigation),
8093            459 => Ok(Consumer::ALContextawareDesktopAssistant),
8094            512 => Ok(Consumer::GenericGUIApplicationControls),
8095            513 => Ok(Consumer::ACNew),
8096            514 => Ok(Consumer::ACOpen),
8097            515 => Ok(Consumer::ACClose),
8098            516 => Ok(Consumer::ACExit),
8099            517 => Ok(Consumer::ACMaximize),
8100            518 => Ok(Consumer::ACMinimize),
8101            519 => Ok(Consumer::ACSave),
8102            520 => Ok(Consumer::ACPrint),
8103            521 => Ok(Consumer::ACProperties),
8104            538 => Ok(Consumer::ACUndo),
8105            539 => Ok(Consumer::ACCopy),
8106            540 => Ok(Consumer::ACCut),
8107            541 => Ok(Consumer::ACPaste),
8108            542 => Ok(Consumer::ACSelectAll),
8109            543 => Ok(Consumer::ACFind),
8110            544 => Ok(Consumer::ACFindandReplace),
8111            545 => Ok(Consumer::ACSearch),
8112            546 => Ok(Consumer::ACGoTo),
8113            547 => Ok(Consumer::ACHome),
8114            548 => Ok(Consumer::ACBack),
8115            549 => Ok(Consumer::ACForward),
8116            550 => Ok(Consumer::ACStop),
8117            551 => Ok(Consumer::ACRefresh),
8118            552 => Ok(Consumer::ACPreviousLink),
8119            553 => Ok(Consumer::ACNextLink),
8120            554 => Ok(Consumer::ACBookmarks),
8121            555 => Ok(Consumer::ACHistory),
8122            556 => Ok(Consumer::ACSubscriptions),
8123            557 => Ok(Consumer::ACZoomIn),
8124            558 => Ok(Consumer::ACZoomOut),
8125            559 => Ok(Consumer::ACZoom),
8126            560 => Ok(Consumer::ACFullScreenView),
8127            561 => Ok(Consumer::ACNormalView),
8128            562 => Ok(Consumer::ACViewToggle),
8129            563 => Ok(Consumer::ACScrollUp),
8130            564 => Ok(Consumer::ACScrollDown),
8131            565 => Ok(Consumer::ACScroll),
8132            566 => Ok(Consumer::ACPanLeft),
8133            567 => Ok(Consumer::ACPanRight),
8134            568 => Ok(Consumer::ACPan),
8135            569 => Ok(Consumer::ACNewWindow),
8136            570 => Ok(Consumer::ACTileHorizontally),
8137            571 => Ok(Consumer::ACTileVertically),
8138            572 => Ok(Consumer::ACFormat),
8139            573 => Ok(Consumer::ACEdit),
8140            574 => Ok(Consumer::ACBold),
8141            575 => Ok(Consumer::ACItalics),
8142            576 => Ok(Consumer::ACUnderline),
8143            577 => Ok(Consumer::ACStrikethrough),
8144            578 => Ok(Consumer::ACSubscript),
8145            579 => Ok(Consumer::ACSuperscript),
8146            580 => Ok(Consumer::ACAllCaps),
8147            581 => Ok(Consumer::ACRotate),
8148            582 => Ok(Consumer::ACResize),
8149            583 => Ok(Consumer::ACFlipHorizontal),
8150            584 => Ok(Consumer::ACFlipVertical),
8151            585 => Ok(Consumer::ACMirrorHorizontal),
8152            586 => Ok(Consumer::ACMirrorVertical),
8153            587 => Ok(Consumer::ACFontSelect),
8154            588 => Ok(Consumer::ACFontColor),
8155            589 => Ok(Consumer::ACFontSize),
8156            590 => Ok(Consumer::ACJustifyLeft),
8157            591 => Ok(Consumer::ACJustifyCenterH),
8158            592 => Ok(Consumer::ACJustifyRight),
8159            593 => Ok(Consumer::ACJustifyBlockH),
8160            594 => Ok(Consumer::ACJustifyTop),
8161            595 => Ok(Consumer::ACJustifyCenterV),
8162            596 => Ok(Consumer::ACJustifyBottom),
8163            597 => Ok(Consumer::ACJustifyBlockV),
8164            598 => Ok(Consumer::ACIndentDecrease),
8165            599 => Ok(Consumer::ACIndentIncrease),
8166            600 => Ok(Consumer::ACNumberedList),
8167            601 => Ok(Consumer::ACRestartNumbering),
8168            602 => Ok(Consumer::ACBulletedList),
8169            603 => Ok(Consumer::ACPromote),
8170            604 => Ok(Consumer::ACDemote),
8171            605 => Ok(Consumer::ACYes),
8172            606 => Ok(Consumer::ACNo),
8173            607 => Ok(Consumer::ACCancel),
8174            608 => Ok(Consumer::ACCatalog),
8175            609 => Ok(Consumer::ACBuyCheckout),
8176            610 => Ok(Consumer::ACAddtoCart),
8177            611 => Ok(Consumer::ACExpand),
8178            612 => Ok(Consumer::ACExpandAll),
8179            613 => Ok(Consumer::ACCollapse),
8180            614 => Ok(Consumer::ACCollapseAll),
8181            615 => Ok(Consumer::ACPrintPreview),
8182            616 => Ok(Consumer::ACPasteSpecial),
8183            617 => Ok(Consumer::ACInsertMode),
8184            618 => Ok(Consumer::ACDelete),
8185            619 => Ok(Consumer::ACLock),
8186            620 => Ok(Consumer::ACUnlock),
8187            621 => Ok(Consumer::ACProtect),
8188            622 => Ok(Consumer::ACUnprotect),
8189            623 => Ok(Consumer::ACAttachComment),
8190            624 => Ok(Consumer::ACDeleteComment),
8191            625 => Ok(Consumer::ACViewComment),
8192            626 => Ok(Consumer::ACSelectWord),
8193            627 => Ok(Consumer::ACSelectSentence),
8194            628 => Ok(Consumer::ACSelectParagraph),
8195            629 => Ok(Consumer::ACSelectColumn),
8196            630 => Ok(Consumer::ACSelectRow),
8197            631 => Ok(Consumer::ACSelectTable),
8198            632 => Ok(Consumer::ACSelectObject),
8199            633 => Ok(Consumer::ACRedoRepeat),
8200            634 => Ok(Consumer::ACSort),
8201            635 => Ok(Consumer::ACSortAscending),
8202            636 => Ok(Consumer::ACSortDescending),
8203            637 => Ok(Consumer::ACFilter),
8204            638 => Ok(Consumer::ACSetClock),
8205            639 => Ok(Consumer::ACViewClock),
8206            640 => Ok(Consumer::ACSelectTimeZone),
8207            641 => Ok(Consumer::ACEditTimeZones),
8208            642 => Ok(Consumer::ACSetAlarm),
8209            643 => Ok(Consumer::ACClearAlarm),
8210            644 => Ok(Consumer::ACSnoozeAlarm),
8211            645 => Ok(Consumer::ACResetAlarm),
8212            646 => Ok(Consumer::ACSynchronize),
8213            647 => Ok(Consumer::ACSendReceive),
8214            648 => Ok(Consumer::ACSendTo),
8215            649 => Ok(Consumer::ACReply),
8216            650 => Ok(Consumer::ACReplyAll),
8217            651 => Ok(Consumer::ACForwardMsg),
8218            652 => Ok(Consumer::ACSend),
8219            653 => Ok(Consumer::ACAttachFile),
8220            654 => Ok(Consumer::ACUpload),
8221            655 => Ok(Consumer::ACDownloadSaveTargetAs),
8222            656 => Ok(Consumer::ACSetBorders),
8223            657 => Ok(Consumer::ACInsertRow),
8224            658 => Ok(Consumer::ACInsertColumn),
8225            659 => Ok(Consumer::ACInsertFile),
8226            660 => Ok(Consumer::ACInsertPicture),
8227            661 => Ok(Consumer::ACInsertObject),
8228            662 => Ok(Consumer::ACInsertSymbol),
8229            663 => Ok(Consumer::ACSaveandClose),
8230            664 => Ok(Consumer::ACRename),
8231            665 => Ok(Consumer::ACMerge),
8232            666 => Ok(Consumer::ACSplit),
8233            667 => Ok(Consumer::ACDisributeHorizontally),
8234            668 => Ok(Consumer::ACDistributeVertically),
8235            669 => Ok(Consumer::ACNextKeyboardLayoutSelect),
8236            670 => Ok(Consumer::ACNavigationGuidance),
8237            671 => Ok(Consumer::ACDesktopShowAllWindows),
8238            672 => Ok(Consumer::ACSoftKeyLeft),
8239            673 => Ok(Consumer::ACSoftKeyRight),
8240            674 => Ok(Consumer::ACDesktopShowAllApplications),
8241            688 => Ok(Consumer::ACIdleKeepAlive),
8242            704 => Ok(Consumer::ExtendedKeyboardAttributesCollection),
8243            705 => Ok(Consumer::KeyboardFormFactor),
8244            706 => Ok(Consumer::KeyboardKeyType),
8245            707 => Ok(Consumer::KeyboardPhysicalLayout),
8246            708 => Ok(Consumer::VendorSpecificKeyboardPhysicalLayout),
8247            709 => Ok(Consumer::KeyboardIETFLanguageTagIndex),
8248            710 => Ok(Consumer::ImplementedKeyboardInputAssistControls),
8249            711 => Ok(Consumer::KeyboardInputAssistPrevious),
8250            712 => Ok(Consumer::KeyboardInputAssistNext),
8251            713 => Ok(Consumer::KeyboardInputAssistPreviousGroup),
8252            714 => Ok(Consumer::KeyboardInputAssistNextGroup),
8253            715 => Ok(Consumer::KeyboardInputAssistAccept),
8254            716 => Ok(Consumer::KeyboardInputAssistCancel),
8255            720 => Ok(Consumer::PrivacyScreenToggle),
8256            721 => Ok(Consumer::PrivacyScreenLevelDecrement),
8257            722 => Ok(Consumer::PrivacyScreenLevelIncrement),
8258            723 => Ok(Consumer::PrivacyScreenLevelMinimum),
8259            724 => Ok(Consumer::PrivacyScreenLevelMaximum),
8260            1280 => Ok(Consumer::ContactEdited),
8261            1281 => Ok(Consumer::ContactAdded),
8262            1282 => Ok(Consumer::ContactRecordActive),
8263            1283 => Ok(Consumer::ContactIndex),
8264            1284 => Ok(Consumer::ContactNickname),
8265            1285 => Ok(Consumer::ContactFirstName),
8266            1286 => Ok(Consumer::ContactLastName),
8267            1287 => Ok(Consumer::ContactFullName),
8268            1288 => Ok(Consumer::ContactPhoneNumberPersonal),
8269            1289 => Ok(Consumer::ContactPhoneNumberBusiness),
8270            1290 => Ok(Consumer::ContactPhoneNumberMobile),
8271            1291 => Ok(Consumer::ContactPhoneNumberPager),
8272            1292 => Ok(Consumer::ContactPhoneNumberFax),
8273            1293 => Ok(Consumer::ContactPhoneNumberOther),
8274            1294 => Ok(Consumer::ContactEmailPersonal),
8275            1295 => Ok(Consumer::ContactEmailBusiness),
8276            1296 => Ok(Consumer::ContactEmailOther),
8277            1297 => Ok(Consumer::ContactEmailMain),
8278            1298 => Ok(Consumer::ContactSpeedDialNumber),
8279            1299 => Ok(Consumer::ContactStatusFlag),
8280            1300 => Ok(Consumer::ContactMisc),
8281            n => Err(HutError::UnknownUsageId { usage_id: n }),
8282        }
8283    }
8284}
8285
8286impl BitOr<u16> for Consumer {
8287    type Output = Usage;
8288
8289    /// A convenience function to combine a Usage Page with
8290    /// a value.
8291    ///
8292    /// This function panics if the Usage ID value results in
8293    /// an unknown Usage. Where error checking is required,
8294    /// use [UsagePage::to_usage_from_value].
8295    fn bitor(self, usage: u16) -> Usage {
8296        let up = u16::from(self) as u32;
8297        let u = usage as u32;
8298        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
8299    }
8300}
8301
8302/// *Usage Page `0xD`: "Digitizers"*
8303///
8304/// **This enum is autogenerated from the HID Usage Tables**.
8305/// ```
8306/// # use hut::*;
8307/// let u1 = Usage::Digitizers(Digitizers::Pen);
8308/// let u2 = Usage::new_from_page_and_id(0xD, 0x2).unwrap();
8309/// let u3 = Usage::from(Digitizers::Pen);
8310/// let u4: Usage = Digitizers::Pen.into();
8311/// assert_eq!(u1, u2);
8312/// assert_eq!(u1, u3);
8313/// assert_eq!(u1, u4);
8314///
8315/// assert!(matches!(u1.usage_page(), UsagePage::Digitizers));
8316/// assert_eq!(0xD, u1.usage_page_value());
8317/// assert_eq!(0x2, u1.usage_id_value());
8318/// assert_eq!((0xD << 16) | 0x2, u1.usage_value());
8319/// assert_eq!("Pen", u1.name());
8320/// ```
8321///
8322#[allow(non_camel_case_types)]
8323#[derive(Debug)]
8324#[non_exhaustive]
8325pub enum Digitizers {
8326    /// Usage ID `0x1`: "Digitizer"
8327    Digitizer,
8328    /// Usage ID `0x2`: "Pen"
8329    Pen,
8330    /// Usage ID `0x3`: "Light Pen"
8331    LightPen,
8332    /// Usage ID `0x4`: "Touch Screen"
8333    TouchScreen,
8334    /// Usage ID `0x5`: "Touch Pad"
8335    TouchPad,
8336    /// Usage ID `0x6`: "Whiteboard"
8337    Whiteboard,
8338    /// Usage ID `0x7`: "Coordinate Measuring Machine"
8339    CoordinateMeasuringMachine,
8340    /// Usage ID `0x8`: "3D Digitizer"
8341    ThreeDDigitizer,
8342    /// Usage ID `0x9`: "Stereo Plotter"
8343    StereoPlotter,
8344    /// Usage ID `0xA`: "Articulated Arm"
8345    ArticulatedArm,
8346    /// Usage ID `0xB`: "Armature"
8347    Armature,
8348    /// Usage ID `0xC`: "Multiple Point Digitizer"
8349    MultiplePointDigitizer,
8350    /// Usage ID `0xD`: "Free Space Wand"
8351    FreeSpaceWand,
8352    /// Usage ID `0xE`: "Device Configuration"
8353    DeviceConfiguration,
8354    /// Usage ID `0xF`: "Capacitive Heat Map Digitizer"
8355    CapacitiveHeatMapDigitizer,
8356    /// Usage ID `0x20`: "Stylus"
8357    Stylus,
8358    /// Usage ID `0x21`: "Puck"
8359    Puck,
8360    /// Usage ID `0x22`: "Finger"
8361    Finger,
8362    /// Usage ID `0x23`: "Device settings"
8363    Devicesettings,
8364    /// Usage ID `0x24`: "Character Gesture"
8365    CharacterGesture,
8366    /// Usage ID `0x30`: "Tip Pressure"
8367    TipPressure,
8368    /// Usage ID `0x31`: "Barrel Pressure"
8369    BarrelPressure,
8370    /// Usage ID `0x32`: "In Range"
8371    InRange,
8372    /// Usage ID `0x33`: "Touch"
8373    Touch,
8374    /// Usage ID `0x34`: "Untouch"
8375    Untouch,
8376    /// Usage ID `0x35`: "Tap"
8377    Tap,
8378    /// Usage ID `0x36`: "Quality"
8379    Quality,
8380    /// Usage ID `0x37`: "Data Valid"
8381    DataValid,
8382    /// Usage ID `0x38`: "Transducer Index"
8383    TransducerIndex,
8384    /// Usage ID `0x39`: "Tablet Function Keys"
8385    TabletFunctionKeys,
8386    /// Usage ID `0x3A`: "Program Change Keys"
8387    ProgramChangeKeys,
8388    /// Usage ID `0x3B`: "Battery Strength"
8389    BatteryStrength,
8390    /// Usage ID `0x3C`: "Invert"
8391    Invert,
8392    /// Usage ID `0x3D`: "X Tilt"
8393    XTilt,
8394    /// Usage ID `0x3E`: "Y Tilt"
8395    YTilt,
8396    /// Usage ID `0x3F`: "Azimuth"
8397    Azimuth,
8398    /// Usage ID `0x40`: "Altitude"
8399    Altitude,
8400    /// Usage ID `0x41`: "Twist"
8401    Twist,
8402    /// Usage ID `0x42`: "Tip Switch"
8403    TipSwitch,
8404    /// Usage ID `0x43`: "Secondary Tip Switch"
8405    SecondaryTipSwitch,
8406    /// Usage ID `0x44`: "Barrel Switch"
8407    BarrelSwitch,
8408    /// Usage ID `0x45`: "Eraser"
8409    Eraser,
8410    /// Usage ID `0x46`: "Tablet Pick"
8411    TabletPick,
8412    /// Usage ID `0x47`: "Touch Valid"
8413    TouchValid,
8414    /// Usage ID `0x48`: "Width"
8415    Width,
8416    /// Usage ID `0x49`: "Height"
8417    Height,
8418    /// Usage ID `0x51`: "Contact Identifier"
8419    ContactIdentifier,
8420    /// Usage ID `0x52`: "Device Mode"
8421    DeviceMode,
8422    /// Usage ID `0x53`: "Device Identifier"
8423    DeviceIdentifier,
8424    /// Usage ID `0x54`: "Contact Count"
8425    ContactCount,
8426    /// Usage ID `0x55`: "Contact Count Maximum"
8427    ContactCountMaximum,
8428    /// Usage ID `0x56`: "Scan Time"
8429    ScanTime,
8430    /// Usage ID `0x57`: "Surface Switch"
8431    SurfaceSwitch,
8432    /// Usage ID `0x58`: "Button Switch"
8433    ButtonSwitch,
8434    /// Usage ID `0x59`: "Pad Type"
8435    PadType,
8436    /// Usage ID `0x5A`: "Secondary Barrel Switch"
8437    SecondaryBarrelSwitch,
8438    /// Usage ID `0x5B`: "Transducer Serial Number"
8439    TransducerSerialNumber,
8440    /// Usage ID `0x5C`: "Preferred Color"
8441    PreferredColor,
8442    /// Usage ID `0x5D`: "Preferred Color is Locked"
8443    PreferredColorisLocked,
8444    /// Usage ID `0x5E`: "Preferred Line Width"
8445    PreferredLineWidth,
8446    /// Usage ID `0x5F`: "Preferred Line Width is Locked"
8447    PreferredLineWidthisLocked,
8448    /// Usage ID `0x60`: "Latency Mode"
8449    LatencyMode,
8450    /// Usage ID `0x61`: "Gesture Character Quality"
8451    GestureCharacterQuality,
8452    /// Usage ID `0x62`: "Character Gesture Data Length"
8453    CharacterGestureDataLength,
8454    /// Usage ID `0x63`: "Character Gesture Data"
8455    CharacterGestureData,
8456    /// Usage ID `0x64`: "Gesture Character Encoding"
8457    GestureCharacterEncoding,
8458    /// Usage ID `0x65`: "UTF8 Character Gesture Encoding"
8459    UTF8CharacterGestureEncoding,
8460    /// Usage ID `0x66`: "UTF16 Little Endian Character Gesture Encoding"
8461    UTF16LittleEndianCharacterGestureEncoding,
8462    /// Usage ID `0x67`: "UTF16 Big Endian Character Gesture Encoding"
8463    UTF16BigEndianCharacterGestureEncoding,
8464    /// Usage ID `0x68`: "UTF32 Little Endian Character Gesture Encoding"
8465    UTF32LittleEndianCharacterGestureEncoding,
8466    /// Usage ID `0x69`: "UTF32 Big Endian Character Gesture Encoding"
8467    UTF32BigEndianCharacterGestureEncoding,
8468    /// Usage ID `0x6A`: "Capacitive Heat Map Protocol Vendor ID"
8469    CapacitiveHeatMapProtocolVendorID,
8470    /// Usage ID `0x6B`: "Capacitive Heat Map Protocol Version"
8471    CapacitiveHeatMapProtocolVersion,
8472    /// Usage ID `0x6C`: "Capacitive Heat Map Frame Data"
8473    CapacitiveHeatMapFrameData,
8474    /// Usage ID `0x6D`: "Gesture Character Enable"
8475    GestureCharacterEnable,
8476    /// Usage ID `0x6E`: "Transducer Serial Number Part 2"
8477    TransducerSerialNumberPart2,
8478    /// Usage ID `0x6F`: "No Preferred Color"
8479    NoPreferredColor,
8480    /// Usage ID `0x70`: "Preferred Line Style"
8481    PreferredLineStyle,
8482    /// Usage ID `0x71`: "Preferred Line Style is Locked"
8483    PreferredLineStyleisLocked,
8484    /// Usage ID `0x72`: "Ink"
8485    Ink,
8486    /// Usage ID `0x73`: "Pencil"
8487    Pencil,
8488    /// Usage ID `0x74`: "Highlighter"
8489    Highlighter,
8490    /// Usage ID `0x75`: "Chisel Marker"
8491    ChiselMarker,
8492    /// Usage ID `0x76`: "Brush"
8493    Brush,
8494    /// Usage ID `0x77`: "No Preference"
8495    NoPreference,
8496    /// Usage ID `0x80`: "Digitizer Diagnostic"
8497    DigitizerDiagnostic,
8498    /// Usage ID `0x81`: "Digitizer Error"
8499    DigitizerError,
8500    /// Usage ID `0x82`: "Err Normal Status"
8501    ErrNormalStatus,
8502    /// Usage ID `0x83`: "Err Transducers Exceeded"
8503    ErrTransducersExceeded,
8504    /// Usage ID `0x84`: "Err Full Trans Features Unavailable"
8505    ErrFullTransFeaturesUnavailable,
8506    /// Usage ID `0x85`: "Err Charge Low"
8507    ErrChargeLow,
8508    /// Usage ID `0x90`: "Transducer Software Info"
8509    TransducerSoftwareInfo,
8510    /// Usage ID `0x91`: "Transducer Vendor Id"
8511    TransducerVendorId,
8512    /// Usage ID `0x92`: "Transducer Product Id"
8513    TransducerProductId,
8514    /// Usage ID `0x93`: "Device Supported Protocols"
8515    DeviceSupportedProtocols,
8516    /// Usage ID `0x94`: "Transducer Supported Protocols"
8517    TransducerSupportedProtocols,
8518    /// Usage ID `0x95`: "No Protocol"
8519    NoProtocol,
8520    /// Usage ID `0x96`: "Wacom AES Protocol"
8521    WacomAESProtocol,
8522    /// Usage ID `0x97`: "USI Protocol"
8523    USIProtocol,
8524    /// Usage ID `0x98`: "Microsoft Pen Protocol"
8525    MicrosoftPenProtocol,
8526    /// Usage ID `0xA0`: "Supported Report Rates"
8527    SupportedReportRates,
8528    /// Usage ID `0xA1`: "Report Rate"
8529    ReportRate,
8530    /// Usage ID `0xA2`: "Transducer Connected"
8531    TransducerConnected,
8532    /// Usage ID `0xA3`: "Switch Disabled"
8533    SwitchDisabled,
8534    /// Usage ID `0xA4`: "Switch Unimplemented"
8535    SwitchUnimplemented,
8536    /// Usage ID `0xA5`: "Transducer Switches"
8537    TransducerSwitches,
8538    /// Usage ID `0xA6`: "Transducer Index Selector"
8539    TransducerIndexSelector,
8540    /// Usage ID `0xB0`: "Button Press Threshold"
8541    ButtonPressThreshold,
8542}
8543
8544impl Digitizers {
8545    #[cfg(feature = "std")]
8546    pub fn name(&self) -> String {
8547        match self {
8548            Digitizers::Digitizer => "Digitizer",
8549            Digitizers::Pen => "Pen",
8550            Digitizers::LightPen => "Light Pen",
8551            Digitizers::TouchScreen => "Touch Screen",
8552            Digitizers::TouchPad => "Touch Pad",
8553            Digitizers::Whiteboard => "Whiteboard",
8554            Digitizers::CoordinateMeasuringMachine => "Coordinate Measuring Machine",
8555            Digitizers::ThreeDDigitizer => "3D Digitizer",
8556            Digitizers::StereoPlotter => "Stereo Plotter",
8557            Digitizers::ArticulatedArm => "Articulated Arm",
8558            Digitizers::Armature => "Armature",
8559            Digitizers::MultiplePointDigitizer => "Multiple Point Digitizer",
8560            Digitizers::FreeSpaceWand => "Free Space Wand",
8561            Digitizers::DeviceConfiguration => "Device Configuration",
8562            Digitizers::CapacitiveHeatMapDigitizer => "Capacitive Heat Map Digitizer",
8563            Digitizers::Stylus => "Stylus",
8564            Digitizers::Puck => "Puck",
8565            Digitizers::Finger => "Finger",
8566            Digitizers::Devicesettings => "Device settings",
8567            Digitizers::CharacterGesture => "Character Gesture",
8568            Digitizers::TipPressure => "Tip Pressure",
8569            Digitizers::BarrelPressure => "Barrel Pressure",
8570            Digitizers::InRange => "In Range",
8571            Digitizers::Touch => "Touch",
8572            Digitizers::Untouch => "Untouch",
8573            Digitizers::Tap => "Tap",
8574            Digitizers::Quality => "Quality",
8575            Digitizers::DataValid => "Data Valid",
8576            Digitizers::TransducerIndex => "Transducer Index",
8577            Digitizers::TabletFunctionKeys => "Tablet Function Keys",
8578            Digitizers::ProgramChangeKeys => "Program Change Keys",
8579            Digitizers::BatteryStrength => "Battery Strength",
8580            Digitizers::Invert => "Invert",
8581            Digitizers::XTilt => "X Tilt",
8582            Digitizers::YTilt => "Y Tilt",
8583            Digitizers::Azimuth => "Azimuth",
8584            Digitizers::Altitude => "Altitude",
8585            Digitizers::Twist => "Twist",
8586            Digitizers::TipSwitch => "Tip Switch",
8587            Digitizers::SecondaryTipSwitch => "Secondary Tip Switch",
8588            Digitizers::BarrelSwitch => "Barrel Switch",
8589            Digitizers::Eraser => "Eraser",
8590            Digitizers::TabletPick => "Tablet Pick",
8591            Digitizers::TouchValid => "Touch Valid",
8592            Digitizers::Width => "Width",
8593            Digitizers::Height => "Height",
8594            Digitizers::ContactIdentifier => "Contact Identifier",
8595            Digitizers::DeviceMode => "Device Mode",
8596            Digitizers::DeviceIdentifier => "Device Identifier",
8597            Digitizers::ContactCount => "Contact Count",
8598            Digitizers::ContactCountMaximum => "Contact Count Maximum",
8599            Digitizers::ScanTime => "Scan Time",
8600            Digitizers::SurfaceSwitch => "Surface Switch",
8601            Digitizers::ButtonSwitch => "Button Switch",
8602            Digitizers::PadType => "Pad Type",
8603            Digitizers::SecondaryBarrelSwitch => "Secondary Barrel Switch",
8604            Digitizers::TransducerSerialNumber => "Transducer Serial Number",
8605            Digitizers::PreferredColor => "Preferred Color",
8606            Digitizers::PreferredColorisLocked => "Preferred Color is Locked",
8607            Digitizers::PreferredLineWidth => "Preferred Line Width",
8608            Digitizers::PreferredLineWidthisLocked => "Preferred Line Width is Locked",
8609            Digitizers::LatencyMode => "Latency Mode",
8610            Digitizers::GestureCharacterQuality => "Gesture Character Quality",
8611            Digitizers::CharacterGestureDataLength => "Character Gesture Data Length",
8612            Digitizers::CharacterGestureData => "Character Gesture Data",
8613            Digitizers::GestureCharacterEncoding => "Gesture Character Encoding",
8614            Digitizers::UTF8CharacterGestureEncoding => "UTF8 Character Gesture Encoding",
8615            Digitizers::UTF16LittleEndianCharacterGestureEncoding => {
8616                "UTF16 Little Endian Character Gesture Encoding"
8617            }
8618            Digitizers::UTF16BigEndianCharacterGestureEncoding => {
8619                "UTF16 Big Endian Character Gesture Encoding"
8620            }
8621            Digitizers::UTF32LittleEndianCharacterGestureEncoding => {
8622                "UTF32 Little Endian Character Gesture Encoding"
8623            }
8624            Digitizers::UTF32BigEndianCharacterGestureEncoding => {
8625                "UTF32 Big Endian Character Gesture Encoding"
8626            }
8627            Digitizers::CapacitiveHeatMapProtocolVendorID => {
8628                "Capacitive Heat Map Protocol Vendor ID"
8629            }
8630            Digitizers::CapacitiveHeatMapProtocolVersion => "Capacitive Heat Map Protocol Version",
8631            Digitizers::CapacitiveHeatMapFrameData => "Capacitive Heat Map Frame Data",
8632            Digitizers::GestureCharacterEnable => "Gesture Character Enable",
8633            Digitizers::TransducerSerialNumberPart2 => "Transducer Serial Number Part 2",
8634            Digitizers::NoPreferredColor => "No Preferred Color",
8635            Digitizers::PreferredLineStyle => "Preferred Line Style",
8636            Digitizers::PreferredLineStyleisLocked => "Preferred Line Style is Locked",
8637            Digitizers::Ink => "Ink",
8638            Digitizers::Pencil => "Pencil",
8639            Digitizers::Highlighter => "Highlighter",
8640            Digitizers::ChiselMarker => "Chisel Marker",
8641            Digitizers::Brush => "Brush",
8642            Digitizers::NoPreference => "No Preference",
8643            Digitizers::DigitizerDiagnostic => "Digitizer Diagnostic",
8644            Digitizers::DigitizerError => "Digitizer Error",
8645            Digitizers::ErrNormalStatus => "Err Normal Status",
8646            Digitizers::ErrTransducersExceeded => "Err Transducers Exceeded",
8647            Digitizers::ErrFullTransFeaturesUnavailable => "Err Full Trans Features Unavailable",
8648            Digitizers::ErrChargeLow => "Err Charge Low",
8649            Digitizers::TransducerSoftwareInfo => "Transducer Software Info",
8650            Digitizers::TransducerVendorId => "Transducer Vendor Id",
8651            Digitizers::TransducerProductId => "Transducer Product Id",
8652            Digitizers::DeviceSupportedProtocols => "Device Supported Protocols",
8653            Digitizers::TransducerSupportedProtocols => "Transducer Supported Protocols",
8654            Digitizers::NoProtocol => "No Protocol",
8655            Digitizers::WacomAESProtocol => "Wacom AES Protocol",
8656            Digitizers::USIProtocol => "USI Protocol",
8657            Digitizers::MicrosoftPenProtocol => "Microsoft Pen Protocol",
8658            Digitizers::SupportedReportRates => "Supported Report Rates",
8659            Digitizers::ReportRate => "Report Rate",
8660            Digitizers::TransducerConnected => "Transducer Connected",
8661            Digitizers::SwitchDisabled => "Switch Disabled",
8662            Digitizers::SwitchUnimplemented => "Switch Unimplemented",
8663            Digitizers::TransducerSwitches => "Transducer Switches",
8664            Digitizers::TransducerIndexSelector => "Transducer Index Selector",
8665            Digitizers::ButtonPressThreshold => "Button Press Threshold",
8666        }
8667        .into()
8668    }
8669}
8670
8671#[cfg(feature = "std")]
8672impl fmt::Display for Digitizers {
8673    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
8674        write!(f, "{}", self.name())
8675    }
8676}
8677
8678impl AsUsage for Digitizers {
8679    /// Returns the 32 bit Usage value of this Usage
8680    fn usage_value(&self) -> u32 {
8681        u32::from(self)
8682    }
8683
8684    /// Returns the 16 bit Usage ID value of this Usage
8685    fn usage_id_value(&self) -> u16 {
8686        u16::from(self)
8687    }
8688
8689    /// Returns this usage as [Usage::Digitizers(self)](Usage::Digitizers)
8690    /// This is a convenience function to avoid having
8691    /// to implement `From` for every used type in the caller.
8692    ///
8693    /// ```
8694    /// # use hut::*;
8695    /// let gd_x = GenericDesktop::X;
8696    /// let usage = Usage::from(GenericDesktop::X);
8697    /// assert!(matches!(gd_x.usage(), usage));
8698    /// ```
8699    fn usage(&self) -> Usage {
8700        Usage::from(self)
8701    }
8702}
8703
8704impl AsUsagePage for Digitizers {
8705    /// Returns the 16 bit value of this UsagePage
8706    ///
8707    /// This value is `0xD` for [Digitizers]
8708    fn usage_page_value(&self) -> u16 {
8709        let up = UsagePage::from(self);
8710        u16::from(up)
8711    }
8712
8713    /// Returns [UsagePage::Digitizers]]
8714    fn usage_page(&self) -> UsagePage {
8715        UsagePage::from(self)
8716    }
8717}
8718
8719impl From<&Digitizers> for u16 {
8720    fn from(digitizers: &Digitizers) -> u16 {
8721        match *digitizers {
8722            Digitizers::Digitizer => 1,
8723            Digitizers::Pen => 2,
8724            Digitizers::LightPen => 3,
8725            Digitizers::TouchScreen => 4,
8726            Digitizers::TouchPad => 5,
8727            Digitizers::Whiteboard => 6,
8728            Digitizers::CoordinateMeasuringMachine => 7,
8729            Digitizers::ThreeDDigitizer => 8,
8730            Digitizers::StereoPlotter => 9,
8731            Digitizers::ArticulatedArm => 10,
8732            Digitizers::Armature => 11,
8733            Digitizers::MultiplePointDigitizer => 12,
8734            Digitizers::FreeSpaceWand => 13,
8735            Digitizers::DeviceConfiguration => 14,
8736            Digitizers::CapacitiveHeatMapDigitizer => 15,
8737            Digitizers::Stylus => 32,
8738            Digitizers::Puck => 33,
8739            Digitizers::Finger => 34,
8740            Digitizers::Devicesettings => 35,
8741            Digitizers::CharacterGesture => 36,
8742            Digitizers::TipPressure => 48,
8743            Digitizers::BarrelPressure => 49,
8744            Digitizers::InRange => 50,
8745            Digitizers::Touch => 51,
8746            Digitizers::Untouch => 52,
8747            Digitizers::Tap => 53,
8748            Digitizers::Quality => 54,
8749            Digitizers::DataValid => 55,
8750            Digitizers::TransducerIndex => 56,
8751            Digitizers::TabletFunctionKeys => 57,
8752            Digitizers::ProgramChangeKeys => 58,
8753            Digitizers::BatteryStrength => 59,
8754            Digitizers::Invert => 60,
8755            Digitizers::XTilt => 61,
8756            Digitizers::YTilt => 62,
8757            Digitizers::Azimuth => 63,
8758            Digitizers::Altitude => 64,
8759            Digitizers::Twist => 65,
8760            Digitizers::TipSwitch => 66,
8761            Digitizers::SecondaryTipSwitch => 67,
8762            Digitizers::BarrelSwitch => 68,
8763            Digitizers::Eraser => 69,
8764            Digitizers::TabletPick => 70,
8765            Digitizers::TouchValid => 71,
8766            Digitizers::Width => 72,
8767            Digitizers::Height => 73,
8768            Digitizers::ContactIdentifier => 81,
8769            Digitizers::DeviceMode => 82,
8770            Digitizers::DeviceIdentifier => 83,
8771            Digitizers::ContactCount => 84,
8772            Digitizers::ContactCountMaximum => 85,
8773            Digitizers::ScanTime => 86,
8774            Digitizers::SurfaceSwitch => 87,
8775            Digitizers::ButtonSwitch => 88,
8776            Digitizers::PadType => 89,
8777            Digitizers::SecondaryBarrelSwitch => 90,
8778            Digitizers::TransducerSerialNumber => 91,
8779            Digitizers::PreferredColor => 92,
8780            Digitizers::PreferredColorisLocked => 93,
8781            Digitizers::PreferredLineWidth => 94,
8782            Digitizers::PreferredLineWidthisLocked => 95,
8783            Digitizers::LatencyMode => 96,
8784            Digitizers::GestureCharacterQuality => 97,
8785            Digitizers::CharacterGestureDataLength => 98,
8786            Digitizers::CharacterGestureData => 99,
8787            Digitizers::GestureCharacterEncoding => 100,
8788            Digitizers::UTF8CharacterGestureEncoding => 101,
8789            Digitizers::UTF16LittleEndianCharacterGestureEncoding => 102,
8790            Digitizers::UTF16BigEndianCharacterGestureEncoding => 103,
8791            Digitizers::UTF32LittleEndianCharacterGestureEncoding => 104,
8792            Digitizers::UTF32BigEndianCharacterGestureEncoding => 105,
8793            Digitizers::CapacitiveHeatMapProtocolVendorID => 106,
8794            Digitizers::CapacitiveHeatMapProtocolVersion => 107,
8795            Digitizers::CapacitiveHeatMapFrameData => 108,
8796            Digitizers::GestureCharacterEnable => 109,
8797            Digitizers::TransducerSerialNumberPart2 => 110,
8798            Digitizers::NoPreferredColor => 111,
8799            Digitizers::PreferredLineStyle => 112,
8800            Digitizers::PreferredLineStyleisLocked => 113,
8801            Digitizers::Ink => 114,
8802            Digitizers::Pencil => 115,
8803            Digitizers::Highlighter => 116,
8804            Digitizers::ChiselMarker => 117,
8805            Digitizers::Brush => 118,
8806            Digitizers::NoPreference => 119,
8807            Digitizers::DigitizerDiagnostic => 128,
8808            Digitizers::DigitizerError => 129,
8809            Digitizers::ErrNormalStatus => 130,
8810            Digitizers::ErrTransducersExceeded => 131,
8811            Digitizers::ErrFullTransFeaturesUnavailable => 132,
8812            Digitizers::ErrChargeLow => 133,
8813            Digitizers::TransducerSoftwareInfo => 144,
8814            Digitizers::TransducerVendorId => 145,
8815            Digitizers::TransducerProductId => 146,
8816            Digitizers::DeviceSupportedProtocols => 147,
8817            Digitizers::TransducerSupportedProtocols => 148,
8818            Digitizers::NoProtocol => 149,
8819            Digitizers::WacomAESProtocol => 150,
8820            Digitizers::USIProtocol => 151,
8821            Digitizers::MicrosoftPenProtocol => 152,
8822            Digitizers::SupportedReportRates => 160,
8823            Digitizers::ReportRate => 161,
8824            Digitizers::TransducerConnected => 162,
8825            Digitizers::SwitchDisabled => 163,
8826            Digitizers::SwitchUnimplemented => 164,
8827            Digitizers::TransducerSwitches => 165,
8828            Digitizers::TransducerIndexSelector => 166,
8829            Digitizers::ButtonPressThreshold => 176,
8830        }
8831    }
8832}
8833
8834impl From<Digitizers> for u16 {
8835    /// Returns the 16bit value of this usage. This is identical
8836    /// to [Digitizers::usage_page_value()].
8837    fn from(digitizers: Digitizers) -> u16 {
8838        u16::from(&digitizers)
8839    }
8840}
8841
8842impl From<&Digitizers> for u32 {
8843    /// Returns the 32 bit value of this usage. This is identical
8844    /// to [Digitizers::usage_value()].
8845    fn from(digitizers: &Digitizers) -> u32 {
8846        let up = UsagePage::from(digitizers);
8847        let up = (u16::from(&up) as u32) << 16;
8848        let id = u16::from(digitizers) as u32;
8849        up | id
8850    }
8851}
8852
8853impl From<&Digitizers> for UsagePage {
8854    /// Always returns [UsagePage::Digitizers] and is
8855    /// identical to [Digitizers::usage_page()].
8856    fn from(_: &Digitizers) -> UsagePage {
8857        UsagePage::Digitizers
8858    }
8859}
8860
8861impl From<Digitizers> for UsagePage {
8862    /// Always returns [UsagePage::Digitizers] and is
8863    /// identical to [Digitizers::usage_page()].
8864    fn from(_: Digitizers) -> UsagePage {
8865        UsagePage::Digitizers
8866    }
8867}
8868
8869impl From<&Digitizers> for Usage {
8870    fn from(digitizers: &Digitizers) -> Usage {
8871        Usage::try_from(u32::from(digitizers)).unwrap()
8872    }
8873}
8874
8875impl From<Digitizers> for Usage {
8876    fn from(digitizers: Digitizers) -> Usage {
8877        Usage::from(&digitizers)
8878    }
8879}
8880
8881impl TryFrom<u16> for Digitizers {
8882    type Error = HutError;
8883
8884    fn try_from(usage_id: u16) -> Result<Digitizers> {
8885        match usage_id {
8886            1 => Ok(Digitizers::Digitizer),
8887            2 => Ok(Digitizers::Pen),
8888            3 => Ok(Digitizers::LightPen),
8889            4 => Ok(Digitizers::TouchScreen),
8890            5 => Ok(Digitizers::TouchPad),
8891            6 => Ok(Digitizers::Whiteboard),
8892            7 => Ok(Digitizers::CoordinateMeasuringMachine),
8893            8 => Ok(Digitizers::ThreeDDigitizer),
8894            9 => Ok(Digitizers::StereoPlotter),
8895            10 => Ok(Digitizers::ArticulatedArm),
8896            11 => Ok(Digitizers::Armature),
8897            12 => Ok(Digitizers::MultiplePointDigitizer),
8898            13 => Ok(Digitizers::FreeSpaceWand),
8899            14 => Ok(Digitizers::DeviceConfiguration),
8900            15 => Ok(Digitizers::CapacitiveHeatMapDigitizer),
8901            32 => Ok(Digitizers::Stylus),
8902            33 => Ok(Digitizers::Puck),
8903            34 => Ok(Digitizers::Finger),
8904            35 => Ok(Digitizers::Devicesettings),
8905            36 => Ok(Digitizers::CharacterGesture),
8906            48 => Ok(Digitizers::TipPressure),
8907            49 => Ok(Digitizers::BarrelPressure),
8908            50 => Ok(Digitizers::InRange),
8909            51 => Ok(Digitizers::Touch),
8910            52 => Ok(Digitizers::Untouch),
8911            53 => Ok(Digitizers::Tap),
8912            54 => Ok(Digitizers::Quality),
8913            55 => Ok(Digitizers::DataValid),
8914            56 => Ok(Digitizers::TransducerIndex),
8915            57 => Ok(Digitizers::TabletFunctionKeys),
8916            58 => Ok(Digitizers::ProgramChangeKeys),
8917            59 => Ok(Digitizers::BatteryStrength),
8918            60 => Ok(Digitizers::Invert),
8919            61 => Ok(Digitizers::XTilt),
8920            62 => Ok(Digitizers::YTilt),
8921            63 => Ok(Digitizers::Azimuth),
8922            64 => Ok(Digitizers::Altitude),
8923            65 => Ok(Digitizers::Twist),
8924            66 => Ok(Digitizers::TipSwitch),
8925            67 => Ok(Digitizers::SecondaryTipSwitch),
8926            68 => Ok(Digitizers::BarrelSwitch),
8927            69 => Ok(Digitizers::Eraser),
8928            70 => Ok(Digitizers::TabletPick),
8929            71 => Ok(Digitizers::TouchValid),
8930            72 => Ok(Digitizers::Width),
8931            73 => Ok(Digitizers::Height),
8932            81 => Ok(Digitizers::ContactIdentifier),
8933            82 => Ok(Digitizers::DeviceMode),
8934            83 => Ok(Digitizers::DeviceIdentifier),
8935            84 => Ok(Digitizers::ContactCount),
8936            85 => Ok(Digitizers::ContactCountMaximum),
8937            86 => Ok(Digitizers::ScanTime),
8938            87 => Ok(Digitizers::SurfaceSwitch),
8939            88 => Ok(Digitizers::ButtonSwitch),
8940            89 => Ok(Digitizers::PadType),
8941            90 => Ok(Digitizers::SecondaryBarrelSwitch),
8942            91 => Ok(Digitizers::TransducerSerialNumber),
8943            92 => Ok(Digitizers::PreferredColor),
8944            93 => Ok(Digitizers::PreferredColorisLocked),
8945            94 => Ok(Digitizers::PreferredLineWidth),
8946            95 => Ok(Digitizers::PreferredLineWidthisLocked),
8947            96 => Ok(Digitizers::LatencyMode),
8948            97 => Ok(Digitizers::GestureCharacterQuality),
8949            98 => Ok(Digitizers::CharacterGestureDataLength),
8950            99 => Ok(Digitizers::CharacterGestureData),
8951            100 => Ok(Digitizers::GestureCharacterEncoding),
8952            101 => Ok(Digitizers::UTF8CharacterGestureEncoding),
8953            102 => Ok(Digitizers::UTF16LittleEndianCharacterGestureEncoding),
8954            103 => Ok(Digitizers::UTF16BigEndianCharacterGestureEncoding),
8955            104 => Ok(Digitizers::UTF32LittleEndianCharacterGestureEncoding),
8956            105 => Ok(Digitizers::UTF32BigEndianCharacterGestureEncoding),
8957            106 => Ok(Digitizers::CapacitiveHeatMapProtocolVendorID),
8958            107 => Ok(Digitizers::CapacitiveHeatMapProtocolVersion),
8959            108 => Ok(Digitizers::CapacitiveHeatMapFrameData),
8960            109 => Ok(Digitizers::GestureCharacterEnable),
8961            110 => Ok(Digitizers::TransducerSerialNumberPart2),
8962            111 => Ok(Digitizers::NoPreferredColor),
8963            112 => Ok(Digitizers::PreferredLineStyle),
8964            113 => Ok(Digitizers::PreferredLineStyleisLocked),
8965            114 => Ok(Digitizers::Ink),
8966            115 => Ok(Digitizers::Pencil),
8967            116 => Ok(Digitizers::Highlighter),
8968            117 => Ok(Digitizers::ChiselMarker),
8969            118 => Ok(Digitizers::Brush),
8970            119 => Ok(Digitizers::NoPreference),
8971            128 => Ok(Digitizers::DigitizerDiagnostic),
8972            129 => Ok(Digitizers::DigitizerError),
8973            130 => Ok(Digitizers::ErrNormalStatus),
8974            131 => Ok(Digitizers::ErrTransducersExceeded),
8975            132 => Ok(Digitizers::ErrFullTransFeaturesUnavailable),
8976            133 => Ok(Digitizers::ErrChargeLow),
8977            144 => Ok(Digitizers::TransducerSoftwareInfo),
8978            145 => Ok(Digitizers::TransducerVendorId),
8979            146 => Ok(Digitizers::TransducerProductId),
8980            147 => Ok(Digitizers::DeviceSupportedProtocols),
8981            148 => Ok(Digitizers::TransducerSupportedProtocols),
8982            149 => Ok(Digitizers::NoProtocol),
8983            150 => Ok(Digitizers::WacomAESProtocol),
8984            151 => Ok(Digitizers::USIProtocol),
8985            152 => Ok(Digitizers::MicrosoftPenProtocol),
8986            160 => Ok(Digitizers::SupportedReportRates),
8987            161 => Ok(Digitizers::ReportRate),
8988            162 => Ok(Digitizers::TransducerConnected),
8989            163 => Ok(Digitizers::SwitchDisabled),
8990            164 => Ok(Digitizers::SwitchUnimplemented),
8991            165 => Ok(Digitizers::TransducerSwitches),
8992            166 => Ok(Digitizers::TransducerIndexSelector),
8993            176 => Ok(Digitizers::ButtonPressThreshold),
8994            n => Err(HutError::UnknownUsageId { usage_id: n }),
8995        }
8996    }
8997}
8998
8999impl BitOr<u16> for Digitizers {
9000    type Output = Usage;
9001
9002    /// A convenience function to combine a Usage Page with
9003    /// a value.
9004    ///
9005    /// This function panics if the Usage ID value results in
9006    /// an unknown Usage. Where error checking is required,
9007    /// use [UsagePage::to_usage_from_value].
9008    fn bitor(self, usage: u16) -> Usage {
9009        let up = u16::from(self) as u32;
9010        let u = usage as u32;
9011        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
9012    }
9013}
9014
9015/// *Usage Page `0xE`: "Haptics"*
9016///
9017/// **This enum is autogenerated from the HID Usage Tables**.
9018/// ```
9019/// # use hut::*;
9020/// let u1 = Usage::Haptics(Haptics::WaveformList);
9021/// let u2 = Usage::new_from_page_and_id(0xE, 0x10).unwrap();
9022/// let u3 = Usage::from(Haptics::WaveformList);
9023/// let u4: Usage = Haptics::WaveformList.into();
9024/// assert_eq!(u1, u2);
9025/// assert_eq!(u1, u3);
9026/// assert_eq!(u1, u4);
9027///
9028/// assert!(matches!(u1.usage_page(), UsagePage::Haptics));
9029/// assert_eq!(0xE, u1.usage_page_value());
9030/// assert_eq!(0x10, u1.usage_id_value());
9031/// assert_eq!((0xE << 16) | 0x10, u1.usage_value());
9032/// assert_eq!("Waveform List", u1.name());
9033/// ```
9034///
9035#[allow(non_camel_case_types)]
9036#[derive(Debug)]
9037#[non_exhaustive]
9038pub enum Haptics {
9039    /// Usage ID `0x1`: "Simple Haptic Controller"
9040    SimpleHapticController,
9041    /// Usage ID `0x10`: "Waveform List"
9042    WaveformList,
9043    /// Usage ID `0x11`: "Duration List"
9044    DurationList,
9045    /// Usage ID `0x20`: "Auto Trigger"
9046    AutoTrigger,
9047    /// Usage ID `0x21`: "Manual Trigger"
9048    ManualTrigger,
9049    /// Usage ID `0x22`: "Auto Trigger Associated Control"
9050    AutoTriggerAssociatedControl,
9051    /// Usage ID `0x23`: "Intensity"
9052    Intensity,
9053    /// Usage ID `0x24`: "Repeat Count"
9054    RepeatCount,
9055    /// Usage ID `0x25`: "Retrigger Period"
9056    RetriggerPeriod,
9057    /// Usage ID `0x26`: "Waveform Vendor Page"
9058    WaveformVendorPage,
9059    /// Usage ID `0x27`: "Waveform Vendor ID"
9060    WaveformVendorID,
9061    /// Usage ID `0x28`: "Waveform Cutoff Time"
9062    WaveformCutoffTime,
9063    /// Usage ID `0x1001`: "Waveform None"
9064    WaveformNone,
9065    /// Usage ID `0x1002`: "Waveform Stop"
9066    WaveformStop,
9067    /// Usage ID `0x1003`: "Waveform Click"
9068    WaveformClick,
9069    /// Usage ID `0x1004`: "Waveform Buzz Continuous"
9070    WaveformBuzzContinuous,
9071    /// Usage ID `0x1005`: "Waveform Rumble Continuous"
9072    WaveformRumbleContinuous,
9073    /// Usage ID `0x1006`: "Waveform Press"
9074    WaveformPress,
9075    /// Usage ID `0x1007`: "Waveform Release"
9076    WaveformRelease,
9077    /// Usage ID `0x1008`: "Waveform Hover"
9078    WaveformHover,
9079    /// Usage ID `0x1009`: "Waveform Success"
9080    WaveformSuccess,
9081    /// Usage ID `0x100A`: "Waveform Error"
9082    WaveformError,
9083    /// Usage ID `0x100B`: "Waveform Ink Continuous"
9084    WaveformInkContinuous,
9085    /// Usage ID `0x100C`: "Waveform Pencil Continuous"
9086    WaveformPencilContinuous,
9087    /// Usage ID `0x100D`: "Waveform Marker Continuous"
9088    WaveformMarkerContinuous,
9089    /// Usage ID `0x100E`: "Waveform Chisel Marker Continuous"
9090    WaveformChiselMarkerContinuous,
9091    /// Usage ID `0x100F`: "Waveform Brush Continuous"
9092    WaveformBrushContinuous,
9093    /// Usage ID `0x1010`: "Waveform Eraser Continuous"
9094    WaveformEraserContinuous,
9095    /// Usage ID `0x1011`: "Waveform Sparkle Continuous"
9096    WaveformSparkleContinuous,
9097}
9098
9099impl Haptics {
9100    #[cfg(feature = "std")]
9101    pub fn name(&self) -> String {
9102        match self {
9103            Haptics::SimpleHapticController => "Simple Haptic Controller",
9104            Haptics::WaveformList => "Waveform List",
9105            Haptics::DurationList => "Duration List",
9106            Haptics::AutoTrigger => "Auto Trigger",
9107            Haptics::ManualTrigger => "Manual Trigger",
9108            Haptics::AutoTriggerAssociatedControl => "Auto Trigger Associated Control",
9109            Haptics::Intensity => "Intensity",
9110            Haptics::RepeatCount => "Repeat Count",
9111            Haptics::RetriggerPeriod => "Retrigger Period",
9112            Haptics::WaveformVendorPage => "Waveform Vendor Page",
9113            Haptics::WaveformVendorID => "Waveform Vendor ID",
9114            Haptics::WaveformCutoffTime => "Waveform Cutoff Time",
9115            Haptics::WaveformNone => "Waveform None",
9116            Haptics::WaveformStop => "Waveform Stop",
9117            Haptics::WaveformClick => "Waveform Click",
9118            Haptics::WaveformBuzzContinuous => "Waveform Buzz Continuous",
9119            Haptics::WaveformRumbleContinuous => "Waveform Rumble Continuous",
9120            Haptics::WaveformPress => "Waveform Press",
9121            Haptics::WaveformRelease => "Waveform Release",
9122            Haptics::WaveformHover => "Waveform Hover",
9123            Haptics::WaveformSuccess => "Waveform Success",
9124            Haptics::WaveformError => "Waveform Error",
9125            Haptics::WaveformInkContinuous => "Waveform Ink Continuous",
9126            Haptics::WaveformPencilContinuous => "Waveform Pencil Continuous",
9127            Haptics::WaveformMarkerContinuous => "Waveform Marker Continuous",
9128            Haptics::WaveformChiselMarkerContinuous => "Waveform Chisel Marker Continuous",
9129            Haptics::WaveformBrushContinuous => "Waveform Brush Continuous",
9130            Haptics::WaveformEraserContinuous => "Waveform Eraser Continuous",
9131            Haptics::WaveformSparkleContinuous => "Waveform Sparkle Continuous",
9132        }
9133        .into()
9134    }
9135}
9136
9137#[cfg(feature = "std")]
9138impl fmt::Display for Haptics {
9139    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
9140        write!(f, "{}", self.name())
9141    }
9142}
9143
9144impl AsUsage for Haptics {
9145    /// Returns the 32 bit Usage value of this Usage
9146    fn usage_value(&self) -> u32 {
9147        u32::from(self)
9148    }
9149
9150    /// Returns the 16 bit Usage ID value of this Usage
9151    fn usage_id_value(&self) -> u16 {
9152        u16::from(self)
9153    }
9154
9155    /// Returns this usage as [Usage::Haptics(self)](Usage::Haptics)
9156    /// This is a convenience function to avoid having
9157    /// to implement `From` for every used type in the caller.
9158    ///
9159    /// ```
9160    /// # use hut::*;
9161    /// let gd_x = GenericDesktop::X;
9162    /// let usage = Usage::from(GenericDesktop::X);
9163    /// assert!(matches!(gd_x.usage(), usage));
9164    /// ```
9165    fn usage(&self) -> Usage {
9166        Usage::from(self)
9167    }
9168}
9169
9170impl AsUsagePage for Haptics {
9171    /// Returns the 16 bit value of this UsagePage
9172    ///
9173    /// This value is `0xE` for [Haptics]
9174    fn usage_page_value(&self) -> u16 {
9175        let up = UsagePage::from(self);
9176        u16::from(up)
9177    }
9178
9179    /// Returns [UsagePage::Haptics]]
9180    fn usage_page(&self) -> UsagePage {
9181        UsagePage::from(self)
9182    }
9183}
9184
9185impl From<&Haptics> for u16 {
9186    fn from(haptics: &Haptics) -> u16 {
9187        match *haptics {
9188            Haptics::SimpleHapticController => 1,
9189            Haptics::WaveformList => 16,
9190            Haptics::DurationList => 17,
9191            Haptics::AutoTrigger => 32,
9192            Haptics::ManualTrigger => 33,
9193            Haptics::AutoTriggerAssociatedControl => 34,
9194            Haptics::Intensity => 35,
9195            Haptics::RepeatCount => 36,
9196            Haptics::RetriggerPeriod => 37,
9197            Haptics::WaveformVendorPage => 38,
9198            Haptics::WaveformVendorID => 39,
9199            Haptics::WaveformCutoffTime => 40,
9200            Haptics::WaveformNone => 4097,
9201            Haptics::WaveformStop => 4098,
9202            Haptics::WaveformClick => 4099,
9203            Haptics::WaveformBuzzContinuous => 4100,
9204            Haptics::WaveformRumbleContinuous => 4101,
9205            Haptics::WaveformPress => 4102,
9206            Haptics::WaveformRelease => 4103,
9207            Haptics::WaveformHover => 4104,
9208            Haptics::WaveformSuccess => 4105,
9209            Haptics::WaveformError => 4106,
9210            Haptics::WaveformInkContinuous => 4107,
9211            Haptics::WaveformPencilContinuous => 4108,
9212            Haptics::WaveformMarkerContinuous => 4109,
9213            Haptics::WaveformChiselMarkerContinuous => 4110,
9214            Haptics::WaveformBrushContinuous => 4111,
9215            Haptics::WaveformEraserContinuous => 4112,
9216            Haptics::WaveformSparkleContinuous => 4113,
9217        }
9218    }
9219}
9220
9221impl From<Haptics> for u16 {
9222    /// Returns the 16bit value of this usage. This is identical
9223    /// to [Haptics::usage_page_value()].
9224    fn from(haptics: Haptics) -> u16 {
9225        u16::from(&haptics)
9226    }
9227}
9228
9229impl From<&Haptics> for u32 {
9230    /// Returns the 32 bit value of this usage. This is identical
9231    /// to [Haptics::usage_value()].
9232    fn from(haptics: &Haptics) -> u32 {
9233        let up = UsagePage::from(haptics);
9234        let up = (u16::from(&up) as u32) << 16;
9235        let id = u16::from(haptics) as u32;
9236        up | id
9237    }
9238}
9239
9240impl From<&Haptics> for UsagePage {
9241    /// Always returns [UsagePage::Haptics] and is
9242    /// identical to [Haptics::usage_page()].
9243    fn from(_: &Haptics) -> UsagePage {
9244        UsagePage::Haptics
9245    }
9246}
9247
9248impl From<Haptics> for UsagePage {
9249    /// Always returns [UsagePage::Haptics] and is
9250    /// identical to [Haptics::usage_page()].
9251    fn from(_: Haptics) -> UsagePage {
9252        UsagePage::Haptics
9253    }
9254}
9255
9256impl From<&Haptics> for Usage {
9257    fn from(haptics: &Haptics) -> Usage {
9258        Usage::try_from(u32::from(haptics)).unwrap()
9259    }
9260}
9261
9262impl From<Haptics> for Usage {
9263    fn from(haptics: Haptics) -> Usage {
9264        Usage::from(&haptics)
9265    }
9266}
9267
9268impl TryFrom<u16> for Haptics {
9269    type Error = HutError;
9270
9271    fn try_from(usage_id: u16) -> Result<Haptics> {
9272        match usage_id {
9273            1 => Ok(Haptics::SimpleHapticController),
9274            16 => Ok(Haptics::WaveformList),
9275            17 => Ok(Haptics::DurationList),
9276            32 => Ok(Haptics::AutoTrigger),
9277            33 => Ok(Haptics::ManualTrigger),
9278            34 => Ok(Haptics::AutoTriggerAssociatedControl),
9279            35 => Ok(Haptics::Intensity),
9280            36 => Ok(Haptics::RepeatCount),
9281            37 => Ok(Haptics::RetriggerPeriod),
9282            38 => Ok(Haptics::WaveformVendorPage),
9283            39 => Ok(Haptics::WaveformVendorID),
9284            40 => Ok(Haptics::WaveformCutoffTime),
9285            4097 => Ok(Haptics::WaveformNone),
9286            4098 => Ok(Haptics::WaveformStop),
9287            4099 => Ok(Haptics::WaveformClick),
9288            4100 => Ok(Haptics::WaveformBuzzContinuous),
9289            4101 => Ok(Haptics::WaveformRumbleContinuous),
9290            4102 => Ok(Haptics::WaveformPress),
9291            4103 => Ok(Haptics::WaveformRelease),
9292            4104 => Ok(Haptics::WaveformHover),
9293            4105 => Ok(Haptics::WaveformSuccess),
9294            4106 => Ok(Haptics::WaveformError),
9295            4107 => Ok(Haptics::WaveformInkContinuous),
9296            4108 => Ok(Haptics::WaveformPencilContinuous),
9297            4109 => Ok(Haptics::WaveformMarkerContinuous),
9298            4110 => Ok(Haptics::WaveformChiselMarkerContinuous),
9299            4111 => Ok(Haptics::WaveformBrushContinuous),
9300            4112 => Ok(Haptics::WaveformEraserContinuous),
9301            4113 => Ok(Haptics::WaveformSparkleContinuous),
9302            n => Err(HutError::UnknownUsageId { usage_id: n }),
9303        }
9304    }
9305}
9306
9307impl BitOr<u16> for Haptics {
9308    type Output = Usage;
9309
9310    /// A convenience function to combine a Usage Page with
9311    /// a value.
9312    ///
9313    /// This function panics if the Usage ID value results in
9314    /// an unknown Usage. Where error checking is required,
9315    /// use [UsagePage::to_usage_from_value].
9316    fn bitor(self, usage: u16) -> Usage {
9317        let up = u16::from(self) as u32;
9318        let u = usage as u32;
9319        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
9320    }
9321}
9322
9323/// *Usage Page `0xF`: "Physical Input Device"*
9324///
9325/// **This enum is autogenerated from the HID Usage Tables**.
9326/// ```
9327/// # use hut::*;
9328/// let u1 = Usage::PhysicalInputDevice(PhysicalInputDevice::Normal);
9329/// let u2 = Usage::new_from_page_and_id(0xF, 0x20).unwrap();
9330/// let u3 = Usage::from(PhysicalInputDevice::Normal);
9331/// let u4: Usage = PhysicalInputDevice::Normal.into();
9332/// assert_eq!(u1, u2);
9333/// assert_eq!(u1, u3);
9334/// assert_eq!(u1, u4);
9335///
9336/// assert!(matches!(u1.usage_page(), UsagePage::PhysicalInputDevice));
9337/// assert_eq!(0xF, u1.usage_page_value());
9338/// assert_eq!(0x20, u1.usage_id_value());
9339/// assert_eq!((0xF << 16) | 0x20, u1.usage_value());
9340/// assert_eq!("Normal", u1.name());
9341/// ```
9342///
9343#[allow(non_camel_case_types)]
9344#[derive(Debug)]
9345#[non_exhaustive]
9346pub enum PhysicalInputDevice {
9347    /// Usage ID `0x1`: "Physical Input Device"
9348    PhysicalInputDevice,
9349    /// Usage ID `0x20`: "Normal"
9350    Normal,
9351    /// Usage ID `0x21`: "Set Effect Report"
9352    SetEffectReport,
9353    /// Usage ID `0x22`: "Effect Parameter Block Index"
9354    EffectParameterBlockIndex,
9355    /// Usage ID `0x23`: "Parameter Block Offset"
9356    ParameterBlockOffset,
9357    /// Usage ID `0x24`: "ROM Flag"
9358    ROMFlag,
9359    /// Usage ID `0x25`: "Effect Type"
9360    EffectType,
9361    /// Usage ID `0x26`: "ET Constant-Force"
9362    ETConstantForce,
9363    /// Usage ID `0x27`: "ET Ramp"
9364    ETRamp,
9365    /// Usage ID `0x28`: "ET Custom-Force"
9366    ETCustomForce,
9367    /// Usage ID `0x30`: "ET Square"
9368    ETSquare,
9369    /// Usage ID `0x31`: "ET Sine"
9370    ETSine,
9371    /// Usage ID `0x32`: "ET Triangle"
9372    ETTriangle,
9373    /// Usage ID `0x33`: "ET Sawtooth Up"
9374    ETSawtoothUp,
9375    /// Usage ID `0x34`: "ET Sawtooth Down"
9376    ETSawtoothDown,
9377    /// Usage ID `0x40`: "ET Spring"
9378    ETSpring,
9379    /// Usage ID `0x41`: "ET Damper"
9380    ETDamper,
9381    /// Usage ID `0x42`: "ET Inertia"
9382    ETInertia,
9383    /// Usage ID `0x43`: "ET Friction"
9384    ETFriction,
9385    /// Usage ID `0x50`: "Duration"
9386    Duration,
9387    /// Usage ID `0x51`: "Sample Period"
9388    SamplePeriod,
9389    /// Usage ID `0x52`: "Gain"
9390    Gain,
9391    /// Usage ID `0x53`: "Trigger Button"
9392    TriggerButton,
9393    /// Usage ID `0x54`: "Trigger Repeat Interval"
9394    TriggerRepeatInterval,
9395    /// Usage ID `0x55`: "Axes Enable"
9396    AxesEnable,
9397    /// Usage ID `0x56`: "Direction Enable"
9398    DirectionEnable,
9399    /// Usage ID `0x57`: "Direction"
9400    Direction,
9401    /// Usage ID `0x58`: "Type Specific Block Offset"
9402    TypeSpecificBlockOffset,
9403    /// Usage ID `0x59`: "Block Type"
9404    BlockType,
9405    /// Usage ID `0x5A`: "Set Envelope Report"
9406    SetEnvelopeReport,
9407    /// Usage ID `0x5B`: "Attack Level"
9408    AttackLevel,
9409    /// Usage ID `0x5C`: "Attack Time"
9410    AttackTime,
9411    /// Usage ID `0x5D`: "Fade Level"
9412    FadeLevel,
9413    /// Usage ID `0x5E`: "Fade Time"
9414    FadeTime,
9415    /// Usage ID `0x5F`: "Set Condition Report"
9416    SetConditionReport,
9417    /// Usage ID `0x60`: "Center-Point Offset"
9418    CenterPointOffset,
9419    /// Usage ID `0x61`: "Positive Coefficient"
9420    PositiveCoefficient,
9421    /// Usage ID `0x62`: "Negative Coefficient"
9422    NegativeCoefficient,
9423    /// Usage ID `0x63`: "Positive Saturation"
9424    PositiveSaturation,
9425    /// Usage ID `0x64`: "Negative Saturation"
9426    NegativeSaturation,
9427    /// Usage ID `0x65`: "Dead Band"
9428    DeadBand,
9429    /// Usage ID `0x66`: "Download Force Sample"
9430    DownloadForceSample,
9431    /// Usage ID `0x67`: "Isoch Custom-Force Enable"
9432    IsochCustomForceEnable,
9433    /// Usage ID `0x68`: "Custom-Force Data Report"
9434    CustomForceDataReport,
9435    /// Usage ID `0x69`: "Custom-Force Data"
9436    CustomForceData,
9437    /// Usage ID `0x6A`: "Custom-Force Vendor Defined Data"
9438    CustomForceVendorDefinedData,
9439    /// Usage ID `0x6B`: "Set Custom-Force Report"
9440    SetCustomForceReport,
9441    /// Usage ID `0x6C`: "Custom-Force Data Offset"
9442    CustomForceDataOffset,
9443    /// Usage ID `0x6D`: "Sample Count"
9444    SampleCount,
9445    /// Usage ID `0x6E`: "Set Periodic Report"
9446    SetPeriodicReport,
9447    /// Usage ID `0x6F`: "Offset"
9448    Offset,
9449    /// Usage ID `0x70`: "Magnitude"
9450    Magnitude,
9451    /// Usage ID `0x71`: "Phase"
9452    Phase,
9453    /// Usage ID `0x72`: "Period"
9454    Period,
9455    /// Usage ID `0x73`: "Set Constant-Force Report"
9456    SetConstantForceReport,
9457    /// Usage ID `0x74`: "Set Ramp-Force Report"
9458    SetRampForceReport,
9459    /// Usage ID `0x75`: "Ramp Start"
9460    RampStart,
9461    /// Usage ID `0x76`: "Ramp End"
9462    RampEnd,
9463    /// Usage ID `0x77`: "Effect Operation Report"
9464    EffectOperationReport,
9465    /// Usage ID `0x78`: "Effect Operation"
9466    EffectOperation,
9467    /// Usage ID `0x79`: "Op Effect Start"
9468    OpEffectStart,
9469    /// Usage ID `0x7A`: "Op Effect Start Solo"
9470    OpEffectStartSolo,
9471    /// Usage ID `0x7B`: "Op Effect Stop"
9472    OpEffectStop,
9473    /// Usage ID `0x7C`: "Loop Count"
9474    LoopCount,
9475    /// Usage ID `0x7D`: "Device Gain Report"
9476    DeviceGainReport,
9477    /// Usage ID `0x7E`: "Device Gain"
9478    DeviceGain,
9479    /// Usage ID `0x7F`: "Parameter Block Pools Report"
9480    ParameterBlockPoolsReport,
9481    /// Usage ID `0x80`: "RAM Pool Size"
9482    RAMPoolSize,
9483    /// Usage ID `0x81`: "ROM Pool Size"
9484    ROMPoolSize,
9485    /// Usage ID `0x82`: "ROM Effect Block Count"
9486    ROMEffectBlockCount,
9487    /// Usage ID `0x83`: "Simultaneous Effects Max"
9488    SimultaneousEffectsMax,
9489    /// Usage ID `0x84`: "Pool Alignment"
9490    PoolAlignment,
9491    /// Usage ID `0x85`: "Parameter Block Move Report"
9492    ParameterBlockMoveReport,
9493    /// Usage ID `0x86`: "Move Source"
9494    MoveSource,
9495    /// Usage ID `0x87`: "Move Destination"
9496    MoveDestination,
9497    /// Usage ID `0x88`: "Move Length"
9498    MoveLength,
9499    /// Usage ID `0x89`: "Effect Parameter Block Load Report"
9500    EffectParameterBlockLoadReport,
9501    /// Usage ID `0x8B`: "Effect Parameter Block Load Status"
9502    EffectParameterBlockLoadStatus,
9503    /// Usage ID `0x8C`: "Block Load Success"
9504    BlockLoadSuccess,
9505    /// Usage ID `0x8D`: "Block Load Full"
9506    BlockLoadFull,
9507    /// Usage ID `0x8E`: "Block Load Error"
9508    BlockLoadError,
9509    /// Usage ID `0x8F`: "Block Handle"
9510    BlockHandle,
9511    /// Usage ID `0x90`: "Effect Parameter Block Free Report"
9512    EffectParameterBlockFreeReport,
9513    /// Usage ID `0x91`: "Type Specific Block Handle"
9514    TypeSpecificBlockHandle,
9515    /// Usage ID `0x92`: "PID State Report"
9516    PIDStateReport,
9517    /// Usage ID `0x94`: "Effect Playing"
9518    EffectPlaying,
9519    /// Usage ID `0x95`: "PID Device Control Report"
9520    PIDDeviceControlReport,
9521    /// Usage ID `0x96`: "PID Device Control"
9522    PIDDeviceControl,
9523    /// Usage ID `0x97`: "DC Enable Actuators"
9524    DCEnableActuators,
9525    /// Usage ID `0x98`: "DC Disable Actuators"
9526    DCDisableActuators,
9527    /// Usage ID `0x99`: "DC Stop All Effects"
9528    DCStopAllEffects,
9529    /// Usage ID `0x9A`: "DC Reset"
9530    DCReset,
9531    /// Usage ID `0x9B`: "DC Pause"
9532    DCPause,
9533    /// Usage ID `0x9C`: "DC Continue"
9534    DCContinue,
9535    /// Usage ID `0x9F`: "Device Paused"
9536    DevicePaused,
9537    /// Usage ID `0xA0`: "Actuators Enabled"
9538    ActuatorsEnabled,
9539    /// Usage ID `0xA4`: "Safety Switch"
9540    SafetySwitch,
9541    /// Usage ID `0xA5`: "Actuator Override Switch"
9542    ActuatorOverrideSwitch,
9543    /// Usage ID `0xA6`: "Actuator Power"
9544    ActuatorPower,
9545    /// Usage ID `0xA7`: "Start Delay"
9546    StartDelay,
9547    /// Usage ID `0xA8`: "Parameter Block Size"
9548    ParameterBlockSize,
9549    /// Usage ID `0xA9`: "Device-Managed Pool"
9550    DeviceManagedPool,
9551    /// Usage ID `0xAA`: "Shared Parameter Blocks"
9552    SharedParameterBlocks,
9553    /// Usage ID `0xAB`: "Create New Effect Parameter Block Report"
9554    CreateNewEffectParameterBlockReport,
9555    /// Usage ID `0xAC`: "RAM Pool Available"
9556    RAMPoolAvailable,
9557}
9558
9559impl PhysicalInputDevice {
9560    #[cfg(feature = "std")]
9561    pub fn name(&self) -> String {
9562        match self {
9563            PhysicalInputDevice::PhysicalInputDevice => "Physical Input Device",
9564            PhysicalInputDevice::Normal => "Normal",
9565            PhysicalInputDevice::SetEffectReport => "Set Effect Report",
9566            PhysicalInputDevice::EffectParameterBlockIndex => "Effect Parameter Block Index",
9567            PhysicalInputDevice::ParameterBlockOffset => "Parameter Block Offset",
9568            PhysicalInputDevice::ROMFlag => "ROM Flag",
9569            PhysicalInputDevice::EffectType => "Effect Type",
9570            PhysicalInputDevice::ETConstantForce => "ET Constant-Force",
9571            PhysicalInputDevice::ETRamp => "ET Ramp",
9572            PhysicalInputDevice::ETCustomForce => "ET Custom-Force",
9573            PhysicalInputDevice::ETSquare => "ET Square",
9574            PhysicalInputDevice::ETSine => "ET Sine",
9575            PhysicalInputDevice::ETTriangle => "ET Triangle",
9576            PhysicalInputDevice::ETSawtoothUp => "ET Sawtooth Up",
9577            PhysicalInputDevice::ETSawtoothDown => "ET Sawtooth Down",
9578            PhysicalInputDevice::ETSpring => "ET Spring",
9579            PhysicalInputDevice::ETDamper => "ET Damper",
9580            PhysicalInputDevice::ETInertia => "ET Inertia",
9581            PhysicalInputDevice::ETFriction => "ET Friction",
9582            PhysicalInputDevice::Duration => "Duration",
9583            PhysicalInputDevice::SamplePeriod => "Sample Period",
9584            PhysicalInputDevice::Gain => "Gain",
9585            PhysicalInputDevice::TriggerButton => "Trigger Button",
9586            PhysicalInputDevice::TriggerRepeatInterval => "Trigger Repeat Interval",
9587            PhysicalInputDevice::AxesEnable => "Axes Enable",
9588            PhysicalInputDevice::DirectionEnable => "Direction Enable",
9589            PhysicalInputDevice::Direction => "Direction",
9590            PhysicalInputDevice::TypeSpecificBlockOffset => "Type Specific Block Offset",
9591            PhysicalInputDevice::BlockType => "Block Type",
9592            PhysicalInputDevice::SetEnvelopeReport => "Set Envelope Report",
9593            PhysicalInputDevice::AttackLevel => "Attack Level",
9594            PhysicalInputDevice::AttackTime => "Attack Time",
9595            PhysicalInputDevice::FadeLevel => "Fade Level",
9596            PhysicalInputDevice::FadeTime => "Fade Time",
9597            PhysicalInputDevice::SetConditionReport => "Set Condition Report",
9598            PhysicalInputDevice::CenterPointOffset => "Center-Point Offset",
9599            PhysicalInputDevice::PositiveCoefficient => "Positive Coefficient",
9600            PhysicalInputDevice::NegativeCoefficient => "Negative Coefficient",
9601            PhysicalInputDevice::PositiveSaturation => "Positive Saturation",
9602            PhysicalInputDevice::NegativeSaturation => "Negative Saturation",
9603            PhysicalInputDevice::DeadBand => "Dead Band",
9604            PhysicalInputDevice::DownloadForceSample => "Download Force Sample",
9605            PhysicalInputDevice::IsochCustomForceEnable => "Isoch Custom-Force Enable",
9606            PhysicalInputDevice::CustomForceDataReport => "Custom-Force Data Report",
9607            PhysicalInputDevice::CustomForceData => "Custom-Force Data",
9608            PhysicalInputDevice::CustomForceVendorDefinedData => "Custom-Force Vendor Defined Data",
9609            PhysicalInputDevice::SetCustomForceReport => "Set Custom-Force Report",
9610            PhysicalInputDevice::CustomForceDataOffset => "Custom-Force Data Offset",
9611            PhysicalInputDevice::SampleCount => "Sample Count",
9612            PhysicalInputDevice::SetPeriodicReport => "Set Periodic Report",
9613            PhysicalInputDevice::Offset => "Offset",
9614            PhysicalInputDevice::Magnitude => "Magnitude",
9615            PhysicalInputDevice::Phase => "Phase",
9616            PhysicalInputDevice::Period => "Period",
9617            PhysicalInputDevice::SetConstantForceReport => "Set Constant-Force Report",
9618            PhysicalInputDevice::SetRampForceReport => "Set Ramp-Force Report",
9619            PhysicalInputDevice::RampStart => "Ramp Start",
9620            PhysicalInputDevice::RampEnd => "Ramp End",
9621            PhysicalInputDevice::EffectOperationReport => "Effect Operation Report",
9622            PhysicalInputDevice::EffectOperation => "Effect Operation",
9623            PhysicalInputDevice::OpEffectStart => "Op Effect Start",
9624            PhysicalInputDevice::OpEffectStartSolo => "Op Effect Start Solo",
9625            PhysicalInputDevice::OpEffectStop => "Op Effect Stop",
9626            PhysicalInputDevice::LoopCount => "Loop Count",
9627            PhysicalInputDevice::DeviceGainReport => "Device Gain Report",
9628            PhysicalInputDevice::DeviceGain => "Device Gain",
9629            PhysicalInputDevice::ParameterBlockPoolsReport => "Parameter Block Pools Report",
9630            PhysicalInputDevice::RAMPoolSize => "RAM Pool Size",
9631            PhysicalInputDevice::ROMPoolSize => "ROM Pool Size",
9632            PhysicalInputDevice::ROMEffectBlockCount => "ROM Effect Block Count",
9633            PhysicalInputDevice::SimultaneousEffectsMax => "Simultaneous Effects Max",
9634            PhysicalInputDevice::PoolAlignment => "Pool Alignment",
9635            PhysicalInputDevice::ParameterBlockMoveReport => "Parameter Block Move Report",
9636            PhysicalInputDevice::MoveSource => "Move Source",
9637            PhysicalInputDevice::MoveDestination => "Move Destination",
9638            PhysicalInputDevice::MoveLength => "Move Length",
9639            PhysicalInputDevice::EffectParameterBlockLoadReport => {
9640                "Effect Parameter Block Load Report"
9641            }
9642            PhysicalInputDevice::EffectParameterBlockLoadStatus => {
9643                "Effect Parameter Block Load Status"
9644            }
9645            PhysicalInputDevice::BlockLoadSuccess => "Block Load Success",
9646            PhysicalInputDevice::BlockLoadFull => "Block Load Full",
9647            PhysicalInputDevice::BlockLoadError => "Block Load Error",
9648            PhysicalInputDevice::BlockHandle => "Block Handle",
9649            PhysicalInputDevice::EffectParameterBlockFreeReport => {
9650                "Effect Parameter Block Free Report"
9651            }
9652            PhysicalInputDevice::TypeSpecificBlockHandle => "Type Specific Block Handle",
9653            PhysicalInputDevice::PIDStateReport => "PID State Report",
9654            PhysicalInputDevice::EffectPlaying => "Effect Playing",
9655            PhysicalInputDevice::PIDDeviceControlReport => "PID Device Control Report",
9656            PhysicalInputDevice::PIDDeviceControl => "PID Device Control",
9657            PhysicalInputDevice::DCEnableActuators => "DC Enable Actuators",
9658            PhysicalInputDevice::DCDisableActuators => "DC Disable Actuators",
9659            PhysicalInputDevice::DCStopAllEffects => "DC Stop All Effects",
9660            PhysicalInputDevice::DCReset => "DC Reset",
9661            PhysicalInputDevice::DCPause => "DC Pause",
9662            PhysicalInputDevice::DCContinue => "DC Continue",
9663            PhysicalInputDevice::DevicePaused => "Device Paused",
9664            PhysicalInputDevice::ActuatorsEnabled => "Actuators Enabled",
9665            PhysicalInputDevice::SafetySwitch => "Safety Switch",
9666            PhysicalInputDevice::ActuatorOverrideSwitch => "Actuator Override Switch",
9667            PhysicalInputDevice::ActuatorPower => "Actuator Power",
9668            PhysicalInputDevice::StartDelay => "Start Delay",
9669            PhysicalInputDevice::ParameterBlockSize => "Parameter Block Size",
9670            PhysicalInputDevice::DeviceManagedPool => "Device-Managed Pool",
9671            PhysicalInputDevice::SharedParameterBlocks => "Shared Parameter Blocks",
9672            PhysicalInputDevice::CreateNewEffectParameterBlockReport => {
9673                "Create New Effect Parameter Block Report"
9674            }
9675            PhysicalInputDevice::RAMPoolAvailable => "RAM Pool Available",
9676        }
9677        .into()
9678    }
9679}
9680
9681#[cfg(feature = "std")]
9682impl fmt::Display for PhysicalInputDevice {
9683    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
9684        write!(f, "{}", self.name())
9685    }
9686}
9687
9688impl AsUsage for PhysicalInputDevice {
9689    /// Returns the 32 bit Usage value of this Usage
9690    fn usage_value(&self) -> u32 {
9691        u32::from(self)
9692    }
9693
9694    /// Returns the 16 bit Usage ID value of this Usage
9695    fn usage_id_value(&self) -> u16 {
9696        u16::from(self)
9697    }
9698
9699    /// Returns this usage as [Usage::PhysicalInputDevice(self)](Usage::PhysicalInputDevice)
9700    /// This is a convenience function to avoid having
9701    /// to implement `From` for every used type in the caller.
9702    ///
9703    /// ```
9704    /// # use hut::*;
9705    /// let gd_x = GenericDesktop::X;
9706    /// let usage = Usage::from(GenericDesktop::X);
9707    /// assert!(matches!(gd_x.usage(), usage));
9708    /// ```
9709    fn usage(&self) -> Usage {
9710        Usage::from(self)
9711    }
9712}
9713
9714impl AsUsagePage for PhysicalInputDevice {
9715    /// Returns the 16 bit value of this UsagePage
9716    ///
9717    /// This value is `0xF` for [PhysicalInputDevice]
9718    fn usage_page_value(&self) -> u16 {
9719        let up = UsagePage::from(self);
9720        u16::from(up)
9721    }
9722
9723    /// Returns [UsagePage::PhysicalInputDevice]]
9724    fn usage_page(&self) -> UsagePage {
9725        UsagePage::from(self)
9726    }
9727}
9728
9729impl From<&PhysicalInputDevice> for u16 {
9730    fn from(physicalinputdevice: &PhysicalInputDevice) -> u16 {
9731        match *physicalinputdevice {
9732            PhysicalInputDevice::PhysicalInputDevice => 1,
9733            PhysicalInputDevice::Normal => 32,
9734            PhysicalInputDevice::SetEffectReport => 33,
9735            PhysicalInputDevice::EffectParameterBlockIndex => 34,
9736            PhysicalInputDevice::ParameterBlockOffset => 35,
9737            PhysicalInputDevice::ROMFlag => 36,
9738            PhysicalInputDevice::EffectType => 37,
9739            PhysicalInputDevice::ETConstantForce => 38,
9740            PhysicalInputDevice::ETRamp => 39,
9741            PhysicalInputDevice::ETCustomForce => 40,
9742            PhysicalInputDevice::ETSquare => 48,
9743            PhysicalInputDevice::ETSine => 49,
9744            PhysicalInputDevice::ETTriangle => 50,
9745            PhysicalInputDevice::ETSawtoothUp => 51,
9746            PhysicalInputDevice::ETSawtoothDown => 52,
9747            PhysicalInputDevice::ETSpring => 64,
9748            PhysicalInputDevice::ETDamper => 65,
9749            PhysicalInputDevice::ETInertia => 66,
9750            PhysicalInputDevice::ETFriction => 67,
9751            PhysicalInputDevice::Duration => 80,
9752            PhysicalInputDevice::SamplePeriod => 81,
9753            PhysicalInputDevice::Gain => 82,
9754            PhysicalInputDevice::TriggerButton => 83,
9755            PhysicalInputDevice::TriggerRepeatInterval => 84,
9756            PhysicalInputDevice::AxesEnable => 85,
9757            PhysicalInputDevice::DirectionEnable => 86,
9758            PhysicalInputDevice::Direction => 87,
9759            PhysicalInputDevice::TypeSpecificBlockOffset => 88,
9760            PhysicalInputDevice::BlockType => 89,
9761            PhysicalInputDevice::SetEnvelopeReport => 90,
9762            PhysicalInputDevice::AttackLevel => 91,
9763            PhysicalInputDevice::AttackTime => 92,
9764            PhysicalInputDevice::FadeLevel => 93,
9765            PhysicalInputDevice::FadeTime => 94,
9766            PhysicalInputDevice::SetConditionReport => 95,
9767            PhysicalInputDevice::CenterPointOffset => 96,
9768            PhysicalInputDevice::PositiveCoefficient => 97,
9769            PhysicalInputDevice::NegativeCoefficient => 98,
9770            PhysicalInputDevice::PositiveSaturation => 99,
9771            PhysicalInputDevice::NegativeSaturation => 100,
9772            PhysicalInputDevice::DeadBand => 101,
9773            PhysicalInputDevice::DownloadForceSample => 102,
9774            PhysicalInputDevice::IsochCustomForceEnable => 103,
9775            PhysicalInputDevice::CustomForceDataReport => 104,
9776            PhysicalInputDevice::CustomForceData => 105,
9777            PhysicalInputDevice::CustomForceVendorDefinedData => 106,
9778            PhysicalInputDevice::SetCustomForceReport => 107,
9779            PhysicalInputDevice::CustomForceDataOffset => 108,
9780            PhysicalInputDevice::SampleCount => 109,
9781            PhysicalInputDevice::SetPeriodicReport => 110,
9782            PhysicalInputDevice::Offset => 111,
9783            PhysicalInputDevice::Magnitude => 112,
9784            PhysicalInputDevice::Phase => 113,
9785            PhysicalInputDevice::Period => 114,
9786            PhysicalInputDevice::SetConstantForceReport => 115,
9787            PhysicalInputDevice::SetRampForceReport => 116,
9788            PhysicalInputDevice::RampStart => 117,
9789            PhysicalInputDevice::RampEnd => 118,
9790            PhysicalInputDevice::EffectOperationReport => 119,
9791            PhysicalInputDevice::EffectOperation => 120,
9792            PhysicalInputDevice::OpEffectStart => 121,
9793            PhysicalInputDevice::OpEffectStartSolo => 122,
9794            PhysicalInputDevice::OpEffectStop => 123,
9795            PhysicalInputDevice::LoopCount => 124,
9796            PhysicalInputDevice::DeviceGainReport => 125,
9797            PhysicalInputDevice::DeviceGain => 126,
9798            PhysicalInputDevice::ParameterBlockPoolsReport => 127,
9799            PhysicalInputDevice::RAMPoolSize => 128,
9800            PhysicalInputDevice::ROMPoolSize => 129,
9801            PhysicalInputDevice::ROMEffectBlockCount => 130,
9802            PhysicalInputDevice::SimultaneousEffectsMax => 131,
9803            PhysicalInputDevice::PoolAlignment => 132,
9804            PhysicalInputDevice::ParameterBlockMoveReport => 133,
9805            PhysicalInputDevice::MoveSource => 134,
9806            PhysicalInputDevice::MoveDestination => 135,
9807            PhysicalInputDevice::MoveLength => 136,
9808            PhysicalInputDevice::EffectParameterBlockLoadReport => 137,
9809            PhysicalInputDevice::EffectParameterBlockLoadStatus => 139,
9810            PhysicalInputDevice::BlockLoadSuccess => 140,
9811            PhysicalInputDevice::BlockLoadFull => 141,
9812            PhysicalInputDevice::BlockLoadError => 142,
9813            PhysicalInputDevice::BlockHandle => 143,
9814            PhysicalInputDevice::EffectParameterBlockFreeReport => 144,
9815            PhysicalInputDevice::TypeSpecificBlockHandle => 145,
9816            PhysicalInputDevice::PIDStateReport => 146,
9817            PhysicalInputDevice::EffectPlaying => 148,
9818            PhysicalInputDevice::PIDDeviceControlReport => 149,
9819            PhysicalInputDevice::PIDDeviceControl => 150,
9820            PhysicalInputDevice::DCEnableActuators => 151,
9821            PhysicalInputDevice::DCDisableActuators => 152,
9822            PhysicalInputDevice::DCStopAllEffects => 153,
9823            PhysicalInputDevice::DCReset => 154,
9824            PhysicalInputDevice::DCPause => 155,
9825            PhysicalInputDevice::DCContinue => 156,
9826            PhysicalInputDevice::DevicePaused => 159,
9827            PhysicalInputDevice::ActuatorsEnabled => 160,
9828            PhysicalInputDevice::SafetySwitch => 164,
9829            PhysicalInputDevice::ActuatorOverrideSwitch => 165,
9830            PhysicalInputDevice::ActuatorPower => 166,
9831            PhysicalInputDevice::StartDelay => 167,
9832            PhysicalInputDevice::ParameterBlockSize => 168,
9833            PhysicalInputDevice::DeviceManagedPool => 169,
9834            PhysicalInputDevice::SharedParameterBlocks => 170,
9835            PhysicalInputDevice::CreateNewEffectParameterBlockReport => 171,
9836            PhysicalInputDevice::RAMPoolAvailable => 172,
9837        }
9838    }
9839}
9840
9841impl From<PhysicalInputDevice> for u16 {
9842    /// Returns the 16bit value of this usage. This is identical
9843    /// to [PhysicalInputDevice::usage_page_value()].
9844    fn from(physicalinputdevice: PhysicalInputDevice) -> u16 {
9845        u16::from(&physicalinputdevice)
9846    }
9847}
9848
9849impl From<&PhysicalInputDevice> for u32 {
9850    /// Returns the 32 bit value of this usage. This is identical
9851    /// to [PhysicalInputDevice::usage_value()].
9852    fn from(physicalinputdevice: &PhysicalInputDevice) -> u32 {
9853        let up = UsagePage::from(physicalinputdevice);
9854        let up = (u16::from(&up) as u32) << 16;
9855        let id = u16::from(physicalinputdevice) as u32;
9856        up | id
9857    }
9858}
9859
9860impl From<&PhysicalInputDevice> for UsagePage {
9861    /// Always returns [UsagePage::PhysicalInputDevice] and is
9862    /// identical to [PhysicalInputDevice::usage_page()].
9863    fn from(_: &PhysicalInputDevice) -> UsagePage {
9864        UsagePage::PhysicalInputDevice
9865    }
9866}
9867
9868impl From<PhysicalInputDevice> for UsagePage {
9869    /// Always returns [UsagePage::PhysicalInputDevice] and is
9870    /// identical to [PhysicalInputDevice::usage_page()].
9871    fn from(_: PhysicalInputDevice) -> UsagePage {
9872        UsagePage::PhysicalInputDevice
9873    }
9874}
9875
9876impl From<&PhysicalInputDevice> for Usage {
9877    fn from(physicalinputdevice: &PhysicalInputDevice) -> Usage {
9878        Usage::try_from(u32::from(physicalinputdevice)).unwrap()
9879    }
9880}
9881
9882impl From<PhysicalInputDevice> for Usage {
9883    fn from(physicalinputdevice: PhysicalInputDevice) -> Usage {
9884        Usage::from(&physicalinputdevice)
9885    }
9886}
9887
9888impl TryFrom<u16> for PhysicalInputDevice {
9889    type Error = HutError;
9890
9891    fn try_from(usage_id: u16) -> Result<PhysicalInputDevice> {
9892        match usage_id {
9893            1 => Ok(PhysicalInputDevice::PhysicalInputDevice),
9894            32 => Ok(PhysicalInputDevice::Normal),
9895            33 => Ok(PhysicalInputDevice::SetEffectReport),
9896            34 => Ok(PhysicalInputDevice::EffectParameterBlockIndex),
9897            35 => Ok(PhysicalInputDevice::ParameterBlockOffset),
9898            36 => Ok(PhysicalInputDevice::ROMFlag),
9899            37 => Ok(PhysicalInputDevice::EffectType),
9900            38 => Ok(PhysicalInputDevice::ETConstantForce),
9901            39 => Ok(PhysicalInputDevice::ETRamp),
9902            40 => Ok(PhysicalInputDevice::ETCustomForce),
9903            48 => Ok(PhysicalInputDevice::ETSquare),
9904            49 => Ok(PhysicalInputDevice::ETSine),
9905            50 => Ok(PhysicalInputDevice::ETTriangle),
9906            51 => Ok(PhysicalInputDevice::ETSawtoothUp),
9907            52 => Ok(PhysicalInputDevice::ETSawtoothDown),
9908            64 => Ok(PhysicalInputDevice::ETSpring),
9909            65 => Ok(PhysicalInputDevice::ETDamper),
9910            66 => Ok(PhysicalInputDevice::ETInertia),
9911            67 => Ok(PhysicalInputDevice::ETFriction),
9912            80 => Ok(PhysicalInputDevice::Duration),
9913            81 => Ok(PhysicalInputDevice::SamplePeriod),
9914            82 => Ok(PhysicalInputDevice::Gain),
9915            83 => Ok(PhysicalInputDevice::TriggerButton),
9916            84 => Ok(PhysicalInputDevice::TriggerRepeatInterval),
9917            85 => Ok(PhysicalInputDevice::AxesEnable),
9918            86 => Ok(PhysicalInputDevice::DirectionEnable),
9919            87 => Ok(PhysicalInputDevice::Direction),
9920            88 => Ok(PhysicalInputDevice::TypeSpecificBlockOffset),
9921            89 => Ok(PhysicalInputDevice::BlockType),
9922            90 => Ok(PhysicalInputDevice::SetEnvelopeReport),
9923            91 => Ok(PhysicalInputDevice::AttackLevel),
9924            92 => Ok(PhysicalInputDevice::AttackTime),
9925            93 => Ok(PhysicalInputDevice::FadeLevel),
9926            94 => Ok(PhysicalInputDevice::FadeTime),
9927            95 => Ok(PhysicalInputDevice::SetConditionReport),
9928            96 => Ok(PhysicalInputDevice::CenterPointOffset),
9929            97 => Ok(PhysicalInputDevice::PositiveCoefficient),
9930            98 => Ok(PhysicalInputDevice::NegativeCoefficient),
9931            99 => Ok(PhysicalInputDevice::PositiveSaturation),
9932            100 => Ok(PhysicalInputDevice::NegativeSaturation),
9933            101 => Ok(PhysicalInputDevice::DeadBand),
9934            102 => Ok(PhysicalInputDevice::DownloadForceSample),
9935            103 => Ok(PhysicalInputDevice::IsochCustomForceEnable),
9936            104 => Ok(PhysicalInputDevice::CustomForceDataReport),
9937            105 => Ok(PhysicalInputDevice::CustomForceData),
9938            106 => Ok(PhysicalInputDevice::CustomForceVendorDefinedData),
9939            107 => Ok(PhysicalInputDevice::SetCustomForceReport),
9940            108 => Ok(PhysicalInputDevice::CustomForceDataOffset),
9941            109 => Ok(PhysicalInputDevice::SampleCount),
9942            110 => Ok(PhysicalInputDevice::SetPeriodicReport),
9943            111 => Ok(PhysicalInputDevice::Offset),
9944            112 => Ok(PhysicalInputDevice::Magnitude),
9945            113 => Ok(PhysicalInputDevice::Phase),
9946            114 => Ok(PhysicalInputDevice::Period),
9947            115 => Ok(PhysicalInputDevice::SetConstantForceReport),
9948            116 => Ok(PhysicalInputDevice::SetRampForceReport),
9949            117 => Ok(PhysicalInputDevice::RampStart),
9950            118 => Ok(PhysicalInputDevice::RampEnd),
9951            119 => Ok(PhysicalInputDevice::EffectOperationReport),
9952            120 => Ok(PhysicalInputDevice::EffectOperation),
9953            121 => Ok(PhysicalInputDevice::OpEffectStart),
9954            122 => Ok(PhysicalInputDevice::OpEffectStartSolo),
9955            123 => Ok(PhysicalInputDevice::OpEffectStop),
9956            124 => Ok(PhysicalInputDevice::LoopCount),
9957            125 => Ok(PhysicalInputDevice::DeviceGainReport),
9958            126 => Ok(PhysicalInputDevice::DeviceGain),
9959            127 => Ok(PhysicalInputDevice::ParameterBlockPoolsReport),
9960            128 => Ok(PhysicalInputDevice::RAMPoolSize),
9961            129 => Ok(PhysicalInputDevice::ROMPoolSize),
9962            130 => Ok(PhysicalInputDevice::ROMEffectBlockCount),
9963            131 => Ok(PhysicalInputDevice::SimultaneousEffectsMax),
9964            132 => Ok(PhysicalInputDevice::PoolAlignment),
9965            133 => Ok(PhysicalInputDevice::ParameterBlockMoveReport),
9966            134 => Ok(PhysicalInputDevice::MoveSource),
9967            135 => Ok(PhysicalInputDevice::MoveDestination),
9968            136 => Ok(PhysicalInputDevice::MoveLength),
9969            137 => Ok(PhysicalInputDevice::EffectParameterBlockLoadReport),
9970            139 => Ok(PhysicalInputDevice::EffectParameterBlockLoadStatus),
9971            140 => Ok(PhysicalInputDevice::BlockLoadSuccess),
9972            141 => Ok(PhysicalInputDevice::BlockLoadFull),
9973            142 => Ok(PhysicalInputDevice::BlockLoadError),
9974            143 => Ok(PhysicalInputDevice::BlockHandle),
9975            144 => Ok(PhysicalInputDevice::EffectParameterBlockFreeReport),
9976            145 => Ok(PhysicalInputDevice::TypeSpecificBlockHandle),
9977            146 => Ok(PhysicalInputDevice::PIDStateReport),
9978            148 => Ok(PhysicalInputDevice::EffectPlaying),
9979            149 => Ok(PhysicalInputDevice::PIDDeviceControlReport),
9980            150 => Ok(PhysicalInputDevice::PIDDeviceControl),
9981            151 => Ok(PhysicalInputDevice::DCEnableActuators),
9982            152 => Ok(PhysicalInputDevice::DCDisableActuators),
9983            153 => Ok(PhysicalInputDevice::DCStopAllEffects),
9984            154 => Ok(PhysicalInputDevice::DCReset),
9985            155 => Ok(PhysicalInputDevice::DCPause),
9986            156 => Ok(PhysicalInputDevice::DCContinue),
9987            159 => Ok(PhysicalInputDevice::DevicePaused),
9988            160 => Ok(PhysicalInputDevice::ActuatorsEnabled),
9989            164 => Ok(PhysicalInputDevice::SafetySwitch),
9990            165 => Ok(PhysicalInputDevice::ActuatorOverrideSwitch),
9991            166 => Ok(PhysicalInputDevice::ActuatorPower),
9992            167 => Ok(PhysicalInputDevice::StartDelay),
9993            168 => Ok(PhysicalInputDevice::ParameterBlockSize),
9994            169 => Ok(PhysicalInputDevice::DeviceManagedPool),
9995            170 => Ok(PhysicalInputDevice::SharedParameterBlocks),
9996            171 => Ok(PhysicalInputDevice::CreateNewEffectParameterBlockReport),
9997            172 => Ok(PhysicalInputDevice::RAMPoolAvailable),
9998            n => Err(HutError::UnknownUsageId { usage_id: n }),
9999        }
10000    }
10001}
10002
10003impl BitOr<u16> for PhysicalInputDevice {
10004    type Output = Usage;
10005
10006    /// A convenience function to combine a Usage Page with
10007    /// a value.
10008    ///
10009    /// This function panics if the Usage ID value results in
10010    /// an unknown Usage. Where error checking is required,
10011    /// use [UsagePage::to_usage_from_value].
10012    fn bitor(self, usage: u16) -> Usage {
10013        let up = u16::from(self) as u32;
10014        let u = usage as u32;
10015        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
10016    }
10017}
10018
10019/// *Usage Page `0x10`: "Unicode"*
10020///
10021/// **This enum is autogenerated from the HID Usage Tables**.
10022///
10023/// This Usage Page is generated, not defined, any Usage IDs in this Usage
10024/// Page are simply the codepoint number.
10025///
10026/// ```
10027/// # use hut::*;
10028/// let u1 = Usage::Unicode(Unicode::Unicode(3));
10029/// let u2 = Usage::new_from_page_and_id(0x10, 3).unwrap();
10030/// let u3 = Usage::from(Unicode::Unicode(3));
10031/// let u4: Usage = Unicode::Unicode(3).into();
10032/// assert_eq!(u1, u2);
10033/// assert_eq!(u1, u3);
10034/// assert_eq!(u1, u4);
10035///
10036/// assert!(matches!(u1.usage_page(), UsagePage::Unicode));
10037/// assert_eq!(0x10, u1.usage_page_value());
10038/// assert_eq!(3, u1.usage_id_value());
10039/// assert_eq!((0x10 << 16) | 3, u1.usage_value());
10040/// assert_eq!("codepoint 3", u1.name());
10041/// ```
10042#[allow(non_camel_case_types)]
10043#[derive(Debug)]
10044#[non_exhaustive]
10045pub enum Unicode {
10046    Unicode(u16),
10047}
10048
10049impl Unicode {
10050    #[cfg(feature = "std")]
10051    pub fn name(&self) -> String {
10052        match self {
10053            Unicode::Unicode(codepoint) => format!("codepoint {codepoint}"),
10054        }
10055    }
10056}
10057
10058#[cfg(feature = "std")]
10059impl fmt::Display for Unicode {
10060    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10061        write!(f, "{}", self.name())
10062    }
10063}
10064
10065impl AsUsage for Unicode {
10066    /// Returns the 32 bit Usage value of this Usage
10067    fn usage_value(&self) -> u32 {
10068        u32::from(self)
10069    }
10070
10071    /// Returns the 16 bit Usage ID value of this Usage
10072    fn usage_id_value(&self) -> u16 {
10073        u16::from(self)
10074    }
10075
10076    /// Returns this usage as [Usage::Unicode(self)](Usage::Unicode)
10077    /// This is a convenience function to avoid having
10078    /// to implement `From` for every used type in the caller.
10079    ///
10080    /// ```
10081    /// # use hut::*;
10082    /// let gd_x = GenericDesktop::X;
10083    /// let usage = Usage::from(GenericDesktop::X);
10084    /// assert!(matches!(gd_x.usage(), usage));
10085    /// ```
10086    fn usage(&self) -> Usage {
10087        Usage::from(self)
10088    }
10089}
10090
10091impl AsUsagePage for Unicode {
10092    /// Returns the 16 bit value of this UsagePage
10093    ///
10094    /// This value is `0x10` for [Unicode]
10095    fn usage_page_value(&self) -> u16 {
10096        let up = UsagePage::from(self);
10097        u16::from(up)
10098    }
10099
10100    /// Returns [UsagePage::Unicode]]
10101    fn usage_page(&self) -> UsagePage {
10102        UsagePage::from(self)
10103    }
10104}
10105
10106impl From<&Unicode> for u16 {
10107    fn from(unicode: &Unicode) -> u16 {
10108        match *unicode {
10109            Unicode::Unicode(codepoint) => codepoint,
10110        }
10111    }
10112}
10113
10114impl From<Unicode> for u16 {
10115    /// Returns the 16bit value of this usage. This is identical
10116    /// to [Unicode::usage_page_value()].
10117    fn from(unicode: Unicode) -> u16 {
10118        u16::from(&unicode)
10119    }
10120}
10121
10122impl From<&Unicode> for u32 {
10123    /// Returns the 32 bit value of this usage. This is identical
10124    /// to [Unicode::usage_value()].
10125    fn from(unicode: &Unicode) -> u32 {
10126        let up = UsagePage::from(unicode);
10127        let up = (u16::from(&up) as u32) << 16;
10128        let id = u16::from(unicode) as u32;
10129        up | id
10130    }
10131}
10132
10133impl From<&Unicode> for UsagePage {
10134    /// Always returns [UsagePage::Unicode] and is
10135    /// identical to [Unicode::usage_page()].
10136    fn from(_: &Unicode) -> UsagePage {
10137        UsagePage::Unicode
10138    }
10139}
10140
10141impl From<Unicode> for UsagePage {
10142    /// Always returns [UsagePage::Unicode] and is
10143    /// identical to [Unicode::usage_page()].
10144    fn from(_: Unicode) -> UsagePage {
10145        UsagePage::Unicode
10146    }
10147}
10148
10149impl From<&Unicode> for Usage {
10150    fn from(unicode: &Unicode) -> Usage {
10151        Usage::try_from(u32::from(unicode)).unwrap()
10152    }
10153}
10154
10155impl From<Unicode> for Usage {
10156    fn from(unicode: Unicode) -> Usage {
10157        Usage::from(&unicode)
10158    }
10159}
10160
10161impl TryFrom<u16> for Unicode {
10162    type Error = HutError;
10163
10164    fn try_from(usage_id: u16) -> Result<Unicode> {
10165        match usage_id {
10166            n => Ok(Unicode::Unicode(n)),
10167        }
10168    }
10169}
10170
10171impl BitOr<u16> for Unicode {
10172    type Output = Usage;
10173
10174    /// A convenience function to combine a Usage Page with
10175    /// a value.
10176    ///
10177    /// This function panics if the Usage ID value results in
10178    /// an unknown Usage. Where error checking is required,
10179    /// use [UsagePage::to_usage_from_value].
10180    fn bitor(self, usage: u16) -> Usage {
10181        let up = u16::from(self) as u32;
10182        let u = usage as u32;
10183        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
10184    }
10185}
10186
10187/// *Usage Page `0x11`: "SoC"*
10188///
10189/// **This enum is autogenerated from the HID Usage Tables**.
10190/// ```
10191/// # use hut::*;
10192/// let u1 = Usage::SoC(SoC::FirmwareTransfer);
10193/// let u2 = Usage::new_from_page_and_id(0x11, 0x2).unwrap();
10194/// let u3 = Usage::from(SoC::FirmwareTransfer);
10195/// let u4: Usage = SoC::FirmwareTransfer.into();
10196/// assert_eq!(u1, u2);
10197/// assert_eq!(u1, u3);
10198/// assert_eq!(u1, u4);
10199///
10200/// assert!(matches!(u1.usage_page(), UsagePage::SoC));
10201/// assert_eq!(0x11, u1.usage_page_value());
10202/// assert_eq!(0x2, u1.usage_id_value());
10203/// assert_eq!((0x11 << 16) | 0x2, u1.usage_value());
10204/// assert_eq!("FirmwareTransfer", u1.name());
10205/// ```
10206///
10207#[allow(non_camel_case_types)]
10208#[derive(Debug)]
10209#[non_exhaustive]
10210pub enum SoC {
10211    /// Usage ID `0x1`: "SocControl"
10212    SocControl,
10213    /// Usage ID `0x2`: "FirmwareTransfer"
10214    FirmwareTransfer,
10215    /// Usage ID `0x3`: "FirmwareFileId"
10216    FirmwareFileId,
10217    /// Usage ID `0x4`: "FileOffsetInBytes"
10218    FileOffsetInBytes,
10219    /// Usage ID `0x5`: "FileTransferSizeMaxInBytes"
10220    FileTransferSizeMaxInBytes,
10221    /// Usage ID `0x6`: "FilePayload"
10222    FilePayload,
10223    /// Usage ID `0x7`: "FilePayloadSizeInBytes"
10224    FilePayloadSizeInBytes,
10225    /// Usage ID `0x8`: "FilePayloadContainsLastBytes"
10226    FilePayloadContainsLastBytes,
10227    /// Usage ID `0x9`: "FileTransferStop"
10228    FileTransferStop,
10229    /// Usage ID `0xA`: "FileTransferTillEnd"
10230    FileTransferTillEnd,
10231}
10232
10233impl SoC {
10234    #[cfg(feature = "std")]
10235    pub fn name(&self) -> String {
10236        match self {
10237            SoC::SocControl => "SocControl",
10238            SoC::FirmwareTransfer => "FirmwareTransfer",
10239            SoC::FirmwareFileId => "FirmwareFileId",
10240            SoC::FileOffsetInBytes => "FileOffsetInBytes",
10241            SoC::FileTransferSizeMaxInBytes => "FileTransferSizeMaxInBytes",
10242            SoC::FilePayload => "FilePayload",
10243            SoC::FilePayloadSizeInBytes => "FilePayloadSizeInBytes",
10244            SoC::FilePayloadContainsLastBytes => "FilePayloadContainsLastBytes",
10245            SoC::FileTransferStop => "FileTransferStop",
10246            SoC::FileTransferTillEnd => "FileTransferTillEnd",
10247        }
10248        .into()
10249    }
10250}
10251
10252#[cfg(feature = "std")]
10253impl fmt::Display for SoC {
10254    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10255        write!(f, "{}", self.name())
10256    }
10257}
10258
10259impl AsUsage for SoC {
10260    /// Returns the 32 bit Usage value of this Usage
10261    fn usage_value(&self) -> u32 {
10262        u32::from(self)
10263    }
10264
10265    /// Returns the 16 bit Usage ID value of this Usage
10266    fn usage_id_value(&self) -> u16 {
10267        u16::from(self)
10268    }
10269
10270    /// Returns this usage as [Usage::SoC(self)](Usage::SoC)
10271    /// This is a convenience function to avoid having
10272    /// to implement `From` for every used type in the caller.
10273    ///
10274    /// ```
10275    /// # use hut::*;
10276    /// let gd_x = GenericDesktop::X;
10277    /// let usage = Usage::from(GenericDesktop::X);
10278    /// assert!(matches!(gd_x.usage(), usage));
10279    /// ```
10280    fn usage(&self) -> Usage {
10281        Usage::from(self)
10282    }
10283}
10284
10285impl AsUsagePage for SoC {
10286    /// Returns the 16 bit value of this UsagePage
10287    ///
10288    /// This value is `0x11` for [SoC]
10289    fn usage_page_value(&self) -> u16 {
10290        let up = UsagePage::from(self);
10291        u16::from(up)
10292    }
10293
10294    /// Returns [UsagePage::SoC]]
10295    fn usage_page(&self) -> UsagePage {
10296        UsagePage::from(self)
10297    }
10298}
10299
10300impl From<&SoC> for u16 {
10301    fn from(soc: &SoC) -> u16 {
10302        match *soc {
10303            SoC::SocControl => 1,
10304            SoC::FirmwareTransfer => 2,
10305            SoC::FirmwareFileId => 3,
10306            SoC::FileOffsetInBytes => 4,
10307            SoC::FileTransferSizeMaxInBytes => 5,
10308            SoC::FilePayload => 6,
10309            SoC::FilePayloadSizeInBytes => 7,
10310            SoC::FilePayloadContainsLastBytes => 8,
10311            SoC::FileTransferStop => 9,
10312            SoC::FileTransferTillEnd => 10,
10313        }
10314    }
10315}
10316
10317impl From<SoC> for u16 {
10318    /// Returns the 16bit value of this usage. This is identical
10319    /// to [SoC::usage_page_value()].
10320    fn from(soc: SoC) -> u16 {
10321        u16::from(&soc)
10322    }
10323}
10324
10325impl From<&SoC> for u32 {
10326    /// Returns the 32 bit value of this usage. This is identical
10327    /// to [SoC::usage_value()].
10328    fn from(soc: &SoC) -> u32 {
10329        let up = UsagePage::from(soc);
10330        let up = (u16::from(&up) as u32) << 16;
10331        let id = u16::from(soc) as u32;
10332        up | id
10333    }
10334}
10335
10336impl From<&SoC> for UsagePage {
10337    /// Always returns [UsagePage::SoC] and is
10338    /// identical to [SoC::usage_page()].
10339    fn from(_: &SoC) -> UsagePage {
10340        UsagePage::SoC
10341    }
10342}
10343
10344impl From<SoC> for UsagePage {
10345    /// Always returns [UsagePage::SoC] and is
10346    /// identical to [SoC::usage_page()].
10347    fn from(_: SoC) -> UsagePage {
10348        UsagePage::SoC
10349    }
10350}
10351
10352impl From<&SoC> for Usage {
10353    fn from(soc: &SoC) -> Usage {
10354        Usage::try_from(u32::from(soc)).unwrap()
10355    }
10356}
10357
10358impl From<SoC> for Usage {
10359    fn from(soc: SoC) -> Usage {
10360        Usage::from(&soc)
10361    }
10362}
10363
10364impl TryFrom<u16> for SoC {
10365    type Error = HutError;
10366
10367    fn try_from(usage_id: u16) -> Result<SoC> {
10368        match usage_id {
10369            1 => Ok(SoC::SocControl),
10370            2 => Ok(SoC::FirmwareTransfer),
10371            3 => Ok(SoC::FirmwareFileId),
10372            4 => Ok(SoC::FileOffsetInBytes),
10373            5 => Ok(SoC::FileTransferSizeMaxInBytes),
10374            6 => Ok(SoC::FilePayload),
10375            7 => Ok(SoC::FilePayloadSizeInBytes),
10376            8 => Ok(SoC::FilePayloadContainsLastBytes),
10377            9 => Ok(SoC::FileTransferStop),
10378            10 => Ok(SoC::FileTransferTillEnd),
10379            n => Err(HutError::UnknownUsageId { usage_id: n }),
10380        }
10381    }
10382}
10383
10384impl BitOr<u16> for SoC {
10385    type Output = Usage;
10386
10387    /// A convenience function to combine a Usage Page with
10388    /// a value.
10389    ///
10390    /// This function panics if the Usage ID value results in
10391    /// an unknown Usage. Where error checking is required,
10392    /// use [UsagePage::to_usage_from_value].
10393    fn bitor(self, usage: u16) -> Usage {
10394        let up = u16::from(self) as u32;
10395        let u = usage as u32;
10396        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
10397    }
10398}
10399
10400/// *Usage Page `0x12`: "Eye and Head Trackers"*
10401///
10402/// **This enum is autogenerated from the HID Usage Tables**.
10403/// ```
10404/// # use hut::*;
10405/// let u1 = Usage::EyeandHeadTrackers(EyeandHeadTrackers::HeadTracker);
10406/// let u2 = Usage::new_from_page_and_id(0x12, 0x2).unwrap();
10407/// let u3 = Usage::from(EyeandHeadTrackers::HeadTracker);
10408/// let u4: Usage = EyeandHeadTrackers::HeadTracker.into();
10409/// assert_eq!(u1, u2);
10410/// assert_eq!(u1, u3);
10411/// assert_eq!(u1, u4);
10412///
10413/// assert!(matches!(u1.usage_page(), UsagePage::EyeandHeadTrackers));
10414/// assert_eq!(0x12, u1.usage_page_value());
10415/// assert_eq!(0x2, u1.usage_id_value());
10416/// assert_eq!((0x12 << 16) | 0x2, u1.usage_value());
10417/// assert_eq!("Head Tracker", u1.name());
10418/// ```
10419///
10420#[allow(non_camel_case_types)]
10421#[derive(Debug)]
10422#[non_exhaustive]
10423pub enum EyeandHeadTrackers {
10424    /// Usage ID `0x1`: "Eye Tracker"
10425    EyeTracker,
10426    /// Usage ID `0x2`: "Head Tracker"
10427    HeadTracker,
10428    /// Usage ID `0x10`: "Tracking Data"
10429    TrackingData,
10430    /// Usage ID `0x11`: "Capabilities"
10431    Capabilities,
10432    /// Usage ID `0x12`: "Configuration"
10433    Configuration,
10434    /// Usage ID `0x13`: "Status"
10435    Status,
10436    /// Usage ID `0x14`: "Control"
10437    Control,
10438    /// Usage ID `0x20`: "Sensor Timestamp"
10439    SensorTimestamp,
10440    /// Usage ID `0x21`: "Position X"
10441    PositionX,
10442    /// Usage ID `0x22`: "Position Y"
10443    PositionY,
10444    /// Usage ID `0x23`: "Position Z"
10445    PositionZ,
10446    /// Usage ID `0x24`: "Gaze Point"
10447    GazePoint,
10448    /// Usage ID `0x25`: "Left Eye Position"
10449    LeftEyePosition,
10450    /// Usage ID `0x26`: "Right Eye Position"
10451    RightEyePosition,
10452    /// Usage ID `0x27`: "Head Position"
10453    HeadPosition,
10454    /// Usage ID `0x28`: "Head Direction Point"
10455    HeadDirectionPoint,
10456    /// Usage ID `0x29`: "Rotation about X axis"
10457    RotationaboutXaxis,
10458    /// Usage ID `0x2A`: "Rotation about Y axis"
10459    RotationaboutYaxis,
10460    /// Usage ID `0x2B`: "Rotation about Z axis"
10461    RotationaboutZaxis,
10462    /// Usage ID `0x100`: "Tracker Quality"
10463    TrackerQuality,
10464    /// Usage ID `0x101`: "Minimum Tracking Distance"
10465    MinimumTrackingDistance,
10466    /// Usage ID `0x102`: "Optimum Tracking Distance"
10467    OptimumTrackingDistance,
10468    /// Usage ID `0x103`: "Maximum Tracking Distance"
10469    MaximumTrackingDistance,
10470    /// Usage ID `0x104`: "Maximum Screen Plane Width"
10471    MaximumScreenPlaneWidth,
10472    /// Usage ID `0x105`: "Maximum Screen Plane Height"
10473    MaximumScreenPlaneHeight,
10474    /// Usage ID `0x200`: "Display Manufacturer ID"
10475    DisplayManufacturerID,
10476    /// Usage ID `0x201`: "Display Product ID"
10477    DisplayProductID,
10478    /// Usage ID `0x202`: "Display Serial Number"
10479    DisplaySerialNumber,
10480    /// Usage ID `0x203`: "Display Manufacturer Date"
10481    DisplayManufacturerDate,
10482    /// Usage ID `0x204`: "Calibrated Screen Width"
10483    CalibratedScreenWidth,
10484    /// Usage ID `0x205`: "Calibrated Screen Height"
10485    CalibratedScreenHeight,
10486    /// Usage ID `0x300`: "Sampling Frequency"
10487    SamplingFrequency,
10488    /// Usage ID `0x301`: "Configuration Status"
10489    ConfigurationStatus,
10490    /// Usage ID `0x400`: "Device Mode Request"
10491    DeviceModeRequest,
10492}
10493
10494impl EyeandHeadTrackers {
10495    #[cfg(feature = "std")]
10496    pub fn name(&self) -> String {
10497        match self {
10498            EyeandHeadTrackers::EyeTracker => "Eye Tracker",
10499            EyeandHeadTrackers::HeadTracker => "Head Tracker",
10500            EyeandHeadTrackers::TrackingData => "Tracking Data",
10501            EyeandHeadTrackers::Capabilities => "Capabilities",
10502            EyeandHeadTrackers::Configuration => "Configuration",
10503            EyeandHeadTrackers::Status => "Status",
10504            EyeandHeadTrackers::Control => "Control",
10505            EyeandHeadTrackers::SensorTimestamp => "Sensor Timestamp",
10506            EyeandHeadTrackers::PositionX => "Position X",
10507            EyeandHeadTrackers::PositionY => "Position Y",
10508            EyeandHeadTrackers::PositionZ => "Position Z",
10509            EyeandHeadTrackers::GazePoint => "Gaze Point",
10510            EyeandHeadTrackers::LeftEyePosition => "Left Eye Position",
10511            EyeandHeadTrackers::RightEyePosition => "Right Eye Position",
10512            EyeandHeadTrackers::HeadPosition => "Head Position",
10513            EyeandHeadTrackers::HeadDirectionPoint => "Head Direction Point",
10514            EyeandHeadTrackers::RotationaboutXaxis => "Rotation about X axis",
10515            EyeandHeadTrackers::RotationaboutYaxis => "Rotation about Y axis",
10516            EyeandHeadTrackers::RotationaboutZaxis => "Rotation about Z axis",
10517            EyeandHeadTrackers::TrackerQuality => "Tracker Quality",
10518            EyeandHeadTrackers::MinimumTrackingDistance => "Minimum Tracking Distance",
10519            EyeandHeadTrackers::OptimumTrackingDistance => "Optimum Tracking Distance",
10520            EyeandHeadTrackers::MaximumTrackingDistance => "Maximum Tracking Distance",
10521            EyeandHeadTrackers::MaximumScreenPlaneWidth => "Maximum Screen Plane Width",
10522            EyeandHeadTrackers::MaximumScreenPlaneHeight => "Maximum Screen Plane Height",
10523            EyeandHeadTrackers::DisplayManufacturerID => "Display Manufacturer ID",
10524            EyeandHeadTrackers::DisplayProductID => "Display Product ID",
10525            EyeandHeadTrackers::DisplaySerialNumber => "Display Serial Number",
10526            EyeandHeadTrackers::DisplayManufacturerDate => "Display Manufacturer Date",
10527            EyeandHeadTrackers::CalibratedScreenWidth => "Calibrated Screen Width",
10528            EyeandHeadTrackers::CalibratedScreenHeight => "Calibrated Screen Height",
10529            EyeandHeadTrackers::SamplingFrequency => "Sampling Frequency",
10530            EyeandHeadTrackers::ConfigurationStatus => "Configuration Status",
10531            EyeandHeadTrackers::DeviceModeRequest => "Device Mode Request",
10532        }
10533        .into()
10534    }
10535}
10536
10537#[cfg(feature = "std")]
10538impl fmt::Display for EyeandHeadTrackers {
10539    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10540        write!(f, "{}", self.name())
10541    }
10542}
10543
10544impl AsUsage for EyeandHeadTrackers {
10545    /// Returns the 32 bit Usage value of this Usage
10546    fn usage_value(&self) -> u32 {
10547        u32::from(self)
10548    }
10549
10550    /// Returns the 16 bit Usage ID value of this Usage
10551    fn usage_id_value(&self) -> u16 {
10552        u16::from(self)
10553    }
10554
10555    /// Returns this usage as [Usage::EyeandHeadTrackers(self)](Usage::EyeandHeadTrackers)
10556    /// This is a convenience function to avoid having
10557    /// to implement `From` for every used type in the caller.
10558    ///
10559    /// ```
10560    /// # use hut::*;
10561    /// let gd_x = GenericDesktop::X;
10562    /// let usage = Usage::from(GenericDesktop::X);
10563    /// assert!(matches!(gd_x.usage(), usage));
10564    /// ```
10565    fn usage(&self) -> Usage {
10566        Usage::from(self)
10567    }
10568}
10569
10570impl AsUsagePage for EyeandHeadTrackers {
10571    /// Returns the 16 bit value of this UsagePage
10572    ///
10573    /// This value is `0x12` for [EyeandHeadTrackers]
10574    fn usage_page_value(&self) -> u16 {
10575        let up = UsagePage::from(self);
10576        u16::from(up)
10577    }
10578
10579    /// Returns [UsagePage::EyeandHeadTrackers]]
10580    fn usage_page(&self) -> UsagePage {
10581        UsagePage::from(self)
10582    }
10583}
10584
10585impl From<&EyeandHeadTrackers> for u16 {
10586    fn from(eyeandheadtrackers: &EyeandHeadTrackers) -> u16 {
10587        match *eyeandheadtrackers {
10588            EyeandHeadTrackers::EyeTracker => 1,
10589            EyeandHeadTrackers::HeadTracker => 2,
10590            EyeandHeadTrackers::TrackingData => 16,
10591            EyeandHeadTrackers::Capabilities => 17,
10592            EyeandHeadTrackers::Configuration => 18,
10593            EyeandHeadTrackers::Status => 19,
10594            EyeandHeadTrackers::Control => 20,
10595            EyeandHeadTrackers::SensorTimestamp => 32,
10596            EyeandHeadTrackers::PositionX => 33,
10597            EyeandHeadTrackers::PositionY => 34,
10598            EyeandHeadTrackers::PositionZ => 35,
10599            EyeandHeadTrackers::GazePoint => 36,
10600            EyeandHeadTrackers::LeftEyePosition => 37,
10601            EyeandHeadTrackers::RightEyePosition => 38,
10602            EyeandHeadTrackers::HeadPosition => 39,
10603            EyeandHeadTrackers::HeadDirectionPoint => 40,
10604            EyeandHeadTrackers::RotationaboutXaxis => 41,
10605            EyeandHeadTrackers::RotationaboutYaxis => 42,
10606            EyeandHeadTrackers::RotationaboutZaxis => 43,
10607            EyeandHeadTrackers::TrackerQuality => 256,
10608            EyeandHeadTrackers::MinimumTrackingDistance => 257,
10609            EyeandHeadTrackers::OptimumTrackingDistance => 258,
10610            EyeandHeadTrackers::MaximumTrackingDistance => 259,
10611            EyeandHeadTrackers::MaximumScreenPlaneWidth => 260,
10612            EyeandHeadTrackers::MaximumScreenPlaneHeight => 261,
10613            EyeandHeadTrackers::DisplayManufacturerID => 512,
10614            EyeandHeadTrackers::DisplayProductID => 513,
10615            EyeandHeadTrackers::DisplaySerialNumber => 514,
10616            EyeandHeadTrackers::DisplayManufacturerDate => 515,
10617            EyeandHeadTrackers::CalibratedScreenWidth => 516,
10618            EyeandHeadTrackers::CalibratedScreenHeight => 517,
10619            EyeandHeadTrackers::SamplingFrequency => 768,
10620            EyeandHeadTrackers::ConfigurationStatus => 769,
10621            EyeandHeadTrackers::DeviceModeRequest => 1024,
10622        }
10623    }
10624}
10625
10626impl From<EyeandHeadTrackers> for u16 {
10627    /// Returns the 16bit value of this usage. This is identical
10628    /// to [EyeandHeadTrackers::usage_page_value()].
10629    fn from(eyeandheadtrackers: EyeandHeadTrackers) -> u16 {
10630        u16::from(&eyeandheadtrackers)
10631    }
10632}
10633
10634impl From<&EyeandHeadTrackers> for u32 {
10635    /// Returns the 32 bit value of this usage. This is identical
10636    /// to [EyeandHeadTrackers::usage_value()].
10637    fn from(eyeandheadtrackers: &EyeandHeadTrackers) -> u32 {
10638        let up = UsagePage::from(eyeandheadtrackers);
10639        let up = (u16::from(&up) as u32) << 16;
10640        let id = u16::from(eyeandheadtrackers) as u32;
10641        up | id
10642    }
10643}
10644
10645impl From<&EyeandHeadTrackers> for UsagePage {
10646    /// Always returns [UsagePage::EyeandHeadTrackers] and is
10647    /// identical to [EyeandHeadTrackers::usage_page()].
10648    fn from(_: &EyeandHeadTrackers) -> UsagePage {
10649        UsagePage::EyeandHeadTrackers
10650    }
10651}
10652
10653impl From<EyeandHeadTrackers> for UsagePage {
10654    /// Always returns [UsagePage::EyeandHeadTrackers] and is
10655    /// identical to [EyeandHeadTrackers::usage_page()].
10656    fn from(_: EyeandHeadTrackers) -> UsagePage {
10657        UsagePage::EyeandHeadTrackers
10658    }
10659}
10660
10661impl From<&EyeandHeadTrackers> for Usage {
10662    fn from(eyeandheadtrackers: &EyeandHeadTrackers) -> Usage {
10663        Usage::try_from(u32::from(eyeandheadtrackers)).unwrap()
10664    }
10665}
10666
10667impl From<EyeandHeadTrackers> for Usage {
10668    fn from(eyeandheadtrackers: EyeandHeadTrackers) -> Usage {
10669        Usage::from(&eyeandheadtrackers)
10670    }
10671}
10672
10673impl TryFrom<u16> for EyeandHeadTrackers {
10674    type Error = HutError;
10675
10676    fn try_from(usage_id: u16) -> Result<EyeandHeadTrackers> {
10677        match usage_id {
10678            1 => Ok(EyeandHeadTrackers::EyeTracker),
10679            2 => Ok(EyeandHeadTrackers::HeadTracker),
10680            16 => Ok(EyeandHeadTrackers::TrackingData),
10681            17 => Ok(EyeandHeadTrackers::Capabilities),
10682            18 => Ok(EyeandHeadTrackers::Configuration),
10683            19 => Ok(EyeandHeadTrackers::Status),
10684            20 => Ok(EyeandHeadTrackers::Control),
10685            32 => Ok(EyeandHeadTrackers::SensorTimestamp),
10686            33 => Ok(EyeandHeadTrackers::PositionX),
10687            34 => Ok(EyeandHeadTrackers::PositionY),
10688            35 => Ok(EyeandHeadTrackers::PositionZ),
10689            36 => Ok(EyeandHeadTrackers::GazePoint),
10690            37 => Ok(EyeandHeadTrackers::LeftEyePosition),
10691            38 => Ok(EyeandHeadTrackers::RightEyePosition),
10692            39 => Ok(EyeandHeadTrackers::HeadPosition),
10693            40 => Ok(EyeandHeadTrackers::HeadDirectionPoint),
10694            41 => Ok(EyeandHeadTrackers::RotationaboutXaxis),
10695            42 => Ok(EyeandHeadTrackers::RotationaboutYaxis),
10696            43 => Ok(EyeandHeadTrackers::RotationaboutZaxis),
10697            256 => Ok(EyeandHeadTrackers::TrackerQuality),
10698            257 => Ok(EyeandHeadTrackers::MinimumTrackingDistance),
10699            258 => Ok(EyeandHeadTrackers::OptimumTrackingDistance),
10700            259 => Ok(EyeandHeadTrackers::MaximumTrackingDistance),
10701            260 => Ok(EyeandHeadTrackers::MaximumScreenPlaneWidth),
10702            261 => Ok(EyeandHeadTrackers::MaximumScreenPlaneHeight),
10703            512 => Ok(EyeandHeadTrackers::DisplayManufacturerID),
10704            513 => Ok(EyeandHeadTrackers::DisplayProductID),
10705            514 => Ok(EyeandHeadTrackers::DisplaySerialNumber),
10706            515 => Ok(EyeandHeadTrackers::DisplayManufacturerDate),
10707            516 => Ok(EyeandHeadTrackers::CalibratedScreenWidth),
10708            517 => Ok(EyeandHeadTrackers::CalibratedScreenHeight),
10709            768 => Ok(EyeandHeadTrackers::SamplingFrequency),
10710            769 => Ok(EyeandHeadTrackers::ConfigurationStatus),
10711            1024 => Ok(EyeandHeadTrackers::DeviceModeRequest),
10712            n => Err(HutError::UnknownUsageId { usage_id: n }),
10713        }
10714    }
10715}
10716
10717impl BitOr<u16> for EyeandHeadTrackers {
10718    type Output = Usage;
10719
10720    /// A convenience function to combine a Usage Page with
10721    /// a value.
10722    ///
10723    /// This function panics if the Usage ID value results in
10724    /// an unknown Usage. Where error checking is required,
10725    /// use [UsagePage::to_usage_from_value].
10726    fn bitor(self, usage: u16) -> Usage {
10727        let up = u16::from(self) as u32;
10728        let u = usage as u32;
10729        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
10730    }
10731}
10732
10733/// *Usage Page `0x14`: "Auxiliary Display"*
10734///
10735/// **This enum is autogenerated from the HID Usage Tables**.
10736/// ```
10737/// # use hut::*;
10738/// let u1 = Usage::AuxiliaryDisplay(AuxiliaryDisplay::AuxiliaryDisplay);
10739/// let u2 = Usage::new_from_page_and_id(0x14, 0x2).unwrap();
10740/// let u3 = Usage::from(AuxiliaryDisplay::AuxiliaryDisplay);
10741/// let u4: Usage = AuxiliaryDisplay::AuxiliaryDisplay.into();
10742/// assert_eq!(u1, u2);
10743/// assert_eq!(u1, u3);
10744/// assert_eq!(u1, u4);
10745///
10746/// assert!(matches!(u1.usage_page(), UsagePage::AuxiliaryDisplay));
10747/// assert_eq!(0x14, u1.usage_page_value());
10748/// assert_eq!(0x2, u1.usage_id_value());
10749/// assert_eq!((0x14 << 16) | 0x2, u1.usage_value());
10750/// assert_eq!("Auxiliary Display", u1.name());
10751/// ```
10752///
10753#[allow(non_camel_case_types)]
10754#[derive(Debug)]
10755#[non_exhaustive]
10756pub enum AuxiliaryDisplay {
10757    /// Usage ID `0x1`: "Alphanumeric Display"
10758    AlphanumericDisplay,
10759    /// Usage ID `0x2`: "Auxiliary Display"
10760    AuxiliaryDisplay,
10761    /// Usage ID `0x20`: "Display Attributes Report"
10762    DisplayAttributesReport,
10763    /// Usage ID `0x21`: "ASCII Character Set"
10764    ASCIICharacterSet,
10765    /// Usage ID `0x22`: "Data Read Back"
10766    DataReadBack,
10767    /// Usage ID `0x23`: "Font Read Back"
10768    FontReadBack,
10769    /// Usage ID `0x24`: "Display Control Report"
10770    DisplayControlReport,
10771    /// Usage ID `0x25`: "Clear Display"
10772    ClearDisplay,
10773    /// Usage ID `0x26`: "Display Enable"
10774    DisplayEnable,
10775    /// Usage ID `0x27`: "Screen Saver Delay"
10776    ScreenSaverDelay,
10777    /// Usage ID `0x28`: "Screen Saver Enable"
10778    ScreenSaverEnable,
10779    /// Usage ID `0x29`: "Vertical Scroll"
10780    VerticalScroll,
10781    /// Usage ID `0x2A`: "Horizontal Scroll"
10782    HorizontalScroll,
10783    /// Usage ID `0x2B`: "Character Report"
10784    CharacterReport,
10785    /// Usage ID `0x2C`: "Display Data"
10786    DisplayData,
10787    /// Usage ID `0x2D`: "Display Status"
10788    DisplayStatus,
10789    /// Usage ID `0x2E`: "Stat Not Ready"
10790    StatNotReady,
10791    /// Usage ID `0x2F`: "Stat Ready"
10792    StatReady,
10793    /// Usage ID `0x30`: "Err Not a loadable character"
10794    ErrNotaloadablecharacter,
10795    /// Usage ID `0x31`: "Err Font data cannot be read"
10796    ErrFontdatacannotberead,
10797    /// Usage ID `0x32`: "Cursor Position Report"
10798    CursorPositionReport,
10799    /// Usage ID `0x33`: "Row"
10800    Row,
10801    /// Usage ID `0x34`: "Column"
10802    Column,
10803    /// Usage ID `0x35`: "Rows"
10804    Rows,
10805    /// Usage ID `0x36`: "Columns"
10806    Columns,
10807    /// Usage ID `0x37`: "Cursor Pixel Positioning"
10808    CursorPixelPositioning,
10809    /// Usage ID `0x38`: "Cursor Mode"
10810    CursorMode,
10811    /// Usage ID `0x39`: "Cursor Enable"
10812    CursorEnable,
10813    /// Usage ID `0x3A`: "Cursor Blink"
10814    CursorBlink,
10815    /// Usage ID `0x3B`: "Font Report"
10816    FontReport,
10817    /// Usage ID `0x3C`: "Font Data"
10818    FontData,
10819    /// Usage ID `0x3D`: "Character Width"
10820    CharacterWidth,
10821    /// Usage ID `0x3E`: "Character Height"
10822    CharacterHeight,
10823    /// Usage ID `0x3F`: "Character Spacing Horizontal"
10824    CharacterSpacingHorizontal,
10825    /// Usage ID `0x40`: "Character Spacing Vertical"
10826    CharacterSpacingVertical,
10827    /// Usage ID `0x41`: "Unicode Character Set"
10828    UnicodeCharacterSet,
10829    /// Usage ID `0x42`: "Font 7-Segment"
10830    Font7Segment,
10831    /// Usage ID `0x43`: "7-Segment Direct Map"
10832    SevenSegmentDirectMap,
10833    /// Usage ID `0x44`: "Font 14-Segment"
10834    Font14Segment,
10835    /// Usage ID `0x45`: "14-Segment Direct Map"
10836    One4SegmentDirectMap,
10837    /// Usage ID `0x46`: "Display Brightness"
10838    DisplayBrightness,
10839    /// Usage ID `0x47`: "Display Contrast"
10840    DisplayContrast,
10841    /// Usage ID `0x48`: "Character Attribute"
10842    CharacterAttribute,
10843    /// Usage ID `0x49`: "Attribute Readback"
10844    AttributeReadback,
10845    /// Usage ID `0x4A`: "Attribute Data"
10846    AttributeData,
10847    /// Usage ID `0x4B`: "Char Attr Enhance"
10848    CharAttrEnhance,
10849    /// Usage ID `0x4C`: "Char Attr Underline"
10850    CharAttrUnderline,
10851    /// Usage ID `0x4D`: "Char Attr Blink"
10852    CharAttrBlink,
10853    /// Usage ID `0x80`: "Bitmap Size X"
10854    BitmapSizeX,
10855    /// Usage ID `0x81`: "Bitmap Size Y"
10856    BitmapSizeY,
10857    /// Usage ID `0x82`: "Max Blit Size"
10858    MaxBlitSize,
10859    /// Usage ID `0x83`: "Bit Depth Format"
10860    BitDepthFormat,
10861    /// Usage ID `0x84`: "Display Orientation"
10862    DisplayOrientation,
10863    /// Usage ID `0x85`: "Palette Report"
10864    PaletteReport,
10865    /// Usage ID `0x86`: "Palette Data Size"
10866    PaletteDataSize,
10867    /// Usage ID `0x87`: "Palette Data Offset"
10868    PaletteDataOffset,
10869    /// Usage ID `0x88`: "Palette Data"
10870    PaletteData,
10871    /// Usage ID `0x8A`: "Blit Report"
10872    BlitReport,
10873    /// Usage ID `0x8B`: "Blit Rectangle X1"
10874    BlitRectangleX1,
10875    /// Usage ID `0x8C`: "Blit Rectangle Y1"
10876    BlitRectangleY1,
10877    /// Usage ID `0x8D`: "Blit Rectangle X2"
10878    BlitRectangleX2,
10879    /// Usage ID `0x8E`: "Blit Rectangle Y2"
10880    BlitRectangleY2,
10881    /// Usage ID `0x8F`: "Blit Data"
10882    BlitData,
10883    /// Usage ID `0x90`: "Soft Button"
10884    SoftButton,
10885    /// Usage ID `0x91`: "Soft Button ID"
10886    SoftButtonID,
10887    /// Usage ID `0x92`: "Soft Button Side"
10888    SoftButtonSide,
10889    /// Usage ID `0x93`: "Soft Button Offset 1"
10890    SoftButtonOffset1,
10891    /// Usage ID `0x94`: "Soft Button Offset 2"
10892    SoftButtonOffset2,
10893    /// Usage ID `0x95`: "Soft Button Report"
10894    SoftButtonReport,
10895    /// Usage ID `0xC2`: "Soft Keys"
10896    SoftKeys,
10897    /// Usage ID `0xCC`: "Display Data Extensions"
10898    DisplayDataExtensions,
10899    /// Usage ID `0xCF`: "Character Mapping"
10900    CharacterMapping,
10901    /// Usage ID `0xDD`: "Unicode Equivalent"
10902    UnicodeEquivalent,
10903    /// Usage ID `0xDF`: "Character Page Mapping"
10904    CharacterPageMapping,
10905    /// Usage ID `0xFF`: "Request Report"
10906    RequestReport,
10907}
10908
10909impl AuxiliaryDisplay {
10910    #[cfg(feature = "std")]
10911    pub fn name(&self) -> String {
10912        match self {
10913            AuxiliaryDisplay::AlphanumericDisplay => "Alphanumeric Display",
10914            AuxiliaryDisplay::AuxiliaryDisplay => "Auxiliary Display",
10915            AuxiliaryDisplay::DisplayAttributesReport => "Display Attributes Report",
10916            AuxiliaryDisplay::ASCIICharacterSet => "ASCII Character Set",
10917            AuxiliaryDisplay::DataReadBack => "Data Read Back",
10918            AuxiliaryDisplay::FontReadBack => "Font Read Back",
10919            AuxiliaryDisplay::DisplayControlReport => "Display Control Report",
10920            AuxiliaryDisplay::ClearDisplay => "Clear Display",
10921            AuxiliaryDisplay::DisplayEnable => "Display Enable",
10922            AuxiliaryDisplay::ScreenSaverDelay => "Screen Saver Delay",
10923            AuxiliaryDisplay::ScreenSaverEnable => "Screen Saver Enable",
10924            AuxiliaryDisplay::VerticalScroll => "Vertical Scroll",
10925            AuxiliaryDisplay::HorizontalScroll => "Horizontal Scroll",
10926            AuxiliaryDisplay::CharacterReport => "Character Report",
10927            AuxiliaryDisplay::DisplayData => "Display Data",
10928            AuxiliaryDisplay::DisplayStatus => "Display Status",
10929            AuxiliaryDisplay::StatNotReady => "Stat Not Ready",
10930            AuxiliaryDisplay::StatReady => "Stat Ready",
10931            AuxiliaryDisplay::ErrNotaloadablecharacter => "Err Not a loadable character",
10932            AuxiliaryDisplay::ErrFontdatacannotberead => "Err Font data cannot be read",
10933            AuxiliaryDisplay::CursorPositionReport => "Cursor Position Report",
10934            AuxiliaryDisplay::Row => "Row",
10935            AuxiliaryDisplay::Column => "Column",
10936            AuxiliaryDisplay::Rows => "Rows",
10937            AuxiliaryDisplay::Columns => "Columns",
10938            AuxiliaryDisplay::CursorPixelPositioning => "Cursor Pixel Positioning",
10939            AuxiliaryDisplay::CursorMode => "Cursor Mode",
10940            AuxiliaryDisplay::CursorEnable => "Cursor Enable",
10941            AuxiliaryDisplay::CursorBlink => "Cursor Blink",
10942            AuxiliaryDisplay::FontReport => "Font Report",
10943            AuxiliaryDisplay::FontData => "Font Data",
10944            AuxiliaryDisplay::CharacterWidth => "Character Width",
10945            AuxiliaryDisplay::CharacterHeight => "Character Height",
10946            AuxiliaryDisplay::CharacterSpacingHorizontal => "Character Spacing Horizontal",
10947            AuxiliaryDisplay::CharacterSpacingVertical => "Character Spacing Vertical",
10948            AuxiliaryDisplay::UnicodeCharacterSet => "Unicode Character Set",
10949            AuxiliaryDisplay::Font7Segment => "Font 7-Segment",
10950            AuxiliaryDisplay::SevenSegmentDirectMap => "7-Segment Direct Map",
10951            AuxiliaryDisplay::Font14Segment => "Font 14-Segment",
10952            AuxiliaryDisplay::One4SegmentDirectMap => "14-Segment Direct Map",
10953            AuxiliaryDisplay::DisplayBrightness => "Display Brightness",
10954            AuxiliaryDisplay::DisplayContrast => "Display Contrast",
10955            AuxiliaryDisplay::CharacterAttribute => "Character Attribute",
10956            AuxiliaryDisplay::AttributeReadback => "Attribute Readback",
10957            AuxiliaryDisplay::AttributeData => "Attribute Data",
10958            AuxiliaryDisplay::CharAttrEnhance => "Char Attr Enhance",
10959            AuxiliaryDisplay::CharAttrUnderline => "Char Attr Underline",
10960            AuxiliaryDisplay::CharAttrBlink => "Char Attr Blink",
10961            AuxiliaryDisplay::BitmapSizeX => "Bitmap Size X",
10962            AuxiliaryDisplay::BitmapSizeY => "Bitmap Size Y",
10963            AuxiliaryDisplay::MaxBlitSize => "Max Blit Size",
10964            AuxiliaryDisplay::BitDepthFormat => "Bit Depth Format",
10965            AuxiliaryDisplay::DisplayOrientation => "Display Orientation",
10966            AuxiliaryDisplay::PaletteReport => "Palette Report",
10967            AuxiliaryDisplay::PaletteDataSize => "Palette Data Size",
10968            AuxiliaryDisplay::PaletteDataOffset => "Palette Data Offset",
10969            AuxiliaryDisplay::PaletteData => "Palette Data",
10970            AuxiliaryDisplay::BlitReport => "Blit Report",
10971            AuxiliaryDisplay::BlitRectangleX1 => "Blit Rectangle X1",
10972            AuxiliaryDisplay::BlitRectangleY1 => "Blit Rectangle Y1",
10973            AuxiliaryDisplay::BlitRectangleX2 => "Blit Rectangle X2",
10974            AuxiliaryDisplay::BlitRectangleY2 => "Blit Rectangle Y2",
10975            AuxiliaryDisplay::BlitData => "Blit Data",
10976            AuxiliaryDisplay::SoftButton => "Soft Button",
10977            AuxiliaryDisplay::SoftButtonID => "Soft Button ID",
10978            AuxiliaryDisplay::SoftButtonSide => "Soft Button Side",
10979            AuxiliaryDisplay::SoftButtonOffset1 => "Soft Button Offset 1",
10980            AuxiliaryDisplay::SoftButtonOffset2 => "Soft Button Offset 2",
10981            AuxiliaryDisplay::SoftButtonReport => "Soft Button Report",
10982            AuxiliaryDisplay::SoftKeys => "Soft Keys",
10983            AuxiliaryDisplay::DisplayDataExtensions => "Display Data Extensions",
10984            AuxiliaryDisplay::CharacterMapping => "Character Mapping",
10985            AuxiliaryDisplay::UnicodeEquivalent => "Unicode Equivalent",
10986            AuxiliaryDisplay::CharacterPageMapping => "Character Page Mapping",
10987            AuxiliaryDisplay::RequestReport => "Request Report",
10988        }
10989        .into()
10990    }
10991}
10992
10993#[cfg(feature = "std")]
10994impl fmt::Display for AuxiliaryDisplay {
10995    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10996        write!(f, "{}", self.name())
10997    }
10998}
10999
11000impl AsUsage for AuxiliaryDisplay {
11001    /// Returns the 32 bit Usage value of this Usage
11002    fn usage_value(&self) -> u32 {
11003        u32::from(self)
11004    }
11005
11006    /// Returns the 16 bit Usage ID value of this Usage
11007    fn usage_id_value(&self) -> u16 {
11008        u16::from(self)
11009    }
11010
11011    /// Returns this usage as [Usage::AuxiliaryDisplay(self)](Usage::AuxiliaryDisplay)
11012    /// This is a convenience function to avoid having
11013    /// to implement `From` for every used type in the caller.
11014    ///
11015    /// ```
11016    /// # use hut::*;
11017    /// let gd_x = GenericDesktop::X;
11018    /// let usage = Usage::from(GenericDesktop::X);
11019    /// assert!(matches!(gd_x.usage(), usage));
11020    /// ```
11021    fn usage(&self) -> Usage {
11022        Usage::from(self)
11023    }
11024}
11025
11026impl AsUsagePage for AuxiliaryDisplay {
11027    /// Returns the 16 bit value of this UsagePage
11028    ///
11029    /// This value is `0x14` for [AuxiliaryDisplay]
11030    fn usage_page_value(&self) -> u16 {
11031        let up = UsagePage::from(self);
11032        u16::from(up)
11033    }
11034
11035    /// Returns [UsagePage::AuxiliaryDisplay]]
11036    fn usage_page(&self) -> UsagePage {
11037        UsagePage::from(self)
11038    }
11039}
11040
11041impl From<&AuxiliaryDisplay> for u16 {
11042    fn from(auxiliarydisplay: &AuxiliaryDisplay) -> u16 {
11043        match *auxiliarydisplay {
11044            AuxiliaryDisplay::AlphanumericDisplay => 1,
11045            AuxiliaryDisplay::AuxiliaryDisplay => 2,
11046            AuxiliaryDisplay::DisplayAttributesReport => 32,
11047            AuxiliaryDisplay::ASCIICharacterSet => 33,
11048            AuxiliaryDisplay::DataReadBack => 34,
11049            AuxiliaryDisplay::FontReadBack => 35,
11050            AuxiliaryDisplay::DisplayControlReport => 36,
11051            AuxiliaryDisplay::ClearDisplay => 37,
11052            AuxiliaryDisplay::DisplayEnable => 38,
11053            AuxiliaryDisplay::ScreenSaverDelay => 39,
11054            AuxiliaryDisplay::ScreenSaverEnable => 40,
11055            AuxiliaryDisplay::VerticalScroll => 41,
11056            AuxiliaryDisplay::HorizontalScroll => 42,
11057            AuxiliaryDisplay::CharacterReport => 43,
11058            AuxiliaryDisplay::DisplayData => 44,
11059            AuxiliaryDisplay::DisplayStatus => 45,
11060            AuxiliaryDisplay::StatNotReady => 46,
11061            AuxiliaryDisplay::StatReady => 47,
11062            AuxiliaryDisplay::ErrNotaloadablecharacter => 48,
11063            AuxiliaryDisplay::ErrFontdatacannotberead => 49,
11064            AuxiliaryDisplay::CursorPositionReport => 50,
11065            AuxiliaryDisplay::Row => 51,
11066            AuxiliaryDisplay::Column => 52,
11067            AuxiliaryDisplay::Rows => 53,
11068            AuxiliaryDisplay::Columns => 54,
11069            AuxiliaryDisplay::CursorPixelPositioning => 55,
11070            AuxiliaryDisplay::CursorMode => 56,
11071            AuxiliaryDisplay::CursorEnable => 57,
11072            AuxiliaryDisplay::CursorBlink => 58,
11073            AuxiliaryDisplay::FontReport => 59,
11074            AuxiliaryDisplay::FontData => 60,
11075            AuxiliaryDisplay::CharacterWidth => 61,
11076            AuxiliaryDisplay::CharacterHeight => 62,
11077            AuxiliaryDisplay::CharacterSpacingHorizontal => 63,
11078            AuxiliaryDisplay::CharacterSpacingVertical => 64,
11079            AuxiliaryDisplay::UnicodeCharacterSet => 65,
11080            AuxiliaryDisplay::Font7Segment => 66,
11081            AuxiliaryDisplay::SevenSegmentDirectMap => 67,
11082            AuxiliaryDisplay::Font14Segment => 68,
11083            AuxiliaryDisplay::One4SegmentDirectMap => 69,
11084            AuxiliaryDisplay::DisplayBrightness => 70,
11085            AuxiliaryDisplay::DisplayContrast => 71,
11086            AuxiliaryDisplay::CharacterAttribute => 72,
11087            AuxiliaryDisplay::AttributeReadback => 73,
11088            AuxiliaryDisplay::AttributeData => 74,
11089            AuxiliaryDisplay::CharAttrEnhance => 75,
11090            AuxiliaryDisplay::CharAttrUnderline => 76,
11091            AuxiliaryDisplay::CharAttrBlink => 77,
11092            AuxiliaryDisplay::BitmapSizeX => 128,
11093            AuxiliaryDisplay::BitmapSizeY => 129,
11094            AuxiliaryDisplay::MaxBlitSize => 130,
11095            AuxiliaryDisplay::BitDepthFormat => 131,
11096            AuxiliaryDisplay::DisplayOrientation => 132,
11097            AuxiliaryDisplay::PaletteReport => 133,
11098            AuxiliaryDisplay::PaletteDataSize => 134,
11099            AuxiliaryDisplay::PaletteDataOffset => 135,
11100            AuxiliaryDisplay::PaletteData => 136,
11101            AuxiliaryDisplay::BlitReport => 138,
11102            AuxiliaryDisplay::BlitRectangleX1 => 139,
11103            AuxiliaryDisplay::BlitRectangleY1 => 140,
11104            AuxiliaryDisplay::BlitRectangleX2 => 141,
11105            AuxiliaryDisplay::BlitRectangleY2 => 142,
11106            AuxiliaryDisplay::BlitData => 143,
11107            AuxiliaryDisplay::SoftButton => 144,
11108            AuxiliaryDisplay::SoftButtonID => 145,
11109            AuxiliaryDisplay::SoftButtonSide => 146,
11110            AuxiliaryDisplay::SoftButtonOffset1 => 147,
11111            AuxiliaryDisplay::SoftButtonOffset2 => 148,
11112            AuxiliaryDisplay::SoftButtonReport => 149,
11113            AuxiliaryDisplay::SoftKeys => 194,
11114            AuxiliaryDisplay::DisplayDataExtensions => 204,
11115            AuxiliaryDisplay::CharacterMapping => 207,
11116            AuxiliaryDisplay::UnicodeEquivalent => 221,
11117            AuxiliaryDisplay::CharacterPageMapping => 223,
11118            AuxiliaryDisplay::RequestReport => 255,
11119        }
11120    }
11121}
11122
11123impl From<AuxiliaryDisplay> for u16 {
11124    /// Returns the 16bit value of this usage. This is identical
11125    /// to [AuxiliaryDisplay::usage_page_value()].
11126    fn from(auxiliarydisplay: AuxiliaryDisplay) -> u16 {
11127        u16::from(&auxiliarydisplay)
11128    }
11129}
11130
11131impl From<&AuxiliaryDisplay> for u32 {
11132    /// Returns the 32 bit value of this usage. This is identical
11133    /// to [AuxiliaryDisplay::usage_value()].
11134    fn from(auxiliarydisplay: &AuxiliaryDisplay) -> u32 {
11135        let up = UsagePage::from(auxiliarydisplay);
11136        let up = (u16::from(&up) as u32) << 16;
11137        let id = u16::from(auxiliarydisplay) as u32;
11138        up | id
11139    }
11140}
11141
11142impl From<&AuxiliaryDisplay> for UsagePage {
11143    /// Always returns [UsagePage::AuxiliaryDisplay] and is
11144    /// identical to [AuxiliaryDisplay::usage_page()].
11145    fn from(_: &AuxiliaryDisplay) -> UsagePage {
11146        UsagePage::AuxiliaryDisplay
11147    }
11148}
11149
11150impl From<AuxiliaryDisplay> for UsagePage {
11151    /// Always returns [UsagePage::AuxiliaryDisplay] and is
11152    /// identical to [AuxiliaryDisplay::usage_page()].
11153    fn from(_: AuxiliaryDisplay) -> UsagePage {
11154        UsagePage::AuxiliaryDisplay
11155    }
11156}
11157
11158impl From<&AuxiliaryDisplay> for Usage {
11159    fn from(auxiliarydisplay: &AuxiliaryDisplay) -> Usage {
11160        Usage::try_from(u32::from(auxiliarydisplay)).unwrap()
11161    }
11162}
11163
11164impl From<AuxiliaryDisplay> for Usage {
11165    fn from(auxiliarydisplay: AuxiliaryDisplay) -> Usage {
11166        Usage::from(&auxiliarydisplay)
11167    }
11168}
11169
11170impl TryFrom<u16> for AuxiliaryDisplay {
11171    type Error = HutError;
11172
11173    fn try_from(usage_id: u16) -> Result<AuxiliaryDisplay> {
11174        match usage_id {
11175            1 => Ok(AuxiliaryDisplay::AlphanumericDisplay),
11176            2 => Ok(AuxiliaryDisplay::AuxiliaryDisplay),
11177            32 => Ok(AuxiliaryDisplay::DisplayAttributesReport),
11178            33 => Ok(AuxiliaryDisplay::ASCIICharacterSet),
11179            34 => Ok(AuxiliaryDisplay::DataReadBack),
11180            35 => Ok(AuxiliaryDisplay::FontReadBack),
11181            36 => Ok(AuxiliaryDisplay::DisplayControlReport),
11182            37 => Ok(AuxiliaryDisplay::ClearDisplay),
11183            38 => Ok(AuxiliaryDisplay::DisplayEnable),
11184            39 => Ok(AuxiliaryDisplay::ScreenSaverDelay),
11185            40 => Ok(AuxiliaryDisplay::ScreenSaverEnable),
11186            41 => Ok(AuxiliaryDisplay::VerticalScroll),
11187            42 => Ok(AuxiliaryDisplay::HorizontalScroll),
11188            43 => Ok(AuxiliaryDisplay::CharacterReport),
11189            44 => Ok(AuxiliaryDisplay::DisplayData),
11190            45 => Ok(AuxiliaryDisplay::DisplayStatus),
11191            46 => Ok(AuxiliaryDisplay::StatNotReady),
11192            47 => Ok(AuxiliaryDisplay::StatReady),
11193            48 => Ok(AuxiliaryDisplay::ErrNotaloadablecharacter),
11194            49 => Ok(AuxiliaryDisplay::ErrFontdatacannotberead),
11195            50 => Ok(AuxiliaryDisplay::CursorPositionReport),
11196            51 => Ok(AuxiliaryDisplay::Row),
11197            52 => Ok(AuxiliaryDisplay::Column),
11198            53 => Ok(AuxiliaryDisplay::Rows),
11199            54 => Ok(AuxiliaryDisplay::Columns),
11200            55 => Ok(AuxiliaryDisplay::CursorPixelPositioning),
11201            56 => Ok(AuxiliaryDisplay::CursorMode),
11202            57 => Ok(AuxiliaryDisplay::CursorEnable),
11203            58 => Ok(AuxiliaryDisplay::CursorBlink),
11204            59 => Ok(AuxiliaryDisplay::FontReport),
11205            60 => Ok(AuxiliaryDisplay::FontData),
11206            61 => Ok(AuxiliaryDisplay::CharacterWidth),
11207            62 => Ok(AuxiliaryDisplay::CharacterHeight),
11208            63 => Ok(AuxiliaryDisplay::CharacterSpacingHorizontal),
11209            64 => Ok(AuxiliaryDisplay::CharacterSpacingVertical),
11210            65 => Ok(AuxiliaryDisplay::UnicodeCharacterSet),
11211            66 => Ok(AuxiliaryDisplay::Font7Segment),
11212            67 => Ok(AuxiliaryDisplay::SevenSegmentDirectMap),
11213            68 => Ok(AuxiliaryDisplay::Font14Segment),
11214            69 => Ok(AuxiliaryDisplay::One4SegmentDirectMap),
11215            70 => Ok(AuxiliaryDisplay::DisplayBrightness),
11216            71 => Ok(AuxiliaryDisplay::DisplayContrast),
11217            72 => Ok(AuxiliaryDisplay::CharacterAttribute),
11218            73 => Ok(AuxiliaryDisplay::AttributeReadback),
11219            74 => Ok(AuxiliaryDisplay::AttributeData),
11220            75 => Ok(AuxiliaryDisplay::CharAttrEnhance),
11221            76 => Ok(AuxiliaryDisplay::CharAttrUnderline),
11222            77 => Ok(AuxiliaryDisplay::CharAttrBlink),
11223            128 => Ok(AuxiliaryDisplay::BitmapSizeX),
11224            129 => Ok(AuxiliaryDisplay::BitmapSizeY),
11225            130 => Ok(AuxiliaryDisplay::MaxBlitSize),
11226            131 => Ok(AuxiliaryDisplay::BitDepthFormat),
11227            132 => Ok(AuxiliaryDisplay::DisplayOrientation),
11228            133 => Ok(AuxiliaryDisplay::PaletteReport),
11229            134 => Ok(AuxiliaryDisplay::PaletteDataSize),
11230            135 => Ok(AuxiliaryDisplay::PaletteDataOffset),
11231            136 => Ok(AuxiliaryDisplay::PaletteData),
11232            138 => Ok(AuxiliaryDisplay::BlitReport),
11233            139 => Ok(AuxiliaryDisplay::BlitRectangleX1),
11234            140 => Ok(AuxiliaryDisplay::BlitRectangleY1),
11235            141 => Ok(AuxiliaryDisplay::BlitRectangleX2),
11236            142 => Ok(AuxiliaryDisplay::BlitRectangleY2),
11237            143 => Ok(AuxiliaryDisplay::BlitData),
11238            144 => Ok(AuxiliaryDisplay::SoftButton),
11239            145 => Ok(AuxiliaryDisplay::SoftButtonID),
11240            146 => Ok(AuxiliaryDisplay::SoftButtonSide),
11241            147 => Ok(AuxiliaryDisplay::SoftButtonOffset1),
11242            148 => Ok(AuxiliaryDisplay::SoftButtonOffset2),
11243            149 => Ok(AuxiliaryDisplay::SoftButtonReport),
11244            194 => Ok(AuxiliaryDisplay::SoftKeys),
11245            204 => Ok(AuxiliaryDisplay::DisplayDataExtensions),
11246            207 => Ok(AuxiliaryDisplay::CharacterMapping),
11247            221 => Ok(AuxiliaryDisplay::UnicodeEquivalent),
11248            223 => Ok(AuxiliaryDisplay::CharacterPageMapping),
11249            255 => Ok(AuxiliaryDisplay::RequestReport),
11250            n => Err(HutError::UnknownUsageId { usage_id: n }),
11251        }
11252    }
11253}
11254
11255impl BitOr<u16> for AuxiliaryDisplay {
11256    type Output = Usage;
11257
11258    /// A convenience function to combine a Usage Page with
11259    /// a value.
11260    ///
11261    /// This function panics if the Usage ID value results in
11262    /// an unknown Usage. Where error checking is required,
11263    /// use [UsagePage::to_usage_from_value].
11264    fn bitor(self, usage: u16) -> Usage {
11265        let up = u16::from(self) as u32;
11266        let u = usage as u32;
11267        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
11268    }
11269}
11270
11271/// *Usage Page `0x20`: "Sensors"*
11272///
11273/// **This enum is autogenerated from the HID Usage Tables**.
11274/// ```
11275/// # use hut::*;
11276/// let u1 = Usage::Sensors(Sensors::Biometric);
11277/// let u2 = Usage::new_from_page_and_id(0x20, 0x10).unwrap();
11278/// let u3 = Usage::from(Sensors::Biometric);
11279/// let u4: Usage = Sensors::Biometric.into();
11280/// assert_eq!(u1, u2);
11281/// assert_eq!(u1, u3);
11282/// assert_eq!(u1, u4);
11283///
11284/// assert!(matches!(u1.usage_page(), UsagePage::Sensors));
11285/// assert_eq!(0x20, u1.usage_page_value());
11286/// assert_eq!(0x10, u1.usage_id_value());
11287/// assert_eq!((0x20 << 16) | 0x10, u1.usage_value());
11288/// assert_eq!("Biometric", u1.name());
11289/// ```
11290///
11291#[allow(non_camel_case_types)]
11292#[derive(Debug)]
11293#[non_exhaustive]
11294pub enum Sensors {
11295    /// Usage ID `0x1`: "Sensor"
11296    Sensor,
11297    /// Usage ID `0x10`: "Biometric"
11298    Biometric,
11299    /// Usage ID `0x11`: "Biometric: Human Presence"
11300    BiometricHumanPresence,
11301    /// Usage ID `0x12`: "Biometric: Human Proximity"
11302    BiometricHumanProximity,
11303    /// Usage ID `0x13`: "Biometric: Human Touch"
11304    BiometricHumanTouch,
11305    /// Usage ID `0x14`: "Biometric: Blood Pressure"
11306    BiometricBloodPressure,
11307    /// Usage ID `0x15`: "Biometric: Body Temperature"
11308    BiometricBodyTemperature,
11309    /// Usage ID `0x16`: "Biometric: Heart Rate"
11310    BiometricHeartRate,
11311    /// Usage ID `0x17`: "Biometric: Heart Rate Variability"
11312    BiometricHeartRateVariability,
11313    /// Usage ID `0x18`: "Biometric: Peripheral Oxygen Saturation"
11314    BiometricPeripheralOxygenSaturation,
11315    /// Usage ID `0x19`: "Biometric: Respiratory Rate"
11316    BiometricRespiratoryRate,
11317    /// Usage ID `0x20`: "Electrical"
11318    Electrical,
11319    /// Usage ID `0x21`: "Electrical: Capacitance"
11320    ElectricalCapacitance,
11321    /// Usage ID `0x22`: "Electrical: Current"
11322    ElectricalCurrent,
11323    /// Usage ID `0x23`: "Electrical: Power"
11324    ElectricalPower,
11325    /// Usage ID `0x24`: "Electrical: Inductance"
11326    ElectricalInductance,
11327    /// Usage ID `0x25`: "Electrical: Resistance"
11328    ElectricalResistance,
11329    /// Usage ID `0x26`: "Electrical: Voltage"
11330    ElectricalVoltage,
11331    /// Usage ID `0x27`: "Electrical: Potentiometer"
11332    ElectricalPotentiometer,
11333    /// Usage ID `0x28`: "Electrical: Frequency"
11334    ElectricalFrequency,
11335    /// Usage ID `0x29`: "Electrical: Period"
11336    ElectricalPeriod,
11337    /// Usage ID `0x30`: "Environmental"
11338    Environmental,
11339    /// Usage ID `0x31`: "Environmental: Atmospheric Pressure"
11340    EnvironmentalAtmosphericPressure,
11341    /// Usage ID `0x32`: "Environmental: Humidity"
11342    EnvironmentalHumidity,
11343    /// Usage ID `0x33`: "Environmental: Temperature"
11344    EnvironmentalTemperature,
11345    /// Usage ID `0x34`: "Environmental: Wind Direction"
11346    EnvironmentalWindDirection,
11347    /// Usage ID `0x35`: "Environmental: Wind Speed"
11348    EnvironmentalWindSpeed,
11349    /// Usage ID `0x36`: "Environmental: Air Quality"
11350    EnvironmentalAirQuality,
11351    /// Usage ID `0x37`: "Environmental: Heat Index"
11352    EnvironmentalHeatIndex,
11353    /// Usage ID `0x38`: "Environmental: Surface Temperature"
11354    EnvironmentalSurfaceTemperature,
11355    /// Usage ID `0x39`: "Environmental: Volatile Organic Compounds"
11356    EnvironmentalVolatileOrganicCompounds,
11357    /// Usage ID `0x3A`: "Environmental: Object Presence"
11358    EnvironmentalObjectPresence,
11359    /// Usage ID `0x3B`: "Environmental: Object Proximity"
11360    EnvironmentalObjectProximity,
11361    /// Usage ID `0x40`: "Light"
11362    Light,
11363    /// Usage ID `0x41`: "Light: Ambient Light"
11364    LightAmbientLight,
11365    /// Usage ID `0x42`: "Light: Consumer Infrared"
11366    LightConsumerInfrared,
11367    /// Usage ID `0x43`: "Light: Infrared Light"
11368    LightInfraredLight,
11369    /// Usage ID `0x44`: "Light: Visible Light"
11370    LightVisibleLight,
11371    /// Usage ID `0x45`: "Light: Ultraviolet Light"
11372    LightUltravioletLight,
11373    /// Usage ID `0x50`: "Location"
11374    Location,
11375    /// Usage ID `0x51`: "Location: Broadcast"
11376    LocationBroadcast,
11377    /// Usage ID `0x52`: "Location: Dead Reckoning"
11378    LocationDeadReckoning,
11379    /// Usage ID `0x53`: "Location: GPS (Global Positioning System)"
11380    LocationGPSGlobalPositioningSystem,
11381    /// Usage ID `0x54`: "Location: Lookup"
11382    LocationLookup,
11383    /// Usage ID `0x55`: "Location: Other"
11384    LocationOther,
11385    /// Usage ID `0x56`: "Location: Static"
11386    LocationStatic,
11387    /// Usage ID `0x57`: "Location: Triangulation"
11388    LocationTriangulation,
11389    /// Usage ID `0x60`: "Mechanical"
11390    Mechanical,
11391    /// Usage ID `0x61`: "Mechanical: Boolean Switch"
11392    MechanicalBooleanSwitch,
11393    /// Usage ID `0x62`: "Mechanical: Boolean Switch Array"
11394    MechanicalBooleanSwitchArray,
11395    /// Usage ID `0x63`: "Mechanical: Multivalue Switch"
11396    MechanicalMultivalueSwitch,
11397    /// Usage ID `0x64`: "Mechanical: Force"
11398    MechanicalForce,
11399    /// Usage ID `0x65`: "Mechanical: Pressure"
11400    MechanicalPressure,
11401    /// Usage ID `0x66`: "Mechanical: Strain"
11402    MechanicalStrain,
11403    /// Usage ID `0x67`: "Mechanical: Weight"
11404    MechanicalWeight,
11405    /// Usage ID `0x68`: "Mechanical: Haptic Vibrator"
11406    MechanicalHapticVibrator,
11407    /// Usage ID `0x69`: "Mechanical: Hall Effect Switch"
11408    MechanicalHallEffectSwitch,
11409    /// Usage ID `0x70`: "Motion"
11410    Motion,
11411    /// Usage ID `0x71`: "Motion: Accelerometer 1D"
11412    MotionAccelerometer1D,
11413    /// Usage ID `0x72`: "Motion: Accelerometer 2D"
11414    MotionAccelerometer2D,
11415    /// Usage ID `0x73`: "Motion: Accelerometer 3D"
11416    MotionAccelerometer3D,
11417    /// Usage ID `0x74`: "Motion: Gyrometer 1D"
11418    MotionGyrometer1D,
11419    /// Usage ID `0x75`: "Motion: Gyrometer 2D"
11420    MotionGyrometer2D,
11421    /// Usage ID `0x76`: "Motion: Gyrometer 3D"
11422    MotionGyrometer3D,
11423    /// Usage ID `0x77`: "Motion: Motion Detector"
11424    MotionMotionDetector,
11425    /// Usage ID `0x78`: "Motion: Speedometer"
11426    MotionSpeedometer,
11427    /// Usage ID `0x79`: "Motion: Accelerometer"
11428    MotionAccelerometer,
11429    /// Usage ID `0x7A`: "Motion: Gyrometer"
11430    MotionGyrometer,
11431    /// Usage ID `0x7B`: "Motion: Gravity Vector"
11432    MotionGravityVector,
11433    /// Usage ID `0x7C`: "Motion: Linear Accelerometer"
11434    MotionLinearAccelerometer,
11435    /// Usage ID `0x80`: "Orientation"
11436    Orientation,
11437    /// Usage ID `0x81`: "Orientation: Compass 1D"
11438    OrientationCompass1D,
11439    /// Usage ID `0x82`: "Orientation: Compass 2D"
11440    OrientationCompass2D,
11441    /// Usage ID `0x83`: "Orientation: Compass 3D"
11442    OrientationCompass3D,
11443    /// Usage ID `0x84`: "Orientation: Inclinometer 1D"
11444    OrientationInclinometer1D,
11445    /// Usage ID `0x85`: "Orientation: Inclinometer 2D"
11446    OrientationInclinometer2D,
11447    /// Usage ID `0x86`: "Orientation: Inclinometer 3D"
11448    OrientationInclinometer3D,
11449    /// Usage ID `0x87`: "Orientation: Distance 1D"
11450    OrientationDistance1D,
11451    /// Usage ID `0x88`: "Orientation: Distance 2D"
11452    OrientationDistance2D,
11453    /// Usage ID `0x89`: "Orientation: Distance 3D"
11454    OrientationDistance3D,
11455    /// Usage ID `0x8A`: "Orientation: Device Orientation"
11456    OrientationDeviceOrientation,
11457    /// Usage ID `0x8B`: "Orientation: Compass"
11458    OrientationCompass,
11459    /// Usage ID `0x8C`: "Orientation: Inclinometer"
11460    OrientationInclinometer,
11461    /// Usage ID `0x8D`: "Orientation: Distance"
11462    OrientationDistance,
11463    /// Usage ID `0x8E`: "Orientation: Relative Orientation"
11464    OrientationRelativeOrientation,
11465    /// Usage ID `0x8F`: "Orientation: Simple Orientation"
11466    OrientationSimpleOrientation,
11467    /// Usage ID `0x90`: "Scanner"
11468    Scanner,
11469    /// Usage ID `0x91`: "Scanner: Barcode"
11470    ScannerBarcode,
11471    /// Usage ID `0x92`: "Scanner: RFID"
11472    ScannerRFID,
11473    /// Usage ID `0x93`: "Scanner: NFC"
11474    ScannerNFC,
11475    /// Usage ID `0xA0`: "Time"
11476    Time,
11477    /// Usage ID `0xA1`: "Time: Alarm Timer"
11478    TimeAlarmTimer,
11479    /// Usage ID `0xA2`: "Time: Real Time Clock"
11480    TimeRealTimeClock,
11481    /// Usage ID `0xB0`: "Personal Activity"
11482    PersonalActivity,
11483    /// Usage ID `0xB1`: "Personal Activity: Activity Detection"
11484    PersonalActivityActivityDetection,
11485    /// Usage ID `0xB2`: "Personal Activity: Device Position"
11486    PersonalActivityDevicePosition,
11487    /// Usage ID `0xB3`: "Personal Activity: Floor Tracker"
11488    PersonalActivityFloorTracker,
11489    /// Usage ID `0xB4`: "Personal Activity: Pedometer"
11490    PersonalActivityPedometer,
11491    /// Usage ID `0xB5`: "Personal Activity: Step Detection"
11492    PersonalActivityStepDetection,
11493    /// Usage ID `0xC0`: "Orientation Extended"
11494    OrientationExtended,
11495    /// Usage ID `0xC1`: "Orientation Extended: Geomagnetic Orientation"
11496    OrientationExtendedGeomagneticOrientation,
11497    /// Usage ID `0xC2`: "Orientation Extended: Magnetometer"
11498    OrientationExtendedMagnetometer,
11499    /// Usage ID `0xD0`: "Gesture"
11500    Gesture,
11501    /// Usage ID `0xD1`: "Gesture: Chassis Flip Gesture"
11502    GestureChassisFlipGesture,
11503    /// Usage ID `0xD2`: "Gesture: Hinge Fold Gesture"
11504    GestureHingeFoldGesture,
11505    /// Usage ID `0xE0`: "Other"
11506    Other,
11507    /// Usage ID `0xE1`: "Other: Custom"
11508    OtherCustom,
11509    /// Usage ID `0xE2`: "Other: Generic"
11510    OtherGeneric,
11511    /// Usage ID `0xE3`: "Other: Generic Enumerator"
11512    OtherGenericEnumerator,
11513    /// Usage ID `0xE4`: "Other: Hinge Angle"
11514    OtherHingeAngle,
11515    /// Usage ID `0xF0`: "Vendor Reserved 1"
11516    VendorReserved1,
11517    /// Usage ID `0xF1`: "Vendor Reserved 2"
11518    VendorReserved2,
11519    /// Usage ID `0xF2`: "Vendor Reserved 3"
11520    VendorReserved3,
11521    /// Usage ID `0xF3`: "Vendor Reserved 4"
11522    VendorReserved4,
11523    /// Usage ID `0xF4`: "Vendor Reserved 5"
11524    VendorReserved5,
11525    /// Usage ID `0xF5`: "Vendor Reserved 6"
11526    VendorReserved6,
11527    /// Usage ID `0xF6`: "Vendor Reserved 7"
11528    VendorReserved7,
11529    /// Usage ID `0xF7`: "Vendor Reserved 8"
11530    VendorReserved8,
11531    /// Usage ID `0xF8`: "Vendor Reserved 9"
11532    VendorReserved9,
11533    /// Usage ID `0xF9`: "Vendor Reserved 10"
11534    VendorReserved10,
11535    /// Usage ID `0xFA`: "Vendor Reserved 11"
11536    VendorReserved11,
11537    /// Usage ID `0xFB`: "Vendor Reserved 12"
11538    VendorReserved12,
11539    /// Usage ID `0xFC`: "Vendor Reserved 13"
11540    VendorReserved13,
11541    /// Usage ID `0xFD`: "Vendor Reserved 14"
11542    VendorReserved14,
11543    /// Usage ID `0xFE`: "Vendor Reserved 15"
11544    VendorReserved15,
11545    /// Usage ID `0xFF`: "Vendor Reserved 16"
11546    VendorReserved16,
11547    /// Usage ID `0x200`: "Event"
11548    Event,
11549    /// Usage ID `0x201`: "Event: Sensor State"
11550    EventSensorState,
11551    /// Usage ID `0x202`: "Event: Sensor Event"
11552    EventSensorEvent,
11553    /// Usage ID `0x300`: "Property"
11554    Property,
11555    /// Usage ID `0x301`: "Property: Friendly Name"
11556    PropertyFriendlyName,
11557    /// Usage ID `0x302`: "Property: Persistent Unique ID"
11558    PropertyPersistentUniqueID,
11559    /// Usage ID `0x303`: "Property: Sensor Status"
11560    PropertySensorStatus,
11561    /// Usage ID `0x304`: "Property: Minimum Report Interval"
11562    PropertyMinimumReportInterval,
11563    /// Usage ID `0x305`: "Property: Sensor Manufacturer"
11564    PropertySensorManufacturer,
11565    /// Usage ID `0x306`: "Property: Sensor Model"
11566    PropertySensorModel,
11567    /// Usage ID `0x307`: "Property: Sensor Serial Number"
11568    PropertySensorSerialNumber,
11569    /// Usage ID `0x308`: "Property: Sensor Description"
11570    PropertySensorDescription,
11571    /// Usage ID `0x309`: "Property: Sensor Connection Type"
11572    PropertySensorConnectionType,
11573    /// Usage ID `0x30A`: "Property: Sensor Device Path"
11574    PropertySensorDevicePath,
11575    /// Usage ID `0x30B`: "Property: Hardware Revision"
11576    PropertyHardwareRevision,
11577    /// Usage ID `0x30C`: "Property: Firmware Version"
11578    PropertyFirmwareVersion,
11579    /// Usage ID `0x30D`: "Property: Release Date"
11580    PropertyReleaseDate,
11581    /// Usage ID `0x30E`: "Property: Report Interval"
11582    PropertyReportInterval,
11583    /// Usage ID `0x30F`: "Property: Change Sensitivity Absolute"
11584    PropertyChangeSensitivityAbsolute,
11585    /// Usage ID `0x310`: "Property: Change Sensitivity Percent of Range"
11586    PropertyChangeSensitivityPercentofRange,
11587    /// Usage ID `0x311`: "Property: Change Sensitivity Percent Relative"
11588    PropertyChangeSensitivityPercentRelative,
11589    /// Usage ID `0x312`: "Property: Accuracy"
11590    PropertyAccuracy,
11591    /// Usage ID `0x313`: "Property: Resolution"
11592    PropertyResolution,
11593    /// Usage ID `0x314`: "Property: Maximum"
11594    PropertyMaximum,
11595    /// Usage ID `0x315`: "Property: Minimum"
11596    PropertyMinimum,
11597    /// Usage ID `0x316`: "Property: Reporting State"
11598    PropertyReportingState,
11599    /// Usage ID `0x317`: "Property: Sampling Rate"
11600    PropertySamplingRate,
11601    /// Usage ID `0x318`: "Property: Response Curve"
11602    PropertyResponseCurve,
11603    /// Usage ID `0x319`: "Property: Power State"
11604    PropertyPowerState,
11605    /// Usage ID `0x31A`: "Property: Maximum FIFO Events"
11606    PropertyMaximumFIFOEvents,
11607    /// Usage ID `0x31B`: "Property: Report Latency"
11608    PropertyReportLatency,
11609    /// Usage ID `0x31C`: "Property: Flush FIFO Events"
11610    PropertyFlushFIFOEvents,
11611    /// Usage ID `0x31D`: "Property: Maximum Power Consumption"
11612    PropertyMaximumPowerConsumption,
11613    /// Usage ID `0x31E`: "Property: Is Primary"
11614    PropertyIsPrimary,
11615    /// Usage ID `0x31F`: "Property: Human Presence Detection Type"
11616    PropertyHumanPresenceDetectionType,
11617    /// Usage ID `0x400`: "Data Field: Location"
11618    DataFieldLocation,
11619    /// Usage ID `0x402`: "Data Field: Altitude Antenna Sea Level"
11620    DataFieldAltitudeAntennaSeaLevel,
11621    /// Usage ID `0x403`: "Data Field: Differential Reference Station ID"
11622    DataFieldDifferentialReferenceStationID,
11623    /// Usage ID `0x404`: "Data Field: Altitude Ellipsoid Error"
11624    DataFieldAltitudeEllipsoidError,
11625    /// Usage ID `0x405`: "Data Field: Altitude Ellipsoid"
11626    DataFieldAltitudeEllipsoid,
11627    /// Usage ID `0x406`: "Data Field: Altitude Sea Level Error"
11628    DataFieldAltitudeSeaLevelError,
11629    /// Usage ID `0x407`: "Data Field: Altitude Sea Level"
11630    DataFieldAltitudeSeaLevel,
11631    /// Usage ID `0x408`: "Data Field: Differential GPS Data Age"
11632    DataFieldDifferentialGPSDataAge,
11633    /// Usage ID `0x409`: "Data Field: Error Radius"
11634    DataFieldErrorRadius,
11635    /// Usage ID `0x40A`: "Data Field: Fix Quality"
11636    DataFieldFixQuality,
11637    /// Usage ID `0x40B`: "Data Field: Fix Type"
11638    DataFieldFixType,
11639    /// Usage ID `0x40C`: "Data Field: Geoidal Separation"
11640    DataFieldGeoidalSeparation,
11641    /// Usage ID `0x40D`: "Data Field: GPS Operation Mode"
11642    DataFieldGPSOperationMode,
11643    /// Usage ID `0x40E`: "Data Field: GPS Selection Mode"
11644    DataFieldGPSSelectionMode,
11645    /// Usage ID `0x40F`: "Data Field: GPS Status"
11646    DataFieldGPSStatus,
11647    /// Usage ID `0x410`: "Data Field: Position Dilution of Precision"
11648    DataFieldPositionDilutionofPrecision,
11649    /// Usage ID `0x411`: "Data Field: Horizontal Dilution of Precision"
11650    DataFieldHorizontalDilutionofPrecision,
11651    /// Usage ID `0x412`: "Data Field: Vertical Dilution of Precision"
11652    DataFieldVerticalDilutionofPrecision,
11653    /// Usage ID `0x413`: "Data Field: Latitude"
11654    DataFieldLatitude,
11655    /// Usage ID `0x414`: "Data Field: Longitude"
11656    DataFieldLongitude,
11657    /// Usage ID `0x415`: "Data Field: True Heading"
11658    DataFieldTrueHeading,
11659    /// Usage ID `0x416`: "Data Field: Magnetic Heading"
11660    DataFieldMagneticHeading,
11661    /// Usage ID `0x417`: "Data Field: Magnetic Variation"
11662    DataFieldMagneticVariation,
11663    /// Usage ID `0x418`: "Data Field: Speed"
11664    DataFieldSpeed,
11665    /// Usage ID `0x419`: "Data Field: Satellites in View"
11666    DataFieldSatellitesinView,
11667    /// Usage ID `0x41A`: "Data Field: Satellites in View Azimuth"
11668    DataFieldSatellitesinViewAzimuth,
11669    /// Usage ID `0x41B`: "Data Field: Satellites in View Elevation"
11670    DataFieldSatellitesinViewElevation,
11671    /// Usage ID `0x41C`: "Data Field: Satellites in View IDs"
11672    DataFieldSatellitesinViewIDs,
11673    /// Usage ID `0x41D`: "Data Field: Satellites in View PRNs"
11674    DataFieldSatellitesinViewPRNs,
11675    /// Usage ID `0x41E`: "Data Field: Satellites in View S/N Ratios"
11676    DataFieldSatellitesinViewSNRatios,
11677    /// Usage ID `0x41F`: "Data Field: Satellites Used Count"
11678    DataFieldSatellitesUsedCount,
11679    /// Usage ID `0x420`: "Data Field: Satellites Used PRNs"
11680    DataFieldSatellitesUsedPRNs,
11681    /// Usage ID `0x421`: "Data Field: NMEA Sentence"
11682    DataFieldNMEASentence,
11683    /// Usage ID `0x422`: "Data Field: Address Line 1"
11684    DataFieldAddressLine1,
11685    /// Usage ID `0x423`: "Data Field: Address Line 2"
11686    DataFieldAddressLine2,
11687    /// Usage ID `0x424`: "Data Field: City"
11688    DataFieldCity,
11689    /// Usage ID `0x425`: "Data Field: State or Province"
11690    DataFieldStateorProvince,
11691    /// Usage ID `0x426`: "Data Field: Country or Region"
11692    DataFieldCountryorRegion,
11693    /// Usage ID `0x427`: "Data Field: Postal Code"
11694    DataFieldPostalCode,
11695    /// Usage ID `0x42A`: "Property: Location"
11696    PropertyLocation,
11697    /// Usage ID `0x42B`: "Property: Location Desired Accuracy"
11698    PropertyLocationDesiredAccuracy,
11699    /// Usage ID `0x430`: "Data Field: Environmental"
11700    DataFieldEnvironmental,
11701    /// Usage ID `0x431`: "Data Field: Atmospheric Pressure"
11702    DataFieldAtmosphericPressure,
11703    /// Usage ID `0x433`: "Data Field: Relative Humidity"
11704    DataFieldRelativeHumidity,
11705    /// Usage ID `0x434`: "Data Field: Temperature"
11706    DataFieldTemperature,
11707    /// Usage ID `0x435`: "Data Field: Wind Direction"
11708    DataFieldWindDirection,
11709    /// Usage ID `0x436`: "Data Field: Wind Speed"
11710    DataFieldWindSpeed,
11711    /// Usage ID `0x437`: "Data Field: Air Quality Index"
11712    DataFieldAirQualityIndex,
11713    /// Usage ID `0x438`: "Data Field: Equivalent CO2"
11714    DataFieldEquivalentCO2,
11715    /// Usage ID `0x439`: "Data Field: Volatile Organic Compound Concentration"
11716    DataFieldVolatileOrganicCompoundConcentration,
11717    /// Usage ID `0x43A`: "Data Field: Object Presence"
11718    DataFieldObjectPresence,
11719    /// Usage ID `0x43B`: "Data Field: Object Proximity Range"
11720    DataFieldObjectProximityRange,
11721    /// Usage ID `0x43C`: "Data Field: Object Proximity Out of Range"
11722    DataFieldObjectProximityOutofRange,
11723    /// Usage ID `0x440`: "Property: Environmental"
11724    PropertyEnvironmental,
11725    /// Usage ID `0x441`: "Property: Reference Pressure"
11726    PropertyReferencePressure,
11727    /// Usage ID `0x450`: "Data Field: Motion"
11728    DataFieldMotion,
11729    /// Usage ID `0x451`: "Data Field: Motion State"
11730    DataFieldMotionState,
11731    /// Usage ID `0x452`: "Data Field: Acceleration"
11732    DataFieldAcceleration,
11733    /// Usage ID `0x453`: "Data Field: Acceleration Axis X"
11734    DataFieldAccelerationAxisX,
11735    /// Usage ID `0x454`: "Data Field: Acceleration Axis Y"
11736    DataFieldAccelerationAxisY,
11737    /// Usage ID `0x455`: "Data Field: Acceleration Axis Z"
11738    DataFieldAccelerationAxisZ,
11739    /// Usage ID `0x456`: "Data Field: Angular Velocity"
11740    DataFieldAngularVelocity,
11741    /// Usage ID `0x457`: "Data Field: Angular Velocity about X Axis"
11742    DataFieldAngularVelocityaboutXAxis,
11743    /// Usage ID `0x458`: "Data Field: Angular Velocity about Y Axis"
11744    DataFieldAngularVelocityaboutYAxis,
11745    /// Usage ID `0x459`: "Data Field: Angular Velocity about Z Axis"
11746    DataFieldAngularVelocityaboutZAxis,
11747    /// Usage ID `0x45A`: "Data Field: Angular Position"
11748    DataFieldAngularPosition,
11749    /// Usage ID `0x45B`: "Data Field: Angular Position about X Axis"
11750    DataFieldAngularPositionaboutXAxis,
11751    /// Usage ID `0x45C`: "Data Field: Angular Position about Y Axis"
11752    DataFieldAngularPositionaboutYAxis,
11753    /// Usage ID `0x45D`: "Data Field: Angular Position about Z Axis"
11754    DataFieldAngularPositionaboutZAxis,
11755    /// Usage ID `0x45E`: "Data Field: Motion Speed"
11756    DataFieldMotionSpeed,
11757    /// Usage ID `0x45F`: "Data Field: Motion Intensity"
11758    DataFieldMotionIntensity,
11759    /// Usage ID `0x470`: "Data Field: Orientation"
11760    DataFieldOrientation,
11761    /// Usage ID `0x471`: "Data Field: Heading"
11762    DataFieldHeading,
11763    /// Usage ID `0x472`: "Data Field: Heading X Axis"
11764    DataFieldHeadingXAxis,
11765    /// Usage ID `0x473`: "Data Field: Heading Y Axis"
11766    DataFieldHeadingYAxis,
11767    /// Usage ID `0x474`: "Data Field: Heading Z Axis"
11768    DataFieldHeadingZAxis,
11769    /// Usage ID `0x475`: "Data Field: Heading Compensated Magnetic North"
11770    DataFieldHeadingCompensatedMagneticNorth,
11771    /// Usage ID `0x476`: "Data Field: Heading Compensated True North"
11772    DataFieldHeadingCompensatedTrueNorth,
11773    /// Usage ID `0x477`: "Data Field: Heading Magnetic North"
11774    DataFieldHeadingMagneticNorth,
11775    /// Usage ID `0x478`: "Data Field: Heading True North"
11776    DataFieldHeadingTrueNorth,
11777    /// Usage ID `0x479`: "Data Field: Distance"
11778    DataFieldDistance,
11779    /// Usage ID `0x47A`: "Data Field: Distance X Axis"
11780    DataFieldDistanceXAxis,
11781    /// Usage ID `0x47B`: "Data Field: Distance Y Axis"
11782    DataFieldDistanceYAxis,
11783    /// Usage ID `0x47C`: "Data Field: Distance Z Axis"
11784    DataFieldDistanceZAxis,
11785    /// Usage ID `0x47D`: "Data Field: Distance Out-of-Range"
11786    DataFieldDistanceOutofRange,
11787    /// Usage ID `0x47E`: "Data Field: Tilt"
11788    DataFieldTilt,
11789    /// Usage ID `0x47F`: "Data Field: Tilt X Axis"
11790    DataFieldTiltXAxis,
11791    /// Usage ID `0x480`: "Data Field: Tilt Y Axis"
11792    DataFieldTiltYAxis,
11793    /// Usage ID `0x481`: "Data Field: Tilt Z Axis"
11794    DataFieldTiltZAxis,
11795    /// Usage ID `0x482`: "Data Field: Rotation Matrix"
11796    DataFieldRotationMatrix,
11797    /// Usage ID `0x483`: "Data Field: Quaternion"
11798    DataFieldQuaternion,
11799    /// Usage ID `0x484`: "Data Field: Magnetic Flux"
11800    DataFieldMagneticFlux,
11801    /// Usage ID `0x485`: "Data Field: Magnetic Flux X Axis"
11802    DataFieldMagneticFluxXAxis,
11803    /// Usage ID `0x486`: "Data Field: Magnetic Flux Y Axis"
11804    DataFieldMagneticFluxYAxis,
11805    /// Usage ID `0x487`: "Data Field: Magnetic Flux Z Axis"
11806    DataFieldMagneticFluxZAxis,
11807    /// Usage ID `0x488`: "Data Field: Magnetometer Accuracy"
11808    DataFieldMagnetometerAccuracy,
11809    /// Usage ID `0x489`: "Data Field: Simple Orientation Direction"
11810    DataFieldSimpleOrientationDirection,
11811    /// Usage ID `0x490`: "Data Field: Mechanical"
11812    DataFieldMechanical,
11813    /// Usage ID `0x491`: "Data Field: Boolean Switch State"
11814    DataFieldBooleanSwitchState,
11815    /// Usage ID `0x492`: "Data Field: Boolean Switch Array States"
11816    DataFieldBooleanSwitchArrayStates,
11817    /// Usage ID `0x493`: "Data Field: Multivalue Switch Value"
11818    DataFieldMultivalueSwitchValue,
11819    /// Usage ID `0x494`: "Data Field: Force"
11820    DataFieldForce,
11821    /// Usage ID `0x495`: "Data Field: Absolute Pressure"
11822    DataFieldAbsolutePressure,
11823    /// Usage ID `0x496`: "Data Field: Gauge Pressure"
11824    DataFieldGaugePressure,
11825    /// Usage ID `0x497`: "Data Field: Strain"
11826    DataFieldStrain,
11827    /// Usage ID `0x498`: "Data Field: Weight"
11828    DataFieldWeight,
11829    /// Usage ID `0x4A0`: "Property: Mechanical"
11830    PropertyMechanical,
11831    /// Usage ID `0x4A1`: "Property: Vibration State"
11832    PropertyVibrationState,
11833    /// Usage ID `0x4A2`: "Property: Forward Vibration Speed"
11834    PropertyForwardVibrationSpeed,
11835    /// Usage ID `0x4A3`: "Property: Backward Vibration Speed"
11836    PropertyBackwardVibrationSpeed,
11837    /// Usage ID `0x4B0`: "Data Field: Biometric"
11838    DataFieldBiometric,
11839    /// Usage ID `0x4B1`: "Data Field: Human Presence"
11840    DataFieldHumanPresence,
11841    /// Usage ID `0x4B2`: "Data Field: Human Proximity Range"
11842    DataFieldHumanProximityRange,
11843    /// Usage ID `0x4B3`: "Data Field: Human Proximity Out of Range"
11844    DataFieldHumanProximityOutofRange,
11845    /// Usage ID `0x4B4`: "Data Field: Human Touch State"
11846    DataFieldHumanTouchState,
11847    /// Usage ID `0x4B5`: "Data Field: Blood Pressure"
11848    DataFieldBloodPressure,
11849    /// Usage ID `0x4B6`: "Data Field: Blood Pressure Diastolic"
11850    DataFieldBloodPressureDiastolic,
11851    /// Usage ID `0x4B7`: "Data Field: Blood Pressure Systolic"
11852    DataFieldBloodPressureSystolic,
11853    /// Usage ID `0x4B8`: "Data Field: Heart Rate"
11854    DataFieldHeartRate,
11855    /// Usage ID `0x4B9`: "Data Field: Resting Heart Rate"
11856    DataFieldRestingHeartRate,
11857    /// Usage ID `0x4BA`: "Data Field: Heartbeat Interval"
11858    DataFieldHeartbeatInterval,
11859    /// Usage ID `0x4BB`: "Data Field: Respiratory Rate"
11860    DataFieldRespiratoryRate,
11861    /// Usage ID `0x4BC`: "Data Field: SpO2"
11862    DataFieldSpO2,
11863    /// Usage ID `0x4BD`: "Data Field: Human Attention Detected"
11864    DataFieldHumanAttentionDetected,
11865    /// Usage ID `0x4BE`: "Data Field: Human Head Azimuth"
11866    DataFieldHumanHeadAzimuth,
11867    /// Usage ID `0x4BF`: "Data Field: Human Head Altitude"
11868    DataFieldHumanHeadAltitude,
11869    /// Usage ID `0x4C0`: "Data Field: Human Head Roll"
11870    DataFieldHumanHeadRoll,
11871    /// Usage ID `0x4C1`: "Data Field: Human Head Pitch"
11872    DataFieldHumanHeadPitch,
11873    /// Usage ID `0x4C2`: "Data Field: Human Head Yaw"
11874    DataFieldHumanHeadYaw,
11875    /// Usage ID `0x4C3`: "Data Field: Human Correlation Id"
11876    DataFieldHumanCorrelationId,
11877    /// Usage ID `0x4D0`: "Data Field: Light"
11878    DataFieldLight,
11879    /// Usage ID `0x4D1`: "Data Field: Illuminance"
11880    DataFieldIlluminance,
11881    /// Usage ID `0x4D2`: "Data Field: Color Temperature"
11882    DataFieldColorTemperature,
11883    /// Usage ID `0x4D3`: "Data Field: Chromaticity"
11884    DataFieldChromaticity,
11885    /// Usage ID `0x4D4`: "Data Field: Chromaticity X"
11886    DataFieldChromaticityX,
11887    /// Usage ID `0x4D5`: "Data Field: Chromaticity Y"
11888    DataFieldChromaticityY,
11889    /// Usage ID `0x4D6`: "Data Field: Consumer IR Sentence Receive"
11890    DataFieldConsumerIRSentenceReceive,
11891    /// Usage ID `0x4D7`: "Data Field: Infrared Light"
11892    DataFieldInfraredLight,
11893    /// Usage ID `0x4D8`: "Data Field: Red Light"
11894    DataFieldRedLight,
11895    /// Usage ID `0x4D9`: "Data Field: Green Light"
11896    DataFieldGreenLight,
11897    /// Usage ID `0x4DA`: "Data Field: Blue Light"
11898    DataFieldBlueLight,
11899    /// Usage ID `0x4DB`: "Data Field: Ultraviolet A Light"
11900    DataFieldUltravioletALight,
11901    /// Usage ID `0x4DC`: "Data Field: Ultraviolet B Light"
11902    DataFieldUltravioletBLight,
11903    /// Usage ID `0x4DD`: "Data Field: Ultraviolet Index"
11904    DataFieldUltravioletIndex,
11905    /// Usage ID `0x4DE`: "Data Field: Near Infrared Light"
11906    DataFieldNearInfraredLight,
11907    /// Usage ID `0x4DF`: "Property: Light"
11908    PropertyLight,
11909    /// Usage ID `0x4E0`: "Property: Consumer IR Sentence Send"
11910    PropertyConsumerIRSentenceSend,
11911    /// Usage ID `0x4E2`: "Property: Auto Brightness Preferred"
11912    PropertyAutoBrightnessPreferred,
11913    /// Usage ID `0x4E3`: "Property: Auto Color Preferred"
11914    PropertyAutoColorPreferred,
11915    /// Usage ID `0x4F0`: "Data Field: Scanner"
11916    DataFieldScanner,
11917    /// Usage ID `0x4F1`: "Data Field: RFID Tag 40 Bit"
11918    DataFieldRFIDTag40Bit,
11919    /// Usage ID `0x4F2`: "Data Field: NFC Sentence Receive"
11920    DataFieldNFCSentenceReceive,
11921    /// Usage ID `0x4F8`: "Property: Scanner"
11922    PropertyScanner,
11923    /// Usage ID `0x4F9`: "Property: NFC Sentence Send"
11924    PropertyNFCSentenceSend,
11925    /// Usage ID `0x500`: "Data Field: Electrical"
11926    DataFieldElectrical,
11927    /// Usage ID `0x501`: "Data Field: Capacitance"
11928    DataFieldCapacitance,
11929    /// Usage ID `0x502`: "Data Field: Current"
11930    DataFieldCurrent,
11931    /// Usage ID `0x503`: "Data Field: Electrical Power"
11932    DataFieldElectricalPower,
11933    /// Usage ID `0x504`: "Data Field: Inductance"
11934    DataFieldInductance,
11935    /// Usage ID `0x505`: "Data Field: Resistance"
11936    DataFieldResistance,
11937    /// Usage ID `0x506`: "Data Field: Voltage"
11938    DataFieldVoltage,
11939    /// Usage ID `0x507`: "Data Field: Frequency"
11940    DataFieldFrequency,
11941    /// Usage ID `0x508`: "Data Field: Period"
11942    DataFieldPeriod,
11943    /// Usage ID `0x509`: "Data Field: Percent of Range"
11944    DataFieldPercentofRange,
11945    /// Usage ID `0x520`: "Data Field: Time"
11946    DataFieldTime,
11947    /// Usage ID `0x521`: "Data Field: Year"
11948    DataFieldYear,
11949    /// Usage ID `0x522`: "Data Field: Month"
11950    DataFieldMonth,
11951    /// Usage ID `0x523`: "Data Field: Day"
11952    DataFieldDay,
11953    /// Usage ID `0x524`: "Data Field: Day of Week"
11954    DataFieldDayofWeek,
11955    /// Usage ID `0x525`: "Data Field: Hour"
11956    DataFieldHour,
11957    /// Usage ID `0x526`: "Data Field: Minute"
11958    DataFieldMinute,
11959    /// Usage ID `0x527`: "Data Field: Second"
11960    DataFieldSecond,
11961    /// Usage ID `0x528`: "Data Field: Millisecond"
11962    DataFieldMillisecond,
11963    /// Usage ID `0x529`: "Data Field: Timestamp"
11964    DataFieldTimestamp,
11965    /// Usage ID `0x52A`: "Data Field: Julian Day of Year"
11966    DataFieldJulianDayofYear,
11967    /// Usage ID `0x52B`: "Data Field: Time Since System Boot"
11968    DataFieldTimeSinceSystemBoot,
11969    /// Usage ID `0x530`: "Property: Time"
11970    PropertyTime,
11971    /// Usage ID `0x531`: "Property: Time Zone Offset from UTC"
11972    PropertyTimeZoneOffsetfromUTC,
11973    /// Usage ID `0x532`: "Property: Time Zone Name"
11974    PropertyTimeZoneName,
11975    /// Usage ID `0x533`: "Property: Daylight Savings Time Observed"
11976    PropertyDaylightSavingsTimeObserved,
11977    /// Usage ID `0x534`: "Property: Time Trim Adjustment"
11978    PropertyTimeTrimAdjustment,
11979    /// Usage ID `0x535`: "Property: Arm Alarm"
11980    PropertyArmAlarm,
11981    /// Usage ID `0x540`: "Data Field: Custom"
11982    DataFieldCustom,
11983    /// Usage ID `0x541`: "Data Field: Custom Usage"
11984    DataFieldCustomUsage,
11985    /// Usage ID `0x542`: "Data Field: Custom Boolean Array"
11986    DataFieldCustomBooleanArray,
11987    /// Usage ID `0x543`: "Data Field: Custom Value"
11988    DataFieldCustomValue,
11989    /// Usage ID `0x544`: "Data Field: Custom Value 1"
11990    DataFieldCustomValue1,
11991    /// Usage ID `0x545`: "Data Field: Custom Value 2"
11992    DataFieldCustomValue2,
11993    /// Usage ID `0x546`: "Data Field: Custom Value 3"
11994    DataFieldCustomValue3,
11995    /// Usage ID `0x547`: "Data Field: Custom Value 4"
11996    DataFieldCustomValue4,
11997    /// Usage ID `0x548`: "Data Field: Custom Value 5"
11998    DataFieldCustomValue5,
11999    /// Usage ID `0x549`: "Data Field: Custom Value 6"
12000    DataFieldCustomValue6,
12001    /// Usage ID `0x54A`: "Data Field: Custom Value 7"
12002    DataFieldCustomValue7,
12003    /// Usage ID `0x54B`: "Data Field: Custom Value 8"
12004    DataFieldCustomValue8,
12005    /// Usage ID `0x54C`: "Data Field: Custom Value 9"
12006    DataFieldCustomValue9,
12007    /// Usage ID `0x54D`: "Data Field: Custom Value 10"
12008    DataFieldCustomValue10,
12009    /// Usage ID `0x54E`: "Data Field: Custom Value 11"
12010    DataFieldCustomValue11,
12011    /// Usage ID `0x54F`: "Data Field: Custom Value 12"
12012    DataFieldCustomValue12,
12013    /// Usage ID `0x550`: "Data Field: Custom Value 13"
12014    DataFieldCustomValue13,
12015    /// Usage ID `0x551`: "Data Field: Custom Value 14"
12016    DataFieldCustomValue14,
12017    /// Usage ID `0x552`: "Data Field: Custom Value 15"
12018    DataFieldCustomValue15,
12019    /// Usage ID `0x553`: "Data Field: Custom Value 16"
12020    DataFieldCustomValue16,
12021    /// Usage ID `0x554`: "Data Field: Custom Value 17"
12022    DataFieldCustomValue17,
12023    /// Usage ID `0x555`: "Data Field: Custom Value 18"
12024    DataFieldCustomValue18,
12025    /// Usage ID `0x556`: "Data Field: Custom Value 19"
12026    DataFieldCustomValue19,
12027    /// Usage ID `0x557`: "Data Field: Custom Value 20"
12028    DataFieldCustomValue20,
12029    /// Usage ID `0x558`: "Data Field: Custom Value 21"
12030    DataFieldCustomValue21,
12031    /// Usage ID `0x559`: "Data Field: Custom Value 22"
12032    DataFieldCustomValue22,
12033    /// Usage ID `0x55A`: "Data Field: Custom Value 23"
12034    DataFieldCustomValue23,
12035    /// Usage ID `0x55B`: "Data Field: Custom Value 24"
12036    DataFieldCustomValue24,
12037    /// Usage ID `0x55C`: "Data Field: Custom Value 25"
12038    DataFieldCustomValue25,
12039    /// Usage ID `0x55D`: "Data Field: Custom Value 26"
12040    DataFieldCustomValue26,
12041    /// Usage ID `0x55E`: "Data Field: Custom Value 27"
12042    DataFieldCustomValue27,
12043    /// Usage ID `0x55F`: "Data Field: Custom Value 28"
12044    DataFieldCustomValue28,
12045    /// Usage ID `0x560`: "Data Field: Generic"
12046    DataFieldGeneric,
12047    /// Usage ID `0x561`: "Data Field: Generic GUID or PROPERTYKEY"
12048    DataFieldGenericGUIDorPROPERTYKEY,
12049    /// Usage ID `0x562`: "Data Field: Generic Category GUID"
12050    DataFieldGenericCategoryGUID,
12051    /// Usage ID `0x563`: "Data Field: Generic Type GUID"
12052    DataFieldGenericTypeGUID,
12053    /// Usage ID `0x564`: "Data Field: Generic Event PROPERTYKEY"
12054    DataFieldGenericEventPROPERTYKEY,
12055    /// Usage ID `0x565`: "Data Field: Generic Property PROPERTYKEY"
12056    DataFieldGenericPropertyPROPERTYKEY,
12057    /// Usage ID `0x566`: "Data Field: Generic Data Field PROPERTYKEY"
12058    DataFieldGenericDataFieldPROPERTYKEY,
12059    /// Usage ID `0x567`: "Data Field: Generic Event"
12060    DataFieldGenericEvent,
12061    /// Usage ID `0x568`: "Data Field: Generic Property"
12062    DataFieldGenericProperty,
12063    /// Usage ID `0x569`: "Data Field: Generic Data Field"
12064    DataFieldGenericDataField,
12065    /// Usage ID `0x56A`: "Data Field: Enumerator Table Row Index"
12066    DataFieldEnumeratorTableRowIndex,
12067    /// Usage ID `0x56B`: "Data Field: Enumerator Table Row Count"
12068    DataFieldEnumeratorTableRowCount,
12069    /// Usage ID `0x56C`: "Data Field: Generic GUID or PROPERTYKEY kind"
12070    DataFieldGenericGUIDorPROPERTYKEYkind,
12071    /// Usage ID `0x56D`: "Data Field: Generic GUID"
12072    DataFieldGenericGUID,
12073    /// Usage ID `0x56E`: "Data Field: Generic PROPERTYKEY"
12074    DataFieldGenericPROPERTYKEY,
12075    /// Usage ID `0x56F`: "Data Field: Generic Top Level Collection ID"
12076    DataFieldGenericTopLevelCollectionID,
12077    /// Usage ID `0x570`: "Data Field: Generic Report ID"
12078    DataFieldGenericReportID,
12079    /// Usage ID `0x571`: "Data Field: Generic Report Item Position Index"
12080    DataFieldGenericReportItemPositionIndex,
12081    /// Usage ID `0x572`: "Data Field: Generic Firmware VARTYPE"
12082    DataFieldGenericFirmwareVARTYPE,
12083    /// Usage ID `0x573`: "Data Field: Generic Unit of Measure"
12084    DataFieldGenericUnitofMeasure,
12085    /// Usage ID `0x574`: "Data Field: Generic Unit Exponent"
12086    DataFieldGenericUnitExponent,
12087    /// Usage ID `0x575`: "Data Field: Generic Report Size"
12088    DataFieldGenericReportSize,
12089    /// Usage ID `0x576`: "Data Field: Generic Report Count"
12090    DataFieldGenericReportCount,
12091    /// Usage ID `0x580`: "Property: Generic"
12092    PropertyGeneric,
12093    /// Usage ID `0x581`: "Property: Enumerator Table Row Index"
12094    PropertyEnumeratorTableRowIndex,
12095    /// Usage ID `0x582`: "Property: Enumerator Table Row Count"
12096    PropertyEnumeratorTableRowCount,
12097    /// Usage ID `0x590`: "Data Field: Personal Activity"
12098    DataFieldPersonalActivity,
12099    /// Usage ID `0x591`: "Data Field: Activity Type"
12100    DataFieldActivityType,
12101    /// Usage ID `0x592`: "Data Field: Activity State"
12102    DataFieldActivityState,
12103    /// Usage ID `0x593`: "Data Field: Device Position"
12104    DataFieldDevicePosition,
12105    /// Usage ID `0x594`: "Data Field: Step Count"
12106    DataFieldStepCount,
12107    /// Usage ID `0x595`: "Data Field: Step Count Reset"
12108    DataFieldStepCountReset,
12109    /// Usage ID `0x596`: "Data Field: Step Duration"
12110    DataFieldStepDuration,
12111    /// Usage ID `0x597`: "Data Field: Step Type"
12112    DataFieldStepType,
12113    /// Usage ID `0x5A0`: "Property: Minimum Activity Detection Interval"
12114    PropertyMinimumActivityDetectionInterval,
12115    /// Usage ID `0x5A1`: "Property: Supported Activity Types"
12116    PropertySupportedActivityTypes,
12117    /// Usage ID `0x5A2`: "Property: Subscribed Activity Types"
12118    PropertySubscribedActivityTypes,
12119    /// Usage ID `0x5A3`: "Property: Supported Step Types"
12120    PropertySupportedStepTypes,
12121    /// Usage ID `0x5A4`: "Property: Subscribed Step Types"
12122    PropertySubscribedStepTypes,
12123    /// Usage ID `0x5A5`: "Property: Floor Height"
12124    PropertyFloorHeight,
12125    /// Usage ID `0x5B0`: "Data Field: Custom Type ID"
12126    DataFieldCustomTypeID,
12127    /// Usage ID `0x5C0`: "Property: Custom"
12128    PropertyCustom,
12129    /// Usage ID `0x5C1`: "Property: Custom Value 1"
12130    PropertyCustomValue1,
12131    /// Usage ID `0x5C2`: "Property: Custom Value 2"
12132    PropertyCustomValue2,
12133    /// Usage ID `0x5C3`: "Property: Custom Value 3"
12134    PropertyCustomValue3,
12135    /// Usage ID `0x5C4`: "Property: Custom Value 4"
12136    PropertyCustomValue4,
12137    /// Usage ID `0x5C5`: "Property: Custom Value 5"
12138    PropertyCustomValue5,
12139    /// Usage ID `0x5C6`: "Property: Custom Value 6"
12140    PropertyCustomValue6,
12141    /// Usage ID `0x5C7`: "Property: Custom Value 7"
12142    PropertyCustomValue7,
12143    /// Usage ID `0x5C8`: "Property: Custom Value 8"
12144    PropertyCustomValue8,
12145    /// Usage ID `0x5C9`: "Property: Custom Value 9"
12146    PropertyCustomValue9,
12147    /// Usage ID `0x5CA`: "Property: Custom Value 10"
12148    PropertyCustomValue10,
12149    /// Usage ID `0x5CB`: "Property: Custom Value 11"
12150    PropertyCustomValue11,
12151    /// Usage ID `0x5CC`: "Property: Custom Value 12"
12152    PropertyCustomValue12,
12153    /// Usage ID `0x5CD`: "Property: Custom Value 13"
12154    PropertyCustomValue13,
12155    /// Usage ID `0x5CE`: "Property: Custom Value 14"
12156    PropertyCustomValue14,
12157    /// Usage ID `0x5CF`: "Property: Custom Value 15"
12158    PropertyCustomValue15,
12159    /// Usage ID `0x5D0`: "Property: Custom Value 16"
12160    PropertyCustomValue16,
12161    /// Usage ID `0x5E0`: "Data Field: Hinge"
12162    DataFieldHinge,
12163    /// Usage ID `0x5E1`: "Data Field: Hinge Angle"
12164    DataFieldHingeAngle,
12165    /// Usage ID `0x5F0`: "Data Field: Gesture Sensor"
12166    DataFieldGestureSensor,
12167    /// Usage ID `0x5F1`: "Data Field: Gesture State"
12168    DataFieldGestureState,
12169    /// Usage ID `0x5F2`: "Data Field: Hinge Fold Initial Angle"
12170    DataFieldHingeFoldInitialAngle,
12171    /// Usage ID `0x5F3`: "Data Field: Hinge Fold Final Angle"
12172    DataFieldHingeFoldFinalAngle,
12173    /// Usage ID `0x5F4`: "Data Field: Hinge Fold Contributing Panel"
12174    DataFieldHingeFoldContributingPanel,
12175    /// Usage ID `0x5F5`: "Data Field: Hinge Fold Type"
12176    DataFieldHingeFoldType,
12177    /// Usage ID `0x800`: "Sensor State: Undefined"
12178    SensorStateUndefined,
12179    /// Usage ID `0x801`: "Sensor State: Ready"
12180    SensorStateReady,
12181    /// Usage ID `0x802`: "Sensor State: Not Available"
12182    SensorStateNotAvailable,
12183    /// Usage ID `0x803`: "Sensor State: No Data"
12184    SensorStateNoData,
12185    /// Usage ID `0x804`: "Sensor State: Initializing"
12186    SensorStateInitializing,
12187    /// Usage ID `0x805`: "Sensor State: Access Denied"
12188    SensorStateAccessDenied,
12189    /// Usage ID `0x806`: "Sensor State: Error"
12190    SensorStateError,
12191    /// Usage ID `0x810`: "Sensor Event: Unknown"
12192    SensorEventUnknown,
12193    /// Usage ID `0x811`: "Sensor Event: State Changed"
12194    SensorEventStateChanged,
12195    /// Usage ID `0x812`: "Sensor Event: Property Changed"
12196    SensorEventPropertyChanged,
12197    /// Usage ID `0x813`: "Sensor Event: Data Updated"
12198    SensorEventDataUpdated,
12199    /// Usage ID `0x814`: "Sensor Event: Poll Response"
12200    SensorEventPollResponse,
12201    /// Usage ID `0x815`: "Sensor Event: Change Sensitivity"
12202    SensorEventChangeSensitivity,
12203    /// Usage ID `0x816`: "Sensor Event: Range Maximum Reached"
12204    SensorEventRangeMaximumReached,
12205    /// Usage ID `0x817`: "Sensor Event: Range Minimum Reached"
12206    SensorEventRangeMinimumReached,
12207    /// Usage ID `0x818`: "Sensor Event: High Threshold Cross Upward"
12208    SensorEventHighThresholdCrossUpward,
12209    /// Usage ID `0x819`: "Sensor Event: High Threshold Cross Downward"
12210    SensorEventHighThresholdCrossDownward,
12211    /// Usage ID `0x81A`: "Sensor Event: Low Threshold Cross Upward"
12212    SensorEventLowThresholdCrossUpward,
12213    /// Usage ID `0x81B`: "Sensor Event: Low Threshold Cross Downward"
12214    SensorEventLowThresholdCrossDownward,
12215    /// Usage ID `0x81C`: "Sensor Event: Zero Threshold Cross Upward"
12216    SensorEventZeroThresholdCrossUpward,
12217    /// Usage ID `0x81D`: "Sensor Event: Zero Threshold Cross Downward"
12218    SensorEventZeroThresholdCrossDownward,
12219    /// Usage ID `0x81E`: "Sensor Event: Period Exceeded"
12220    SensorEventPeriodExceeded,
12221    /// Usage ID `0x81F`: "Sensor Event: Frequency Exceeded"
12222    SensorEventFrequencyExceeded,
12223    /// Usage ID `0x820`: "Sensor Event: Complex Trigger"
12224    SensorEventComplexTrigger,
12225    /// Usage ID `0x830`: "Connection Type: PC Integrated"
12226    ConnectionTypePCIntegrated,
12227    /// Usage ID `0x831`: "Connection Type: PC Attached"
12228    ConnectionTypePCAttached,
12229    /// Usage ID `0x832`: "Connection Type: PC External"
12230    ConnectionTypePCExternal,
12231    /// Usage ID `0x840`: "Reporting State: Report No Events"
12232    ReportingStateReportNoEvents,
12233    /// Usage ID `0x841`: "Reporting State: Report All Events"
12234    ReportingStateReportAllEvents,
12235    /// Usage ID `0x842`: "Reporting State: Report Threshold Events"
12236    ReportingStateReportThresholdEvents,
12237    /// Usage ID `0x843`: "Reporting State: Wake On No Events"
12238    ReportingStateWakeOnNoEvents,
12239    /// Usage ID `0x844`: "Reporting State: Wake On All Events"
12240    ReportingStateWakeOnAllEvents,
12241    /// Usage ID `0x845`: "Reporting State: Wake On Threshold Events"
12242    ReportingStateWakeOnThresholdEvents,
12243    /// Usage ID `0x846`: "Reporting State: Anytime"
12244    ReportingStateAnytime,
12245    /// Usage ID `0x850`: "Power State: Undefined"
12246    PowerStateUndefined,
12247    /// Usage ID `0x851`: "Power State: D0 Full Power"
12248    PowerStateD0FullPower,
12249    /// Usage ID `0x852`: "Power State: D1 Low Power"
12250    PowerStateD1LowPower,
12251    /// Usage ID `0x853`: "Power State: D2 Standby Power with Wakeup"
12252    PowerStateD2StandbyPowerwithWakeup,
12253    /// Usage ID `0x854`: "Power State: D3 Sleep with Wakeup"
12254    PowerStateD3SleepwithWakeup,
12255    /// Usage ID `0x855`: "Power State: D4 Power Off"
12256    PowerStateD4PowerOff,
12257    /// Usage ID `0x860`: "Accuracy: Default"
12258    AccuracyDefault,
12259    /// Usage ID `0x861`: "Accuracy: High"
12260    AccuracyHigh,
12261    /// Usage ID `0x862`: "Accuracy: Medium"
12262    AccuracyMedium,
12263    /// Usage ID `0x863`: "Accuracy: Low"
12264    AccuracyLow,
12265    /// Usage ID `0x870`: "Fix Quality: No Fix"
12266    FixQualityNoFix,
12267    /// Usage ID `0x871`: "Fix Quality: GPS"
12268    FixQualityGPS,
12269    /// Usage ID `0x872`: "Fix Quality: DGPS"
12270    FixQualityDGPS,
12271    /// Usage ID `0x880`: "Fix Type: No Fix"
12272    FixTypeNoFix,
12273    /// Usage ID `0x881`: "Fix Type: GPS SPS Mode, Fix Valid"
12274    FixTypeGPSSPSModeFixValid,
12275    /// Usage ID `0x882`: "Fix Type: DGPS SPS Mode, Fix Valid"
12276    FixTypeDGPSSPSModeFixValid,
12277    /// Usage ID `0x883`: "Fix Type: GPS PPS Mode, Fix Valid"
12278    FixTypeGPSPPSModeFixValid,
12279    /// Usage ID `0x884`: "Fix Type: Real Time Kinematic"
12280    FixTypeRealTimeKinematic,
12281    /// Usage ID `0x885`: "Fix Type: Float RTK"
12282    FixTypeFloatRTK,
12283    /// Usage ID `0x886`: "Fix Type: Estimated (dead reckoned)"
12284    FixTypeEstimateddeadreckoned,
12285    /// Usage ID `0x887`: "Fix Type: Manual Input Mode"
12286    FixTypeManualInputMode,
12287    /// Usage ID `0x888`: "Fix Type: Simulator Mode"
12288    FixTypeSimulatorMode,
12289    /// Usage ID `0x890`: "GPS Operation Mode: Manual"
12290    GPSOperationModeManual,
12291    /// Usage ID `0x891`: "GPS Operation Mode: Automatic"
12292    GPSOperationModeAutomatic,
12293    /// Usage ID `0x8A0`: "GPS Selection Mode: Autonomous"
12294    GPSSelectionModeAutonomous,
12295    /// Usage ID `0x8A1`: "GPS Selection Mode: DGPS"
12296    GPSSelectionModeDGPS,
12297    /// Usage ID `0x8A2`: "GPS Selection Mode: Estimated (dead reckoned)"
12298    GPSSelectionModeEstimateddeadreckoned,
12299    /// Usage ID `0x8A3`: "GPS Selection Mode: Manual Input"
12300    GPSSelectionModeManualInput,
12301    /// Usage ID `0x8A4`: "GPS Selection Mode: Simulator"
12302    GPSSelectionModeSimulator,
12303    /// Usage ID `0x8A5`: "GPS Selection Mode: Data Not Valid"
12304    GPSSelectionModeDataNotValid,
12305    /// Usage ID `0x8B0`: "GPS Status Data: Valid"
12306    GPSStatusDataValid,
12307    /// Usage ID `0x8B1`: "GPS Status Data: Not Valid"
12308    GPSStatusDataNotValid,
12309    /// Usage ID `0x8C0`: "Day of Week: Sunday"
12310    DayofWeekSunday,
12311    /// Usage ID `0x8C1`: "Day of Week: Monday"
12312    DayofWeekMonday,
12313    /// Usage ID `0x8C2`: "Day of Week: Tuesday"
12314    DayofWeekTuesday,
12315    /// Usage ID `0x8C3`: "Day of Week: Wednesday"
12316    DayofWeekWednesday,
12317    /// Usage ID `0x8C4`: "Day of Week: Thursday"
12318    DayofWeekThursday,
12319    /// Usage ID `0x8C5`: "Day of Week: Friday"
12320    DayofWeekFriday,
12321    /// Usage ID `0x8C6`: "Day of Week: Saturday"
12322    DayofWeekSaturday,
12323    /// Usage ID `0x8D0`: "Kind: Category"
12324    KindCategory,
12325    /// Usage ID `0x8D1`: "Kind: Type"
12326    KindType,
12327    /// Usage ID `0x8D2`: "Kind: Event"
12328    KindEvent,
12329    /// Usage ID `0x8D3`: "Kind: Property"
12330    KindProperty,
12331    /// Usage ID `0x8D4`: "Kind: Data Field"
12332    KindDataField,
12333    /// Usage ID `0x8E0`: "Magnetometer Accuracy: Low"
12334    MagnetometerAccuracyLow,
12335    /// Usage ID `0x8E1`: "Magnetometer Accuracy: Medium"
12336    MagnetometerAccuracyMedium,
12337    /// Usage ID `0x8E2`: "Magnetometer Accuracy: High"
12338    MagnetometerAccuracyHigh,
12339    /// Usage ID `0x8F0`: "Simple Orientation Direction: Not Rotated"
12340    SimpleOrientationDirectionNotRotated,
12341    /// Usage ID `0x8F1`: "Simple Orientation Direction: Rotated 90 Degrees CCW"
12342    SimpleOrientationDirectionRotated90DegreesCCW,
12343    /// Usage ID `0x8F2`: "Simple Orientation Direction: Rotated 180 Degrees CCW"
12344    SimpleOrientationDirectionRotated180DegreesCCW,
12345    /// Usage ID `0x8F3`: "Simple Orientation Direction: Rotated 270 Degrees CCW"
12346    SimpleOrientationDirectionRotated270DegreesCCW,
12347    /// Usage ID `0x8F4`: "Simple Orientation Direction: Face Up"
12348    SimpleOrientationDirectionFaceUp,
12349    /// Usage ID `0x8F5`: "Simple Orientation Direction: Face Down"
12350    SimpleOrientationDirectionFaceDown,
12351    /// Usage ID `0x900`: "VT_NULL"
12352    VT_NULL,
12353    /// Usage ID `0x901`: "VT_BOOL"
12354    VT_BOOL,
12355    /// Usage ID `0x902`: "VT_UI1"
12356    VT_UI1,
12357    /// Usage ID `0x903`: "VT_I1"
12358    VT_I1,
12359    /// Usage ID `0x904`: "VT_UI2"
12360    VT_UI2,
12361    /// Usage ID `0x905`: "VT_I2"
12362    VT_I2,
12363    /// Usage ID `0x906`: "VT_UI4"
12364    VT_UI4,
12365    /// Usage ID `0x907`: "VT_I4"
12366    VT_I4,
12367    /// Usage ID `0x908`: "VT_UI8"
12368    VT_UI8,
12369    /// Usage ID `0x909`: "VT_I8"
12370    VT_I8,
12371    /// Usage ID `0x90A`: "VT_R4"
12372    VT_R4,
12373    /// Usage ID `0x90B`: "VT_R8"
12374    VT_R8,
12375    /// Usage ID `0x90C`: "VT_WSTR"
12376    VT_WSTR,
12377    /// Usage ID `0x90D`: "VT_STR"
12378    VT_STR,
12379    /// Usage ID `0x90E`: "VT_CLSID"
12380    VT_CLSID,
12381    /// Usage ID `0x90F`: "VT_VECTOR VT_UI1"
12382    VT_VECTORVT_UI1,
12383    /// Usage ID `0x910`: "VT_F16E0"
12384    VT_F16E0,
12385    /// Usage ID `0x911`: "VT_F16E1"
12386    VT_F16E1,
12387    /// Usage ID `0x912`: "VT_F16E2"
12388    VT_F16E2,
12389    /// Usage ID `0x913`: "VT_F16E3"
12390    VT_F16E3,
12391    /// Usage ID `0x914`: "VT_F16E4"
12392    VT_F16E4,
12393    /// Usage ID `0x915`: "VT_F16E5"
12394    VT_F16E5,
12395    /// Usage ID `0x916`: "VT_F16E6"
12396    VT_F16E6,
12397    /// Usage ID `0x917`: "VT_F16E7"
12398    VT_F16E7,
12399    /// Usage ID `0x918`: "VT_F16E8"
12400    VT_F16E8,
12401    /// Usage ID `0x919`: "VT_F16E9"
12402    VT_F16E9,
12403    /// Usage ID `0x91A`: "VT_F16EA"
12404    VT_F16EA,
12405    /// Usage ID `0x91B`: "VT_F16EB"
12406    VT_F16EB,
12407    /// Usage ID `0x91C`: "VT_F16EC"
12408    VT_F16EC,
12409    /// Usage ID `0x91D`: "VT_F16ED"
12410    VT_F16ED,
12411    /// Usage ID `0x91E`: "VT_F16EE"
12412    VT_F16EE,
12413    /// Usage ID `0x91F`: "VT_F16EF"
12414    VT_F16EF,
12415    /// Usage ID `0x920`: "VT_F32E0"
12416    VT_F32E0,
12417    /// Usage ID `0x921`: "VT_F32E1"
12418    VT_F32E1,
12419    /// Usage ID `0x922`: "VT_F32E2"
12420    VT_F32E2,
12421    /// Usage ID `0x923`: "VT_F32E3"
12422    VT_F32E3,
12423    /// Usage ID `0x924`: "VT_F32E4"
12424    VT_F32E4,
12425    /// Usage ID `0x925`: "VT_F32E5"
12426    VT_F32E5,
12427    /// Usage ID `0x926`: "VT_F32E6"
12428    VT_F32E6,
12429    /// Usage ID `0x927`: "VT_F32E7"
12430    VT_F32E7,
12431    /// Usage ID `0x928`: "VT_F32E8"
12432    VT_F32E8,
12433    /// Usage ID `0x929`: "VT_F32E9"
12434    VT_F32E9,
12435    /// Usage ID `0x92A`: "VT_F32EA"
12436    VT_F32EA,
12437    /// Usage ID `0x92B`: "VT_F32EB"
12438    VT_F32EB,
12439    /// Usage ID `0x92C`: "VT_F32EC"
12440    VT_F32EC,
12441    /// Usage ID `0x92D`: "VT_F32ED"
12442    VT_F32ED,
12443    /// Usage ID `0x92E`: "VT_F32EE"
12444    VT_F32EE,
12445    /// Usage ID `0x92F`: "VT_F32EF"
12446    VT_F32EF,
12447    /// Usage ID `0x930`: "Activity Type: Unknown"
12448    ActivityTypeUnknown,
12449    /// Usage ID `0x931`: "Activity Type: Stationary"
12450    ActivityTypeStationary,
12451    /// Usage ID `0x932`: "Activity Type: Fidgeting"
12452    ActivityTypeFidgeting,
12453    /// Usage ID `0x933`: "Activity Type: Walking"
12454    ActivityTypeWalking,
12455    /// Usage ID `0x934`: "Activity Type: Running"
12456    ActivityTypeRunning,
12457    /// Usage ID `0x935`: "Activity Type: In Vehicle"
12458    ActivityTypeInVehicle,
12459    /// Usage ID `0x936`: "Activity Type: Biking"
12460    ActivityTypeBiking,
12461    /// Usage ID `0x937`: "Activity Type: Idle"
12462    ActivityTypeIdle,
12463    /// Usage ID `0x940`: "Unit: Not Specified"
12464    UnitNotSpecified,
12465    /// Usage ID `0x941`: "Unit: Lux"
12466    UnitLux,
12467    /// Usage ID `0x942`: "Unit: Degrees Kelvin"
12468    UnitDegreesKelvin,
12469    /// Usage ID `0x943`: "Unit: Degrees Celsius"
12470    UnitDegreesCelsius,
12471    /// Usage ID `0x944`: "Unit: Pascal"
12472    UnitPascal,
12473    /// Usage ID `0x945`: "Unit: Newton"
12474    UnitNewton,
12475    /// Usage ID `0x946`: "Unit: Meters/Second"
12476    UnitMetersSecond,
12477    /// Usage ID `0x947`: "Unit: Kilogram"
12478    UnitKilogram,
12479    /// Usage ID `0x948`: "Unit: Meter"
12480    UnitMeter,
12481    /// Usage ID `0x949`: "Unit: Meters/Second/Second"
12482    UnitMetersSecondSecond,
12483    /// Usage ID `0x94A`: "Unit: Farad"
12484    UnitFarad,
12485    /// Usage ID `0x94B`: "Unit: Ampere"
12486    UnitAmpere,
12487    /// Usage ID `0x94C`: "Unit: Watt"
12488    UnitWatt,
12489    /// Usage ID `0x94D`: "Unit: Henry"
12490    UnitHenry,
12491    /// Usage ID `0x94E`: "Unit: Ohm"
12492    UnitOhm,
12493    /// Usage ID `0x94F`: "Unit: Volt"
12494    UnitVolt,
12495    /// Usage ID `0x950`: "Unit: Hertz"
12496    UnitHertz,
12497    /// Usage ID `0x951`: "Unit: Bar"
12498    UnitBar,
12499    /// Usage ID `0x952`: "Unit: Degrees Anti-clockwise"
12500    UnitDegreesAnticlockwise,
12501    /// Usage ID `0x953`: "Unit: Degrees Clockwise"
12502    UnitDegreesClockwise,
12503    /// Usage ID `0x954`: "Unit: Degrees"
12504    UnitDegrees,
12505    /// Usage ID `0x955`: "Unit: Degrees/Second"
12506    UnitDegreesSecond,
12507    /// Usage ID `0x956`: "Unit: Degrees/Second/Second"
12508    UnitDegreesSecondSecond,
12509    /// Usage ID `0x957`: "Unit: Knot"
12510    UnitKnot,
12511    /// Usage ID `0x958`: "Unit: Percent"
12512    UnitPercent,
12513    /// Usage ID `0x959`: "Unit: Second"
12514    UnitSecond,
12515    /// Usage ID `0x95A`: "Unit: Millisecond"
12516    UnitMillisecond,
12517    /// Usage ID `0x95B`: "Unit: G"
12518    UnitG,
12519    /// Usage ID `0x95C`: "Unit: Bytes"
12520    UnitBytes,
12521    /// Usage ID `0x95D`: "Unit: Milligauss"
12522    UnitMilligauss,
12523    /// Usage ID `0x95E`: "Unit: Bits"
12524    UnitBits,
12525    /// Usage ID `0x960`: "Activity State: No State Change"
12526    ActivityStateNoStateChange,
12527    /// Usage ID `0x961`: "Activity State: Start Activity"
12528    ActivityStateStartActivity,
12529    /// Usage ID `0x962`: "Activity State: End Activity"
12530    ActivityStateEndActivity,
12531    /// Usage ID `0x970`: "Exponent 0"
12532    Exponent0,
12533    /// Usage ID `0x971`: "Exponent 1"
12534    Exponent1,
12535    /// Usage ID `0x972`: "Exponent 2"
12536    Exponent2,
12537    /// Usage ID `0x973`: "Exponent 3"
12538    Exponent3,
12539    /// Usage ID `0x974`: "Exponent 4"
12540    Exponent4,
12541    /// Usage ID `0x975`: "Exponent 5"
12542    Exponent5,
12543    /// Usage ID `0x976`: "Exponent 6"
12544    Exponent6,
12545    /// Usage ID `0x977`: "Exponent 7"
12546    Exponent7,
12547    /// Usage ID `0x978`: "Exponent 8"
12548    Exponent8,
12549    /// Usage ID `0x979`: "Exponent 9"
12550    Exponent9,
12551    /// Usage ID `0x97A`: "Exponent A"
12552    ExponentA,
12553    /// Usage ID `0x97B`: "Exponent B"
12554    ExponentB,
12555    /// Usage ID `0x97C`: "Exponent C"
12556    ExponentC,
12557    /// Usage ID `0x97D`: "Exponent D"
12558    ExponentD,
12559    /// Usage ID `0x97E`: "Exponent E"
12560    ExponentE,
12561    /// Usage ID `0x97F`: "Exponent F"
12562    ExponentF,
12563    /// Usage ID `0x980`: "Device Position: Unknown"
12564    DevicePositionUnknown,
12565    /// Usage ID `0x981`: "Device Position: Unchanged"
12566    DevicePositionUnchanged,
12567    /// Usage ID `0x982`: "Device Position: On Desk"
12568    DevicePositionOnDesk,
12569    /// Usage ID `0x983`: "Device Position: In Hand"
12570    DevicePositionInHand,
12571    /// Usage ID `0x984`: "Device Position: Moving in Bag"
12572    DevicePositionMovinginBag,
12573    /// Usage ID `0x985`: "Device Position: Stationary in Bag"
12574    DevicePositionStationaryinBag,
12575    /// Usage ID `0x990`: "Step Type: Unknown"
12576    StepTypeUnknown,
12577    /// Usage ID `0x991`: "Step Type: Walking"
12578    StepTypeWalking,
12579    /// Usage ID `0x992`: "Step Type: Running"
12580    StepTypeRunning,
12581    /// Usage ID `0x9A0`: "Gesture State: Unknown"
12582    GestureStateUnknown,
12583    /// Usage ID `0x9A1`: "Gesture State: Started"
12584    GestureStateStarted,
12585    /// Usage ID `0x9A2`: "Gesture State: Completed"
12586    GestureStateCompleted,
12587    /// Usage ID `0x9A3`: "Gesture State: Cancelled"
12588    GestureStateCancelled,
12589    /// Usage ID `0x9B0`: "Hinge Fold Contributing Panel: Unknown"
12590    HingeFoldContributingPanelUnknown,
12591    /// Usage ID `0x9B1`: "Hinge Fold Contributing Panel: Panel 1"
12592    HingeFoldContributingPanelPanel1,
12593    /// Usage ID `0x9B2`: "Hinge Fold Contributing Panel: Panel 2"
12594    HingeFoldContributingPanelPanel2,
12595    /// Usage ID `0x9B3`: "Hinge Fold Contributing Panel: Both"
12596    HingeFoldContributingPanelBoth,
12597    /// Usage ID `0x9B4`: "Hinge Fold Type: Unknown"
12598    HingeFoldTypeUnknown,
12599    /// Usage ID `0x9B5`: "Hinge Fold Type: Increasing"
12600    HingeFoldTypeIncreasing,
12601    /// Usage ID `0x9B6`: "Hinge Fold Type: Decreasing"
12602    HingeFoldTypeDecreasing,
12603    /// Usage ID `0x9C0`: "Human Presence Detection Type: Vendor-Defined Non-Biometric"
12604    HumanPresenceDetectionTypeVendorDefinedNonBiometric,
12605    /// Usage ID `0x9C1`: "Human Presence Detection Type: Vendor-Defined Biometric"
12606    HumanPresenceDetectionTypeVendorDefinedBiometric,
12607    /// Usage ID `0x9C2`: "Human Presence Detection Type: Facial Biometric"
12608    HumanPresenceDetectionTypeFacialBiometric,
12609    /// Usage ID `0x9C3`: "Human Presence Detection Type: Audio Biometric"
12610    HumanPresenceDetectionTypeAudioBiometric,
12611    /// Usage ID `0x1000`: "Modifier: Change Sensitivity Absolute"
12612    ModifierChangeSensitivityAbsolute,
12613    /// Usage ID `0x2000`: "Modifier: Maximum"
12614    ModifierMaximum,
12615    /// Usage ID `0x3000`: "Modifier: Minimum"
12616    ModifierMinimum,
12617    /// Usage ID `0x4000`: "Modifier: Accuracy"
12618    ModifierAccuracy,
12619    /// Usage ID `0x5000`: "Modifier: Resolution"
12620    ModifierResolution,
12621    /// Usage ID `0x6000`: "Modifier: Threshold High"
12622    ModifierThresholdHigh,
12623    /// Usage ID `0x7000`: "Modifier: Threshold Low"
12624    ModifierThresholdLow,
12625    /// Usage ID `0x8000`: "Modifier: Calibration Offset"
12626    ModifierCalibrationOffset,
12627    /// Usage ID `0x9000`: "Modifier: Calibration Multiplier"
12628    ModifierCalibrationMultiplier,
12629    /// Usage ID `0xA000`: "Modifier: Report Interval"
12630    ModifierReportInterval,
12631    /// Usage ID `0xB000`: "Modifier: Frequency Max"
12632    ModifierFrequencyMax,
12633    /// Usage ID `0xC000`: "Modifier: Period Max"
12634    ModifierPeriodMax,
12635    /// Usage ID `0xD000`: "Modifier: Change Sensitivity Percent of Range"
12636    ModifierChangeSensitivityPercentofRange,
12637    /// Usage ID `0xE000`: "Modifier: Change Sensitivity Percent Relative"
12638    ModifierChangeSensitivityPercentRelative,
12639    /// Usage ID `0xF000`: "Modifier: Vendor Reserved"
12640    ModifierVendorReserved,
12641}
12642
12643impl Sensors {
12644    #[cfg(feature = "std")]
12645    pub fn name(&self) -> String {
12646        match self {
12647            Sensors::Sensor => "Sensor",
12648            Sensors::Biometric => "Biometric",
12649            Sensors::BiometricHumanPresence => "Biometric: Human Presence",
12650            Sensors::BiometricHumanProximity => "Biometric: Human Proximity",
12651            Sensors::BiometricHumanTouch => "Biometric: Human Touch",
12652            Sensors::BiometricBloodPressure => "Biometric: Blood Pressure",
12653            Sensors::BiometricBodyTemperature => "Biometric: Body Temperature",
12654            Sensors::BiometricHeartRate => "Biometric: Heart Rate",
12655            Sensors::BiometricHeartRateVariability => "Biometric: Heart Rate Variability",
12656            Sensors::BiometricPeripheralOxygenSaturation => {
12657                "Biometric: Peripheral Oxygen Saturation"
12658            }
12659            Sensors::BiometricRespiratoryRate => "Biometric: Respiratory Rate",
12660            Sensors::Electrical => "Electrical",
12661            Sensors::ElectricalCapacitance => "Electrical: Capacitance",
12662            Sensors::ElectricalCurrent => "Electrical: Current",
12663            Sensors::ElectricalPower => "Electrical: Power",
12664            Sensors::ElectricalInductance => "Electrical: Inductance",
12665            Sensors::ElectricalResistance => "Electrical: Resistance",
12666            Sensors::ElectricalVoltage => "Electrical: Voltage",
12667            Sensors::ElectricalPotentiometer => "Electrical: Potentiometer",
12668            Sensors::ElectricalFrequency => "Electrical: Frequency",
12669            Sensors::ElectricalPeriod => "Electrical: Period",
12670            Sensors::Environmental => "Environmental",
12671            Sensors::EnvironmentalAtmosphericPressure => "Environmental: Atmospheric Pressure",
12672            Sensors::EnvironmentalHumidity => "Environmental: Humidity",
12673            Sensors::EnvironmentalTemperature => "Environmental: Temperature",
12674            Sensors::EnvironmentalWindDirection => "Environmental: Wind Direction",
12675            Sensors::EnvironmentalWindSpeed => "Environmental: Wind Speed",
12676            Sensors::EnvironmentalAirQuality => "Environmental: Air Quality",
12677            Sensors::EnvironmentalHeatIndex => "Environmental: Heat Index",
12678            Sensors::EnvironmentalSurfaceTemperature => "Environmental: Surface Temperature",
12679            Sensors::EnvironmentalVolatileOrganicCompounds => {
12680                "Environmental: Volatile Organic Compounds"
12681            }
12682            Sensors::EnvironmentalObjectPresence => "Environmental: Object Presence",
12683            Sensors::EnvironmentalObjectProximity => "Environmental: Object Proximity",
12684            Sensors::Light => "Light",
12685            Sensors::LightAmbientLight => "Light: Ambient Light",
12686            Sensors::LightConsumerInfrared => "Light: Consumer Infrared",
12687            Sensors::LightInfraredLight => "Light: Infrared Light",
12688            Sensors::LightVisibleLight => "Light: Visible Light",
12689            Sensors::LightUltravioletLight => "Light: Ultraviolet Light",
12690            Sensors::Location => "Location",
12691            Sensors::LocationBroadcast => "Location: Broadcast",
12692            Sensors::LocationDeadReckoning => "Location: Dead Reckoning",
12693            Sensors::LocationGPSGlobalPositioningSystem => {
12694                "Location: GPS (Global Positioning System)"
12695            }
12696            Sensors::LocationLookup => "Location: Lookup",
12697            Sensors::LocationOther => "Location: Other",
12698            Sensors::LocationStatic => "Location: Static",
12699            Sensors::LocationTriangulation => "Location: Triangulation",
12700            Sensors::Mechanical => "Mechanical",
12701            Sensors::MechanicalBooleanSwitch => "Mechanical: Boolean Switch",
12702            Sensors::MechanicalBooleanSwitchArray => "Mechanical: Boolean Switch Array",
12703            Sensors::MechanicalMultivalueSwitch => "Mechanical: Multivalue Switch",
12704            Sensors::MechanicalForce => "Mechanical: Force",
12705            Sensors::MechanicalPressure => "Mechanical: Pressure",
12706            Sensors::MechanicalStrain => "Mechanical: Strain",
12707            Sensors::MechanicalWeight => "Mechanical: Weight",
12708            Sensors::MechanicalHapticVibrator => "Mechanical: Haptic Vibrator",
12709            Sensors::MechanicalHallEffectSwitch => "Mechanical: Hall Effect Switch",
12710            Sensors::Motion => "Motion",
12711            Sensors::MotionAccelerometer1D => "Motion: Accelerometer 1D",
12712            Sensors::MotionAccelerometer2D => "Motion: Accelerometer 2D",
12713            Sensors::MotionAccelerometer3D => "Motion: Accelerometer 3D",
12714            Sensors::MotionGyrometer1D => "Motion: Gyrometer 1D",
12715            Sensors::MotionGyrometer2D => "Motion: Gyrometer 2D",
12716            Sensors::MotionGyrometer3D => "Motion: Gyrometer 3D",
12717            Sensors::MotionMotionDetector => "Motion: Motion Detector",
12718            Sensors::MotionSpeedometer => "Motion: Speedometer",
12719            Sensors::MotionAccelerometer => "Motion: Accelerometer",
12720            Sensors::MotionGyrometer => "Motion: Gyrometer",
12721            Sensors::MotionGravityVector => "Motion: Gravity Vector",
12722            Sensors::MotionLinearAccelerometer => "Motion: Linear Accelerometer",
12723            Sensors::Orientation => "Orientation",
12724            Sensors::OrientationCompass1D => "Orientation: Compass 1D",
12725            Sensors::OrientationCompass2D => "Orientation: Compass 2D",
12726            Sensors::OrientationCompass3D => "Orientation: Compass 3D",
12727            Sensors::OrientationInclinometer1D => "Orientation: Inclinometer 1D",
12728            Sensors::OrientationInclinometer2D => "Orientation: Inclinometer 2D",
12729            Sensors::OrientationInclinometer3D => "Orientation: Inclinometer 3D",
12730            Sensors::OrientationDistance1D => "Orientation: Distance 1D",
12731            Sensors::OrientationDistance2D => "Orientation: Distance 2D",
12732            Sensors::OrientationDistance3D => "Orientation: Distance 3D",
12733            Sensors::OrientationDeviceOrientation => "Orientation: Device Orientation",
12734            Sensors::OrientationCompass => "Orientation: Compass",
12735            Sensors::OrientationInclinometer => "Orientation: Inclinometer",
12736            Sensors::OrientationDistance => "Orientation: Distance",
12737            Sensors::OrientationRelativeOrientation => "Orientation: Relative Orientation",
12738            Sensors::OrientationSimpleOrientation => "Orientation: Simple Orientation",
12739            Sensors::Scanner => "Scanner",
12740            Sensors::ScannerBarcode => "Scanner: Barcode",
12741            Sensors::ScannerRFID => "Scanner: RFID",
12742            Sensors::ScannerNFC => "Scanner: NFC",
12743            Sensors::Time => "Time",
12744            Sensors::TimeAlarmTimer => "Time: Alarm Timer",
12745            Sensors::TimeRealTimeClock => "Time: Real Time Clock",
12746            Sensors::PersonalActivity => "Personal Activity",
12747            Sensors::PersonalActivityActivityDetection => "Personal Activity: Activity Detection",
12748            Sensors::PersonalActivityDevicePosition => "Personal Activity: Device Position",
12749            Sensors::PersonalActivityFloorTracker => "Personal Activity: Floor Tracker",
12750            Sensors::PersonalActivityPedometer => "Personal Activity: Pedometer",
12751            Sensors::PersonalActivityStepDetection => "Personal Activity: Step Detection",
12752            Sensors::OrientationExtended => "Orientation Extended",
12753            Sensors::OrientationExtendedGeomagneticOrientation => {
12754                "Orientation Extended: Geomagnetic Orientation"
12755            }
12756            Sensors::OrientationExtendedMagnetometer => "Orientation Extended: Magnetometer",
12757            Sensors::Gesture => "Gesture",
12758            Sensors::GestureChassisFlipGesture => "Gesture: Chassis Flip Gesture",
12759            Sensors::GestureHingeFoldGesture => "Gesture: Hinge Fold Gesture",
12760            Sensors::Other => "Other",
12761            Sensors::OtherCustom => "Other: Custom",
12762            Sensors::OtherGeneric => "Other: Generic",
12763            Sensors::OtherGenericEnumerator => "Other: Generic Enumerator",
12764            Sensors::OtherHingeAngle => "Other: Hinge Angle",
12765            Sensors::VendorReserved1 => "Vendor Reserved 1",
12766            Sensors::VendorReserved2 => "Vendor Reserved 2",
12767            Sensors::VendorReserved3 => "Vendor Reserved 3",
12768            Sensors::VendorReserved4 => "Vendor Reserved 4",
12769            Sensors::VendorReserved5 => "Vendor Reserved 5",
12770            Sensors::VendorReserved6 => "Vendor Reserved 6",
12771            Sensors::VendorReserved7 => "Vendor Reserved 7",
12772            Sensors::VendorReserved8 => "Vendor Reserved 8",
12773            Sensors::VendorReserved9 => "Vendor Reserved 9",
12774            Sensors::VendorReserved10 => "Vendor Reserved 10",
12775            Sensors::VendorReserved11 => "Vendor Reserved 11",
12776            Sensors::VendorReserved12 => "Vendor Reserved 12",
12777            Sensors::VendorReserved13 => "Vendor Reserved 13",
12778            Sensors::VendorReserved14 => "Vendor Reserved 14",
12779            Sensors::VendorReserved15 => "Vendor Reserved 15",
12780            Sensors::VendorReserved16 => "Vendor Reserved 16",
12781            Sensors::Event => "Event",
12782            Sensors::EventSensorState => "Event: Sensor State",
12783            Sensors::EventSensorEvent => "Event: Sensor Event",
12784            Sensors::Property => "Property",
12785            Sensors::PropertyFriendlyName => "Property: Friendly Name",
12786            Sensors::PropertyPersistentUniqueID => "Property: Persistent Unique ID",
12787            Sensors::PropertySensorStatus => "Property: Sensor Status",
12788            Sensors::PropertyMinimumReportInterval => "Property: Minimum Report Interval",
12789            Sensors::PropertySensorManufacturer => "Property: Sensor Manufacturer",
12790            Sensors::PropertySensorModel => "Property: Sensor Model",
12791            Sensors::PropertySensorSerialNumber => "Property: Sensor Serial Number",
12792            Sensors::PropertySensorDescription => "Property: Sensor Description",
12793            Sensors::PropertySensorConnectionType => "Property: Sensor Connection Type",
12794            Sensors::PropertySensorDevicePath => "Property: Sensor Device Path",
12795            Sensors::PropertyHardwareRevision => "Property: Hardware Revision",
12796            Sensors::PropertyFirmwareVersion => "Property: Firmware Version",
12797            Sensors::PropertyReleaseDate => "Property: Release Date",
12798            Sensors::PropertyReportInterval => "Property: Report Interval",
12799            Sensors::PropertyChangeSensitivityAbsolute => "Property: Change Sensitivity Absolute",
12800            Sensors::PropertyChangeSensitivityPercentofRange => {
12801                "Property: Change Sensitivity Percent of Range"
12802            }
12803            Sensors::PropertyChangeSensitivityPercentRelative => {
12804                "Property: Change Sensitivity Percent Relative"
12805            }
12806            Sensors::PropertyAccuracy => "Property: Accuracy",
12807            Sensors::PropertyResolution => "Property: Resolution",
12808            Sensors::PropertyMaximum => "Property: Maximum",
12809            Sensors::PropertyMinimum => "Property: Minimum",
12810            Sensors::PropertyReportingState => "Property: Reporting State",
12811            Sensors::PropertySamplingRate => "Property: Sampling Rate",
12812            Sensors::PropertyResponseCurve => "Property: Response Curve",
12813            Sensors::PropertyPowerState => "Property: Power State",
12814            Sensors::PropertyMaximumFIFOEvents => "Property: Maximum FIFO Events",
12815            Sensors::PropertyReportLatency => "Property: Report Latency",
12816            Sensors::PropertyFlushFIFOEvents => "Property: Flush FIFO Events",
12817            Sensors::PropertyMaximumPowerConsumption => "Property: Maximum Power Consumption",
12818            Sensors::PropertyIsPrimary => "Property: Is Primary",
12819            Sensors::PropertyHumanPresenceDetectionType => {
12820                "Property: Human Presence Detection Type"
12821            }
12822            Sensors::DataFieldLocation => "Data Field: Location",
12823            Sensors::DataFieldAltitudeAntennaSeaLevel => "Data Field: Altitude Antenna Sea Level",
12824            Sensors::DataFieldDifferentialReferenceStationID => {
12825                "Data Field: Differential Reference Station ID"
12826            }
12827            Sensors::DataFieldAltitudeEllipsoidError => "Data Field: Altitude Ellipsoid Error",
12828            Sensors::DataFieldAltitudeEllipsoid => "Data Field: Altitude Ellipsoid",
12829            Sensors::DataFieldAltitudeSeaLevelError => "Data Field: Altitude Sea Level Error",
12830            Sensors::DataFieldAltitudeSeaLevel => "Data Field: Altitude Sea Level",
12831            Sensors::DataFieldDifferentialGPSDataAge => "Data Field: Differential GPS Data Age",
12832            Sensors::DataFieldErrorRadius => "Data Field: Error Radius",
12833            Sensors::DataFieldFixQuality => "Data Field: Fix Quality",
12834            Sensors::DataFieldFixType => "Data Field: Fix Type",
12835            Sensors::DataFieldGeoidalSeparation => "Data Field: Geoidal Separation",
12836            Sensors::DataFieldGPSOperationMode => "Data Field: GPS Operation Mode",
12837            Sensors::DataFieldGPSSelectionMode => "Data Field: GPS Selection Mode",
12838            Sensors::DataFieldGPSStatus => "Data Field: GPS Status",
12839            Sensors::DataFieldPositionDilutionofPrecision => {
12840                "Data Field: Position Dilution of Precision"
12841            }
12842            Sensors::DataFieldHorizontalDilutionofPrecision => {
12843                "Data Field: Horizontal Dilution of Precision"
12844            }
12845            Sensors::DataFieldVerticalDilutionofPrecision => {
12846                "Data Field: Vertical Dilution of Precision"
12847            }
12848            Sensors::DataFieldLatitude => "Data Field: Latitude",
12849            Sensors::DataFieldLongitude => "Data Field: Longitude",
12850            Sensors::DataFieldTrueHeading => "Data Field: True Heading",
12851            Sensors::DataFieldMagneticHeading => "Data Field: Magnetic Heading",
12852            Sensors::DataFieldMagneticVariation => "Data Field: Magnetic Variation",
12853            Sensors::DataFieldSpeed => "Data Field: Speed",
12854            Sensors::DataFieldSatellitesinView => "Data Field: Satellites in View",
12855            Sensors::DataFieldSatellitesinViewAzimuth => "Data Field: Satellites in View Azimuth",
12856            Sensors::DataFieldSatellitesinViewElevation => {
12857                "Data Field: Satellites in View Elevation"
12858            }
12859            Sensors::DataFieldSatellitesinViewIDs => "Data Field: Satellites in View IDs",
12860            Sensors::DataFieldSatellitesinViewPRNs => "Data Field: Satellites in View PRNs",
12861            Sensors::DataFieldSatellitesinViewSNRatios => {
12862                "Data Field: Satellites in View S/N Ratios"
12863            }
12864            Sensors::DataFieldSatellitesUsedCount => "Data Field: Satellites Used Count",
12865            Sensors::DataFieldSatellitesUsedPRNs => "Data Field: Satellites Used PRNs",
12866            Sensors::DataFieldNMEASentence => "Data Field: NMEA Sentence",
12867            Sensors::DataFieldAddressLine1 => "Data Field: Address Line 1",
12868            Sensors::DataFieldAddressLine2 => "Data Field: Address Line 2",
12869            Sensors::DataFieldCity => "Data Field: City",
12870            Sensors::DataFieldStateorProvince => "Data Field: State or Province",
12871            Sensors::DataFieldCountryorRegion => "Data Field: Country or Region",
12872            Sensors::DataFieldPostalCode => "Data Field: Postal Code",
12873            Sensors::PropertyLocation => "Property: Location",
12874            Sensors::PropertyLocationDesiredAccuracy => "Property: Location Desired Accuracy",
12875            Sensors::DataFieldEnvironmental => "Data Field: Environmental",
12876            Sensors::DataFieldAtmosphericPressure => "Data Field: Atmospheric Pressure",
12877            Sensors::DataFieldRelativeHumidity => "Data Field: Relative Humidity",
12878            Sensors::DataFieldTemperature => "Data Field: Temperature",
12879            Sensors::DataFieldWindDirection => "Data Field: Wind Direction",
12880            Sensors::DataFieldWindSpeed => "Data Field: Wind Speed",
12881            Sensors::DataFieldAirQualityIndex => "Data Field: Air Quality Index",
12882            Sensors::DataFieldEquivalentCO2 => "Data Field: Equivalent CO2",
12883            Sensors::DataFieldVolatileOrganicCompoundConcentration => {
12884                "Data Field: Volatile Organic Compound Concentration"
12885            }
12886            Sensors::DataFieldObjectPresence => "Data Field: Object Presence",
12887            Sensors::DataFieldObjectProximityRange => "Data Field: Object Proximity Range",
12888            Sensors::DataFieldObjectProximityOutofRange => {
12889                "Data Field: Object Proximity Out of Range"
12890            }
12891            Sensors::PropertyEnvironmental => "Property: Environmental",
12892            Sensors::PropertyReferencePressure => "Property: Reference Pressure",
12893            Sensors::DataFieldMotion => "Data Field: Motion",
12894            Sensors::DataFieldMotionState => "Data Field: Motion State",
12895            Sensors::DataFieldAcceleration => "Data Field: Acceleration",
12896            Sensors::DataFieldAccelerationAxisX => "Data Field: Acceleration Axis X",
12897            Sensors::DataFieldAccelerationAxisY => "Data Field: Acceleration Axis Y",
12898            Sensors::DataFieldAccelerationAxisZ => "Data Field: Acceleration Axis Z",
12899            Sensors::DataFieldAngularVelocity => "Data Field: Angular Velocity",
12900            Sensors::DataFieldAngularVelocityaboutXAxis => {
12901                "Data Field: Angular Velocity about X Axis"
12902            }
12903            Sensors::DataFieldAngularVelocityaboutYAxis => {
12904                "Data Field: Angular Velocity about Y Axis"
12905            }
12906            Sensors::DataFieldAngularVelocityaboutZAxis => {
12907                "Data Field: Angular Velocity about Z Axis"
12908            }
12909            Sensors::DataFieldAngularPosition => "Data Field: Angular Position",
12910            Sensors::DataFieldAngularPositionaboutXAxis => {
12911                "Data Field: Angular Position about X Axis"
12912            }
12913            Sensors::DataFieldAngularPositionaboutYAxis => {
12914                "Data Field: Angular Position about Y Axis"
12915            }
12916            Sensors::DataFieldAngularPositionaboutZAxis => {
12917                "Data Field: Angular Position about Z Axis"
12918            }
12919            Sensors::DataFieldMotionSpeed => "Data Field: Motion Speed",
12920            Sensors::DataFieldMotionIntensity => "Data Field: Motion Intensity",
12921            Sensors::DataFieldOrientation => "Data Field: Orientation",
12922            Sensors::DataFieldHeading => "Data Field: Heading",
12923            Sensors::DataFieldHeadingXAxis => "Data Field: Heading X Axis",
12924            Sensors::DataFieldHeadingYAxis => "Data Field: Heading Y Axis",
12925            Sensors::DataFieldHeadingZAxis => "Data Field: Heading Z Axis",
12926            Sensors::DataFieldHeadingCompensatedMagneticNorth => {
12927                "Data Field: Heading Compensated Magnetic North"
12928            }
12929            Sensors::DataFieldHeadingCompensatedTrueNorth => {
12930                "Data Field: Heading Compensated True North"
12931            }
12932            Sensors::DataFieldHeadingMagneticNorth => "Data Field: Heading Magnetic North",
12933            Sensors::DataFieldHeadingTrueNorth => "Data Field: Heading True North",
12934            Sensors::DataFieldDistance => "Data Field: Distance",
12935            Sensors::DataFieldDistanceXAxis => "Data Field: Distance X Axis",
12936            Sensors::DataFieldDistanceYAxis => "Data Field: Distance Y Axis",
12937            Sensors::DataFieldDistanceZAxis => "Data Field: Distance Z Axis",
12938            Sensors::DataFieldDistanceOutofRange => "Data Field: Distance Out-of-Range",
12939            Sensors::DataFieldTilt => "Data Field: Tilt",
12940            Sensors::DataFieldTiltXAxis => "Data Field: Tilt X Axis",
12941            Sensors::DataFieldTiltYAxis => "Data Field: Tilt Y Axis",
12942            Sensors::DataFieldTiltZAxis => "Data Field: Tilt Z Axis",
12943            Sensors::DataFieldRotationMatrix => "Data Field: Rotation Matrix",
12944            Sensors::DataFieldQuaternion => "Data Field: Quaternion",
12945            Sensors::DataFieldMagneticFlux => "Data Field: Magnetic Flux",
12946            Sensors::DataFieldMagneticFluxXAxis => "Data Field: Magnetic Flux X Axis",
12947            Sensors::DataFieldMagneticFluxYAxis => "Data Field: Magnetic Flux Y Axis",
12948            Sensors::DataFieldMagneticFluxZAxis => "Data Field: Magnetic Flux Z Axis",
12949            Sensors::DataFieldMagnetometerAccuracy => "Data Field: Magnetometer Accuracy",
12950            Sensors::DataFieldSimpleOrientationDirection => {
12951                "Data Field: Simple Orientation Direction"
12952            }
12953            Sensors::DataFieldMechanical => "Data Field: Mechanical",
12954            Sensors::DataFieldBooleanSwitchState => "Data Field: Boolean Switch State",
12955            Sensors::DataFieldBooleanSwitchArrayStates => "Data Field: Boolean Switch Array States",
12956            Sensors::DataFieldMultivalueSwitchValue => "Data Field: Multivalue Switch Value",
12957            Sensors::DataFieldForce => "Data Field: Force",
12958            Sensors::DataFieldAbsolutePressure => "Data Field: Absolute Pressure",
12959            Sensors::DataFieldGaugePressure => "Data Field: Gauge Pressure",
12960            Sensors::DataFieldStrain => "Data Field: Strain",
12961            Sensors::DataFieldWeight => "Data Field: Weight",
12962            Sensors::PropertyMechanical => "Property: Mechanical",
12963            Sensors::PropertyVibrationState => "Property: Vibration State",
12964            Sensors::PropertyForwardVibrationSpeed => "Property: Forward Vibration Speed",
12965            Sensors::PropertyBackwardVibrationSpeed => "Property: Backward Vibration Speed",
12966            Sensors::DataFieldBiometric => "Data Field: Biometric",
12967            Sensors::DataFieldHumanPresence => "Data Field: Human Presence",
12968            Sensors::DataFieldHumanProximityRange => "Data Field: Human Proximity Range",
12969            Sensors::DataFieldHumanProximityOutofRange => {
12970                "Data Field: Human Proximity Out of Range"
12971            }
12972            Sensors::DataFieldHumanTouchState => "Data Field: Human Touch State",
12973            Sensors::DataFieldBloodPressure => "Data Field: Blood Pressure",
12974            Sensors::DataFieldBloodPressureDiastolic => "Data Field: Blood Pressure Diastolic",
12975            Sensors::DataFieldBloodPressureSystolic => "Data Field: Blood Pressure Systolic",
12976            Sensors::DataFieldHeartRate => "Data Field: Heart Rate",
12977            Sensors::DataFieldRestingHeartRate => "Data Field: Resting Heart Rate",
12978            Sensors::DataFieldHeartbeatInterval => "Data Field: Heartbeat Interval",
12979            Sensors::DataFieldRespiratoryRate => "Data Field: Respiratory Rate",
12980            Sensors::DataFieldSpO2 => "Data Field: SpO2",
12981            Sensors::DataFieldHumanAttentionDetected => "Data Field: Human Attention Detected",
12982            Sensors::DataFieldHumanHeadAzimuth => "Data Field: Human Head Azimuth",
12983            Sensors::DataFieldHumanHeadAltitude => "Data Field: Human Head Altitude",
12984            Sensors::DataFieldHumanHeadRoll => "Data Field: Human Head Roll",
12985            Sensors::DataFieldHumanHeadPitch => "Data Field: Human Head Pitch",
12986            Sensors::DataFieldHumanHeadYaw => "Data Field: Human Head Yaw",
12987            Sensors::DataFieldHumanCorrelationId => "Data Field: Human Correlation Id",
12988            Sensors::DataFieldLight => "Data Field: Light",
12989            Sensors::DataFieldIlluminance => "Data Field: Illuminance",
12990            Sensors::DataFieldColorTemperature => "Data Field: Color Temperature",
12991            Sensors::DataFieldChromaticity => "Data Field: Chromaticity",
12992            Sensors::DataFieldChromaticityX => "Data Field: Chromaticity X",
12993            Sensors::DataFieldChromaticityY => "Data Field: Chromaticity Y",
12994            Sensors::DataFieldConsumerIRSentenceReceive => {
12995                "Data Field: Consumer IR Sentence Receive"
12996            }
12997            Sensors::DataFieldInfraredLight => "Data Field: Infrared Light",
12998            Sensors::DataFieldRedLight => "Data Field: Red Light",
12999            Sensors::DataFieldGreenLight => "Data Field: Green Light",
13000            Sensors::DataFieldBlueLight => "Data Field: Blue Light",
13001            Sensors::DataFieldUltravioletALight => "Data Field: Ultraviolet A Light",
13002            Sensors::DataFieldUltravioletBLight => "Data Field: Ultraviolet B Light",
13003            Sensors::DataFieldUltravioletIndex => "Data Field: Ultraviolet Index",
13004            Sensors::DataFieldNearInfraredLight => "Data Field: Near Infrared Light",
13005            Sensors::PropertyLight => "Property: Light",
13006            Sensors::PropertyConsumerIRSentenceSend => "Property: Consumer IR Sentence Send",
13007            Sensors::PropertyAutoBrightnessPreferred => "Property: Auto Brightness Preferred",
13008            Sensors::PropertyAutoColorPreferred => "Property: Auto Color Preferred",
13009            Sensors::DataFieldScanner => "Data Field: Scanner",
13010            Sensors::DataFieldRFIDTag40Bit => "Data Field: RFID Tag 40 Bit",
13011            Sensors::DataFieldNFCSentenceReceive => "Data Field: NFC Sentence Receive",
13012            Sensors::PropertyScanner => "Property: Scanner",
13013            Sensors::PropertyNFCSentenceSend => "Property: NFC Sentence Send",
13014            Sensors::DataFieldElectrical => "Data Field: Electrical",
13015            Sensors::DataFieldCapacitance => "Data Field: Capacitance",
13016            Sensors::DataFieldCurrent => "Data Field: Current",
13017            Sensors::DataFieldElectricalPower => "Data Field: Electrical Power",
13018            Sensors::DataFieldInductance => "Data Field: Inductance",
13019            Sensors::DataFieldResistance => "Data Field: Resistance",
13020            Sensors::DataFieldVoltage => "Data Field: Voltage",
13021            Sensors::DataFieldFrequency => "Data Field: Frequency",
13022            Sensors::DataFieldPeriod => "Data Field: Period",
13023            Sensors::DataFieldPercentofRange => "Data Field: Percent of Range",
13024            Sensors::DataFieldTime => "Data Field: Time",
13025            Sensors::DataFieldYear => "Data Field: Year",
13026            Sensors::DataFieldMonth => "Data Field: Month",
13027            Sensors::DataFieldDay => "Data Field: Day",
13028            Sensors::DataFieldDayofWeek => "Data Field: Day of Week",
13029            Sensors::DataFieldHour => "Data Field: Hour",
13030            Sensors::DataFieldMinute => "Data Field: Minute",
13031            Sensors::DataFieldSecond => "Data Field: Second",
13032            Sensors::DataFieldMillisecond => "Data Field: Millisecond",
13033            Sensors::DataFieldTimestamp => "Data Field: Timestamp",
13034            Sensors::DataFieldJulianDayofYear => "Data Field: Julian Day of Year",
13035            Sensors::DataFieldTimeSinceSystemBoot => "Data Field: Time Since System Boot",
13036            Sensors::PropertyTime => "Property: Time",
13037            Sensors::PropertyTimeZoneOffsetfromUTC => "Property: Time Zone Offset from UTC",
13038            Sensors::PropertyTimeZoneName => "Property: Time Zone Name",
13039            Sensors::PropertyDaylightSavingsTimeObserved => {
13040                "Property: Daylight Savings Time Observed"
13041            }
13042            Sensors::PropertyTimeTrimAdjustment => "Property: Time Trim Adjustment",
13043            Sensors::PropertyArmAlarm => "Property: Arm Alarm",
13044            Sensors::DataFieldCustom => "Data Field: Custom",
13045            Sensors::DataFieldCustomUsage => "Data Field: Custom Usage",
13046            Sensors::DataFieldCustomBooleanArray => "Data Field: Custom Boolean Array",
13047            Sensors::DataFieldCustomValue => "Data Field: Custom Value",
13048            Sensors::DataFieldCustomValue1 => "Data Field: Custom Value 1",
13049            Sensors::DataFieldCustomValue2 => "Data Field: Custom Value 2",
13050            Sensors::DataFieldCustomValue3 => "Data Field: Custom Value 3",
13051            Sensors::DataFieldCustomValue4 => "Data Field: Custom Value 4",
13052            Sensors::DataFieldCustomValue5 => "Data Field: Custom Value 5",
13053            Sensors::DataFieldCustomValue6 => "Data Field: Custom Value 6",
13054            Sensors::DataFieldCustomValue7 => "Data Field: Custom Value 7",
13055            Sensors::DataFieldCustomValue8 => "Data Field: Custom Value 8",
13056            Sensors::DataFieldCustomValue9 => "Data Field: Custom Value 9",
13057            Sensors::DataFieldCustomValue10 => "Data Field: Custom Value 10",
13058            Sensors::DataFieldCustomValue11 => "Data Field: Custom Value 11",
13059            Sensors::DataFieldCustomValue12 => "Data Field: Custom Value 12",
13060            Sensors::DataFieldCustomValue13 => "Data Field: Custom Value 13",
13061            Sensors::DataFieldCustomValue14 => "Data Field: Custom Value 14",
13062            Sensors::DataFieldCustomValue15 => "Data Field: Custom Value 15",
13063            Sensors::DataFieldCustomValue16 => "Data Field: Custom Value 16",
13064            Sensors::DataFieldCustomValue17 => "Data Field: Custom Value 17",
13065            Sensors::DataFieldCustomValue18 => "Data Field: Custom Value 18",
13066            Sensors::DataFieldCustomValue19 => "Data Field: Custom Value 19",
13067            Sensors::DataFieldCustomValue20 => "Data Field: Custom Value 20",
13068            Sensors::DataFieldCustomValue21 => "Data Field: Custom Value 21",
13069            Sensors::DataFieldCustomValue22 => "Data Field: Custom Value 22",
13070            Sensors::DataFieldCustomValue23 => "Data Field: Custom Value 23",
13071            Sensors::DataFieldCustomValue24 => "Data Field: Custom Value 24",
13072            Sensors::DataFieldCustomValue25 => "Data Field: Custom Value 25",
13073            Sensors::DataFieldCustomValue26 => "Data Field: Custom Value 26",
13074            Sensors::DataFieldCustomValue27 => "Data Field: Custom Value 27",
13075            Sensors::DataFieldCustomValue28 => "Data Field: Custom Value 28",
13076            Sensors::DataFieldGeneric => "Data Field: Generic",
13077            Sensors::DataFieldGenericGUIDorPROPERTYKEY => "Data Field: Generic GUID or PROPERTYKEY",
13078            Sensors::DataFieldGenericCategoryGUID => "Data Field: Generic Category GUID",
13079            Sensors::DataFieldGenericTypeGUID => "Data Field: Generic Type GUID",
13080            Sensors::DataFieldGenericEventPROPERTYKEY => "Data Field: Generic Event PROPERTYKEY",
13081            Sensors::DataFieldGenericPropertyPROPERTYKEY => {
13082                "Data Field: Generic Property PROPERTYKEY"
13083            }
13084            Sensors::DataFieldGenericDataFieldPROPERTYKEY => {
13085                "Data Field: Generic Data Field PROPERTYKEY"
13086            }
13087            Sensors::DataFieldGenericEvent => "Data Field: Generic Event",
13088            Sensors::DataFieldGenericProperty => "Data Field: Generic Property",
13089            Sensors::DataFieldGenericDataField => "Data Field: Generic Data Field",
13090            Sensors::DataFieldEnumeratorTableRowIndex => "Data Field: Enumerator Table Row Index",
13091            Sensors::DataFieldEnumeratorTableRowCount => "Data Field: Enumerator Table Row Count",
13092            Sensors::DataFieldGenericGUIDorPROPERTYKEYkind => {
13093                "Data Field: Generic GUID or PROPERTYKEY kind"
13094            }
13095            Sensors::DataFieldGenericGUID => "Data Field: Generic GUID",
13096            Sensors::DataFieldGenericPROPERTYKEY => "Data Field: Generic PROPERTYKEY",
13097            Sensors::DataFieldGenericTopLevelCollectionID => {
13098                "Data Field: Generic Top Level Collection ID"
13099            }
13100            Sensors::DataFieldGenericReportID => "Data Field: Generic Report ID",
13101            Sensors::DataFieldGenericReportItemPositionIndex => {
13102                "Data Field: Generic Report Item Position Index"
13103            }
13104            Sensors::DataFieldGenericFirmwareVARTYPE => "Data Field: Generic Firmware VARTYPE",
13105            Sensors::DataFieldGenericUnitofMeasure => "Data Field: Generic Unit of Measure",
13106            Sensors::DataFieldGenericUnitExponent => "Data Field: Generic Unit Exponent",
13107            Sensors::DataFieldGenericReportSize => "Data Field: Generic Report Size",
13108            Sensors::DataFieldGenericReportCount => "Data Field: Generic Report Count",
13109            Sensors::PropertyGeneric => "Property: Generic",
13110            Sensors::PropertyEnumeratorTableRowIndex => "Property: Enumerator Table Row Index",
13111            Sensors::PropertyEnumeratorTableRowCount => "Property: Enumerator Table Row Count",
13112            Sensors::DataFieldPersonalActivity => "Data Field: Personal Activity",
13113            Sensors::DataFieldActivityType => "Data Field: Activity Type",
13114            Sensors::DataFieldActivityState => "Data Field: Activity State",
13115            Sensors::DataFieldDevicePosition => "Data Field: Device Position",
13116            Sensors::DataFieldStepCount => "Data Field: Step Count",
13117            Sensors::DataFieldStepCountReset => "Data Field: Step Count Reset",
13118            Sensors::DataFieldStepDuration => "Data Field: Step Duration",
13119            Sensors::DataFieldStepType => "Data Field: Step Type",
13120            Sensors::PropertyMinimumActivityDetectionInterval => {
13121                "Property: Minimum Activity Detection Interval"
13122            }
13123            Sensors::PropertySupportedActivityTypes => "Property: Supported Activity Types",
13124            Sensors::PropertySubscribedActivityTypes => "Property: Subscribed Activity Types",
13125            Sensors::PropertySupportedStepTypes => "Property: Supported Step Types",
13126            Sensors::PropertySubscribedStepTypes => "Property: Subscribed Step Types",
13127            Sensors::PropertyFloorHeight => "Property: Floor Height",
13128            Sensors::DataFieldCustomTypeID => "Data Field: Custom Type ID",
13129            Sensors::PropertyCustom => "Property: Custom",
13130            Sensors::PropertyCustomValue1 => "Property: Custom Value 1",
13131            Sensors::PropertyCustomValue2 => "Property: Custom Value 2",
13132            Sensors::PropertyCustomValue3 => "Property: Custom Value 3",
13133            Sensors::PropertyCustomValue4 => "Property: Custom Value 4",
13134            Sensors::PropertyCustomValue5 => "Property: Custom Value 5",
13135            Sensors::PropertyCustomValue6 => "Property: Custom Value 6",
13136            Sensors::PropertyCustomValue7 => "Property: Custom Value 7",
13137            Sensors::PropertyCustomValue8 => "Property: Custom Value 8",
13138            Sensors::PropertyCustomValue9 => "Property: Custom Value 9",
13139            Sensors::PropertyCustomValue10 => "Property: Custom Value 10",
13140            Sensors::PropertyCustomValue11 => "Property: Custom Value 11",
13141            Sensors::PropertyCustomValue12 => "Property: Custom Value 12",
13142            Sensors::PropertyCustomValue13 => "Property: Custom Value 13",
13143            Sensors::PropertyCustomValue14 => "Property: Custom Value 14",
13144            Sensors::PropertyCustomValue15 => "Property: Custom Value 15",
13145            Sensors::PropertyCustomValue16 => "Property: Custom Value 16",
13146            Sensors::DataFieldHinge => "Data Field: Hinge",
13147            Sensors::DataFieldHingeAngle => "Data Field: Hinge Angle",
13148            Sensors::DataFieldGestureSensor => "Data Field: Gesture Sensor",
13149            Sensors::DataFieldGestureState => "Data Field: Gesture State",
13150            Sensors::DataFieldHingeFoldInitialAngle => "Data Field: Hinge Fold Initial Angle",
13151            Sensors::DataFieldHingeFoldFinalAngle => "Data Field: Hinge Fold Final Angle",
13152            Sensors::DataFieldHingeFoldContributingPanel => {
13153                "Data Field: Hinge Fold Contributing Panel"
13154            }
13155            Sensors::DataFieldHingeFoldType => "Data Field: Hinge Fold Type",
13156            Sensors::SensorStateUndefined => "Sensor State: Undefined",
13157            Sensors::SensorStateReady => "Sensor State: Ready",
13158            Sensors::SensorStateNotAvailable => "Sensor State: Not Available",
13159            Sensors::SensorStateNoData => "Sensor State: No Data",
13160            Sensors::SensorStateInitializing => "Sensor State: Initializing",
13161            Sensors::SensorStateAccessDenied => "Sensor State: Access Denied",
13162            Sensors::SensorStateError => "Sensor State: Error",
13163            Sensors::SensorEventUnknown => "Sensor Event: Unknown",
13164            Sensors::SensorEventStateChanged => "Sensor Event: State Changed",
13165            Sensors::SensorEventPropertyChanged => "Sensor Event: Property Changed",
13166            Sensors::SensorEventDataUpdated => "Sensor Event: Data Updated",
13167            Sensors::SensorEventPollResponse => "Sensor Event: Poll Response",
13168            Sensors::SensorEventChangeSensitivity => "Sensor Event: Change Sensitivity",
13169            Sensors::SensorEventRangeMaximumReached => "Sensor Event: Range Maximum Reached",
13170            Sensors::SensorEventRangeMinimumReached => "Sensor Event: Range Minimum Reached",
13171            Sensors::SensorEventHighThresholdCrossUpward => {
13172                "Sensor Event: High Threshold Cross Upward"
13173            }
13174            Sensors::SensorEventHighThresholdCrossDownward => {
13175                "Sensor Event: High Threshold Cross Downward"
13176            }
13177            Sensors::SensorEventLowThresholdCrossUpward => {
13178                "Sensor Event: Low Threshold Cross Upward"
13179            }
13180            Sensors::SensorEventLowThresholdCrossDownward => {
13181                "Sensor Event: Low Threshold Cross Downward"
13182            }
13183            Sensors::SensorEventZeroThresholdCrossUpward => {
13184                "Sensor Event: Zero Threshold Cross Upward"
13185            }
13186            Sensors::SensorEventZeroThresholdCrossDownward => {
13187                "Sensor Event: Zero Threshold Cross Downward"
13188            }
13189            Sensors::SensorEventPeriodExceeded => "Sensor Event: Period Exceeded",
13190            Sensors::SensorEventFrequencyExceeded => "Sensor Event: Frequency Exceeded",
13191            Sensors::SensorEventComplexTrigger => "Sensor Event: Complex Trigger",
13192            Sensors::ConnectionTypePCIntegrated => "Connection Type: PC Integrated",
13193            Sensors::ConnectionTypePCAttached => "Connection Type: PC Attached",
13194            Sensors::ConnectionTypePCExternal => "Connection Type: PC External",
13195            Sensors::ReportingStateReportNoEvents => "Reporting State: Report No Events",
13196            Sensors::ReportingStateReportAllEvents => "Reporting State: Report All Events",
13197            Sensors::ReportingStateReportThresholdEvents => {
13198                "Reporting State: Report Threshold Events"
13199            }
13200            Sensors::ReportingStateWakeOnNoEvents => "Reporting State: Wake On No Events",
13201            Sensors::ReportingStateWakeOnAllEvents => "Reporting State: Wake On All Events",
13202            Sensors::ReportingStateWakeOnThresholdEvents => {
13203                "Reporting State: Wake On Threshold Events"
13204            }
13205            Sensors::ReportingStateAnytime => "Reporting State: Anytime",
13206            Sensors::PowerStateUndefined => "Power State: Undefined",
13207            Sensors::PowerStateD0FullPower => "Power State: D0 Full Power",
13208            Sensors::PowerStateD1LowPower => "Power State: D1 Low Power",
13209            Sensors::PowerStateD2StandbyPowerwithWakeup => {
13210                "Power State: D2 Standby Power with Wakeup"
13211            }
13212            Sensors::PowerStateD3SleepwithWakeup => "Power State: D3 Sleep with Wakeup",
13213            Sensors::PowerStateD4PowerOff => "Power State: D4 Power Off",
13214            Sensors::AccuracyDefault => "Accuracy: Default",
13215            Sensors::AccuracyHigh => "Accuracy: High",
13216            Sensors::AccuracyMedium => "Accuracy: Medium",
13217            Sensors::AccuracyLow => "Accuracy: Low",
13218            Sensors::FixQualityNoFix => "Fix Quality: No Fix",
13219            Sensors::FixQualityGPS => "Fix Quality: GPS",
13220            Sensors::FixQualityDGPS => "Fix Quality: DGPS",
13221            Sensors::FixTypeNoFix => "Fix Type: No Fix",
13222            Sensors::FixTypeGPSSPSModeFixValid => "Fix Type: GPS SPS Mode, Fix Valid",
13223            Sensors::FixTypeDGPSSPSModeFixValid => "Fix Type: DGPS SPS Mode, Fix Valid",
13224            Sensors::FixTypeGPSPPSModeFixValid => "Fix Type: GPS PPS Mode, Fix Valid",
13225            Sensors::FixTypeRealTimeKinematic => "Fix Type: Real Time Kinematic",
13226            Sensors::FixTypeFloatRTK => "Fix Type: Float RTK",
13227            Sensors::FixTypeEstimateddeadreckoned => "Fix Type: Estimated (dead reckoned)",
13228            Sensors::FixTypeManualInputMode => "Fix Type: Manual Input Mode",
13229            Sensors::FixTypeSimulatorMode => "Fix Type: Simulator Mode",
13230            Sensors::GPSOperationModeManual => "GPS Operation Mode: Manual",
13231            Sensors::GPSOperationModeAutomatic => "GPS Operation Mode: Automatic",
13232            Sensors::GPSSelectionModeAutonomous => "GPS Selection Mode: Autonomous",
13233            Sensors::GPSSelectionModeDGPS => "GPS Selection Mode: DGPS",
13234            Sensors::GPSSelectionModeEstimateddeadreckoned => {
13235                "GPS Selection Mode: Estimated (dead reckoned)"
13236            }
13237            Sensors::GPSSelectionModeManualInput => "GPS Selection Mode: Manual Input",
13238            Sensors::GPSSelectionModeSimulator => "GPS Selection Mode: Simulator",
13239            Sensors::GPSSelectionModeDataNotValid => "GPS Selection Mode: Data Not Valid",
13240            Sensors::GPSStatusDataValid => "GPS Status Data: Valid",
13241            Sensors::GPSStatusDataNotValid => "GPS Status Data: Not Valid",
13242            Sensors::DayofWeekSunday => "Day of Week: Sunday",
13243            Sensors::DayofWeekMonday => "Day of Week: Monday",
13244            Sensors::DayofWeekTuesday => "Day of Week: Tuesday",
13245            Sensors::DayofWeekWednesday => "Day of Week: Wednesday",
13246            Sensors::DayofWeekThursday => "Day of Week: Thursday",
13247            Sensors::DayofWeekFriday => "Day of Week: Friday",
13248            Sensors::DayofWeekSaturday => "Day of Week: Saturday",
13249            Sensors::KindCategory => "Kind: Category",
13250            Sensors::KindType => "Kind: Type",
13251            Sensors::KindEvent => "Kind: Event",
13252            Sensors::KindProperty => "Kind: Property",
13253            Sensors::KindDataField => "Kind: Data Field",
13254            Sensors::MagnetometerAccuracyLow => "Magnetometer Accuracy: Low",
13255            Sensors::MagnetometerAccuracyMedium => "Magnetometer Accuracy: Medium",
13256            Sensors::MagnetometerAccuracyHigh => "Magnetometer Accuracy: High",
13257            Sensors::SimpleOrientationDirectionNotRotated => {
13258                "Simple Orientation Direction: Not Rotated"
13259            }
13260            Sensors::SimpleOrientationDirectionRotated90DegreesCCW => {
13261                "Simple Orientation Direction: Rotated 90 Degrees CCW"
13262            }
13263            Sensors::SimpleOrientationDirectionRotated180DegreesCCW => {
13264                "Simple Orientation Direction: Rotated 180 Degrees CCW"
13265            }
13266            Sensors::SimpleOrientationDirectionRotated270DegreesCCW => {
13267                "Simple Orientation Direction: Rotated 270 Degrees CCW"
13268            }
13269            Sensors::SimpleOrientationDirectionFaceUp => "Simple Orientation Direction: Face Up",
13270            Sensors::SimpleOrientationDirectionFaceDown => {
13271                "Simple Orientation Direction: Face Down"
13272            }
13273            Sensors::VT_NULL => "VT_NULL",
13274            Sensors::VT_BOOL => "VT_BOOL",
13275            Sensors::VT_UI1 => "VT_UI1",
13276            Sensors::VT_I1 => "VT_I1",
13277            Sensors::VT_UI2 => "VT_UI2",
13278            Sensors::VT_I2 => "VT_I2",
13279            Sensors::VT_UI4 => "VT_UI4",
13280            Sensors::VT_I4 => "VT_I4",
13281            Sensors::VT_UI8 => "VT_UI8",
13282            Sensors::VT_I8 => "VT_I8",
13283            Sensors::VT_R4 => "VT_R4",
13284            Sensors::VT_R8 => "VT_R8",
13285            Sensors::VT_WSTR => "VT_WSTR",
13286            Sensors::VT_STR => "VT_STR",
13287            Sensors::VT_CLSID => "VT_CLSID",
13288            Sensors::VT_VECTORVT_UI1 => "VT_VECTOR VT_UI1",
13289            Sensors::VT_F16E0 => "VT_F16E0",
13290            Sensors::VT_F16E1 => "VT_F16E1",
13291            Sensors::VT_F16E2 => "VT_F16E2",
13292            Sensors::VT_F16E3 => "VT_F16E3",
13293            Sensors::VT_F16E4 => "VT_F16E4",
13294            Sensors::VT_F16E5 => "VT_F16E5",
13295            Sensors::VT_F16E6 => "VT_F16E6",
13296            Sensors::VT_F16E7 => "VT_F16E7",
13297            Sensors::VT_F16E8 => "VT_F16E8",
13298            Sensors::VT_F16E9 => "VT_F16E9",
13299            Sensors::VT_F16EA => "VT_F16EA",
13300            Sensors::VT_F16EB => "VT_F16EB",
13301            Sensors::VT_F16EC => "VT_F16EC",
13302            Sensors::VT_F16ED => "VT_F16ED",
13303            Sensors::VT_F16EE => "VT_F16EE",
13304            Sensors::VT_F16EF => "VT_F16EF",
13305            Sensors::VT_F32E0 => "VT_F32E0",
13306            Sensors::VT_F32E1 => "VT_F32E1",
13307            Sensors::VT_F32E2 => "VT_F32E2",
13308            Sensors::VT_F32E3 => "VT_F32E3",
13309            Sensors::VT_F32E4 => "VT_F32E4",
13310            Sensors::VT_F32E5 => "VT_F32E5",
13311            Sensors::VT_F32E6 => "VT_F32E6",
13312            Sensors::VT_F32E7 => "VT_F32E7",
13313            Sensors::VT_F32E8 => "VT_F32E8",
13314            Sensors::VT_F32E9 => "VT_F32E9",
13315            Sensors::VT_F32EA => "VT_F32EA",
13316            Sensors::VT_F32EB => "VT_F32EB",
13317            Sensors::VT_F32EC => "VT_F32EC",
13318            Sensors::VT_F32ED => "VT_F32ED",
13319            Sensors::VT_F32EE => "VT_F32EE",
13320            Sensors::VT_F32EF => "VT_F32EF",
13321            Sensors::ActivityTypeUnknown => "Activity Type: Unknown",
13322            Sensors::ActivityTypeStationary => "Activity Type: Stationary",
13323            Sensors::ActivityTypeFidgeting => "Activity Type: Fidgeting",
13324            Sensors::ActivityTypeWalking => "Activity Type: Walking",
13325            Sensors::ActivityTypeRunning => "Activity Type: Running",
13326            Sensors::ActivityTypeInVehicle => "Activity Type: In Vehicle",
13327            Sensors::ActivityTypeBiking => "Activity Type: Biking",
13328            Sensors::ActivityTypeIdle => "Activity Type: Idle",
13329            Sensors::UnitNotSpecified => "Unit: Not Specified",
13330            Sensors::UnitLux => "Unit: Lux",
13331            Sensors::UnitDegreesKelvin => "Unit: Degrees Kelvin",
13332            Sensors::UnitDegreesCelsius => "Unit: Degrees Celsius",
13333            Sensors::UnitPascal => "Unit: Pascal",
13334            Sensors::UnitNewton => "Unit: Newton",
13335            Sensors::UnitMetersSecond => "Unit: Meters/Second",
13336            Sensors::UnitKilogram => "Unit: Kilogram",
13337            Sensors::UnitMeter => "Unit: Meter",
13338            Sensors::UnitMetersSecondSecond => "Unit: Meters/Second/Second",
13339            Sensors::UnitFarad => "Unit: Farad",
13340            Sensors::UnitAmpere => "Unit: Ampere",
13341            Sensors::UnitWatt => "Unit: Watt",
13342            Sensors::UnitHenry => "Unit: Henry",
13343            Sensors::UnitOhm => "Unit: Ohm",
13344            Sensors::UnitVolt => "Unit: Volt",
13345            Sensors::UnitHertz => "Unit: Hertz",
13346            Sensors::UnitBar => "Unit: Bar",
13347            Sensors::UnitDegreesAnticlockwise => "Unit: Degrees Anti-clockwise",
13348            Sensors::UnitDegreesClockwise => "Unit: Degrees Clockwise",
13349            Sensors::UnitDegrees => "Unit: Degrees",
13350            Sensors::UnitDegreesSecond => "Unit: Degrees/Second",
13351            Sensors::UnitDegreesSecondSecond => "Unit: Degrees/Second/Second",
13352            Sensors::UnitKnot => "Unit: Knot",
13353            Sensors::UnitPercent => "Unit: Percent",
13354            Sensors::UnitSecond => "Unit: Second",
13355            Sensors::UnitMillisecond => "Unit: Millisecond",
13356            Sensors::UnitG => "Unit: G",
13357            Sensors::UnitBytes => "Unit: Bytes",
13358            Sensors::UnitMilligauss => "Unit: Milligauss",
13359            Sensors::UnitBits => "Unit: Bits",
13360            Sensors::ActivityStateNoStateChange => "Activity State: No State Change",
13361            Sensors::ActivityStateStartActivity => "Activity State: Start Activity",
13362            Sensors::ActivityStateEndActivity => "Activity State: End Activity",
13363            Sensors::Exponent0 => "Exponent 0",
13364            Sensors::Exponent1 => "Exponent 1",
13365            Sensors::Exponent2 => "Exponent 2",
13366            Sensors::Exponent3 => "Exponent 3",
13367            Sensors::Exponent4 => "Exponent 4",
13368            Sensors::Exponent5 => "Exponent 5",
13369            Sensors::Exponent6 => "Exponent 6",
13370            Sensors::Exponent7 => "Exponent 7",
13371            Sensors::Exponent8 => "Exponent 8",
13372            Sensors::Exponent9 => "Exponent 9",
13373            Sensors::ExponentA => "Exponent A",
13374            Sensors::ExponentB => "Exponent B",
13375            Sensors::ExponentC => "Exponent C",
13376            Sensors::ExponentD => "Exponent D",
13377            Sensors::ExponentE => "Exponent E",
13378            Sensors::ExponentF => "Exponent F",
13379            Sensors::DevicePositionUnknown => "Device Position: Unknown",
13380            Sensors::DevicePositionUnchanged => "Device Position: Unchanged",
13381            Sensors::DevicePositionOnDesk => "Device Position: On Desk",
13382            Sensors::DevicePositionInHand => "Device Position: In Hand",
13383            Sensors::DevicePositionMovinginBag => "Device Position: Moving in Bag",
13384            Sensors::DevicePositionStationaryinBag => "Device Position: Stationary in Bag",
13385            Sensors::StepTypeUnknown => "Step Type: Unknown",
13386            Sensors::StepTypeWalking => "Step Type: Walking",
13387            Sensors::StepTypeRunning => "Step Type: Running",
13388            Sensors::GestureStateUnknown => "Gesture State: Unknown",
13389            Sensors::GestureStateStarted => "Gesture State: Started",
13390            Sensors::GestureStateCompleted => "Gesture State: Completed",
13391            Sensors::GestureStateCancelled => "Gesture State: Cancelled",
13392            Sensors::HingeFoldContributingPanelUnknown => "Hinge Fold Contributing Panel: Unknown",
13393            Sensors::HingeFoldContributingPanelPanel1 => "Hinge Fold Contributing Panel: Panel 1",
13394            Sensors::HingeFoldContributingPanelPanel2 => "Hinge Fold Contributing Panel: Panel 2",
13395            Sensors::HingeFoldContributingPanelBoth => "Hinge Fold Contributing Panel: Both",
13396            Sensors::HingeFoldTypeUnknown => "Hinge Fold Type: Unknown",
13397            Sensors::HingeFoldTypeIncreasing => "Hinge Fold Type: Increasing",
13398            Sensors::HingeFoldTypeDecreasing => "Hinge Fold Type: Decreasing",
13399            Sensors::HumanPresenceDetectionTypeVendorDefinedNonBiometric => {
13400                "Human Presence Detection Type: Vendor-Defined Non-Biometric"
13401            }
13402            Sensors::HumanPresenceDetectionTypeVendorDefinedBiometric => {
13403                "Human Presence Detection Type: Vendor-Defined Biometric"
13404            }
13405            Sensors::HumanPresenceDetectionTypeFacialBiometric => {
13406                "Human Presence Detection Type: Facial Biometric"
13407            }
13408            Sensors::HumanPresenceDetectionTypeAudioBiometric => {
13409                "Human Presence Detection Type: Audio Biometric"
13410            }
13411            Sensors::ModifierChangeSensitivityAbsolute => "Modifier: Change Sensitivity Absolute",
13412            Sensors::ModifierMaximum => "Modifier: Maximum",
13413            Sensors::ModifierMinimum => "Modifier: Minimum",
13414            Sensors::ModifierAccuracy => "Modifier: Accuracy",
13415            Sensors::ModifierResolution => "Modifier: Resolution",
13416            Sensors::ModifierThresholdHigh => "Modifier: Threshold High",
13417            Sensors::ModifierThresholdLow => "Modifier: Threshold Low",
13418            Sensors::ModifierCalibrationOffset => "Modifier: Calibration Offset",
13419            Sensors::ModifierCalibrationMultiplier => "Modifier: Calibration Multiplier",
13420            Sensors::ModifierReportInterval => "Modifier: Report Interval",
13421            Sensors::ModifierFrequencyMax => "Modifier: Frequency Max",
13422            Sensors::ModifierPeriodMax => "Modifier: Period Max",
13423            Sensors::ModifierChangeSensitivityPercentofRange => {
13424                "Modifier: Change Sensitivity Percent of Range"
13425            }
13426            Sensors::ModifierChangeSensitivityPercentRelative => {
13427                "Modifier: Change Sensitivity Percent Relative"
13428            }
13429            Sensors::ModifierVendorReserved => "Modifier: Vendor Reserved",
13430        }
13431        .into()
13432    }
13433}
13434
13435#[cfg(feature = "std")]
13436impl fmt::Display for Sensors {
13437    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
13438        write!(f, "{}", self.name())
13439    }
13440}
13441
13442impl AsUsage for Sensors {
13443    /// Returns the 32 bit Usage value of this Usage
13444    fn usage_value(&self) -> u32 {
13445        u32::from(self)
13446    }
13447
13448    /// Returns the 16 bit Usage ID value of this Usage
13449    fn usage_id_value(&self) -> u16 {
13450        u16::from(self)
13451    }
13452
13453    /// Returns this usage as [Usage::Sensors(self)](Usage::Sensors)
13454    /// This is a convenience function to avoid having
13455    /// to implement `From` for every used type in the caller.
13456    ///
13457    /// ```
13458    /// # use hut::*;
13459    /// let gd_x = GenericDesktop::X;
13460    /// let usage = Usage::from(GenericDesktop::X);
13461    /// assert!(matches!(gd_x.usage(), usage));
13462    /// ```
13463    fn usage(&self) -> Usage {
13464        Usage::from(self)
13465    }
13466}
13467
13468impl AsUsagePage for Sensors {
13469    /// Returns the 16 bit value of this UsagePage
13470    ///
13471    /// This value is `0x20` for [Sensors]
13472    fn usage_page_value(&self) -> u16 {
13473        let up = UsagePage::from(self);
13474        u16::from(up)
13475    }
13476
13477    /// Returns [UsagePage::Sensors]]
13478    fn usage_page(&self) -> UsagePage {
13479        UsagePage::from(self)
13480    }
13481}
13482
13483impl From<&Sensors> for u16 {
13484    fn from(sensors: &Sensors) -> u16 {
13485        match *sensors {
13486            Sensors::Sensor => 1,
13487            Sensors::Biometric => 16,
13488            Sensors::BiometricHumanPresence => 17,
13489            Sensors::BiometricHumanProximity => 18,
13490            Sensors::BiometricHumanTouch => 19,
13491            Sensors::BiometricBloodPressure => 20,
13492            Sensors::BiometricBodyTemperature => 21,
13493            Sensors::BiometricHeartRate => 22,
13494            Sensors::BiometricHeartRateVariability => 23,
13495            Sensors::BiometricPeripheralOxygenSaturation => 24,
13496            Sensors::BiometricRespiratoryRate => 25,
13497            Sensors::Electrical => 32,
13498            Sensors::ElectricalCapacitance => 33,
13499            Sensors::ElectricalCurrent => 34,
13500            Sensors::ElectricalPower => 35,
13501            Sensors::ElectricalInductance => 36,
13502            Sensors::ElectricalResistance => 37,
13503            Sensors::ElectricalVoltage => 38,
13504            Sensors::ElectricalPotentiometer => 39,
13505            Sensors::ElectricalFrequency => 40,
13506            Sensors::ElectricalPeriod => 41,
13507            Sensors::Environmental => 48,
13508            Sensors::EnvironmentalAtmosphericPressure => 49,
13509            Sensors::EnvironmentalHumidity => 50,
13510            Sensors::EnvironmentalTemperature => 51,
13511            Sensors::EnvironmentalWindDirection => 52,
13512            Sensors::EnvironmentalWindSpeed => 53,
13513            Sensors::EnvironmentalAirQuality => 54,
13514            Sensors::EnvironmentalHeatIndex => 55,
13515            Sensors::EnvironmentalSurfaceTemperature => 56,
13516            Sensors::EnvironmentalVolatileOrganicCompounds => 57,
13517            Sensors::EnvironmentalObjectPresence => 58,
13518            Sensors::EnvironmentalObjectProximity => 59,
13519            Sensors::Light => 64,
13520            Sensors::LightAmbientLight => 65,
13521            Sensors::LightConsumerInfrared => 66,
13522            Sensors::LightInfraredLight => 67,
13523            Sensors::LightVisibleLight => 68,
13524            Sensors::LightUltravioletLight => 69,
13525            Sensors::Location => 80,
13526            Sensors::LocationBroadcast => 81,
13527            Sensors::LocationDeadReckoning => 82,
13528            Sensors::LocationGPSGlobalPositioningSystem => 83,
13529            Sensors::LocationLookup => 84,
13530            Sensors::LocationOther => 85,
13531            Sensors::LocationStatic => 86,
13532            Sensors::LocationTriangulation => 87,
13533            Sensors::Mechanical => 96,
13534            Sensors::MechanicalBooleanSwitch => 97,
13535            Sensors::MechanicalBooleanSwitchArray => 98,
13536            Sensors::MechanicalMultivalueSwitch => 99,
13537            Sensors::MechanicalForce => 100,
13538            Sensors::MechanicalPressure => 101,
13539            Sensors::MechanicalStrain => 102,
13540            Sensors::MechanicalWeight => 103,
13541            Sensors::MechanicalHapticVibrator => 104,
13542            Sensors::MechanicalHallEffectSwitch => 105,
13543            Sensors::Motion => 112,
13544            Sensors::MotionAccelerometer1D => 113,
13545            Sensors::MotionAccelerometer2D => 114,
13546            Sensors::MotionAccelerometer3D => 115,
13547            Sensors::MotionGyrometer1D => 116,
13548            Sensors::MotionGyrometer2D => 117,
13549            Sensors::MotionGyrometer3D => 118,
13550            Sensors::MotionMotionDetector => 119,
13551            Sensors::MotionSpeedometer => 120,
13552            Sensors::MotionAccelerometer => 121,
13553            Sensors::MotionGyrometer => 122,
13554            Sensors::MotionGravityVector => 123,
13555            Sensors::MotionLinearAccelerometer => 124,
13556            Sensors::Orientation => 128,
13557            Sensors::OrientationCompass1D => 129,
13558            Sensors::OrientationCompass2D => 130,
13559            Sensors::OrientationCompass3D => 131,
13560            Sensors::OrientationInclinometer1D => 132,
13561            Sensors::OrientationInclinometer2D => 133,
13562            Sensors::OrientationInclinometer3D => 134,
13563            Sensors::OrientationDistance1D => 135,
13564            Sensors::OrientationDistance2D => 136,
13565            Sensors::OrientationDistance3D => 137,
13566            Sensors::OrientationDeviceOrientation => 138,
13567            Sensors::OrientationCompass => 139,
13568            Sensors::OrientationInclinometer => 140,
13569            Sensors::OrientationDistance => 141,
13570            Sensors::OrientationRelativeOrientation => 142,
13571            Sensors::OrientationSimpleOrientation => 143,
13572            Sensors::Scanner => 144,
13573            Sensors::ScannerBarcode => 145,
13574            Sensors::ScannerRFID => 146,
13575            Sensors::ScannerNFC => 147,
13576            Sensors::Time => 160,
13577            Sensors::TimeAlarmTimer => 161,
13578            Sensors::TimeRealTimeClock => 162,
13579            Sensors::PersonalActivity => 176,
13580            Sensors::PersonalActivityActivityDetection => 177,
13581            Sensors::PersonalActivityDevicePosition => 178,
13582            Sensors::PersonalActivityFloorTracker => 179,
13583            Sensors::PersonalActivityPedometer => 180,
13584            Sensors::PersonalActivityStepDetection => 181,
13585            Sensors::OrientationExtended => 192,
13586            Sensors::OrientationExtendedGeomagneticOrientation => 193,
13587            Sensors::OrientationExtendedMagnetometer => 194,
13588            Sensors::Gesture => 208,
13589            Sensors::GestureChassisFlipGesture => 209,
13590            Sensors::GestureHingeFoldGesture => 210,
13591            Sensors::Other => 224,
13592            Sensors::OtherCustom => 225,
13593            Sensors::OtherGeneric => 226,
13594            Sensors::OtherGenericEnumerator => 227,
13595            Sensors::OtherHingeAngle => 228,
13596            Sensors::VendorReserved1 => 240,
13597            Sensors::VendorReserved2 => 241,
13598            Sensors::VendorReserved3 => 242,
13599            Sensors::VendorReserved4 => 243,
13600            Sensors::VendorReserved5 => 244,
13601            Sensors::VendorReserved6 => 245,
13602            Sensors::VendorReserved7 => 246,
13603            Sensors::VendorReserved8 => 247,
13604            Sensors::VendorReserved9 => 248,
13605            Sensors::VendorReserved10 => 249,
13606            Sensors::VendorReserved11 => 250,
13607            Sensors::VendorReserved12 => 251,
13608            Sensors::VendorReserved13 => 252,
13609            Sensors::VendorReserved14 => 253,
13610            Sensors::VendorReserved15 => 254,
13611            Sensors::VendorReserved16 => 255,
13612            Sensors::Event => 512,
13613            Sensors::EventSensorState => 513,
13614            Sensors::EventSensorEvent => 514,
13615            Sensors::Property => 768,
13616            Sensors::PropertyFriendlyName => 769,
13617            Sensors::PropertyPersistentUniqueID => 770,
13618            Sensors::PropertySensorStatus => 771,
13619            Sensors::PropertyMinimumReportInterval => 772,
13620            Sensors::PropertySensorManufacturer => 773,
13621            Sensors::PropertySensorModel => 774,
13622            Sensors::PropertySensorSerialNumber => 775,
13623            Sensors::PropertySensorDescription => 776,
13624            Sensors::PropertySensorConnectionType => 777,
13625            Sensors::PropertySensorDevicePath => 778,
13626            Sensors::PropertyHardwareRevision => 779,
13627            Sensors::PropertyFirmwareVersion => 780,
13628            Sensors::PropertyReleaseDate => 781,
13629            Sensors::PropertyReportInterval => 782,
13630            Sensors::PropertyChangeSensitivityAbsolute => 783,
13631            Sensors::PropertyChangeSensitivityPercentofRange => 784,
13632            Sensors::PropertyChangeSensitivityPercentRelative => 785,
13633            Sensors::PropertyAccuracy => 786,
13634            Sensors::PropertyResolution => 787,
13635            Sensors::PropertyMaximum => 788,
13636            Sensors::PropertyMinimum => 789,
13637            Sensors::PropertyReportingState => 790,
13638            Sensors::PropertySamplingRate => 791,
13639            Sensors::PropertyResponseCurve => 792,
13640            Sensors::PropertyPowerState => 793,
13641            Sensors::PropertyMaximumFIFOEvents => 794,
13642            Sensors::PropertyReportLatency => 795,
13643            Sensors::PropertyFlushFIFOEvents => 796,
13644            Sensors::PropertyMaximumPowerConsumption => 797,
13645            Sensors::PropertyIsPrimary => 798,
13646            Sensors::PropertyHumanPresenceDetectionType => 799,
13647            Sensors::DataFieldLocation => 1024,
13648            Sensors::DataFieldAltitudeAntennaSeaLevel => 1026,
13649            Sensors::DataFieldDifferentialReferenceStationID => 1027,
13650            Sensors::DataFieldAltitudeEllipsoidError => 1028,
13651            Sensors::DataFieldAltitudeEllipsoid => 1029,
13652            Sensors::DataFieldAltitudeSeaLevelError => 1030,
13653            Sensors::DataFieldAltitudeSeaLevel => 1031,
13654            Sensors::DataFieldDifferentialGPSDataAge => 1032,
13655            Sensors::DataFieldErrorRadius => 1033,
13656            Sensors::DataFieldFixQuality => 1034,
13657            Sensors::DataFieldFixType => 1035,
13658            Sensors::DataFieldGeoidalSeparation => 1036,
13659            Sensors::DataFieldGPSOperationMode => 1037,
13660            Sensors::DataFieldGPSSelectionMode => 1038,
13661            Sensors::DataFieldGPSStatus => 1039,
13662            Sensors::DataFieldPositionDilutionofPrecision => 1040,
13663            Sensors::DataFieldHorizontalDilutionofPrecision => 1041,
13664            Sensors::DataFieldVerticalDilutionofPrecision => 1042,
13665            Sensors::DataFieldLatitude => 1043,
13666            Sensors::DataFieldLongitude => 1044,
13667            Sensors::DataFieldTrueHeading => 1045,
13668            Sensors::DataFieldMagneticHeading => 1046,
13669            Sensors::DataFieldMagneticVariation => 1047,
13670            Sensors::DataFieldSpeed => 1048,
13671            Sensors::DataFieldSatellitesinView => 1049,
13672            Sensors::DataFieldSatellitesinViewAzimuth => 1050,
13673            Sensors::DataFieldSatellitesinViewElevation => 1051,
13674            Sensors::DataFieldSatellitesinViewIDs => 1052,
13675            Sensors::DataFieldSatellitesinViewPRNs => 1053,
13676            Sensors::DataFieldSatellitesinViewSNRatios => 1054,
13677            Sensors::DataFieldSatellitesUsedCount => 1055,
13678            Sensors::DataFieldSatellitesUsedPRNs => 1056,
13679            Sensors::DataFieldNMEASentence => 1057,
13680            Sensors::DataFieldAddressLine1 => 1058,
13681            Sensors::DataFieldAddressLine2 => 1059,
13682            Sensors::DataFieldCity => 1060,
13683            Sensors::DataFieldStateorProvince => 1061,
13684            Sensors::DataFieldCountryorRegion => 1062,
13685            Sensors::DataFieldPostalCode => 1063,
13686            Sensors::PropertyLocation => 1066,
13687            Sensors::PropertyLocationDesiredAccuracy => 1067,
13688            Sensors::DataFieldEnvironmental => 1072,
13689            Sensors::DataFieldAtmosphericPressure => 1073,
13690            Sensors::DataFieldRelativeHumidity => 1075,
13691            Sensors::DataFieldTemperature => 1076,
13692            Sensors::DataFieldWindDirection => 1077,
13693            Sensors::DataFieldWindSpeed => 1078,
13694            Sensors::DataFieldAirQualityIndex => 1079,
13695            Sensors::DataFieldEquivalentCO2 => 1080,
13696            Sensors::DataFieldVolatileOrganicCompoundConcentration => 1081,
13697            Sensors::DataFieldObjectPresence => 1082,
13698            Sensors::DataFieldObjectProximityRange => 1083,
13699            Sensors::DataFieldObjectProximityOutofRange => 1084,
13700            Sensors::PropertyEnvironmental => 1088,
13701            Sensors::PropertyReferencePressure => 1089,
13702            Sensors::DataFieldMotion => 1104,
13703            Sensors::DataFieldMotionState => 1105,
13704            Sensors::DataFieldAcceleration => 1106,
13705            Sensors::DataFieldAccelerationAxisX => 1107,
13706            Sensors::DataFieldAccelerationAxisY => 1108,
13707            Sensors::DataFieldAccelerationAxisZ => 1109,
13708            Sensors::DataFieldAngularVelocity => 1110,
13709            Sensors::DataFieldAngularVelocityaboutXAxis => 1111,
13710            Sensors::DataFieldAngularVelocityaboutYAxis => 1112,
13711            Sensors::DataFieldAngularVelocityaboutZAxis => 1113,
13712            Sensors::DataFieldAngularPosition => 1114,
13713            Sensors::DataFieldAngularPositionaboutXAxis => 1115,
13714            Sensors::DataFieldAngularPositionaboutYAxis => 1116,
13715            Sensors::DataFieldAngularPositionaboutZAxis => 1117,
13716            Sensors::DataFieldMotionSpeed => 1118,
13717            Sensors::DataFieldMotionIntensity => 1119,
13718            Sensors::DataFieldOrientation => 1136,
13719            Sensors::DataFieldHeading => 1137,
13720            Sensors::DataFieldHeadingXAxis => 1138,
13721            Sensors::DataFieldHeadingYAxis => 1139,
13722            Sensors::DataFieldHeadingZAxis => 1140,
13723            Sensors::DataFieldHeadingCompensatedMagneticNorth => 1141,
13724            Sensors::DataFieldHeadingCompensatedTrueNorth => 1142,
13725            Sensors::DataFieldHeadingMagneticNorth => 1143,
13726            Sensors::DataFieldHeadingTrueNorth => 1144,
13727            Sensors::DataFieldDistance => 1145,
13728            Sensors::DataFieldDistanceXAxis => 1146,
13729            Sensors::DataFieldDistanceYAxis => 1147,
13730            Sensors::DataFieldDistanceZAxis => 1148,
13731            Sensors::DataFieldDistanceOutofRange => 1149,
13732            Sensors::DataFieldTilt => 1150,
13733            Sensors::DataFieldTiltXAxis => 1151,
13734            Sensors::DataFieldTiltYAxis => 1152,
13735            Sensors::DataFieldTiltZAxis => 1153,
13736            Sensors::DataFieldRotationMatrix => 1154,
13737            Sensors::DataFieldQuaternion => 1155,
13738            Sensors::DataFieldMagneticFlux => 1156,
13739            Sensors::DataFieldMagneticFluxXAxis => 1157,
13740            Sensors::DataFieldMagneticFluxYAxis => 1158,
13741            Sensors::DataFieldMagneticFluxZAxis => 1159,
13742            Sensors::DataFieldMagnetometerAccuracy => 1160,
13743            Sensors::DataFieldSimpleOrientationDirection => 1161,
13744            Sensors::DataFieldMechanical => 1168,
13745            Sensors::DataFieldBooleanSwitchState => 1169,
13746            Sensors::DataFieldBooleanSwitchArrayStates => 1170,
13747            Sensors::DataFieldMultivalueSwitchValue => 1171,
13748            Sensors::DataFieldForce => 1172,
13749            Sensors::DataFieldAbsolutePressure => 1173,
13750            Sensors::DataFieldGaugePressure => 1174,
13751            Sensors::DataFieldStrain => 1175,
13752            Sensors::DataFieldWeight => 1176,
13753            Sensors::PropertyMechanical => 1184,
13754            Sensors::PropertyVibrationState => 1185,
13755            Sensors::PropertyForwardVibrationSpeed => 1186,
13756            Sensors::PropertyBackwardVibrationSpeed => 1187,
13757            Sensors::DataFieldBiometric => 1200,
13758            Sensors::DataFieldHumanPresence => 1201,
13759            Sensors::DataFieldHumanProximityRange => 1202,
13760            Sensors::DataFieldHumanProximityOutofRange => 1203,
13761            Sensors::DataFieldHumanTouchState => 1204,
13762            Sensors::DataFieldBloodPressure => 1205,
13763            Sensors::DataFieldBloodPressureDiastolic => 1206,
13764            Sensors::DataFieldBloodPressureSystolic => 1207,
13765            Sensors::DataFieldHeartRate => 1208,
13766            Sensors::DataFieldRestingHeartRate => 1209,
13767            Sensors::DataFieldHeartbeatInterval => 1210,
13768            Sensors::DataFieldRespiratoryRate => 1211,
13769            Sensors::DataFieldSpO2 => 1212,
13770            Sensors::DataFieldHumanAttentionDetected => 1213,
13771            Sensors::DataFieldHumanHeadAzimuth => 1214,
13772            Sensors::DataFieldHumanHeadAltitude => 1215,
13773            Sensors::DataFieldHumanHeadRoll => 1216,
13774            Sensors::DataFieldHumanHeadPitch => 1217,
13775            Sensors::DataFieldHumanHeadYaw => 1218,
13776            Sensors::DataFieldHumanCorrelationId => 1219,
13777            Sensors::DataFieldLight => 1232,
13778            Sensors::DataFieldIlluminance => 1233,
13779            Sensors::DataFieldColorTemperature => 1234,
13780            Sensors::DataFieldChromaticity => 1235,
13781            Sensors::DataFieldChromaticityX => 1236,
13782            Sensors::DataFieldChromaticityY => 1237,
13783            Sensors::DataFieldConsumerIRSentenceReceive => 1238,
13784            Sensors::DataFieldInfraredLight => 1239,
13785            Sensors::DataFieldRedLight => 1240,
13786            Sensors::DataFieldGreenLight => 1241,
13787            Sensors::DataFieldBlueLight => 1242,
13788            Sensors::DataFieldUltravioletALight => 1243,
13789            Sensors::DataFieldUltravioletBLight => 1244,
13790            Sensors::DataFieldUltravioletIndex => 1245,
13791            Sensors::DataFieldNearInfraredLight => 1246,
13792            Sensors::PropertyLight => 1247,
13793            Sensors::PropertyConsumerIRSentenceSend => 1248,
13794            Sensors::PropertyAutoBrightnessPreferred => 1250,
13795            Sensors::PropertyAutoColorPreferred => 1251,
13796            Sensors::DataFieldScanner => 1264,
13797            Sensors::DataFieldRFIDTag40Bit => 1265,
13798            Sensors::DataFieldNFCSentenceReceive => 1266,
13799            Sensors::PropertyScanner => 1272,
13800            Sensors::PropertyNFCSentenceSend => 1273,
13801            Sensors::DataFieldElectrical => 1280,
13802            Sensors::DataFieldCapacitance => 1281,
13803            Sensors::DataFieldCurrent => 1282,
13804            Sensors::DataFieldElectricalPower => 1283,
13805            Sensors::DataFieldInductance => 1284,
13806            Sensors::DataFieldResistance => 1285,
13807            Sensors::DataFieldVoltage => 1286,
13808            Sensors::DataFieldFrequency => 1287,
13809            Sensors::DataFieldPeriod => 1288,
13810            Sensors::DataFieldPercentofRange => 1289,
13811            Sensors::DataFieldTime => 1312,
13812            Sensors::DataFieldYear => 1313,
13813            Sensors::DataFieldMonth => 1314,
13814            Sensors::DataFieldDay => 1315,
13815            Sensors::DataFieldDayofWeek => 1316,
13816            Sensors::DataFieldHour => 1317,
13817            Sensors::DataFieldMinute => 1318,
13818            Sensors::DataFieldSecond => 1319,
13819            Sensors::DataFieldMillisecond => 1320,
13820            Sensors::DataFieldTimestamp => 1321,
13821            Sensors::DataFieldJulianDayofYear => 1322,
13822            Sensors::DataFieldTimeSinceSystemBoot => 1323,
13823            Sensors::PropertyTime => 1328,
13824            Sensors::PropertyTimeZoneOffsetfromUTC => 1329,
13825            Sensors::PropertyTimeZoneName => 1330,
13826            Sensors::PropertyDaylightSavingsTimeObserved => 1331,
13827            Sensors::PropertyTimeTrimAdjustment => 1332,
13828            Sensors::PropertyArmAlarm => 1333,
13829            Sensors::DataFieldCustom => 1344,
13830            Sensors::DataFieldCustomUsage => 1345,
13831            Sensors::DataFieldCustomBooleanArray => 1346,
13832            Sensors::DataFieldCustomValue => 1347,
13833            Sensors::DataFieldCustomValue1 => 1348,
13834            Sensors::DataFieldCustomValue2 => 1349,
13835            Sensors::DataFieldCustomValue3 => 1350,
13836            Sensors::DataFieldCustomValue4 => 1351,
13837            Sensors::DataFieldCustomValue5 => 1352,
13838            Sensors::DataFieldCustomValue6 => 1353,
13839            Sensors::DataFieldCustomValue7 => 1354,
13840            Sensors::DataFieldCustomValue8 => 1355,
13841            Sensors::DataFieldCustomValue9 => 1356,
13842            Sensors::DataFieldCustomValue10 => 1357,
13843            Sensors::DataFieldCustomValue11 => 1358,
13844            Sensors::DataFieldCustomValue12 => 1359,
13845            Sensors::DataFieldCustomValue13 => 1360,
13846            Sensors::DataFieldCustomValue14 => 1361,
13847            Sensors::DataFieldCustomValue15 => 1362,
13848            Sensors::DataFieldCustomValue16 => 1363,
13849            Sensors::DataFieldCustomValue17 => 1364,
13850            Sensors::DataFieldCustomValue18 => 1365,
13851            Sensors::DataFieldCustomValue19 => 1366,
13852            Sensors::DataFieldCustomValue20 => 1367,
13853            Sensors::DataFieldCustomValue21 => 1368,
13854            Sensors::DataFieldCustomValue22 => 1369,
13855            Sensors::DataFieldCustomValue23 => 1370,
13856            Sensors::DataFieldCustomValue24 => 1371,
13857            Sensors::DataFieldCustomValue25 => 1372,
13858            Sensors::DataFieldCustomValue26 => 1373,
13859            Sensors::DataFieldCustomValue27 => 1374,
13860            Sensors::DataFieldCustomValue28 => 1375,
13861            Sensors::DataFieldGeneric => 1376,
13862            Sensors::DataFieldGenericGUIDorPROPERTYKEY => 1377,
13863            Sensors::DataFieldGenericCategoryGUID => 1378,
13864            Sensors::DataFieldGenericTypeGUID => 1379,
13865            Sensors::DataFieldGenericEventPROPERTYKEY => 1380,
13866            Sensors::DataFieldGenericPropertyPROPERTYKEY => 1381,
13867            Sensors::DataFieldGenericDataFieldPROPERTYKEY => 1382,
13868            Sensors::DataFieldGenericEvent => 1383,
13869            Sensors::DataFieldGenericProperty => 1384,
13870            Sensors::DataFieldGenericDataField => 1385,
13871            Sensors::DataFieldEnumeratorTableRowIndex => 1386,
13872            Sensors::DataFieldEnumeratorTableRowCount => 1387,
13873            Sensors::DataFieldGenericGUIDorPROPERTYKEYkind => 1388,
13874            Sensors::DataFieldGenericGUID => 1389,
13875            Sensors::DataFieldGenericPROPERTYKEY => 1390,
13876            Sensors::DataFieldGenericTopLevelCollectionID => 1391,
13877            Sensors::DataFieldGenericReportID => 1392,
13878            Sensors::DataFieldGenericReportItemPositionIndex => 1393,
13879            Sensors::DataFieldGenericFirmwareVARTYPE => 1394,
13880            Sensors::DataFieldGenericUnitofMeasure => 1395,
13881            Sensors::DataFieldGenericUnitExponent => 1396,
13882            Sensors::DataFieldGenericReportSize => 1397,
13883            Sensors::DataFieldGenericReportCount => 1398,
13884            Sensors::PropertyGeneric => 1408,
13885            Sensors::PropertyEnumeratorTableRowIndex => 1409,
13886            Sensors::PropertyEnumeratorTableRowCount => 1410,
13887            Sensors::DataFieldPersonalActivity => 1424,
13888            Sensors::DataFieldActivityType => 1425,
13889            Sensors::DataFieldActivityState => 1426,
13890            Sensors::DataFieldDevicePosition => 1427,
13891            Sensors::DataFieldStepCount => 1428,
13892            Sensors::DataFieldStepCountReset => 1429,
13893            Sensors::DataFieldStepDuration => 1430,
13894            Sensors::DataFieldStepType => 1431,
13895            Sensors::PropertyMinimumActivityDetectionInterval => 1440,
13896            Sensors::PropertySupportedActivityTypes => 1441,
13897            Sensors::PropertySubscribedActivityTypes => 1442,
13898            Sensors::PropertySupportedStepTypes => 1443,
13899            Sensors::PropertySubscribedStepTypes => 1444,
13900            Sensors::PropertyFloorHeight => 1445,
13901            Sensors::DataFieldCustomTypeID => 1456,
13902            Sensors::PropertyCustom => 1472,
13903            Sensors::PropertyCustomValue1 => 1473,
13904            Sensors::PropertyCustomValue2 => 1474,
13905            Sensors::PropertyCustomValue3 => 1475,
13906            Sensors::PropertyCustomValue4 => 1476,
13907            Sensors::PropertyCustomValue5 => 1477,
13908            Sensors::PropertyCustomValue6 => 1478,
13909            Sensors::PropertyCustomValue7 => 1479,
13910            Sensors::PropertyCustomValue8 => 1480,
13911            Sensors::PropertyCustomValue9 => 1481,
13912            Sensors::PropertyCustomValue10 => 1482,
13913            Sensors::PropertyCustomValue11 => 1483,
13914            Sensors::PropertyCustomValue12 => 1484,
13915            Sensors::PropertyCustomValue13 => 1485,
13916            Sensors::PropertyCustomValue14 => 1486,
13917            Sensors::PropertyCustomValue15 => 1487,
13918            Sensors::PropertyCustomValue16 => 1488,
13919            Sensors::DataFieldHinge => 1504,
13920            Sensors::DataFieldHingeAngle => 1505,
13921            Sensors::DataFieldGestureSensor => 1520,
13922            Sensors::DataFieldGestureState => 1521,
13923            Sensors::DataFieldHingeFoldInitialAngle => 1522,
13924            Sensors::DataFieldHingeFoldFinalAngle => 1523,
13925            Sensors::DataFieldHingeFoldContributingPanel => 1524,
13926            Sensors::DataFieldHingeFoldType => 1525,
13927            Sensors::SensorStateUndefined => 2048,
13928            Sensors::SensorStateReady => 2049,
13929            Sensors::SensorStateNotAvailable => 2050,
13930            Sensors::SensorStateNoData => 2051,
13931            Sensors::SensorStateInitializing => 2052,
13932            Sensors::SensorStateAccessDenied => 2053,
13933            Sensors::SensorStateError => 2054,
13934            Sensors::SensorEventUnknown => 2064,
13935            Sensors::SensorEventStateChanged => 2065,
13936            Sensors::SensorEventPropertyChanged => 2066,
13937            Sensors::SensorEventDataUpdated => 2067,
13938            Sensors::SensorEventPollResponse => 2068,
13939            Sensors::SensorEventChangeSensitivity => 2069,
13940            Sensors::SensorEventRangeMaximumReached => 2070,
13941            Sensors::SensorEventRangeMinimumReached => 2071,
13942            Sensors::SensorEventHighThresholdCrossUpward => 2072,
13943            Sensors::SensorEventHighThresholdCrossDownward => 2073,
13944            Sensors::SensorEventLowThresholdCrossUpward => 2074,
13945            Sensors::SensorEventLowThresholdCrossDownward => 2075,
13946            Sensors::SensorEventZeroThresholdCrossUpward => 2076,
13947            Sensors::SensorEventZeroThresholdCrossDownward => 2077,
13948            Sensors::SensorEventPeriodExceeded => 2078,
13949            Sensors::SensorEventFrequencyExceeded => 2079,
13950            Sensors::SensorEventComplexTrigger => 2080,
13951            Sensors::ConnectionTypePCIntegrated => 2096,
13952            Sensors::ConnectionTypePCAttached => 2097,
13953            Sensors::ConnectionTypePCExternal => 2098,
13954            Sensors::ReportingStateReportNoEvents => 2112,
13955            Sensors::ReportingStateReportAllEvents => 2113,
13956            Sensors::ReportingStateReportThresholdEvents => 2114,
13957            Sensors::ReportingStateWakeOnNoEvents => 2115,
13958            Sensors::ReportingStateWakeOnAllEvents => 2116,
13959            Sensors::ReportingStateWakeOnThresholdEvents => 2117,
13960            Sensors::ReportingStateAnytime => 2118,
13961            Sensors::PowerStateUndefined => 2128,
13962            Sensors::PowerStateD0FullPower => 2129,
13963            Sensors::PowerStateD1LowPower => 2130,
13964            Sensors::PowerStateD2StandbyPowerwithWakeup => 2131,
13965            Sensors::PowerStateD3SleepwithWakeup => 2132,
13966            Sensors::PowerStateD4PowerOff => 2133,
13967            Sensors::AccuracyDefault => 2144,
13968            Sensors::AccuracyHigh => 2145,
13969            Sensors::AccuracyMedium => 2146,
13970            Sensors::AccuracyLow => 2147,
13971            Sensors::FixQualityNoFix => 2160,
13972            Sensors::FixQualityGPS => 2161,
13973            Sensors::FixQualityDGPS => 2162,
13974            Sensors::FixTypeNoFix => 2176,
13975            Sensors::FixTypeGPSSPSModeFixValid => 2177,
13976            Sensors::FixTypeDGPSSPSModeFixValid => 2178,
13977            Sensors::FixTypeGPSPPSModeFixValid => 2179,
13978            Sensors::FixTypeRealTimeKinematic => 2180,
13979            Sensors::FixTypeFloatRTK => 2181,
13980            Sensors::FixTypeEstimateddeadreckoned => 2182,
13981            Sensors::FixTypeManualInputMode => 2183,
13982            Sensors::FixTypeSimulatorMode => 2184,
13983            Sensors::GPSOperationModeManual => 2192,
13984            Sensors::GPSOperationModeAutomatic => 2193,
13985            Sensors::GPSSelectionModeAutonomous => 2208,
13986            Sensors::GPSSelectionModeDGPS => 2209,
13987            Sensors::GPSSelectionModeEstimateddeadreckoned => 2210,
13988            Sensors::GPSSelectionModeManualInput => 2211,
13989            Sensors::GPSSelectionModeSimulator => 2212,
13990            Sensors::GPSSelectionModeDataNotValid => 2213,
13991            Sensors::GPSStatusDataValid => 2224,
13992            Sensors::GPSStatusDataNotValid => 2225,
13993            Sensors::DayofWeekSunday => 2240,
13994            Sensors::DayofWeekMonday => 2241,
13995            Sensors::DayofWeekTuesday => 2242,
13996            Sensors::DayofWeekWednesday => 2243,
13997            Sensors::DayofWeekThursday => 2244,
13998            Sensors::DayofWeekFriday => 2245,
13999            Sensors::DayofWeekSaturday => 2246,
14000            Sensors::KindCategory => 2256,
14001            Sensors::KindType => 2257,
14002            Sensors::KindEvent => 2258,
14003            Sensors::KindProperty => 2259,
14004            Sensors::KindDataField => 2260,
14005            Sensors::MagnetometerAccuracyLow => 2272,
14006            Sensors::MagnetometerAccuracyMedium => 2273,
14007            Sensors::MagnetometerAccuracyHigh => 2274,
14008            Sensors::SimpleOrientationDirectionNotRotated => 2288,
14009            Sensors::SimpleOrientationDirectionRotated90DegreesCCW => 2289,
14010            Sensors::SimpleOrientationDirectionRotated180DegreesCCW => 2290,
14011            Sensors::SimpleOrientationDirectionRotated270DegreesCCW => 2291,
14012            Sensors::SimpleOrientationDirectionFaceUp => 2292,
14013            Sensors::SimpleOrientationDirectionFaceDown => 2293,
14014            Sensors::VT_NULL => 2304,
14015            Sensors::VT_BOOL => 2305,
14016            Sensors::VT_UI1 => 2306,
14017            Sensors::VT_I1 => 2307,
14018            Sensors::VT_UI2 => 2308,
14019            Sensors::VT_I2 => 2309,
14020            Sensors::VT_UI4 => 2310,
14021            Sensors::VT_I4 => 2311,
14022            Sensors::VT_UI8 => 2312,
14023            Sensors::VT_I8 => 2313,
14024            Sensors::VT_R4 => 2314,
14025            Sensors::VT_R8 => 2315,
14026            Sensors::VT_WSTR => 2316,
14027            Sensors::VT_STR => 2317,
14028            Sensors::VT_CLSID => 2318,
14029            Sensors::VT_VECTORVT_UI1 => 2319,
14030            Sensors::VT_F16E0 => 2320,
14031            Sensors::VT_F16E1 => 2321,
14032            Sensors::VT_F16E2 => 2322,
14033            Sensors::VT_F16E3 => 2323,
14034            Sensors::VT_F16E4 => 2324,
14035            Sensors::VT_F16E5 => 2325,
14036            Sensors::VT_F16E6 => 2326,
14037            Sensors::VT_F16E7 => 2327,
14038            Sensors::VT_F16E8 => 2328,
14039            Sensors::VT_F16E9 => 2329,
14040            Sensors::VT_F16EA => 2330,
14041            Sensors::VT_F16EB => 2331,
14042            Sensors::VT_F16EC => 2332,
14043            Sensors::VT_F16ED => 2333,
14044            Sensors::VT_F16EE => 2334,
14045            Sensors::VT_F16EF => 2335,
14046            Sensors::VT_F32E0 => 2336,
14047            Sensors::VT_F32E1 => 2337,
14048            Sensors::VT_F32E2 => 2338,
14049            Sensors::VT_F32E3 => 2339,
14050            Sensors::VT_F32E4 => 2340,
14051            Sensors::VT_F32E5 => 2341,
14052            Sensors::VT_F32E6 => 2342,
14053            Sensors::VT_F32E7 => 2343,
14054            Sensors::VT_F32E8 => 2344,
14055            Sensors::VT_F32E9 => 2345,
14056            Sensors::VT_F32EA => 2346,
14057            Sensors::VT_F32EB => 2347,
14058            Sensors::VT_F32EC => 2348,
14059            Sensors::VT_F32ED => 2349,
14060            Sensors::VT_F32EE => 2350,
14061            Sensors::VT_F32EF => 2351,
14062            Sensors::ActivityTypeUnknown => 2352,
14063            Sensors::ActivityTypeStationary => 2353,
14064            Sensors::ActivityTypeFidgeting => 2354,
14065            Sensors::ActivityTypeWalking => 2355,
14066            Sensors::ActivityTypeRunning => 2356,
14067            Sensors::ActivityTypeInVehicle => 2357,
14068            Sensors::ActivityTypeBiking => 2358,
14069            Sensors::ActivityTypeIdle => 2359,
14070            Sensors::UnitNotSpecified => 2368,
14071            Sensors::UnitLux => 2369,
14072            Sensors::UnitDegreesKelvin => 2370,
14073            Sensors::UnitDegreesCelsius => 2371,
14074            Sensors::UnitPascal => 2372,
14075            Sensors::UnitNewton => 2373,
14076            Sensors::UnitMetersSecond => 2374,
14077            Sensors::UnitKilogram => 2375,
14078            Sensors::UnitMeter => 2376,
14079            Sensors::UnitMetersSecondSecond => 2377,
14080            Sensors::UnitFarad => 2378,
14081            Sensors::UnitAmpere => 2379,
14082            Sensors::UnitWatt => 2380,
14083            Sensors::UnitHenry => 2381,
14084            Sensors::UnitOhm => 2382,
14085            Sensors::UnitVolt => 2383,
14086            Sensors::UnitHertz => 2384,
14087            Sensors::UnitBar => 2385,
14088            Sensors::UnitDegreesAnticlockwise => 2386,
14089            Sensors::UnitDegreesClockwise => 2387,
14090            Sensors::UnitDegrees => 2388,
14091            Sensors::UnitDegreesSecond => 2389,
14092            Sensors::UnitDegreesSecondSecond => 2390,
14093            Sensors::UnitKnot => 2391,
14094            Sensors::UnitPercent => 2392,
14095            Sensors::UnitSecond => 2393,
14096            Sensors::UnitMillisecond => 2394,
14097            Sensors::UnitG => 2395,
14098            Sensors::UnitBytes => 2396,
14099            Sensors::UnitMilligauss => 2397,
14100            Sensors::UnitBits => 2398,
14101            Sensors::ActivityStateNoStateChange => 2400,
14102            Sensors::ActivityStateStartActivity => 2401,
14103            Sensors::ActivityStateEndActivity => 2402,
14104            Sensors::Exponent0 => 2416,
14105            Sensors::Exponent1 => 2417,
14106            Sensors::Exponent2 => 2418,
14107            Sensors::Exponent3 => 2419,
14108            Sensors::Exponent4 => 2420,
14109            Sensors::Exponent5 => 2421,
14110            Sensors::Exponent6 => 2422,
14111            Sensors::Exponent7 => 2423,
14112            Sensors::Exponent8 => 2424,
14113            Sensors::Exponent9 => 2425,
14114            Sensors::ExponentA => 2426,
14115            Sensors::ExponentB => 2427,
14116            Sensors::ExponentC => 2428,
14117            Sensors::ExponentD => 2429,
14118            Sensors::ExponentE => 2430,
14119            Sensors::ExponentF => 2431,
14120            Sensors::DevicePositionUnknown => 2432,
14121            Sensors::DevicePositionUnchanged => 2433,
14122            Sensors::DevicePositionOnDesk => 2434,
14123            Sensors::DevicePositionInHand => 2435,
14124            Sensors::DevicePositionMovinginBag => 2436,
14125            Sensors::DevicePositionStationaryinBag => 2437,
14126            Sensors::StepTypeUnknown => 2448,
14127            Sensors::StepTypeWalking => 2449,
14128            Sensors::StepTypeRunning => 2450,
14129            Sensors::GestureStateUnknown => 2464,
14130            Sensors::GestureStateStarted => 2465,
14131            Sensors::GestureStateCompleted => 2466,
14132            Sensors::GestureStateCancelled => 2467,
14133            Sensors::HingeFoldContributingPanelUnknown => 2480,
14134            Sensors::HingeFoldContributingPanelPanel1 => 2481,
14135            Sensors::HingeFoldContributingPanelPanel2 => 2482,
14136            Sensors::HingeFoldContributingPanelBoth => 2483,
14137            Sensors::HingeFoldTypeUnknown => 2484,
14138            Sensors::HingeFoldTypeIncreasing => 2485,
14139            Sensors::HingeFoldTypeDecreasing => 2486,
14140            Sensors::HumanPresenceDetectionTypeVendorDefinedNonBiometric => 2496,
14141            Sensors::HumanPresenceDetectionTypeVendorDefinedBiometric => 2497,
14142            Sensors::HumanPresenceDetectionTypeFacialBiometric => 2498,
14143            Sensors::HumanPresenceDetectionTypeAudioBiometric => 2499,
14144            Sensors::ModifierChangeSensitivityAbsolute => 4096,
14145            Sensors::ModifierMaximum => 8192,
14146            Sensors::ModifierMinimum => 12288,
14147            Sensors::ModifierAccuracy => 16384,
14148            Sensors::ModifierResolution => 20480,
14149            Sensors::ModifierThresholdHigh => 24576,
14150            Sensors::ModifierThresholdLow => 28672,
14151            Sensors::ModifierCalibrationOffset => 32768,
14152            Sensors::ModifierCalibrationMultiplier => 36864,
14153            Sensors::ModifierReportInterval => 40960,
14154            Sensors::ModifierFrequencyMax => 45056,
14155            Sensors::ModifierPeriodMax => 49152,
14156            Sensors::ModifierChangeSensitivityPercentofRange => 53248,
14157            Sensors::ModifierChangeSensitivityPercentRelative => 57344,
14158            Sensors::ModifierVendorReserved => 61440,
14159        }
14160    }
14161}
14162
14163impl From<Sensors> for u16 {
14164    /// Returns the 16bit value of this usage. This is identical
14165    /// to [Sensors::usage_page_value()].
14166    fn from(sensors: Sensors) -> u16 {
14167        u16::from(&sensors)
14168    }
14169}
14170
14171impl From<&Sensors> for u32 {
14172    /// Returns the 32 bit value of this usage. This is identical
14173    /// to [Sensors::usage_value()].
14174    fn from(sensors: &Sensors) -> u32 {
14175        let up = UsagePage::from(sensors);
14176        let up = (u16::from(&up) as u32) << 16;
14177        let id = u16::from(sensors) as u32;
14178        up | id
14179    }
14180}
14181
14182impl From<&Sensors> for UsagePage {
14183    /// Always returns [UsagePage::Sensors] and is
14184    /// identical to [Sensors::usage_page()].
14185    fn from(_: &Sensors) -> UsagePage {
14186        UsagePage::Sensors
14187    }
14188}
14189
14190impl From<Sensors> for UsagePage {
14191    /// Always returns [UsagePage::Sensors] and is
14192    /// identical to [Sensors::usage_page()].
14193    fn from(_: Sensors) -> UsagePage {
14194        UsagePage::Sensors
14195    }
14196}
14197
14198impl From<&Sensors> for Usage {
14199    fn from(sensors: &Sensors) -> Usage {
14200        Usage::try_from(u32::from(sensors)).unwrap()
14201    }
14202}
14203
14204impl From<Sensors> for Usage {
14205    fn from(sensors: Sensors) -> Usage {
14206        Usage::from(&sensors)
14207    }
14208}
14209
14210impl TryFrom<u16> for Sensors {
14211    type Error = HutError;
14212
14213    fn try_from(usage_id: u16) -> Result<Sensors> {
14214        match usage_id {
14215            1 => Ok(Sensors::Sensor),
14216            16 => Ok(Sensors::Biometric),
14217            17 => Ok(Sensors::BiometricHumanPresence),
14218            18 => Ok(Sensors::BiometricHumanProximity),
14219            19 => Ok(Sensors::BiometricHumanTouch),
14220            20 => Ok(Sensors::BiometricBloodPressure),
14221            21 => Ok(Sensors::BiometricBodyTemperature),
14222            22 => Ok(Sensors::BiometricHeartRate),
14223            23 => Ok(Sensors::BiometricHeartRateVariability),
14224            24 => Ok(Sensors::BiometricPeripheralOxygenSaturation),
14225            25 => Ok(Sensors::BiometricRespiratoryRate),
14226            32 => Ok(Sensors::Electrical),
14227            33 => Ok(Sensors::ElectricalCapacitance),
14228            34 => Ok(Sensors::ElectricalCurrent),
14229            35 => Ok(Sensors::ElectricalPower),
14230            36 => Ok(Sensors::ElectricalInductance),
14231            37 => Ok(Sensors::ElectricalResistance),
14232            38 => Ok(Sensors::ElectricalVoltage),
14233            39 => Ok(Sensors::ElectricalPotentiometer),
14234            40 => Ok(Sensors::ElectricalFrequency),
14235            41 => Ok(Sensors::ElectricalPeriod),
14236            48 => Ok(Sensors::Environmental),
14237            49 => Ok(Sensors::EnvironmentalAtmosphericPressure),
14238            50 => Ok(Sensors::EnvironmentalHumidity),
14239            51 => Ok(Sensors::EnvironmentalTemperature),
14240            52 => Ok(Sensors::EnvironmentalWindDirection),
14241            53 => Ok(Sensors::EnvironmentalWindSpeed),
14242            54 => Ok(Sensors::EnvironmentalAirQuality),
14243            55 => Ok(Sensors::EnvironmentalHeatIndex),
14244            56 => Ok(Sensors::EnvironmentalSurfaceTemperature),
14245            57 => Ok(Sensors::EnvironmentalVolatileOrganicCompounds),
14246            58 => Ok(Sensors::EnvironmentalObjectPresence),
14247            59 => Ok(Sensors::EnvironmentalObjectProximity),
14248            64 => Ok(Sensors::Light),
14249            65 => Ok(Sensors::LightAmbientLight),
14250            66 => Ok(Sensors::LightConsumerInfrared),
14251            67 => Ok(Sensors::LightInfraredLight),
14252            68 => Ok(Sensors::LightVisibleLight),
14253            69 => Ok(Sensors::LightUltravioletLight),
14254            80 => Ok(Sensors::Location),
14255            81 => Ok(Sensors::LocationBroadcast),
14256            82 => Ok(Sensors::LocationDeadReckoning),
14257            83 => Ok(Sensors::LocationGPSGlobalPositioningSystem),
14258            84 => Ok(Sensors::LocationLookup),
14259            85 => Ok(Sensors::LocationOther),
14260            86 => Ok(Sensors::LocationStatic),
14261            87 => Ok(Sensors::LocationTriangulation),
14262            96 => Ok(Sensors::Mechanical),
14263            97 => Ok(Sensors::MechanicalBooleanSwitch),
14264            98 => Ok(Sensors::MechanicalBooleanSwitchArray),
14265            99 => Ok(Sensors::MechanicalMultivalueSwitch),
14266            100 => Ok(Sensors::MechanicalForce),
14267            101 => Ok(Sensors::MechanicalPressure),
14268            102 => Ok(Sensors::MechanicalStrain),
14269            103 => Ok(Sensors::MechanicalWeight),
14270            104 => Ok(Sensors::MechanicalHapticVibrator),
14271            105 => Ok(Sensors::MechanicalHallEffectSwitch),
14272            112 => Ok(Sensors::Motion),
14273            113 => Ok(Sensors::MotionAccelerometer1D),
14274            114 => Ok(Sensors::MotionAccelerometer2D),
14275            115 => Ok(Sensors::MotionAccelerometer3D),
14276            116 => Ok(Sensors::MotionGyrometer1D),
14277            117 => Ok(Sensors::MotionGyrometer2D),
14278            118 => Ok(Sensors::MotionGyrometer3D),
14279            119 => Ok(Sensors::MotionMotionDetector),
14280            120 => Ok(Sensors::MotionSpeedometer),
14281            121 => Ok(Sensors::MotionAccelerometer),
14282            122 => Ok(Sensors::MotionGyrometer),
14283            123 => Ok(Sensors::MotionGravityVector),
14284            124 => Ok(Sensors::MotionLinearAccelerometer),
14285            128 => Ok(Sensors::Orientation),
14286            129 => Ok(Sensors::OrientationCompass1D),
14287            130 => Ok(Sensors::OrientationCompass2D),
14288            131 => Ok(Sensors::OrientationCompass3D),
14289            132 => Ok(Sensors::OrientationInclinometer1D),
14290            133 => Ok(Sensors::OrientationInclinometer2D),
14291            134 => Ok(Sensors::OrientationInclinometer3D),
14292            135 => Ok(Sensors::OrientationDistance1D),
14293            136 => Ok(Sensors::OrientationDistance2D),
14294            137 => Ok(Sensors::OrientationDistance3D),
14295            138 => Ok(Sensors::OrientationDeviceOrientation),
14296            139 => Ok(Sensors::OrientationCompass),
14297            140 => Ok(Sensors::OrientationInclinometer),
14298            141 => Ok(Sensors::OrientationDistance),
14299            142 => Ok(Sensors::OrientationRelativeOrientation),
14300            143 => Ok(Sensors::OrientationSimpleOrientation),
14301            144 => Ok(Sensors::Scanner),
14302            145 => Ok(Sensors::ScannerBarcode),
14303            146 => Ok(Sensors::ScannerRFID),
14304            147 => Ok(Sensors::ScannerNFC),
14305            160 => Ok(Sensors::Time),
14306            161 => Ok(Sensors::TimeAlarmTimer),
14307            162 => Ok(Sensors::TimeRealTimeClock),
14308            176 => Ok(Sensors::PersonalActivity),
14309            177 => Ok(Sensors::PersonalActivityActivityDetection),
14310            178 => Ok(Sensors::PersonalActivityDevicePosition),
14311            179 => Ok(Sensors::PersonalActivityFloorTracker),
14312            180 => Ok(Sensors::PersonalActivityPedometer),
14313            181 => Ok(Sensors::PersonalActivityStepDetection),
14314            192 => Ok(Sensors::OrientationExtended),
14315            193 => Ok(Sensors::OrientationExtendedGeomagneticOrientation),
14316            194 => Ok(Sensors::OrientationExtendedMagnetometer),
14317            208 => Ok(Sensors::Gesture),
14318            209 => Ok(Sensors::GestureChassisFlipGesture),
14319            210 => Ok(Sensors::GestureHingeFoldGesture),
14320            224 => Ok(Sensors::Other),
14321            225 => Ok(Sensors::OtherCustom),
14322            226 => Ok(Sensors::OtherGeneric),
14323            227 => Ok(Sensors::OtherGenericEnumerator),
14324            228 => Ok(Sensors::OtherHingeAngle),
14325            240 => Ok(Sensors::VendorReserved1),
14326            241 => Ok(Sensors::VendorReserved2),
14327            242 => Ok(Sensors::VendorReserved3),
14328            243 => Ok(Sensors::VendorReserved4),
14329            244 => Ok(Sensors::VendorReserved5),
14330            245 => Ok(Sensors::VendorReserved6),
14331            246 => Ok(Sensors::VendorReserved7),
14332            247 => Ok(Sensors::VendorReserved8),
14333            248 => Ok(Sensors::VendorReserved9),
14334            249 => Ok(Sensors::VendorReserved10),
14335            250 => Ok(Sensors::VendorReserved11),
14336            251 => Ok(Sensors::VendorReserved12),
14337            252 => Ok(Sensors::VendorReserved13),
14338            253 => Ok(Sensors::VendorReserved14),
14339            254 => Ok(Sensors::VendorReserved15),
14340            255 => Ok(Sensors::VendorReserved16),
14341            512 => Ok(Sensors::Event),
14342            513 => Ok(Sensors::EventSensorState),
14343            514 => Ok(Sensors::EventSensorEvent),
14344            768 => Ok(Sensors::Property),
14345            769 => Ok(Sensors::PropertyFriendlyName),
14346            770 => Ok(Sensors::PropertyPersistentUniqueID),
14347            771 => Ok(Sensors::PropertySensorStatus),
14348            772 => Ok(Sensors::PropertyMinimumReportInterval),
14349            773 => Ok(Sensors::PropertySensorManufacturer),
14350            774 => Ok(Sensors::PropertySensorModel),
14351            775 => Ok(Sensors::PropertySensorSerialNumber),
14352            776 => Ok(Sensors::PropertySensorDescription),
14353            777 => Ok(Sensors::PropertySensorConnectionType),
14354            778 => Ok(Sensors::PropertySensorDevicePath),
14355            779 => Ok(Sensors::PropertyHardwareRevision),
14356            780 => Ok(Sensors::PropertyFirmwareVersion),
14357            781 => Ok(Sensors::PropertyReleaseDate),
14358            782 => Ok(Sensors::PropertyReportInterval),
14359            783 => Ok(Sensors::PropertyChangeSensitivityAbsolute),
14360            784 => Ok(Sensors::PropertyChangeSensitivityPercentofRange),
14361            785 => Ok(Sensors::PropertyChangeSensitivityPercentRelative),
14362            786 => Ok(Sensors::PropertyAccuracy),
14363            787 => Ok(Sensors::PropertyResolution),
14364            788 => Ok(Sensors::PropertyMaximum),
14365            789 => Ok(Sensors::PropertyMinimum),
14366            790 => Ok(Sensors::PropertyReportingState),
14367            791 => Ok(Sensors::PropertySamplingRate),
14368            792 => Ok(Sensors::PropertyResponseCurve),
14369            793 => Ok(Sensors::PropertyPowerState),
14370            794 => Ok(Sensors::PropertyMaximumFIFOEvents),
14371            795 => Ok(Sensors::PropertyReportLatency),
14372            796 => Ok(Sensors::PropertyFlushFIFOEvents),
14373            797 => Ok(Sensors::PropertyMaximumPowerConsumption),
14374            798 => Ok(Sensors::PropertyIsPrimary),
14375            799 => Ok(Sensors::PropertyHumanPresenceDetectionType),
14376            1024 => Ok(Sensors::DataFieldLocation),
14377            1026 => Ok(Sensors::DataFieldAltitudeAntennaSeaLevel),
14378            1027 => Ok(Sensors::DataFieldDifferentialReferenceStationID),
14379            1028 => Ok(Sensors::DataFieldAltitudeEllipsoidError),
14380            1029 => Ok(Sensors::DataFieldAltitudeEllipsoid),
14381            1030 => Ok(Sensors::DataFieldAltitudeSeaLevelError),
14382            1031 => Ok(Sensors::DataFieldAltitudeSeaLevel),
14383            1032 => Ok(Sensors::DataFieldDifferentialGPSDataAge),
14384            1033 => Ok(Sensors::DataFieldErrorRadius),
14385            1034 => Ok(Sensors::DataFieldFixQuality),
14386            1035 => Ok(Sensors::DataFieldFixType),
14387            1036 => Ok(Sensors::DataFieldGeoidalSeparation),
14388            1037 => Ok(Sensors::DataFieldGPSOperationMode),
14389            1038 => Ok(Sensors::DataFieldGPSSelectionMode),
14390            1039 => Ok(Sensors::DataFieldGPSStatus),
14391            1040 => Ok(Sensors::DataFieldPositionDilutionofPrecision),
14392            1041 => Ok(Sensors::DataFieldHorizontalDilutionofPrecision),
14393            1042 => Ok(Sensors::DataFieldVerticalDilutionofPrecision),
14394            1043 => Ok(Sensors::DataFieldLatitude),
14395            1044 => Ok(Sensors::DataFieldLongitude),
14396            1045 => Ok(Sensors::DataFieldTrueHeading),
14397            1046 => Ok(Sensors::DataFieldMagneticHeading),
14398            1047 => Ok(Sensors::DataFieldMagneticVariation),
14399            1048 => Ok(Sensors::DataFieldSpeed),
14400            1049 => Ok(Sensors::DataFieldSatellitesinView),
14401            1050 => Ok(Sensors::DataFieldSatellitesinViewAzimuth),
14402            1051 => Ok(Sensors::DataFieldSatellitesinViewElevation),
14403            1052 => Ok(Sensors::DataFieldSatellitesinViewIDs),
14404            1053 => Ok(Sensors::DataFieldSatellitesinViewPRNs),
14405            1054 => Ok(Sensors::DataFieldSatellitesinViewSNRatios),
14406            1055 => Ok(Sensors::DataFieldSatellitesUsedCount),
14407            1056 => Ok(Sensors::DataFieldSatellitesUsedPRNs),
14408            1057 => Ok(Sensors::DataFieldNMEASentence),
14409            1058 => Ok(Sensors::DataFieldAddressLine1),
14410            1059 => Ok(Sensors::DataFieldAddressLine2),
14411            1060 => Ok(Sensors::DataFieldCity),
14412            1061 => Ok(Sensors::DataFieldStateorProvince),
14413            1062 => Ok(Sensors::DataFieldCountryorRegion),
14414            1063 => Ok(Sensors::DataFieldPostalCode),
14415            1066 => Ok(Sensors::PropertyLocation),
14416            1067 => Ok(Sensors::PropertyLocationDesiredAccuracy),
14417            1072 => Ok(Sensors::DataFieldEnvironmental),
14418            1073 => Ok(Sensors::DataFieldAtmosphericPressure),
14419            1075 => Ok(Sensors::DataFieldRelativeHumidity),
14420            1076 => Ok(Sensors::DataFieldTemperature),
14421            1077 => Ok(Sensors::DataFieldWindDirection),
14422            1078 => Ok(Sensors::DataFieldWindSpeed),
14423            1079 => Ok(Sensors::DataFieldAirQualityIndex),
14424            1080 => Ok(Sensors::DataFieldEquivalentCO2),
14425            1081 => Ok(Sensors::DataFieldVolatileOrganicCompoundConcentration),
14426            1082 => Ok(Sensors::DataFieldObjectPresence),
14427            1083 => Ok(Sensors::DataFieldObjectProximityRange),
14428            1084 => Ok(Sensors::DataFieldObjectProximityOutofRange),
14429            1088 => Ok(Sensors::PropertyEnvironmental),
14430            1089 => Ok(Sensors::PropertyReferencePressure),
14431            1104 => Ok(Sensors::DataFieldMotion),
14432            1105 => Ok(Sensors::DataFieldMotionState),
14433            1106 => Ok(Sensors::DataFieldAcceleration),
14434            1107 => Ok(Sensors::DataFieldAccelerationAxisX),
14435            1108 => Ok(Sensors::DataFieldAccelerationAxisY),
14436            1109 => Ok(Sensors::DataFieldAccelerationAxisZ),
14437            1110 => Ok(Sensors::DataFieldAngularVelocity),
14438            1111 => Ok(Sensors::DataFieldAngularVelocityaboutXAxis),
14439            1112 => Ok(Sensors::DataFieldAngularVelocityaboutYAxis),
14440            1113 => Ok(Sensors::DataFieldAngularVelocityaboutZAxis),
14441            1114 => Ok(Sensors::DataFieldAngularPosition),
14442            1115 => Ok(Sensors::DataFieldAngularPositionaboutXAxis),
14443            1116 => Ok(Sensors::DataFieldAngularPositionaboutYAxis),
14444            1117 => Ok(Sensors::DataFieldAngularPositionaboutZAxis),
14445            1118 => Ok(Sensors::DataFieldMotionSpeed),
14446            1119 => Ok(Sensors::DataFieldMotionIntensity),
14447            1136 => Ok(Sensors::DataFieldOrientation),
14448            1137 => Ok(Sensors::DataFieldHeading),
14449            1138 => Ok(Sensors::DataFieldHeadingXAxis),
14450            1139 => Ok(Sensors::DataFieldHeadingYAxis),
14451            1140 => Ok(Sensors::DataFieldHeadingZAxis),
14452            1141 => Ok(Sensors::DataFieldHeadingCompensatedMagneticNorth),
14453            1142 => Ok(Sensors::DataFieldHeadingCompensatedTrueNorth),
14454            1143 => Ok(Sensors::DataFieldHeadingMagneticNorth),
14455            1144 => Ok(Sensors::DataFieldHeadingTrueNorth),
14456            1145 => Ok(Sensors::DataFieldDistance),
14457            1146 => Ok(Sensors::DataFieldDistanceXAxis),
14458            1147 => Ok(Sensors::DataFieldDistanceYAxis),
14459            1148 => Ok(Sensors::DataFieldDistanceZAxis),
14460            1149 => Ok(Sensors::DataFieldDistanceOutofRange),
14461            1150 => Ok(Sensors::DataFieldTilt),
14462            1151 => Ok(Sensors::DataFieldTiltXAxis),
14463            1152 => Ok(Sensors::DataFieldTiltYAxis),
14464            1153 => Ok(Sensors::DataFieldTiltZAxis),
14465            1154 => Ok(Sensors::DataFieldRotationMatrix),
14466            1155 => Ok(Sensors::DataFieldQuaternion),
14467            1156 => Ok(Sensors::DataFieldMagneticFlux),
14468            1157 => Ok(Sensors::DataFieldMagneticFluxXAxis),
14469            1158 => Ok(Sensors::DataFieldMagneticFluxYAxis),
14470            1159 => Ok(Sensors::DataFieldMagneticFluxZAxis),
14471            1160 => Ok(Sensors::DataFieldMagnetometerAccuracy),
14472            1161 => Ok(Sensors::DataFieldSimpleOrientationDirection),
14473            1168 => Ok(Sensors::DataFieldMechanical),
14474            1169 => Ok(Sensors::DataFieldBooleanSwitchState),
14475            1170 => Ok(Sensors::DataFieldBooleanSwitchArrayStates),
14476            1171 => Ok(Sensors::DataFieldMultivalueSwitchValue),
14477            1172 => Ok(Sensors::DataFieldForce),
14478            1173 => Ok(Sensors::DataFieldAbsolutePressure),
14479            1174 => Ok(Sensors::DataFieldGaugePressure),
14480            1175 => Ok(Sensors::DataFieldStrain),
14481            1176 => Ok(Sensors::DataFieldWeight),
14482            1184 => Ok(Sensors::PropertyMechanical),
14483            1185 => Ok(Sensors::PropertyVibrationState),
14484            1186 => Ok(Sensors::PropertyForwardVibrationSpeed),
14485            1187 => Ok(Sensors::PropertyBackwardVibrationSpeed),
14486            1200 => Ok(Sensors::DataFieldBiometric),
14487            1201 => Ok(Sensors::DataFieldHumanPresence),
14488            1202 => Ok(Sensors::DataFieldHumanProximityRange),
14489            1203 => Ok(Sensors::DataFieldHumanProximityOutofRange),
14490            1204 => Ok(Sensors::DataFieldHumanTouchState),
14491            1205 => Ok(Sensors::DataFieldBloodPressure),
14492            1206 => Ok(Sensors::DataFieldBloodPressureDiastolic),
14493            1207 => Ok(Sensors::DataFieldBloodPressureSystolic),
14494            1208 => Ok(Sensors::DataFieldHeartRate),
14495            1209 => Ok(Sensors::DataFieldRestingHeartRate),
14496            1210 => Ok(Sensors::DataFieldHeartbeatInterval),
14497            1211 => Ok(Sensors::DataFieldRespiratoryRate),
14498            1212 => Ok(Sensors::DataFieldSpO2),
14499            1213 => Ok(Sensors::DataFieldHumanAttentionDetected),
14500            1214 => Ok(Sensors::DataFieldHumanHeadAzimuth),
14501            1215 => Ok(Sensors::DataFieldHumanHeadAltitude),
14502            1216 => Ok(Sensors::DataFieldHumanHeadRoll),
14503            1217 => Ok(Sensors::DataFieldHumanHeadPitch),
14504            1218 => Ok(Sensors::DataFieldHumanHeadYaw),
14505            1219 => Ok(Sensors::DataFieldHumanCorrelationId),
14506            1232 => Ok(Sensors::DataFieldLight),
14507            1233 => Ok(Sensors::DataFieldIlluminance),
14508            1234 => Ok(Sensors::DataFieldColorTemperature),
14509            1235 => Ok(Sensors::DataFieldChromaticity),
14510            1236 => Ok(Sensors::DataFieldChromaticityX),
14511            1237 => Ok(Sensors::DataFieldChromaticityY),
14512            1238 => Ok(Sensors::DataFieldConsumerIRSentenceReceive),
14513            1239 => Ok(Sensors::DataFieldInfraredLight),
14514            1240 => Ok(Sensors::DataFieldRedLight),
14515            1241 => Ok(Sensors::DataFieldGreenLight),
14516            1242 => Ok(Sensors::DataFieldBlueLight),
14517            1243 => Ok(Sensors::DataFieldUltravioletALight),
14518            1244 => Ok(Sensors::DataFieldUltravioletBLight),
14519            1245 => Ok(Sensors::DataFieldUltravioletIndex),
14520            1246 => Ok(Sensors::DataFieldNearInfraredLight),
14521            1247 => Ok(Sensors::PropertyLight),
14522            1248 => Ok(Sensors::PropertyConsumerIRSentenceSend),
14523            1250 => Ok(Sensors::PropertyAutoBrightnessPreferred),
14524            1251 => Ok(Sensors::PropertyAutoColorPreferred),
14525            1264 => Ok(Sensors::DataFieldScanner),
14526            1265 => Ok(Sensors::DataFieldRFIDTag40Bit),
14527            1266 => Ok(Sensors::DataFieldNFCSentenceReceive),
14528            1272 => Ok(Sensors::PropertyScanner),
14529            1273 => Ok(Sensors::PropertyNFCSentenceSend),
14530            1280 => Ok(Sensors::DataFieldElectrical),
14531            1281 => Ok(Sensors::DataFieldCapacitance),
14532            1282 => Ok(Sensors::DataFieldCurrent),
14533            1283 => Ok(Sensors::DataFieldElectricalPower),
14534            1284 => Ok(Sensors::DataFieldInductance),
14535            1285 => Ok(Sensors::DataFieldResistance),
14536            1286 => Ok(Sensors::DataFieldVoltage),
14537            1287 => Ok(Sensors::DataFieldFrequency),
14538            1288 => Ok(Sensors::DataFieldPeriod),
14539            1289 => Ok(Sensors::DataFieldPercentofRange),
14540            1312 => Ok(Sensors::DataFieldTime),
14541            1313 => Ok(Sensors::DataFieldYear),
14542            1314 => Ok(Sensors::DataFieldMonth),
14543            1315 => Ok(Sensors::DataFieldDay),
14544            1316 => Ok(Sensors::DataFieldDayofWeek),
14545            1317 => Ok(Sensors::DataFieldHour),
14546            1318 => Ok(Sensors::DataFieldMinute),
14547            1319 => Ok(Sensors::DataFieldSecond),
14548            1320 => Ok(Sensors::DataFieldMillisecond),
14549            1321 => Ok(Sensors::DataFieldTimestamp),
14550            1322 => Ok(Sensors::DataFieldJulianDayofYear),
14551            1323 => Ok(Sensors::DataFieldTimeSinceSystemBoot),
14552            1328 => Ok(Sensors::PropertyTime),
14553            1329 => Ok(Sensors::PropertyTimeZoneOffsetfromUTC),
14554            1330 => Ok(Sensors::PropertyTimeZoneName),
14555            1331 => Ok(Sensors::PropertyDaylightSavingsTimeObserved),
14556            1332 => Ok(Sensors::PropertyTimeTrimAdjustment),
14557            1333 => Ok(Sensors::PropertyArmAlarm),
14558            1344 => Ok(Sensors::DataFieldCustom),
14559            1345 => Ok(Sensors::DataFieldCustomUsage),
14560            1346 => Ok(Sensors::DataFieldCustomBooleanArray),
14561            1347 => Ok(Sensors::DataFieldCustomValue),
14562            1348 => Ok(Sensors::DataFieldCustomValue1),
14563            1349 => Ok(Sensors::DataFieldCustomValue2),
14564            1350 => Ok(Sensors::DataFieldCustomValue3),
14565            1351 => Ok(Sensors::DataFieldCustomValue4),
14566            1352 => Ok(Sensors::DataFieldCustomValue5),
14567            1353 => Ok(Sensors::DataFieldCustomValue6),
14568            1354 => Ok(Sensors::DataFieldCustomValue7),
14569            1355 => Ok(Sensors::DataFieldCustomValue8),
14570            1356 => Ok(Sensors::DataFieldCustomValue9),
14571            1357 => Ok(Sensors::DataFieldCustomValue10),
14572            1358 => Ok(Sensors::DataFieldCustomValue11),
14573            1359 => Ok(Sensors::DataFieldCustomValue12),
14574            1360 => Ok(Sensors::DataFieldCustomValue13),
14575            1361 => Ok(Sensors::DataFieldCustomValue14),
14576            1362 => Ok(Sensors::DataFieldCustomValue15),
14577            1363 => Ok(Sensors::DataFieldCustomValue16),
14578            1364 => Ok(Sensors::DataFieldCustomValue17),
14579            1365 => Ok(Sensors::DataFieldCustomValue18),
14580            1366 => Ok(Sensors::DataFieldCustomValue19),
14581            1367 => Ok(Sensors::DataFieldCustomValue20),
14582            1368 => Ok(Sensors::DataFieldCustomValue21),
14583            1369 => Ok(Sensors::DataFieldCustomValue22),
14584            1370 => Ok(Sensors::DataFieldCustomValue23),
14585            1371 => Ok(Sensors::DataFieldCustomValue24),
14586            1372 => Ok(Sensors::DataFieldCustomValue25),
14587            1373 => Ok(Sensors::DataFieldCustomValue26),
14588            1374 => Ok(Sensors::DataFieldCustomValue27),
14589            1375 => Ok(Sensors::DataFieldCustomValue28),
14590            1376 => Ok(Sensors::DataFieldGeneric),
14591            1377 => Ok(Sensors::DataFieldGenericGUIDorPROPERTYKEY),
14592            1378 => Ok(Sensors::DataFieldGenericCategoryGUID),
14593            1379 => Ok(Sensors::DataFieldGenericTypeGUID),
14594            1380 => Ok(Sensors::DataFieldGenericEventPROPERTYKEY),
14595            1381 => Ok(Sensors::DataFieldGenericPropertyPROPERTYKEY),
14596            1382 => Ok(Sensors::DataFieldGenericDataFieldPROPERTYKEY),
14597            1383 => Ok(Sensors::DataFieldGenericEvent),
14598            1384 => Ok(Sensors::DataFieldGenericProperty),
14599            1385 => Ok(Sensors::DataFieldGenericDataField),
14600            1386 => Ok(Sensors::DataFieldEnumeratorTableRowIndex),
14601            1387 => Ok(Sensors::DataFieldEnumeratorTableRowCount),
14602            1388 => Ok(Sensors::DataFieldGenericGUIDorPROPERTYKEYkind),
14603            1389 => Ok(Sensors::DataFieldGenericGUID),
14604            1390 => Ok(Sensors::DataFieldGenericPROPERTYKEY),
14605            1391 => Ok(Sensors::DataFieldGenericTopLevelCollectionID),
14606            1392 => Ok(Sensors::DataFieldGenericReportID),
14607            1393 => Ok(Sensors::DataFieldGenericReportItemPositionIndex),
14608            1394 => Ok(Sensors::DataFieldGenericFirmwareVARTYPE),
14609            1395 => Ok(Sensors::DataFieldGenericUnitofMeasure),
14610            1396 => Ok(Sensors::DataFieldGenericUnitExponent),
14611            1397 => Ok(Sensors::DataFieldGenericReportSize),
14612            1398 => Ok(Sensors::DataFieldGenericReportCount),
14613            1408 => Ok(Sensors::PropertyGeneric),
14614            1409 => Ok(Sensors::PropertyEnumeratorTableRowIndex),
14615            1410 => Ok(Sensors::PropertyEnumeratorTableRowCount),
14616            1424 => Ok(Sensors::DataFieldPersonalActivity),
14617            1425 => Ok(Sensors::DataFieldActivityType),
14618            1426 => Ok(Sensors::DataFieldActivityState),
14619            1427 => Ok(Sensors::DataFieldDevicePosition),
14620            1428 => Ok(Sensors::DataFieldStepCount),
14621            1429 => Ok(Sensors::DataFieldStepCountReset),
14622            1430 => Ok(Sensors::DataFieldStepDuration),
14623            1431 => Ok(Sensors::DataFieldStepType),
14624            1440 => Ok(Sensors::PropertyMinimumActivityDetectionInterval),
14625            1441 => Ok(Sensors::PropertySupportedActivityTypes),
14626            1442 => Ok(Sensors::PropertySubscribedActivityTypes),
14627            1443 => Ok(Sensors::PropertySupportedStepTypes),
14628            1444 => Ok(Sensors::PropertySubscribedStepTypes),
14629            1445 => Ok(Sensors::PropertyFloorHeight),
14630            1456 => Ok(Sensors::DataFieldCustomTypeID),
14631            1472 => Ok(Sensors::PropertyCustom),
14632            1473 => Ok(Sensors::PropertyCustomValue1),
14633            1474 => Ok(Sensors::PropertyCustomValue2),
14634            1475 => Ok(Sensors::PropertyCustomValue3),
14635            1476 => Ok(Sensors::PropertyCustomValue4),
14636            1477 => Ok(Sensors::PropertyCustomValue5),
14637            1478 => Ok(Sensors::PropertyCustomValue6),
14638            1479 => Ok(Sensors::PropertyCustomValue7),
14639            1480 => Ok(Sensors::PropertyCustomValue8),
14640            1481 => Ok(Sensors::PropertyCustomValue9),
14641            1482 => Ok(Sensors::PropertyCustomValue10),
14642            1483 => Ok(Sensors::PropertyCustomValue11),
14643            1484 => Ok(Sensors::PropertyCustomValue12),
14644            1485 => Ok(Sensors::PropertyCustomValue13),
14645            1486 => Ok(Sensors::PropertyCustomValue14),
14646            1487 => Ok(Sensors::PropertyCustomValue15),
14647            1488 => Ok(Sensors::PropertyCustomValue16),
14648            1504 => Ok(Sensors::DataFieldHinge),
14649            1505 => Ok(Sensors::DataFieldHingeAngle),
14650            1520 => Ok(Sensors::DataFieldGestureSensor),
14651            1521 => Ok(Sensors::DataFieldGestureState),
14652            1522 => Ok(Sensors::DataFieldHingeFoldInitialAngle),
14653            1523 => Ok(Sensors::DataFieldHingeFoldFinalAngle),
14654            1524 => Ok(Sensors::DataFieldHingeFoldContributingPanel),
14655            1525 => Ok(Sensors::DataFieldHingeFoldType),
14656            2048 => Ok(Sensors::SensorStateUndefined),
14657            2049 => Ok(Sensors::SensorStateReady),
14658            2050 => Ok(Sensors::SensorStateNotAvailable),
14659            2051 => Ok(Sensors::SensorStateNoData),
14660            2052 => Ok(Sensors::SensorStateInitializing),
14661            2053 => Ok(Sensors::SensorStateAccessDenied),
14662            2054 => Ok(Sensors::SensorStateError),
14663            2064 => Ok(Sensors::SensorEventUnknown),
14664            2065 => Ok(Sensors::SensorEventStateChanged),
14665            2066 => Ok(Sensors::SensorEventPropertyChanged),
14666            2067 => Ok(Sensors::SensorEventDataUpdated),
14667            2068 => Ok(Sensors::SensorEventPollResponse),
14668            2069 => Ok(Sensors::SensorEventChangeSensitivity),
14669            2070 => Ok(Sensors::SensorEventRangeMaximumReached),
14670            2071 => Ok(Sensors::SensorEventRangeMinimumReached),
14671            2072 => Ok(Sensors::SensorEventHighThresholdCrossUpward),
14672            2073 => Ok(Sensors::SensorEventHighThresholdCrossDownward),
14673            2074 => Ok(Sensors::SensorEventLowThresholdCrossUpward),
14674            2075 => Ok(Sensors::SensorEventLowThresholdCrossDownward),
14675            2076 => Ok(Sensors::SensorEventZeroThresholdCrossUpward),
14676            2077 => Ok(Sensors::SensorEventZeroThresholdCrossDownward),
14677            2078 => Ok(Sensors::SensorEventPeriodExceeded),
14678            2079 => Ok(Sensors::SensorEventFrequencyExceeded),
14679            2080 => Ok(Sensors::SensorEventComplexTrigger),
14680            2096 => Ok(Sensors::ConnectionTypePCIntegrated),
14681            2097 => Ok(Sensors::ConnectionTypePCAttached),
14682            2098 => Ok(Sensors::ConnectionTypePCExternal),
14683            2112 => Ok(Sensors::ReportingStateReportNoEvents),
14684            2113 => Ok(Sensors::ReportingStateReportAllEvents),
14685            2114 => Ok(Sensors::ReportingStateReportThresholdEvents),
14686            2115 => Ok(Sensors::ReportingStateWakeOnNoEvents),
14687            2116 => Ok(Sensors::ReportingStateWakeOnAllEvents),
14688            2117 => Ok(Sensors::ReportingStateWakeOnThresholdEvents),
14689            2118 => Ok(Sensors::ReportingStateAnytime),
14690            2128 => Ok(Sensors::PowerStateUndefined),
14691            2129 => Ok(Sensors::PowerStateD0FullPower),
14692            2130 => Ok(Sensors::PowerStateD1LowPower),
14693            2131 => Ok(Sensors::PowerStateD2StandbyPowerwithWakeup),
14694            2132 => Ok(Sensors::PowerStateD3SleepwithWakeup),
14695            2133 => Ok(Sensors::PowerStateD4PowerOff),
14696            2144 => Ok(Sensors::AccuracyDefault),
14697            2145 => Ok(Sensors::AccuracyHigh),
14698            2146 => Ok(Sensors::AccuracyMedium),
14699            2147 => Ok(Sensors::AccuracyLow),
14700            2160 => Ok(Sensors::FixQualityNoFix),
14701            2161 => Ok(Sensors::FixQualityGPS),
14702            2162 => Ok(Sensors::FixQualityDGPS),
14703            2176 => Ok(Sensors::FixTypeNoFix),
14704            2177 => Ok(Sensors::FixTypeGPSSPSModeFixValid),
14705            2178 => Ok(Sensors::FixTypeDGPSSPSModeFixValid),
14706            2179 => Ok(Sensors::FixTypeGPSPPSModeFixValid),
14707            2180 => Ok(Sensors::FixTypeRealTimeKinematic),
14708            2181 => Ok(Sensors::FixTypeFloatRTK),
14709            2182 => Ok(Sensors::FixTypeEstimateddeadreckoned),
14710            2183 => Ok(Sensors::FixTypeManualInputMode),
14711            2184 => Ok(Sensors::FixTypeSimulatorMode),
14712            2192 => Ok(Sensors::GPSOperationModeManual),
14713            2193 => Ok(Sensors::GPSOperationModeAutomatic),
14714            2208 => Ok(Sensors::GPSSelectionModeAutonomous),
14715            2209 => Ok(Sensors::GPSSelectionModeDGPS),
14716            2210 => Ok(Sensors::GPSSelectionModeEstimateddeadreckoned),
14717            2211 => Ok(Sensors::GPSSelectionModeManualInput),
14718            2212 => Ok(Sensors::GPSSelectionModeSimulator),
14719            2213 => Ok(Sensors::GPSSelectionModeDataNotValid),
14720            2224 => Ok(Sensors::GPSStatusDataValid),
14721            2225 => Ok(Sensors::GPSStatusDataNotValid),
14722            2240 => Ok(Sensors::DayofWeekSunday),
14723            2241 => Ok(Sensors::DayofWeekMonday),
14724            2242 => Ok(Sensors::DayofWeekTuesday),
14725            2243 => Ok(Sensors::DayofWeekWednesday),
14726            2244 => Ok(Sensors::DayofWeekThursday),
14727            2245 => Ok(Sensors::DayofWeekFriday),
14728            2246 => Ok(Sensors::DayofWeekSaturday),
14729            2256 => Ok(Sensors::KindCategory),
14730            2257 => Ok(Sensors::KindType),
14731            2258 => Ok(Sensors::KindEvent),
14732            2259 => Ok(Sensors::KindProperty),
14733            2260 => Ok(Sensors::KindDataField),
14734            2272 => Ok(Sensors::MagnetometerAccuracyLow),
14735            2273 => Ok(Sensors::MagnetometerAccuracyMedium),
14736            2274 => Ok(Sensors::MagnetometerAccuracyHigh),
14737            2288 => Ok(Sensors::SimpleOrientationDirectionNotRotated),
14738            2289 => Ok(Sensors::SimpleOrientationDirectionRotated90DegreesCCW),
14739            2290 => Ok(Sensors::SimpleOrientationDirectionRotated180DegreesCCW),
14740            2291 => Ok(Sensors::SimpleOrientationDirectionRotated270DegreesCCW),
14741            2292 => Ok(Sensors::SimpleOrientationDirectionFaceUp),
14742            2293 => Ok(Sensors::SimpleOrientationDirectionFaceDown),
14743            2304 => Ok(Sensors::VT_NULL),
14744            2305 => Ok(Sensors::VT_BOOL),
14745            2306 => Ok(Sensors::VT_UI1),
14746            2307 => Ok(Sensors::VT_I1),
14747            2308 => Ok(Sensors::VT_UI2),
14748            2309 => Ok(Sensors::VT_I2),
14749            2310 => Ok(Sensors::VT_UI4),
14750            2311 => Ok(Sensors::VT_I4),
14751            2312 => Ok(Sensors::VT_UI8),
14752            2313 => Ok(Sensors::VT_I8),
14753            2314 => Ok(Sensors::VT_R4),
14754            2315 => Ok(Sensors::VT_R8),
14755            2316 => Ok(Sensors::VT_WSTR),
14756            2317 => Ok(Sensors::VT_STR),
14757            2318 => Ok(Sensors::VT_CLSID),
14758            2319 => Ok(Sensors::VT_VECTORVT_UI1),
14759            2320 => Ok(Sensors::VT_F16E0),
14760            2321 => Ok(Sensors::VT_F16E1),
14761            2322 => Ok(Sensors::VT_F16E2),
14762            2323 => Ok(Sensors::VT_F16E3),
14763            2324 => Ok(Sensors::VT_F16E4),
14764            2325 => Ok(Sensors::VT_F16E5),
14765            2326 => Ok(Sensors::VT_F16E6),
14766            2327 => Ok(Sensors::VT_F16E7),
14767            2328 => Ok(Sensors::VT_F16E8),
14768            2329 => Ok(Sensors::VT_F16E9),
14769            2330 => Ok(Sensors::VT_F16EA),
14770            2331 => Ok(Sensors::VT_F16EB),
14771            2332 => Ok(Sensors::VT_F16EC),
14772            2333 => Ok(Sensors::VT_F16ED),
14773            2334 => Ok(Sensors::VT_F16EE),
14774            2335 => Ok(Sensors::VT_F16EF),
14775            2336 => Ok(Sensors::VT_F32E0),
14776            2337 => Ok(Sensors::VT_F32E1),
14777            2338 => Ok(Sensors::VT_F32E2),
14778            2339 => Ok(Sensors::VT_F32E3),
14779            2340 => Ok(Sensors::VT_F32E4),
14780            2341 => Ok(Sensors::VT_F32E5),
14781            2342 => Ok(Sensors::VT_F32E6),
14782            2343 => Ok(Sensors::VT_F32E7),
14783            2344 => Ok(Sensors::VT_F32E8),
14784            2345 => Ok(Sensors::VT_F32E9),
14785            2346 => Ok(Sensors::VT_F32EA),
14786            2347 => Ok(Sensors::VT_F32EB),
14787            2348 => Ok(Sensors::VT_F32EC),
14788            2349 => Ok(Sensors::VT_F32ED),
14789            2350 => Ok(Sensors::VT_F32EE),
14790            2351 => Ok(Sensors::VT_F32EF),
14791            2352 => Ok(Sensors::ActivityTypeUnknown),
14792            2353 => Ok(Sensors::ActivityTypeStationary),
14793            2354 => Ok(Sensors::ActivityTypeFidgeting),
14794            2355 => Ok(Sensors::ActivityTypeWalking),
14795            2356 => Ok(Sensors::ActivityTypeRunning),
14796            2357 => Ok(Sensors::ActivityTypeInVehicle),
14797            2358 => Ok(Sensors::ActivityTypeBiking),
14798            2359 => Ok(Sensors::ActivityTypeIdle),
14799            2368 => Ok(Sensors::UnitNotSpecified),
14800            2369 => Ok(Sensors::UnitLux),
14801            2370 => Ok(Sensors::UnitDegreesKelvin),
14802            2371 => Ok(Sensors::UnitDegreesCelsius),
14803            2372 => Ok(Sensors::UnitPascal),
14804            2373 => Ok(Sensors::UnitNewton),
14805            2374 => Ok(Sensors::UnitMetersSecond),
14806            2375 => Ok(Sensors::UnitKilogram),
14807            2376 => Ok(Sensors::UnitMeter),
14808            2377 => Ok(Sensors::UnitMetersSecondSecond),
14809            2378 => Ok(Sensors::UnitFarad),
14810            2379 => Ok(Sensors::UnitAmpere),
14811            2380 => Ok(Sensors::UnitWatt),
14812            2381 => Ok(Sensors::UnitHenry),
14813            2382 => Ok(Sensors::UnitOhm),
14814            2383 => Ok(Sensors::UnitVolt),
14815            2384 => Ok(Sensors::UnitHertz),
14816            2385 => Ok(Sensors::UnitBar),
14817            2386 => Ok(Sensors::UnitDegreesAnticlockwise),
14818            2387 => Ok(Sensors::UnitDegreesClockwise),
14819            2388 => Ok(Sensors::UnitDegrees),
14820            2389 => Ok(Sensors::UnitDegreesSecond),
14821            2390 => Ok(Sensors::UnitDegreesSecondSecond),
14822            2391 => Ok(Sensors::UnitKnot),
14823            2392 => Ok(Sensors::UnitPercent),
14824            2393 => Ok(Sensors::UnitSecond),
14825            2394 => Ok(Sensors::UnitMillisecond),
14826            2395 => Ok(Sensors::UnitG),
14827            2396 => Ok(Sensors::UnitBytes),
14828            2397 => Ok(Sensors::UnitMilligauss),
14829            2398 => Ok(Sensors::UnitBits),
14830            2400 => Ok(Sensors::ActivityStateNoStateChange),
14831            2401 => Ok(Sensors::ActivityStateStartActivity),
14832            2402 => Ok(Sensors::ActivityStateEndActivity),
14833            2416 => Ok(Sensors::Exponent0),
14834            2417 => Ok(Sensors::Exponent1),
14835            2418 => Ok(Sensors::Exponent2),
14836            2419 => Ok(Sensors::Exponent3),
14837            2420 => Ok(Sensors::Exponent4),
14838            2421 => Ok(Sensors::Exponent5),
14839            2422 => Ok(Sensors::Exponent6),
14840            2423 => Ok(Sensors::Exponent7),
14841            2424 => Ok(Sensors::Exponent8),
14842            2425 => Ok(Sensors::Exponent9),
14843            2426 => Ok(Sensors::ExponentA),
14844            2427 => Ok(Sensors::ExponentB),
14845            2428 => Ok(Sensors::ExponentC),
14846            2429 => Ok(Sensors::ExponentD),
14847            2430 => Ok(Sensors::ExponentE),
14848            2431 => Ok(Sensors::ExponentF),
14849            2432 => Ok(Sensors::DevicePositionUnknown),
14850            2433 => Ok(Sensors::DevicePositionUnchanged),
14851            2434 => Ok(Sensors::DevicePositionOnDesk),
14852            2435 => Ok(Sensors::DevicePositionInHand),
14853            2436 => Ok(Sensors::DevicePositionMovinginBag),
14854            2437 => Ok(Sensors::DevicePositionStationaryinBag),
14855            2448 => Ok(Sensors::StepTypeUnknown),
14856            2449 => Ok(Sensors::StepTypeWalking),
14857            2450 => Ok(Sensors::StepTypeRunning),
14858            2464 => Ok(Sensors::GestureStateUnknown),
14859            2465 => Ok(Sensors::GestureStateStarted),
14860            2466 => Ok(Sensors::GestureStateCompleted),
14861            2467 => Ok(Sensors::GestureStateCancelled),
14862            2480 => Ok(Sensors::HingeFoldContributingPanelUnknown),
14863            2481 => Ok(Sensors::HingeFoldContributingPanelPanel1),
14864            2482 => Ok(Sensors::HingeFoldContributingPanelPanel2),
14865            2483 => Ok(Sensors::HingeFoldContributingPanelBoth),
14866            2484 => Ok(Sensors::HingeFoldTypeUnknown),
14867            2485 => Ok(Sensors::HingeFoldTypeIncreasing),
14868            2486 => Ok(Sensors::HingeFoldTypeDecreasing),
14869            2496 => Ok(Sensors::HumanPresenceDetectionTypeVendorDefinedNonBiometric),
14870            2497 => Ok(Sensors::HumanPresenceDetectionTypeVendorDefinedBiometric),
14871            2498 => Ok(Sensors::HumanPresenceDetectionTypeFacialBiometric),
14872            2499 => Ok(Sensors::HumanPresenceDetectionTypeAudioBiometric),
14873            4096 => Ok(Sensors::ModifierChangeSensitivityAbsolute),
14874            8192 => Ok(Sensors::ModifierMaximum),
14875            12288 => Ok(Sensors::ModifierMinimum),
14876            16384 => Ok(Sensors::ModifierAccuracy),
14877            20480 => Ok(Sensors::ModifierResolution),
14878            24576 => Ok(Sensors::ModifierThresholdHigh),
14879            28672 => Ok(Sensors::ModifierThresholdLow),
14880            32768 => Ok(Sensors::ModifierCalibrationOffset),
14881            36864 => Ok(Sensors::ModifierCalibrationMultiplier),
14882            40960 => Ok(Sensors::ModifierReportInterval),
14883            45056 => Ok(Sensors::ModifierFrequencyMax),
14884            49152 => Ok(Sensors::ModifierPeriodMax),
14885            53248 => Ok(Sensors::ModifierChangeSensitivityPercentofRange),
14886            57344 => Ok(Sensors::ModifierChangeSensitivityPercentRelative),
14887            61440 => Ok(Sensors::ModifierVendorReserved),
14888            n => Err(HutError::UnknownUsageId { usage_id: n }),
14889        }
14890    }
14891}
14892
14893impl BitOr<u16> for Sensors {
14894    type Output = Usage;
14895
14896    /// A convenience function to combine a Usage Page with
14897    /// a value.
14898    ///
14899    /// This function panics if the Usage ID value results in
14900    /// an unknown Usage. Where error checking is required,
14901    /// use [UsagePage::to_usage_from_value].
14902    fn bitor(self, usage: u16) -> Usage {
14903        let up = u16::from(self) as u32;
14904        let u = usage as u32;
14905        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
14906    }
14907}
14908
14909/// *Usage Page `0x40`: "Medical Instrument"*
14910///
14911/// **This enum is autogenerated from the HID Usage Tables**.
14912/// ```
14913/// # use hut::*;
14914/// let u1 = Usage::MedicalInstrument(MedicalInstrument::VCRAcquisition);
14915/// let u2 = Usage::new_from_page_and_id(0x40, 0x20).unwrap();
14916/// let u3 = Usage::from(MedicalInstrument::VCRAcquisition);
14917/// let u4: Usage = MedicalInstrument::VCRAcquisition.into();
14918/// assert_eq!(u1, u2);
14919/// assert_eq!(u1, u3);
14920/// assert_eq!(u1, u4);
14921///
14922/// assert!(matches!(u1.usage_page(), UsagePage::MedicalInstrument));
14923/// assert_eq!(0x40, u1.usage_page_value());
14924/// assert_eq!(0x20, u1.usage_id_value());
14925/// assert_eq!((0x40 << 16) | 0x20, u1.usage_value());
14926/// assert_eq!("VCR/Acquisition", u1.name());
14927/// ```
14928///
14929#[allow(non_camel_case_types)]
14930#[derive(Debug)]
14931#[non_exhaustive]
14932pub enum MedicalInstrument {
14933    /// Usage ID `0x1`: "Medical Ultrasound"
14934    MedicalUltrasound,
14935    /// Usage ID `0x20`: "VCR/Acquisition"
14936    VCRAcquisition,
14937    /// Usage ID `0x21`: "Freeze/Thaw"
14938    FreezeThaw,
14939    /// Usage ID `0x22`: "Clip Store"
14940    ClipStore,
14941    /// Usage ID `0x23`: "Update"
14942    Update,
14943    /// Usage ID `0x24`: "Next"
14944    Next,
14945    /// Usage ID `0x25`: "Save"
14946    Save,
14947    /// Usage ID `0x26`: "Print"
14948    Print,
14949    /// Usage ID `0x27`: "Microphone Enable"
14950    MicrophoneEnable,
14951    /// Usage ID `0x40`: "Cine"
14952    Cine,
14953    /// Usage ID `0x41`: "Transmit Power"
14954    TransmitPower,
14955    /// Usage ID `0x42`: "Volume"
14956    Volume,
14957    /// Usage ID `0x43`: "Focus"
14958    Focus,
14959    /// Usage ID `0x44`: "Depth"
14960    Depth,
14961    /// Usage ID `0x60`: "Soft Step - Primary"
14962    SoftStepPrimary,
14963    /// Usage ID `0x61`: "Soft Step - Secondary"
14964    SoftStepSecondary,
14965    /// Usage ID `0x70`: "Depth Gain Compensation"
14966    DepthGainCompensation,
14967    /// Usage ID `0x80`: "Zoom Select"
14968    ZoomSelect,
14969    /// Usage ID `0x81`: "Zoom Adjust"
14970    ZoomAdjust,
14971    /// Usage ID `0x82`: "Spectral Doppler Mode Select"
14972    SpectralDopplerModeSelect,
14973    /// Usage ID `0x83`: "Spectral Doppler Adjust"
14974    SpectralDopplerAdjust,
14975    /// Usage ID `0x84`: "Color Doppler Mode Select"
14976    ColorDopplerModeSelect,
14977    /// Usage ID `0x85`: "Color Doppler Adjust"
14978    ColorDopplerAdjust,
14979    /// Usage ID `0x86`: "Motion Mode Select"
14980    MotionModeSelect,
14981    /// Usage ID `0x87`: "Motion Mode Adjust"
14982    MotionModeAdjust,
14983    /// Usage ID `0x88`: "2-D Mode Select"
14984    TwoDModeSelect,
14985    /// Usage ID `0x89`: "2-D Mode Adjust"
14986    TwoDModeAdjust,
14987    /// Usage ID `0xA0`: "Soft Control Select"
14988    SoftControlSelect,
14989    /// Usage ID `0xA1`: "Soft Control Adjust"
14990    SoftControlAdjust,
14991}
14992
14993impl MedicalInstrument {
14994    #[cfg(feature = "std")]
14995    pub fn name(&self) -> String {
14996        match self {
14997            MedicalInstrument::MedicalUltrasound => "Medical Ultrasound",
14998            MedicalInstrument::VCRAcquisition => "VCR/Acquisition",
14999            MedicalInstrument::FreezeThaw => "Freeze/Thaw",
15000            MedicalInstrument::ClipStore => "Clip Store",
15001            MedicalInstrument::Update => "Update",
15002            MedicalInstrument::Next => "Next",
15003            MedicalInstrument::Save => "Save",
15004            MedicalInstrument::Print => "Print",
15005            MedicalInstrument::MicrophoneEnable => "Microphone Enable",
15006            MedicalInstrument::Cine => "Cine",
15007            MedicalInstrument::TransmitPower => "Transmit Power",
15008            MedicalInstrument::Volume => "Volume",
15009            MedicalInstrument::Focus => "Focus",
15010            MedicalInstrument::Depth => "Depth",
15011            MedicalInstrument::SoftStepPrimary => "Soft Step - Primary",
15012            MedicalInstrument::SoftStepSecondary => "Soft Step - Secondary",
15013            MedicalInstrument::DepthGainCompensation => "Depth Gain Compensation",
15014            MedicalInstrument::ZoomSelect => "Zoom Select",
15015            MedicalInstrument::ZoomAdjust => "Zoom Adjust",
15016            MedicalInstrument::SpectralDopplerModeSelect => "Spectral Doppler Mode Select",
15017            MedicalInstrument::SpectralDopplerAdjust => "Spectral Doppler Adjust",
15018            MedicalInstrument::ColorDopplerModeSelect => "Color Doppler Mode Select",
15019            MedicalInstrument::ColorDopplerAdjust => "Color Doppler Adjust",
15020            MedicalInstrument::MotionModeSelect => "Motion Mode Select",
15021            MedicalInstrument::MotionModeAdjust => "Motion Mode Adjust",
15022            MedicalInstrument::TwoDModeSelect => "2-D Mode Select",
15023            MedicalInstrument::TwoDModeAdjust => "2-D Mode Adjust",
15024            MedicalInstrument::SoftControlSelect => "Soft Control Select",
15025            MedicalInstrument::SoftControlAdjust => "Soft Control Adjust",
15026        }
15027        .into()
15028    }
15029}
15030
15031#[cfg(feature = "std")]
15032impl fmt::Display for MedicalInstrument {
15033    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15034        write!(f, "{}", self.name())
15035    }
15036}
15037
15038impl AsUsage for MedicalInstrument {
15039    /// Returns the 32 bit Usage value of this Usage
15040    fn usage_value(&self) -> u32 {
15041        u32::from(self)
15042    }
15043
15044    /// Returns the 16 bit Usage ID value of this Usage
15045    fn usage_id_value(&self) -> u16 {
15046        u16::from(self)
15047    }
15048
15049    /// Returns this usage as [Usage::MedicalInstrument(self)](Usage::MedicalInstrument)
15050    /// This is a convenience function to avoid having
15051    /// to implement `From` for every used type in the caller.
15052    ///
15053    /// ```
15054    /// # use hut::*;
15055    /// let gd_x = GenericDesktop::X;
15056    /// let usage = Usage::from(GenericDesktop::X);
15057    /// assert!(matches!(gd_x.usage(), usage));
15058    /// ```
15059    fn usage(&self) -> Usage {
15060        Usage::from(self)
15061    }
15062}
15063
15064impl AsUsagePage for MedicalInstrument {
15065    /// Returns the 16 bit value of this UsagePage
15066    ///
15067    /// This value is `0x40` for [MedicalInstrument]
15068    fn usage_page_value(&self) -> u16 {
15069        let up = UsagePage::from(self);
15070        u16::from(up)
15071    }
15072
15073    /// Returns [UsagePage::MedicalInstrument]]
15074    fn usage_page(&self) -> UsagePage {
15075        UsagePage::from(self)
15076    }
15077}
15078
15079impl From<&MedicalInstrument> for u16 {
15080    fn from(medicalinstrument: &MedicalInstrument) -> u16 {
15081        match *medicalinstrument {
15082            MedicalInstrument::MedicalUltrasound => 1,
15083            MedicalInstrument::VCRAcquisition => 32,
15084            MedicalInstrument::FreezeThaw => 33,
15085            MedicalInstrument::ClipStore => 34,
15086            MedicalInstrument::Update => 35,
15087            MedicalInstrument::Next => 36,
15088            MedicalInstrument::Save => 37,
15089            MedicalInstrument::Print => 38,
15090            MedicalInstrument::MicrophoneEnable => 39,
15091            MedicalInstrument::Cine => 64,
15092            MedicalInstrument::TransmitPower => 65,
15093            MedicalInstrument::Volume => 66,
15094            MedicalInstrument::Focus => 67,
15095            MedicalInstrument::Depth => 68,
15096            MedicalInstrument::SoftStepPrimary => 96,
15097            MedicalInstrument::SoftStepSecondary => 97,
15098            MedicalInstrument::DepthGainCompensation => 112,
15099            MedicalInstrument::ZoomSelect => 128,
15100            MedicalInstrument::ZoomAdjust => 129,
15101            MedicalInstrument::SpectralDopplerModeSelect => 130,
15102            MedicalInstrument::SpectralDopplerAdjust => 131,
15103            MedicalInstrument::ColorDopplerModeSelect => 132,
15104            MedicalInstrument::ColorDopplerAdjust => 133,
15105            MedicalInstrument::MotionModeSelect => 134,
15106            MedicalInstrument::MotionModeAdjust => 135,
15107            MedicalInstrument::TwoDModeSelect => 136,
15108            MedicalInstrument::TwoDModeAdjust => 137,
15109            MedicalInstrument::SoftControlSelect => 160,
15110            MedicalInstrument::SoftControlAdjust => 161,
15111        }
15112    }
15113}
15114
15115impl From<MedicalInstrument> for u16 {
15116    /// Returns the 16bit value of this usage. This is identical
15117    /// to [MedicalInstrument::usage_page_value()].
15118    fn from(medicalinstrument: MedicalInstrument) -> u16 {
15119        u16::from(&medicalinstrument)
15120    }
15121}
15122
15123impl From<&MedicalInstrument> for u32 {
15124    /// Returns the 32 bit value of this usage. This is identical
15125    /// to [MedicalInstrument::usage_value()].
15126    fn from(medicalinstrument: &MedicalInstrument) -> u32 {
15127        let up = UsagePage::from(medicalinstrument);
15128        let up = (u16::from(&up) as u32) << 16;
15129        let id = u16::from(medicalinstrument) as u32;
15130        up | id
15131    }
15132}
15133
15134impl From<&MedicalInstrument> for UsagePage {
15135    /// Always returns [UsagePage::MedicalInstrument] and is
15136    /// identical to [MedicalInstrument::usage_page()].
15137    fn from(_: &MedicalInstrument) -> UsagePage {
15138        UsagePage::MedicalInstrument
15139    }
15140}
15141
15142impl From<MedicalInstrument> for UsagePage {
15143    /// Always returns [UsagePage::MedicalInstrument] and is
15144    /// identical to [MedicalInstrument::usage_page()].
15145    fn from(_: MedicalInstrument) -> UsagePage {
15146        UsagePage::MedicalInstrument
15147    }
15148}
15149
15150impl From<&MedicalInstrument> for Usage {
15151    fn from(medicalinstrument: &MedicalInstrument) -> Usage {
15152        Usage::try_from(u32::from(medicalinstrument)).unwrap()
15153    }
15154}
15155
15156impl From<MedicalInstrument> for Usage {
15157    fn from(medicalinstrument: MedicalInstrument) -> Usage {
15158        Usage::from(&medicalinstrument)
15159    }
15160}
15161
15162impl TryFrom<u16> for MedicalInstrument {
15163    type Error = HutError;
15164
15165    fn try_from(usage_id: u16) -> Result<MedicalInstrument> {
15166        match usage_id {
15167            1 => Ok(MedicalInstrument::MedicalUltrasound),
15168            32 => Ok(MedicalInstrument::VCRAcquisition),
15169            33 => Ok(MedicalInstrument::FreezeThaw),
15170            34 => Ok(MedicalInstrument::ClipStore),
15171            35 => Ok(MedicalInstrument::Update),
15172            36 => Ok(MedicalInstrument::Next),
15173            37 => Ok(MedicalInstrument::Save),
15174            38 => Ok(MedicalInstrument::Print),
15175            39 => Ok(MedicalInstrument::MicrophoneEnable),
15176            64 => Ok(MedicalInstrument::Cine),
15177            65 => Ok(MedicalInstrument::TransmitPower),
15178            66 => Ok(MedicalInstrument::Volume),
15179            67 => Ok(MedicalInstrument::Focus),
15180            68 => Ok(MedicalInstrument::Depth),
15181            96 => Ok(MedicalInstrument::SoftStepPrimary),
15182            97 => Ok(MedicalInstrument::SoftStepSecondary),
15183            112 => Ok(MedicalInstrument::DepthGainCompensation),
15184            128 => Ok(MedicalInstrument::ZoomSelect),
15185            129 => Ok(MedicalInstrument::ZoomAdjust),
15186            130 => Ok(MedicalInstrument::SpectralDopplerModeSelect),
15187            131 => Ok(MedicalInstrument::SpectralDopplerAdjust),
15188            132 => Ok(MedicalInstrument::ColorDopplerModeSelect),
15189            133 => Ok(MedicalInstrument::ColorDopplerAdjust),
15190            134 => Ok(MedicalInstrument::MotionModeSelect),
15191            135 => Ok(MedicalInstrument::MotionModeAdjust),
15192            136 => Ok(MedicalInstrument::TwoDModeSelect),
15193            137 => Ok(MedicalInstrument::TwoDModeAdjust),
15194            160 => Ok(MedicalInstrument::SoftControlSelect),
15195            161 => Ok(MedicalInstrument::SoftControlAdjust),
15196            n => Err(HutError::UnknownUsageId { usage_id: n }),
15197        }
15198    }
15199}
15200
15201impl BitOr<u16> for MedicalInstrument {
15202    type Output = Usage;
15203
15204    /// A convenience function to combine a Usage Page with
15205    /// a value.
15206    ///
15207    /// This function panics if the Usage ID value results in
15208    /// an unknown Usage. Where error checking is required,
15209    /// use [UsagePage::to_usage_from_value].
15210    fn bitor(self, usage: u16) -> Usage {
15211        let up = u16::from(self) as u32;
15212        let u = usage as u32;
15213        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
15214    }
15215}
15216
15217/// *Usage Page `0x41`: "Braille Display"*
15218///
15219/// **This enum is autogenerated from the HID Usage Tables**.
15220/// ```
15221/// # use hut::*;
15222/// let u1 = Usage::BrailleDisplay(BrailleDisplay::BrailleRow);
15223/// let u2 = Usage::new_from_page_and_id(0x41, 0x2).unwrap();
15224/// let u3 = Usage::from(BrailleDisplay::BrailleRow);
15225/// let u4: Usage = BrailleDisplay::BrailleRow.into();
15226/// assert_eq!(u1, u2);
15227/// assert_eq!(u1, u3);
15228/// assert_eq!(u1, u4);
15229///
15230/// assert!(matches!(u1.usage_page(), UsagePage::BrailleDisplay));
15231/// assert_eq!(0x41, u1.usage_page_value());
15232/// assert_eq!(0x2, u1.usage_id_value());
15233/// assert_eq!((0x41 << 16) | 0x2, u1.usage_value());
15234/// assert_eq!("Braille Row", u1.name());
15235/// ```
15236///
15237#[allow(non_camel_case_types)]
15238#[derive(Debug)]
15239#[non_exhaustive]
15240pub enum BrailleDisplay {
15241    /// Usage ID `0x1`: "Braille Display"
15242    BrailleDisplay,
15243    /// Usage ID `0x2`: "Braille Row"
15244    BrailleRow,
15245    /// Usage ID `0x3`: "8 Dot Braille Cell"
15246    EightDotBrailleCell,
15247    /// Usage ID `0x4`: "6 Dot Braille Cell"
15248    SixDotBrailleCell,
15249    /// Usage ID `0x5`: "Number of Braille Cells"
15250    NumberofBrailleCells,
15251    /// Usage ID `0x6`: "Screen Reader Control"
15252    ScreenReaderControl,
15253    /// Usage ID `0x7`: "Screen Reader Identifier"
15254    ScreenReaderIdentifier,
15255    /// Usage ID `0xFA`: "Router Set 1"
15256    RouterSet1,
15257    /// Usage ID `0xFB`: "Router Set 2"
15258    RouterSet2,
15259    /// Usage ID `0xFC`: "Router Set 3"
15260    RouterSet3,
15261    /// Usage ID `0x100`: "Router Key"
15262    RouterKey,
15263    /// Usage ID `0x101`: "Row Router Key"
15264    RowRouterKey,
15265    /// Usage ID `0x200`: "Braille Buttons"
15266    BrailleButtons,
15267    /// Usage ID `0x201`: "Braille Keyboard Dot 1"
15268    BrailleKeyboardDot1,
15269    /// Usage ID `0x202`: "Braille Keyboard Dot 2"
15270    BrailleKeyboardDot2,
15271    /// Usage ID `0x203`: "Braille Keyboard Dot 3"
15272    BrailleKeyboardDot3,
15273    /// Usage ID `0x204`: "Braille Keyboard Dot 4"
15274    BrailleKeyboardDot4,
15275    /// Usage ID `0x205`: "Braille Keyboard Dot 5"
15276    BrailleKeyboardDot5,
15277    /// Usage ID `0x206`: "Braille Keyboard Dot 6"
15278    BrailleKeyboardDot6,
15279    /// Usage ID `0x207`: "Braille Keyboard Dot 7"
15280    BrailleKeyboardDot7,
15281    /// Usage ID `0x208`: "Braille Keyboard Dot 8"
15282    BrailleKeyboardDot8,
15283    /// Usage ID `0x209`: "Braille Keyboard Space"
15284    BrailleKeyboardSpace,
15285    /// Usage ID `0x20A`: "Braille Keyboard Left Space"
15286    BrailleKeyboardLeftSpace,
15287    /// Usage ID `0x20B`: "Braille Keyboard Right Space"
15288    BrailleKeyboardRightSpace,
15289    /// Usage ID `0x20C`: "Braille Face Controls"
15290    BrailleFaceControls,
15291    /// Usage ID `0x20D`: "Braille Left Controls"
15292    BrailleLeftControls,
15293    /// Usage ID `0x20E`: "Braille Right Controls"
15294    BrailleRightControls,
15295    /// Usage ID `0x20F`: "Braille Top Controls"
15296    BrailleTopControls,
15297    /// Usage ID `0x210`: "Braille Joystick Center"
15298    BrailleJoystickCenter,
15299    /// Usage ID `0x211`: "Braille Joystick Up"
15300    BrailleJoystickUp,
15301    /// Usage ID `0x212`: "Braille Joystick Down"
15302    BrailleJoystickDown,
15303    /// Usage ID `0x213`: "Braille Joystick Left"
15304    BrailleJoystickLeft,
15305    /// Usage ID `0x214`: "Braille Joystick Right"
15306    BrailleJoystickRight,
15307    /// Usage ID `0x215`: "Braille D-Pad Center"
15308    BrailleDPadCenter,
15309    /// Usage ID `0x216`: "Braille D-Pad Up"
15310    BrailleDPadUp,
15311    /// Usage ID `0x217`: "Braille D-Pad Down"
15312    BrailleDPadDown,
15313    /// Usage ID `0x218`: "Braille D-Pad Left"
15314    BrailleDPadLeft,
15315    /// Usage ID `0x219`: "Braille D-Pad Right"
15316    BrailleDPadRight,
15317    /// Usage ID `0x21A`: "Braille Pan Left"
15318    BraillePanLeft,
15319    /// Usage ID `0x21B`: "Braille Pan Right"
15320    BraillePanRight,
15321    /// Usage ID `0x21C`: "Braille Rocker Up"
15322    BrailleRockerUp,
15323    /// Usage ID `0x21D`: "Braille Rocker Down"
15324    BrailleRockerDown,
15325    /// Usage ID `0x21E`: "Braille Rocker Press"
15326    BrailleRockerPress,
15327}
15328
15329impl BrailleDisplay {
15330    #[cfg(feature = "std")]
15331    pub fn name(&self) -> String {
15332        match self {
15333            BrailleDisplay::BrailleDisplay => "Braille Display",
15334            BrailleDisplay::BrailleRow => "Braille Row",
15335            BrailleDisplay::EightDotBrailleCell => "8 Dot Braille Cell",
15336            BrailleDisplay::SixDotBrailleCell => "6 Dot Braille Cell",
15337            BrailleDisplay::NumberofBrailleCells => "Number of Braille Cells",
15338            BrailleDisplay::ScreenReaderControl => "Screen Reader Control",
15339            BrailleDisplay::ScreenReaderIdentifier => "Screen Reader Identifier",
15340            BrailleDisplay::RouterSet1 => "Router Set 1",
15341            BrailleDisplay::RouterSet2 => "Router Set 2",
15342            BrailleDisplay::RouterSet3 => "Router Set 3",
15343            BrailleDisplay::RouterKey => "Router Key",
15344            BrailleDisplay::RowRouterKey => "Row Router Key",
15345            BrailleDisplay::BrailleButtons => "Braille Buttons",
15346            BrailleDisplay::BrailleKeyboardDot1 => "Braille Keyboard Dot 1",
15347            BrailleDisplay::BrailleKeyboardDot2 => "Braille Keyboard Dot 2",
15348            BrailleDisplay::BrailleKeyboardDot3 => "Braille Keyboard Dot 3",
15349            BrailleDisplay::BrailleKeyboardDot4 => "Braille Keyboard Dot 4",
15350            BrailleDisplay::BrailleKeyboardDot5 => "Braille Keyboard Dot 5",
15351            BrailleDisplay::BrailleKeyboardDot6 => "Braille Keyboard Dot 6",
15352            BrailleDisplay::BrailleKeyboardDot7 => "Braille Keyboard Dot 7",
15353            BrailleDisplay::BrailleKeyboardDot8 => "Braille Keyboard Dot 8",
15354            BrailleDisplay::BrailleKeyboardSpace => "Braille Keyboard Space",
15355            BrailleDisplay::BrailleKeyboardLeftSpace => "Braille Keyboard Left Space",
15356            BrailleDisplay::BrailleKeyboardRightSpace => "Braille Keyboard Right Space",
15357            BrailleDisplay::BrailleFaceControls => "Braille Face Controls",
15358            BrailleDisplay::BrailleLeftControls => "Braille Left Controls",
15359            BrailleDisplay::BrailleRightControls => "Braille Right Controls",
15360            BrailleDisplay::BrailleTopControls => "Braille Top Controls",
15361            BrailleDisplay::BrailleJoystickCenter => "Braille Joystick Center",
15362            BrailleDisplay::BrailleJoystickUp => "Braille Joystick Up",
15363            BrailleDisplay::BrailleJoystickDown => "Braille Joystick Down",
15364            BrailleDisplay::BrailleJoystickLeft => "Braille Joystick Left",
15365            BrailleDisplay::BrailleJoystickRight => "Braille Joystick Right",
15366            BrailleDisplay::BrailleDPadCenter => "Braille D-Pad Center",
15367            BrailleDisplay::BrailleDPadUp => "Braille D-Pad Up",
15368            BrailleDisplay::BrailleDPadDown => "Braille D-Pad Down",
15369            BrailleDisplay::BrailleDPadLeft => "Braille D-Pad Left",
15370            BrailleDisplay::BrailleDPadRight => "Braille D-Pad Right",
15371            BrailleDisplay::BraillePanLeft => "Braille Pan Left",
15372            BrailleDisplay::BraillePanRight => "Braille Pan Right",
15373            BrailleDisplay::BrailleRockerUp => "Braille Rocker Up",
15374            BrailleDisplay::BrailleRockerDown => "Braille Rocker Down",
15375            BrailleDisplay::BrailleRockerPress => "Braille Rocker Press",
15376        }
15377        .into()
15378    }
15379}
15380
15381#[cfg(feature = "std")]
15382impl fmt::Display for BrailleDisplay {
15383    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15384        write!(f, "{}", self.name())
15385    }
15386}
15387
15388impl AsUsage for BrailleDisplay {
15389    /// Returns the 32 bit Usage value of this Usage
15390    fn usage_value(&self) -> u32 {
15391        u32::from(self)
15392    }
15393
15394    /// Returns the 16 bit Usage ID value of this Usage
15395    fn usage_id_value(&self) -> u16 {
15396        u16::from(self)
15397    }
15398
15399    /// Returns this usage as [Usage::BrailleDisplay(self)](Usage::BrailleDisplay)
15400    /// This is a convenience function to avoid having
15401    /// to implement `From` for every used type in the caller.
15402    ///
15403    /// ```
15404    /// # use hut::*;
15405    /// let gd_x = GenericDesktop::X;
15406    /// let usage = Usage::from(GenericDesktop::X);
15407    /// assert!(matches!(gd_x.usage(), usage));
15408    /// ```
15409    fn usage(&self) -> Usage {
15410        Usage::from(self)
15411    }
15412}
15413
15414impl AsUsagePage for BrailleDisplay {
15415    /// Returns the 16 bit value of this UsagePage
15416    ///
15417    /// This value is `0x41` for [BrailleDisplay]
15418    fn usage_page_value(&self) -> u16 {
15419        let up = UsagePage::from(self);
15420        u16::from(up)
15421    }
15422
15423    /// Returns [UsagePage::BrailleDisplay]]
15424    fn usage_page(&self) -> UsagePage {
15425        UsagePage::from(self)
15426    }
15427}
15428
15429impl From<&BrailleDisplay> for u16 {
15430    fn from(brailledisplay: &BrailleDisplay) -> u16 {
15431        match *brailledisplay {
15432            BrailleDisplay::BrailleDisplay => 1,
15433            BrailleDisplay::BrailleRow => 2,
15434            BrailleDisplay::EightDotBrailleCell => 3,
15435            BrailleDisplay::SixDotBrailleCell => 4,
15436            BrailleDisplay::NumberofBrailleCells => 5,
15437            BrailleDisplay::ScreenReaderControl => 6,
15438            BrailleDisplay::ScreenReaderIdentifier => 7,
15439            BrailleDisplay::RouterSet1 => 250,
15440            BrailleDisplay::RouterSet2 => 251,
15441            BrailleDisplay::RouterSet3 => 252,
15442            BrailleDisplay::RouterKey => 256,
15443            BrailleDisplay::RowRouterKey => 257,
15444            BrailleDisplay::BrailleButtons => 512,
15445            BrailleDisplay::BrailleKeyboardDot1 => 513,
15446            BrailleDisplay::BrailleKeyboardDot2 => 514,
15447            BrailleDisplay::BrailleKeyboardDot3 => 515,
15448            BrailleDisplay::BrailleKeyboardDot4 => 516,
15449            BrailleDisplay::BrailleKeyboardDot5 => 517,
15450            BrailleDisplay::BrailleKeyboardDot6 => 518,
15451            BrailleDisplay::BrailleKeyboardDot7 => 519,
15452            BrailleDisplay::BrailleKeyboardDot8 => 520,
15453            BrailleDisplay::BrailleKeyboardSpace => 521,
15454            BrailleDisplay::BrailleKeyboardLeftSpace => 522,
15455            BrailleDisplay::BrailleKeyboardRightSpace => 523,
15456            BrailleDisplay::BrailleFaceControls => 524,
15457            BrailleDisplay::BrailleLeftControls => 525,
15458            BrailleDisplay::BrailleRightControls => 526,
15459            BrailleDisplay::BrailleTopControls => 527,
15460            BrailleDisplay::BrailleJoystickCenter => 528,
15461            BrailleDisplay::BrailleJoystickUp => 529,
15462            BrailleDisplay::BrailleJoystickDown => 530,
15463            BrailleDisplay::BrailleJoystickLeft => 531,
15464            BrailleDisplay::BrailleJoystickRight => 532,
15465            BrailleDisplay::BrailleDPadCenter => 533,
15466            BrailleDisplay::BrailleDPadUp => 534,
15467            BrailleDisplay::BrailleDPadDown => 535,
15468            BrailleDisplay::BrailleDPadLeft => 536,
15469            BrailleDisplay::BrailleDPadRight => 537,
15470            BrailleDisplay::BraillePanLeft => 538,
15471            BrailleDisplay::BraillePanRight => 539,
15472            BrailleDisplay::BrailleRockerUp => 540,
15473            BrailleDisplay::BrailleRockerDown => 541,
15474            BrailleDisplay::BrailleRockerPress => 542,
15475        }
15476    }
15477}
15478
15479impl From<BrailleDisplay> for u16 {
15480    /// Returns the 16bit value of this usage. This is identical
15481    /// to [BrailleDisplay::usage_page_value()].
15482    fn from(brailledisplay: BrailleDisplay) -> u16 {
15483        u16::from(&brailledisplay)
15484    }
15485}
15486
15487impl From<&BrailleDisplay> for u32 {
15488    /// Returns the 32 bit value of this usage. This is identical
15489    /// to [BrailleDisplay::usage_value()].
15490    fn from(brailledisplay: &BrailleDisplay) -> u32 {
15491        let up = UsagePage::from(brailledisplay);
15492        let up = (u16::from(&up) as u32) << 16;
15493        let id = u16::from(brailledisplay) as u32;
15494        up | id
15495    }
15496}
15497
15498impl From<&BrailleDisplay> for UsagePage {
15499    /// Always returns [UsagePage::BrailleDisplay] and is
15500    /// identical to [BrailleDisplay::usage_page()].
15501    fn from(_: &BrailleDisplay) -> UsagePage {
15502        UsagePage::BrailleDisplay
15503    }
15504}
15505
15506impl From<BrailleDisplay> for UsagePage {
15507    /// Always returns [UsagePage::BrailleDisplay] and is
15508    /// identical to [BrailleDisplay::usage_page()].
15509    fn from(_: BrailleDisplay) -> UsagePage {
15510        UsagePage::BrailleDisplay
15511    }
15512}
15513
15514impl From<&BrailleDisplay> for Usage {
15515    fn from(brailledisplay: &BrailleDisplay) -> Usage {
15516        Usage::try_from(u32::from(brailledisplay)).unwrap()
15517    }
15518}
15519
15520impl From<BrailleDisplay> for Usage {
15521    fn from(brailledisplay: BrailleDisplay) -> Usage {
15522        Usage::from(&brailledisplay)
15523    }
15524}
15525
15526impl TryFrom<u16> for BrailleDisplay {
15527    type Error = HutError;
15528
15529    fn try_from(usage_id: u16) -> Result<BrailleDisplay> {
15530        match usage_id {
15531            1 => Ok(BrailleDisplay::BrailleDisplay),
15532            2 => Ok(BrailleDisplay::BrailleRow),
15533            3 => Ok(BrailleDisplay::EightDotBrailleCell),
15534            4 => Ok(BrailleDisplay::SixDotBrailleCell),
15535            5 => Ok(BrailleDisplay::NumberofBrailleCells),
15536            6 => Ok(BrailleDisplay::ScreenReaderControl),
15537            7 => Ok(BrailleDisplay::ScreenReaderIdentifier),
15538            250 => Ok(BrailleDisplay::RouterSet1),
15539            251 => Ok(BrailleDisplay::RouterSet2),
15540            252 => Ok(BrailleDisplay::RouterSet3),
15541            256 => Ok(BrailleDisplay::RouterKey),
15542            257 => Ok(BrailleDisplay::RowRouterKey),
15543            512 => Ok(BrailleDisplay::BrailleButtons),
15544            513 => Ok(BrailleDisplay::BrailleKeyboardDot1),
15545            514 => Ok(BrailleDisplay::BrailleKeyboardDot2),
15546            515 => Ok(BrailleDisplay::BrailleKeyboardDot3),
15547            516 => Ok(BrailleDisplay::BrailleKeyboardDot4),
15548            517 => Ok(BrailleDisplay::BrailleKeyboardDot5),
15549            518 => Ok(BrailleDisplay::BrailleKeyboardDot6),
15550            519 => Ok(BrailleDisplay::BrailleKeyboardDot7),
15551            520 => Ok(BrailleDisplay::BrailleKeyboardDot8),
15552            521 => Ok(BrailleDisplay::BrailleKeyboardSpace),
15553            522 => Ok(BrailleDisplay::BrailleKeyboardLeftSpace),
15554            523 => Ok(BrailleDisplay::BrailleKeyboardRightSpace),
15555            524 => Ok(BrailleDisplay::BrailleFaceControls),
15556            525 => Ok(BrailleDisplay::BrailleLeftControls),
15557            526 => Ok(BrailleDisplay::BrailleRightControls),
15558            527 => Ok(BrailleDisplay::BrailleTopControls),
15559            528 => Ok(BrailleDisplay::BrailleJoystickCenter),
15560            529 => Ok(BrailleDisplay::BrailleJoystickUp),
15561            530 => Ok(BrailleDisplay::BrailleJoystickDown),
15562            531 => Ok(BrailleDisplay::BrailleJoystickLeft),
15563            532 => Ok(BrailleDisplay::BrailleJoystickRight),
15564            533 => Ok(BrailleDisplay::BrailleDPadCenter),
15565            534 => Ok(BrailleDisplay::BrailleDPadUp),
15566            535 => Ok(BrailleDisplay::BrailleDPadDown),
15567            536 => Ok(BrailleDisplay::BrailleDPadLeft),
15568            537 => Ok(BrailleDisplay::BrailleDPadRight),
15569            538 => Ok(BrailleDisplay::BraillePanLeft),
15570            539 => Ok(BrailleDisplay::BraillePanRight),
15571            540 => Ok(BrailleDisplay::BrailleRockerUp),
15572            541 => Ok(BrailleDisplay::BrailleRockerDown),
15573            542 => Ok(BrailleDisplay::BrailleRockerPress),
15574            n => Err(HutError::UnknownUsageId { usage_id: n }),
15575        }
15576    }
15577}
15578
15579impl BitOr<u16> for BrailleDisplay {
15580    type Output = Usage;
15581
15582    /// A convenience function to combine a Usage Page with
15583    /// a value.
15584    ///
15585    /// This function panics if the Usage ID value results in
15586    /// an unknown Usage. Where error checking is required,
15587    /// use [UsagePage::to_usage_from_value].
15588    fn bitor(self, usage: u16) -> Usage {
15589        let up = u16::from(self) as u32;
15590        let u = usage as u32;
15591        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
15592    }
15593}
15594
15595/// *Usage Page `0x59`: "Lighting And Illumination"*
15596///
15597/// **This enum is autogenerated from the HID Usage Tables**.
15598/// ```
15599/// # use hut::*;
15600/// let u1 = Usage::LightingAndIllumination(LightingAndIllumination::LampArrayAttributesReport);
15601/// let u2 = Usage::new_from_page_and_id(0x59, 0x2).unwrap();
15602/// let u3 = Usage::from(LightingAndIllumination::LampArrayAttributesReport);
15603/// let u4: Usage = LightingAndIllumination::LampArrayAttributesReport.into();
15604/// assert_eq!(u1, u2);
15605/// assert_eq!(u1, u3);
15606/// assert_eq!(u1, u4);
15607///
15608/// assert!(matches!(u1.usage_page(), UsagePage::LightingAndIllumination));
15609/// assert_eq!(0x59, u1.usage_page_value());
15610/// assert_eq!(0x2, u1.usage_id_value());
15611/// assert_eq!((0x59 << 16) | 0x2, u1.usage_value());
15612/// assert_eq!("LampArrayAttributesReport", u1.name());
15613/// ```
15614///
15615#[allow(non_camel_case_types)]
15616#[derive(Debug)]
15617#[non_exhaustive]
15618pub enum LightingAndIllumination {
15619    /// Usage ID `0x1`: "LampArray"
15620    LampArray,
15621    /// Usage ID `0x2`: "LampArrayAttributesReport"
15622    LampArrayAttributesReport,
15623    /// Usage ID `0x3`: "LampCount"
15624    LampCount,
15625    /// Usage ID `0x4`: "BoundingBoxWidthInMicrometers"
15626    BoundingBoxWidthInMicrometers,
15627    /// Usage ID `0x5`: "BoundingBoxHeightInMicrometers"
15628    BoundingBoxHeightInMicrometers,
15629    /// Usage ID `0x6`: "BoundingBoxDepthInMicrometers"
15630    BoundingBoxDepthInMicrometers,
15631    /// Usage ID `0x7`: "LampArrayKind"
15632    LampArrayKind,
15633    /// Usage ID `0x8`: "MinUpdateIntervalInMicroseconds"
15634    MinUpdateIntervalInMicroseconds,
15635    /// Usage ID `0x20`: "LampAttributesRequestReport"
15636    LampAttributesRequestReport,
15637    /// Usage ID `0x21`: "LampId"
15638    LampId,
15639    /// Usage ID `0x22`: "LampAttributesResponseReport"
15640    LampAttributesResponseReport,
15641    /// Usage ID `0x23`: "PositionXInMicrometers"
15642    PositionXInMicrometers,
15643    /// Usage ID `0x24`: "PositionYInMicrometers"
15644    PositionYInMicrometers,
15645    /// Usage ID `0x25`: "PositionZInMicrometers"
15646    PositionZInMicrometers,
15647    /// Usage ID `0x26`: "LampPurposes"
15648    LampPurposes,
15649    /// Usage ID `0x27`: "UpdateLatencyInMicroseconds"
15650    UpdateLatencyInMicroseconds,
15651    /// Usage ID `0x28`: "RedLevelCount"
15652    RedLevelCount,
15653    /// Usage ID `0x29`: "GreenLevelCount"
15654    GreenLevelCount,
15655    /// Usage ID `0x2A`: "BlueLevelCount"
15656    BlueLevelCount,
15657    /// Usage ID `0x2B`: "IntensityLevelCount"
15658    IntensityLevelCount,
15659    /// Usage ID `0x2C`: "IsProgrammable"
15660    IsProgrammable,
15661    /// Usage ID `0x2D`: "InputBinding"
15662    InputBinding,
15663    /// Usage ID `0x50`: "LampMultiUpdateReport"
15664    LampMultiUpdateReport,
15665    /// Usage ID `0x51`: "RedUpdateChannel"
15666    RedUpdateChannel,
15667    /// Usage ID `0x52`: "GreenUpdateChannel"
15668    GreenUpdateChannel,
15669    /// Usage ID `0x53`: "BlueUpdateChannel"
15670    BlueUpdateChannel,
15671    /// Usage ID `0x54`: "IntensityUpdateChannel"
15672    IntensityUpdateChannel,
15673    /// Usage ID `0x55`: "LampUpdateFlags"
15674    LampUpdateFlags,
15675    /// Usage ID `0x60`: "LampRangeUpdateReport"
15676    LampRangeUpdateReport,
15677    /// Usage ID `0x61`: "LampIdStart"
15678    LampIdStart,
15679    /// Usage ID `0x62`: "LampIdEnd"
15680    LampIdEnd,
15681    /// Usage ID `0x70`: "LampArrayControlReport"
15682    LampArrayControlReport,
15683    /// Usage ID `0x71`: "AutonomousMode"
15684    AutonomousMode,
15685}
15686
15687impl LightingAndIllumination {
15688    #[cfg(feature = "std")]
15689    pub fn name(&self) -> String {
15690        match self {
15691            LightingAndIllumination::LampArray => "LampArray",
15692            LightingAndIllumination::LampArrayAttributesReport => "LampArrayAttributesReport",
15693            LightingAndIllumination::LampCount => "LampCount",
15694            LightingAndIllumination::BoundingBoxWidthInMicrometers => {
15695                "BoundingBoxWidthInMicrometers"
15696            }
15697            LightingAndIllumination::BoundingBoxHeightInMicrometers => {
15698                "BoundingBoxHeightInMicrometers"
15699            }
15700            LightingAndIllumination::BoundingBoxDepthInMicrometers => {
15701                "BoundingBoxDepthInMicrometers"
15702            }
15703            LightingAndIllumination::LampArrayKind => "LampArrayKind",
15704            LightingAndIllumination::MinUpdateIntervalInMicroseconds => {
15705                "MinUpdateIntervalInMicroseconds"
15706            }
15707            LightingAndIllumination::LampAttributesRequestReport => "LampAttributesRequestReport",
15708            LightingAndIllumination::LampId => "LampId",
15709            LightingAndIllumination::LampAttributesResponseReport => "LampAttributesResponseReport",
15710            LightingAndIllumination::PositionXInMicrometers => "PositionXInMicrometers",
15711            LightingAndIllumination::PositionYInMicrometers => "PositionYInMicrometers",
15712            LightingAndIllumination::PositionZInMicrometers => "PositionZInMicrometers",
15713            LightingAndIllumination::LampPurposes => "LampPurposes",
15714            LightingAndIllumination::UpdateLatencyInMicroseconds => "UpdateLatencyInMicroseconds",
15715            LightingAndIllumination::RedLevelCount => "RedLevelCount",
15716            LightingAndIllumination::GreenLevelCount => "GreenLevelCount",
15717            LightingAndIllumination::BlueLevelCount => "BlueLevelCount",
15718            LightingAndIllumination::IntensityLevelCount => "IntensityLevelCount",
15719            LightingAndIllumination::IsProgrammable => "IsProgrammable",
15720            LightingAndIllumination::InputBinding => "InputBinding",
15721            LightingAndIllumination::LampMultiUpdateReport => "LampMultiUpdateReport",
15722            LightingAndIllumination::RedUpdateChannel => "RedUpdateChannel",
15723            LightingAndIllumination::GreenUpdateChannel => "GreenUpdateChannel",
15724            LightingAndIllumination::BlueUpdateChannel => "BlueUpdateChannel",
15725            LightingAndIllumination::IntensityUpdateChannel => "IntensityUpdateChannel",
15726            LightingAndIllumination::LampUpdateFlags => "LampUpdateFlags",
15727            LightingAndIllumination::LampRangeUpdateReport => "LampRangeUpdateReport",
15728            LightingAndIllumination::LampIdStart => "LampIdStart",
15729            LightingAndIllumination::LampIdEnd => "LampIdEnd",
15730            LightingAndIllumination::LampArrayControlReport => "LampArrayControlReport",
15731            LightingAndIllumination::AutonomousMode => "AutonomousMode",
15732        }
15733        .into()
15734    }
15735}
15736
15737#[cfg(feature = "std")]
15738impl fmt::Display for LightingAndIllumination {
15739    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15740        write!(f, "{}", self.name())
15741    }
15742}
15743
15744impl AsUsage for LightingAndIllumination {
15745    /// Returns the 32 bit Usage value of this Usage
15746    fn usage_value(&self) -> u32 {
15747        u32::from(self)
15748    }
15749
15750    /// Returns the 16 bit Usage ID value of this Usage
15751    fn usage_id_value(&self) -> u16 {
15752        u16::from(self)
15753    }
15754
15755    /// Returns this usage as [Usage::LightingAndIllumination(self)](Usage::LightingAndIllumination)
15756    /// This is a convenience function to avoid having
15757    /// to implement `From` for every used type in the caller.
15758    ///
15759    /// ```
15760    /// # use hut::*;
15761    /// let gd_x = GenericDesktop::X;
15762    /// let usage = Usage::from(GenericDesktop::X);
15763    /// assert!(matches!(gd_x.usage(), usage));
15764    /// ```
15765    fn usage(&self) -> Usage {
15766        Usage::from(self)
15767    }
15768}
15769
15770impl AsUsagePage for LightingAndIllumination {
15771    /// Returns the 16 bit value of this UsagePage
15772    ///
15773    /// This value is `0x59` for [LightingAndIllumination]
15774    fn usage_page_value(&self) -> u16 {
15775        let up = UsagePage::from(self);
15776        u16::from(up)
15777    }
15778
15779    /// Returns [UsagePage::LightingAndIllumination]]
15780    fn usage_page(&self) -> UsagePage {
15781        UsagePage::from(self)
15782    }
15783}
15784
15785impl From<&LightingAndIllumination> for u16 {
15786    fn from(lightingandillumination: &LightingAndIllumination) -> u16 {
15787        match *lightingandillumination {
15788            LightingAndIllumination::LampArray => 1,
15789            LightingAndIllumination::LampArrayAttributesReport => 2,
15790            LightingAndIllumination::LampCount => 3,
15791            LightingAndIllumination::BoundingBoxWidthInMicrometers => 4,
15792            LightingAndIllumination::BoundingBoxHeightInMicrometers => 5,
15793            LightingAndIllumination::BoundingBoxDepthInMicrometers => 6,
15794            LightingAndIllumination::LampArrayKind => 7,
15795            LightingAndIllumination::MinUpdateIntervalInMicroseconds => 8,
15796            LightingAndIllumination::LampAttributesRequestReport => 32,
15797            LightingAndIllumination::LampId => 33,
15798            LightingAndIllumination::LampAttributesResponseReport => 34,
15799            LightingAndIllumination::PositionXInMicrometers => 35,
15800            LightingAndIllumination::PositionYInMicrometers => 36,
15801            LightingAndIllumination::PositionZInMicrometers => 37,
15802            LightingAndIllumination::LampPurposes => 38,
15803            LightingAndIllumination::UpdateLatencyInMicroseconds => 39,
15804            LightingAndIllumination::RedLevelCount => 40,
15805            LightingAndIllumination::GreenLevelCount => 41,
15806            LightingAndIllumination::BlueLevelCount => 42,
15807            LightingAndIllumination::IntensityLevelCount => 43,
15808            LightingAndIllumination::IsProgrammable => 44,
15809            LightingAndIllumination::InputBinding => 45,
15810            LightingAndIllumination::LampMultiUpdateReport => 80,
15811            LightingAndIllumination::RedUpdateChannel => 81,
15812            LightingAndIllumination::GreenUpdateChannel => 82,
15813            LightingAndIllumination::BlueUpdateChannel => 83,
15814            LightingAndIllumination::IntensityUpdateChannel => 84,
15815            LightingAndIllumination::LampUpdateFlags => 85,
15816            LightingAndIllumination::LampRangeUpdateReport => 96,
15817            LightingAndIllumination::LampIdStart => 97,
15818            LightingAndIllumination::LampIdEnd => 98,
15819            LightingAndIllumination::LampArrayControlReport => 112,
15820            LightingAndIllumination::AutonomousMode => 113,
15821        }
15822    }
15823}
15824
15825impl From<LightingAndIllumination> for u16 {
15826    /// Returns the 16bit value of this usage. This is identical
15827    /// to [LightingAndIllumination::usage_page_value()].
15828    fn from(lightingandillumination: LightingAndIllumination) -> u16 {
15829        u16::from(&lightingandillumination)
15830    }
15831}
15832
15833impl From<&LightingAndIllumination> for u32 {
15834    /// Returns the 32 bit value of this usage. This is identical
15835    /// to [LightingAndIllumination::usage_value()].
15836    fn from(lightingandillumination: &LightingAndIllumination) -> u32 {
15837        let up = UsagePage::from(lightingandillumination);
15838        let up = (u16::from(&up) as u32) << 16;
15839        let id = u16::from(lightingandillumination) as u32;
15840        up | id
15841    }
15842}
15843
15844impl From<&LightingAndIllumination> for UsagePage {
15845    /// Always returns [UsagePage::LightingAndIllumination] and is
15846    /// identical to [LightingAndIllumination::usage_page()].
15847    fn from(_: &LightingAndIllumination) -> UsagePage {
15848        UsagePage::LightingAndIllumination
15849    }
15850}
15851
15852impl From<LightingAndIllumination> for UsagePage {
15853    /// Always returns [UsagePage::LightingAndIllumination] and is
15854    /// identical to [LightingAndIllumination::usage_page()].
15855    fn from(_: LightingAndIllumination) -> UsagePage {
15856        UsagePage::LightingAndIllumination
15857    }
15858}
15859
15860impl From<&LightingAndIllumination> for Usage {
15861    fn from(lightingandillumination: &LightingAndIllumination) -> Usage {
15862        Usage::try_from(u32::from(lightingandillumination)).unwrap()
15863    }
15864}
15865
15866impl From<LightingAndIllumination> for Usage {
15867    fn from(lightingandillumination: LightingAndIllumination) -> Usage {
15868        Usage::from(&lightingandillumination)
15869    }
15870}
15871
15872impl TryFrom<u16> for LightingAndIllumination {
15873    type Error = HutError;
15874
15875    fn try_from(usage_id: u16) -> Result<LightingAndIllumination> {
15876        match usage_id {
15877            1 => Ok(LightingAndIllumination::LampArray),
15878            2 => Ok(LightingAndIllumination::LampArrayAttributesReport),
15879            3 => Ok(LightingAndIllumination::LampCount),
15880            4 => Ok(LightingAndIllumination::BoundingBoxWidthInMicrometers),
15881            5 => Ok(LightingAndIllumination::BoundingBoxHeightInMicrometers),
15882            6 => Ok(LightingAndIllumination::BoundingBoxDepthInMicrometers),
15883            7 => Ok(LightingAndIllumination::LampArrayKind),
15884            8 => Ok(LightingAndIllumination::MinUpdateIntervalInMicroseconds),
15885            32 => Ok(LightingAndIllumination::LampAttributesRequestReport),
15886            33 => Ok(LightingAndIllumination::LampId),
15887            34 => Ok(LightingAndIllumination::LampAttributesResponseReport),
15888            35 => Ok(LightingAndIllumination::PositionXInMicrometers),
15889            36 => Ok(LightingAndIllumination::PositionYInMicrometers),
15890            37 => Ok(LightingAndIllumination::PositionZInMicrometers),
15891            38 => Ok(LightingAndIllumination::LampPurposes),
15892            39 => Ok(LightingAndIllumination::UpdateLatencyInMicroseconds),
15893            40 => Ok(LightingAndIllumination::RedLevelCount),
15894            41 => Ok(LightingAndIllumination::GreenLevelCount),
15895            42 => Ok(LightingAndIllumination::BlueLevelCount),
15896            43 => Ok(LightingAndIllumination::IntensityLevelCount),
15897            44 => Ok(LightingAndIllumination::IsProgrammable),
15898            45 => Ok(LightingAndIllumination::InputBinding),
15899            80 => Ok(LightingAndIllumination::LampMultiUpdateReport),
15900            81 => Ok(LightingAndIllumination::RedUpdateChannel),
15901            82 => Ok(LightingAndIllumination::GreenUpdateChannel),
15902            83 => Ok(LightingAndIllumination::BlueUpdateChannel),
15903            84 => Ok(LightingAndIllumination::IntensityUpdateChannel),
15904            85 => Ok(LightingAndIllumination::LampUpdateFlags),
15905            96 => Ok(LightingAndIllumination::LampRangeUpdateReport),
15906            97 => Ok(LightingAndIllumination::LampIdStart),
15907            98 => Ok(LightingAndIllumination::LampIdEnd),
15908            112 => Ok(LightingAndIllumination::LampArrayControlReport),
15909            113 => Ok(LightingAndIllumination::AutonomousMode),
15910            n => Err(HutError::UnknownUsageId { usage_id: n }),
15911        }
15912    }
15913}
15914
15915impl BitOr<u16> for LightingAndIllumination {
15916    type Output = Usage;
15917
15918    /// A convenience function to combine a Usage Page with
15919    /// a value.
15920    ///
15921    /// This function panics if the Usage ID value results in
15922    /// an unknown Usage. Where error checking is required,
15923    /// use [UsagePage::to_usage_from_value].
15924    fn bitor(self, usage: u16) -> Usage {
15925        let up = u16::from(self) as u32;
15926        let u = usage as u32;
15927        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
15928    }
15929}
15930
15931/// *Usage Page `0x80`: "Monitor"*
15932///
15933/// **This enum is autogenerated from the HID Usage Tables**.
15934/// ```
15935/// # use hut::*;
15936/// let u1 = Usage::Monitor(Monitor::EDIDInformation);
15937/// let u2 = Usage::new_from_page_and_id(0x80, 0x2).unwrap();
15938/// let u3 = Usage::from(Monitor::EDIDInformation);
15939/// let u4: Usage = Monitor::EDIDInformation.into();
15940/// assert_eq!(u1, u2);
15941/// assert_eq!(u1, u3);
15942/// assert_eq!(u1, u4);
15943///
15944/// assert!(matches!(u1.usage_page(), UsagePage::Monitor));
15945/// assert_eq!(0x80, u1.usage_page_value());
15946/// assert_eq!(0x2, u1.usage_id_value());
15947/// assert_eq!((0x80 << 16) | 0x2, u1.usage_value());
15948/// assert_eq!("EDID Information", u1.name());
15949/// ```
15950///
15951#[allow(non_camel_case_types)]
15952#[derive(Debug)]
15953#[non_exhaustive]
15954pub enum Monitor {
15955    /// Usage ID `0x1`: "Monitor Control"
15956    MonitorControl,
15957    /// Usage ID `0x2`: "EDID Information"
15958    EDIDInformation,
15959    /// Usage ID `0x3`: "VDIF Information"
15960    VDIFInformation,
15961    /// Usage ID `0x4`: "VESA Version"
15962    VESAVersion,
15963}
15964
15965impl Monitor {
15966    #[cfg(feature = "std")]
15967    pub fn name(&self) -> String {
15968        match self {
15969            Monitor::MonitorControl => "Monitor Control",
15970            Monitor::EDIDInformation => "EDID Information",
15971            Monitor::VDIFInformation => "VDIF Information",
15972            Monitor::VESAVersion => "VESA Version",
15973        }
15974        .into()
15975    }
15976}
15977
15978#[cfg(feature = "std")]
15979impl fmt::Display for Monitor {
15980    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15981        write!(f, "{}", self.name())
15982    }
15983}
15984
15985impl AsUsage for Monitor {
15986    /// Returns the 32 bit Usage value of this Usage
15987    fn usage_value(&self) -> u32 {
15988        u32::from(self)
15989    }
15990
15991    /// Returns the 16 bit Usage ID value of this Usage
15992    fn usage_id_value(&self) -> u16 {
15993        u16::from(self)
15994    }
15995
15996    /// Returns this usage as [Usage::Monitor(self)](Usage::Monitor)
15997    /// This is a convenience function to avoid having
15998    /// to implement `From` for every used type in the caller.
15999    ///
16000    /// ```
16001    /// # use hut::*;
16002    /// let gd_x = GenericDesktop::X;
16003    /// let usage = Usage::from(GenericDesktop::X);
16004    /// assert!(matches!(gd_x.usage(), usage));
16005    /// ```
16006    fn usage(&self) -> Usage {
16007        Usage::from(self)
16008    }
16009}
16010
16011impl AsUsagePage for Monitor {
16012    /// Returns the 16 bit value of this UsagePage
16013    ///
16014    /// This value is `0x80` for [Monitor]
16015    fn usage_page_value(&self) -> u16 {
16016        let up = UsagePage::from(self);
16017        u16::from(up)
16018    }
16019
16020    /// Returns [UsagePage::Monitor]]
16021    fn usage_page(&self) -> UsagePage {
16022        UsagePage::from(self)
16023    }
16024}
16025
16026impl From<&Monitor> for u16 {
16027    fn from(monitor: &Monitor) -> u16 {
16028        match *monitor {
16029            Monitor::MonitorControl => 1,
16030            Monitor::EDIDInformation => 2,
16031            Monitor::VDIFInformation => 3,
16032            Monitor::VESAVersion => 4,
16033        }
16034    }
16035}
16036
16037impl From<Monitor> for u16 {
16038    /// Returns the 16bit value of this usage. This is identical
16039    /// to [Monitor::usage_page_value()].
16040    fn from(monitor: Monitor) -> u16 {
16041        u16::from(&monitor)
16042    }
16043}
16044
16045impl From<&Monitor> for u32 {
16046    /// Returns the 32 bit value of this usage. This is identical
16047    /// to [Monitor::usage_value()].
16048    fn from(monitor: &Monitor) -> u32 {
16049        let up = UsagePage::from(monitor);
16050        let up = (u16::from(&up) as u32) << 16;
16051        let id = u16::from(monitor) as u32;
16052        up | id
16053    }
16054}
16055
16056impl From<&Monitor> for UsagePage {
16057    /// Always returns [UsagePage::Monitor] and is
16058    /// identical to [Monitor::usage_page()].
16059    fn from(_: &Monitor) -> UsagePage {
16060        UsagePage::Monitor
16061    }
16062}
16063
16064impl From<Monitor> for UsagePage {
16065    /// Always returns [UsagePage::Monitor] and is
16066    /// identical to [Monitor::usage_page()].
16067    fn from(_: Monitor) -> UsagePage {
16068        UsagePage::Monitor
16069    }
16070}
16071
16072impl From<&Monitor> for Usage {
16073    fn from(monitor: &Monitor) -> Usage {
16074        Usage::try_from(u32::from(monitor)).unwrap()
16075    }
16076}
16077
16078impl From<Monitor> for Usage {
16079    fn from(monitor: Monitor) -> Usage {
16080        Usage::from(&monitor)
16081    }
16082}
16083
16084impl TryFrom<u16> for Monitor {
16085    type Error = HutError;
16086
16087    fn try_from(usage_id: u16) -> Result<Monitor> {
16088        match usage_id {
16089            1 => Ok(Monitor::MonitorControl),
16090            2 => Ok(Monitor::EDIDInformation),
16091            3 => Ok(Monitor::VDIFInformation),
16092            4 => Ok(Monitor::VESAVersion),
16093            n => Err(HutError::UnknownUsageId { usage_id: n }),
16094        }
16095    }
16096}
16097
16098impl BitOr<u16> for Monitor {
16099    type Output = Usage;
16100
16101    /// A convenience function to combine a Usage Page with
16102    /// a value.
16103    ///
16104    /// This function panics if the Usage ID value results in
16105    /// an unknown Usage. Where error checking is required,
16106    /// use [UsagePage::to_usage_from_value].
16107    fn bitor(self, usage: u16) -> Usage {
16108        let up = u16::from(self) as u32;
16109        let u = usage as u32;
16110        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
16111    }
16112}
16113
16114/// *Usage Page `0x81`: "Monitor Enumerated"*
16115///
16116/// **This enum is autogenerated from the HID Usage Tables**.
16117///
16118/// This Usage Page is generated, not defined, any Usage IDs in this Usage
16119/// Page are simply the enumerate number.
16120///
16121/// ```
16122/// # use hut::*;
16123/// let u1 = Usage::MonitorEnumerated(MonitorEnumerated::MonitorEnumerated(3));
16124/// let u2 = Usage::new_from_page_and_id(0x81, 3).unwrap();
16125/// let u3 = Usage::from(MonitorEnumerated::MonitorEnumerated(3));
16126/// let u4: Usage = MonitorEnumerated::MonitorEnumerated(3).into();
16127/// assert_eq!(u1, u2);
16128/// assert_eq!(u1, u3);
16129/// assert_eq!(u1, u4);
16130///
16131/// assert!(matches!(u1.usage_page(), UsagePage::MonitorEnumerated));
16132/// assert_eq!(0x81, u1.usage_page_value());
16133/// assert_eq!(3, u1.usage_id_value());
16134/// assert_eq!((0x81 << 16) | 3, u1.usage_value());
16135/// assert_eq!("Enumerate 3", u1.name());
16136/// ```
16137#[allow(non_camel_case_types)]
16138#[derive(Debug)]
16139#[non_exhaustive]
16140pub enum MonitorEnumerated {
16141    MonitorEnumerated(u16),
16142}
16143
16144impl MonitorEnumerated {
16145    #[cfg(feature = "std")]
16146    pub fn name(&self) -> String {
16147        match self {
16148            MonitorEnumerated::MonitorEnumerated(enumerate) => format!("Enumerate {enumerate}"),
16149        }
16150    }
16151}
16152
16153#[cfg(feature = "std")]
16154impl fmt::Display for MonitorEnumerated {
16155    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16156        write!(f, "{}", self.name())
16157    }
16158}
16159
16160impl AsUsage for MonitorEnumerated {
16161    /// Returns the 32 bit Usage value of this Usage
16162    fn usage_value(&self) -> u32 {
16163        u32::from(self)
16164    }
16165
16166    /// Returns the 16 bit Usage ID value of this Usage
16167    fn usage_id_value(&self) -> u16 {
16168        u16::from(self)
16169    }
16170
16171    /// Returns this usage as [Usage::MonitorEnumerated(self)](Usage::MonitorEnumerated)
16172    /// This is a convenience function to avoid having
16173    /// to implement `From` for every used type in the caller.
16174    ///
16175    /// ```
16176    /// # use hut::*;
16177    /// let gd_x = GenericDesktop::X;
16178    /// let usage = Usage::from(GenericDesktop::X);
16179    /// assert!(matches!(gd_x.usage(), usage));
16180    /// ```
16181    fn usage(&self) -> Usage {
16182        Usage::from(self)
16183    }
16184}
16185
16186impl AsUsagePage for MonitorEnumerated {
16187    /// Returns the 16 bit value of this UsagePage
16188    ///
16189    /// This value is `0x81` for [MonitorEnumerated]
16190    fn usage_page_value(&self) -> u16 {
16191        let up = UsagePage::from(self);
16192        u16::from(up)
16193    }
16194
16195    /// Returns [UsagePage::MonitorEnumerated]]
16196    fn usage_page(&self) -> UsagePage {
16197        UsagePage::from(self)
16198    }
16199}
16200
16201impl From<&MonitorEnumerated> for u16 {
16202    fn from(monitorenumerated: &MonitorEnumerated) -> u16 {
16203        match *monitorenumerated {
16204            MonitorEnumerated::MonitorEnumerated(enumerate) => enumerate,
16205        }
16206    }
16207}
16208
16209impl From<MonitorEnumerated> for u16 {
16210    /// Returns the 16bit value of this usage. This is identical
16211    /// to [MonitorEnumerated::usage_page_value()].
16212    fn from(monitorenumerated: MonitorEnumerated) -> u16 {
16213        u16::from(&monitorenumerated)
16214    }
16215}
16216
16217impl From<&MonitorEnumerated> for u32 {
16218    /// Returns the 32 bit value of this usage. This is identical
16219    /// to [MonitorEnumerated::usage_value()].
16220    fn from(monitorenumerated: &MonitorEnumerated) -> u32 {
16221        let up = UsagePage::from(monitorenumerated);
16222        let up = (u16::from(&up) as u32) << 16;
16223        let id = u16::from(monitorenumerated) as u32;
16224        up | id
16225    }
16226}
16227
16228impl From<&MonitorEnumerated> for UsagePage {
16229    /// Always returns [UsagePage::MonitorEnumerated] and is
16230    /// identical to [MonitorEnumerated::usage_page()].
16231    fn from(_: &MonitorEnumerated) -> UsagePage {
16232        UsagePage::MonitorEnumerated
16233    }
16234}
16235
16236impl From<MonitorEnumerated> for UsagePage {
16237    /// Always returns [UsagePage::MonitorEnumerated] and is
16238    /// identical to [MonitorEnumerated::usage_page()].
16239    fn from(_: MonitorEnumerated) -> UsagePage {
16240        UsagePage::MonitorEnumerated
16241    }
16242}
16243
16244impl From<&MonitorEnumerated> for Usage {
16245    fn from(monitorenumerated: &MonitorEnumerated) -> Usage {
16246        Usage::try_from(u32::from(monitorenumerated)).unwrap()
16247    }
16248}
16249
16250impl From<MonitorEnumerated> for Usage {
16251    fn from(monitorenumerated: MonitorEnumerated) -> Usage {
16252        Usage::from(&monitorenumerated)
16253    }
16254}
16255
16256impl TryFrom<u16> for MonitorEnumerated {
16257    type Error = HutError;
16258
16259    fn try_from(usage_id: u16) -> Result<MonitorEnumerated> {
16260        match usage_id {
16261            n => Ok(MonitorEnumerated::MonitorEnumerated(n)),
16262        }
16263    }
16264}
16265
16266impl BitOr<u16> for MonitorEnumerated {
16267    type Output = Usage;
16268
16269    /// A convenience function to combine a Usage Page with
16270    /// a value.
16271    ///
16272    /// This function panics if the Usage ID value results in
16273    /// an unknown Usage. Where error checking is required,
16274    /// use [UsagePage::to_usage_from_value].
16275    fn bitor(self, usage: u16) -> Usage {
16276        let up = u16::from(self) as u32;
16277        let u = usage as u32;
16278        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
16279    }
16280}
16281
16282/// *Usage Page `0x82`: "VESA Virtual Controls"*
16283///
16284/// **This enum is autogenerated from the HID Usage Tables**.
16285/// ```
16286/// # use hut::*;
16287/// let u1 = Usage::VESAVirtualControls(VESAVirtualControls::Brightness);
16288/// let u2 = Usage::new_from_page_and_id(0x82, 0x10).unwrap();
16289/// let u3 = Usage::from(VESAVirtualControls::Brightness);
16290/// let u4: Usage = VESAVirtualControls::Brightness.into();
16291/// assert_eq!(u1, u2);
16292/// assert_eq!(u1, u3);
16293/// assert_eq!(u1, u4);
16294///
16295/// assert!(matches!(u1.usage_page(), UsagePage::VESAVirtualControls));
16296/// assert_eq!(0x82, u1.usage_page_value());
16297/// assert_eq!(0x10, u1.usage_id_value());
16298/// assert_eq!((0x82 << 16) | 0x10, u1.usage_value());
16299/// assert_eq!("Brightness", u1.name());
16300/// ```
16301///
16302#[allow(non_camel_case_types)]
16303#[derive(Debug)]
16304#[non_exhaustive]
16305pub enum VESAVirtualControls {
16306    /// Usage ID `0x1`: "Degauss"
16307    Degauss,
16308    /// Usage ID `0x10`: "Brightness"
16309    Brightness,
16310    /// Usage ID `0x12`: "Contrast"
16311    Contrast,
16312    /// Usage ID `0x16`: "Red Video Gain"
16313    RedVideoGain,
16314    /// Usage ID `0x18`: "Green Video Gain"
16315    GreenVideoGain,
16316    /// Usage ID `0x1A`: "Blue Video Gain"
16317    BlueVideoGain,
16318    /// Usage ID `0x1C`: "Focus"
16319    Focus,
16320    /// Usage ID `0x20`: "Horizontal Position"
16321    HorizontalPosition,
16322    /// Usage ID `0x22`: "Horizontal Size"
16323    HorizontalSize,
16324    /// Usage ID `0x24`: "Horizontal Pincushion"
16325    HorizontalPincushion,
16326    /// Usage ID `0x26`: "Horizontal Pincushion Balance"
16327    HorizontalPincushionBalance,
16328    /// Usage ID `0x28`: "Horizontal Misconvergence"
16329    HorizontalMisconvergence,
16330    /// Usage ID `0x2A`: "Horizontal Linearity"
16331    HorizontalLinearity,
16332    /// Usage ID `0x2C`: "Horizontal Linearity Balance"
16333    HorizontalLinearityBalance,
16334    /// Usage ID `0x30`: "Vertical Position"
16335    VerticalPosition,
16336    /// Usage ID `0x32`: "Vertical Size"
16337    VerticalSize,
16338    /// Usage ID `0x34`: "Vertical Pincushion"
16339    VerticalPincushion,
16340    /// Usage ID `0x36`: "Vertical Pincushion Balance"
16341    VerticalPincushionBalance,
16342    /// Usage ID `0x38`: "Vertical Misconvergence"
16343    VerticalMisconvergence,
16344    /// Usage ID `0x3A`: "Vertical Linearity"
16345    VerticalLinearity,
16346    /// Usage ID `0x3C`: "Vertical Linearity Balance"
16347    VerticalLinearityBalance,
16348    /// Usage ID `0x40`: "Parallelogram Distortion (Key Balance)"
16349    ParallelogramDistortionKeyBalance,
16350    /// Usage ID `0x42`: "Trapezoidal Distortion (Key)"
16351    TrapezoidalDistortionKey,
16352    /// Usage ID `0x44`: "Tilt (Rotation)"
16353    TiltRotation,
16354    /// Usage ID `0x46`: "Top Corner Distortion Control"
16355    TopCornerDistortionControl,
16356    /// Usage ID `0x48`: "Top Corner Distortion Balance"
16357    TopCornerDistortionBalance,
16358    /// Usage ID `0x4A`: "Bottom Corner Distortion Control"
16359    BottomCornerDistortionControl,
16360    /// Usage ID `0x4C`: "Bottom Corner Distortion Balance"
16361    BottomCornerDistortionBalance,
16362    /// Usage ID `0x56`: "Horizontal Moiré"
16363    HorizontalMoiré,
16364    /// Usage ID `0x58`: "Vertical Moiré"
16365    VerticalMoiré,
16366    /// Usage ID `0x5E`: "Input Level Select"
16367    InputLevelSelect,
16368    /// Usage ID `0x60`: "Input Source Select"
16369    InputSourceSelect,
16370    /// Usage ID `0x6C`: "Red Video Black Level"
16371    RedVideoBlackLevel,
16372    /// Usage ID `0x6E`: "Green Video Black Level"
16373    GreenVideoBlackLevel,
16374    /// Usage ID `0x70`: "Blue Video Black Level"
16375    BlueVideoBlackLevel,
16376    /// Usage ID `0xA2`: "Auto Size Center"
16377    AutoSizeCenter,
16378    /// Usage ID `0xA4`: "Polarity Horizontal Synchronization"
16379    PolarityHorizontalSynchronization,
16380    /// Usage ID `0xA6`: "Polarity Vertical Synchronization"
16381    PolarityVerticalSynchronization,
16382    /// Usage ID `0xA8`: "Synchronization Type"
16383    SynchronizationType,
16384    /// Usage ID `0xAA`: "Screen Orientation"
16385    ScreenOrientation,
16386    /// Usage ID `0xAC`: "Horizontal Frequency"
16387    HorizontalFrequency,
16388    /// Usage ID `0xAE`: "Vertical Frequency"
16389    VerticalFrequency,
16390    /// Usage ID `0xB0`: "Settings"
16391    Settings,
16392    /// Usage ID `0xCA`: "On Screen Display"
16393    OnScreenDisplay,
16394    /// Usage ID `0xD4`: "Stereo Mode"
16395    StereoMode,
16396}
16397
16398impl VESAVirtualControls {
16399    #[cfg(feature = "std")]
16400    pub fn name(&self) -> String {
16401        match self {
16402            VESAVirtualControls::Degauss => "Degauss",
16403            VESAVirtualControls::Brightness => "Brightness",
16404            VESAVirtualControls::Contrast => "Contrast",
16405            VESAVirtualControls::RedVideoGain => "Red Video Gain",
16406            VESAVirtualControls::GreenVideoGain => "Green Video Gain",
16407            VESAVirtualControls::BlueVideoGain => "Blue Video Gain",
16408            VESAVirtualControls::Focus => "Focus",
16409            VESAVirtualControls::HorizontalPosition => "Horizontal Position",
16410            VESAVirtualControls::HorizontalSize => "Horizontal Size",
16411            VESAVirtualControls::HorizontalPincushion => "Horizontal Pincushion",
16412            VESAVirtualControls::HorizontalPincushionBalance => "Horizontal Pincushion Balance",
16413            VESAVirtualControls::HorizontalMisconvergence => "Horizontal Misconvergence",
16414            VESAVirtualControls::HorizontalLinearity => "Horizontal Linearity",
16415            VESAVirtualControls::HorizontalLinearityBalance => "Horizontal Linearity Balance",
16416            VESAVirtualControls::VerticalPosition => "Vertical Position",
16417            VESAVirtualControls::VerticalSize => "Vertical Size",
16418            VESAVirtualControls::VerticalPincushion => "Vertical Pincushion",
16419            VESAVirtualControls::VerticalPincushionBalance => "Vertical Pincushion Balance",
16420            VESAVirtualControls::VerticalMisconvergence => "Vertical Misconvergence",
16421            VESAVirtualControls::VerticalLinearity => "Vertical Linearity",
16422            VESAVirtualControls::VerticalLinearityBalance => "Vertical Linearity Balance",
16423            VESAVirtualControls::ParallelogramDistortionKeyBalance => {
16424                "Parallelogram Distortion (Key Balance)"
16425            }
16426            VESAVirtualControls::TrapezoidalDistortionKey => "Trapezoidal Distortion (Key)",
16427            VESAVirtualControls::TiltRotation => "Tilt (Rotation)",
16428            VESAVirtualControls::TopCornerDistortionControl => "Top Corner Distortion Control",
16429            VESAVirtualControls::TopCornerDistortionBalance => "Top Corner Distortion Balance",
16430            VESAVirtualControls::BottomCornerDistortionControl => {
16431                "Bottom Corner Distortion Control"
16432            }
16433            VESAVirtualControls::BottomCornerDistortionBalance => {
16434                "Bottom Corner Distortion Balance"
16435            }
16436            VESAVirtualControls::HorizontalMoiré => "Horizontal Moiré",
16437            VESAVirtualControls::VerticalMoiré => "Vertical Moiré",
16438            VESAVirtualControls::InputLevelSelect => "Input Level Select",
16439            VESAVirtualControls::InputSourceSelect => "Input Source Select",
16440            VESAVirtualControls::RedVideoBlackLevel => "Red Video Black Level",
16441            VESAVirtualControls::GreenVideoBlackLevel => "Green Video Black Level",
16442            VESAVirtualControls::BlueVideoBlackLevel => "Blue Video Black Level",
16443            VESAVirtualControls::AutoSizeCenter => "Auto Size Center",
16444            VESAVirtualControls::PolarityHorizontalSynchronization => {
16445                "Polarity Horizontal Synchronization"
16446            }
16447            VESAVirtualControls::PolarityVerticalSynchronization => {
16448                "Polarity Vertical Synchronization"
16449            }
16450            VESAVirtualControls::SynchronizationType => "Synchronization Type",
16451            VESAVirtualControls::ScreenOrientation => "Screen Orientation",
16452            VESAVirtualControls::HorizontalFrequency => "Horizontal Frequency",
16453            VESAVirtualControls::VerticalFrequency => "Vertical Frequency",
16454            VESAVirtualControls::Settings => "Settings",
16455            VESAVirtualControls::OnScreenDisplay => "On Screen Display",
16456            VESAVirtualControls::StereoMode => "Stereo Mode",
16457        }
16458        .into()
16459    }
16460}
16461
16462#[cfg(feature = "std")]
16463impl fmt::Display for VESAVirtualControls {
16464    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16465        write!(f, "{}", self.name())
16466    }
16467}
16468
16469impl AsUsage for VESAVirtualControls {
16470    /// Returns the 32 bit Usage value of this Usage
16471    fn usage_value(&self) -> u32 {
16472        u32::from(self)
16473    }
16474
16475    /// Returns the 16 bit Usage ID value of this Usage
16476    fn usage_id_value(&self) -> u16 {
16477        u16::from(self)
16478    }
16479
16480    /// Returns this usage as [Usage::VESAVirtualControls(self)](Usage::VESAVirtualControls)
16481    /// This is a convenience function to avoid having
16482    /// to implement `From` for every used type in the caller.
16483    ///
16484    /// ```
16485    /// # use hut::*;
16486    /// let gd_x = GenericDesktop::X;
16487    /// let usage = Usage::from(GenericDesktop::X);
16488    /// assert!(matches!(gd_x.usage(), usage));
16489    /// ```
16490    fn usage(&self) -> Usage {
16491        Usage::from(self)
16492    }
16493}
16494
16495impl AsUsagePage for VESAVirtualControls {
16496    /// Returns the 16 bit value of this UsagePage
16497    ///
16498    /// This value is `0x82` for [VESAVirtualControls]
16499    fn usage_page_value(&self) -> u16 {
16500        let up = UsagePage::from(self);
16501        u16::from(up)
16502    }
16503
16504    /// Returns [UsagePage::VESAVirtualControls]]
16505    fn usage_page(&self) -> UsagePage {
16506        UsagePage::from(self)
16507    }
16508}
16509
16510impl From<&VESAVirtualControls> for u16 {
16511    fn from(vesavirtualcontrols: &VESAVirtualControls) -> u16 {
16512        match *vesavirtualcontrols {
16513            VESAVirtualControls::Degauss => 1,
16514            VESAVirtualControls::Brightness => 16,
16515            VESAVirtualControls::Contrast => 18,
16516            VESAVirtualControls::RedVideoGain => 22,
16517            VESAVirtualControls::GreenVideoGain => 24,
16518            VESAVirtualControls::BlueVideoGain => 26,
16519            VESAVirtualControls::Focus => 28,
16520            VESAVirtualControls::HorizontalPosition => 32,
16521            VESAVirtualControls::HorizontalSize => 34,
16522            VESAVirtualControls::HorizontalPincushion => 36,
16523            VESAVirtualControls::HorizontalPincushionBalance => 38,
16524            VESAVirtualControls::HorizontalMisconvergence => 40,
16525            VESAVirtualControls::HorizontalLinearity => 42,
16526            VESAVirtualControls::HorizontalLinearityBalance => 44,
16527            VESAVirtualControls::VerticalPosition => 48,
16528            VESAVirtualControls::VerticalSize => 50,
16529            VESAVirtualControls::VerticalPincushion => 52,
16530            VESAVirtualControls::VerticalPincushionBalance => 54,
16531            VESAVirtualControls::VerticalMisconvergence => 56,
16532            VESAVirtualControls::VerticalLinearity => 58,
16533            VESAVirtualControls::VerticalLinearityBalance => 60,
16534            VESAVirtualControls::ParallelogramDistortionKeyBalance => 64,
16535            VESAVirtualControls::TrapezoidalDistortionKey => 66,
16536            VESAVirtualControls::TiltRotation => 68,
16537            VESAVirtualControls::TopCornerDistortionControl => 70,
16538            VESAVirtualControls::TopCornerDistortionBalance => 72,
16539            VESAVirtualControls::BottomCornerDistortionControl => 74,
16540            VESAVirtualControls::BottomCornerDistortionBalance => 76,
16541            VESAVirtualControls::HorizontalMoiré => 86,
16542            VESAVirtualControls::VerticalMoiré => 88,
16543            VESAVirtualControls::InputLevelSelect => 94,
16544            VESAVirtualControls::InputSourceSelect => 96,
16545            VESAVirtualControls::RedVideoBlackLevel => 108,
16546            VESAVirtualControls::GreenVideoBlackLevel => 110,
16547            VESAVirtualControls::BlueVideoBlackLevel => 112,
16548            VESAVirtualControls::AutoSizeCenter => 162,
16549            VESAVirtualControls::PolarityHorizontalSynchronization => 164,
16550            VESAVirtualControls::PolarityVerticalSynchronization => 166,
16551            VESAVirtualControls::SynchronizationType => 168,
16552            VESAVirtualControls::ScreenOrientation => 170,
16553            VESAVirtualControls::HorizontalFrequency => 172,
16554            VESAVirtualControls::VerticalFrequency => 174,
16555            VESAVirtualControls::Settings => 176,
16556            VESAVirtualControls::OnScreenDisplay => 202,
16557            VESAVirtualControls::StereoMode => 212,
16558        }
16559    }
16560}
16561
16562impl From<VESAVirtualControls> for u16 {
16563    /// Returns the 16bit value of this usage. This is identical
16564    /// to [VESAVirtualControls::usage_page_value()].
16565    fn from(vesavirtualcontrols: VESAVirtualControls) -> u16 {
16566        u16::from(&vesavirtualcontrols)
16567    }
16568}
16569
16570impl From<&VESAVirtualControls> for u32 {
16571    /// Returns the 32 bit value of this usage. This is identical
16572    /// to [VESAVirtualControls::usage_value()].
16573    fn from(vesavirtualcontrols: &VESAVirtualControls) -> u32 {
16574        let up = UsagePage::from(vesavirtualcontrols);
16575        let up = (u16::from(&up) as u32) << 16;
16576        let id = u16::from(vesavirtualcontrols) as u32;
16577        up | id
16578    }
16579}
16580
16581impl From<&VESAVirtualControls> for UsagePage {
16582    /// Always returns [UsagePage::VESAVirtualControls] and is
16583    /// identical to [VESAVirtualControls::usage_page()].
16584    fn from(_: &VESAVirtualControls) -> UsagePage {
16585        UsagePage::VESAVirtualControls
16586    }
16587}
16588
16589impl From<VESAVirtualControls> for UsagePage {
16590    /// Always returns [UsagePage::VESAVirtualControls] and is
16591    /// identical to [VESAVirtualControls::usage_page()].
16592    fn from(_: VESAVirtualControls) -> UsagePage {
16593        UsagePage::VESAVirtualControls
16594    }
16595}
16596
16597impl From<&VESAVirtualControls> for Usage {
16598    fn from(vesavirtualcontrols: &VESAVirtualControls) -> Usage {
16599        Usage::try_from(u32::from(vesavirtualcontrols)).unwrap()
16600    }
16601}
16602
16603impl From<VESAVirtualControls> for Usage {
16604    fn from(vesavirtualcontrols: VESAVirtualControls) -> Usage {
16605        Usage::from(&vesavirtualcontrols)
16606    }
16607}
16608
16609impl TryFrom<u16> for VESAVirtualControls {
16610    type Error = HutError;
16611
16612    fn try_from(usage_id: u16) -> Result<VESAVirtualControls> {
16613        match usage_id {
16614            1 => Ok(VESAVirtualControls::Degauss),
16615            16 => Ok(VESAVirtualControls::Brightness),
16616            18 => Ok(VESAVirtualControls::Contrast),
16617            22 => Ok(VESAVirtualControls::RedVideoGain),
16618            24 => Ok(VESAVirtualControls::GreenVideoGain),
16619            26 => Ok(VESAVirtualControls::BlueVideoGain),
16620            28 => Ok(VESAVirtualControls::Focus),
16621            32 => Ok(VESAVirtualControls::HorizontalPosition),
16622            34 => Ok(VESAVirtualControls::HorizontalSize),
16623            36 => Ok(VESAVirtualControls::HorizontalPincushion),
16624            38 => Ok(VESAVirtualControls::HorizontalPincushionBalance),
16625            40 => Ok(VESAVirtualControls::HorizontalMisconvergence),
16626            42 => Ok(VESAVirtualControls::HorizontalLinearity),
16627            44 => Ok(VESAVirtualControls::HorizontalLinearityBalance),
16628            48 => Ok(VESAVirtualControls::VerticalPosition),
16629            50 => Ok(VESAVirtualControls::VerticalSize),
16630            52 => Ok(VESAVirtualControls::VerticalPincushion),
16631            54 => Ok(VESAVirtualControls::VerticalPincushionBalance),
16632            56 => Ok(VESAVirtualControls::VerticalMisconvergence),
16633            58 => Ok(VESAVirtualControls::VerticalLinearity),
16634            60 => Ok(VESAVirtualControls::VerticalLinearityBalance),
16635            64 => Ok(VESAVirtualControls::ParallelogramDistortionKeyBalance),
16636            66 => Ok(VESAVirtualControls::TrapezoidalDistortionKey),
16637            68 => Ok(VESAVirtualControls::TiltRotation),
16638            70 => Ok(VESAVirtualControls::TopCornerDistortionControl),
16639            72 => Ok(VESAVirtualControls::TopCornerDistortionBalance),
16640            74 => Ok(VESAVirtualControls::BottomCornerDistortionControl),
16641            76 => Ok(VESAVirtualControls::BottomCornerDistortionBalance),
16642            86 => Ok(VESAVirtualControls::HorizontalMoiré),
16643            88 => Ok(VESAVirtualControls::VerticalMoiré),
16644            94 => Ok(VESAVirtualControls::InputLevelSelect),
16645            96 => Ok(VESAVirtualControls::InputSourceSelect),
16646            108 => Ok(VESAVirtualControls::RedVideoBlackLevel),
16647            110 => Ok(VESAVirtualControls::GreenVideoBlackLevel),
16648            112 => Ok(VESAVirtualControls::BlueVideoBlackLevel),
16649            162 => Ok(VESAVirtualControls::AutoSizeCenter),
16650            164 => Ok(VESAVirtualControls::PolarityHorizontalSynchronization),
16651            166 => Ok(VESAVirtualControls::PolarityVerticalSynchronization),
16652            168 => Ok(VESAVirtualControls::SynchronizationType),
16653            170 => Ok(VESAVirtualControls::ScreenOrientation),
16654            172 => Ok(VESAVirtualControls::HorizontalFrequency),
16655            174 => Ok(VESAVirtualControls::VerticalFrequency),
16656            176 => Ok(VESAVirtualControls::Settings),
16657            202 => Ok(VESAVirtualControls::OnScreenDisplay),
16658            212 => Ok(VESAVirtualControls::StereoMode),
16659            n => Err(HutError::UnknownUsageId { usage_id: n }),
16660        }
16661    }
16662}
16663
16664impl BitOr<u16> for VESAVirtualControls {
16665    type Output = Usage;
16666
16667    /// A convenience function to combine a Usage Page with
16668    /// a value.
16669    ///
16670    /// This function panics if the Usage ID value results in
16671    /// an unknown Usage. Where error checking is required,
16672    /// use [UsagePage::to_usage_from_value].
16673    fn bitor(self, usage: u16) -> Usage {
16674        let up = u16::from(self) as u32;
16675        let u = usage as u32;
16676        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
16677    }
16678}
16679
16680/// *Usage Page `0x84`: "Power"*
16681///
16682/// **This enum is autogenerated from the HID Usage Tables**.
16683/// ```
16684/// # use hut::*;
16685/// let u1 = Usage::Power(Power::PresentStatus);
16686/// let u2 = Usage::new_from_page_and_id(0x84, 0x2).unwrap();
16687/// let u3 = Usage::from(Power::PresentStatus);
16688/// let u4: Usage = Power::PresentStatus.into();
16689/// assert_eq!(u1, u2);
16690/// assert_eq!(u1, u3);
16691/// assert_eq!(u1, u4);
16692///
16693/// assert!(matches!(u1.usage_page(), UsagePage::Power));
16694/// assert_eq!(0x84, u1.usage_page_value());
16695/// assert_eq!(0x2, u1.usage_id_value());
16696/// assert_eq!((0x84 << 16) | 0x2, u1.usage_value());
16697/// assert_eq!("Present Status", u1.name());
16698/// ```
16699///
16700#[allow(non_camel_case_types)]
16701#[derive(Debug)]
16702#[non_exhaustive]
16703pub enum Power {
16704    /// Usage ID `0x1`: "iName"
16705    iName,
16706    /// Usage ID `0x2`: "Present Status"
16707    PresentStatus,
16708    /// Usage ID `0x3`: "Changed Status"
16709    ChangedStatus,
16710    /// Usage ID `0x4`: "UPS"
16711    UPS,
16712    /// Usage ID `0x5`: "Power Supply"
16713    PowerSupply,
16714    /// Usage ID `0x10`: "Battery System"
16715    BatterySystem,
16716    /// Usage ID `0x11`: "Battery System Id"
16717    BatterySystemId,
16718    /// Usage ID `0x12`: "Battery"
16719    Battery,
16720    /// Usage ID `0x13`: "Battery Id"
16721    BatteryId,
16722    /// Usage ID `0x14`: "Charger"
16723    Charger,
16724    /// Usage ID `0x15`: "Charger Id"
16725    ChargerId,
16726    /// Usage ID `0x16`: "Power Converter"
16727    PowerConverter,
16728    /// Usage ID `0x17`: "Power Converter Id"
16729    PowerConverterId,
16730    /// Usage ID `0x18`: "Outlet System"
16731    OutletSystem,
16732    /// Usage ID `0x19`: "Outlet System Id"
16733    OutletSystemId,
16734    /// Usage ID `0x1A`: "Input"
16735    Input,
16736    /// Usage ID `0x1B`: "Input Id"
16737    InputId,
16738    /// Usage ID `0x1C`: "Output"
16739    Output,
16740    /// Usage ID `0x1D`: "Output Id"
16741    OutputId,
16742    /// Usage ID `0x1E`: "Flow"
16743    Flow,
16744    /// Usage ID `0x1F`: "Flow Id"
16745    FlowId,
16746    /// Usage ID `0x20`: "Outlet"
16747    Outlet,
16748    /// Usage ID `0x21`: "Outlet Id"
16749    OutletId,
16750    /// Usage ID `0x22`: "Gang"
16751    Gang,
16752    /// Usage ID `0x23`: "Gang Id"
16753    GangId,
16754    /// Usage ID `0x24`: "Power Summary"
16755    PowerSummary,
16756    /// Usage ID `0x25`: "Power Summary Id"
16757    PowerSummaryId,
16758    /// Usage ID `0x30`: "Voltage"
16759    Voltage,
16760    /// Usage ID `0x31`: "Current"
16761    Current,
16762    /// Usage ID `0x32`: "Frequency"
16763    Frequency,
16764    /// Usage ID `0x33`: "Apparent Power"
16765    ApparentPower,
16766    /// Usage ID `0x34`: "Active Power"
16767    ActivePower,
16768    /// Usage ID `0x35`: "Percent Load"
16769    PercentLoad,
16770    /// Usage ID `0x36`: "Temperature"
16771    Temperature,
16772    /// Usage ID `0x37`: "Humidity"
16773    Humidity,
16774    /// Usage ID `0x38`: "Bad Count"
16775    BadCount,
16776    /// Usage ID `0x40`: "Config Voltage"
16777    ConfigVoltage,
16778    /// Usage ID `0x41`: "Config Current"
16779    ConfigCurrent,
16780    /// Usage ID `0x42`: "Config Frequency"
16781    ConfigFrequency,
16782    /// Usage ID `0x43`: "Config Apparent Power"
16783    ConfigApparentPower,
16784    /// Usage ID `0x44`: "Config Active Power"
16785    ConfigActivePower,
16786    /// Usage ID `0x45`: "Config Percent Load"
16787    ConfigPercentLoad,
16788    /// Usage ID `0x46`: "Config Temperature"
16789    ConfigTemperature,
16790    /// Usage ID `0x47`: "Config Humidity"
16791    ConfigHumidity,
16792    /// Usage ID `0x50`: "Switch On Control"
16793    SwitchOnControl,
16794    /// Usage ID `0x51`: "Switch Off Control"
16795    SwitchOffControl,
16796    /// Usage ID `0x52`: "Toggle Control"
16797    ToggleControl,
16798    /// Usage ID `0x53`: "Low Voltage Transfer"
16799    LowVoltageTransfer,
16800    /// Usage ID `0x54`: "High Voltage Transfer"
16801    HighVoltageTransfer,
16802    /// Usage ID `0x55`: "Delay Before Reboot"
16803    DelayBeforeReboot,
16804    /// Usage ID `0x56`: "Delay Before Startup"
16805    DelayBeforeStartup,
16806    /// Usage ID `0x57`: "Delay Before Shutdown"
16807    DelayBeforeShutdown,
16808    /// Usage ID `0x58`: "Test"
16809    Test,
16810    /// Usage ID `0x59`: "Module Reset"
16811    ModuleReset,
16812    /// Usage ID `0x5A`: "Audible Alarm Control"
16813    AudibleAlarmControl,
16814    /// Usage ID `0x60`: "Present"
16815    Present,
16816    /// Usage ID `0x61`: "Good"
16817    Good,
16818    /// Usage ID `0x62`: "Internal Failure"
16819    InternalFailure,
16820    /// Usage ID `0x63`: "Voltag Out Of Range"
16821    VoltagOutOfRange,
16822    /// Usage ID `0x64`: "Frequency Out Of Range"
16823    FrequencyOutOfRange,
16824    /// Usage ID `0x65`: "Overload"
16825    Overload,
16826    /// Usage ID `0x66`: "Over Charged"
16827    OverCharged,
16828    /// Usage ID `0x67`: "Over Temperature"
16829    OverTemperature,
16830    /// Usage ID `0x68`: "Shutdown Requested"
16831    ShutdownRequested,
16832    /// Usage ID `0x69`: "Shutdown Imminent"
16833    ShutdownImminent,
16834    /// Usage ID `0x6B`: "Switch On/Off"
16835    SwitchOnOff,
16836    /// Usage ID `0x6C`: "Switchable"
16837    Switchable,
16838    /// Usage ID `0x6D`: "Used"
16839    Used,
16840    /// Usage ID `0x6E`: "Boost"
16841    Boost,
16842    /// Usage ID `0x6F`: "Buck"
16843    Buck,
16844    /// Usage ID `0x70`: "Initialized"
16845    Initialized,
16846    /// Usage ID `0x71`: "Tested"
16847    Tested,
16848    /// Usage ID `0x72`: "Awaiting Power"
16849    AwaitingPower,
16850    /// Usage ID `0x73`: "Communication Lost"
16851    CommunicationLost,
16852    /// Usage ID `0xFD`: "iManufacturer"
16853    iManufacturer,
16854    /// Usage ID `0xFE`: "iProduct"
16855    iProduct,
16856    /// Usage ID `0xFF`: "iSerialNumber"
16857    iSerialNumber,
16858}
16859
16860impl Power {
16861    #[cfg(feature = "std")]
16862    pub fn name(&self) -> String {
16863        match self {
16864            Power::iName => "iName",
16865            Power::PresentStatus => "Present Status",
16866            Power::ChangedStatus => "Changed Status",
16867            Power::UPS => "UPS",
16868            Power::PowerSupply => "Power Supply",
16869            Power::BatterySystem => "Battery System",
16870            Power::BatterySystemId => "Battery System Id",
16871            Power::Battery => "Battery",
16872            Power::BatteryId => "Battery Id",
16873            Power::Charger => "Charger",
16874            Power::ChargerId => "Charger Id",
16875            Power::PowerConverter => "Power Converter",
16876            Power::PowerConverterId => "Power Converter Id",
16877            Power::OutletSystem => "Outlet System",
16878            Power::OutletSystemId => "Outlet System Id",
16879            Power::Input => "Input",
16880            Power::InputId => "Input Id",
16881            Power::Output => "Output",
16882            Power::OutputId => "Output Id",
16883            Power::Flow => "Flow",
16884            Power::FlowId => "Flow Id",
16885            Power::Outlet => "Outlet",
16886            Power::OutletId => "Outlet Id",
16887            Power::Gang => "Gang",
16888            Power::GangId => "Gang Id",
16889            Power::PowerSummary => "Power Summary",
16890            Power::PowerSummaryId => "Power Summary Id",
16891            Power::Voltage => "Voltage",
16892            Power::Current => "Current",
16893            Power::Frequency => "Frequency",
16894            Power::ApparentPower => "Apparent Power",
16895            Power::ActivePower => "Active Power",
16896            Power::PercentLoad => "Percent Load",
16897            Power::Temperature => "Temperature",
16898            Power::Humidity => "Humidity",
16899            Power::BadCount => "Bad Count",
16900            Power::ConfigVoltage => "Config Voltage",
16901            Power::ConfigCurrent => "Config Current",
16902            Power::ConfigFrequency => "Config Frequency",
16903            Power::ConfigApparentPower => "Config Apparent Power",
16904            Power::ConfigActivePower => "Config Active Power",
16905            Power::ConfigPercentLoad => "Config Percent Load",
16906            Power::ConfigTemperature => "Config Temperature",
16907            Power::ConfigHumidity => "Config Humidity",
16908            Power::SwitchOnControl => "Switch On Control",
16909            Power::SwitchOffControl => "Switch Off Control",
16910            Power::ToggleControl => "Toggle Control",
16911            Power::LowVoltageTransfer => "Low Voltage Transfer",
16912            Power::HighVoltageTransfer => "High Voltage Transfer",
16913            Power::DelayBeforeReboot => "Delay Before Reboot",
16914            Power::DelayBeforeStartup => "Delay Before Startup",
16915            Power::DelayBeforeShutdown => "Delay Before Shutdown",
16916            Power::Test => "Test",
16917            Power::ModuleReset => "Module Reset",
16918            Power::AudibleAlarmControl => "Audible Alarm Control",
16919            Power::Present => "Present",
16920            Power::Good => "Good",
16921            Power::InternalFailure => "Internal Failure",
16922            Power::VoltagOutOfRange => "Voltag Out Of Range",
16923            Power::FrequencyOutOfRange => "Frequency Out Of Range",
16924            Power::Overload => "Overload",
16925            Power::OverCharged => "Over Charged",
16926            Power::OverTemperature => "Over Temperature",
16927            Power::ShutdownRequested => "Shutdown Requested",
16928            Power::ShutdownImminent => "Shutdown Imminent",
16929            Power::SwitchOnOff => "Switch On/Off",
16930            Power::Switchable => "Switchable",
16931            Power::Used => "Used",
16932            Power::Boost => "Boost",
16933            Power::Buck => "Buck",
16934            Power::Initialized => "Initialized",
16935            Power::Tested => "Tested",
16936            Power::AwaitingPower => "Awaiting Power",
16937            Power::CommunicationLost => "Communication Lost",
16938            Power::iManufacturer => "iManufacturer",
16939            Power::iProduct => "iProduct",
16940            Power::iSerialNumber => "iSerialNumber",
16941        }
16942        .into()
16943    }
16944}
16945
16946#[cfg(feature = "std")]
16947impl fmt::Display for Power {
16948    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16949        write!(f, "{}", self.name())
16950    }
16951}
16952
16953impl AsUsage for Power {
16954    /// Returns the 32 bit Usage value of this Usage
16955    fn usage_value(&self) -> u32 {
16956        u32::from(self)
16957    }
16958
16959    /// Returns the 16 bit Usage ID value of this Usage
16960    fn usage_id_value(&self) -> u16 {
16961        u16::from(self)
16962    }
16963
16964    /// Returns this usage as [Usage::Power(self)](Usage::Power)
16965    /// This is a convenience function to avoid having
16966    /// to implement `From` for every used type in the caller.
16967    ///
16968    /// ```
16969    /// # use hut::*;
16970    /// let gd_x = GenericDesktop::X;
16971    /// let usage = Usage::from(GenericDesktop::X);
16972    /// assert!(matches!(gd_x.usage(), usage));
16973    /// ```
16974    fn usage(&self) -> Usage {
16975        Usage::from(self)
16976    }
16977}
16978
16979impl AsUsagePage for Power {
16980    /// Returns the 16 bit value of this UsagePage
16981    ///
16982    /// This value is `0x84` for [Power]
16983    fn usage_page_value(&self) -> u16 {
16984        let up = UsagePage::from(self);
16985        u16::from(up)
16986    }
16987
16988    /// Returns [UsagePage::Power]]
16989    fn usage_page(&self) -> UsagePage {
16990        UsagePage::from(self)
16991    }
16992}
16993
16994impl From<&Power> for u16 {
16995    fn from(power: &Power) -> u16 {
16996        match *power {
16997            Power::iName => 1,
16998            Power::PresentStatus => 2,
16999            Power::ChangedStatus => 3,
17000            Power::UPS => 4,
17001            Power::PowerSupply => 5,
17002            Power::BatterySystem => 16,
17003            Power::BatterySystemId => 17,
17004            Power::Battery => 18,
17005            Power::BatteryId => 19,
17006            Power::Charger => 20,
17007            Power::ChargerId => 21,
17008            Power::PowerConverter => 22,
17009            Power::PowerConverterId => 23,
17010            Power::OutletSystem => 24,
17011            Power::OutletSystemId => 25,
17012            Power::Input => 26,
17013            Power::InputId => 27,
17014            Power::Output => 28,
17015            Power::OutputId => 29,
17016            Power::Flow => 30,
17017            Power::FlowId => 31,
17018            Power::Outlet => 32,
17019            Power::OutletId => 33,
17020            Power::Gang => 34,
17021            Power::GangId => 35,
17022            Power::PowerSummary => 36,
17023            Power::PowerSummaryId => 37,
17024            Power::Voltage => 48,
17025            Power::Current => 49,
17026            Power::Frequency => 50,
17027            Power::ApparentPower => 51,
17028            Power::ActivePower => 52,
17029            Power::PercentLoad => 53,
17030            Power::Temperature => 54,
17031            Power::Humidity => 55,
17032            Power::BadCount => 56,
17033            Power::ConfigVoltage => 64,
17034            Power::ConfigCurrent => 65,
17035            Power::ConfigFrequency => 66,
17036            Power::ConfigApparentPower => 67,
17037            Power::ConfigActivePower => 68,
17038            Power::ConfigPercentLoad => 69,
17039            Power::ConfigTemperature => 70,
17040            Power::ConfigHumidity => 71,
17041            Power::SwitchOnControl => 80,
17042            Power::SwitchOffControl => 81,
17043            Power::ToggleControl => 82,
17044            Power::LowVoltageTransfer => 83,
17045            Power::HighVoltageTransfer => 84,
17046            Power::DelayBeforeReboot => 85,
17047            Power::DelayBeforeStartup => 86,
17048            Power::DelayBeforeShutdown => 87,
17049            Power::Test => 88,
17050            Power::ModuleReset => 89,
17051            Power::AudibleAlarmControl => 90,
17052            Power::Present => 96,
17053            Power::Good => 97,
17054            Power::InternalFailure => 98,
17055            Power::VoltagOutOfRange => 99,
17056            Power::FrequencyOutOfRange => 100,
17057            Power::Overload => 101,
17058            Power::OverCharged => 102,
17059            Power::OverTemperature => 103,
17060            Power::ShutdownRequested => 104,
17061            Power::ShutdownImminent => 105,
17062            Power::SwitchOnOff => 107,
17063            Power::Switchable => 108,
17064            Power::Used => 109,
17065            Power::Boost => 110,
17066            Power::Buck => 111,
17067            Power::Initialized => 112,
17068            Power::Tested => 113,
17069            Power::AwaitingPower => 114,
17070            Power::CommunicationLost => 115,
17071            Power::iManufacturer => 253,
17072            Power::iProduct => 254,
17073            Power::iSerialNumber => 255,
17074        }
17075    }
17076}
17077
17078impl From<Power> for u16 {
17079    /// Returns the 16bit value of this usage. This is identical
17080    /// to [Power::usage_page_value()].
17081    fn from(power: Power) -> u16 {
17082        u16::from(&power)
17083    }
17084}
17085
17086impl From<&Power> for u32 {
17087    /// Returns the 32 bit value of this usage. This is identical
17088    /// to [Power::usage_value()].
17089    fn from(power: &Power) -> u32 {
17090        let up = UsagePage::from(power);
17091        let up = (u16::from(&up) as u32) << 16;
17092        let id = u16::from(power) as u32;
17093        up | id
17094    }
17095}
17096
17097impl From<&Power> for UsagePage {
17098    /// Always returns [UsagePage::Power] and is
17099    /// identical to [Power::usage_page()].
17100    fn from(_: &Power) -> UsagePage {
17101        UsagePage::Power
17102    }
17103}
17104
17105impl From<Power> for UsagePage {
17106    /// Always returns [UsagePage::Power] and is
17107    /// identical to [Power::usage_page()].
17108    fn from(_: Power) -> UsagePage {
17109        UsagePage::Power
17110    }
17111}
17112
17113impl From<&Power> for Usage {
17114    fn from(power: &Power) -> Usage {
17115        Usage::try_from(u32::from(power)).unwrap()
17116    }
17117}
17118
17119impl From<Power> for Usage {
17120    fn from(power: Power) -> Usage {
17121        Usage::from(&power)
17122    }
17123}
17124
17125impl TryFrom<u16> for Power {
17126    type Error = HutError;
17127
17128    fn try_from(usage_id: u16) -> Result<Power> {
17129        match usage_id {
17130            1 => Ok(Power::iName),
17131            2 => Ok(Power::PresentStatus),
17132            3 => Ok(Power::ChangedStatus),
17133            4 => Ok(Power::UPS),
17134            5 => Ok(Power::PowerSupply),
17135            16 => Ok(Power::BatterySystem),
17136            17 => Ok(Power::BatterySystemId),
17137            18 => Ok(Power::Battery),
17138            19 => Ok(Power::BatteryId),
17139            20 => Ok(Power::Charger),
17140            21 => Ok(Power::ChargerId),
17141            22 => Ok(Power::PowerConverter),
17142            23 => Ok(Power::PowerConverterId),
17143            24 => Ok(Power::OutletSystem),
17144            25 => Ok(Power::OutletSystemId),
17145            26 => Ok(Power::Input),
17146            27 => Ok(Power::InputId),
17147            28 => Ok(Power::Output),
17148            29 => Ok(Power::OutputId),
17149            30 => Ok(Power::Flow),
17150            31 => Ok(Power::FlowId),
17151            32 => Ok(Power::Outlet),
17152            33 => Ok(Power::OutletId),
17153            34 => Ok(Power::Gang),
17154            35 => Ok(Power::GangId),
17155            36 => Ok(Power::PowerSummary),
17156            37 => Ok(Power::PowerSummaryId),
17157            48 => Ok(Power::Voltage),
17158            49 => Ok(Power::Current),
17159            50 => Ok(Power::Frequency),
17160            51 => Ok(Power::ApparentPower),
17161            52 => Ok(Power::ActivePower),
17162            53 => Ok(Power::PercentLoad),
17163            54 => Ok(Power::Temperature),
17164            55 => Ok(Power::Humidity),
17165            56 => Ok(Power::BadCount),
17166            64 => Ok(Power::ConfigVoltage),
17167            65 => Ok(Power::ConfigCurrent),
17168            66 => Ok(Power::ConfigFrequency),
17169            67 => Ok(Power::ConfigApparentPower),
17170            68 => Ok(Power::ConfigActivePower),
17171            69 => Ok(Power::ConfigPercentLoad),
17172            70 => Ok(Power::ConfigTemperature),
17173            71 => Ok(Power::ConfigHumidity),
17174            80 => Ok(Power::SwitchOnControl),
17175            81 => Ok(Power::SwitchOffControl),
17176            82 => Ok(Power::ToggleControl),
17177            83 => Ok(Power::LowVoltageTransfer),
17178            84 => Ok(Power::HighVoltageTransfer),
17179            85 => Ok(Power::DelayBeforeReboot),
17180            86 => Ok(Power::DelayBeforeStartup),
17181            87 => Ok(Power::DelayBeforeShutdown),
17182            88 => Ok(Power::Test),
17183            89 => Ok(Power::ModuleReset),
17184            90 => Ok(Power::AudibleAlarmControl),
17185            96 => Ok(Power::Present),
17186            97 => Ok(Power::Good),
17187            98 => Ok(Power::InternalFailure),
17188            99 => Ok(Power::VoltagOutOfRange),
17189            100 => Ok(Power::FrequencyOutOfRange),
17190            101 => Ok(Power::Overload),
17191            102 => Ok(Power::OverCharged),
17192            103 => Ok(Power::OverTemperature),
17193            104 => Ok(Power::ShutdownRequested),
17194            105 => Ok(Power::ShutdownImminent),
17195            107 => Ok(Power::SwitchOnOff),
17196            108 => Ok(Power::Switchable),
17197            109 => Ok(Power::Used),
17198            110 => Ok(Power::Boost),
17199            111 => Ok(Power::Buck),
17200            112 => Ok(Power::Initialized),
17201            113 => Ok(Power::Tested),
17202            114 => Ok(Power::AwaitingPower),
17203            115 => Ok(Power::CommunicationLost),
17204            253 => Ok(Power::iManufacturer),
17205            254 => Ok(Power::iProduct),
17206            255 => Ok(Power::iSerialNumber),
17207            n => Err(HutError::UnknownUsageId { usage_id: n }),
17208        }
17209    }
17210}
17211
17212impl BitOr<u16> for Power {
17213    type Output = Usage;
17214
17215    /// A convenience function to combine a Usage Page with
17216    /// a value.
17217    ///
17218    /// This function panics if the Usage ID value results in
17219    /// an unknown Usage. Where error checking is required,
17220    /// use [UsagePage::to_usage_from_value].
17221    fn bitor(self, usage: u16) -> Usage {
17222        let up = u16::from(self) as u32;
17223        let u = usage as u32;
17224        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
17225    }
17226}
17227
17228/// *Usage Page `0x85`: "Battery System"*
17229///
17230/// **This enum is autogenerated from the HID Usage Tables**.
17231/// ```
17232/// # use hut::*;
17233/// let u1 = Usage::BatterySystem(BatterySystem::SmartBatteryBatteryStatus);
17234/// let u2 = Usage::new_from_page_and_id(0x85, 0x2).unwrap();
17235/// let u3 = Usage::from(BatterySystem::SmartBatteryBatteryStatus);
17236/// let u4: Usage = BatterySystem::SmartBatteryBatteryStatus.into();
17237/// assert_eq!(u1, u2);
17238/// assert_eq!(u1, u3);
17239/// assert_eq!(u1, u4);
17240///
17241/// assert!(matches!(u1.usage_page(), UsagePage::BatterySystem));
17242/// assert_eq!(0x85, u1.usage_page_value());
17243/// assert_eq!(0x2, u1.usage_id_value());
17244/// assert_eq!((0x85 << 16) | 0x2, u1.usage_value());
17245/// assert_eq!("Smart Battery Battery Status", u1.name());
17246/// ```
17247///
17248#[allow(non_camel_case_types)]
17249#[derive(Debug)]
17250#[non_exhaustive]
17251pub enum BatterySystem {
17252    /// Usage ID `0x1`: "Smart Battery Battery Mode"
17253    SmartBatteryBatteryMode,
17254    /// Usage ID `0x2`: "Smart Battery Battery Status"
17255    SmartBatteryBatteryStatus,
17256    /// Usage ID `0x3`: "Smart Battery Alarm Warning"
17257    SmartBatteryAlarmWarning,
17258    /// Usage ID `0x4`: "Smart Battery Charger Mode"
17259    SmartBatteryChargerMode,
17260    /// Usage ID `0x5`: "Smart Battery Charger Status"
17261    SmartBatteryChargerStatus,
17262    /// Usage ID `0x6`: "Smart Battery Charger Spec Info"
17263    SmartBatteryChargerSpecInfo,
17264    /// Usage ID `0x7`: "Smart Battery Selector State"
17265    SmartBatterySelectorState,
17266    /// Usage ID `0x8`: "Smart Battery Selector Presets"
17267    SmartBatterySelectorPresets,
17268    /// Usage ID `0x9`: "Smart Battery Selector Info"
17269    SmartBatterySelectorInfo,
17270    /// Usage ID `0x10`: "Optional Mfg Function 1"
17271    OptionalMfgFunction1,
17272    /// Usage ID `0x11`: "Optional Mfg Function 2"
17273    OptionalMfgFunction2,
17274    /// Usage ID `0x12`: "Optional Mfg Function 3"
17275    OptionalMfgFunction3,
17276    /// Usage ID `0x13`: "Optional Mfg Function 4"
17277    OptionalMfgFunction4,
17278    /// Usage ID `0x14`: "Optional Mfg Function 5"
17279    OptionalMfgFunction5,
17280    /// Usage ID `0x15`: "Connection To SM Bus"
17281    ConnectionToSMBus,
17282    /// Usage ID `0x16`: "Output Connection"
17283    OutputConnection,
17284    /// Usage ID `0x17`: "Charger Connection"
17285    ChargerConnection,
17286    /// Usage ID `0x18`: "Battery Insertion"
17287    BatteryInsertion,
17288    /// Usage ID `0x19`: "Use Next"
17289    UseNext,
17290    /// Usage ID `0x1A`: "OK To Use"
17291    OKToUse,
17292    /// Usage ID `0x1B`: "Battery Supported"
17293    BatterySupported,
17294    /// Usage ID `0x1C`: "Selector Revision"
17295    SelectorRevision,
17296    /// Usage ID `0x1D`: "Charging Indicator"
17297    ChargingIndicator,
17298    /// Usage ID `0x28`: "Manufacturer Access"
17299    ManufacturerAccess,
17300    /// Usage ID `0x29`: "Remaining Capacity Limit"
17301    RemainingCapacityLimit,
17302    /// Usage ID `0x2A`: "Remaining Time Limit"
17303    RemainingTimeLimit,
17304    /// Usage ID `0x2B`: "At Rate"
17305    AtRate,
17306    /// Usage ID `0x2C`: "Capacity Mode"
17307    CapacityMode,
17308    /// Usage ID `0x2D`: "Broadcast To Charger"
17309    BroadcastToCharger,
17310    /// Usage ID `0x2E`: "Primary Battery"
17311    PrimaryBattery,
17312    /// Usage ID `0x2F`: "Charge Controller"
17313    ChargeController,
17314    /// Usage ID `0x40`: "Terminate Charge"
17315    TerminateCharge,
17316    /// Usage ID `0x41`: "Terminate Discharge"
17317    TerminateDischarge,
17318    /// Usage ID `0x42`: "Below Remaining Capacity Limit"
17319    BelowRemainingCapacityLimit,
17320    /// Usage ID `0x43`: "Remaining Time Limit Expired"
17321    RemainingTimeLimitExpired,
17322    /// Usage ID `0x44`: "Charging"
17323    Charging,
17324    /// Usage ID `0x45`: "Discharging"
17325    Discharging,
17326    /// Usage ID `0x46`: "Fully Charged"
17327    FullyCharged,
17328    /// Usage ID `0x47`: "Fully Discharged"
17329    FullyDischarged,
17330    /// Usage ID `0x48`: "Conditioning Flag"
17331    ConditioningFlag,
17332    /// Usage ID `0x49`: "At Rate OK"
17333    AtRateOK,
17334    /// Usage ID `0x4A`: "Smart Battery Error Code"
17335    SmartBatteryErrorCode,
17336    /// Usage ID `0x4B`: "Need Replacement"
17337    NeedReplacement,
17338    /// Usage ID `0x60`: "At Rate Time To Full"
17339    AtRateTimeToFull,
17340    /// Usage ID `0x61`: "At Rate Time To Empty"
17341    AtRateTimeToEmpty,
17342    /// Usage ID `0x62`: "Average Current"
17343    AverageCurrent,
17344    /// Usage ID `0x63`: "Max Error"
17345    MaxError,
17346    /// Usage ID `0x64`: "Relative State Of Charge"
17347    RelativeStateOfCharge,
17348    /// Usage ID `0x65`: "Absolute State Of Charge"
17349    AbsoluteStateOfCharge,
17350    /// Usage ID `0x66`: "Remaining Capacity"
17351    RemainingCapacity,
17352    /// Usage ID `0x67`: "Full Charge Capacity"
17353    FullChargeCapacity,
17354    /// Usage ID `0x68`: "Run Time To Empty"
17355    RunTimeToEmpty,
17356    /// Usage ID `0x69`: "Average Time To Empty"
17357    AverageTimeToEmpty,
17358    /// Usage ID `0x6A`: "Average Time To Full"
17359    AverageTimeToFull,
17360    /// Usage ID `0x6B`: "Cycle Count"
17361    CycleCount,
17362    /// Usage ID `0x80`: "Battery Pack Model Level"
17363    BatteryPackModelLevel,
17364    /// Usage ID `0x81`: "Internal Charge Controller"
17365    InternalChargeController,
17366    /// Usage ID `0x82`: "Primary Battery Support"
17367    PrimaryBatterySupport,
17368    /// Usage ID `0x83`: "Design Capacity"
17369    DesignCapacity,
17370    /// Usage ID `0x84`: "Specification Info"
17371    SpecificationInfo,
17372    /// Usage ID `0x85`: "Manufacture Date"
17373    ManufactureDate,
17374    /// Usage ID `0x86`: "Serial Number"
17375    SerialNumber,
17376    /// Usage ID `0x87`: "iManufacturer Name"
17377    iManufacturerName,
17378    /// Usage ID `0x88`: "iDevice Name"
17379    iDeviceName,
17380    /// Usage ID `0x89`: "iDevice Chemistry"
17381    iDeviceChemistry,
17382    /// Usage ID `0x8A`: "Manufacturer Data"
17383    ManufacturerData,
17384    /// Usage ID `0x8B`: "Rechargable"
17385    Rechargable,
17386    /// Usage ID `0x8C`: "Warning Capacity Limit"
17387    WarningCapacityLimit,
17388    /// Usage ID `0x8D`: "Capacity Granularity 1"
17389    CapacityGranularity1,
17390    /// Usage ID `0x8E`: "Capacity Granularity 2"
17391    CapacityGranularity2,
17392    /// Usage ID `0x8F`: "iOEM Information"
17393    iOEMInformation,
17394    /// Usage ID `0xC0`: "Inhibit Charge"
17395    InhibitCharge,
17396    /// Usage ID `0xC1`: "Enable Polling"
17397    EnablePolling,
17398    /// Usage ID `0xC2`: "Reset To Zero"
17399    ResetToZero,
17400    /// Usage ID `0xD0`: "AC Present"
17401    ACPresent,
17402    /// Usage ID `0xD1`: "Battery Present"
17403    BatteryPresent,
17404    /// Usage ID `0xD2`: "Power Fail"
17405    PowerFail,
17406    /// Usage ID `0xD3`: "Alarm Inhibited"
17407    AlarmInhibited,
17408    /// Usage ID `0xD4`: "Thermistor Under Range"
17409    ThermistorUnderRange,
17410    /// Usage ID `0xD5`: "Thermistor Hot"
17411    ThermistorHot,
17412    /// Usage ID `0xD6`: "Thermistor Cold"
17413    ThermistorCold,
17414    /// Usage ID `0xD7`: "Thermistor Over Range"
17415    ThermistorOverRange,
17416    /// Usage ID `0xD8`: "Voltage Out Of Range"
17417    VoltageOutOfRange,
17418    /// Usage ID `0xD9`: "Current Out Of Range"
17419    CurrentOutOfRange,
17420    /// Usage ID `0xDA`: "Current Not Regulated"
17421    CurrentNotRegulated,
17422    /// Usage ID `0xDB`: "Voltage Not Regulated"
17423    VoltageNotRegulated,
17424    /// Usage ID `0xDC`: "Master Mode"
17425    MasterMode,
17426    /// Usage ID `0xF0`: "Charger Selector Support"
17427    ChargerSelectorSupport,
17428    /// Usage ID `0xF1`: "Charger Spec"
17429    ChargerSpec,
17430    /// Usage ID `0xF2`: "Level 2"
17431    Level2,
17432    /// Usage ID `0xF3`: "Level 3"
17433    Level3,
17434}
17435
17436impl BatterySystem {
17437    #[cfg(feature = "std")]
17438    pub fn name(&self) -> String {
17439        match self {
17440            BatterySystem::SmartBatteryBatteryMode => "Smart Battery Battery Mode",
17441            BatterySystem::SmartBatteryBatteryStatus => "Smart Battery Battery Status",
17442            BatterySystem::SmartBatteryAlarmWarning => "Smart Battery Alarm Warning",
17443            BatterySystem::SmartBatteryChargerMode => "Smart Battery Charger Mode",
17444            BatterySystem::SmartBatteryChargerStatus => "Smart Battery Charger Status",
17445            BatterySystem::SmartBatteryChargerSpecInfo => "Smart Battery Charger Spec Info",
17446            BatterySystem::SmartBatterySelectorState => "Smart Battery Selector State",
17447            BatterySystem::SmartBatterySelectorPresets => "Smart Battery Selector Presets",
17448            BatterySystem::SmartBatterySelectorInfo => "Smart Battery Selector Info",
17449            BatterySystem::OptionalMfgFunction1 => "Optional Mfg Function 1",
17450            BatterySystem::OptionalMfgFunction2 => "Optional Mfg Function 2",
17451            BatterySystem::OptionalMfgFunction3 => "Optional Mfg Function 3",
17452            BatterySystem::OptionalMfgFunction4 => "Optional Mfg Function 4",
17453            BatterySystem::OptionalMfgFunction5 => "Optional Mfg Function 5",
17454            BatterySystem::ConnectionToSMBus => "Connection To SM Bus",
17455            BatterySystem::OutputConnection => "Output Connection",
17456            BatterySystem::ChargerConnection => "Charger Connection",
17457            BatterySystem::BatteryInsertion => "Battery Insertion",
17458            BatterySystem::UseNext => "Use Next",
17459            BatterySystem::OKToUse => "OK To Use",
17460            BatterySystem::BatterySupported => "Battery Supported",
17461            BatterySystem::SelectorRevision => "Selector Revision",
17462            BatterySystem::ChargingIndicator => "Charging Indicator",
17463            BatterySystem::ManufacturerAccess => "Manufacturer Access",
17464            BatterySystem::RemainingCapacityLimit => "Remaining Capacity Limit",
17465            BatterySystem::RemainingTimeLimit => "Remaining Time Limit",
17466            BatterySystem::AtRate => "At Rate",
17467            BatterySystem::CapacityMode => "Capacity Mode",
17468            BatterySystem::BroadcastToCharger => "Broadcast To Charger",
17469            BatterySystem::PrimaryBattery => "Primary Battery",
17470            BatterySystem::ChargeController => "Charge Controller",
17471            BatterySystem::TerminateCharge => "Terminate Charge",
17472            BatterySystem::TerminateDischarge => "Terminate Discharge",
17473            BatterySystem::BelowRemainingCapacityLimit => "Below Remaining Capacity Limit",
17474            BatterySystem::RemainingTimeLimitExpired => "Remaining Time Limit Expired",
17475            BatterySystem::Charging => "Charging",
17476            BatterySystem::Discharging => "Discharging",
17477            BatterySystem::FullyCharged => "Fully Charged",
17478            BatterySystem::FullyDischarged => "Fully Discharged",
17479            BatterySystem::ConditioningFlag => "Conditioning Flag",
17480            BatterySystem::AtRateOK => "At Rate OK",
17481            BatterySystem::SmartBatteryErrorCode => "Smart Battery Error Code",
17482            BatterySystem::NeedReplacement => "Need Replacement",
17483            BatterySystem::AtRateTimeToFull => "At Rate Time To Full",
17484            BatterySystem::AtRateTimeToEmpty => "At Rate Time To Empty",
17485            BatterySystem::AverageCurrent => "Average Current",
17486            BatterySystem::MaxError => "Max Error",
17487            BatterySystem::RelativeStateOfCharge => "Relative State Of Charge",
17488            BatterySystem::AbsoluteStateOfCharge => "Absolute State Of Charge",
17489            BatterySystem::RemainingCapacity => "Remaining Capacity",
17490            BatterySystem::FullChargeCapacity => "Full Charge Capacity",
17491            BatterySystem::RunTimeToEmpty => "Run Time To Empty",
17492            BatterySystem::AverageTimeToEmpty => "Average Time To Empty",
17493            BatterySystem::AverageTimeToFull => "Average Time To Full",
17494            BatterySystem::CycleCount => "Cycle Count",
17495            BatterySystem::BatteryPackModelLevel => "Battery Pack Model Level",
17496            BatterySystem::InternalChargeController => "Internal Charge Controller",
17497            BatterySystem::PrimaryBatterySupport => "Primary Battery Support",
17498            BatterySystem::DesignCapacity => "Design Capacity",
17499            BatterySystem::SpecificationInfo => "Specification Info",
17500            BatterySystem::ManufactureDate => "Manufacture Date",
17501            BatterySystem::SerialNumber => "Serial Number",
17502            BatterySystem::iManufacturerName => "iManufacturer Name",
17503            BatterySystem::iDeviceName => "iDevice Name",
17504            BatterySystem::iDeviceChemistry => "iDevice Chemistry",
17505            BatterySystem::ManufacturerData => "Manufacturer Data",
17506            BatterySystem::Rechargable => "Rechargable",
17507            BatterySystem::WarningCapacityLimit => "Warning Capacity Limit",
17508            BatterySystem::CapacityGranularity1 => "Capacity Granularity 1",
17509            BatterySystem::CapacityGranularity2 => "Capacity Granularity 2",
17510            BatterySystem::iOEMInformation => "iOEM Information",
17511            BatterySystem::InhibitCharge => "Inhibit Charge",
17512            BatterySystem::EnablePolling => "Enable Polling",
17513            BatterySystem::ResetToZero => "Reset To Zero",
17514            BatterySystem::ACPresent => "AC Present",
17515            BatterySystem::BatteryPresent => "Battery Present",
17516            BatterySystem::PowerFail => "Power Fail",
17517            BatterySystem::AlarmInhibited => "Alarm Inhibited",
17518            BatterySystem::ThermistorUnderRange => "Thermistor Under Range",
17519            BatterySystem::ThermistorHot => "Thermistor Hot",
17520            BatterySystem::ThermistorCold => "Thermistor Cold",
17521            BatterySystem::ThermistorOverRange => "Thermistor Over Range",
17522            BatterySystem::VoltageOutOfRange => "Voltage Out Of Range",
17523            BatterySystem::CurrentOutOfRange => "Current Out Of Range",
17524            BatterySystem::CurrentNotRegulated => "Current Not Regulated",
17525            BatterySystem::VoltageNotRegulated => "Voltage Not Regulated",
17526            BatterySystem::MasterMode => "Master Mode",
17527            BatterySystem::ChargerSelectorSupport => "Charger Selector Support",
17528            BatterySystem::ChargerSpec => "Charger Spec",
17529            BatterySystem::Level2 => "Level 2",
17530            BatterySystem::Level3 => "Level 3",
17531        }
17532        .into()
17533    }
17534}
17535
17536#[cfg(feature = "std")]
17537impl fmt::Display for BatterySystem {
17538    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
17539        write!(f, "{}", self.name())
17540    }
17541}
17542
17543impl AsUsage for BatterySystem {
17544    /// Returns the 32 bit Usage value of this Usage
17545    fn usage_value(&self) -> u32 {
17546        u32::from(self)
17547    }
17548
17549    /// Returns the 16 bit Usage ID value of this Usage
17550    fn usage_id_value(&self) -> u16 {
17551        u16::from(self)
17552    }
17553
17554    /// Returns this usage as [Usage::BatterySystem(self)](Usage::BatterySystem)
17555    /// This is a convenience function to avoid having
17556    /// to implement `From` for every used type in the caller.
17557    ///
17558    /// ```
17559    /// # use hut::*;
17560    /// let gd_x = GenericDesktop::X;
17561    /// let usage = Usage::from(GenericDesktop::X);
17562    /// assert!(matches!(gd_x.usage(), usage));
17563    /// ```
17564    fn usage(&self) -> Usage {
17565        Usage::from(self)
17566    }
17567}
17568
17569impl AsUsagePage for BatterySystem {
17570    /// Returns the 16 bit value of this UsagePage
17571    ///
17572    /// This value is `0x85` for [BatterySystem]
17573    fn usage_page_value(&self) -> u16 {
17574        let up = UsagePage::from(self);
17575        u16::from(up)
17576    }
17577
17578    /// Returns [UsagePage::BatterySystem]]
17579    fn usage_page(&self) -> UsagePage {
17580        UsagePage::from(self)
17581    }
17582}
17583
17584impl From<&BatterySystem> for u16 {
17585    fn from(batterysystem: &BatterySystem) -> u16 {
17586        match *batterysystem {
17587            BatterySystem::SmartBatteryBatteryMode => 1,
17588            BatterySystem::SmartBatteryBatteryStatus => 2,
17589            BatterySystem::SmartBatteryAlarmWarning => 3,
17590            BatterySystem::SmartBatteryChargerMode => 4,
17591            BatterySystem::SmartBatteryChargerStatus => 5,
17592            BatterySystem::SmartBatteryChargerSpecInfo => 6,
17593            BatterySystem::SmartBatterySelectorState => 7,
17594            BatterySystem::SmartBatterySelectorPresets => 8,
17595            BatterySystem::SmartBatterySelectorInfo => 9,
17596            BatterySystem::OptionalMfgFunction1 => 16,
17597            BatterySystem::OptionalMfgFunction2 => 17,
17598            BatterySystem::OptionalMfgFunction3 => 18,
17599            BatterySystem::OptionalMfgFunction4 => 19,
17600            BatterySystem::OptionalMfgFunction5 => 20,
17601            BatterySystem::ConnectionToSMBus => 21,
17602            BatterySystem::OutputConnection => 22,
17603            BatterySystem::ChargerConnection => 23,
17604            BatterySystem::BatteryInsertion => 24,
17605            BatterySystem::UseNext => 25,
17606            BatterySystem::OKToUse => 26,
17607            BatterySystem::BatterySupported => 27,
17608            BatterySystem::SelectorRevision => 28,
17609            BatterySystem::ChargingIndicator => 29,
17610            BatterySystem::ManufacturerAccess => 40,
17611            BatterySystem::RemainingCapacityLimit => 41,
17612            BatterySystem::RemainingTimeLimit => 42,
17613            BatterySystem::AtRate => 43,
17614            BatterySystem::CapacityMode => 44,
17615            BatterySystem::BroadcastToCharger => 45,
17616            BatterySystem::PrimaryBattery => 46,
17617            BatterySystem::ChargeController => 47,
17618            BatterySystem::TerminateCharge => 64,
17619            BatterySystem::TerminateDischarge => 65,
17620            BatterySystem::BelowRemainingCapacityLimit => 66,
17621            BatterySystem::RemainingTimeLimitExpired => 67,
17622            BatterySystem::Charging => 68,
17623            BatterySystem::Discharging => 69,
17624            BatterySystem::FullyCharged => 70,
17625            BatterySystem::FullyDischarged => 71,
17626            BatterySystem::ConditioningFlag => 72,
17627            BatterySystem::AtRateOK => 73,
17628            BatterySystem::SmartBatteryErrorCode => 74,
17629            BatterySystem::NeedReplacement => 75,
17630            BatterySystem::AtRateTimeToFull => 96,
17631            BatterySystem::AtRateTimeToEmpty => 97,
17632            BatterySystem::AverageCurrent => 98,
17633            BatterySystem::MaxError => 99,
17634            BatterySystem::RelativeStateOfCharge => 100,
17635            BatterySystem::AbsoluteStateOfCharge => 101,
17636            BatterySystem::RemainingCapacity => 102,
17637            BatterySystem::FullChargeCapacity => 103,
17638            BatterySystem::RunTimeToEmpty => 104,
17639            BatterySystem::AverageTimeToEmpty => 105,
17640            BatterySystem::AverageTimeToFull => 106,
17641            BatterySystem::CycleCount => 107,
17642            BatterySystem::BatteryPackModelLevel => 128,
17643            BatterySystem::InternalChargeController => 129,
17644            BatterySystem::PrimaryBatterySupport => 130,
17645            BatterySystem::DesignCapacity => 131,
17646            BatterySystem::SpecificationInfo => 132,
17647            BatterySystem::ManufactureDate => 133,
17648            BatterySystem::SerialNumber => 134,
17649            BatterySystem::iManufacturerName => 135,
17650            BatterySystem::iDeviceName => 136,
17651            BatterySystem::iDeviceChemistry => 137,
17652            BatterySystem::ManufacturerData => 138,
17653            BatterySystem::Rechargable => 139,
17654            BatterySystem::WarningCapacityLimit => 140,
17655            BatterySystem::CapacityGranularity1 => 141,
17656            BatterySystem::CapacityGranularity2 => 142,
17657            BatterySystem::iOEMInformation => 143,
17658            BatterySystem::InhibitCharge => 192,
17659            BatterySystem::EnablePolling => 193,
17660            BatterySystem::ResetToZero => 194,
17661            BatterySystem::ACPresent => 208,
17662            BatterySystem::BatteryPresent => 209,
17663            BatterySystem::PowerFail => 210,
17664            BatterySystem::AlarmInhibited => 211,
17665            BatterySystem::ThermistorUnderRange => 212,
17666            BatterySystem::ThermistorHot => 213,
17667            BatterySystem::ThermistorCold => 214,
17668            BatterySystem::ThermistorOverRange => 215,
17669            BatterySystem::VoltageOutOfRange => 216,
17670            BatterySystem::CurrentOutOfRange => 217,
17671            BatterySystem::CurrentNotRegulated => 218,
17672            BatterySystem::VoltageNotRegulated => 219,
17673            BatterySystem::MasterMode => 220,
17674            BatterySystem::ChargerSelectorSupport => 240,
17675            BatterySystem::ChargerSpec => 241,
17676            BatterySystem::Level2 => 242,
17677            BatterySystem::Level3 => 243,
17678        }
17679    }
17680}
17681
17682impl From<BatterySystem> for u16 {
17683    /// Returns the 16bit value of this usage. This is identical
17684    /// to [BatterySystem::usage_page_value()].
17685    fn from(batterysystem: BatterySystem) -> u16 {
17686        u16::from(&batterysystem)
17687    }
17688}
17689
17690impl From<&BatterySystem> for u32 {
17691    /// Returns the 32 bit value of this usage. This is identical
17692    /// to [BatterySystem::usage_value()].
17693    fn from(batterysystem: &BatterySystem) -> u32 {
17694        let up = UsagePage::from(batterysystem);
17695        let up = (u16::from(&up) as u32) << 16;
17696        let id = u16::from(batterysystem) as u32;
17697        up | id
17698    }
17699}
17700
17701impl From<&BatterySystem> for UsagePage {
17702    /// Always returns [UsagePage::BatterySystem] and is
17703    /// identical to [BatterySystem::usage_page()].
17704    fn from(_: &BatterySystem) -> UsagePage {
17705        UsagePage::BatterySystem
17706    }
17707}
17708
17709impl From<BatterySystem> for UsagePage {
17710    /// Always returns [UsagePage::BatterySystem] and is
17711    /// identical to [BatterySystem::usage_page()].
17712    fn from(_: BatterySystem) -> UsagePage {
17713        UsagePage::BatterySystem
17714    }
17715}
17716
17717impl From<&BatterySystem> for Usage {
17718    fn from(batterysystem: &BatterySystem) -> Usage {
17719        Usage::try_from(u32::from(batterysystem)).unwrap()
17720    }
17721}
17722
17723impl From<BatterySystem> for Usage {
17724    fn from(batterysystem: BatterySystem) -> Usage {
17725        Usage::from(&batterysystem)
17726    }
17727}
17728
17729impl TryFrom<u16> for BatterySystem {
17730    type Error = HutError;
17731
17732    fn try_from(usage_id: u16) -> Result<BatterySystem> {
17733        match usage_id {
17734            1 => Ok(BatterySystem::SmartBatteryBatteryMode),
17735            2 => Ok(BatterySystem::SmartBatteryBatteryStatus),
17736            3 => Ok(BatterySystem::SmartBatteryAlarmWarning),
17737            4 => Ok(BatterySystem::SmartBatteryChargerMode),
17738            5 => Ok(BatterySystem::SmartBatteryChargerStatus),
17739            6 => Ok(BatterySystem::SmartBatteryChargerSpecInfo),
17740            7 => Ok(BatterySystem::SmartBatterySelectorState),
17741            8 => Ok(BatterySystem::SmartBatterySelectorPresets),
17742            9 => Ok(BatterySystem::SmartBatterySelectorInfo),
17743            16 => Ok(BatterySystem::OptionalMfgFunction1),
17744            17 => Ok(BatterySystem::OptionalMfgFunction2),
17745            18 => Ok(BatterySystem::OptionalMfgFunction3),
17746            19 => Ok(BatterySystem::OptionalMfgFunction4),
17747            20 => Ok(BatterySystem::OptionalMfgFunction5),
17748            21 => Ok(BatterySystem::ConnectionToSMBus),
17749            22 => Ok(BatterySystem::OutputConnection),
17750            23 => Ok(BatterySystem::ChargerConnection),
17751            24 => Ok(BatterySystem::BatteryInsertion),
17752            25 => Ok(BatterySystem::UseNext),
17753            26 => Ok(BatterySystem::OKToUse),
17754            27 => Ok(BatterySystem::BatterySupported),
17755            28 => Ok(BatterySystem::SelectorRevision),
17756            29 => Ok(BatterySystem::ChargingIndicator),
17757            40 => Ok(BatterySystem::ManufacturerAccess),
17758            41 => Ok(BatterySystem::RemainingCapacityLimit),
17759            42 => Ok(BatterySystem::RemainingTimeLimit),
17760            43 => Ok(BatterySystem::AtRate),
17761            44 => Ok(BatterySystem::CapacityMode),
17762            45 => Ok(BatterySystem::BroadcastToCharger),
17763            46 => Ok(BatterySystem::PrimaryBattery),
17764            47 => Ok(BatterySystem::ChargeController),
17765            64 => Ok(BatterySystem::TerminateCharge),
17766            65 => Ok(BatterySystem::TerminateDischarge),
17767            66 => Ok(BatterySystem::BelowRemainingCapacityLimit),
17768            67 => Ok(BatterySystem::RemainingTimeLimitExpired),
17769            68 => Ok(BatterySystem::Charging),
17770            69 => Ok(BatterySystem::Discharging),
17771            70 => Ok(BatterySystem::FullyCharged),
17772            71 => Ok(BatterySystem::FullyDischarged),
17773            72 => Ok(BatterySystem::ConditioningFlag),
17774            73 => Ok(BatterySystem::AtRateOK),
17775            74 => Ok(BatterySystem::SmartBatteryErrorCode),
17776            75 => Ok(BatterySystem::NeedReplacement),
17777            96 => Ok(BatterySystem::AtRateTimeToFull),
17778            97 => Ok(BatterySystem::AtRateTimeToEmpty),
17779            98 => Ok(BatterySystem::AverageCurrent),
17780            99 => Ok(BatterySystem::MaxError),
17781            100 => Ok(BatterySystem::RelativeStateOfCharge),
17782            101 => Ok(BatterySystem::AbsoluteStateOfCharge),
17783            102 => Ok(BatterySystem::RemainingCapacity),
17784            103 => Ok(BatterySystem::FullChargeCapacity),
17785            104 => Ok(BatterySystem::RunTimeToEmpty),
17786            105 => Ok(BatterySystem::AverageTimeToEmpty),
17787            106 => Ok(BatterySystem::AverageTimeToFull),
17788            107 => Ok(BatterySystem::CycleCount),
17789            128 => Ok(BatterySystem::BatteryPackModelLevel),
17790            129 => Ok(BatterySystem::InternalChargeController),
17791            130 => Ok(BatterySystem::PrimaryBatterySupport),
17792            131 => Ok(BatterySystem::DesignCapacity),
17793            132 => Ok(BatterySystem::SpecificationInfo),
17794            133 => Ok(BatterySystem::ManufactureDate),
17795            134 => Ok(BatterySystem::SerialNumber),
17796            135 => Ok(BatterySystem::iManufacturerName),
17797            136 => Ok(BatterySystem::iDeviceName),
17798            137 => Ok(BatterySystem::iDeviceChemistry),
17799            138 => Ok(BatterySystem::ManufacturerData),
17800            139 => Ok(BatterySystem::Rechargable),
17801            140 => Ok(BatterySystem::WarningCapacityLimit),
17802            141 => Ok(BatterySystem::CapacityGranularity1),
17803            142 => Ok(BatterySystem::CapacityGranularity2),
17804            143 => Ok(BatterySystem::iOEMInformation),
17805            192 => Ok(BatterySystem::InhibitCharge),
17806            193 => Ok(BatterySystem::EnablePolling),
17807            194 => Ok(BatterySystem::ResetToZero),
17808            208 => Ok(BatterySystem::ACPresent),
17809            209 => Ok(BatterySystem::BatteryPresent),
17810            210 => Ok(BatterySystem::PowerFail),
17811            211 => Ok(BatterySystem::AlarmInhibited),
17812            212 => Ok(BatterySystem::ThermistorUnderRange),
17813            213 => Ok(BatterySystem::ThermistorHot),
17814            214 => Ok(BatterySystem::ThermistorCold),
17815            215 => Ok(BatterySystem::ThermistorOverRange),
17816            216 => Ok(BatterySystem::VoltageOutOfRange),
17817            217 => Ok(BatterySystem::CurrentOutOfRange),
17818            218 => Ok(BatterySystem::CurrentNotRegulated),
17819            219 => Ok(BatterySystem::VoltageNotRegulated),
17820            220 => Ok(BatterySystem::MasterMode),
17821            240 => Ok(BatterySystem::ChargerSelectorSupport),
17822            241 => Ok(BatterySystem::ChargerSpec),
17823            242 => Ok(BatterySystem::Level2),
17824            243 => Ok(BatterySystem::Level3),
17825            n => Err(HutError::UnknownUsageId { usage_id: n }),
17826        }
17827    }
17828}
17829
17830impl BitOr<u16> for BatterySystem {
17831    type Output = Usage;
17832
17833    /// A convenience function to combine a Usage Page with
17834    /// a value.
17835    ///
17836    /// This function panics if the Usage ID value results in
17837    /// an unknown Usage. Where error checking is required,
17838    /// use [UsagePage::to_usage_from_value].
17839    fn bitor(self, usage: u16) -> Usage {
17840        let up = u16::from(self) as u32;
17841        let u = usage as u32;
17842        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
17843    }
17844}
17845
17846/// *Usage Page `0x8C`: "Barcode Scanner"*
17847///
17848/// **This enum is autogenerated from the HID Usage Tables**.
17849/// ```
17850/// # use hut::*;
17851/// let u1 = Usage::BarcodeScanner(BarcodeScanner::BarcodeScanner);
17852/// let u2 = Usage::new_from_page_and_id(0x8C, 0x2).unwrap();
17853/// let u3 = Usage::from(BarcodeScanner::BarcodeScanner);
17854/// let u4: Usage = BarcodeScanner::BarcodeScanner.into();
17855/// assert_eq!(u1, u2);
17856/// assert_eq!(u1, u3);
17857/// assert_eq!(u1, u4);
17858///
17859/// assert!(matches!(u1.usage_page(), UsagePage::BarcodeScanner));
17860/// assert_eq!(0x8C, u1.usage_page_value());
17861/// assert_eq!(0x2, u1.usage_id_value());
17862/// assert_eq!((0x8C << 16) | 0x2, u1.usage_value());
17863/// assert_eq!("Barcode Scanner", u1.name());
17864/// ```
17865///
17866#[allow(non_camel_case_types)]
17867#[derive(Debug)]
17868#[non_exhaustive]
17869pub enum BarcodeScanner {
17870    /// Usage ID `0x1`: "Barcode Badge Reader"
17871    BarcodeBadgeReader,
17872    /// Usage ID `0x2`: "Barcode Scanner"
17873    BarcodeScanner,
17874    /// Usage ID `0x3`: "Dumb Bar Code Scanner"
17875    DumbBarCodeScanner,
17876    /// Usage ID `0x4`: "Cordless Scanner Base"
17877    CordlessScannerBase,
17878    /// Usage ID `0x5`: "Bar Code Scanner Cradle"
17879    BarCodeScannerCradle,
17880    /// Usage ID `0x10`: "Attribute Report"
17881    AttributeReport,
17882    /// Usage ID `0x11`: "Settings Report"
17883    SettingsReport,
17884    /// Usage ID `0x12`: "Scanned Data Report"
17885    ScannedDataReport,
17886    /// Usage ID `0x13`: "Raw Scanned Data Report"
17887    RawScannedDataReport,
17888    /// Usage ID `0x14`: "Trigger Report"
17889    TriggerReport,
17890    /// Usage ID `0x15`: "Status Report"
17891    StatusReport,
17892    /// Usage ID `0x16`: "UPC/EAN Control Report"
17893    UPCEANControlReport,
17894    /// Usage ID `0x17`: "EAN 2/3 Label Control Report"
17895    EAN23LabelControlReport,
17896    /// Usage ID `0x18`: "Code 39 Control Report"
17897    Code39ControlReport,
17898    /// Usage ID `0x19`: "Interleaved 2 of 5 Control Report"
17899    Interleaved2of5ControlReport,
17900    /// Usage ID `0x1A`: "Standard 2 of 5 Control Report"
17901    Standard2of5ControlReport,
17902    /// Usage ID `0x1B`: "MSI Plessey Control Report"
17903    MSIPlesseyControlReport,
17904    /// Usage ID `0x1C`: "Codabar Control Report"
17905    CodabarControlReport,
17906    /// Usage ID `0x1D`: "Code 128 Control Report"
17907    Code128ControlReport,
17908    /// Usage ID `0x1E`: "Misc 1D Control Report"
17909    Misc1DControlReport,
17910    /// Usage ID `0x1F`: "2D Control Report"
17911    TwoDControlReport,
17912    /// Usage ID `0x30`: "Aiming/Pointer Mode"
17913    AimingPointerMode,
17914    /// Usage ID `0x31`: "Bar Code Present Sensor"
17915    BarCodePresentSensor,
17916    /// Usage ID `0x32`: "Class 1A Laser"
17917    Class1ALaser,
17918    /// Usage ID `0x33`: "Class 2 Laser"
17919    Class2Laser,
17920    /// Usage ID `0x34`: "Heater Present"
17921    HeaterPresent,
17922    /// Usage ID `0x35`: "Contact Scanner"
17923    ContactScanner,
17924    /// Usage ID `0x36`: "Electronic Article Surveillance Notification"
17925    ElectronicArticleSurveillanceNotification,
17926    /// Usage ID `0x37`: "Constant Electronic Article Surveillance"
17927    ConstantElectronicArticleSurveillance,
17928    /// Usage ID `0x38`: "Error Indication"
17929    ErrorIndication,
17930    /// Usage ID `0x39`: "Fixed Beeper"
17931    FixedBeeper,
17932    /// Usage ID `0x3A`: "Good Decode Indication"
17933    GoodDecodeIndication,
17934    /// Usage ID `0x3B`: "Hands Free Scanning"
17935    HandsFreeScanning,
17936    /// Usage ID `0x3C`: "Intrinsically Safe"
17937    IntrinsicallySafe,
17938    /// Usage ID `0x3D`: "Klasse Eins Laser"
17939    KlasseEinsLaser,
17940    /// Usage ID `0x3E`: "Long Range Scanner"
17941    LongRangeScanner,
17942    /// Usage ID `0x3F`: "Mirror Speed Control"
17943    MirrorSpeedControl,
17944    /// Usage ID `0x40`: "Not On File Indication"
17945    NotOnFileIndication,
17946    /// Usage ID `0x41`: "Programmable Beeper"
17947    ProgrammableBeeper,
17948    /// Usage ID `0x42`: "Triggerless"
17949    Triggerless,
17950    /// Usage ID `0x43`: "Wand"
17951    Wand,
17952    /// Usage ID `0x44`: "Water Resistant"
17953    WaterResistant,
17954    /// Usage ID `0x45`: "Multi-Range Scanner"
17955    MultiRangeScanner,
17956    /// Usage ID `0x46`: "Proximity Sensor"
17957    ProximitySensor,
17958    /// Usage ID `0x4D`: "Fragment Decoding"
17959    FragmentDecoding,
17960    /// Usage ID `0x4E`: "Scanner Read Confidence"
17961    ScannerReadConfidence,
17962    /// Usage ID `0x4F`: "Data Prefix"
17963    DataPrefix,
17964    /// Usage ID `0x50`: "Prefix AIMI"
17965    PrefixAIMI,
17966    /// Usage ID `0x51`: "Prefix None"
17967    PrefixNone,
17968    /// Usage ID `0x52`: "Prefix Proprietary"
17969    PrefixProprietary,
17970    /// Usage ID `0x55`: "Active Time"
17971    ActiveTime,
17972    /// Usage ID `0x56`: "Aiming Laser Pattern"
17973    AimingLaserPattern,
17974    /// Usage ID `0x57`: "Bar Code Present"
17975    BarCodePresent,
17976    /// Usage ID `0x58`: "Beeper State"
17977    BeeperState,
17978    /// Usage ID `0x59`: "Laser On Time"
17979    LaserOnTime,
17980    /// Usage ID `0x5A`: "Laser State"
17981    LaserState,
17982    /// Usage ID `0x5B`: "Lockout Time"
17983    LockoutTime,
17984    /// Usage ID `0x5C`: "Motor State"
17985    MotorState,
17986    /// Usage ID `0x5D`: "Motor Timeout"
17987    MotorTimeout,
17988    /// Usage ID `0x5E`: "Power On Reset Scanner"
17989    PowerOnResetScanner,
17990    /// Usage ID `0x5F`: "Prevent Read of Barcodes"
17991    PreventReadofBarcodes,
17992    /// Usage ID `0x60`: "Initiate Barcode Read"
17993    InitiateBarcodeRead,
17994    /// Usage ID `0x61`: "Trigger State"
17995    TriggerState,
17996    /// Usage ID `0x62`: "Trigger Mode"
17997    TriggerMode,
17998    /// Usage ID `0x63`: "Trigger Mode Blinking Laser On"
17999    TriggerModeBlinkingLaserOn,
18000    /// Usage ID `0x64`: "Trigger Mode Continuous Laser On"
18001    TriggerModeContinuousLaserOn,
18002    /// Usage ID `0x65`: "Trigger Mode Laser on while Pulled"
18003    TriggerModeLaseronwhilePulled,
18004    /// Usage ID `0x66`: "Trigger Mode Laser stays on after release"
18005    TriggerModeLaserstaysonafterrelease,
18006    /// Usage ID `0x6D`: "Commit Parameters to NVM"
18007    CommitParameterstoNVM,
18008    /// Usage ID `0x6E`: "Parameter Scanning"
18009    ParameterScanning,
18010    /// Usage ID `0x6F`: "Parameters Changed"
18011    ParametersChanged,
18012    /// Usage ID `0x70`: "Set parameter default values"
18013    Setparameterdefaultvalues,
18014    /// Usage ID `0x75`: "Scanner In Cradle"
18015    ScannerInCradle,
18016    /// Usage ID `0x76`: "Scanner In Range"
18017    ScannerInRange,
18018    /// Usage ID `0x7A`: "Aim Duration"
18019    AimDuration,
18020    /// Usage ID `0x7B`: "Good Read Lamp Duration"
18021    GoodReadLampDuration,
18022    /// Usage ID `0x7C`: "Good Read Lamp Intensity"
18023    GoodReadLampIntensity,
18024    /// Usage ID `0x7D`: "Good Read LED"
18025    GoodReadLED,
18026    /// Usage ID `0x7E`: "Good Read Tone Frequency"
18027    GoodReadToneFrequency,
18028    /// Usage ID `0x7F`: "Good Read Tone Length"
18029    GoodReadToneLength,
18030    /// Usage ID `0x80`: "Good Read Tone Volume"
18031    GoodReadToneVolume,
18032    /// Usage ID `0x82`: "No Read Message"
18033    NoReadMessage,
18034    /// Usage ID `0x83`: "Not on File Volume"
18035    NotonFileVolume,
18036    /// Usage ID `0x84`: "Powerup Beep"
18037    PowerupBeep,
18038    /// Usage ID `0x85`: "Sound Error Beep"
18039    SoundErrorBeep,
18040    /// Usage ID `0x86`: "Sound Good Read Beep"
18041    SoundGoodReadBeep,
18042    /// Usage ID `0x87`: "Sound Not On File Beep"
18043    SoundNotOnFileBeep,
18044    /// Usage ID `0x88`: "Good Read When to Write"
18045    GoodReadWhentoWrite,
18046    /// Usage ID `0x89`: "GRWTI After Decode"
18047    GRWTIAfterDecode,
18048    /// Usage ID `0x8A`: "GRWTI Beep/Lamp after transmit"
18049    GRWTIBeepLampaftertransmit,
18050    /// Usage ID `0x8B`: "GRWTI No Beep/Lamp use at all"
18051    GRWTINoBeepLampuseatall,
18052    /// Usage ID `0x91`: "Bookland EAN"
18053    BooklandEAN,
18054    /// Usage ID `0x92`: "Convert EAN 8 to 13 Type"
18055    ConvertEAN8to13Type,
18056    /// Usage ID `0x93`: "Convert UPC A to EAN-13"
18057    ConvertUPCAtoEAN13,
18058    /// Usage ID `0x94`: "Convert UPC-E to A"
18059    ConvertUPCEtoA,
18060    /// Usage ID `0x95`: "EAN-13"
18061    EAN13,
18062    /// Usage ID `0x96`: "EAN-8"
18063    EAN8,
18064    /// Usage ID `0x97`: "EAN-99 128 Mandatory"
18065    EAN99128Mandatory,
18066    /// Usage ID `0x98`: "EAN-99 P5/128 Optional"
18067    EAN99P5128Optional,
18068    /// Usage ID `0x99`: "Enable EAN Two Label"
18069    EnableEANTwoLabel,
18070    /// Usage ID `0x9A`: "UPC/EAN"
18071    UPCEAN,
18072    /// Usage ID `0x9B`: "UPC/EAN Coupon Code"
18073    UPCEANCouponCode,
18074    /// Usage ID `0x9C`: "UPC/EAN Periodicals"
18075    UPCEANPeriodicals,
18076    /// Usage ID `0x9D`: "UPC-A"
18077    UPCA,
18078    /// Usage ID `0x9E`: "UPC-A with 128 Mandatory"
18079    UPCAwith128Mandatory,
18080    /// Usage ID `0x9F`: "UPC-A with 128 Optional"
18081    UPCAwith128Optional,
18082    /// Usage ID `0xA0`: "UPC-A with P5 Optional"
18083    UPCAwithP5Optional,
18084    /// Usage ID `0xA1`: "UPC-E"
18085    UPCE,
18086    /// Usage ID `0xA2`: "UPC-E1"
18087    UPCE1,
18088    /// Usage ID `0xA9`: "Periodical"
18089    Periodical,
18090    /// Usage ID `0xAA`: "Periodical Auto-Discriminate +2"
18091    PeriodicalAutoDiscriminatePlus2,
18092    /// Usage ID `0xAB`: "Periodical Only Decode with +2"
18093    PeriodicalOnlyDecodewithPlus2,
18094    /// Usage ID `0xAC`: "Periodical Ignore +2"
18095    PeriodicalIgnorePlus2,
18096    /// Usage ID `0xAD`: "Periodical Auto-Discriminate +5"
18097    PeriodicalAutoDiscriminatePlus5,
18098    /// Usage ID `0xAE`: "Periodical Only Decode with +5"
18099    PeriodicalOnlyDecodewithPlus5,
18100    /// Usage ID `0xAF`: "Periodical Ignore +5"
18101    PeriodicalIgnorePlus5,
18102    /// Usage ID `0xB0`: "Check"
18103    Check,
18104    /// Usage ID `0xB1`: "Check Disable Price"
18105    CheckDisablePrice,
18106    /// Usage ID `0xB2`: "Check Enable 4 digit Price"
18107    CheckEnable4digitPrice,
18108    /// Usage ID `0xB3`: "Check Enable 5 digit Price"
18109    CheckEnable5digitPrice,
18110    /// Usage ID `0xB4`: "Check Enable European 4 digit Price"
18111    CheckEnableEuropean4digitPrice,
18112    /// Usage ID `0xB5`: "Check Enable European 5 digit Price"
18113    CheckEnableEuropean5digitPrice,
18114    /// Usage ID `0xB7`: "EAN Two Label"
18115    EANTwoLabel,
18116    /// Usage ID `0xB8`: "EAN Three Label"
18117    EANThreeLabel,
18118    /// Usage ID `0xB9`: "EAN 8 Flag Digit 1"
18119    EAN8FlagDigit1,
18120    /// Usage ID `0xBA`: "EAN 8 Flag Digit 2"
18121    EAN8FlagDigit2,
18122    /// Usage ID `0xBB`: "EAN 8 Flag Digit 3"
18123    EAN8FlagDigit3,
18124    /// Usage ID `0xBC`: "EAN 13 Flag Digit 1"
18125    EAN13FlagDigit1,
18126    /// Usage ID `0xBD`: "EAN 13 Flag Digit 2"
18127    EAN13FlagDigit2,
18128    /// Usage ID `0xBE`: "EAN 13 Flag Digit 3"
18129    EAN13FlagDigit3,
18130    /// Usage ID `0xBF`: "Add EAN 2/3 Label Definition"
18131    AddEAN23LabelDefinition,
18132    /// Usage ID `0xC0`: "Clear all EAN 2/3 Label Definitions"
18133    ClearallEAN23LabelDefinitions,
18134    /// Usage ID `0xC3`: "Codabar"
18135    Codabar,
18136    /// Usage ID `0xC4`: "Code 128"
18137    Code128,
18138    /// Usage ID `0xC7`: "Code 39"
18139    Code39,
18140    /// Usage ID `0xC8`: "Code 93"
18141    Code93,
18142    /// Usage ID `0xC9`: "Full ASCII Conversion"
18143    FullASCIIConversion,
18144    /// Usage ID `0xCA`: "Interleaved 2 of 5"
18145    Interleaved2of5,
18146    /// Usage ID `0xCB`: "Italian Pharmacy Code"
18147    ItalianPharmacyCode,
18148    /// Usage ID `0xCC`: "MSI/Plessey"
18149    MSIPlessey,
18150    /// Usage ID `0xCD`: "Standard 2 of 5 IATA"
18151    Standard2of5IATA,
18152    /// Usage ID `0xCE`: "Standard 2 of 5"
18153    Standard2of5,
18154    /// Usage ID `0xD3`: "Transmit Start/Stop"
18155    TransmitStartStop,
18156    /// Usage ID `0xD4`: "Tri-Optic"
18157    TriOptic,
18158    /// Usage ID `0xD5`: "UCC/EAN-128"
18159    UCCEAN128,
18160    /// Usage ID `0xD6`: "Check Digit"
18161    CheckDigit,
18162    /// Usage ID `0xD7`: "Check Digit Disable"
18163    CheckDigitDisable,
18164    /// Usage ID `0xD8`: "Check Digit Enable Interleaved 2 of 5 OPCC"
18165    CheckDigitEnableInterleaved2of5OPCC,
18166    /// Usage ID `0xD9`: "Check Digit Enable Interleaved 2 of 5 USS"
18167    CheckDigitEnableInterleaved2of5USS,
18168    /// Usage ID `0xDA`: "Check Digit Enable Standard 2 of 5 OPCC"
18169    CheckDigitEnableStandard2of5OPCC,
18170    /// Usage ID `0xDB`: "Check Digit Enable Standard 2 of 5 USS"
18171    CheckDigitEnableStandard2of5USS,
18172    /// Usage ID `0xDC`: "Check Digit Enable One MSI Plessey"
18173    CheckDigitEnableOneMSIPlessey,
18174    /// Usage ID `0xDD`: "Check Digit Enable Two MSI Plessey"
18175    CheckDigitEnableTwoMSIPlessey,
18176    /// Usage ID `0xDE`: "Check Digit Codabar Enable"
18177    CheckDigitCodabarEnable,
18178    /// Usage ID `0xDF`: "Check Digit Code 39 Enable"
18179    CheckDigitCode39Enable,
18180    /// Usage ID `0xF0`: "Transmit Check Digit"
18181    TransmitCheckDigit,
18182    /// Usage ID `0xF1`: "Disable Check Digit Transmit"
18183    DisableCheckDigitTransmit,
18184    /// Usage ID `0xF2`: "Enable Check Digit Transmit"
18185    EnableCheckDigitTransmit,
18186    /// Usage ID `0xFB`: "Symbology Identifier 1"
18187    SymbologyIdentifier1,
18188    /// Usage ID `0xFC`: "Symbology Identifier 2"
18189    SymbologyIdentifier2,
18190    /// Usage ID `0xFD`: "Symbology Identifier 3"
18191    SymbologyIdentifier3,
18192    /// Usage ID `0xFE`: "Decoded Data"
18193    DecodedData,
18194    /// Usage ID `0xFF`: "Decode Data Continued"
18195    DecodeDataContinued,
18196    /// Usage ID `0x100`: "Bar Space Data"
18197    BarSpaceData,
18198    /// Usage ID `0x101`: "Scanner Data Accuracy"
18199    ScannerDataAccuracy,
18200    /// Usage ID `0x102`: "Raw Data Polarity"
18201    RawDataPolarity,
18202    /// Usage ID `0x103`: "Polarity Inverted Bar Code"
18203    PolarityInvertedBarCode,
18204    /// Usage ID `0x104`: "Polarity Normal Bar Code"
18205    PolarityNormalBarCode,
18206    /// Usage ID `0x106`: "Minimum Length to Decode"
18207    MinimumLengthtoDecode,
18208    /// Usage ID `0x107`: "Maximum Length to Decode"
18209    MaximumLengthtoDecode,
18210    /// Usage ID `0x108`: "Discrete Length to Decode 1"
18211    DiscreteLengthtoDecode1,
18212    /// Usage ID `0x109`: "Discrete Length to Decode 2"
18213    DiscreteLengthtoDecode2,
18214    /// Usage ID `0x10A`: "Data Length Method"
18215    DataLengthMethod,
18216    /// Usage ID `0x10B`: "DL Method Read any"
18217    DLMethodReadany,
18218    /// Usage ID `0x10C`: "DL Method Check in Range"
18219    DLMethodCheckinRange,
18220    /// Usage ID `0x10D`: "DL Method Check for Discrete"
18221    DLMethodCheckforDiscrete,
18222    /// Usage ID `0x110`: "Aztec Code"
18223    AztecCode,
18224    /// Usage ID `0x111`: "BC412"
18225    BC412,
18226    /// Usage ID `0x112`: "Channel Code"
18227    ChannelCode,
18228    /// Usage ID `0x113`: "Code 16"
18229    Code16,
18230    /// Usage ID `0x114`: "Code 32"
18231    Code32,
18232    /// Usage ID `0x115`: "Code 49"
18233    Code49,
18234    /// Usage ID `0x116`: "Code One"
18235    CodeOne,
18236    /// Usage ID `0x117`: "Colorcode"
18237    Colorcode,
18238    /// Usage ID `0x118`: "Data Matrix"
18239    DataMatrix,
18240    /// Usage ID `0x119`: "MaxiCode"
18241    MaxiCode,
18242    /// Usage ID `0x11A`: "MicroPDF"
18243    MicroPDF,
18244    /// Usage ID `0x11B`: "PDF-417"
18245    PDF417,
18246    /// Usage ID `0x11C`: "PosiCode"
18247    PosiCode,
18248    /// Usage ID `0x11D`: "QR Code"
18249    QRCode,
18250    /// Usage ID `0x11E`: "SuperCode"
18251    SuperCode,
18252    /// Usage ID `0x11F`: "UltraCode"
18253    UltraCode,
18254    /// Usage ID `0x120`: "USD-5 (Slug Code)"
18255    USD5SlugCode,
18256    /// Usage ID `0x121`: "VeriCode"
18257    VeriCode,
18258}
18259
18260impl BarcodeScanner {
18261    #[cfg(feature = "std")]
18262    pub fn name(&self) -> String {
18263        match self {
18264            BarcodeScanner::BarcodeBadgeReader => "Barcode Badge Reader",
18265            BarcodeScanner::BarcodeScanner => "Barcode Scanner",
18266            BarcodeScanner::DumbBarCodeScanner => "Dumb Bar Code Scanner",
18267            BarcodeScanner::CordlessScannerBase => "Cordless Scanner Base",
18268            BarcodeScanner::BarCodeScannerCradle => "Bar Code Scanner Cradle",
18269            BarcodeScanner::AttributeReport => "Attribute Report",
18270            BarcodeScanner::SettingsReport => "Settings Report",
18271            BarcodeScanner::ScannedDataReport => "Scanned Data Report",
18272            BarcodeScanner::RawScannedDataReport => "Raw Scanned Data Report",
18273            BarcodeScanner::TriggerReport => "Trigger Report",
18274            BarcodeScanner::StatusReport => "Status Report",
18275            BarcodeScanner::UPCEANControlReport => "UPC/EAN Control Report",
18276            BarcodeScanner::EAN23LabelControlReport => "EAN 2/3 Label Control Report",
18277            BarcodeScanner::Code39ControlReport => "Code 39 Control Report",
18278            BarcodeScanner::Interleaved2of5ControlReport => "Interleaved 2 of 5 Control Report",
18279            BarcodeScanner::Standard2of5ControlReport => "Standard 2 of 5 Control Report",
18280            BarcodeScanner::MSIPlesseyControlReport => "MSI Plessey Control Report",
18281            BarcodeScanner::CodabarControlReport => "Codabar Control Report",
18282            BarcodeScanner::Code128ControlReport => "Code 128 Control Report",
18283            BarcodeScanner::Misc1DControlReport => "Misc 1D Control Report",
18284            BarcodeScanner::TwoDControlReport => "2D Control Report",
18285            BarcodeScanner::AimingPointerMode => "Aiming/Pointer Mode",
18286            BarcodeScanner::BarCodePresentSensor => "Bar Code Present Sensor",
18287            BarcodeScanner::Class1ALaser => "Class 1A Laser",
18288            BarcodeScanner::Class2Laser => "Class 2 Laser",
18289            BarcodeScanner::HeaterPresent => "Heater Present",
18290            BarcodeScanner::ContactScanner => "Contact Scanner",
18291            BarcodeScanner::ElectronicArticleSurveillanceNotification => {
18292                "Electronic Article Surveillance Notification"
18293            }
18294            BarcodeScanner::ConstantElectronicArticleSurveillance => {
18295                "Constant Electronic Article Surveillance"
18296            }
18297            BarcodeScanner::ErrorIndication => "Error Indication",
18298            BarcodeScanner::FixedBeeper => "Fixed Beeper",
18299            BarcodeScanner::GoodDecodeIndication => "Good Decode Indication",
18300            BarcodeScanner::HandsFreeScanning => "Hands Free Scanning",
18301            BarcodeScanner::IntrinsicallySafe => "Intrinsically Safe",
18302            BarcodeScanner::KlasseEinsLaser => "Klasse Eins Laser",
18303            BarcodeScanner::LongRangeScanner => "Long Range Scanner",
18304            BarcodeScanner::MirrorSpeedControl => "Mirror Speed Control",
18305            BarcodeScanner::NotOnFileIndication => "Not On File Indication",
18306            BarcodeScanner::ProgrammableBeeper => "Programmable Beeper",
18307            BarcodeScanner::Triggerless => "Triggerless",
18308            BarcodeScanner::Wand => "Wand",
18309            BarcodeScanner::WaterResistant => "Water Resistant",
18310            BarcodeScanner::MultiRangeScanner => "Multi-Range Scanner",
18311            BarcodeScanner::ProximitySensor => "Proximity Sensor",
18312            BarcodeScanner::FragmentDecoding => "Fragment Decoding",
18313            BarcodeScanner::ScannerReadConfidence => "Scanner Read Confidence",
18314            BarcodeScanner::DataPrefix => "Data Prefix",
18315            BarcodeScanner::PrefixAIMI => "Prefix AIMI",
18316            BarcodeScanner::PrefixNone => "Prefix None",
18317            BarcodeScanner::PrefixProprietary => "Prefix Proprietary",
18318            BarcodeScanner::ActiveTime => "Active Time",
18319            BarcodeScanner::AimingLaserPattern => "Aiming Laser Pattern",
18320            BarcodeScanner::BarCodePresent => "Bar Code Present",
18321            BarcodeScanner::BeeperState => "Beeper State",
18322            BarcodeScanner::LaserOnTime => "Laser On Time",
18323            BarcodeScanner::LaserState => "Laser State",
18324            BarcodeScanner::LockoutTime => "Lockout Time",
18325            BarcodeScanner::MotorState => "Motor State",
18326            BarcodeScanner::MotorTimeout => "Motor Timeout",
18327            BarcodeScanner::PowerOnResetScanner => "Power On Reset Scanner",
18328            BarcodeScanner::PreventReadofBarcodes => "Prevent Read of Barcodes",
18329            BarcodeScanner::InitiateBarcodeRead => "Initiate Barcode Read",
18330            BarcodeScanner::TriggerState => "Trigger State",
18331            BarcodeScanner::TriggerMode => "Trigger Mode",
18332            BarcodeScanner::TriggerModeBlinkingLaserOn => "Trigger Mode Blinking Laser On",
18333            BarcodeScanner::TriggerModeContinuousLaserOn => "Trigger Mode Continuous Laser On",
18334            BarcodeScanner::TriggerModeLaseronwhilePulled => "Trigger Mode Laser on while Pulled",
18335            BarcodeScanner::TriggerModeLaserstaysonafterrelease => {
18336                "Trigger Mode Laser stays on after release"
18337            }
18338            BarcodeScanner::CommitParameterstoNVM => "Commit Parameters to NVM",
18339            BarcodeScanner::ParameterScanning => "Parameter Scanning",
18340            BarcodeScanner::ParametersChanged => "Parameters Changed",
18341            BarcodeScanner::Setparameterdefaultvalues => "Set parameter default values",
18342            BarcodeScanner::ScannerInCradle => "Scanner In Cradle",
18343            BarcodeScanner::ScannerInRange => "Scanner In Range",
18344            BarcodeScanner::AimDuration => "Aim Duration",
18345            BarcodeScanner::GoodReadLampDuration => "Good Read Lamp Duration",
18346            BarcodeScanner::GoodReadLampIntensity => "Good Read Lamp Intensity",
18347            BarcodeScanner::GoodReadLED => "Good Read LED",
18348            BarcodeScanner::GoodReadToneFrequency => "Good Read Tone Frequency",
18349            BarcodeScanner::GoodReadToneLength => "Good Read Tone Length",
18350            BarcodeScanner::GoodReadToneVolume => "Good Read Tone Volume",
18351            BarcodeScanner::NoReadMessage => "No Read Message",
18352            BarcodeScanner::NotonFileVolume => "Not on File Volume",
18353            BarcodeScanner::PowerupBeep => "Powerup Beep",
18354            BarcodeScanner::SoundErrorBeep => "Sound Error Beep",
18355            BarcodeScanner::SoundGoodReadBeep => "Sound Good Read Beep",
18356            BarcodeScanner::SoundNotOnFileBeep => "Sound Not On File Beep",
18357            BarcodeScanner::GoodReadWhentoWrite => "Good Read When to Write",
18358            BarcodeScanner::GRWTIAfterDecode => "GRWTI After Decode",
18359            BarcodeScanner::GRWTIBeepLampaftertransmit => "GRWTI Beep/Lamp after transmit",
18360            BarcodeScanner::GRWTINoBeepLampuseatall => "GRWTI No Beep/Lamp use at all",
18361            BarcodeScanner::BooklandEAN => "Bookland EAN",
18362            BarcodeScanner::ConvertEAN8to13Type => "Convert EAN 8 to 13 Type",
18363            BarcodeScanner::ConvertUPCAtoEAN13 => "Convert UPC A to EAN-13",
18364            BarcodeScanner::ConvertUPCEtoA => "Convert UPC-E to A",
18365            BarcodeScanner::EAN13 => "EAN-13",
18366            BarcodeScanner::EAN8 => "EAN-8",
18367            BarcodeScanner::EAN99128Mandatory => "EAN-99 128 Mandatory",
18368            BarcodeScanner::EAN99P5128Optional => "EAN-99 P5/128 Optional",
18369            BarcodeScanner::EnableEANTwoLabel => "Enable EAN Two Label",
18370            BarcodeScanner::UPCEAN => "UPC/EAN",
18371            BarcodeScanner::UPCEANCouponCode => "UPC/EAN Coupon Code",
18372            BarcodeScanner::UPCEANPeriodicals => "UPC/EAN Periodicals",
18373            BarcodeScanner::UPCA => "UPC-A",
18374            BarcodeScanner::UPCAwith128Mandatory => "UPC-A with 128 Mandatory",
18375            BarcodeScanner::UPCAwith128Optional => "UPC-A with 128 Optional",
18376            BarcodeScanner::UPCAwithP5Optional => "UPC-A with P5 Optional",
18377            BarcodeScanner::UPCE => "UPC-E",
18378            BarcodeScanner::UPCE1 => "UPC-E1",
18379            BarcodeScanner::Periodical => "Periodical",
18380            BarcodeScanner::PeriodicalAutoDiscriminatePlus2 => "Periodical Auto-Discriminate +2",
18381            BarcodeScanner::PeriodicalOnlyDecodewithPlus2 => "Periodical Only Decode with +2",
18382            BarcodeScanner::PeriodicalIgnorePlus2 => "Periodical Ignore +2",
18383            BarcodeScanner::PeriodicalAutoDiscriminatePlus5 => "Periodical Auto-Discriminate +5",
18384            BarcodeScanner::PeriodicalOnlyDecodewithPlus5 => "Periodical Only Decode with +5",
18385            BarcodeScanner::PeriodicalIgnorePlus5 => "Periodical Ignore +5",
18386            BarcodeScanner::Check => "Check",
18387            BarcodeScanner::CheckDisablePrice => "Check Disable Price",
18388            BarcodeScanner::CheckEnable4digitPrice => "Check Enable 4 digit Price",
18389            BarcodeScanner::CheckEnable5digitPrice => "Check Enable 5 digit Price",
18390            BarcodeScanner::CheckEnableEuropean4digitPrice => "Check Enable European 4 digit Price",
18391            BarcodeScanner::CheckEnableEuropean5digitPrice => "Check Enable European 5 digit Price",
18392            BarcodeScanner::EANTwoLabel => "EAN Two Label",
18393            BarcodeScanner::EANThreeLabel => "EAN Three Label",
18394            BarcodeScanner::EAN8FlagDigit1 => "EAN 8 Flag Digit 1",
18395            BarcodeScanner::EAN8FlagDigit2 => "EAN 8 Flag Digit 2",
18396            BarcodeScanner::EAN8FlagDigit3 => "EAN 8 Flag Digit 3",
18397            BarcodeScanner::EAN13FlagDigit1 => "EAN 13 Flag Digit 1",
18398            BarcodeScanner::EAN13FlagDigit2 => "EAN 13 Flag Digit 2",
18399            BarcodeScanner::EAN13FlagDigit3 => "EAN 13 Flag Digit 3",
18400            BarcodeScanner::AddEAN23LabelDefinition => "Add EAN 2/3 Label Definition",
18401            BarcodeScanner::ClearallEAN23LabelDefinitions => "Clear all EAN 2/3 Label Definitions",
18402            BarcodeScanner::Codabar => "Codabar",
18403            BarcodeScanner::Code128 => "Code 128",
18404            BarcodeScanner::Code39 => "Code 39",
18405            BarcodeScanner::Code93 => "Code 93",
18406            BarcodeScanner::FullASCIIConversion => "Full ASCII Conversion",
18407            BarcodeScanner::Interleaved2of5 => "Interleaved 2 of 5",
18408            BarcodeScanner::ItalianPharmacyCode => "Italian Pharmacy Code",
18409            BarcodeScanner::MSIPlessey => "MSI/Plessey",
18410            BarcodeScanner::Standard2of5IATA => "Standard 2 of 5 IATA",
18411            BarcodeScanner::Standard2of5 => "Standard 2 of 5",
18412            BarcodeScanner::TransmitStartStop => "Transmit Start/Stop",
18413            BarcodeScanner::TriOptic => "Tri-Optic",
18414            BarcodeScanner::UCCEAN128 => "UCC/EAN-128",
18415            BarcodeScanner::CheckDigit => "Check Digit",
18416            BarcodeScanner::CheckDigitDisable => "Check Digit Disable",
18417            BarcodeScanner::CheckDigitEnableInterleaved2of5OPCC => {
18418                "Check Digit Enable Interleaved 2 of 5 OPCC"
18419            }
18420            BarcodeScanner::CheckDigitEnableInterleaved2of5USS => {
18421                "Check Digit Enable Interleaved 2 of 5 USS"
18422            }
18423            BarcodeScanner::CheckDigitEnableStandard2of5OPCC => {
18424                "Check Digit Enable Standard 2 of 5 OPCC"
18425            }
18426            BarcodeScanner::CheckDigitEnableStandard2of5USS => {
18427                "Check Digit Enable Standard 2 of 5 USS"
18428            }
18429            BarcodeScanner::CheckDigitEnableOneMSIPlessey => "Check Digit Enable One MSI Plessey",
18430            BarcodeScanner::CheckDigitEnableTwoMSIPlessey => "Check Digit Enable Two MSI Plessey",
18431            BarcodeScanner::CheckDigitCodabarEnable => "Check Digit Codabar Enable",
18432            BarcodeScanner::CheckDigitCode39Enable => "Check Digit Code 39 Enable",
18433            BarcodeScanner::TransmitCheckDigit => "Transmit Check Digit",
18434            BarcodeScanner::DisableCheckDigitTransmit => "Disable Check Digit Transmit",
18435            BarcodeScanner::EnableCheckDigitTransmit => "Enable Check Digit Transmit",
18436            BarcodeScanner::SymbologyIdentifier1 => "Symbology Identifier 1",
18437            BarcodeScanner::SymbologyIdentifier2 => "Symbology Identifier 2",
18438            BarcodeScanner::SymbologyIdentifier3 => "Symbology Identifier 3",
18439            BarcodeScanner::DecodedData => "Decoded Data",
18440            BarcodeScanner::DecodeDataContinued => "Decode Data Continued",
18441            BarcodeScanner::BarSpaceData => "Bar Space Data",
18442            BarcodeScanner::ScannerDataAccuracy => "Scanner Data Accuracy",
18443            BarcodeScanner::RawDataPolarity => "Raw Data Polarity",
18444            BarcodeScanner::PolarityInvertedBarCode => "Polarity Inverted Bar Code",
18445            BarcodeScanner::PolarityNormalBarCode => "Polarity Normal Bar Code",
18446            BarcodeScanner::MinimumLengthtoDecode => "Minimum Length to Decode",
18447            BarcodeScanner::MaximumLengthtoDecode => "Maximum Length to Decode",
18448            BarcodeScanner::DiscreteLengthtoDecode1 => "Discrete Length to Decode 1",
18449            BarcodeScanner::DiscreteLengthtoDecode2 => "Discrete Length to Decode 2",
18450            BarcodeScanner::DataLengthMethod => "Data Length Method",
18451            BarcodeScanner::DLMethodReadany => "DL Method Read any",
18452            BarcodeScanner::DLMethodCheckinRange => "DL Method Check in Range",
18453            BarcodeScanner::DLMethodCheckforDiscrete => "DL Method Check for Discrete",
18454            BarcodeScanner::AztecCode => "Aztec Code",
18455            BarcodeScanner::BC412 => "BC412",
18456            BarcodeScanner::ChannelCode => "Channel Code",
18457            BarcodeScanner::Code16 => "Code 16",
18458            BarcodeScanner::Code32 => "Code 32",
18459            BarcodeScanner::Code49 => "Code 49",
18460            BarcodeScanner::CodeOne => "Code One",
18461            BarcodeScanner::Colorcode => "Colorcode",
18462            BarcodeScanner::DataMatrix => "Data Matrix",
18463            BarcodeScanner::MaxiCode => "MaxiCode",
18464            BarcodeScanner::MicroPDF => "MicroPDF",
18465            BarcodeScanner::PDF417 => "PDF-417",
18466            BarcodeScanner::PosiCode => "PosiCode",
18467            BarcodeScanner::QRCode => "QR Code",
18468            BarcodeScanner::SuperCode => "SuperCode",
18469            BarcodeScanner::UltraCode => "UltraCode",
18470            BarcodeScanner::USD5SlugCode => "USD-5 (Slug Code)",
18471            BarcodeScanner::VeriCode => "VeriCode",
18472        }
18473        .into()
18474    }
18475}
18476
18477#[cfg(feature = "std")]
18478impl fmt::Display for BarcodeScanner {
18479    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18480        write!(f, "{}", self.name())
18481    }
18482}
18483
18484impl AsUsage for BarcodeScanner {
18485    /// Returns the 32 bit Usage value of this Usage
18486    fn usage_value(&self) -> u32 {
18487        u32::from(self)
18488    }
18489
18490    /// Returns the 16 bit Usage ID value of this Usage
18491    fn usage_id_value(&self) -> u16 {
18492        u16::from(self)
18493    }
18494
18495    /// Returns this usage as [Usage::BarcodeScanner(self)](Usage::BarcodeScanner)
18496    /// This is a convenience function to avoid having
18497    /// to implement `From` for every used type in the caller.
18498    ///
18499    /// ```
18500    /// # use hut::*;
18501    /// let gd_x = GenericDesktop::X;
18502    /// let usage = Usage::from(GenericDesktop::X);
18503    /// assert!(matches!(gd_x.usage(), usage));
18504    /// ```
18505    fn usage(&self) -> Usage {
18506        Usage::from(self)
18507    }
18508}
18509
18510impl AsUsagePage for BarcodeScanner {
18511    /// Returns the 16 bit value of this UsagePage
18512    ///
18513    /// This value is `0x8C` for [BarcodeScanner]
18514    fn usage_page_value(&self) -> u16 {
18515        let up = UsagePage::from(self);
18516        u16::from(up)
18517    }
18518
18519    /// Returns [UsagePage::BarcodeScanner]]
18520    fn usage_page(&self) -> UsagePage {
18521        UsagePage::from(self)
18522    }
18523}
18524
18525impl From<&BarcodeScanner> for u16 {
18526    fn from(barcodescanner: &BarcodeScanner) -> u16 {
18527        match *barcodescanner {
18528            BarcodeScanner::BarcodeBadgeReader => 1,
18529            BarcodeScanner::BarcodeScanner => 2,
18530            BarcodeScanner::DumbBarCodeScanner => 3,
18531            BarcodeScanner::CordlessScannerBase => 4,
18532            BarcodeScanner::BarCodeScannerCradle => 5,
18533            BarcodeScanner::AttributeReport => 16,
18534            BarcodeScanner::SettingsReport => 17,
18535            BarcodeScanner::ScannedDataReport => 18,
18536            BarcodeScanner::RawScannedDataReport => 19,
18537            BarcodeScanner::TriggerReport => 20,
18538            BarcodeScanner::StatusReport => 21,
18539            BarcodeScanner::UPCEANControlReport => 22,
18540            BarcodeScanner::EAN23LabelControlReport => 23,
18541            BarcodeScanner::Code39ControlReport => 24,
18542            BarcodeScanner::Interleaved2of5ControlReport => 25,
18543            BarcodeScanner::Standard2of5ControlReport => 26,
18544            BarcodeScanner::MSIPlesseyControlReport => 27,
18545            BarcodeScanner::CodabarControlReport => 28,
18546            BarcodeScanner::Code128ControlReport => 29,
18547            BarcodeScanner::Misc1DControlReport => 30,
18548            BarcodeScanner::TwoDControlReport => 31,
18549            BarcodeScanner::AimingPointerMode => 48,
18550            BarcodeScanner::BarCodePresentSensor => 49,
18551            BarcodeScanner::Class1ALaser => 50,
18552            BarcodeScanner::Class2Laser => 51,
18553            BarcodeScanner::HeaterPresent => 52,
18554            BarcodeScanner::ContactScanner => 53,
18555            BarcodeScanner::ElectronicArticleSurveillanceNotification => 54,
18556            BarcodeScanner::ConstantElectronicArticleSurveillance => 55,
18557            BarcodeScanner::ErrorIndication => 56,
18558            BarcodeScanner::FixedBeeper => 57,
18559            BarcodeScanner::GoodDecodeIndication => 58,
18560            BarcodeScanner::HandsFreeScanning => 59,
18561            BarcodeScanner::IntrinsicallySafe => 60,
18562            BarcodeScanner::KlasseEinsLaser => 61,
18563            BarcodeScanner::LongRangeScanner => 62,
18564            BarcodeScanner::MirrorSpeedControl => 63,
18565            BarcodeScanner::NotOnFileIndication => 64,
18566            BarcodeScanner::ProgrammableBeeper => 65,
18567            BarcodeScanner::Triggerless => 66,
18568            BarcodeScanner::Wand => 67,
18569            BarcodeScanner::WaterResistant => 68,
18570            BarcodeScanner::MultiRangeScanner => 69,
18571            BarcodeScanner::ProximitySensor => 70,
18572            BarcodeScanner::FragmentDecoding => 77,
18573            BarcodeScanner::ScannerReadConfidence => 78,
18574            BarcodeScanner::DataPrefix => 79,
18575            BarcodeScanner::PrefixAIMI => 80,
18576            BarcodeScanner::PrefixNone => 81,
18577            BarcodeScanner::PrefixProprietary => 82,
18578            BarcodeScanner::ActiveTime => 85,
18579            BarcodeScanner::AimingLaserPattern => 86,
18580            BarcodeScanner::BarCodePresent => 87,
18581            BarcodeScanner::BeeperState => 88,
18582            BarcodeScanner::LaserOnTime => 89,
18583            BarcodeScanner::LaserState => 90,
18584            BarcodeScanner::LockoutTime => 91,
18585            BarcodeScanner::MotorState => 92,
18586            BarcodeScanner::MotorTimeout => 93,
18587            BarcodeScanner::PowerOnResetScanner => 94,
18588            BarcodeScanner::PreventReadofBarcodes => 95,
18589            BarcodeScanner::InitiateBarcodeRead => 96,
18590            BarcodeScanner::TriggerState => 97,
18591            BarcodeScanner::TriggerMode => 98,
18592            BarcodeScanner::TriggerModeBlinkingLaserOn => 99,
18593            BarcodeScanner::TriggerModeContinuousLaserOn => 100,
18594            BarcodeScanner::TriggerModeLaseronwhilePulled => 101,
18595            BarcodeScanner::TriggerModeLaserstaysonafterrelease => 102,
18596            BarcodeScanner::CommitParameterstoNVM => 109,
18597            BarcodeScanner::ParameterScanning => 110,
18598            BarcodeScanner::ParametersChanged => 111,
18599            BarcodeScanner::Setparameterdefaultvalues => 112,
18600            BarcodeScanner::ScannerInCradle => 117,
18601            BarcodeScanner::ScannerInRange => 118,
18602            BarcodeScanner::AimDuration => 122,
18603            BarcodeScanner::GoodReadLampDuration => 123,
18604            BarcodeScanner::GoodReadLampIntensity => 124,
18605            BarcodeScanner::GoodReadLED => 125,
18606            BarcodeScanner::GoodReadToneFrequency => 126,
18607            BarcodeScanner::GoodReadToneLength => 127,
18608            BarcodeScanner::GoodReadToneVolume => 128,
18609            BarcodeScanner::NoReadMessage => 130,
18610            BarcodeScanner::NotonFileVolume => 131,
18611            BarcodeScanner::PowerupBeep => 132,
18612            BarcodeScanner::SoundErrorBeep => 133,
18613            BarcodeScanner::SoundGoodReadBeep => 134,
18614            BarcodeScanner::SoundNotOnFileBeep => 135,
18615            BarcodeScanner::GoodReadWhentoWrite => 136,
18616            BarcodeScanner::GRWTIAfterDecode => 137,
18617            BarcodeScanner::GRWTIBeepLampaftertransmit => 138,
18618            BarcodeScanner::GRWTINoBeepLampuseatall => 139,
18619            BarcodeScanner::BooklandEAN => 145,
18620            BarcodeScanner::ConvertEAN8to13Type => 146,
18621            BarcodeScanner::ConvertUPCAtoEAN13 => 147,
18622            BarcodeScanner::ConvertUPCEtoA => 148,
18623            BarcodeScanner::EAN13 => 149,
18624            BarcodeScanner::EAN8 => 150,
18625            BarcodeScanner::EAN99128Mandatory => 151,
18626            BarcodeScanner::EAN99P5128Optional => 152,
18627            BarcodeScanner::EnableEANTwoLabel => 153,
18628            BarcodeScanner::UPCEAN => 154,
18629            BarcodeScanner::UPCEANCouponCode => 155,
18630            BarcodeScanner::UPCEANPeriodicals => 156,
18631            BarcodeScanner::UPCA => 157,
18632            BarcodeScanner::UPCAwith128Mandatory => 158,
18633            BarcodeScanner::UPCAwith128Optional => 159,
18634            BarcodeScanner::UPCAwithP5Optional => 160,
18635            BarcodeScanner::UPCE => 161,
18636            BarcodeScanner::UPCE1 => 162,
18637            BarcodeScanner::Periodical => 169,
18638            BarcodeScanner::PeriodicalAutoDiscriminatePlus2 => 170,
18639            BarcodeScanner::PeriodicalOnlyDecodewithPlus2 => 171,
18640            BarcodeScanner::PeriodicalIgnorePlus2 => 172,
18641            BarcodeScanner::PeriodicalAutoDiscriminatePlus5 => 173,
18642            BarcodeScanner::PeriodicalOnlyDecodewithPlus5 => 174,
18643            BarcodeScanner::PeriodicalIgnorePlus5 => 175,
18644            BarcodeScanner::Check => 176,
18645            BarcodeScanner::CheckDisablePrice => 177,
18646            BarcodeScanner::CheckEnable4digitPrice => 178,
18647            BarcodeScanner::CheckEnable5digitPrice => 179,
18648            BarcodeScanner::CheckEnableEuropean4digitPrice => 180,
18649            BarcodeScanner::CheckEnableEuropean5digitPrice => 181,
18650            BarcodeScanner::EANTwoLabel => 183,
18651            BarcodeScanner::EANThreeLabel => 184,
18652            BarcodeScanner::EAN8FlagDigit1 => 185,
18653            BarcodeScanner::EAN8FlagDigit2 => 186,
18654            BarcodeScanner::EAN8FlagDigit3 => 187,
18655            BarcodeScanner::EAN13FlagDigit1 => 188,
18656            BarcodeScanner::EAN13FlagDigit2 => 189,
18657            BarcodeScanner::EAN13FlagDigit3 => 190,
18658            BarcodeScanner::AddEAN23LabelDefinition => 191,
18659            BarcodeScanner::ClearallEAN23LabelDefinitions => 192,
18660            BarcodeScanner::Codabar => 195,
18661            BarcodeScanner::Code128 => 196,
18662            BarcodeScanner::Code39 => 199,
18663            BarcodeScanner::Code93 => 200,
18664            BarcodeScanner::FullASCIIConversion => 201,
18665            BarcodeScanner::Interleaved2of5 => 202,
18666            BarcodeScanner::ItalianPharmacyCode => 203,
18667            BarcodeScanner::MSIPlessey => 204,
18668            BarcodeScanner::Standard2of5IATA => 205,
18669            BarcodeScanner::Standard2of5 => 206,
18670            BarcodeScanner::TransmitStartStop => 211,
18671            BarcodeScanner::TriOptic => 212,
18672            BarcodeScanner::UCCEAN128 => 213,
18673            BarcodeScanner::CheckDigit => 214,
18674            BarcodeScanner::CheckDigitDisable => 215,
18675            BarcodeScanner::CheckDigitEnableInterleaved2of5OPCC => 216,
18676            BarcodeScanner::CheckDigitEnableInterleaved2of5USS => 217,
18677            BarcodeScanner::CheckDigitEnableStandard2of5OPCC => 218,
18678            BarcodeScanner::CheckDigitEnableStandard2of5USS => 219,
18679            BarcodeScanner::CheckDigitEnableOneMSIPlessey => 220,
18680            BarcodeScanner::CheckDigitEnableTwoMSIPlessey => 221,
18681            BarcodeScanner::CheckDigitCodabarEnable => 222,
18682            BarcodeScanner::CheckDigitCode39Enable => 223,
18683            BarcodeScanner::TransmitCheckDigit => 240,
18684            BarcodeScanner::DisableCheckDigitTransmit => 241,
18685            BarcodeScanner::EnableCheckDigitTransmit => 242,
18686            BarcodeScanner::SymbologyIdentifier1 => 251,
18687            BarcodeScanner::SymbologyIdentifier2 => 252,
18688            BarcodeScanner::SymbologyIdentifier3 => 253,
18689            BarcodeScanner::DecodedData => 254,
18690            BarcodeScanner::DecodeDataContinued => 255,
18691            BarcodeScanner::BarSpaceData => 256,
18692            BarcodeScanner::ScannerDataAccuracy => 257,
18693            BarcodeScanner::RawDataPolarity => 258,
18694            BarcodeScanner::PolarityInvertedBarCode => 259,
18695            BarcodeScanner::PolarityNormalBarCode => 260,
18696            BarcodeScanner::MinimumLengthtoDecode => 262,
18697            BarcodeScanner::MaximumLengthtoDecode => 263,
18698            BarcodeScanner::DiscreteLengthtoDecode1 => 264,
18699            BarcodeScanner::DiscreteLengthtoDecode2 => 265,
18700            BarcodeScanner::DataLengthMethod => 266,
18701            BarcodeScanner::DLMethodReadany => 267,
18702            BarcodeScanner::DLMethodCheckinRange => 268,
18703            BarcodeScanner::DLMethodCheckforDiscrete => 269,
18704            BarcodeScanner::AztecCode => 272,
18705            BarcodeScanner::BC412 => 273,
18706            BarcodeScanner::ChannelCode => 274,
18707            BarcodeScanner::Code16 => 275,
18708            BarcodeScanner::Code32 => 276,
18709            BarcodeScanner::Code49 => 277,
18710            BarcodeScanner::CodeOne => 278,
18711            BarcodeScanner::Colorcode => 279,
18712            BarcodeScanner::DataMatrix => 280,
18713            BarcodeScanner::MaxiCode => 281,
18714            BarcodeScanner::MicroPDF => 282,
18715            BarcodeScanner::PDF417 => 283,
18716            BarcodeScanner::PosiCode => 284,
18717            BarcodeScanner::QRCode => 285,
18718            BarcodeScanner::SuperCode => 286,
18719            BarcodeScanner::UltraCode => 287,
18720            BarcodeScanner::USD5SlugCode => 288,
18721            BarcodeScanner::VeriCode => 289,
18722        }
18723    }
18724}
18725
18726impl From<BarcodeScanner> for u16 {
18727    /// Returns the 16bit value of this usage. This is identical
18728    /// to [BarcodeScanner::usage_page_value()].
18729    fn from(barcodescanner: BarcodeScanner) -> u16 {
18730        u16::from(&barcodescanner)
18731    }
18732}
18733
18734impl From<&BarcodeScanner> for u32 {
18735    /// Returns the 32 bit value of this usage. This is identical
18736    /// to [BarcodeScanner::usage_value()].
18737    fn from(barcodescanner: &BarcodeScanner) -> u32 {
18738        let up = UsagePage::from(barcodescanner);
18739        let up = (u16::from(&up) as u32) << 16;
18740        let id = u16::from(barcodescanner) as u32;
18741        up | id
18742    }
18743}
18744
18745impl From<&BarcodeScanner> for UsagePage {
18746    /// Always returns [UsagePage::BarcodeScanner] and is
18747    /// identical to [BarcodeScanner::usage_page()].
18748    fn from(_: &BarcodeScanner) -> UsagePage {
18749        UsagePage::BarcodeScanner
18750    }
18751}
18752
18753impl From<BarcodeScanner> for UsagePage {
18754    /// Always returns [UsagePage::BarcodeScanner] and is
18755    /// identical to [BarcodeScanner::usage_page()].
18756    fn from(_: BarcodeScanner) -> UsagePage {
18757        UsagePage::BarcodeScanner
18758    }
18759}
18760
18761impl From<&BarcodeScanner> for Usage {
18762    fn from(barcodescanner: &BarcodeScanner) -> Usage {
18763        Usage::try_from(u32::from(barcodescanner)).unwrap()
18764    }
18765}
18766
18767impl From<BarcodeScanner> for Usage {
18768    fn from(barcodescanner: BarcodeScanner) -> Usage {
18769        Usage::from(&barcodescanner)
18770    }
18771}
18772
18773impl TryFrom<u16> for BarcodeScanner {
18774    type Error = HutError;
18775
18776    fn try_from(usage_id: u16) -> Result<BarcodeScanner> {
18777        match usage_id {
18778            1 => Ok(BarcodeScanner::BarcodeBadgeReader),
18779            2 => Ok(BarcodeScanner::BarcodeScanner),
18780            3 => Ok(BarcodeScanner::DumbBarCodeScanner),
18781            4 => Ok(BarcodeScanner::CordlessScannerBase),
18782            5 => Ok(BarcodeScanner::BarCodeScannerCradle),
18783            16 => Ok(BarcodeScanner::AttributeReport),
18784            17 => Ok(BarcodeScanner::SettingsReport),
18785            18 => Ok(BarcodeScanner::ScannedDataReport),
18786            19 => Ok(BarcodeScanner::RawScannedDataReport),
18787            20 => Ok(BarcodeScanner::TriggerReport),
18788            21 => Ok(BarcodeScanner::StatusReport),
18789            22 => Ok(BarcodeScanner::UPCEANControlReport),
18790            23 => Ok(BarcodeScanner::EAN23LabelControlReport),
18791            24 => Ok(BarcodeScanner::Code39ControlReport),
18792            25 => Ok(BarcodeScanner::Interleaved2of5ControlReport),
18793            26 => Ok(BarcodeScanner::Standard2of5ControlReport),
18794            27 => Ok(BarcodeScanner::MSIPlesseyControlReport),
18795            28 => Ok(BarcodeScanner::CodabarControlReport),
18796            29 => Ok(BarcodeScanner::Code128ControlReport),
18797            30 => Ok(BarcodeScanner::Misc1DControlReport),
18798            31 => Ok(BarcodeScanner::TwoDControlReport),
18799            48 => Ok(BarcodeScanner::AimingPointerMode),
18800            49 => Ok(BarcodeScanner::BarCodePresentSensor),
18801            50 => Ok(BarcodeScanner::Class1ALaser),
18802            51 => Ok(BarcodeScanner::Class2Laser),
18803            52 => Ok(BarcodeScanner::HeaterPresent),
18804            53 => Ok(BarcodeScanner::ContactScanner),
18805            54 => Ok(BarcodeScanner::ElectronicArticleSurveillanceNotification),
18806            55 => Ok(BarcodeScanner::ConstantElectronicArticleSurveillance),
18807            56 => Ok(BarcodeScanner::ErrorIndication),
18808            57 => Ok(BarcodeScanner::FixedBeeper),
18809            58 => Ok(BarcodeScanner::GoodDecodeIndication),
18810            59 => Ok(BarcodeScanner::HandsFreeScanning),
18811            60 => Ok(BarcodeScanner::IntrinsicallySafe),
18812            61 => Ok(BarcodeScanner::KlasseEinsLaser),
18813            62 => Ok(BarcodeScanner::LongRangeScanner),
18814            63 => Ok(BarcodeScanner::MirrorSpeedControl),
18815            64 => Ok(BarcodeScanner::NotOnFileIndication),
18816            65 => Ok(BarcodeScanner::ProgrammableBeeper),
18817            66 => Ok(BarcodeScanner::Triggerless),
18818            67 => Ok(BarcodeScanner::Wand),
18819            68 => Ok(BarcodeScanner::WaterResistant),
18820            69 => Ok(BarcodeScanner::MultiRangeScanner),
18821            70 => Ok(BarcodeScanner::ProximitySensor),
18822            77 => Ok(BarcodeScanner::FragmentDecoding),
18823            78 => Ok(BarcodeScanner::ScannerReadConfidence),
18824            79 => Ok(BarcodeScanner::DataPrefix),
18825            80 => Ok(BarcodeScanner::PrefixAIMI),
18826            81 => Ok(BarcodeScanner::PrefixNone),
18827            82 => Ok(BarcodeScanner::PrefixProprietary),
18828            85 => Ok(BarcodeScanner::ActiveTime),
18829            86 => Ok(BarcodeScanner::AimingLaserPattern),
18830            87 => Ok(BarcodeScanner::BarCodePresent),
18831            88 => Ok(BarcodeScanner::BeeperState),
18832            89 => Ok(BarcodeScanner::LaserOnTime),
18833            90 => Ok(BarcodeScanner::LaserState),
18834            91 => Ok(BarcodeScanner::LockoutTime),
18835            92 => Ok(BarcodeScanner::MotorState),
18836            93 => Ok(BarcodeScanner::MotorTimeout),
18837            94 => Ok(BarcodeScanner::PowerOnResetScanner),
18838            95 => Ok(BarcodeScanner::PreventReadofBarcodes),
18839            96 => Ok(BarcodeScanner::InitiateBarcodeRead),
18840            97 => Ok(BarcodeScanner::TriggerState),
18841            98 => Ok(BarcodeScanner::TriggerMode),
18842            99 => Ok(BarcodeScanner::TriggerModeBlinkingLaserOn),
18843            100 => Ok(BarcodeScanner::TriggerModeContinuousLaserOn),
18844            101 => Ok(BarcodeScanner::TriggerModeLaseronwhilePulled),
18845            102 => Ok(BarcodeScanner::TriggerModeLaserstaysonafterrelease),
18846            109 => Ok(BarcodeScanner::CommitParameterstoNVM),
18847            110 => Ok(BarcodeScanner::ParameterScanning),
18848            111 => Ok(BarcodeScanner::ParametersChanged),
18849            112 => Ok(BarcodeScanner::Setparameterdefaultvalues),
18850            117 => Ok(BarcodeScanner::ScannerInCradle),
18851            118 => Ok(BarcodeScanner::ScannerInRange),
18852            122 => Ok(BarcodeScanner::AimDuration),
18853            123 => Ok(BarcodeScanner::GoodReadLampDuration),
18854            124 => Ok(BarcodeScanner::GoodReadLampIntensity),
18855            125 => Ok(BarcodeScanner::GoodReadLED),
18856            126 => Ok(BarcodeScanner::GoodReadToneFrequency),
18857            127 => Ok(BarcodeScanner::GoodReadToneLength),
18858            128 => Ok(BarcodeScanner::GoodReadToneVolume),
18859            130 => Ok(BarcodeScanner::NoReadMessage),
18860            131 => Ok(BarcodeScanner::NotonFileVolume),
18861            132 => Ok(BarcodeScanner::PowerupBeep),
18862            133 => Ok(BarcodeScanner::SoundErrorBeep),
18863            134 => Ok(BarcodeScanner::SoundGoodReadBeep),
18864            135 => Ok(BarcodeScanner::SoundNotOnFileBeep),
18865            136 => Ok(BarcodeScanner::GoodReadWhentoWrite),
18866            137 => Ok(BarcodeScanner::GRWTIAfterDecode),
18867            138 => Ok(BarcodeScanner::GRWTIBeepLampaftertransmit),
18868            139 => Ok(BarcodeScanner::GRWTINoBeepLampuseatall),
18869            145 => Ok(BarcodeScanner::BooklandEAN),
18870            146 => Ok(BarcodeScanner::ConvertEAN8to13Type),
18871            147 => Ok(BarcodeScanner::ConvertUPCAtoEAN13),
18872            148 => Ok(BarcodeScanner::ConvertUPCEtoA),
18873            149 => Ok(BarcodeScanner::EAN13),
18874            150 => Ok(BarcodeScanner::EAN8),
18875            151 => Ok(BarcodeScanner::EAN99128Mandatory),
18876            152 => Ok(BarcodeScanner::EAN99P5128Optional),
18877            153 => Ok(BarcodeScanner::EnableEANTwoLabel),
18878            154 => Ok(BarcodeScanner::UPCEAN),
18879            155 => Ok(BarcodeScanner::UPCEANCouponCode),
18880            156 => Ok(BarcodeScanner::UPCEANPeriodicals),
18881            157 => Ok(BarcodeScanner::UPCA),
18882            158 => Ok(BarcodeScanner::UPCAwith128Mandatory),
18883            159 => Ok(BarcodeScanner::UPCAwith128Optional),
18884            160 => Ok(BarcodeScanner::UPCAwithP5Optional),
18885            161 => Ok(BarcodeScanner::UPCE),
18886            162 => Ok(BarcodeScanner::UPCE1),
18887            169 => Ok(BarcodeScanner::Periodical),
18888            170 => Ok(BarcodeScanner::PeriodicalAutoDiscriminatePlus2),
18889            171 => Ok(BarcodeScanner::PeriodicalOnlyDecodewithPlus2),
18890            172 => Ok(BarcodeScanner::PeriodicalIgnorePlus2),
18891            173 => Ok(BarcodeScanner::PeriodicalAutoDiscriminatePlus5),
18892            174 => Ok(BarcodeScanner::PeriodicalOnlyDecodewithPlus5),
18893            175 => Ok(BarcodeScanner::PeriodicalIgnorePlus5),
18894            176 => Ok(BarcodeScanner::Check),
18895            177 => Ok(BarcodeScanner::CheckDisablePrice),
18896            178 => Ok(BarcodeScanner::CheckEnable4digitPrice),
18897            179 => Ok(BarcodeScanner::CheckEnable5digitPrice),
18898            180 => Ok(BarcodeScanner::CheckEnableEuropean4digitPrice),
18899            181 => Ok(BarcodeScanner::CheckEnableEuropean5digitPrice),
18900            183 => Ok(BarcodeScanner::EANTwoLabel),
18901            184 => Ok(BarcodeScanner::EANThreeLabel),
18902            185 => Ok(BarcodeScanner::EAN8FlagDigit1),
18903            186 => Ok(BarcodeScanner::EAN8FlagDigit2),
18904            187 => Ok(BarcodeScanner::EAN8FlagDigit3),
18905            188 => Ok(BarcodeScanner::EAN13FlagDigit1),
18906            189 => Ok(BarcodeScanner::EAN13FlagDigit2),
18907            190 => Ok(BarcodeScanner::EAN13FlagDigit3),
18908            191 => Ok(BarcodeScanner::AddEAN23LabelDefinition),
18909            192 => Ok(BarcodeScanner::ClearallEAN23LabelDefinitions),
18910            195 => Ok(BarcodeScanner::Codabar),
18911            196 => Ok(BarcodeScanner::Code128),
18912            199 => Ok(BarcodeScanner::Code39),
18913            200 => Ok(BarcodeScanner::Code93),
18914            201 => Ok(BarcodeScanner::FullASCIIConversion),
18915            202 => Ok(BarcodeScanner::Interleaved2of5),
18916            203 => Ok(BarcodeScanner::ItalianPharmacyCode),
18917            204 => Ok(BarcodeScanner::MSIPlessey),
18918            205 => Ok(BarcodeScanner::Standard2of5IATA),
18919            206 => Ok(BarcodeScanner::Standard2of5),
18920            211 => Ok(BarcodeScanner::TransmitStartStop),
18921            212 => Ok(BarcodeScanner::TriOptic),
18922            213 => Ok(BarcodeScanner::UCCEAN128),
18923            214 => Ok(BarcodeScanner::CheckDigit),
18924            215 => Ok(BarcodeScanner::CheckDigitDisable),
18925            216 => Ok(BarcodeScanner::CheckDigitEnableInterleaved2of5OPCC),
18926            217 => Ok(BarcodeScanner::CheckDigitEnableInterleaved2of5USS),
18927            218 => Ok(BarcodeScanner::CheckDigitEnableStandard2of5OPCC),
18928            219 => Ok(BarcodeScanner::CheckDigitEnableStandard2of5USS),
18929            220 => Ok(BarcodeScanner::CheckDigitEnableOneMSIPlessey),
18930            221 => Ok(BarcodeScanner::CheckDigitEnableTwoMSIPlessey),
18931            222 => Ok(BarcodeScanner::CheckDigitCodabarEnable),
18932            223 => Ok(BarcodeScanner::CheckDigitCode39Enable),
18933            240 => Ok(BarcodeScanner::TransmitCheckDigit),
18934            241 => Ok(BarcodeScanner::DisableCheckDigitTransmit),
18935            242 => Ok(BarcodeScanner::EnableCheckDigitTransmit),
18936            251 => Ok(BarcodeScanner::SymbologyIdentifier1),
18937            252 => Ok(BarcodeScanner::SymbologyIdentifier2),
18938            253 => Ok(BarcodeScanner::SymbologyIdentifier3),
18939            254 => Ok(BarcodeScanner::DecodedData),
18940            255 => Ok(BarcodeScanner::DecodeDataContinued),
18941            256 => Ok(BarcodeScanner::BarSpaceData),
18942            257 => Ok(BarcodeScanner::ScannerDataAccuracy),
18943            258 => Ok(BarcodeScanner::RawDataPolarity),
18944            259 => Ok(BarcodeScanner::PolarityInvertedBarCode),
18945            260 => Ok(BarcodeScanner::PolarityNormalBarCode),
18946            262 => Ok(BarcodeScanner::MinimumLengthtoDecode),
18947            263 => Ok(BarcodeScanner::MaximumLengthtoDecode),
18948            264 => Ok(BarcodeScanner::DiscreteLengthtoDecode1),
18949            265 => Ok(BarcodeScanner::DiscreteLengthtoDecode2),
18950            266 => Ok(BarcodeScanner::DataLengthMethod),
18951            267 => Ok(BarcodeScanner::DLMethodReadany),
18952            268 => Ok(BarcodeScanner::DLMethodCheckinRange),
18953            269 => Ok(BarcodeScanner::DLMethodCheckforDiscrete),
18954            272 => Ok(BarcodeScanner::AztecCode),
18955            273 => Ok(BarcodeScanner::BC412),
18956            274 => Ok(BarcodeScanner::ChannelCode),
18957            275 => Ok(BarcodeScanner::Code16),
18958            276 => Ok(BarcodeScanner::Code32),
18959            277 => Ok(BarcodeScanner::Code49),
18960            278 => Ok(BarcodeScanner::CodeOne),
18961            279 => Ok(BarcodeScanner::Colorcode),
18962            280 => Ok(BarcodeScanner::DataMatrix),
18963            281 => Ok(BarcodeScanner::MaxiCode),
18964            282 => Ok(BarcodeScanner::MicroPDF),
18965            283 => Ok(BarcodeScanner::PDF417),
18966            284 => Ok(BarcodeScanner::PosiCode),
18967            285 => Ok(BarcodeScanner::QRCode),
18968            286 => Ok(BarcodeScanner::SuperCode),
18969            287 => Ok(BarcodeScanner::UltraCode),
18970            288 => Ok(BarcodeScanner::USD5SlugCode),
18971            289 => Ok(BarcodeScanner::VeriCode),
18972            n => Err(HutError::UnknownUsageId { usage_id: n }),
18973        }
18974    }
18975}
18976
18977impl BitOr<u16> for BarcodeScanner {
18978    type Output = Usage;
18979
18980    /// A convenience function to combine a Usage Page with
18981    /// a value.
18982    ///
18983    /// This function panics if the Usage ID value results in
18984    /// an unknown Usage. Where error checking is required,
18985    /// use [UsagePage::to_usage_from_value].
18986    fn bitor(self, usage: u16) -> Usage {
18987        let up = u16::from(self) as u32;
18988        let u = usage as u32;
18989        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
18990    }
18991}
18992
18993/// *Usage Page `0x8D`: "Scales"*
18994///
18995/// **This enum is autogenerated from the HID Usage Tables**.
18996/// ```
18997/// # use hut::*;
18998/// let u1 = Usage::Scales(Scales::ScaleDevice);
18999/// let u2 = Usage::new_from_page_and_id(0x8D, 0x20).unwrap();
19000/// let u3 = Usage::from(Scales::ScaleDevice);
19001/// let u4: Usage = Scales::ScaleDevice.into();
19002/// assert_eq!(u1, u2);
19003/// assert_eq!(u1, u3);
19004/// assert_eq!(u1, u4);
19005///
19006/// assert!(matches!(u1.usage_page(), UsagePage::Scales));
19007/// assert_eq!(0x8D, u1.usage_page_value());
19008/// assert_eq!(0x20, u1.usage_id_value());
19009/// assert_eq!((0x8D << 16) | 0x20, u1.usage_value());
19010/// assert_eq!("Scale Device", u1.name());
19011/// ```
19012///
19013#[allow(non_camel_case_types)]
19014#[derive(Debug)]
19015#[non_exhaustive]
19016pub enum Scales {
19017    /// Usage ID `0x1`: "Scales"
19018    Scales,
19019    /// Usage ID `0x20`: "Scale Device"
19020    ScaleDevice,
19021    /// Usage ID `0x21`: "Scale Class"
19022    ScaleClass,
19023    /// Usage ID `0x22`: "Scale Class I Metric"
19024    ScaleClassIMetric,
19025    /// Usage ID `0x23`: "Scale Class II Metric"
19026    ScaleClassIIMetric,
19027    /// Usage ID `0x24`: "Scale Class III Metric"
19028    ScaleClassIIIMetric,
19029    /// Usage ID `0x25`: "Scale Class IIIL Metric"
19030    ScaleClassIIILMetric,
19031    /// Usage ID `0x26`: "Scale Class IV Metric"
19032    ScaleClassIVMetric,
19033    /// Usage ID `0x27`: "Scale Class III English"
19034    ScaleClassIIIEnglish,
19035    /// Usage ID `0x28`: "Scale Class IIIL English"
19036    ScaleClassIIILEnglish,
19037    /// Usage ID `0x29`: "Scale Class IV English"
19038    ScaleClassIVEnglish,
19039    /// Usage ID `0x2A`: "Scale Class Generic"
19040    ScaleClassGeneric,
19041    /// Usage ID `0x30`: "Scale Attribute Report"
19042    ScaleAttributeReport,
19043    /// Usage ID `0x31`: "Scale Control Report"
19044    ScaleControlReport,
19045    /// Usage ID `0x32`: "Scale Data Report"
19046    ScaleDataReport,
19047    /// Usage ID `0x33`: "Scale Status Report"
19048    ScaleStatusReport,
19049    /// Usage ID `0x34`: "Scale Weight Limit Report"
19050    ScaleWeightLimitReport,
19051    /// Usage ID `0x35`: "Scale Statistics Report"
19052    ScaleStatisticsReport,
19053    /// Usage ID `0x40`: "Data Weight"
19054    DataWeight,
19055    /// Usage ID `0x41`: "Data Scaling"
19056    DataScaling,
19057    /// Usage ID `0x50`: "Weight Unit"
19058    WeightUnit,
19059    /// Usage ID `0x51`: "Weight Unit Milligram"
19060    WeightUnitMilligram,
19061    /// Usage ID `0x52`: "Weight Unit Gram"
19062    WeightUnitGram,
19063    /// Usage ID `0x53`: "Weight Unit Kilogram"
19064    WeightUnitKilogram,
19065    /// Usage ID `0x54`: "Weight Unit Carats"
19066    WeightUnitCarats,
19067    /// Usage ID `0x55`: "Weight Unit Taels"
19068    WeightUnitTaels,
19069    /// Usage ID `0x56`: "Weight Unit Grains"
19070    WeightUnitGrains,
19071    /// Usage ID `0x57`: "Weight Unit Pennyweights"
19072    WeightUnitPennyweights,
19073    /// Usage ID `0x58`: "Weight Unit Metric Ton"
19074    WeightUnitMetricTon,
19075    /// Usage ID `0x59`: "Weight Unit Avoir Ton"
19076    WeightUnitAvoirTon,
19077    /// Usage ID `0x5A`: "Weight Unit Troy Ounce"
19078    WeightUnitTroyOunce,
19079    /// Usage ID `0x5B`: "Weight Unit Ounce"
19080    WeightUnitOunce,
19081    /// Usage ID `0x5C`: "Weight Unit Pound"
19082    WeightUnitPound,
19083    /// Usage ID `0x60`: "Calibration Count"
19084    CalibrationCount,
19085    /// Usage ID `0x61`: "Re-Zero Count"
19086    ReZeroCount,
19087    /// Usage ID `0x70`: "Scale Status"
19088    ScaleStatus,
19089    /// Usage ID `0x71`: "Scale Status Fault"
19090    ScaleStatusFault,
19091    /// Usage ID `0x72`: "Scale Status Stable at Center of Zero"
19092    ScaleStatusStableatCenterofZero,
19093    /// Usage ID `0x73`: "Scale Status In Motion"
19094    ScaleStatusInMotion,
19095    /// Usage ID `0x74`: "Scale Status Weight Stable"
19096    ScaleStatusWeightStable,
19097    /// Usage ID `0x75`: "Scale Status Under Zero"
19098    ScaleStatusUnderZero,
19099    /// Usage ID `0x76`: "Scale Status Over Weight Limit"
19100    ScaleStatusOverWeightLimit,
19101    /// Usage ID `0x77`: "Scale Status Requires Calibration"
19102    ScaleStatusRequiresCalibration,
19103    /// Usage ID `0x78`: "Scale Status Requires Rezeroing"
19104    ScaleStatusRequiresRezeroing,
19105    /// Usage ID `0x80`: "Zero Scale"
19106    ZeroScale,
19107    /// Usage ID `0x81`: "Enforced Zero Return"
19108    EnforcedZeroReturn,
19109}
19110
19111impl Scales {
19112    #[cfg(feature = "std")]
19113    pub fn name(&self) -> String {
19114        match self {
19115            Scales::Scales => "Scales",
19116            Scales::ScaleDevice => "Scale Device",
19117            Scales::ScaleClass => "Scale Class",
19118            Scales::ScaleClassIMetric => "Scale Class I Metric",
19119            Scales::ScaleClassIIMetric => "Scale Class II Metric",
19120            Scales::ScaleClassIIIMetric => "Scale Class III Metric",
19121            Scales::ScaleClassIIILMetric => "Scale Class IIIL Metric",
19122            Scales::ScaleClassIVMetric => "Scale Class IV Metric",
19123            Scales::ScaleClassIIIEnglish => "Scale Class III English",
19124            Scales::ScaleClassIIILEnglish => "Scale Class IIIL English",
19125            Scales::ScaleClassIVEnglish => "Scale Class IV English",
19126            Scales::ScaleClassGeneric => "Scale Class Generic",
19127            Scales::ScaleAttributeReport => "Scale Attribute Report",
19128            Scales::ScaleControlReport => "Scale Control Report",
19129            Scales::ScaleDataReport => "Scale Data Report",
19130            Scales::ScaleStatusReport => "Scale Status Report",
19131            Scales::ScaleWeightLimitReport => "Scale Weight Limit Report",
19132            Scales::ScaleStatisticsReport => "Scale Statistics Report",
19133            Scales::DataWeight => "Data Weight",
19134            Scales::DataScaling => "Data Scaling",
19135            Scales::WeightUnit => "Weight Unit",
19136            Scales::WeightUnitMilligram => "Weight Unit Milligram",
19137            Scales::WeightUnitGram => "Weight Unit Gram",
19138            Scales::WeightUnitKilogram => "Weight Unit Kilogram",
19139            Scales::WeightUnitCarats => "Weight Unit Carats",
19140            Scales::WeightUnitTaels => "Weight Unit Taels",
19141            Scales::WeightUnitGrains => "Weight Unit Grains",
19142            Scales::WeightUnitPennyweights => "Weight Unit Pennyweights",
19143            Scales::WeightUnitMetricTon => "Weight Unit Metric Ton",
19144            Scales::WeightUnitAvoirTon => "Weight Unit Avoir Ton",
19145            Scales::WeightUnitTroyOunce => "Weight Unit Troy Ounce",
19146            Scales::WeightUnitOunce => "Weight Unit Ounce",
19147            Scales::WeightUnitPound => "Weight Unit Pound",
19148            Scales::CalibrationCount => "Calibration Count",
19149            Scales::ReZeroCount => "Re-Zero Count",
19150            Scales::ScaleStatus => "Scale Status",
19151            Scales::ScaleStatusFault => "Scale Status Fault",
19152            Scales::ScaleStatusStableatCenterofZero => "Scale Status Stable at Center of Zero",
19153            Scales::ScaleStatusInMotion => "Scale Status In Motion",
19154            Scales::ScaleStatusWeightStable => "Scale Status Weight Stable",
19155            Scales::ScaleStatusUnderZero => "Scale Status Under Zero",
19156            Scales::ScaleStatusOverWeightLimit => "Scale Status Over Weight Limit",
19157            Scales::ScaleStatusRequiresCalibration => "Scale Status Requires Calibration",
19158            Scales::ScaleStatusRequiresRezeroing => "Scale Status Requires Rezeroing",
19159            Scales::ZeroScale => "Zero Scale",
19160            Scales::EnforcedZeroReturn => "Enforced Zero Return",
19161        }
19162        .into()
19163    }
19164}
19165
19166#[cfg(feature = "std")]
19167impl fmt::Display for Scales {
19168    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19169        write!(f, "{}", self.name())
19170    }
19171}
19172
19173impl AsUsage for Scales {
19174    /// Returns the 32 bit Usage value of this Usage
19175    fn usage_value(&self) -> u32 {
19176        u32::from(self)
19177    }
19178
19179    /// Returns the 16 bit Usage ID value of this Usage
19180    fn usage_id_value(&self) -> u16 {
19181        u16::from(self)
19182    }
19183
19184    /// Returns this usage as [Usage::Scales(self)](Usage::Scales)
19185    /// This is a convenience function to avoid having
19186    /// to implement `From` for every used type in the caller.
19187    ///
19188    /// ```
19189    /// # use hut::*;
19190    /// let gd_x = GenericDesktop::X;
19191    /// let usage = Usage::from(GenericDesktop::X);
19192    /// assert!(matches!(gd_x.usage(), usage));
19193    /// ```
19194    fn usage(&self) -> Usage {
19195        Usage::from(self)
19196    }
19197}
19198
19199impl AsUsagePage for Scales {
19200    /// Returns the 16 bit value of this UsagePage
19201    ///
19202    /// This value is `0x8D` for [Scales]
19203    fn usage_page_value(&self) -> u16 {
19204        let up = UsagePage::from(self);
19205        u16::from(up)
19206    }
19207
19208    /// Returns [UsagePage::Scales]]
19209    fn usage_page(&self) -> UsagePage {
19210        UsagePage::from(self)
19211    }
19212}
19213
19214impl From<&Scales> for u16 {
19215    fn from(scales: &Scales) -> u16 {
19216        match *scales {
19217            Scales::Scales => 1,
19218            Scales::ScaleDevice => 32,
19219            Scales::ScaleClass => 33,
19220            Scales::ScaleClassIMetric => 34,
19221            Scales::ScaleClassIIMetric => 35,
19222            Scales::ScaleClassIIIMetric => 36,
19223            Scales::ScaleClassIIILMetric => 37,
19224            Scales::ScaleClassIVMetric => 38,
19225            Scales::ScaleClassIIIEnglish => 39,
19226            Scales::ScaleClassIIILEnglish => 40,
19227            Scales::ScaleClassIVEnglish => 41,
19228            Scales::ScaleClassGeneric => 42,
19229            Scales::ScaleAttributeReport => 48,
19230            Scales::ScaleControlReport => 49,
19231            Scales::ScaleDataReport => 50,
19232            Scales::ScaleStatusReport => 51,
19233            Scales::ScaleWeightLimitReport => 52,
19234            Scales::ScaleStatisticsReport => 53,
19235            Scales::DataWeight => 64,
19236            Scales::DataScaling => 65,
19237            Scales::WeightUnit => 80,
19238            Scales::WeightUnitMilligram => 81,
19239            Scales::WeightUnitGram => 82,
19240            Scales::WeightUnitKilogram => 83,
19241            Scales::WeightUnitCarats => 84,
19242            Scales::WeightUnitTaels => 85,
19243            Scales::WeightUnitGrains => 86,
19244            Scales::WeightUnitPennyweights => 87,
19245            Scales::WeightUnitMetricTon => 88,
19246            Scales::WeightUnitAvoirTon => 89,
19247            Scales::WeightUnitTroyOunce => 90,
19248            Scales::WeightUnitOunce => 91,
19249            Scales::WeightUnitPound => 92,
19250            Scales::CalibrationCount => 96,
19251            Scales::ReZeroCount => 97,
19252            Scales::ScaleStatus => 112,
19253            Scales::ScaleStatusFault => 113,
19254            Scales::ScaleStatusStableatCenterofZero => 114,
19255            Scales::ScaleStatusInMotion => 115,
19256            Scales::ScaleStatusWeightStable => 116,
19257            Scales::ScaleStatusUnderZero => 117,
19258            Scales::ScaleStatusOverWeightLimit => 118,
19259            Scales::ScaleStatusRequiresCalibration => 119,
19260            Scales::ScaleStatusRequiresRezeroing => 120,
19261            Scales::ZeroScale => 128,
19262            Scales::EnforcedZeroReturn => 129,
19263        }
19264    }
19265}
19266
19267impl From<Scales> for u16 {
19268    /// Returns the 16bit value of this usage. This is identical
19269    /// to [Scales::usage_page_value()].
19270    fn from(scales: Scales) -> u16 {
19271        u16::from(&scales)
19272    }
19273}
19274
19275impl From<&Scales> for u32 {
19276    /// Returns the 32 bit value of this usage. This is identical
19277    /// to [Scales::usage_value()].
19278    fn from(scales: &Scales) -> u32 {
19279        let up = UsagePage::from(scales);
19280        let up = (u16::from(&up) as u32) << 16;
19281        let id = u16::from(scales) as u32;
19282        up | id
19283    }
19284}
19285
19286impl From<&Scales> for UsagePage {
19287    /// Always returns [UsagePage::Scales] and is
19288    /// identical to [Scales::usage_page()].
19289    fn from(_: &Scales) -> UsagePage {
19290        UsagePage::Scales
19291    }
19292}
19293
19294impl From<Scales> for UsagePage {
19295    /// Always returns [UsagePage::Scales] and is
19296    /// identical to [Scales::usage_page()].
19297    fn from(_: Scales) -> UsagePage {
19298        UsagePage::Scales
19299    }
19300}
19301
19302impl From<&Scales> for Usage {
19303    fn from(scales: &Scales) -> Usage {
19304        Usage::try_from(u32::from(scales)).unwrap()
19305    }
19306}
19307
19308impl From<Scales> for Usage {
19309    fn from(scales: Scales) -> Usage {
19310        Usage::from(&scales)
19311    }
19312}
19313
19314impl TryFrom<u16> for Scales {
19315    type Error = HutError;
19316
19317    fn try_from(usage_id: u16) -> Result<Scales> {
19318        match usage_id {
19319            1 => Ok(Scales::Scales),
19320            32 => Ok(Scales::ScaleDevice),
19321            33 => Ok(Scales::ScaleClass),
19322            34 => Ok(Scales::ScaleClassIMetric),
19323            35 => Ok(Scales::ScaleClassIIMetric),
19324            36 => Ok(Scales::ScaleClassIIIMetric),
19325            37 => Ok(Scales::ScaleClassIIILMetric),
19326            38 => Ok(Scales::ScaleClassIVMetric),
19327            39 => Ok(Scales::ScaleClassIIIEnglish),
19328            40 => Ok(Scales::ScaleClassIIILEnglish),
19329            41 => Ok(Scales::ScaleClassIVEnglish),
19330            42 => Ok(Scales::ScaleClassGeneric),
19331            48 => Ok(Scales::ScaleAttributeReport),
19332            49 => Ok(Scales::ScaleControlReport),
19333            50 => Ok(Scales::ScaleDataReport),
19334            51 => Ok(Scales::ScaleStatusReport),
19335            52 => Ok(Scales::ScaleWeightLimitReport),
19336            53 => Ok(Scales::ScaleStatisticsReport),
19337            64 => Ok(Scales::DataWeight),
19338            65 => Ok(Scales::DataScaling),
19339            80 => Ok(Scales::WeightUnit),
19340            81 => Ok(Scales::WeightUnitMilligram),
19341            82 => Ok(Scales::WeightUnitGram),
19342            83 => Ok(Scales::WeightUnitKilogram),
19343            84 => Ok(Scales::WeightUnitCarats),
19344            85 => Ok(Scales::WeightUnitTaels),
19345            86 => Ok(Scales::WeightUnitGrains),
19346            87 => Ok(Scales::WeightUnitPennyweights),
19347            88 => Ok(Scales::WeightUnitMetricTon),
19348            89 => Ok(Scales::WeightUnitAvoirTon),
19349            90 => Ok(Scales::WeightUnitTroyOunce),
19350            91 => Ok(Scales::WeightUnitOunce),
19351            92 => Ok(Scales::WeightUnitPound),
19352            96 => Ok(Scales::CalibrationCount),
19353            97 => Ok(Scales::ReZeroCount),
19354            112 => Ok(Scales::ScaleStatus),
19355            113 => Ok(Scales::ScaleStatusFault),
19356            114 => Ok(Scales::ScaleStatusStableatCenterofZero),
19357            115 => Ok(Scales::ScaleStatusInMotion),
19358            116 => Ok(Scales::ScaleStatusWeightStable),
19359            117 => Ok(Scales::ScaleStatusUnderZero),
19360            118 => Ok(Scales::ScaleStatusOverWeightLimit),
19361            119 => Ok(Scales::ScaleStatusRequiresCalibration),
19362            120 => Ok(Scales::ScaleStatusRequiresRezeroing),
19363            128 => Ok(Scales::ZeroScale),
19364            129 => Ok(Scales::EnforcedZeroReturn),
19365            n => Err(HutError::UnknownUsageId { usage_id: n }),
19366        }
19367    }
19368}
19369
19370impl BitOr<u16> for Scales {
19371    type Output = Usage;
19372
19373    /// A convenience function to combine a Usage Page with
19374    /// a value.
19375    ///
19376    /// This function panics if the Usage ID value results in
19377    /// an unknown Usage. Where error checking is required,
19378    /// use [UsagePage::to_usage_from_value].
19379    fn bitor(self, usage: u16) -> Usage {
19380        let up = u16::from(self) as u32;
19381        let u = usage as u32;
19382        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
19383    }
19384}
19385
19386/// *Usage Page `0x8E`: "Magnetic Stripe Reader"*
19387///
19388/// **This enum is autogenerated from the HID Usage Tables**.
19389/// ```
19390/// # use hut::*;
19391/// let u1 = Usage::MagneticStripeReader(MagneticStripeReader::Track1Length);
19392/// let u2 = Usage::new_from_page_and_id(0x8E, 0x11).unwrap();
19393/// let u3 = Usage::from(MagneticStripeReader::Track1Length);
19394/// let u4: Usage = MagneticStripeReader::Track1Length.into();
19395/// assert_eq!(u1, u2);
19396/// assert_eq!(u1, u3);
19397/// assert_eq!(u1, u4);
19398///
19399/// assert!(matches!(u1.usage_page(), UsagePage::MagneticStripeReader));
19400/// assert_eq!(0x8E, u1.usage_page_value());
19401/// assert_eq!(0x11, u1.usage_id_value());
19402/// assert_eq!((0x8E << 16) | 0x11, u1.usage_value());
19403/// assert_eq!("Track 1 Length", u1.name());
19404/// ```
19405///
19406#[allow(non_camel_case_types)]
19407#[derive(Debug)]
19408#[non_exhaustive]
19409pub enum MagneticStripeReader {
19410    /// Usage ID `0x1`: "MSR Device Read-Only"
19411    MSRDeviceReadOnly,
19412    /// Usage ID `0x11`: "Track 1 Length"
19413    Track1Length,
19414    /// Usage ID `0x12`: "Track 2 Length"
19415    Track2Length,
19416    /// Usage ID `0x13`: "Track 3 Length"
19417    Track3Length,
19418    /// Usage ID `0x14`: "Track JIS Length"
19419    TrackJISLength,
19420    /// Usage ID `0x20`: "Track Data"
19421    TrackData,
19422    /// Usage ID `0x21`: "Track 1 Data"
19423    Track1Data,
19424    /// Usage ID `0x22`: "Track 2 Data"
19425    Track2Data,
19426    /// Usage ID `0x23`: "Track 3 Data"
19427    Track3Data,
19428    /// Usage ID `0x24`: "Track JIS Data"
19429    TrackJISData,
19430}
19431
19432impl MagneticStripeReader {
19433    #[cfg(feature = "std")]
19434    pub fn name(&self) -> String {
19435        match self {
19436            MagneticStripeReader::MSRDeviceReadOnly => "MSR Device Read-Only",
19437            MagneticStripeReader::Track1Length => "Track 1 Length",
19438            MagneticStripeReader::Track2Length => "Track 2 Length",
19439            MagneticStripeReader::Track3Length => "Track 3 Length",
19440            MagneticStripeReader::TrackJISLength => "Track JIS Length",
19441            MagneticStripeReader::TrackData => "Track Data",
19442            MagneticStripeReader::Track1Data => "Track 1 Data",
19443            MagneticStripeReader::Track2Data => "Track 2 Data",
19444            MagneticStripeReader::Track3Data => "Track 3 Data",
19445            MagneticStripeReader::TrackJISData => "Track JIS Data",
19446        }
19447        .into()
19448    }
19449}
19450
19451#[cfg(feature = "std")]
19452impl fmt::Display for MagneticStripeReader {
19453    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19454        write!(f, "{}", self.name())
19455    }
19456}
19457
19458impl AsUsage for MagneticStripeReader {
19459    /// Returns the 32 bit Usage value of this Usage
19460    fn usage_value(&self) -> u32 {
19461        u32::from(self)
19462    }
19463
19464    /// Returns the 16 bit Usage ID value of this Usage
19465    fn usage_id_value(&self) -> u16 {
19466        u16::from(self)
19467    }
19468
19469    /// Returns this usage as [Usage::MagneticStripeReader(self)](Usage::MagneticStripeReader)
19470    /// This is a convenience function to avoid having
19471    /// to implement `From` for every used type in the caller.
19472    ///
19473    /// ```
19474    /// # use hut::*;
19475    /// let gd_x = GenericDesktop::X;
19476    /// let usage = Usage::from(GenericDesktop::X);
19477    /// assert!(matches!(gd_x.usage(), usage));
19478    /// ```
19479    fn usage(&self) -> Usage {
19480        Usage::from(self)
19481    }
19482}
19483
19484impl AsUsagePage for MagneticStripeReader {
19485    /// Returns the 16 bit value of this UsagePage
19486    ///
19487    /// This value is `0x8E` for [MagneticStripeReader]
19488    fn usage_page_value(&self) -> u16 {
19489        let up = UsagePage::from(self);
19490        u16::from(up)
19491    }
19492
19493    /// Returns [UsagePage::MagneticStripeReader]]
19494    fn usage_page(&self) -> UsagePage {
19495        UsagePage::from(self)
19496    }
19497}
19498
19499impl From<&MagneticStripeReader> for u16 {
19500    fn from(magneticstripereader: &MagneticStripeReader) -> u16 {
19501        match *magneticstripereader {
19502            MagneticStripeReader::MSRDeviceReadOnly => 1,
19503            MagneticStripeReader::Track1Length => 17,
19504            MagneticStripeReader::Track2Length => 18,
19505            MagneticStripeReader::Track3Length => 19,
19506            MagneticStripeReader::TrackJISLength => 20,
19507            MagneticStripeReader::TrackData => 32,
19508            MagneticStripeReader::Track1Data => 33,
19509            MagneticStripeReader::Track2Data => 34,
19510            MagneticStripeReader::Track3Data => 35,
19511            MagneticStripeReader::TrackJISData => 36,
19512        }
19513    }
19514}
19515
19516impl From<MagneticStripeReader> for u16 {
19517    /// Returns the 16bit value of this usage. This is identical
19518    /// to [MagneticStripeReader::usage_page_value()].
19519    fn from(magneticstripereader: MagneticStripeReader) -> u16 {
19520        u16::from(&magneticstripereader)
19521    }
19522}
19523
19524impl From<&MagneticStripeReader> for u32 {
19525    /// Returns the 32 bit value of this usage. This is identical
19526    /// to [MagneticStripeReader::usage_value()].
19527    fn from(magneticstripereader: &MagneticStripeReader) -> u32 {
19528        let up = UsagePage::from(magneticstripereader);
19529        let up = (u16::from(&up) as u32) << 16;
19530        let id = u16::from(magneticstripereader) as u32;
19531        up | id
19532    }
19533}
19534
19535impl From<&MagneticStripeReader> for UsagePage {
19536    /// Always returns [UsagePage::MagneticStripeReader] and is
19537    /// identical to [MagneticStripeReader::usage_page()].
19538    fn from(_: &MagneticStripeReader) -> UsagePage {
19539        UsagePage::MagneticStripeReader
19540    }
19541}
19542
19543impl From<MagneticStripeReader> for UsagePage {
19544    /// Always returns [UsagePage::MagneticStripeReader] and is
19545    /// identical to [MagneticStripeReader::usage_page()].
19546    fn from(_: MagneticStripeReader) -> UsagePage {
19547        UsagePage::MagneticStripeReader
19548    }
19549}
19550
19551impl From<&MagneticStripeReader> for Usage {
19552    fn from(magneticstripereader: &MagneticStripeReader) -> Usage {
19553        Usage::try_from(u32::from(magneticstripereader)).unwrap()
19554    }
19555}
19556
19557impl From<MagneticStripeReader> for Usage {
19558    fn from(magneticstripereader: MagneticStripeReader) -> Usage {
19559        Usage::from(&magneticstripereader)
19560    }
19561}
19562
19563impl TryFrom<u16> for MagneticStripeReader {
19564    type Error = HutError;
19565
19566    fn try_from(usage_id: u16) -> Result<MagneticStripeReader> {
19567        match usage_id {
19568            1 => Ok(MagneticStripeReader::MSRDeviceReadOnly),
19569            17 => Ok(MagneticStripeReader::Track1Length),
19570            18 => Ok(MagneticStripeReader::Track2Length),
19571            19 => Ok(MagneticStripeReader::Track3Length),
19572            20 => Ok(MagneticStripeReader::TrackJISLength),
19573            32 => Ok(MagneticStripeReader::TrackData),
19574            33 => Ok(MagneticStripeReader::Track1Data),
19575            34 => Ok(MagneticStripeReader::Track2Data),
19576            35 => Ok(MagneticStripeReader::Track3Data),
19577            36 => Ok(MagneticStripeReader::TrackJISData),
19578            n => Err(HutError::UnknownUsageId { usage_id: n }),
19579        }
19580    }
19581}
19582
19583impl BitOr<u16> for MagneticStripeReader {
19584    type Output = Usage;
19585
19586    /// A convenience function to combine a Usage Page with
19587    /// a value.
19588    ///
19589    /// This function panics if the Usage ID value results in
19590    /// an unknown Usage. Where error checking is required,
19591    /// use [UsagePage::to_usage_from_value].
19592    fn bitor(self, usage: u16) -> Usage {
19593        let up = u16::from(self) as u32;
19594        let u = usage as u32;
19595        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
19596    }
19597}
19598
19599/// *Usage Page `0x90`: "Camera Control"*
19600///
19601/// **This enum is autogenerated from the HID Usage Tables**.
19602/// ```
19603/// # use hut::*;
19604/// let u1 = Usage::CameraControl(CameraControl::CameraShutter);
19605/// let u2 = Usage::new_from_page_and_id(0x90, 0x21).unwrap();
19606/// let u3 = Usage::from(CameraControl::CameraShutter);
19607/// let u4: Usage = CameraControl::CameraShutter.into();
19608/// assert_eq!(u1, u2);
19609/// assert_eq!(u1, u3);
19610/// assert_eq!(u1, u4);
19611///
19612/// assert!(matches!(u1.usage_page(), UsagePage::CameraControl));
19613/// assert_eq!(0x90, u1.usage_page_value());
19614/// assert_eq!(0x21, u1.usage_id_value());
19615/// assert_eq!((0x90 << 16) | 0x21, u1.usage_value());
19616/// assert_eq!("Camera Shutter", u1.name());
19617/// ```
19618///
19619#[allow(non_camel_case_types)]
19620#[derive(Debug)]
19621#[non_exhaustive]
19622pub enum CameraControl {
19623    /// Usage ID `0x20`: "Camera Auto-focus"
19624    CameraAutofocus,
19625    /// Usage ID `0x21`: "Camera Shutter"
19626    CameraShutter,
19627}
19628
19629impl CameraControl {
19630    #[cfg(feature = "std")]
19631    pub fn name(&self) -> String {
19632        match self {
19633            CameraControl::CameraAutofocus => "Camera Auto-focus",
19634            CameraControl::CameraShutter => "Camera Shutter",
19635        }
19636        .into()
19637    }
19638}
19639
19640#[cfg(feature = "std")]
19641impl fmt::Display for CameraControl {
19642    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19643        write!(f, "{}", self.name())
19644    }
19645}
19646
19647impl AsUsage for CameraControl {
19648    /// Returns the 32 bit Usage value of this Usage
19649    fn usage_value(&self) -> u32 {
19650        u32::from(self)
19651    }
19652
19653    /// Returns the 16 bit Usage ID value of this Usage
19654    fn usage_id_value(&self) -> u16 {
19655        u16::from(self)
19656    }
19657
19658    /// Returns this usage as [Usage::CameraControl(self)](Usage::CameraControl)
19659    /// This is a convenience function to avoid having
19660    /// to implement `From` for every used type in the caller.
19661    ///
19662    /// ```
19663    /// # use hut::*;
19664    /// let gd_x = GenericDesktop::X;
19665    /// let usage = Usage::from(GenericDesktop::X);
19666    /// assert!(matches!(gd_x.usage(), usage));
19667    /// ```
19668    fn usage(&self) -> Usage {
19669        Usage::from(self)
19670    }
19671}
19672
19673impl AsUsagePage for CameraControl {
19674    /// Returns the 16 bit value of this UsagePage
19675    ///
19676    /// This value is `0x90` for [CameraControl]
19677    fn usage_page_value(&self) -> u16 {
19678        let up = UsagePage::from(self);
19679        u16::from(up)
19680    }
19681
19682    /// Returns [UsagePage::CameraControl]]
19683    fn usage_page(&self) -> UsagePage {
19684        UsagePage::from(self)
19685    }
19686}
19687
19688impl From<&CameraControl> for u16 {
19689    fn from(cameracontrol: &CameraControl) -> u16 {
19690        match *cameracontrol {
19691            CameraControl::CameraAutofocus => 32,
19692            CameraControl::CameraShutter => 33,
19693        }
19694    }
19695}
19696
19697impl From<CameraControl> for u16 {
19698    /// Returns the 16bit value of this usage. This is identical
19699    /// to [CameraControl::usage_page_value()].
19700    fn from(cameracontrol: CameraControl) -> u16 {
19701        u16::from(&cameracontrol)
19702    }
19703}
19704
19705impl From<&CameraControl> for u32 {
19706    /// Returns the 32 bit value of this usage. This is identical
19707    /// to [CameraControl::usage_value()].
19708    fn from(cameracontrol: &CameraControl) -> u32 {
19709        let up = UsagePage::from(cameracontrol);
19710        let up = (u16::from(&up) as u32) << 16;
19711        let id = u16::from(cameracontrol) as u32;
19712        up | id
19713    }
19714}
19715
19716impl From<&CameraControl> for UsagePage {
19717    /// Always returns [UsagePage::CameraControl] and is
19718    /// identical to [CameraControl::usage_page()].
19719    fn from(_: &CameraControl) -> UsagePage {
19720        UsagePage::CameraControl
19721    }
19722}
19723
19724impl From<CameraControl> for UsagePage {
19725    /// Always returns [UsagePage::CameraControl] and is
19726    /// identical to [CameraControl::usage_page()].
19727    fn from(_: CameraControl) -> UsagePage {
19728        UsagePage::CameraControl
19729    }
19730}
19731
19732impl From<&CameraControl> for Usage {
19733    fn from(cameracontrol: &CameraControl) -> Usage {
19734        Usage::try_from(u32::from(cameracontrol)).unwrap()
19735    }
19736}
19737
19738impl From<CameraControl> for Usage {
19739    fn from(cameracontrol: CameraControl) -> Usage {
19740        Usage::from(&cameracontrol)
19741    }
19742}
19743
19744impl TryFrom<u16> for CameraControl {
19745    type Error = HutError;
19746
19747    fn try_from(usage_id: u16) -> Result<CameraControl> {
19748        match usage_id {
19749            32 => Ok(CameraControl::CameraAutofocus),
19750            33 => Ok(CameraControl::CameraShutter),
19751            n => Err(HutError::UnknownUsageId { usage_id: n }),
19752        }
19753    }
19754}
19755
19756impl BitOr<u16> for CameraControl {
19757    type Output = Usage;
19758
19759    /// A convenience function to combine a Usage Page with
19760    /// a value.
19761    ///
19762    /// This function panics if the Usage ID value results in
19763    /// an unknown Usage. Where error checking is required,
19764    /// use [UsagePage::to_usage_from_value].
19765    fn bitor(self, usage: u16) -> Usage {
19766        let up = u16::from(self) as u32;
19767        let u = usage as u32;
19768        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
19769    }
19770}
19771
19772/// *Usage Page `0x91`: "Arcade"*
19773///
19774/// **This enum is autogenerated from the HID Usage Tables**.
19775/// ```
19776/// # use hut::*;
19777/// let u1 = Usage::Arcade(Arcade::CoinDoor);
19778/// let u2 = Usage::new_from_page_and_id(0x91, 0x2).unwrap();
19779/// let u3 = Usage::from(Arcade::CoinDoor);
19780/// let u4: Usage = Arcade::CoinDoor.into();
19781/// assert_eq!(u1, u2);
19782/// assert_eq!(u1, u3);
19783/// assert_eq!(u1, u4);
19784///
19785/// assert!(matches!(u1.usage_page(), UsagePage::Arcade));
19786/// assert_eq!(0x91, u1.usage_page_value());
19787/// assert_eq!(0x2, u1.usage_id_value());
19788/// assert_eq!((0x91 << 16) | 0x2, u1.usage_value());
19789/// assert_eq!("Coin Door", u1.name());
19790/// ```
19791///
19792#[allow(non_camel_case_types)]
19793#[derive(Debug)]
19794#[non_exhaustive]
19795pub enum Arcade {
19796    /// Usage ID `0x1`: "General Purpose IO Card"
19797    GeneralPurposeIOCard,
19798    /// Usage ID `0x2`: "Coin Door"
19799    CoinDoor,
19800    /// Usage ID `0x3`: "Watchdog Timer"
19801    WatchdogTimer,
19802    /// Usage ID `0x30`: "General Purpose Analog Input State"
19803    GeneralPurposeAnalogInputState,
19804    /// Usage ID `0x31`: "General Purpose Digital Input State"
19805    GeneralPurposeDigitalInputState,
19806    /// Usage ID `0x32`: "General Purpose Optical Input State"
19807    GeneralPurposeOpticalInputState,
19808    /// Usage ID `0x33`: "General Purpose Digital Output State"
19809    GeneralPurposeDigitalOutputState,
19810    /// Usage ID `0x34`: "Number of Coin Doors"
19811    NumberofCoinDoors,
19812    /// Usage ID `0x35`: "Coin Drawer Drop Count"
19813    CoinDrawerDropCount,
19814    /// Usage ID `0x36`: "Coin Drawer Start"
19815    CoinDrawerStart,
19816    /// Usage ID `0x37`: "Coin Drawer Service"
19817    CoinDrawerService,
19818    /// Usage ID `0x38`: "Coin Drawer Tilt"
19819    CoinDrawerTilt,
19820    /// Usage ID `0x39`: "Coin Door Test"
19821    CoinDoorTest,
19822    /// Usage ID `0x40`: "Coin Door Lockout"
19823    CoinDoorLockout,
19824    /// Usage ID `0x41`: "Watchdog Timeout"
19825    WatchdogTimeout,
19826    /// Usage ID `0x42`: "Watchdog Action"
19827    WatchdogAction,
19828    /// Usage ID `0x43`: "Watchdog Reboot"
19829    WatchdogReboot,
19830    /// Usage ID `0x44`: "Watchdog Restart"
19831    WatchdogRestart,
19832    /// Usage ID `0x45`: "Alarm Input"
19833    AlarmInput,
19834    /// Usage ID `0x46`: "Coin Door Counter"
19835    CoinDoorCounter,
19836    /// Usage ID `0x47`: "I/O Direction Mapping"
19837    IODirectionMapping,
19838    /// Usage ID `0x48`: "Set I/O Direction Mapping"
19839    SetIODirectionMapping,
19840    /// Usage ID `0x49`: "Extended Optical Input State"
19841    ExtendedOpticalInputState,
19842    /// Usage ID `0x4A`: "Pin Pad Input State"
19843    PinPadInputState,
19844    /// Usage ID `0x4B`: "Pin Pad Status"
19845    PinPadStatus,
19846    /// Usage ID `0x4C`: "Pin Pad Output"
19847    PinPadOutput,
19848    /// Usage ID `0x4D`: "Pin Pad Command"
19849    PinPadCommand,
19850}
19851
19852impl Arcade {
19853    #[cfg(feature = "std")]
19854    pub fn name(&self) -> String {
19855        match self {
19856            Arcade::GeneralPurposeIOCard => "General Purpose IO Card",
19857            Arcade::CoinDoor => "Coin Door",
19858            Arcade::WatchdogTimer => "Watchdog Timer",
19859            Arcade::GeneralPurposeAnalogInputState => "General Purpose Analog Input State",
19860            Arcade::GeneralPurposeDigitalInputState => "General Purpose Digital Input State",
19861            Arcade::GeneralPurposeOpticalInputState => "General Purpose Optical Input State",
19862            Arcade::GeneralPurposeDigitalOutputState => "General Purpose Digital Output State",
19863            Arcade::NumberofCoinDoors => "Number of Coin Doors",
19864            Arcade::CoinDrawerDropCount => "Coin Drawer Drop Count",
19865            Arcade::CoinDrawerStart => "Coin Drawer Start",
19866            Arcade::CoinDrawerService => "Coin Drawer Service",
19867            Arcade::CoinDrawerTilt => "Coin Drawer Tilt",
19868            Arcade::CoinDoorTest => "Coin Door Test",
19869            Arcade::CoinDoorLockout => "Coin Door Lockout",
19870            Arcade::WatchdogTimeout => "Watchdog Timeout",
19871            Arcade::WatchdogAction => "Watchdog Action",
19872            Arcade::WatchdogReboot => "Watchdog Reboot",
19873            Arcade::WatchdogRestart => "Watchdog Restart",
19874            Arcade::AlarmInput => "Alarm Input",
19875            Arcade::CoinDoorCounter => "Coin Door Counter",
19876            Arcade::IODirectionMapping => "I/O Direction Mapping",
19877            Arcade::SetIODirectionMapping => "Set I/O Direction Mapping",
19878            Arcade::ExtendedOpticalInputState => "Extended Optical Input State",
19879            Arcade::PinPadInputState => "Pin Pad Input State",
19880            Arcade::PinPadStatus => "Pin Pad Status",
19881            Arcade::PinPadOutput => "Pin Pad Output",
19882            Arcade::PinPadCommand => "Pin Pad Command",
19883        }
19884        .into()
19885    }
19886}
19887
19888#[cfg(feature = "std")]
19889impl fmt::Display for Arcade {
19890    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19891        write!(f, "{}", self.name())
19892    }
19893}
19894
19895impl AsUsage for Arcade {
19896    /// Returns the 32 bit Usage value of this Usage
19897    fn usage_value(&self) -> u32 {
19898        u32::from(self)
19899    }
19900
19901    /// Returns the 16 bit Usage ID value of this Usage
19902    fn usage_id_value(&self) -> u16 {
19903        u16::from(self)
19904    }
19905
19906    /// Returns this usage as [Usage::Arcade(self)](Usage::Arcade)
19907    /// This is a convenience function to avoid having
19908    /// to implement `From` for every used type in the caller.
19909    ///
19910    /// ```
19911    /// # use hut::*;
19912    /// let gd_x = GenericDesktop::X;
19913    /// let usage = Usage::from(GenericDesktop::X);
19914    /// assert!(matches!(gd_x.usage(), usage));
19915    /// ```
19916    fn usage(&self) -> Usage {
19917        Usage::from(self)
19918    }
19919}
19920
19921impl AsUsagePage for Arcade {
19922    /// Returns the 16 bit value of this UsagePage
19923    ///
19924    /// This value is `0x91` for [Arcade]
19925    fn usage_page_value(&self) -> u16 {
19926        let up = UsagePage::from(self);
19927        u16::from(up)
19928    }
19929
19930    /// Returns [UsagePage::Arcade]]
19931    fn usage_page(&self) -> UsagePage {
19932        UsagePage::from(self)
19933    }
19934}
19935
19936impl From<&Arcade> for u16 {
19937    fn from(arcade: &Arcade) -> u16 {
19938        match *arcade {
19939            Arcade::GeneralPurposeIOCard => 1,
19940            Arcade::CoinDoor => 2,
19941            Arcade::WatchdogTimer => 3,
19942            Arcade::GeneralPurposeAnalogInputState => 48,
19943            Arcade::GeneralPurposeDigitalInputState => 49,
19944            Arcade::GeneralPurposeOpticalInputState => 50,
19945            Arcade::GeneralPurposeDigitalOutputState => 51,
19946            Arcade::NumberofCoinDoors => 52,
19947            Arcade::CoinDrawerDropCount => 53,
19948            Arcade::CoinDrawerStart => 54,
19949            Arcade::CoinDrawerService => 55,
19950            Arcade::CoinDrawerTilt => 56,
19951            Arcade::CoinDoorTest => 57,
19952            Arcade::CoinDoorLockout => 64,
19953            Arcade::WatchdogTimeout => 65,
19954            Arcade::WatchdogAction => 66,
19955            Arcade::WatchdogReboot => 67,
19956            Arcade::WatchdogRestart => 68,
19957            Arcade::AlarmInput => 69,
19958            Arcade::CoinDoorCounter => 70,
19959            Arcade::IODirectionMapping => 71,
19960            Arcade::SetIODirectionMapping => 72,
19961            Arcade::ExtendedOpticalInputState => 73,
19962            Arcade::PinPadInputState => 74,
19963            Arcade::PinPadStatus => 75,
19964            Arcade::PinPadOutput => 76,
19965            Arcade::PinPadCommand => 77,
19966        }
19967    }
19968}
19969
19970impl From<Arcade> for u16 {
19971    /// Returns the 16bit value of this usage. This is identical
19972    /// to [Arcade::usage_page_value()].
19973    fn from(arcade: Arcade) -> u16 {
19974        u16::from(&arcade)
19975    }
19976}
19977
19978impl From<&Arcade> for u32 {
19979    /// Returns the 32 bit value of this usage. This is identical
19980    /// to [Arcade::usage_value()].
19981    fn from(arcade: &Arcade) -> u32 {
19982        let up = UsagePage::from(arcade);
19983        let up = (u16::from(&up) as u32) << 16;
19984        let id = u16::from(arcade) as u32;
19985        up | id
19986    }
19987}
19988
19989impl From<&Arcade> for UsagePage {
19990    /// Always returns [UsagePage::Arcade] and is
19991    /// identical to [Arcade::usage_page()].
19992    fn from(_: &Arcade) -> UsagePage {
19993        UsagePage::Arcade
19994    }
19995}
19996
19997impl From<Arcade> for UsagePage {
19998    /// Always returns [UsagePage::Arcade] and is
19999    /// identical to [Arcade::usage_page()].
20000    fn from(_: Arcade) -> UsagePage {
20001        UsagePage::Arcade
20002    }
20003}
20004
20005impl From<&Arcade> for Usage {
20006    fn from(arcade: &Arcade) -> Usage {
20007        Usage::try_from(u32::from(arcade)).unwrap()
20008    }
20009}
20010
20011impl From<Arcade> for Usage {
20012    fn from(arcade: Arcade) -> Usage {
20013        Usage::from(&arcade)
20014    }
20015}
20016
20017impl TryFrom<u16> for Arcade {
20018    type Error = HutError;
20019
20020    fn try_from(usage_id: u16) -> Result<Arcade> {
20021        match usage_id {
20022            1 => Ok(Arcade::GeneralPurposeIOCard),
20023            2 => Ok(Arcade::CoinDoor),
20024            3 => Ok(Arcade::WatchdogTimer),
20025            48 => Ok(Arcade::GeneralPurposeAnalogInputState),
20026            49 => Ok(Arcade::GeneralPurposeDigitalInputState),
20027            50 => Ok(Arcade::GeneralPurposeOpticalInputState),
20028            51 => Ok(Arcade::GeneralPurposeDigitalOutputState),
20029            52 => Ok(Arcade::NumberofCoinDoors),
20030            53 => Ok(Arcade::CoinDrawerDropCount),
20031            54 => Ok(Arcade::CoinDrawerStart),
20032            55 => Ok(Arcade::CoinDrawerService),
20033            56 => Ok(Arcade::CoinDrawerTilt),
20034            57 => Ok(Arcade::CoinDoorTest),
20035            64 => Ok(Arcade::CoinDoorLockout),
20036            65 => Ok(Arcade::WatchdogTimeout),
20037            66 => Ok(Arcade::WatchdogAction),
20038            67 => Ok(Arcade::WatchdogReboot),
20039            68 => Ok(Arcade::WatchdogRestart),
20040            69 => Ok(Arcade::AlarmInput),
20041            70 => Ok(Arcade::CoinDoorCounter),
20042            71 => Ok(Arcade::IODirectionMapping),
20043            72 => Ok(Arcade::SetIODirectionMapping),
20044            73 => Ok(Arcade::ExtendedOpticalInputState),
20045            74 => Ok(Arcade::PinPadInputState),
20046            75 => Ok(Arcade::PinPadStatus),
20047            76 => Ok(Arcade::PinPadOutput),
20048            77 => Ok(Arcade::PinPadCommand),
20049            n => Err(HutError::UnknownUsageId { usage_id: n }),
20050        }
20051    }
20052}
20053
20054impl BitOr<u16> for Arcade {
20055    type Output = Usage;
20056
20057    /// A convenience function to combine a Usage Page with
20058    /// a value.
20059    ///
20060    /// This function panics if the Usage ID value results in
20061    /// an unknown Usage. Where error checking is required,
20062    /// use [UsagePage::to_usage_from_value].
20063    fn bitor(self, usage: u16) -> Usage {
20064        let up = u16::from(self) as u32;
20065        let u = usage as u32;
20066        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
20067    }
20068}
20069
20070/// *Usage Page `0xF1D0`: "FIDO Alliance"*
20071///
20072/// **This enum is autogenerated from the HID Usage Tables**.
20073/// ```
20074/// # use hut::*;
20075/// let u1 = Usage::FIDOAlliance(FIDOAlliance::InputReportData);
20076/// let u2 = Usage::new_from_page_and_id(0xF1D0, 0x20).unwrap();
20077/// let u3 = Usage::from(FIDOAlliance::InputReportData);
20078/// let u4: Usage = FIDOAlliance::InputReportData.into();
20079/// assert_eq!(u1, u2);
20080/// assert_eq!(u1, u3);
20081/// assert_eq!(u1, u4);
20082///
20083/// assert!(matches!(u1.usage_page(), UsagePage::FIDOAlliance));
20084/// assert_eq!(0xF1D0, u1.usage_page_value());
20085/// assert_eq!(0x20, u1.usage_id_value());
20086/// assert_eq!((0xF1D0 << 16) | 0x20, u1.usage_value());
20087/// assert_eq!("Input Report Data", u1.name());
20088/// ```
20089///
20090#[allow(non_camel_case_types)]
20091#[derive(Debug)]
20092#[non_exhaustive]
20093pub enum FIDOAlliance {
20094    /// Usage ID `0x1`: "U2F Authenticator Device"
20095    U2FAuthenticatorDevice,
20096    /// Usage ID `0x20`: "Input Report Data"
20097    InputReportData,
20098    /// Usage ID `0x21`: "Output Report Data"
20099    OutputReportData,
20100}
20101
20102impl FIDOAlliance {
20103    #[cfg(feature = "std")]
20104    pub fn name(&self) -> String {
20105        match self {
20106            FIDOAlliance::U2FAuthenticatorDevice => "U2F Authenticator Device",
20107            FIDOAlliance::InputReportData => "Input Report Data",
20108            FIDOAlliance::OutputReportData => "Output Report Data",
20109        }
20110        .into()
20111    }
20112}
20113
20114#[cfg(feature = "std")]
20115impl fmt::Display for FIDOAlliance {
20116    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
20117        write!(f, "{}", self.name())
20118    }
20119}
20120
20121impl AsUsage for FIDOAlliance {
20122    /// Returns the 32 bit Usage value of this Usage
20123    fn usage_value(&self) -> u32 {
20124        u32::from(self)
20125    }
20126
20127    /// Returns the 16 bit Usage ID value of this Usage
20128    fn usage_id_value(&self) -> u16 {
20129        u16::from(self)
20130    }
20131
20132    /// Returns this usage as [Usage::FIDOAlliance(self)](Usage::FIDOAlliance)
20133    /// This is a convenience function to avoid having
20134    /// to implement `From` for every used type in the caller.
20135    ///
20136    /// ```
20137    /// # use hut::*;
20138    /// let gd_x = GenericDesktop::X;
20139    /// let usage = Usage::from(GenericDesktop::X);
20140    /// assert!(matches!(gd_x.usage(), usage));
20141    /// ```
20142    fn usage(&self) -> Usage {
20143        Usage::from(self)
20144    }
20145}
20146
20147impl AsUsagePage for FIDOAlliance {
20148    /// Returns the 16 bit value of this UsagePage
20149    ///
20150    /// This value is `0xF1D0` for [FIDOAlliance]
20151    fn usage_page_value(&self) -> u16 {
20152        let up = UsagePage::from(self);
20153        u16::from(up)
20154    }
20155
20156    /// Returns [UsagePage::FIDOAlliance]]
20157    fn usage_page(&self) -> UsagePage {
20158        UsagePage::from(self)
20159    }
20160}
20161
20162impl From<&FIDOAlliance> for u16 {
20163    fn from(fidoalliance: &FIDOAlliance) -> u16 {
20164        match *fidoalliance {
20165            FIDOAlliance::U2FAuthenticatorDevice => 1,
20166            FIDOAlliance::InputReportData => 32,
20167            FIDOAlliance::OutputReportData => 33,
20168        }
20169    }
20170}
20171
20172impl From<FIDOAlliance> for u16 {
20173    /// Returns the 16bit value of this usage. This is identical
20174    /// to [FIDOAlliance::usage_page_value()].
20175    fn from(fidoalliance: FIDOAlliance) -> u16 {
20176        u16::from(&fidoalliance)
20177    }
20178}
20179
20180impl From<&FIDOAlliance> for u32 {
20181    /// Returns the 32 bit value of this usage. This is identical
20182    /// to [FIDOAlliance::usage_value()].
20183    fn from(fidoalliance: &FIDOAlliance) -> u32 {
20184        let up = UsagePage::from(fidoalliance);
20185        let up = (u16::from(&up) as u32) << 16;
20186        let id = u16::from(fidoalliance) as u32;
20187        up | id
20188    }
20189}
20190
20191impl From<&FIDOAlliance> for UsagePage {
20192    /// Always returns [UsagePage::FIDOAlliance] and is
20193    /// identical to [FIDOAlliance::usage_page()].
20194    fn from(_: &FIDOAlliance) -> UsagePage {
20195        UsagePage::FIDOAlliance
20196    }
20197}
20198
20199impl From<FIDOAlliance> for UsagePage {
20200    /// Always returns [UsagePage::FIDOAlliance] and is
20201    /// identical to [FIDOAlliance::usage_page()].
20202    fn from(_: FIDOAlliance) -> UsagePage {
20203        UsagePage::FIDOAlliance
20204    }
20205}
20206
20207impl From<&FIDOAlliance> for Usage {
20208    fn from(fidoalliance: &FIDOAlliance) -> Usage {
20209        Usage::try_from(u32::from(fidoalliance)).unwrap()
20210    }
20211}
20212
20213impl From<FIDOAlliance> for Usage {
20214    fn from(fidoalliance: FIDOAlliance) -> Usage {
20215        Usage::from(&fidoalliance)
20216    }
20217}
20218
20219impl TryFrom<u16> for FIDOAlliance {
20220    type Error = HutError;
20221
20222    fn try_from(usage_id: u16) -> Result<FIDOAlliance> {
20223        match usage_id {
20224            1 => Ok(FIDOAlliance::U2FAuthenticatorDevice),
20225            32 => Ok(FIDOAlliance::InputReportData),
20226            33 => Ok(FIDOAlliance::OutputReportData),
20227            n => Err(HutError::UnknownUsageId { usage_id: n }),
20228        }
20229    }
20230}
20231
20232impl BitOr<u16> for FIDOAlliance {
20233    type Output = Usage;
20234
20235    /// A convenience function to combine a Usage Page with
20236    /// a value.
20237    ///
20238    /// This function panics if the Usage ID value results in
20239    /// an unknown Usage. Where error checking is required,
20240    /// use [UsagePage::to_usage_from_value].
20241    fn bitor(self, usage: u16) -> Usage {
20242        let up = u16::from(self) as u32;
20243        let u = usage as u32;
20244        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
20245    }
20246}
20247
20248/// *Usage Page `0xFF0D`: "Wacom"*
20249///
20250/// **This enum is autogenerated from the HID Usage Tables**.
20251/// ```
20252/// # use hut::*;
20253/// let u1 = Usage::Wacom(Wacom::WacomPen);
20254/// let u2 = Usage::new_from_page_and_id(0xFF0D, 0x2).unwrap();
20255/// let u3 = Usage::from(Wacom::WacomPen);
20256/// let u4: Usage = Wacom::WacomPen.into();
20257/// assert_eq!(u1, u2);
20258/// assert_eq!(u1, u3);
20259/// assert_eq!(u1, u4);
20260///
20261/// assert!(matches!(u1.usage_page(), UsagePage::Wacom));
20262/// assert_eq!(0xFF0D, u1.usage_page_value());
20263/// assert_eq!(0x2, u1.usage_id_value());
20264/// assert_eq!((0xFF0D << 16) | 0x2, u1.usage_value());
20265/// assert_eq!("Wacom Pen", u1.name());
20266/// ```
20267///
20268#[allow(non_camel_case_types)]
20269#[derive(Debug)]
20270#[non_exhaustive]
20271pub enum Wacom {
20272    /// Usage ID `0x1`: "Wacom Digitizer"
20273    WacomDigitizer,
20274    /// Usage ID `0x2`: "Wacom Pen"
20275    WacomPen,
20276    /// Usage ID `0x3`: "Light Pen"
20277    LightPen,
20278    /// Usage ID `0x4`: "Touch Screen"
20279    TouchScreen,
20280    /// Usage ID `0x5`: "Touch Pad"
20281    TouchPad,
20282    /// Usage ID `0x6`: "White Board"
20283    WhiteBoard,
20284    /// Usage ID `0x7`: "Coordinate Measuring Machine"
20285    CoordinateMeasuringMachine,
20286    /// Usage ID `0x8`: "3-D Digitizer"
20287    ThreeDDigitizer,
20288    /// Usage ID `0x9`: "Stereo Plotter"
20289    StereoPlotter,
20290    /// Usage ID `0xA`: "Articulated Arm"
20291    ArticulatedArm,
20292    /// Usage ID `0xB`: "Armature"
20293    Armature,
20294    /// Usage ID `0xC`: "Multiple Point Digitizer"
20295    MultiplePointDigitizer,
20296    /// Usage ID `0xD`: "Free Space Wand"
20297    FreeSpaceWand,
20298    /// Usage ID `0xE`: "Device Configuration"
20299    DeviceConfiguration,
20300    /// Usage ID `0x20`: "Stylus"
20301    Stylus,
20302    /// Usage ID `0x21`: "Puck"
20303    Puck,
20304    /// Usage ID `0x22`: "Finger"
20305    Finger,
20306    /// Usage ID `0x23`: "Device Settings"
20307    DeviceSettings,
20308    /// Usage ID `0x30`: "Tip Pressure"
20309    TipPressure,
20310    /// Usage ID `0x31`: "Barrel Pressure"
20311    BarrelPressure,
20312    /// Usage ID `0x32`: "In Range"
20313    InRange,
20314    /// Usage ID `0x33`: "Touch"
20315    Touch,
20316    /// Usage ID `0x34`: "Untouch"
20317    Untouch,
20318    /// Usage ID `0x35`: "Tap"
20319    Tap,
20320    /// Usage ID `0x36`: "Wacom Sense"
20321    WacomSense,
20322    /// Usage ID `0x37`: "Data Valid"
20323    DataValid,
20324    /// Usage ID `0x38`: "Transducer Index"
20325    TransducerIndex,
20326    /// Usage ID `0x39`: "Wacom DigitizerFnKeys"
20327    WacomDigitizerFnKeys,
20328    /// Usage ID `0x3A`: "Program Change Keys"
20329    ProgramChangeKeys,
20330    /// Usage ID `0x3B`: "Battery Strength"
20331    BatteryStrength,
20332    /// Usage ID `0x3C`: "Invert"
20333    Invert,
20334    /// Usage ID `0x3D`: "X Tilt"
20335    XTilt,
20336    /// Usage ID `0x3E`: "Y Tilt"
20337    YTilt,
20338    /// Usage ID `0x3F`: "Azimuth"
20339    Azimuth,
20340    /// Usage ID `0x40`: "Altitude"
20341    Altitude,
20342    /// Usage ID `0x41`: "Twist"
20343    Twist,
20344    /// Usage ID `0x42`: "Tip Switch"
20345    TipSwitch,
20346    /// Usage ID `0x43`: "Secondary Tip Switch"
20347    SecondaryTipSwitch,
20348    /// Usage ID `0x44`: "Barrel Switch"
20349    BarrelSwitch,
20350    /// Usage ID `0x45`: "Eraser"
20351    Eraser,
20352    /// Usage ID `0x46`: "Tablet Pick"
20353    TabletPick,
20354    /// Usage ID `0x47`: "Confidence"
20355    Confidence,
20356    /// Usage ID `0x48`: "Width"
20357    Width,
20358    /// Usage ID `0x49`: "Height"
20359    Height,
20360    /// Usage ID `0x51`: "Contact Id"
20361    ContactId,
20362    /// Usage ID `0x52`: "Inputmode"
20363    Inputmode,
20364    /// Usage ID `0x53`: "Device Index"
20365    DeviceIndex,
20366    /// Usage ID `0x54`: "Contact Count"
20367    ContactCount,
20368    /// Usage ID `0x55`: "Contact Max"
20369    ContactMax,
20370    /// Usage ID `0x56`: "Scan Time"
20371    ScanTime,
20372    /// Usage ID `0x57`: "Surface Switch"
20373    SurfaceSwitch,
20374    /// Usage ID `0x58`: "Button Switch"
20375    ButtonSwitch,
20376    /// Usage ID `0x59`: "Button Type"
20377    ButtonType,
20378    /// Usage ID `0x5A`: "Secondary Barrel Switch"
20379    SecondaryBarrelSwitch,
20380    /// Usage ID `0x5B`: "Transducer Serial Number"
20381    TransducerSerialNumber,
20382    /// Usage ID `0x5C`: "Wacom SerialHi"
20383    WacomSerialHi,
20384    /// Usage ID `0x5D`: "Preferred Color is Locked"
20385    PreferredColorisLocked,
20386    /// Usage ID `0x5E`: "Preferred Line Width"
20387    PreferredLineWidth,
20388    /// Usage ID `0x5F`: "Preferred Line Width is Locked"
20389    PreferredLineWidthisLocked,
20390    /// Usage ID `0x70`: "Preferred Line Style"
20391    PreferredLineStyle,
20392    /// Usage ID `0x71`: "Preferred Line Style is Locked"
20393    PreferredLineStyleisLocked,
20394    /// Usage ID `0x72`: "Ink"
20395    Ink,
20396    /// Usage ID `0x73`: "Pencil"
20397    Pencil,
20398    /// Usage ID `0x74`: "Highlighter"
20399    Highlighter,
20400    /// Usage ID `0x75`: "Chisel Marker"
20401    ChiselMarker,
20402    /// Usage ID `0x76`: "Brush"
20403    Brush,
20404    /// Usage ID `0x77`: "Wacom ToolType"
20405    WacomToolType,
20406    /// Usage ID `0x80`: "Digitizer Diagnostic"
20407    DigitizerDiagnostic,
20408    /// Usage ID `0x81`: "Digitizer Error"
20409    DigitizerError,
20410    /// Usage ID `0x82`: "Err Normal Status"
20411    ErrNormalStatus,
20412    /// Usage ID `0x83`: "Err Transducers Exceeded"
20413    ErrTransducersExceeded,
20414    /// Usage ID `0x84`: "Err Full Trans Features Unavail"
20415    ErrFullTransFeaturesUnavail,
20416    /// Usage ID `0x85`: "Err Charge Low"
20417    ErrChargeLow,
20418    /// Usage ID `0x130`: "X"
20419    X,
20420    /// Usage ID `0x131`: "Y"
20421    Y,
20422    /// Usage ID `0x132`: "Wacom Distance"
20423    WacomDistance,
20424    /// Usage ID `0x136`: "Wacom TouchStrip"
20425    WacomTouchStrip,
20426    /// Usage ID `0x137`: "Wacom TouchStrip2"
20427    WacomTouchStrip2,
20428    /// Usage ID `0x138`: "Wacom TouchRing"
20429    WacomTouchRing,
20430    /// Usage ID `0x139`: "Wacom TouchRingStatus"
20431    WacomTouchRingStatus,
20432    /// Usage ID `0x401`: "Wacom Accelerometer X"
20433    WacomAccelerometerX,
20434    /// Usage ID `0x402`: "Wacom Accelerometer Y"
20435    WacomAccelerometerY,
20436    /// Usage ID `0x403`: "Wacom Accelerometer Z"
20437    WacomAccelerometerZ,
20438    /// Usage ID `0x404`: "Wacom Battery Charging"
20439    WacomBatteryCharging,
20440    /// Usage ID `0x43B`: "Wacom Battery Level"
20441    WacomBatteryLevel,
20442    /// Usage ID `0x454`: "Wacom TouchOnOff"
20443    WacomTouchOnOff,
20444    /// Usage ID `0x910`: "Wacom ExpressKey00"
20445    WacomExpressKey00,
20446    /// Usage ID `0x950`: "Wacom ExpressKeyCap00"
20447    WacomExpressKeyCap00,
20448    /// Usage ID `0x980`: "Wacom Mode Change"
20449    WacomModeChange,
20450    /// Usage ID `0x981`: "Wacom Button Desktop Center"
20451    WacomButtonDesktopCenter,
20452    /// Usage ID `0x982`: "Wacom Button On Screen Keyboard"
20453    WacomButtonOnScreenKeyboard,
20454    /// Usage ID `0x983`: "Wacom Button Display Setting"
20455    WacomButtonDisplaySetting,
20456    /// Usage ID `0x986`: "Wacom Button Touch On/Off"
20457    WacomButtonTouchOnOff,
20458    /// Usage ID `0x990`: "Wacom Button Home"
20459    WacomButtonHome,
20460    /// Usage ID `0x991`: "Wacom Button Up"
20461    WacomButtonUp,
20462    /// Usage ID `0x992`: "Wacom Button Down"
20463    WacomButtonDown,
20464    /// Usage ID `0x993`: "Wacom Button Left"
20465    WacomButtonLeft,
20466    /// Usage ID `0x994`: "Wacom Button Right"
20467    WacomButtonRight,
20468    /// Usage ID `0x995`: "Wacom Button Center"
20469    WacomButtonCenter,
20470    /// Usage ID `0xD03`: "Wacom FingerWheel"
20471    WacomFingerWheel,
20472    /// Usage ID `0xD30`: "Wacom Offset Left"
20473    WacomOffsetLeft,
20474    /// Usage ID `0xD31`: "Wacom Offset Top"
20475    WacomOffsetTop,
20476    /// Usage ID `0xD32`: "Wacom Offset Right"
20477    WacomOffsetRight,
20478    /// Usage ID `0xD33`: "Wacom Offset Bottom"
20479    WacomOffsetBottom,
20480    /// Usage ID `0x1002`: "Wacom DataMode"
20481    WacomDataMode,
20482    /// Usage ID `0x1013`: "Wacom Digitizer Info"
20483    WacomDigitizerInfo,
20484}
20485
20486impl Wacom {
20487    #[cfg(feature = "std")]
20488    pub fn name(&self) -> String {
20489        match self {
20490            Wacom::WacomDigitizer => "Wacom Digitizer",
20491            Wacom::WacomPen => "Wacom Pen",
20492            Wacom::LightPen => "Light Pen",
20493            Wacom::TouchScreen => "Touch Screen",
20494            Wacom::TouchPad => "Touch Pad",
20495            Wacom::WhiteBoard => "White Board",
20496            Wacom::CoordinateMeasuringMachine => "Coordinate Measuring Machine",
20497            Wacom::ThreeDDigitizer => "3-D Digitizer",
20498            Wacom::StereoPlotter => "Stereo Plotter",
20499            Wacom::ArticulatedArm => "Articulated Arm",
20500            Wacom::Armature => "Armature",
20501            Wacom::MultiplePointDigitizer => "Multiple Point Digitizer",
20502            Wacom::FreeSpaceWand => "Free Space Wand",
20503            Wacom::DeviceConfiguration => "Device Configuration",
20504            Wacom::Stylus => "Stylus",
20505            Wacom::Puck => "Puck",
20506            Wacom::Finger => "Finger",
20507            Wacom::DeviceSettings => "Device Settings",
20508            Wacom::TipPressure => "Tip Pressure",
20509            Wacom::BarrelPressure => "Barrel Pressure",
20510            Wacom::InRange => "In Range",
20511            Wacom::Touch => "Touch",
20512            Wacom::Untouch => "Untouch",
20513            Wacom::Tap => "Tap",
20514            Wacom::WacomSense => "Wacom Sense",
20515            Wacom::DataValid => "Data Valid",
20516            Wacom::TransducerIndex => "Transducer Index",
20517            Wacom::WacomDigitizerFnKeys => "Wacom DigitizerFnKeys",
20518            Wacom::ProgramChangeKeys => "Program Change Keys",
20519            Wacom::BatteryStrength => "Battery Strength",
20520            Wacom::Invert => "Invert",
20521            Wacom::XTilt => "X Tilt",
20522            Wacom::YTilt => "Y Tilt",
20523            Wacom::Azimuth => "Azimuth",
20524            Wacom::Altitude => "Altitude",
20525            Wacom::Twist => "Twist",
20526            Wacom::TipSwitch => "Tip Switch",
20527            Wacom::SecondaryTipSwitch => "Secondary Tip Switch",
20528            Wacom::BarrelSwitch => "Barrel Switch",
20529            Wacom::Eraser => "Eraser",
20530            Wacom::TabletPick => "Tablet Pick",
20531            Wacom::Confidence => "Confidence",
20532            Wacom::Width => "Width",
20533            Wacom::Height => "Height",
20534            Wacom::ContactId => "Contact Id",
20535            Wacom::Inputmode => "Inputmode",
20536            Wacom::DeviceIndex => "Device Index",
20537            Wacom::ContactCount => "Contact Count",
20538            Wacom::ContactMax => "Contact Max",
20539            Wacom::ScanTime => "Scan Time",
20540            Wacom::SurfaceSwitch => "Surface Switch",
20541            Wacom::ButtonSwitch => "Button Switch",
20542            Wacom::ButtonType => "Button Type",
20543            Wacom::SecondaryBarrelSwitch => "Secondary Barrel Switch",
20544            Wacom::TransducerSerialNumber => "Transducer Serial Number",
20545            Wacom::WacomSerialHi => "Wacom SerialHi",
20546            Wacom::PreferredColorisLocked => "Preferred Color is Locked",
20547            Wacom::PreferredLineWidth => "Preferred Line Width",
20548            Wacom::PreferredLineWidthisLocked => "Preferred Line Width is Locked",
20549            Wacom::PreferredLineStyle => "Preferred Line Style",
20550            Wacom::PreferredLineStyleisLocked => "Preferred Line Style is Locked",
20551            Wacom::Ink => "Ink",
20552            Wacom::Pencil => "Pencil",
20553            Wacom::Highlighter => "Highlighter",
20554            Wacom::ChiselMarker => "Chisel Marker",
20555            Wacom::Brush => "Brush",
20556            Wacom::WacomToolType => "Wacom ToolType",
20557            Wacom::DigitizerDiagnostic => "Digitizer Diagnostic",
20558            Wacom::DigitizerError => "Digitizer Error",
20559            Wacom::ErrNormalStatus => "Err Normal Status",
20560            Wacom::ErrTransducersExceeded => "Err Transducers Exceeded",
20561            Wacom::ErrFullTransFeaturesUnavail => "Err Full Trans Features Unavail",
20562            Wacom::ErrChargeLow => "Err Charge Low",
20563            Wacom::X => "X",
20564            Wacom::Y => "Y",
20565            Wacom::WacomDistance => "Wacom Distance",
20566            Wacom::WacomTouchStrip => "Wacom TouchStrip",
20567            Wacom::WacomTouchStrip2 => "Wacom TouchStrip2",
20568            Wacom::WacomTouchRing => "Wacom TouchRing",
20569            Wacom::WacomTouchRingStatus => "Wacom TouchRingStatus",
20570            Wacom::WacomAccelerometerX => "Wacom Accelerometer X",
20571            Wacom::WacomAccelerometerY => "Wacom Accelerometer Y",
20572            Wacom::WacomAccelerometerZ => "Wacom Accelerometer Z",
20573            Wacom::WacomBatteryCharging => "Wacom Battery Charging",
20574            Wacom::WacomBatteryLevel => "Wacom Battery Level",
20575            Wacom::WacomTouchOnOff => "Wacom TouchOnOff",
20576            Wacom::WacomExpressKey00 => "Wacom ExpressKey00",
20577            Wacom::WacomExpressKeyCap00 => "Wacom ExpressKeyCap00",
20578            Wacom::WacomModeChange => "Wacom Mode Change",
20579            Wacom::WacomButtonDesktopCenter => "Wacom Button Desktop Center",
20580            Wacom::WacomButtonOnScreenKeyboard => "Wacom Button On Screen Keyboard",
20581            Wacom::WacomButtonDisplaySetting => "Wacom Button Display Setting",
20582            Wacom::WacomButtonTouchOnOff => "Wacom Button Touch On/Off",
20583            Wacom::WacomButtonHome => "Wacom Button Home",
20584            Wacom::WacomButtonUp => "Wacom Button Up",
20585            Wacom::WacomButtonDown => "Wacom Button Down",
20586            Wacom::WacomButtonLeft => "Wacom Button Left",
20587            Wacom::WacomButtonRight => "Wacom Button Right",
20588            Wacom::WacomButtonCenter => "Wacom Button Center",
20589            Wacom::WacomFingerWheel => "Wacom FingerWheel",
20590            Wacom::WacomOffsetLeft => "Wacom Offset Left",
20591            Wacom::WacomOffsetTop => "Wacom Offset Top",
20592            Wacom::WacomOffsetRight => "Wacom Offset Right",
20593            Wacom::WacomOffsetBottom => "Wacom Offset Bottom",
20594            Wacom::WacomDataMode => "Wacom DataMode",
20595            Wacom::WacomDigitizerInfo => "Wacom Digitizer Info",
20596        }
20597        .into()
20598    }
20599}
20600
20601#[cfg(feature = "std")]
20602impl fmt::Display for Wacom {
20603    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
20604        write!(f, "{}", self.name())
20605    }
20606}
20607
20608impl AsUsage for Wacom {
20609    /// Returns the 32 bit Usage value of this Usage
20610    fn usage_value(&self) -> u32 {
20611        u32::from(self)
20612    }
20613
20614    /// Returns the 16 bit Usage ID value of this Usage
20615    fn usage_id_value(&self) -> u16 {
20616        u16::from(self)
20617    }
20618
20619    /// Returns this usage as [Usage::Wacom(self)](Usage::Wacom)
20620    /// This is a convenience function to avoid having
20621    /// to implement `From` for every used type in the caller.
20622    ///
20623    /// ```
20624    /// # use hut::*;
20625    /// let gd_x = GenericDesktop::X;
20626    /// let usage = Usage::from(GenericDesktop::X);
20627    /// assert!(matches!(gd_x.usage(), usage));
20628    /// ```
20629    fn usage(&self) -> Usage {
20630        Usage::from(self)
20631    }
20632}
20633
20634impl AsUsagePage for Wacom {
20635    /// Returns the 16 bit value of this UsagePage
20636    ///
20637    /// This value is `0xFF0D` for [Wacom]
20638    fn usage_page_value(&self) -> u16 {
20639        let up = UsagePage::from(self);
20640        u16::from(up)
20641    }
20642
20643    /// Returns [UsagePage::Wacom]]
20644    fn usage_page(&self) -> UsagePage {
20645        UsagePage::from(self)
20646    }
20647}
20648
20649impl From<&Wacom> for u16 {
20650    fn from(wacom: &Wacom) -> u16 {
20651        match *wacom {
20652            Wacom::WacomDigitizer => 1,
20653            Wacom::WacomPen => 2,
20654            Wacom::LightPen => 3,
20655            Wacom::TouchScreen => 4,
20656            Wacom::TouchPad => 5,
20657            Wacom::WhiteBoard => 6,
20658            Wacom::CoordinateMeasuringMachine => 7,
20659            Wacom::ThreeDDigitizer => 8,
20660            Wacom::StereoPlotter => 9,
20661            Wacom::ArticulatedArm => 10,
20662            Wacom::Armature => 11,
20663            Wacom::MultiplePointDigitizer => 12,
20664            Wacom::FreeSpaceWand => 13,
20665            Wacom::DeviceConfiguration => 14,
20666            Wacom::Stylus => 32,
20667            Wacom::Puck => 33,
20668            Wacom::Finger => 34,
20669            Wacom::DeviceSettings => 35,
20670            Wacom::TipPressure => 48,
20671            Wacom::BarrelPressure => 49,
20672            Wacom::InRange => 50,
20673            Wacom::Touch => 51,
20674            Wacom::Untouch => 52,
20675            Wacom::Tap => 53,
20676            Wacom::WacomSense => 54,
20677            Wacom::DataValid => 55,
20678            Wacom::TransducerIndex => 56,
20679            Wacom::WacomDigitizerFnKeys => 57,
20680            Wacom::ProgramChangeKeys => 58,
20681            Wacom::BatteryStrength => 59,
20682            Wacom::Invert => 60,
20683            Wacom::XTilt => 61,
20684            Wacom::YTilt => 62,
20685            Wacom::Azimuth => 63,
20686            Wacom::Altitude => 64,
20687            Wacom::Twist => 65,
20688            Wacom::TipSwitch => 66,
20689            Wacom::SecondaryTipSwitch => 67,
20690            Wacom::BarrelSwitch => 68,
20691            Wacom::Eraser => 69,
20692            Wacom::TabletPick => 70,
20693            Wacom::Confidence => 71,
20694            Wacom::Width => 72,
20695            Wacom::Height => 73,
20696            Wacom::ContactId => 81,
20697            Wacom::Inputmode => 82,
20698            Wacom::DeviceIndex => 83,
20699            Wacom::ContactCount => 84,
20700            Wacom::ContactMax => 85,
20701            Wacom::ScanTime => 86,
20702            Wacom::SurfaceSwitch => 87,
20703            Wacom::ButtonSwitch => 88,
20704            Wacom::ButtonType => 89,
20705            Wacom::SecondaryBarrelSwitch => 90,
20706            Wacom::TransducerSerialNumber => 91,
20707            Wacom::WacomSerialHi => 92,
20708            Wacom::PreferredColorisLocked => 93,
20709            Wacom::PreferredLineWidth => 94,
20710            Wacom::PreferredLineWidthisLocked => 95,
20711            Wacom::PreferredLineStyle => 112,
20712            Wacom::PreferredLineStyleisLocked => 113,
20713            Wacom::Ink => 114,
20714            Wacom::Pencil => 115,
20715            Wacom::Highlighter => 116,
20716            Wacom::ChiselMarker => 117,
20717            Wacom::Brush => 118,
20718            Wacom::WacomToolType => 119,
20719            Wacom::DigitizerDiagnostic => 128,
20720            Wacom::DigitizerError => 129,
20721            Wacom::ErrNormalStatus => 130,
20722            Wacom::ErrTransducersExceeded => 131,
20723            Wacom::ErrFullTransFeaturesUnavail => 132,
20724            Wacom::ErrChargeLow => 133,
20725            Wacom::X => 304,
20726            Wacom::Y => 305,
20727            Wacom::WacomDistance => 306,
20728            Wacom::WacomTouchStrip => 310,
20729            Wacom::WacomTouchStrip2 => 311,
20730            Wacom::WacomTouchRing => 312,
20731            Wacom::WacomTouchRingStatus => 313,
20732            Wacom::WacomAccelerometerX => 1025,
20733            Wacom::WacomAccelerometerY => 1026,
20734            Wacom::WacomAccelerometerZ => 1027,
20735            Wacom::WacomBatteryCharging => 1028,
20736            Wacom::WacomBatteryLevel => 1083,
20737            Wacom::WacomTouchOnOff => 1108,
20738            Wacom::WacomExpressKey00 => 2320,
20739            Wacom::WacomExpressKeyCap00 => 2384,
20740            Wacom::WacomModeChange => 2432,
20741            Wacom::WacomButtonDesktopCenter => 2433,
20742            Wacom::WacomButtonOnScreenKeyboard => 2434,
20743            Wacom::WacomButtonDisplaySetting => 2435,
20744            Wacom::WacomButtonTouchOnOff => 2438,
20745            Wacom::WacomButtonHome => 2448,
20746            Wacom::WacomButtonUp => 2449,
20747            Wacom::WacomButtonDown => 2450,
20748            Wacom::WacomButtonLeft => 2451,
20749            Wacom::WacomButtonRight => 2452,
20750            Wacom::WacomButtonCenter => 2453,
20751            Wacom::WacomFingerWheel => 3331,
20752            Wacom::WacomOffsetLeft => 3376,
20753            Wacom::WacomOffsetTop => 3377,
20754            Wacom::WacomOffsetRight => 3378,
20755            Wacom::WacomOffsetBottom => 3379,
20756            Wacom::WacomDataMode => 4098,
20757            Wacom::WacomDigitizerInfo => 4115,
20758        }
20759    }
20760}
20761
20762impl From<Wacom> for u16 {
20763    /// Returns the 16bit value of this usage. This is identical
20764    /// to [Wacom::usage_page_value()].
20765    fn from(wacom: Wacom) -> u16 {
20766        u16::from(&wacom)
20767    }
20768}
20769
20770impl From<&Wacom> for u32 {
20771    /// Returns the 32 bit value of this usage. This is identical
20772    /// to [Wacom::usage_value()].
20773    fn from(wacom: &Wacom) -> u32 {
20774        let up = UsagePage::from(wacom);
20775        let up = (u16::from(&up) as u32) << 16;
20776        let id = u16::from(wacom) as u32;
20777        up | id
20778    }
20779}
20780
20781impl From<&Wacom> for UsagePage {
20782    /// Always returns [UsagePage::Wacom] and is
20783    /// identical to [Wacom::usage_page()].
20784    fn from(_: &Wacom) -> UsagePage {
20785        UsagePage::Wacom
20786    }
20787}
20788
20789impl From<Wacom> for UsagePage {
20790    /// Always returns [UsagePage::Wacom] and is
20791    /// identical to [Wacom::usage_page()].
20792    fn from(_: Wacom) -> UsagePage {
20793        UsagePage::Wacom
20794    }
20795}
20796
20797impl From<&Wacom> for Usage {
20798    fn from(wacom: &Wacom) -> Usage {
20799        Usage::try_from(u32::from(wacom)).unwrap()
20800    }
20801}
20802
20803impl From<Wacom> for Usage {
20804    fn from(wacom: Wacom) -> Usage {
20805        Usage::from(&wacom)
20806    }
20807}
20808
20809impl TryFrom<u16> for Wacom {
20810    type Error = HutError;
20811
20812    fn try_from(usage_id: u16) -> Result<Wacom> {
20813        match usage_id {
20814            1 => Ok(Wacom::WacomDigitizer),
20815            2 => Ok(Wacom::WacomPen),
20816            3 => Ok(Wacom::LightPen),
20817            4 => Ok(Wacom::TouchScreen),
20818            5 => Ok(Wacom::TouchPad),
20819            6 => Ok(Wacom::WhiteBoard),
20820            7 => Ok(Wacom::CoordinateMeasuringMachine),
20821            8 => Ok(Wacom::ThreeDDigitizer),
20822            9 => Ok(Wacom::StereoPlotter),
20823            10 => Ok(Wacom::ArticulatedArm),
20824            11 => Ok(Wacom::Armature),
20825            12 => Ok(Wacom::MultiplePointDigitizer),
20826            13 => Ok(Wacom::FreeSpaceWand),
20827            14 => Ok(Wacom::DeviceConfiguration),
20828            32 => Ok(Wacom::Stylus),
20829            33 => Ok(Wacom::Puck),
20830            34 => Ok(Wacom::Finger),
20831            35 => Ok(Wacom::DeviceSettings),
20832            48 => Ok(Wacom::TipPressure),
20833            49 => Ok(Wacom::BarrelPressure),
20834            50 => Ok(Wacom::InRange),
20835            51 => Ok(Wacom::Touch),
20836            52 => Ok(Wacom::Untouch),
20837            53 => Ok(Wacom::Tap),
20838            54 => Ok(Wacom::WacomSense),
20839            55 => Ok(Wacom::DataValid),
20840            56 => Ok(Wacom::TransducerIndex),
20841            57 => Ok(Wacom::WacomDigitizerFnKeys),
20842            58 => Ok(Wacom::ProgramChangeKeys),
20843            59 => Ok(Wacom::BatteryStrength),
20844            60 => Ok(Wacom::Invert),
20845            61 => Ok(Wacom::XTilt),
20846            62 => Ok(Wacom::YTilt),
20847            63 => Ok(Wacom::Azimuth),
20848            64 => Ok(Wacom::Altitude),
20849            65 => Ok(Wacom::Twist),
20850            66 => Ok(Wacom::TipSwitch),
20851            67 => Ok(Wacom::SecondaryTipSwitch),
20852            68 => Ok(Wacom::BarrelSwitch),
20853            69 => Ok(Wacom::Eraser),
20854            70 => Ok(Wacom::TabletPick),
20855            71 => Ok(Wacom::Confidence),
20856            72 => Ok(Wacom::Width),
20857            73 => Ok(Wacom::Height),
20858            81 => Ok(Wacom::ContactId),
20859            82 => Ok(Wacom::Inputmode),
20860            83 => Ok(Wacom::DeviceIndex),
20861            84 => Ok(Wacom::ContactCount),
20862            85 => Ok(Wacom::ContactMax),
20863            86 => Ok(Wacom::ScanTime),
20864            87 => Ok(Wacom::SurfaceSwitch),
20865            88 => Ok(Wacom::ButtonSwitch),
20866            89 => Ok(Wacom::ButtonType),
20867            90 => Ok(Wacom::SecondaryBarrelSwitch),
20868            91 => Ok(Wacom::TransducerSerialNumber),
20869            92 => Ok(Wacom::WacomSerialHi),
20870            93 => Ok(Wacom::PreferredColorisLocked),
20871            94 => Ok(Wacom::PreferredLineWidth),
20872            95 => Ok(Wacom::PreferredLineWidthisLocked),
20873            112 => Ok(Wacom::PreferredLineStyle),
20874            113 => Ok(Wacom::PreferredLineStyleisLocked),
20875            114 => Ok(Wacom::Ink),
20876            115 => Ok(Wacom::Pencil),
20877            116 => Ok(Wacom::Highlighter),
20878            117 => Ok(Wacom::ChiselMarker),
20879            118 => Ok(Wacom::Brush),
20880            119 => Ok(Wacom::WacomToolType),
20881            128 => Ok(Wacom::DigitizerDiagnostic),
20882            129 => Ok(Wacom::DigitizerError),
20883            130 => Ok(Wacom::ErrNormalStatus),
20884            131 => Ok(Wacom::ErrTransducersExceeded),
20885            132 => Ok(Wacom::ErrFullTransFeaturesUnavail),
20886            133 => Ok(Wacom::ErrChargeLow),
20887            304 => Ok(Wacom::X),
20888            305 => Ok(Wacom::Y),
20889            306 => Ok(Wacom::WacomDistance),
20890            310 => Ok(Wacom::WacomTouchStrip),
20891            311 => Ok(Wacom::WacomTouchStrip2),
20892            312 => Ok(Wacom::WacomTouchRing),
20893            313 => Ok(Wacom::WacomTouchRingStatus),
20894            1025 => Ok(Wacom::WacomAccelerometerX),
20895            1026 => Ok(Wacom::WacomAccelerometerY),
20896            1027 => Ok(Wacom::WacomAccelerometerZ),
20897            1028 => Ok(Wacom::WacomBatteryCharging),
20898            1083 => Ok(Wacom::WacomBatteryLevel),
20899            1108 => Ok(Wacom::WacomTouchOnOff),
20900            2320 => Ok(Wacom::WacomExpressKey00),
20901            2384 => Ok(Wacom::WacomExpressKeyCap00),
20902            2432 => Ok(Wacom::WacomModeChange),
20903            2433 => Ok(Wacom::WacomButtonDesktopCenter),
20904            2434 => Ok(Wacom::WacomButtonOnScreenKeyboard),
20905            2435 => Ok(Wacom::WacomButtonDisplaySetting),
20906            2438 => Ok(Wacom::WacomButtonTouchOnOff),
20907            2448 => Ok(Wacom::WacomButtonHome),
20908            2449 => Ok(Wacom::WacomButtonUp),
20909            2450 => Ok(Wacom::WacomButtonDown),
20910            2451 => Ok(Wacom::WacomButtonLeft),
20911            2452 => Ok(Wacom::WacomButtonRight),
20912            2453 => Ok(Wacom::WacomButtonCenter),
20913            3331 => Ok(Wacom::WacomFingerWheel),
20914            3376 => Ok(Wacom::WacomOffsetLeft),
20915            3377 => Ok(Wacom::WacomOffsetTop),
20916            3378 => Ok(Wacom::WacomOffsetRight),
20917            3379 => Ok(Wacom::WacomOffsetBottom),
20918            4098 => Ok(Wacom::WacomDataMode),
20919            4115 => Ok(Wacom::WacomDigitizerInfo),
20920            n => Err(HutError::UnknownUsageId { usage_id: n }),
20921        }
20922    }
20923}
20924
20925impl BitOr<u16> for Wacom {
20926    type Output = Usage;
20927
20928    /// A convenience function to combine a Usage Page with
20929    /// a value.
20930    ///
20931    /// This function panics if the Usage ID value results in
20932    /// an unknown Usage. Where error checking is required,
20933    /// use [UsagePage::to_usage_from_value].
20934    fn bitor(self, usage: u16) -> Usage {
20935        let up = u16::from(self) as u32;
20936        let u = usage as u32;
20937        Usage::try_from(up | u).expect("Invalid Usage ID for this Usage Page")
20938    }
20939}
20940
20941/// *Reserved Usage Pages*
20942///
20943/// This Usage Page has no named Usage IDs, any Usages in this Usage Page are
20944/// reserved implementation. In a future version of the HUT standard a reserved
20945/// Usage Page may become a defined Usage Page.
20946#[allow(non_camel_case_types)]
20947#[derive(Debug)]
20948#[non_exhaustive]
20949pub enum ReservedUsagePage {
20950    Undefined,
20951    ReservedUsage { usage_id: u16 },
20952}
20953
20954impl ReservedUsagePage {
20955    #[cfg(feature = "std")]
20956    fn name(&self) -> String {
20957        match self {
20958            ReservedUsagePage::Undefined => "Reserved Usage Undefined".to_string(),
20959            ReservedUsagePage::ReservedUsage { usage_id } => {
20960                format!("Reserved Usage 0x{usage_id:02x}")
20961            }
20962        }
20963    }
20964}
20965
20966#[cfg(feature = "std")]
20967impl fmt::Display for ReservedUsagePage {
20968    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
20969        write!(f, "{}", self.name())
20970    }
20971}
20972
20973impl From<&ReservedUsagePage> for u16 {
20974    fn from(v: &ReservedUsagePage) -> u16 {
20975        match v {
20976            ReservedUsagePage::Undefined => 0x00,
20977            ReservedUsagePage::ReservedUsage { usage_id } => *usage_id,
20978        }
20979    }
20980}
20981
20982/// *Usage Page `0xFF00` to `0xFFFF`: The Vendor Defined Pages*
20983///
20984/// This Usage Page has no named Usage IDs, any Usages in this Usage Page are
20985/// private to a vendor implementation.
20986#[allow(non_camel_case_types)]
20987#[derive(Debug)]
20988#[non_exhaustive]
20989pub enum VendorDefinedPage {
20990    Undefined,
20991    VendorUsage { usage_id: u16 },
20992}
20993
20994impl VendorDefinedPage {
20995    #[cfg(feature = "std")]
20996    fn name(&self) -> String {
20997        match self {
20998            VendorDefinedPage::Undefined => "Vendor Usage Undefined".to_string(),
20999            VendorDefinedPage::VendorUsage { usage_id } => {
21000                format!("Vendor Usage 0x{usage_id:02x}")
21001            }
21002        }
21003    }
21004}
21005
21006#[cfg(feature = "std")]
21007impl fmt::Display for VendorDefinedPage {
21008    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
21009        write!(f, "{}", self.name())
21010    }
21011}
21012
21013impl From<&VendorDefinedPage> for u16 {
21014    fn from(v: &VendorDefinedPage) -> u16 {
21015        match v {
21016            VendorDefinedPage::Undefined => 0x00,
21017            VendorDefinedPage::VendorUsage { usage_id } => *usage_id,
21018        }
21019    }
21020}
21021
21022impl From<&Usage> for UsagePage {
21023    fn from(usage: &Usage) -> UsagePage {
21024        match usage {
21025            Usage::GenericDesktop { .. } => UsagePage::GenericDesktop,
21026            Usage::SimulationControls { .. } => UsagePage::SimulationControls,
21027            Usage::VRControls { .. } => UsagePage::VRControls,
21028            Usage::SportControls { .. } => UsagePage::SportControls,
21029            Usage::GameControls { .. } => UsagePage::GameControls,
21030            Usage::GenericDeviceControls { .. } => UsagePage::GenericDeviceControls,
21031            Usage::KeyboardKeypad { .. } => UsagePage::KeyboardKeypad,
21032            Usage::LED { .. } => UsagePage::LED,
21033            Usage::Button { .. } => UsagePage::Button,
21034            Usage::Ordinal { .. } => UsagePage::Ordinal,
21035            Usage::TelephonyDevice { .. } => UsagePage::TelephonyDevice,
21036            Usage::Consumer { .. } => UsagePage::Consumer,
21037            Usage::Digitizers { .. } => UsagePage::Digitizers,
21038            Usage::Haptics { .. } => UsagePage::Haptics,
21039            Usage::PhysicalInputDevice { .. } => UsagePage::PhysicalInputDevice,
21040            Usage::Unicode { .. } => UsagePage::Unicode,
21041            Usage::SoC { .. } => UsagePage::SoC,
21042            Usage::EyeandHeadTrackers { .. } => UsagePage::EyeandHeadTrackers,
21043            Usage::AuxiliaryDisplay { .. } => UsagePage::AuxiliaryDisplay,
21044            Usage::Sensors { .. } => UsagePage::Sensors,
21045            Usage::MedicalInstrument { .. } => UsagePage::MedicalInstrument,
21046            Usage::BrailleDisplay { .. } => UsagePage::BrailleDisplay,
21047            Usage::LightingAndIllumination { .. } => UsagePage::LightingAndIllumination,
21048            Usage::Monitor { .. } => UsagePage::Monitor,
21049            Usage::MonitorEnumerated { .. } => UsagePage::MonitorEnumerated,
21050            Usage::VESAVirtualControls { .. } => UsagePage::VESAVirtualControls,
21051            Usage::Power { .. } => UsagePage::Power,
21052            Usage::BatterySystem { .. } => UsagePage::BatterySystem,
21053            Usage::BarcodeScanner { .. } => UsagePage::BarcodeScanner,
21054            Usage::Scales { .. } => UsagePage::Scales,
21055            Usage::MagneticStripeReader { .. } => UsagePage::MagneticStripeReader,
21056            Usage::CameraControl { .. } => UsagePage::CameraControl,
21057            Usage::Arcade { .. } => UsagePage::Arcade,
21058            Usage::FIDOAlliance { .. } => UsagePage::FIDOAlliance,
21059            Usage::Wacom { .. } => UsagePage::Wacom,
21060            Usage::ReservedUsagePage { reserved_page, .. } => {
21061                UsagePage::ReservedUsagePage(*reserved_page)
21062            }
21063            Usage::VendorDefinedPage { vendor_page, .. } => {
21064                UsagePage::VendorDefinedPage(*vendor_page)
21065            }
21066        }
21067    }
21068}
21069
21070impl From<&UsagePage> for u16 {
21071    /// Returns the UsagePage as 16-bit value. This is equivalent to the
21072    /// upper 16 bits of a full 32-bit Usage value shifted down.
21073    fn from(usage_page: &UsagePage) -> u16 {
21074        match usage_page {
21075            UsagePage::GenericDesktop { .. } => 1,
21076            UsagePage::SimulationControls { .. } => 2,
21077            UsagePage::VRControls { .. } => 3,
21078            UsagePage::SportControls { .. } => 4,
21079            UsagePage::GameControls { .. } => 5,
21080            UsagePage::GenericDeviceControls { .. } => 6,
21081            UsagePage::KeyboardKeypad { .. } => 7,
21082            UsagePage::LED { .. } => 8,
21083            UsagePage::Button { .. } => 9,
21084            UsagePage::Ordinal { .. } => 10,
21085            UsagePage::TelephonyDevice { .. } => 11,
21086            UsagePage::Consumer { .. } => 12,
21087            UsagePage::Digitizers { .. } => 13,
21088            UsagePage::Haptics { .. } => 14,
21089            UsagePage::PhysicalInputDevice { .. } => 15,
21090            UsagePage::Unicode { .. } => 16,
21091            UsagePage::SoC { .. } => 17,
21092            UsagePage::EyeandHeadTrackers { .. } => 18,
21093            UsagePage::AuxiliaryDisplay { .. } => 20,
21094            UsagePage::Sensors { .. } => 32,
21095            UsagePage::MedicalInstrument { .. } => 64,
21096            UsagePage::BrailleDisplay { .. } => 65,
21097            UsagePage::LightingAndIllumination { .. } => 89,
21098            UsagePage::Monitor { .. } => 128,
21099            UsagePage::MonitorEnumerated { .. } => 129,
21100            UsagePage::VESAVirtualControls { .. } => 130,
21101            UsagePage::Power { .. } => 132,
21102            UsagePage::BatterySystem { .. } => 133,
21103            UsagePage::BarcodeScanner { .. } => 140,
21104            UsagePage::Scales { .. } => 141,
21105            UsagePage::MagneticStripeReader { .. } => 142,
21106            UsagePage::CameraControl { .. } => 144,
21107            UsagePage::Arcade { .. } => 145,
21108            UsagePage::FIDOAlliance { .. } => 61904,
21109            UsagePage::Wacom { .. } => 65293,
21110            UsagePage::ReservedUsagePage(reserved_page) => u16::from(reserved_page),
21111            UsagePage::VendorDefinedPage(vendor_page) => u16::from(vendor_page),
21112        }
21113    }
21114}
21115
21116impl From<UsagePage> for u16 {
21117    fn from(usage_page: UsagePage) -> u16 {
21118        u16::from(&usage_page)
21119    }
21120}
21121
21122impl TryFrom<u16> for UsagePage {
21123    type Error = HutError;
21124
21125    fn try_from(usage_page: u16) -> Result<UsagePage> {
21126        match usage_page {
21127            1 => Ok(UsagePage::GenericDesktop),
21128            2 => Ok(UsagePage::SimulationControls),
21129            3 => Ok(UsagePage::VRControls),
21130            4 => Ok(UsagePage::SportControls),
21131            5 => Ok(UsagePage::GameControls),
21132            6 => Ok(UsagePage::GenericDeviceControls),
21133            7 => Ok(UsagePage::KeyboardKeypad),
21134            8 => Ok(UsagePage::LED),
21135            9 => Ok(UsagePage::Button),
21136            10 => Ok(UsagePage::Ordinal),
21137            11 => Ok(UsagePage::TelephonyDevice),
21138            12 => Ok(UsagePage::Consumer),
21139            13 => Ok(UsagePage::Digitizers),
21140            14 => Ok(UsagePage::Haptics),
21141            15 => Ok(UsagePage::PhysicalInputDevice),
21142            16 => Ok(UsagePage::Unicode),
21143            17 => Ok(UsagePage::SoC),
21144            18 => Ok(UsagePage::EyeandHeadTrackers),
21145            20 => Ok(UsagePage::AuxiliaryDisplay),
21146            32 => Ok(UsagePage::Sensors),
21147            64 => Ok(UsagePage::MedicalInstrument),
21148            65 => Ok(UsagePage::BrailleDisplay),
21149            89 => Ok(UsagePage::LightingAndIllumination),
21150            128 => Ok(UsagePage::Monitor),
21151            129 => Ok(UsagePage::MonitorEnumerated),
21152            130 => Ok(UsagePage::VESAVirtualControls),
21153            132 => Ok(UsagePage::Power),
21154            133 => Ok(UsagePage::BatterySystem),
21155            140 => Ok(UsagePage::BarcodeScanner),
21156            141 => Ok(UsagePage::Scales),
21157            142 => Ok(UsagePage::MagneticStripeReader),
21158            144 => Ok(UsagePage::CameraControl),
21159            145 => Ok(UsagePage::Arcade),
21160            61904 => Ok(UsagePage::FIDOAlliance),
21161            65293 => Ok(UsagePage::Wacom),
21162            page @ 0xff00..=0xffff => Ok(UsagePage::VendorDefinedPage(VendorPage(page))),
21163            n => match ReservedPage::try_from(n) {
21164                Ok(r) => Ok(UsagePage::ReservedUsagePage(r)),
21165                Err(_) => Err(HutError::UnknownUsagePage { usage_page: n }),
21166            },
21167        }
21168    }
21169}
21170
21171impl TryFrom<u32> for UsagePage {
21172    type Error = HutError;
21173
21174    fn try_from(usage_page: u32) -> Result<UsagePage> {
21175        UsagePage::try_from((usage_page >> 16) as u16)
21176    }
21177}
21178
21179#[cfg(feature = "std")]
21180impl fmt::Display for UsagePage {
21181    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
21182        write!(f, "{}", self.name())
21183    }
21184}
21185
21186/// An enum wrapping all known Usages in the HUT.
21187/// ```
21188/// # use hut::*;
21189/// let u1 = Usage::GenericDesktop(GenericDesktop::Mouse);
21190/// let u2 = Usage::new_from_page_and_id(0x01, 0x02).unwrap();
21191/// let u3 = Usage::from(GenericDesktop::Mouse);
21192/// assert_eq!(u1, u2);
21193/// assert_eq!(u1, u3);
21194///
21195/// assert_eq!(0x1, u1.usage_page_value());
21196/// assert_eq!(0x2, u1.usage_id_value());
21197/// assert_eq!((0x1 << 16) | 0x2, u1.usage_value());
21198/// ```
21199/// Note: this enum is generated from the HUT documents.
21200#[allow(non_camel_case_types)]
21201#[derive(Debug)]
21202#[non_exhaustive]
21203pub enum Usage {
21204    /// "Generic Desktop"
21205    GenericDesktop(GenericDesktop),
21206    /// "Simulation Controls"
21207    SimulationControls(SimulationControls),
21208    /// "VR Controls"
21209    VRControls(VRControls),
21210    /// "Sport Controls"
21211    SportControls(SportControls),
21212    /// "Game Controls"
21213    GameControls(GameControls),
21214    /// "Generic Device Controls"
21215    GenericDeviceControls(GenericDeviceControls),
21216    /// "Keyboard/Keypad"
21217    KeyboardKeypad(KeyboardKeypad),
21218    /// "LED"
21219    LED(LED),
21220    /// "Button"
21221    Button(Button),
21222    /// "Ordinal"
21223    Ordinal(Ordinal),
21224    /// "Telephony Device"
21225    TelephonyDevice(TelephonyDevice),
21226    /// "Consumer"
21227    Consumer(Consumer),
21228    /// "Digitizers"
21229    Digitizers(Digitizers),
21230    /// "Haptics"
21231    Haptics(Haptics),
21232    /// "Physical Input Device"
21233    PhysicalInputDevice(PhysicalInputDevice),
21234    /// "Unicode"
21235    Unicode(Unicode),
21236    /// "SoC"
21237    SoC(SoC),
21238    /// "Eye and Head Trackers"
21239    EyeandHeadTrackers(EyeandHeadTrackers),
21240    /// "Auxiliary Display"
21241    AuxiliaryDisplay(AuxiliaryDisplay),
21242    /// "Sensors"
21243    Sensors(Sensors),
21244    /// "Medical Instrument"
21245    MedicalInstrument(MedicalInstrument),
21246    /// "Braille Display"
21247    BrailleDisplay(BrailleDisplay),
21248    /// "Lighting And Illumination"
21249    LightingAndIllumination(LightingAndIllumination),
21250    /// "Monitor"
21251    Monitor(Monitor),
21252    /// "Monitor Enumerated"
21253    MonitorEnumerated(MonitorEnumerated),
21254    /// "VESA Virtual Controls"
21255    VESAVirtualControls(VESAVirtualControls),
21256    /// "Power"
21257    Power(Power),
21258    /// "Battery System"
21259    BatterySystem(BatterySystem),
21260    /// "Barcode Scanner"
21261    BarcodeScanner(BarcodeScanner),
21262    /// "Scales"
21263    Scales(Scales),
21264    /// "Magnetic Stripe Reader"
21265    MagneticStripeReader(MagneticStripeReader),
21266    /// "Camera Control"
21267    CameraControl(CameraControl),
21268    /// "Arcade"
21269    Arcade(Arcade),
21270    /// "FIDO Alliance"
21271    FIDOAlliance(FIDOAlliance),
21272    /// "Wacom"
21273    Wacom(Wacom),
21274    ReservedUsagePage {
21275        reserved_page: ReservedPage,
21276        usage: ReservedUsagePage,
21277    },
21278    VendorDefinedPage {
21279        vendor_page: VendorPage,
21280        usage: VendorDefinedPage,
21281    },
21282}
21283
21284impl Usage {
21285    #[cfg(feature = "std")]
21286    pub fn new_from_page_and_id(usage_page: u16, usage_id: u16) -> Result<Usage> {
21287        Usage::try_from(((usage_page as u32) << 16) | usage_id as u32)
21288    }
21289
21290    #[cfg(feature = "std")]
21291    pub fn name(&self) -> String {
21292        match self {
21293            Usage::GenericDesktop(usage) => usage.name(),
21294            Usage::SimulationControls(usage) => usage.name(),
21295            Usage::VRControls(usage) => usage.name(),
21296            Usage::SportControls(usage) => usage.name(),
21297            Usage::GameControls(usage) => usage.name(),
21298            Usage::GenericDeviceControls(usage) => usage.name(),
21299            Usage::KeyboardKeypad(usage) => usage.name(),
21300            Usage::LED(usage) => usage.name(),
21301            Usage::Button(usage) => usage.name(),
21302            Usage::Ordinal(usage) => usage.name(),
21303            Usage::TelephonyDevice(usage) => usage.name(),
21304            Usage::Consumer(usage) => usage.name(),
21305            Usage::Digitizers(usage) => usage.name(),
21306            Usage::Haptics(usage) => usage.name(),
21307            Usage::PhysicalInputDevice(usage) => usage.name(),
21308            Usage::Unicode(usage) => usage.name(),
21309            Usage::SoC(usage) => usage.name(),
21310            Usage::EyeandHeadTrackers(usage) => usage.name(),
21311            Usage::AuxiliaryDisplay(usage) => usage.name(),
21312            Usage::Sensors(usage) => usage.name(),
21313            Usage::MedicalInstrument(usage) => usage.name(),
21314            Usage::BrailleDisplay(usage) => usage.name(),
21315            Usage::LightingAndIllumination(usage) => usage.name(),
21316            Usage::Monitor(usage) => usage.name(),
21317            Usage::MonitorEnumerated(usage) => usage.name(),
21318            Usage::VESAVirtualControls(usage) => usage.name(),
21319            Usage::Power(usage) => usage.name(),
21320            Usage::BatterySystem(usage) => usage.name(),
21321            Usage::BarcodeScanner(usage) => usage.name(),
21322            Usage::Scales(usage) => usage.name(),
21323            Usage::MagneticStripeReader(usage) => usage.name(),
21324            Usage::CameraControl(usage) => usage.name(),
21325            Usage::Arcade(usage) => usage.name(),
21326            Usage::FIDOAlliance(usage) => usage.name(),
21327            Usage::Wacom(usage) => usage.name(),
21328            Usage::ReservedUsagePage { usage, .. } => usage.name(),
21329            Usage::VendorDefinedPage { usage, .. } => usage.name(),
21330        }
21331    }
21332}
21333
21334impl AsUsage for Usage {
21335    /// Returns the 32 bit Usage value for this usage.
21336    fn usage_value(&self) -> u32 {
21337        self.into()
21338    }
21339
21340    /// Returns the 16-bit Usage ID value for this usage.
21341    fn usage_id_value(&self) -> u16 {
21342        self.into()
21343    }
21344
21345    /// Returns [Self]
21346    fn usage(&self) -> Usage {
21347        Usage::try_from(self.usage_value()).unwrap()
21348    }
21349}
21350
21351impl PartialEq for Usage {
21352    fn eq(&self, other: &Self) -> bool {
21353        u32::from(self) == u32::from(other)
21354    }
21355}
21356
21357impl AsUsagePage for Usage {
21358    fn usage_page_value(&self) -> u16 {
21359        UsagePage::from(self).into()
21360    }
21361
21362    fn usage_page(&self) -> UsagePage {
21363        match self {
21364            Usage::GenericDesktop(_) => UsagePage::GenericDesktop,
21365            Usage::SimulationControls(_) => UsagePage::SimulationControls,
21366            Usage::VRControls(_) => UsagePage::VRControls,
21367            Usage::SportControls(_) => UsagePage::SportControls,
21368            Usage::GameControls(_) => UsagePage::GameControls,
21369            Usage::GenericDeviceControls(_) => UsagePage::GenericDeviceControls,
21370            Usage::KeyboardKeypad(_) => UsagePage::KeyboardKeypad,
21371            Usage::LED(_) => UsagePage::LED,
21372            Usage::Button(_) => UsagePage::Button,
21373            Usage::Ordinal(_) => UsagePage::Ordinal,
21374            Usage::TelephonyDevice(_) => UsagePage::TelephonyDevice,
21375            Usage::Consumer(_) => UsagePage::Consumer,
21376            Usage::Digitizers(_) => UsagePage::Digitizers,
21377            Usage::Haptics(_) => UsagePage::Haptics,
21378            Usage::PhysicalInputDevice(_) => UsagePage::PhysicalInputDevice,
21379            Usage::Unicode(_) => UsagePage::Unicode,
21380            Usage::SoC(_) => UsagePage::SoC,
21381            Usage::EyeandHeadTrackers(_) => UsagePage::EyeandHeadTrackers,
21382            Usage::AuxiliaryDisplay(_) => UsagePage::AuxiliaryDisplay,
21383            Usage::Sensors(_) => UsagePage::Sensors,
21384            Usage::MedicalInstrument(_) => UsagePage::MedicalInstrument,
21385            Usage::BrailleDisplay(_) => UsagePage::BrailleDisplay,
21386            Usage::LightingAndIllumination(_) => UsagePage::LightingAndIllumination,
21387            Usage::Monitor(_) => UsagePage::Monitor,
21388            Usage::MonitorEnumerated(_) => UsagePage::MonitorEnumerated,
21389            Usage::VESAVirtualControls(_) => UsagePage::VESAVirtualControls,
21390            Usage::Power(_) => UsagePage::Power,
21391            Usage::BatterySystem(_) => UsagePage::BatterySystem,
21392            Usage::BarcodeScanner(_) => UsagePage::BarcodeScanner,
21393            Usage::Scales(_) => UsagePage::Scales,
21394            Usage::MagneticStripeReader(_) => UsagePage::MagneticStripeReader,
21395            Usage::CameraControl(_) => UsagePage::CameraControl,
21396            Usage::Arcade(_) => UsagePage::Arcade,
21397            Usage::FIDOAlliance(_) => UsagePage::FIDOAlliance,
21398            Usage::Wacom(_) => UsagePage::Wacom,
21399            Usage::ReservedUsagePage { reserved_page, .. } => {
21400                UsagePage::ReservedUsagePage(*reserved_page)
21401            }
21402            Usage::VendorDefinedPage { vendor_page, .. } => {
21403                UsagePage::VendorDefinedPage(*vendor_page)
21404            }
21405        }
21406    }
21407}
21408
21409#[cfg(feature = "std")]
21410impl fmt::Display for Usage {
21411    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
21412        write!(f, "{}", self.name())
21413    }
21414}
21415
21416impl From<&Usage> for u16 {
21417    fn from(usage: &Usage) -> u16 {
21418        let u: u32 = u32::from(usage);
21419        (u & 0xFFFF) as u16
21420    }
21421}
21422
21423impl From<Usage> for u16 {
21424    fn from(usage: Usage) -> u16 {
21425        u16::from(&usage)
21426    }
21427}
21428
21429impl From<&Usage> for u32 {
21430    fn from(usage: &Usage) -> u32 {
21431        match usage {
21432            Usage::GenericDesktop(usage) => (1 << 16) | u16::from(usage) as u32,
21433            Usage::SimulationControls(usage) => (2 << 16) | u16::from(usage) as u32,
21434            Usage::VRControls(usage) => (3 << 16) | u16::from(usage) as u32,
21435            Usage::SportControls(usage) => (4 << 16) | u16::from(usage) as u32,
21436            Usage::GameControls(usage) => (5 << 16) | u16::from(usage) as u32,
21437            Usage::GenericDeviceControls(usage) => (6 << 16) | u16::from(usage) as u32,
21438            Usage::KeyboardKeypad(usage) => (7 << 16) | u16::from(usage) as u32,
21439            Usage::LED(usage) => (8 << 16) | u16::from(usage) as u32,
21440            Usage::Button(usage) => (9 << 16) | u16::from(usage) as u32,
21441            Usage::Ordinal(usage) => (10 << 16) | u16::from(usage) as u32,
21442            Usage::TelephonyDevice(usage) => (11 << 16) | u16::from(usage) as u32,
21443            Usage::Consumer(usage) => (12 << 16) | u16::from(usage) as u32,
21444            Usage::Digitizers(usage) => (13 << 16) | u16::from(usage) as u32,
21445            Usage::Haptics(usage) => (14 << 16) | u16::from(usage) as u32,
21446            Usage::PhysicalInputDevice(usage) => (15 << 16) | u16::from(usage) as u32,
21447            Usage::Unicode(usage) => (16 << 16) | u16::from(usage) as u32,
21448            Usage::SoC(usage) => (17 << 16) | u16::from(usage) as u32,
21449            Usage::EyeandHeadTrackers(usage) => (18 << 16) | u16::from(usage) as u32,
21450            Usage::AuxiliaryDisplay(usage) => (20 << 16) | u16::from(usage) as u32,
21451            Usage::Sensors(usage) => (32 << 16) | u16::from(usage) as u32,
21452            Usage::MedicalInstrument(usage) => (64 << 16) | u16::from(usage) as u32,
21453            Usage::BrailleDisplay(usage) => (65 << 16) | u16::from(usage) as u32,
21454            Usage::LightingAndIllumination(usage) => (89 << 16) | u16::from(usage) as u32,
21455            Usage::Monitor(usage) => (128 << 16) | u16::from(usage) as u32,
21456            Usage::MonitorEnumerated(usage) => (129 << 16) | u16::from(usage) as u32,
21457            Usage::VESAVirtualControls(usage) => (130 << 16) | u16::from(usage) as u32,
21458            Usage::Power(usage) => (132 << 16) | u16::from(usage) as u32,
21459            Usage::BatterySystem(usage) => (133 << 16) | u16::from(usage) as u32,
21460            Usage::BarcodeScanner(usage) => (140 << 16) | u16::from(usage) as u32,
21461            Usage::Scales(usage) => (141 << 16) | u16::from(usage) as u32,
21462            Usage::MagneticStripeReader(usage) => (142 << 16) | u16::from(usage) as u32,
21463            Usage::CameraControl(usage) => (144 << 16) | u16::from(usage) as u32,
21464            Usage::Arcade(usage) => (145 << 16) | u16::from(usage) as u32,
21465            Usage::FIDOAlliance(usage) => (61904 << 16) | u16::from(usage) as u32,
21466            Usage::Wacom(usage) => (65293 << 16) | u16::from(usage) as u32,
21467            Usage::ReservedUsagePage {
21468                reserved_page,
21469                usage,
21470            } => ((u16::from(reserved_page) as u32) << 16) | u16::from(usage) as u32,
21471            Usage::VendorDefinedPage { vendor_page, usage } => {
21472                ((u16::from(vendor_page) as u32) << 16) | u16::from(usage) as u32
21473            }
21474        }
21475    }
21476}
21477
21478impl TryFrom<u32> for Usage {
21479    type Error = HutError;
21480
21481    fn try_from(up: u32) -> Result<Usage> {
21482        match (up >> 16, up & 0xFFFF) {
21483            (1, n) => Ok(Usage::GenericDesktop(GenericDesktop::try_from(n as u16)?)),
21484            (2, n) => Ok(Usage::SimulationControls(SimulationControls::try_from(
21485                n as u16,
21486            )?)),
21487            (3, n) => Ok(Usage::VRControls(VRControls::try_from(n as u16)?)),
21488            (4, n) => Ok(Usage::SportControls(SportControls::try_from(n as u16)?)),
21489            (5, n) => Ok(Usage::GameControls(GameControls::try_from(n as u16)?)),
21490            (6, n) => Ok(Usage::GenericDeviceControls(
21491                GenericDeviceControls::try_from(n as u16)?,
21492            )),
21493            (7, n) => Ok(Usage::KeyboardKeypad(KeyboardKeypad::try_from(n as u16)?)),
21494            (8, n) => Ok(Usage::LED(LED::try_from(n as u16)?)),
21495            (9, n) => Ok(Usage::Button(Button::try_from(n as u16)?)),
21496            (10, n) => Ok(Usage::Ordinal(Ordinal::try_from(n as u16)?)),
21497            (11, n) => Ok(Usage::TelephonyDevice(TelephonyDevice::try_from(n as u16)?)),
21498            (12, n) => Ok(Usage::Consumer(Consumer::try_from(n as u16)?)),
21499            (13, n) => Ok(Usage::Digitizers(Digitizers::try_from(n as u16)?)),
21500            (14, n) => Ok(Usage::Haptics(Haptics::try_from(n as u16)?)),
21501            (15, n) => Ok(Usage::PhysicalInputDevice(PhysicalInputDevice::try_from(
21502                n as u16,
21503            )?)),
21504            (16, n) => Ok(Usage::Unicode(Unicode::try_from(n as u16)?)),
21505            (17, n) => Ok(Usage::SoC(SoC::try_from(n as u16)?)),
21506            (18, n) => Ok(Usage::EyeandHeadTrackers(EyeandHeadTrackers::try_from(
21507                n as u16,
21508            )?)),
21509            (20, n) => Ok(Usage::AuxiliaryDisplay(AuxiliaryDisplay::try_from(
21510                n as u16,
21511            )?)),
21512            (32, n) => Ok(Usage::Sensors(Sensors::try_from(n as u16)?)),
21513            (64, n) => Ok(Usage::MedicalInstrument(MedicalInstrument::try_from(
21514                n as u16,
21515            )?)),
21516            (65, n) => Ok(Usage::BrailleDisplay(BrailleDisplay::try_from(n as u16)?)),
21517            (89, n) => Ok(Usage::LightingAndIllumination(
21518                LightingAndIllumination::try_from(n as u16)?,
21519            )),
21520            (128, n) => Ok(Usage::Monitor(Monitor::try_from(n as u16)?)),
21521            (129, n) => Ok(Usage::MonitorEnumerated(MonitorEnumerated::try_from(
21522                n as u16,
21523            )?)),
21524            (130, n) => Ok(Usage::VESAVirtualControls(VESAVirtualControls::try_from(
21525                n as u16,
21526            )?)),
21527            (132, n) => Ok(Usage::Power(Power::try_from(n as u16)?)),
21528            (133, n) => Ok(Usage::BatterySystem(BatterySystem::try_from(n as u16)?)),
21529            (140, n) => Ok(Usage::BarcodeScanner(BarcodeScanner::try_from(n as u16)?)),
21530            (141, n) => Ok(Usage::Scales(Scales::try_from(n as u16)?)),
21531            (142, n) => Ok(Usage::MagneticStripeReader(MagneticStripeReader::try_from(
21532                n as u16,
21533            )?)),
21534            (144, n) => Ok(Usage::CameraControl(CameraControl::try_from(n as u16)?)),
21535            (145, n) => Ok(Usage::Arcade(Arcade::try_from(n as u16)?)),
21536            (61904, n) => Ok(Usage::FIDOAlliance(FIDOAlliance::try_from(n as u16)?)),
21537            (65293, n) => Ok(Usage::Wacom(Wacom::try_from(n as u16)?)),
21538            (p @ 0xff00..=0xffff, n) => Ok(Usage::VendorDefinedPage {
21539                vendor_page: VendorPage(p as u16),
21540                usage: VendorDefinedPage::VendorUsage { usage_id: n as u16 },
21541            }),
21542            (p, n) => match ReservedPage::try_from(p as u16) {
21543                Ok(r) => Ok(Usage::ReservedUsagePage {
21544                    reserved_page: r,
21545                    usage: ReservedUsagePage::ReservedUsage { usage_id: n as u16 },
21546                }),
21547                _ => Err(HutError::UnknownUsage),
21548            },
21549        }
21550    }
21551}
21552
21553#[cfg(test)]
21554mod tests {
21555    use super::*;
21556
21557    #[test]
21558    fn conversions() {
21559        let hid_usage_page: u16 = 0x01; // Generic Desktop
21560        let hid_usage_id: u16 = 0x02; // Mouse
21561        let hid_usage: u32 = ((hid_usage_page as u32) << 16) | hid_usage_id as u32;
21562
21563        let u = GenericDesktop::Mouse;
21564        // 32 bit usage to enum
21565        assert!(matches!(
21566            Usage::try_from(hid_usage).unwrap(),
21567            Usage::GenericDesktop(_)
21568        ));
21569
21570        // Usage to u32
21571        assert_eq!(u32::from(&u), hid_usage);
21572        assert_eq!(u.usage_value(), hid_usage);
21573
21574        // Usage to u16 usage_id
21575        assert_eq!(hid_usage_id, u16::from(&u));
21576        assert_eq!(hid_usage_id, u.usage_id_value());
21577
21578        // Usage to UsagePage
21579        assert!(matches!(UsagePage::from(&u), UsagePage::GenericDesktop));
21580
21581        // UsagePage to u16
21582        let up = UsagePage::from(&u);
21583        assert_eq!(hid_usage_page, u16::from(&up));
21584
21585        // UsagePage to u16 via AsUsagePage trait
21586        assert_eq!(hid_usage_page, up.usage_page_value());
21587    }
21588
21589    #[test]
21590    fn buttons() {
21591        let hid_usage_page: u16 = 0x9;
21592        let hid_usage_id: u16 = 0x5;
21593        let hid_usage: u32 = ((hid_usage_page as u32) << 16) | hid_usage_id as u32;
21594
21595        let u = Button::Button(5);
21596        assert!(matches!(
21597            Usage::try_from(hid_usage).unwrap(),
21598            Usage::Button(_)
21599        ));
21600
21601        // Usage to u32
21602        assert_eq!(u32::from(&u), hid_usage);
21603        assert_eq!(u.usage_value(), hid_usage);
21604
21605        // Usage to u16 usage_id
21606        assert_eq!(hid_usage_id, u16::from(&u));
21607        assert_eq!(hid_usage_id, u.usage_id_value());
21608
21609        // Usage to UsagePage
21610        assert!(matches!(UsagePage::from(&u), UsagePage::Button));
21611
21612        // UsagePage to u16
21613        let up = UsagePage::from(&u);
21614        assert_eq!(hid_usage_page, u16::from(&up));
21615
21616        // UsagePage to u16 via AsUsagePage trait
21617        assert_eq!(hid_usage_page, up.usage_page_value());
21618    }
21619
21620    #[test]
21621    fn ordinals() {
21622        let hid_usage_page: u16 = 0xA;
21623        let hid_usage_id: u16 = 0x8;
21624        let hid_usage: u32 = ((hid_usage_page as u32) << 16) | hid_usage_id as u32;
21625
21626        let u = Ordinal::Ordinal(8);
21627        assert!(matches!(
21628            Usage::try_from(hid_usage).unwrap(),
21629            Usage::Ordinal(_)
21630        ));
21631
21632        // Usage to u32
21633        assert_eq!(u32::from(&u), hid_usage);
21634        assert_eq!(u.usage_value(), hid_usage);
21635
21636        // Usage to u16 usage_id
21637        assert_eq!(hid_usage_id, u16::from(&u));
21638        assert_eq!(hid_usage_id, u.usage_id_value());
21639
21640        // Usage to UsagePage
21641        assert!(matches!(UsagePage::from(&u), UsagePage::Ordinal));
21642
21643        // UsagePage to u16
21644        let up = UsagePage::from(&u);
21645        assert_eq!(hid_usage_page, u16::from(&up));
21646
21647        // UsagePage to u16 via AsUsagePage trait
21648        assert_eq!(hid_usage_page, up.usage_page_value());
21649    }
21650
21651    #[cfg(feature = "std")]
21652    #[test]
21653    fn names() {
21654        assert_eq!(UsagePage::GenericDesktop.name().as_str(), "Generic Desktop");
21655        assert_eq!(
21656            UsagePage::PhysicalInputDevice.name().as_str(),
21657            "Physical Input Device"
21658        );
21659        assert_eq!(GenericDesktop::CallMuteLED.name().as_str(), "Call Mute LED");
21660        assert_eq!(VRControls::HeadTracker.name().as_str(), "Head Tracker");
21661    }
21662
21663    #[test]
21664    fn usages() {
21665        let mouse = GenericDesktop::Mouse;
21666        let usage = Usage::GenericDesktop(GenericDesktop::Mouse);
21667        assert_eq!(mouse.usage(), usage);
21668    }
21669}