1// GENERATED CONTENT - DO NOT EDIT
2// Content was automatically extracted by Reffy into webref
3// (https://github.com/w3c/webref)
4// Source: WebHID API (https://wicg.github.io/webhid/)
5
6dictionary HIDDeviceFilter {
7    unsigned long vendorId;
8    unsigned short productId;
9    unsigned short usagePage;
10    unsigned short usage;
11};
12
13dictionary HIDDeviceRequestOptions {
14    required sequence<HIDDeviceFilter> filters;
15};
16
17[
18    Exposed=Window,
19    SecureContext
20]
21interface HID : EventTarget {
22    attribute EventHandler onconnect;
23    attribute EventHandler ondisconnect;
24    Promise<sequence<HIDDevice>> getDevices();
25    Promise<sequence<HIDDevice>> requestDevice(
26        HIDDeviceRequestOptions options);
27};
28
29[SecureContext] partial interface Navigator {
30    [SameObject] readonly attribute HID hid;
31};
32
33dictionary HIDConnectionEventInit : EventInit {
34    required HIDDevice device;
35};
36
37[
38    Exposed=Window,
39    SecureContext
40] interface HIDConnectionEvent : Event {
41    constructor(DOMString type, HIDConnectionEventInit eventInitDict);
42    [SameObject] readonly attribute HIDDevice device;
43};
44
45dictionary HIDInputReportEventInit : EventInit {
46    required HIDDevice device;
47    required octet reportId;
48    required DataView data;
49};
50
51[
52    Exposed=Window,
53    SecureContext
54] interface HIDInputReportEvent : Event {
55    constructor(DOMString type, HIDInputReportEventInit eventInitDict);
56    [SameObject] readonly attribute HIDDevice device;
57    readonly attribute octet reportId;
58    readonly attribute DataView data;
59};
60
61enum HIDUnitSystem {
62    "none", "si-linear", "si-rotation", "english-linear",
63    "english-rotation", "vendor-defined", "reserved"
64};
65
66dictionary HIDReportItem {
67    boolean isAbsolute;
68    boolean isArray;
69    boolean isBufferedBytes;
70    boolean isConstant;
71    boolean isLinear;
72    boolean isRange;
73    boolean isVolatile;
74    boolean hasNull;
75    boolean hasPreferredState;
76    boolean wrap;
77    sequence<unsigned long> usages;
78    unsigned long usageMinimum;
79    unsigned long usageMaximum;
80    unsigned short reportSize;
81    unsigned short reportCount;
82    byte unitExponent;
83    HIDUnitSystem unitSystem;
84    byte unitFactorLengthExponent;
85    byte unitFactorMassExponent;
86    byte unitFactorTimeExponent;
87    byte unitFactorTemperatureExponent;
88    byte unitFactorCurrentExponent;
89    byte unitFactorLuminousIntensityExponent;
90    long logicalMinimum;
91    long logicalMaximum;
92    long physicalMinimum;
93    long physicalMaximum;
94    sequence<DOMString> strings;
95};
96
97dictionary HIDReportInfo {
98    octet reportId;
99    sequence<HIDReportItem> items;
100};
101
102dictionary HIDCollectionInfo {
103    unsigned short usagePage;
104    unsigned short usage;
105    octet type;
106    sequence<HIDCollectionInfo> children;
107    sequence<HIDReportInfo> inputReports;
108    sequence<HIDReportInfo> outputReports;
109    sequence<HIDReportInfo> featureReports;
110};
111
112[
113    Exposed=Window,
114    SecureContext
115] interface HIDDevice : EventTarget {
116    attribute EventHandler oninputreport;
117    readonly attribute boolean opened;
118    readonly attribute unsigned short vendorId;
119    readonly attribute unsigned short productId;
120    readonly attribute DOMString productName;
121    readonly attribute FrozenArray<HIDCollectionInfo> collections;
122    Promise<undefined> open();
123    Promise<undefined> close();
124    Promise<undefined> sendReport([EnforceRange] octet reportId, BufferSource data);
125    Promise<undefined> sendFeatureReport([EnforceRange] octet reportId, BufferSource data);
126    Promise<DataView> receiveFeatureReport([EnforceRange] octet reportId);
127};
128