Starting to build the object chain
This commit is contained in:
parent
af4636598a
commit
2e74b8bdef
|
@ -11,5 +11,6 @@
|
|||
Robot = require("./robot")
|
||||
utils = require('./utils')
|
||||
|
||||
exports.robot = (opts) ->
|
||||
exports.robot = (opts = {}) ->
|
||||
opts.master = this
|
||||
new Robot(opts)
|
||||
|
|
|
@ -26,3 +26,5 @@ module.exports = class Device
|
|||
|
||||
requireDriver: (driverName) ->
|
||||
console.log "dynamic load driver"
|
||||
self = this
|
||||
#new require("cylon-#{driverName}")(device: self)
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue