WIP on device
This commit is contained in:
parent
f2e90634c5
commit
af4636598a
|
@ -9,10 +9,20 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = class Device
|
||||
constructor: (opts) ->
|
||||
constructor: (opts = {}) ->
|
||||
@parent = opts.parent
|
||||
@name = opts.name
|
||||
@driver = opts.driver
|
||||
@connection = @determineConnection(opts.connection) or @defaultConnection
|
||||
@driver = @requireDriver(opts.driver)
|
||||
|
||||
start: ->
|
||||
console.log "started"
|
||||
|
||||
determineConnection: (c) ->
|
||||
@parent.connections(c) if c
|
||||
|
||||
defaultConnection: ->
|
||||
@parent.connections.first
|
||||
|
||||
requireDriver: (driverName) ->
|
||||
console.log "dynamic load driver"
|
||||
|
|
|
@ -8,7 +8,5 @@ describe "devices", ->
|
|||
it "should have a name", ->
|
||||
device.name.should.be.equal 'devisive'
|
||||
|
||||
it "should have an driver", ->
|
||||
device.driver.should.be.equal 'driving'
|
||||
|
||||
it "should be able to require an external driver module"
|
||||
it "should have a connection"
|
||||
it "should have an driver"
|
||||
|
|
Loading…
Reference in New Issue