Add direct Adaptor access inside Drivers

This commit is contained in:
Andrew Stewart 2014-09-23 11:57:35 -07:00
parent 6fa67f0e3b
commit 90cf0eed0a
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({});
});