Starting to build the object chain

This commit is contained in:
deadprogram 2013-10-22 13:30:16 -07:00
parent af4636598a
commit 2e74b8bdef
3 changed files with 5 additions and 1 deletions

View File

@ -11,5 +11,6 @@
Robot = require("./robot")
utils = require('./utils')
exports.robot = (opts) ->
exports.robot = (opts = {}) ->
opts.master = this
new Robot(opts)

View File

@ -26,3 +26,5 @@ module.exports = class Device
requireDriver: (driverName) ->
console.log "dynamic load driver"
self = this
#new require("cylon-#{driverName}")(device: self)

View File

@ -17,6 +17,7 @@ module.exports = class Robot
constructor: (opts = {}) ->
@name = opts.name or @constructor.randomName()
@master = opts.master
@connections = initConnections(opts.connection or opts.connections or {})
@devices = initDevices(opts.device or opts.devices or {})
@work = opts.work or -> (console.log "No work yet")