Class HIDDevice
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
NOTE
ExperimentalHIDDevice interface of the WebHID API represents a HID Device. It provides properties for accessing information about the device, methods for opening and closing the connection, and the sending and receiving of reports.
[Value("HIDDevice")]
public class HIDDevice : EventTarget
- Inheritance
-
HIDDevice
- Inherited Members
Remarks
Constructors
HIDDevice()
public HIDDevice()
Properties
Collections
NOTE
Experimentalcollections read-only property of the HIDDevice interface returns an array of report formats
[Value("collections")]
public HIDCollectionInfo[] Collections { get; }
Property Value
- HIDCollectionInfo[]
An array of report formats. Each entry contains the following:
Remarks
Oninputreport
[Value("oninputreport")]
public EventHandlerNonNull Oninputreport { get; set; }
Property Value
Opened
NOTE
Experimentalopened read-only property of the HIDDevice interface returns true if the connection to the HIDDevice is open and ready to transfer data.
[Value("opened")]
public bool Opened { get; }
Property Value
- bool
A boolean value, true if the connection is open.
Remarks
ProductId
NOTE
ExperimentalproductId read-only property of the HIDDevice interface returns the product ID of the connected HID device.
[Value("productId")]
public ushort ProductId { get; }
Property Value
- ushort
An integer. If the device has no product ID, or the product ID cannot be accessed this will return
0.
Remarks
ProductName
NOTE
ExperimentalproductName read-only property of the HIDDevice interface returns the product name of the connected HID device.
[Value("productName")]
public string ProductName { get; }
Property Value
- string
A string.
Remarks
VendorId
NOTE
ExperimentalvendorId read-only property of the HIDDevice interface returns the vendor ID of the connected HID device. This identifies the vendor of the device.
[Value("vendorId")]
public ushort VendorId { get; }
Property Value
- ushort
An integer. If the device has no vendor ID, or the vendor ID cannot be accessed this will return
0.
Remarks
Methods
Close()
NOTE
Experimentalclose() method of the HIDDevice interface closes the connection to the HID device.
[Value("close")]
public Task<GlobalObject.Undefined> Close()
Returns
- Task<GlobalObject.Undefined>
A Promise that resolves with
undefinedonce the connection is closed.
Remarks
Forget()
NOTE
Experimentalforget() method of the HIDDevice interface closes the connection to the HID device and forgets the device.
[Value("forget")]
public Task<GlobalObject.Undefined> Forget()
Returns
- Task<GlobalObject.Undefined>
A Promise that resolves with
undefinedonce the connection is closed, the device is forgotten, and the permission is reset.
Remarks
Open()
NOTE
Experimentalopen() method of the HIDDevice interface requests that the operating system opens the HID device.
[Value("open")]
public Task<GlobalObject.Undefined> Open()
Returns
- Task<GlobalObject.Undefined>
A Promise that resolves with
undefinedonce the connection is opened.
Remarks
NOTE
HID devices are not opened automatically. Therefore, a HIDDevice returned by RequestDevice(HIDDeviceRequestOptions) must be opened with this method before it is available to transfer data.
ReceiveFeatureReport(byte)
NOTE
ExperimentalreceiveFeatureReport() method of the HIDDevice interface receives a feature report from the HID device. Feature reports are a way for HID devices and applications to exchange non-standardized HID data.
[Value("receiveFeatureReport")]
public Task<DataView> ReceiveFeatureReport(byte reportId)
Parameters
reportIdbyte
Returns
Remarks
The reportId for each of the report formats that this device supports can be retrieved from Collections.
SendFeatureReport(byte, Union224)
NOTE
ExperimentalsendFeatureReport() method of the HIDDevice interface sends a feature report to the HID device. Feature reports are a way for HID devices and applications to exchange non-standardized HID data.
[Value("sendFeatureReport")]
public Task<GlobalObject.Undefined> SendFeatureReport(byte reportId, Union224 data)
Parameters
Returns
- Task<GlobalObject.Undefined>
A Promise that resolves with
undefinedonce the report has been sent.
Remarks
The reportId for each of the report formats that this device supports can be retrieved from Collections.
SendReport(byte, Union224)
NOTE
ExperimentalsendReport() method of the HIDDevice interface sends an output report to the HID device.
[Value("sendReport")]
public Task<GlobalObject.Undefined> SendReport(byte reportId, Union224 data)
Parameters
Returns
- Task<GlobalObject.Undefined>
A Promise that resolves with
undefinedonce the report has been sent.
Remarks
The reportId for each of the report formats that this device supports can be retrieved from Collections.