WIP on device

This commit is contained in:
deadprogram 2013-10-22 13:13:55 -07:00
parent f2e90634c5
commit af4636598a
2 changed files with 15 additions and 7 deletions

View File

@ -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"

View File

@ -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"