Start to connect

This commit is contained in:
deadprogram 2013-10-19 23:54:49 -07:00
parent d7cc0c3730
commit 54f657e76a
1 changed files with 8 additions and 1 deletions

View File

@ -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..."