Skip to content

Commit

Permalink
refactor(bacnet-client): implement options parameter to client functions
Browse files Browse the repository at this point in the history
BREAKING CHANGE: various function parameters changed. Adapt according latest documentation.
  • Loading branch information
fh1ch committed Dec 24, 2017
1 parent 28d4844 commit 12f27ef
Show file tree
Hide file tree
Showing 6 changed files with 237 additions and 121 deletions.
342 changes: 225 additions & 117 deletions lib/bacnet-client.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions lib/bacnet-enum.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,10 @@ module.exports.BacnetReliability = {
RELIABILITY_TRIPPED: 13
};

/**
* @readonly
* @enum {BacnetMaxSegments}
*/
module.exports.BacnetMaxSegments = {
MAX_SEG0: 0,
MAX_SEG2: 0x10,
Expand All @@ -654,6 +658,10 @@ module.exports.BacnetMaxSegments = {
MAX_SEG65: 0x70
};

/**
* @readonly
* @enum {BacnetMaxAdpu}
*/
module.exports.BacnetMaxAdpu = {
MAX_APDU50: 0,
MAX_APDU128: 1,
Expand Down
2 changes: 1 addition & 1 deletion test/integration/device-communication-control.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var utils = require('./utils');
describe('bacstack - deviceCommunicationControl integration', function() {
it('should return a timeout error if no device is available', function(next) {
var client = new utils.bacnetClient({adpuTimeout: 200});
client.deviceCommunicationControl('127.0.0.1', 60, 1, 'Test1234', function(err, value) {
client.deviceCommunicationControl('127.0.0.1', 60, 1, {password: 'Test1234'}, function(err, value) {
expect(err.message).to.eql('ERR_TIMEOUT');
expect(value).to.eql(undefined);
client.close();
Expand Down
2 changes: 1 addition & 1 deletion test/integration/read-property.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var utils = require('./utils');
describe('bacstack - readProperty integration', function() {
it('should return a timeout error if no device is available', function(next) {
var client = new utils.bacnetClient({adpuTimeout: 200});
client.readProperty('127.0.0.1', 8, 44301, 28, null, function(err, value) {
client.readProperty('127.0.0.1', 8, 44301, 28, function(err, value) {
expect(err.message).to.eql('ERR_TIMEOUT');
expect(value).to.eql(undefined);
client.close();
Expand Down
2 changes: 1 addition & 1 deletion test/integration/reinitialize-sevice.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var utils = require('./utils');
describe('bacstack - reinitializeDevice integration', function() {
it('should return a timeout error if no device is available', function(next) {
var client = new utils.bacnetClient({adpuTimeout: 200});
client.reinitializeDevice('127.0.0.1', 1, 'Test1234', function(err, value) {
client.reinitializeDevice('127.0.0.1', 1, {password: 'Test1234'}, function(err, value) {
expect(err.message).to.eql('ERR_TIMEOUT');
expect(value).to.eql(undefined);
client.close();
Expand Down
2 changes: 1 addition & 1 deletion test/integration/write-property.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var utils = require('./utils');
describe('bacstack - writeProperty integration', function() {
it('should return a timeout error if no device is available', function(next) {
var client = new utils.bacnetClient({adpuTimeout: 200});
client.writeProperty('127.0.0.1', 8, 44301, 28, 12, [{type: 4, value: 100}], function(err, value) {
client.writeProperty('127.0.0.1', 8, 44301, 28, [{type: 4, value: 100}], function(err, value) {
expect(err.message).to.eql('ERR_TIMEOUT');
expect(value).to.eql(undefined);
client.close();
Expand Down

0 comments on commit 12f27ef

Please sign in to comment.