Class: UsbDeviceVS¶
api/hardware/framework/vs/EvamUsbManagerVS.UsbDeviceVS
Usb device accessible from the Evam platform
Implements¶
Constructors¶
constructor¶
new UsbDeviceVS(android, serialNumber, productId, productName, vendorId, version, classCode, subclassCode, protocolCode)
Parameters¶
Name |
Type |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
classCode¶
Readonly classCode: number
Device class code
Implementation of¶
productId¶
Readonly productId: number
Device product ID
Implementation of¶
productName¶
Readonly productName: string
Device product name
Implementation of¶
protocolCode¶
Readonly protocolCode: number
Device protocol code
Implementation of¶
serialNumber¶
Readonly serialNumber: string
Device serial number
Implementation of¶
subclassCode¶
Readonly subclassCode: number
Device sub class code
Implementation of¶
vendorId¶
Readonly vendorId: number
Device vendor ID
Implementation of¶
version¶
Readonly version: string
Device USB version as “major.minor.sub-minor”
Implementation of¶
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>
Implementation of¶
close¶
close(): Promise<void>
Close a device once it is no longer needed
Returns¶
Promise<void>
Implementation of¶
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>
Implementation of¶
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>
Implementation of¶
forget¶
forget(): Promise<void>
Release the authorization for this device, access will have to be requested again.
Returns¶
Promise<void>
Implementation of¶
getInterfaces¶
getInterfaces(): UsbInterface[]
Get the interfaces this device has
Returns¶
Implementation of¶
open¶
open(): Promise<void>
Open the device for communication
Returns¶
Promise<void>
Implementation of¶
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>
Implementation of¶
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>
Implementation of¶
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>