Class: EvamUsbManagerDev

api/hardware/framework/dev/EvamUsbManagerDev.EvamUsbManagerDev

Usb manager class for the Evam platform, contains general USB device management APIs.

Implements

Constructors

constructor

new EvamUsbManagerDev(usb)

Parameters

Name

Type

usb

USB

Methods

getDeviceList

getDeviceList(): Promise<UsbDevice[]>

Gets the list of devices the application is allowed (authorized) to communicate with.

Returns

Promise<UsbDevice[]>

UsbDevice[] List of accessible devices

Implementation of

UsbManager.getDeviceList


hasPermission

hasPermission(device): Promise<boolean>

Checks if a specific device can be accessed from this application

Parameters

Name

Type

Description

device

UsbDevice

The target USB device

Returns

Promise<boolean>

boolean true if application is authorized, false otherwise

Implementation of

UsbManager.hasPermission


openDevice

openDevice(device): Promise<void>

Opens a specific device

Parameters

Name

Type

Description

device

UsbDevice

Device to be opened for communication

Returns

Promise<void>

Implementation of

UsbManager.openDevice


requestPermission

requestPermission(filters, callback): Promise<void>

Requests the permission to access a specific device selected from a list of filters. Will cause a system pop-up to be shown to the end user for the device selection.

Parameters

Name

Type

Description

filters

UsbDeviceFilter[]

List of filters for the USB device to be requested

callback

(device: UsbDevice, message: string) => void

Function to be run when the end user has granted permission to a device. Provides the device and a result message.

Returns

Promise<void>

Implementation of

UsbManager.requestPermission