Start to connect
This commit is contained in:
parent
d7cc0c3730
commit
54f657e76a
|
@ -8,15 +8,22 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
Connection = source("connection")
|
||||||
|
|
||||||
module.exports = class Robot
|
module.exports = class Robot
|
||||||
constructor: (opts) ->
|
constructor: (opts) ->
|
||||||
@name = opts.name
|
@name = opts.name
|
||||||
@connections = initConnections(opts.connection or opts.connections)
|
@connections = initConnections(opts.connection or opts.connections or {})
|
||||||
@devices = initDevices(opts.device or opts.devices)
|
@devices = initDevices(opts.device or opts.devices)
|
||||||
@work = opts.work or -> (console.log "No work yet")
|
@work = opts.work or -> (console.log "No work yet")
|
||||||
|
|
||||||
initConnections = (connections) ->
|
initConnections = (connections) ->
|
||||||
console.log "Initialing connections..."
|
console.log "Initialing connections..."
|
||||||
|
initConnection connection for connection in connections
|
||||||
|
|
||||||
|
initConnection = (connection) ->
|
||||||
|
console.log "Initialing connection '" + connection.name + "'..."
|
||||||
|
@_connections[connection.name] = new Connection(connection)
|
||||||
|
|
||||||
initDevices = (devices) ->
|
initDevices = (devices) ->
|
||||||
console.log "Initialing devices..."
|
console.log "Initialing devices..."
|
||||||
|
|
Loading…
Reference in New Issue