Interface: UsbDevice¶
api/hardware/EvamHardwareUsbApi.UsbDevice
Usb device accessible from the Evam platform
Implemented by¶
Properties¶
classCode¶
Readonly
classCode: number
Device class code
productId¶
Readonly
productId: number
Device product ID
productName¶
Readonly
productName: string
Device product name
protocolCode¶
Readonly
protocolCode: number
Device protocol code
serialNumber¶
Readonly
serialNumber: string
Device serial number
subclassCode¶
Readonly
subclassCode: number
Device sub class code
vendorId¶
Readonly
vendorId: number
Device vendor ID
version¶
Readonly
version: string
Device USB version as “major.minor.sub-minor”
Methods¶
claimInterface¶
claimInterface(interfaceNumber
, force
): Promise
<void
>
Claims an interface by its number for exclusive communication access
Parameters¶
Name |
Type |
Description |
---|---|---|
|
|
The interface number from [UsbInterface] |
|
|
Set to true to make an attempt at enforcing the claim |
Returns¶
Promise
<void
>
close¶
close(): Promise
<void
>
Close a device once it is no longer needed
Returns¶
Promise
<void
>
controlTransferIn¶
controlTransferIn(requestType
, recipient
, request
, value
, index
, length
, timeout
): Promise
<UsbTransferResult
>
Perform a control transfer - IN direction (data read)
Parameters¶
Name |
Type |
Description |
---|---|---|
|
|
The request type: “standard”, “class” or “vendor” |
|
|
The recipient: “device” | “interface” | “endpoint” | “other” |
|
|
The request byte |
|
|
The value byte |
|
|
The index for the request |
|
|
The request length |
|
|
timeout in milliseconds |
Returns¶
Promise
<UsbTransferResult
>
controlTransferOut¶
controlTransferOut(requestType
, recipient
, request
, value
, index
, data
, timeout
): Promise
<UsbTransferResult
>
Perform a control transfer - OUT direction (data write)
Parameters¶
Name |
Type |
Description |
---|---|---|
|
|
The request type: “standard”, “class” or “vendor” |
|
|
The recipient: “device” | “interface” | “endpoint” | “other” |
|
|
The request byte |
|
|
The value byte |
|
|
The index for the request |
|
|
The data to be written |
|
|
The timeout in milliseconds |
Returns¶
Promise
<UsbTransferResult
>
forget¶
forget(): Promise
<void
>
Release the authorization for this device, access will have to be requested again.
Returns¶
Promise
<void
>
getInterfaces¶
getInterfaces(): UsbInterface
[]
Get the interfaces this device has
Returns¶
open¶
open(): Promise
<void
>
Open the device for communication
Returns¶
Promise
<void
>
releaseInterface¶
releaseInterface(interfaceNumber
): Promise
<void
>
Release an interface once communication is no longer needed
Parameters¶
Name |
Type |
Description |
---|---|---|
|
|
The interface number from [UsbInterface] |
Returns¶
Promise
<void
>
transferIn¶
transferIn(endpointNumber
, length
, timeout
): Promise
<UsbTransferResult
>
Perform a bulk transfer - IN direction (data read)
Parameters¶
Name |
Type |
Description |
---|---|---|
|
|
The endpoint number to be targeted |
|
|
The transfer length |
|
|
The timeout in milliseconds |
Returns¶
Promise
<UsbTransferResult
>
transferOut¶
transferOut(endpointNumber
, data
, timeout
): Promise
<UsbTransferResult
>
Perform a bulk transfer - OUT direction (data write)
Parameters¶
Name |
Type |
Description |
---|---|---|
|
|
The endpoint number to be targeted |
|
|
The data bytes to be written |
|
|
The timeout in milliseconds |
Returns¶
Promise
<UsbTransferResult
>