new DeviceManager(controllerType, controllerName, opts)
- Source:
- Implements:
Example
// Create a device manager instance for managing ARSDK devices
const manager = new DeviceManager('js-arsdk', os.hostname())
// Connect to 'connected' signal.
manager.on('connected', (device) => {
device.on('navdata', mesg => {
console.info('RX:', JSON.stringify(mesg))
})
})
// Connects to drone via an already paired SkyController
manager.attach(new NetworkConnector('192.168.53.1', 44444))
Parameters:
Name |
Type |
Description |
controllerType |
string
|
|
controllerName |
string
|
|
opts |
Object
|
|
Methods
attach(connector, optsopt) → {Promise}
- Source:
- Implements:
Attach a device protocol connector to this manager for managing
device connectivity.
Parameters:
Name |
Type |
Attributes |
Description |
connector |
ConnectorInterface
|
|
|
opts |
Object
|
<optional>
|
Properties
Name |
Type |
Attributes |
Default |
Description |
autoconnect |
boolean
|
<optional>
|
true
|
Automatically connect |
reconnect |
boolean
|
<optional>
|
true
|
Enable/Disable auto-reconnects |
|
Returns:
-
Type
-
Promise
- Source:
- Implements:
Parameters:
Name |
Type |
Description |
uid |
string
|
|
Returns:
-
Type
-
MessageChannel
detach(uid, optsopt) → {Promise}
- Source:
- Implements:
Detach a device protocol connector from this manager and disconnect from the
device if it's connected.
Parameters:
Name |
Type |
Attributes |
Description |
uid |
string
|
|
|
opts |
Object
|
<optional>
|
Properties
Name |
Type |
Attributes |
Default |
Description |
disconnect |
boolean
|
<optional>
|
true
|
|
|
Returns:
-
Type
-
Promise
disconnect(uid) → {boolean}
- Source:
- Implements:
Parameters:
Name |
Type |
Description |
uid |
string
|
|
Returns:
-
Type
-
boolean
Events
connected
- Source:
- Implements:
Properties:
Name |
Type |
Description |
uid |
string
|
|
device |
Device
|
|
Emitted when a device has connected.