ConnectionHandler

ConnectionHandler - Base class for implementing different connection methods

Constructor

new ConnectionHandler()

Classes

ConnectionHandler

Methods

(async) connect(options) → {Promise.<boolean>}

Connect to a device

Parameters:
NameTypeDescription
optionsObject

Connection options

Returns:
  • Whether connection was successful
Type: 
Promise.<boolean>

(async) disconnect() → {Promise.<void>}

Disconnect from the device

Returns:
Type: 
Promise.<void>

getDeviceInfo() → {Object}

Get information about the connected device

Returns:
  • Device information
Type: 
Object

getPriority(options) → {number}

Get priority level for this connection method

Parameters:
NameTypeDescription
optionsObject

Connection options that may affect priority

Returns:
  • Priority level (higher = try first)
Type: 
number

isAvailable() → {boolean}

Check if this connection method is available

Returns:
  • Whether this method is available
Type: 
boolean

(async) sendData(data) → {Promise.<boolean>}

Send data to the device

Parameters:
NameTypeDescription
datastring | ArrayBuffer

Data to send

Returns:
  • Whether data was sent successfully
Type: 
Promise.<boolean>