Start to connect
This commit is contained in:
parent
d7cc0c3730
commit
54f657e76a
|
@ -8,15 +8,22 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
Connection = source("connection")
|
||||
|
||||
module.exports = class Robot
|
||||
constructor: (opts) ->
|
||||
@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)
|
||||
@work = opts.work or -> (console.log "No work yet")
|
||||
|
||||
initConnections = (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) ->
|
||||
console.log "Initialing devices..."
|
||||
|
|
Loading…
Reference in New Issue