Merge pull request #230 from hybridgroup/change/pass-adaptor-to-driver-instances

Add direct Adaptor access inside Drivers
This commit is contained in:
Ron Evans 2014-09-23 15:25:59 -07:00
commit 8d6bb1ba71
2 changed files with 5 additions and 0 deletions

View File

@ -26,6 +26,7 @@ var Driver = module.exports = function Driver(opts) {
this.name = opts.name;
this.device = opts.device;
this.connection = this.device.connection;
this.adaptor = this.connection.adaptor;
this.interval = extraParams.interval || 10;
this.commands = {};

View File

@ -34,6 +34,10 @@ describe("Driver", function() {
expect(driver.connection).to.be.eql(device.connection);
});
it("sets @connection to the device's connection adaptor", function() {
expect(driver.adaptor).to.be.eql(device.connection.adaptor);
});
it("sets @commands to an empty object by default", function() {
expect(driver.commands).to.be.eql({});
});