diff --git a/src/cylon.coffee b/src/cylon.coffee index e9166c4..28232f4 100644 --- a/src/cylon.coffee +++ b/src/cylon.coffee @@ -11,5 +11,6 @@ Robot = require("./robot") utils = require('./utils') -exports.robot = (opts) -> +exports.robot = (opts = {}) -> + opts.master = this new Robot(opts) diff --git a/src/device.coffee b/src/device.coffee index 5b2ccd7..f80d814 100644 --- a/src/device.coffee +++ b/src/device.coffee @@ -26,3 +26,5 @@ module.exports = class Device requireDriver: (driverName) -> console.log "dynamic load driver" + self = this + #new require("cylon-#{driverName}")(device: self) diff --git a/src/robot.coffee b/src/robot.coffee index 07b44a9..c3d5fa7 100644 --- a/src/robot.coffee +++ b/src/robot.coffee @@ -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")