diff --git a/src/robot.coffee b/src/robot.coffee index 2e5bdf1..25da3df 100644 --- a/src/robot.coffee +++ b/src/robot.coffee @@ -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..."