From ed50c385c4eb424d0a2cb116e972b539078bf247 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Sun, 15 Dec 2013 19:28:12 -0800 Subject: [PATCH] Removing extraneous things from Adaptor/Driver --- dist/driver.js | 1 + dist/test/loopback.js | 6 ++++-- dist/test/ping.js | 6 ++++-- src/driver.coffee | 1 + src/test/loopback.coffee | 3 --- src/test/ping.coffee | 3 --- test/dist/specs/device.spec.js | 6 +++++- test/src/specs/device.spec.coffee | 2 +- 8 files changed, 16 insertions(+), 12 deletions(-) diff --git a/dist/driver.js b/dist/driver.js index cf668b0..ab292d1 100644 --- a/dist/driver.js +++ b/dist/driver.js @@ -28,6 +28,7 @@ this.self = this; this.name = opts.name; this.device = opts.device; + this.connection = this.device.connection; } Driver.prototype.start = function(callback) { diff --git a/dist/test/loopback.js b/dist/test/loopback.js index c73acb7..5da27e2 100644 --- a/dist/test/loopback.js +++ b/dist/test/loopback.js @@ -29,11 +29,13 @@ }; namespace('Cylon.Adaptors', function() { + var _ref; return this.Loopback = (function(_super) { __extends(Loopback, _super); - function Loopback(opts) { - Loopback.__super__.constructor.apply(this, arguments); + function Loopback() { + _ref = Loopback.__super__.constructor.apply(this, arguments); + return _ref; } Loopback.prototype.commands = function() { diff --git a/dist/test/ping.js b/dist/test/ping.js index c3ae9f7..61e5d9e 100644 --- a/dist/test/ping.js +++ b/dist/test/ping.js @@ -29,11 +29,13 @@ }; namespace('Cylon.Drivers', function() { + var _ref; return this.Ping = (function(_super) { __extends(Ping, _super); - function Ping(opts) { - Ping.__super__.constructor.apply(this, arguments); + function Ping() { + _ref = Ping.__super__.constructor.apply(this, arguments); + return _ref; } Ping.prototype.commands = function() { diff --git a/src/driver.coffee b/src/driver.coffee index 8eb710a..d0481b7 100644 --- a/src/driver.coffee +++ b/src/driver.coffee @@ -18,6 +18,7 @@ namespace 'Cylon.Drivers', -> @self = this @name = opts.name @device = opts.device + @connection = @device.connection start: (callback) -> Logger.info "Driver #{@name} started" diff --git a/src/test/loopback.coffee b/src/test/loopback.coffee index bec7730..b8bc7fa 100644 --- a/src/test/loopback.coffee +++ b/src/test/loopback.coffee @@ -16,8 +16,5 @@ module.exports = namespace 'Cylon.Adaptors', -> class @Loopback extends Cylon.Adaptors.Adaptor - constructor: (opts) -> - super - commands: -> ['ping'] diff --git a/src/test/ping.coffee b/src/test/ping.coffee index 21e483b..66d70f3 100644 --- a/src/test/ping.coffee +++ b/src/test/ping.coffee @@ -16,9 +16,6 @@ module.exports = namespace 'Cylon.Drivers', -> class @Ping extends Cylon.Drivers.Driver - constructor: (opts) -> - super - commands: -> ['ping'] diff --git a/test/dist/specs/device.spec.js b/test/dist/specs/device.spec.js index 71ac8bc..cc13036 100644 --- a/test/dist/specs/device.spec.js +++ b/test/dist/specs/device.spec.js @@ -14,7 +14,11 @@ name: 'me' }); driver = new Cylon.Drivers.Ping({ - name: 'driving' + name: 'driving', + device: { + connection: 'connect', + pin: 13 + } }); initDriver = sinon.stub(robot, 'initDriver').returns(driver); device = new Cylon.Device({ diff --git a/test/src/specs/device.spec.coffee b/test/src/specs/device.spec.coffee index 34f9fee..a89024a 100644 --- a/test/src/specs/device.spec.coffee +++ b/test/src/specs/device.spec.coffee @@ -7,7 +7,7 @@ source "test/ping" describe "Device", -> robot = new Cylon.Robot(name: 'me') - driver = new Cylon.Drivers.Ping(name: 'driving') + driver = new Cylon.Drivers.Ping(name: 'driving', device: {connection: 'connect', pin: 13}) initDriver = sinon.stub(robot, 'initDriver').returns(driver) device = new Cylon.Device(name: "devisive", driver: 'driving', robot: robot)