From 38bf5fdfedd39617b79430677d69c8def21c28b9 Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Fri, 14 Nov 2014 10:56:45 -0800 Subject: [PATCH] Refer to Adaptor instances as 'Connection' --- lib/basestar.js | 6 +++--- lib/driver.js | 4 ++-- lib/robot.js | 4 ++-- spec/lib/basestar.spec.js | 2 +- spec/lib/driver.spec.js | 14 +++++++------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/basestar.js b/lib/basestar.js index 6d8f83f..c25dceb 100644 --- a/lib/basestar.js +++ b/lib/basestar.js @@ -78,14 +78,14 @@ Basestar.prototype.defineAdaptorEvent = function(opts) { return this._proxyEvents(opts, this.connector, this); }; -// Public: Creates an event handler that proxies events from an driver's -// adaptor to the driver +// Public: Creates an event handler that proxies events from a driver's +// connection to the driver // // opts - hash of opts to be passed to defineEvent() // // Returns this.connection Basestar.prototype.defineDriverEvent = function(opts) { - return this._proxyEvents(opts, this.adaptor, this); + return this._proxyEvents(opts, this.connection, this); }; Basestar.prototype._proxyEvents = function(opts, source, target) { diff --git a/lib/driver.js b/lib/driver.js index 615df9d..bea5261 100644 --- a/lib/driver.js +++ b/lib/driver.js @@ -25,7 +25,7 @@ var Driver = module.exports = function Driver(opts) { this.name = opts.name; this.robot = opts.robot - this.adaptor = opts.adaptor + this.connection = opts.connection; this.commands = {}; @@ -72,7 +72,7 @@ Driver.prototype.toJSON = function() { return { name: this.name, driver: this.constructor.name || this.name, - connection: this.adaptor.name, + connection: this.connection.name, commands: Object.keys(this.commands), details: this.details }; diff --git a/lib/robot.js b/lib/robot.js index 193fed4..6365754 100644 --- a/lib/robot.js +++ b/lib/robot.js @@ -229,10 +229,10 @@ Robot.prototype.initDevices = function(opts) { process.emit('SIGINT'); } - device.adaptor = this.connections[device.connection]; + device.connection = this.connections[device.connection]; } else { for (var conn in this.connections) { - device.adaptor = this.connections[conn]; + device.connection = this.connections[conn]; break; } } diff --git a/spec/lib/basestar.spec.js b/spec/lib/basestar.spec.js index a2cb4cd..35dcda6 100644 --- a/spec/lib/basestar.spec.js +++ b/spec/lib/basestar.spec.js @@ -137,7 +137,7 @@ describe('Basestar', function() { beforeEach(function() { basestar = new Basestar(); - basestar.adaptor = new EventEmitter(); + basestar.connection = new EventEmitter(); }); it("proxies events between the connection and device", function() { diff --git a/spec/lib/driver.spec.js b/spec/lib/driver.spec.js index 3eaa0c3..b78e1da 100644 --- a/spec/lib/driver.spec.js +++ b/spec/lib/driver.spec.js @@ -7,16 +7,16 @@ var Driver = source("driver"), Utils = source('utils'); describe("Driver", function() { - var adaptor, device, driver; + var connection, device, driver; beforeEach(function() { - adaptor = { - adaptor: 'adaptor' + connection = { + connection: 'connection' }; driver = new Driver({ name: 'driver', - adaptor: adaptor, + connection: connection, }); }); @@ -25,8 +25,8 @@ describe("Driver", function() { expect(driver.name).to.be.eql('driver'); }); - it("sets @adaptor to the provided adaptor", function() { - expect(driver.adaptor).to.be.eql(adaptor); + it("sets @connection to the provided connection", function() { + expect(driver.connection).to.be.eql(connection); }); it("sets @commands to an empty object by default", function() { @@ -38,7 +38,7 @@ describe("Driver", function() { driver = new Driver({ name: 'driver', - adaptor: adaptor, + connection: connection, interval: 2000, });