Class USBDevice
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
NOTE
ExperimentalUSBDevice interface of the WebUSB API provides access to metadata about a paired USB device and methods for controlling it.
[Value("USBDevice")]
public class USBDevice
- Inheritance
-
USBDevice
- Inherited Members
Remarks
Constructors
USBDevice()
public USBDevice()
Properties
Configuration
NOTE
Experimentalconfiguration read only property of theUSBDevice interface returns a USBConfiguration object for
the currently selected interface for a paired USB device.
[Value("configuration")]
public USBConfiguration? Configuration { get; }
Property Value
- USBConfiguration
A USBConfiguration object.
Remarks
Configurations
NOTE
Experimentalconfigurations read only property of theUSBDevice interface an {{jsxref("array")}} of device-specific interfaces
for controlling a paired USB device.
[Value("configurations")]
public USBConfiguration[] Configurations { get; }
Property Value
- USBConfiguration[]
An {{jsxref("array")}} of USBConfiguration objects.
Remarks
DeviceClass
NOTE
ExperimentaldeviceClass read only property of theUSBDevice interface one of three properties that identify USB devices for
the purpose of loading a USB driver that will work with that device. The other two
properties are
USBDevice.deviceSubclass and USBDevice.deviceProtocol.
[Value("deviceClass")]
public byte DeviceClass { get; }
Property Value
- byte
A number.
Remarks
DeviceProtocol
NOTE
ExperimentaldeviceProtocol read only property of theUSBDevice interface one of three properties that identify USB devices for
the purpose of loading a USB driver that will work with that device. The other two
properties are
USBDevice.deviceClassand
USBDevice.deviceSubclass.
[Value("deviceProtocol")]
public byte DeviceProtocol { get; }
Property Value
- byte
A number.
Remarks
DeviceSubclass
NOTE
ExperimentaldeviceSubclass read only property of theUSBDevice interface one of three properties that identify USB devices for
the purpose of loading a USB driver that will work with that device. The other two
properties are USBDevice.deviceClass and USBDevice.deviceProtocol.
[Value("deviceSubclass")]
public byte DeviceSubclass { get; }
Property Value
- byte
A number.
Remarks
DeviceVersionMajor
NOTE
ExperimentaldeviceVersionMajor read only property of theUSBDevice interface he major version number of the device in a semantic
versioning scheme.
[Value("deviceVersionMajor")]
public byte DeviceVersionMajor { get; }
Property Value
- byte
A number.
Remarks
DeviceVersionMinor
NOTE
ExperimentaldeviceVersionMinor read only property of theUSBDevice interface the minor version number of the device in a semantic
versioning scheme.
[Value("deviceVersionMinor")]
public byte DeviceVersionMinor { get; }
Property Value
- byte
A number.
Remarks
DeviceVersionSubminor
NOTE
ExperimentaldeviceVersionSubminor read only property of theUSBDevice interface the patch version number of the device in a semantic
versioning scheme.
[Value("deviceVersionSubminor")]
public byte DeviceVersionSubminor { get; }
Property Value
- byte
A number.
Remarks
ManufacturerName
NOTE
ExperimentalmanufacturerName read only property of theUSBDevice interface the of the organization that manufactured the USB
device.
[Value("manufacturerName")]
public string? ManufacturerName { get; }
Property Value
- string
A string.
Remarks
Opened
NOTE
Experimentalopened read only property of theUSBDevice interface indicates whether a session has been started with a
paired USB device. A device must be opened before it can be controlled by a web page.
[Value("opened")]
public bool Opened { get; }
Property Value
Remarks
ProductId
NOTE
ExperimentalproductId read only property of theUSBDevice interface the manufacturer-defined code that identifies a USB
device.
[Value("productId")]
public ushort ProductId { get; }
Property Value
- ushort
The manufacturer-defined code that identifies a USB device.
Remarks
ProductName
NOTE
ExperimentalproductName read only property of theUSBDevice interface the manufacturer-defined name that identifies a USB
device.
[Value("productName")]
public string? ProductName { get; }
Property Value
- string
The manufacturer-defined name that identifies a USB device.
Remarks
SerialNumber
NOTE
ExperimentalserialNumber read only property of theUSBDevice interface is the manufacturer-defined serial number for the
specific USB device.
[Value("serialNumber")]
public string? SerialNumber { get; }
Property Value
- string
The serial number for the specified USB device
Remarks
UsbVersionMajor
NOTE
ExperimentalusbVersionMajor read only property of theUSBDevice interface is one of three properties that declare the USB
protocol version supported by the device. The other two properties
are USBDevice.usbVersionMinor and USBDevice.usbVersionSubminor.
[Value("usbVersionMajor")]
public byte UsbVersionMajor { get; }
Property Value
- byte
The last of three properties that declare the USB protocol version supported by the
device.
Remarks
UsbVersionMinor
NOTE
ExperimentalusbVersionMinor read only property of theUSBDevice interface is one of three properties that declare the USB
protocol version supported by the device. The other two properties
are USBDevice.usbVersionMajor and USBDevice.usbVersionSubminor.
[Value("usbVersionMinor")]
public byte UsbVersionMinor { get; }
Property Value
- byte
The second of three properties that declare the USB protocol version supported by the
device.
Remarks
UsbVersionSubminor
NOTE
ExperimentalusbVersionSubminor read only property of theUSBDevice interface is one of three properties that declare the USB
protocol version supported by the device. The other two properties
are USBDevice.usbVersionMajor and USBDevice.usbVersionMinor.
[Value("usbVersionSubminor")]
public byte UsbVersionSubminor { get; }
Property Value
- byte
The first of three properties that declare the USB protocol version supported by the
device.
Remarks
VendorId
NOTE
ExperimentalvendorId read only property of theUSBDevice interface is the official usb.org-assigned vendor ID.
[Value("vendorId")]
public ushort VendorId { get; }
Property Value
- ushort
The official usb.org-assigned vendor ID.
Remarks
Methods
ClaimInterface(byte)
NOTE
ExperimentalclaimInterface() method of theUSBDevice interface returns a {{jsxref("promise")}} that resolves when
the requested interface is claimed for exclusive access.
[Value("claimInterface")]
public Task<GlobalObject.Undefined> ClaimInterface(byte interfaceNumber)
Parameters
interfaceNumberbyte
Returns
Remarks
ClearHalt(USBDirection, byte)
NOTE
ExperimentalclearHalt() method of the USBDeviceinterface returns a Promise that resolves when a halt condition is
cleared. A halt condition is when a data transfer to or from the device has a status
of
'stall', which requires the web page (the host system, in USBterminology) to clear that condition. See the for details.
[Value("clearHalt")]
public Task<GlobalObject.Undefined> ClearHalt(USBDirection direction, byte endpointNumber)
Parameters
directionUSBDirectionendpointNumberbyte
Returns
Remarks
Close()
NOTE
Experimentalclose() method of the USBDeviceinterface returns a Promise that resolves when all open interfaces are
released and the device session has ended.
[Value("close")]
public Task<GlobalObject.Undefined> Close()
Returns
Remarks
ControlTransferIn(USBControlTransferParameters, ushort)
NOTE
ExperimentalcontrolTransferIn() method of the USBDevice interface returns a {{jsxref("Promise")}} that resolves with a USBInTransferResult when a command or status request has been transmitted to (received by) the USB device.
[Value("controlTransferIn")]
public Task<USBInTransferResult> ControlTransferIn(USBControlTransferParameters setup, ushort length)
Parameters
setupUSBControlTransferParameterslengthushort
Returns
- Task<USBInTransferResult>
{{jsxref("promise")}} that resolves with a USBInTransferResult.
Remarks
ControlTransferOut(USBControlTransferParameters, Union224)
NOTE
ExperimentalcontrolTransferOut() method of the USBDevice interface returns a {{jsxref("Promise")}} that resolves with a USBOutTransferResult when a command or status operation has been transmitted from the USB device.
[Value("controlTransferOut")]
public Task<USBOutTransferResult> ControlTransferOut(USBControlTransferParameters setup, Union224 data = default)
Parameters
setupUSBControlTransferParametersdataUnion224
Returns
- Task<USBOutTransferResult>
A {{jsxref("promise")}} that resolves with a USBOutTransferResult.
Remarks
Forget()
NOTE
Experimentalforget() method of the USBDevice interface returns a {{jsxref("Promise")}} that resolves when all pending operations are aborted, all open interfaces are released, the device session has ended, and the permission is reset.
[Value("forget")]
public Task<GlobalObject.Undefined> Forget()
Returns
- Task<GlobalObject.Undefined>
A Promise which resolves with
undefinedonce the device access permission is revoked.
Remarks
IsochronousTransferIn(byte, List<ulong>)
NOTE
ExperimentalisochronousTransferIn() method of the USBDevice interface returns a {{jsxref("Promise")}} that resolves with a USBIsochronousInTransferResult when time sensitive information has been transmitted to (received by) the USB device.
[Value("isochronousTransferIn")]
public Task<USBIsochronousInTransferResult> IsochronousTransferIn(byte endpointNumber, List<ulong> packetLengths)
Parameters
Returns
- Task<USBIsochronousInTransferResult>
A {{jsxref("Promise")}} that resolves with a USBIsochronousInTransferResult.
Remarks
IsochronousTransferOut(byte, Union224, List<ulong>)
NOTE
ExperimentalisochronousTransferOut() method of theUSBDevice interface returns a {{jsxref("Promise")}} that resolves with a USBIsochronousOutTransferResult when time sensitive information has been transmitted from the USB device.
[Value("isochronousTransferOut")]
public Task<USBIsochronousOutTransferResult> IsochronousTransferOut(byte endpointNumber, Union224 data, List<ulong> packetLengths)
Parameters
Returns
- Task<USBIsochronousOutTransferResult>
A {{jsxref("Promise")}} that resolves with a USBIsochronousOutTransferResult.
Remarks
Open()
NOTE
Experimentalopen() method of the USBDeviceinterface returns a Promise that resolves when a device session has
started.
[Value("open")]
public Task<GlobalObject.Undefined> Open()
Returns
Remarks
ReleaseInterface(byte)
NOTE
ExperimentalreleaseInterface() method of theUSBDevice interface returns a {{jsxref("promise")}} that resolves when a
claimed interface is released from exclusive access.
[Value("releaseInterface")]
public Task<GlobalObject.Undefined> ReleaseInterface(byte interfaceNumber)
Parameters
interfaceNumberbyte
Returns
Remarks
Reset()
NOTE
Experimentalreset() method of the USBDeviceinterface returns a Promise that resolves when the device is reset and all
app operations canceled and their promises rejected.
[Value("reset")]
public Task<GlobalObject.Undefined> Reset()
Returns
Remarks
SelectAlternateInterface(byte, byte)
NOTE
ExperimentalselectAlternateInterface() method of theUSBDevice interface returns a {{jsxref("promise")}} that resolves when
the specified alternative endpoint is selected.
[Value("selectAlternateInterface")]
public Task<GlobalObject.Undefined> SelectAlternateInterface(byte interfaceNumber, byte alternateSetting)
Parameters
Returns
Remarks
SelectConfiguration(byte)
NOTE
ExperimentalselectConfiguration() method of theUSBDevice interface returns a {{jsxref("promise")}} that resolves when
the specified configuration is selected.
[Value("selectConfiguration")]
public Task<GlobalObject.Undefined> SelectConfiguration(byte configurationValue)
Parameters
configurationValuebyte
Returns
Remarks
TransferIn(byte, ulong)
NOTE
ExperimentaltransferIn() method of the USBDeviceinterface returns a Promise that resolves with a
USBInTransferResult when bulk or interrupt data is received from the USB
device.
[Value("transferIn")]
public Task<USBInTransferResult> TransferIn(byte endpointNumber, ulong length)
Parameters
Returns
- Task<USBInTransferResult>
A {{jsxref("promise")}} that resolves with a USBInTransferResult.
Remarks
TransferOut(byte, Union224)
NOTE
ExperimentaltransferOut() method of the USBDeviceinterface returns a Promise that resolves with a
USBOutTransferResult when bulk or interrupt data is sent to the USB
device.
[Value("transferOut")]
public Task<USBOutTransferResult> TransferOut(byte endpointNumber, Union224 data)
Parameters
Returns
- Task<USBOutTransferResult>
A {{jsxref("promise")}} that resolves with a USBOutTransferResult.