Removing DriverName param in favor of opts, which already contains it.

This commit is contained in:
Edgar O Silva 2013-10-29 18:15:41 -06:00
parent 2e0d0423bb
commit cf6d2c88bc
2 changed files with 8 additions and 8 deletions

8
dist/device.js vendored
View File

@ -35,7 +35,7 @@
this.name = opts.name; this.name = opts.name;
this.pin = opts.pin; this.pin = opts.pin;
this.connection = this.determineConnection(opts.connection) || this.defaultConnection(); this.connection = this.determineConnection(opts.connection) || this.defaultConnection();
this.driver = this.requireDriver(opts.driver, opts); this.driver = this.requireDriver(opts);
proxyFunctionsToObject(this.driver.commands(), this.driver, klass); proxyFunctionsToObject(this.driver.commands(), this.driver, klass);
} }
@ -66,12 +66,12 @@
return first; return first;
}; };
Device.prototype.requireDriver = function(driverName, opts) { Device.prototype.requireDriver = function(opts) {
if (opts == null) { if (opts == null) {
opts = {}; opts = {};
} }
Logger.debug("Loading driver '" + driverName + "'"); Logger.debug("Loading driver '" + opts.driver + "'");
return this.robot.requireDriver(driverName, this.self, opts); return this.robot.requireDriver(opts.driver, this.self, opts);
}; };
return Device; return Device;

View File

@ -20,7 +20,7 @@ module.exports = class Device extends EventEmitter
@name = opts.name @name = opts.name
@pin = opts.pin @pin = opts.pin
@connection = @determineConnection(opts.connection) or @defaultConnection() @connection = @determineConnection(opts.connection) or @defaultConnection()
@driver = @requireDriver(opts.driver, opts) @driver = @requireDriver(opts)
proxyFunctionsToObject @driver.commands(), @driver, klass proxyFunctionsToObject @driver.commands(), @driver, klass
start: (callback) => start: (callback) =>
@ -38,6 +38,6 @@ module.exports = class Device extends EventEmitter
first or= v first or= v
first first
requireDriver: (driverName, opts = {}) -> requireDriver: (opts = {}) ->
Logger.debug "Loading driver '#{driverName}'" Logger.debug "Loading driver '#{ opts.driver }'"
@robot.requireDriver(driverName, @self, opts) @robot.requireDriver(opts.driver, @self, opts)