Better naming for connection and device types
This commit is contained in:
parent
520035b842
commit
05cc4221aa
|
@ -14,8 +14,8 @@ Device = source("device")
|
||||||
module.exports = class Robot
|
module.exports = class Robot
|
||||||
constructor: (opts) ->
|
constructor: (opts) ->
|
||||||
opts ?= {}
|
opts ?= {}
|
||||||
@_connections = {}
|
@connectionTypes = {}
|
||||||
@_devices = {}
|
@deviceTypes = {}
|
||||||
@name = opts.name or @constructor.randomName()
|
@name = opts.name or @constructor.randomName()
|
||||||
@connections = initConnections(opts.connection or opts.connections or {})
|
@connections = initConnections(opts.connection or opts.connections or {})
|
||||||
@devices = initDevices(opts.device or opts.devices or {})
|
@devices = initDevices(opts.device or opts.devices or {})
|
||||||
|
@ -32,7 +32,7 @@ module.exports = class Robot
|
||||||
|
|
||||||
initConnection = (connection) ->
|
initConnection = (connection) ->
|
||||||
console.log "Initializing connection '#{ connection.name }'..."
|
console.log "Initializing connection '#{ connection.name }'..."
|
||||||
@_connections[connection.name] = new Connection(connection)
|
@connectionTypes[connection.name] = new Connection(connection)
|
||||||
|
|
||||||
initDevices = (devices) ->
|
initDevices = (devices) ->
|
||||||
console.log "Initializing devices..."
|
console.log "Initializing devices..."
|
||||||
|
@ -40,7 +40,7 @@ module.exports = class Robot
|
||||||
|
|
||||||
initDevice = (device) ->
|
initDevice = (device) ->
|
||||||
console.log "Initializing device '#{ device.name }'..."
|
console.log "Initializing device '#{ device.name }'..."
|
||||||
@_devices[device.name] = new Device(device)
|
@deviceTypes[device.name] = new Device(device)
|
||||||
|
|
||||||
startConnections = ->
|
startConnections = ->
|
||||||
console.log "Starting connections..."
|
console.log "Starting connections..."
|
||||||
|
|
Loading…
Reference in New Issue