DeviceManager

DeviceManager

To manager connected devices

Constructor

new DeviceManager(config)

Source:

To create an instance of DeviceManager

Parameters:
Name Type Description
config Configuration

The configuration object

Members

bridges

Source:

Supported bridges TODO : add sdb

count

Source:

Total amount of connected devices

defaultDevice

Source:

deffault device to use

devFile

Source:

Path of the file where device are stored

devices

Source:

List of connected devices

status

Source:

Methods

clear()

Source:

Remove all device saved or previously enrolled

disconnectAll()

Source:

To turn all device tagged "connected" to "disconnected"

(async) enroll(pDevice, pOtions)

Source:

To enroll a new device or an updated device

Parameters:
Name Type Description
pDevice *
pOtions *

getAll() → {Object}

Source:

To get all devices (connected or not)

Returns:

To get an hashmap associtating to each device ID the device instance

Type
Object

getBridgeFactory(pName)

Source:
Since:
  • v0.7.2
Parameters:
Name Type Description
pName String

Bridge name

getConnectedDevices() → {Array.<Device>}

Source:

To get a list of connected devices

Returns:

Array of device

Type
Array.<Device>

getDefault() → {Device}

Source:

To get the default device

Returns:

Default device

Type
Device

getDevice(deviceId) → {Device}

Source:

To get a device by its deviceID

Parameters:
Name Type Description
deviceId String

Device ID

Returns:

The Device instance, else null

Type
Device

hasNotDefault() → {Boolean}

Source:

To check if a device is connected, but there is not default device selected.

Returns:

Return TRUE if a device is connected and if there is not default device selected.

Type
Boolean

load()

Source:

To load Devices properties from .dxc/dev/devices.json file

save()

Source:

To save properties of devices into .dxc/dev/devices.json file

(async) scan()

Source:

To detect connected devices from each bridges and update device list

setDefault(deviceId)

Source:

To select a default device

Parameters:
Name Type Description
deviceId String

toJsonObject() → {String}

Source:

To export data to JSON

Returns:

JSON payload

Type
String

updateDeviceList(pDeviceList)

Source:

To merge a given device list with cuurent list

Parameters:
Name Type Description
pDeviceList *