Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(client): implement missing un/confirmed event handler
- Loading branch information
Showing
7 changed files
with
229 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use strict'; | ||
|
||
const expect = require('chai').expect; | ||
const utils = require('./utils'); | ||
|
||
describe('bacstack - confirmedEventNotification integration', () => { | ||
it('should return a timeout error if no device is available', (next) => { | ||
const client = new utils.bacnetClient({adpuTimeout: 200}); | ||
const date = new Date(); | ||
date.setMilliseconds(880); | ||
client.confirmedEventNotification('127.0.0.1', { | ||
processId: 3, | ||
initiatingObjectId: {}, | ||
eventObjectId: {}, | ||
timeStamp: {type: 2, value: date}, | ||
notificationClass: 9, | ||
priority: 7, | ||
eventType: 2, | ||
messageText: 'Test1234$', | ||
notifyType: 1, | ||
changeOfValueTag: 1, | ||
changeOfValueChangeValue: 90, | ||
changeOfValueStatusFlags: {bitsUsed: 24, value: [0xaa, 0xaa, 0xaa]} | ||
}, (err, value) => { | ||
expect(err.message).to.eql('ERR_TIMEOUT'); | ||
expect(value).to.eql(undefined); | ||
client.close(); | ||
next(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
const expect = require('chai').expect; | ||
const utils = require('./utils'); | ||
|
||
describe('bacstack - confirmedPrivateTransfer integration', () => { | ||
it('should return a timeout error if no device is available', (next) => { | ||
const client = new utils.bacnetClient({adpuTimeout: 200}); | ||
client.confirmedPrivateTransfer('127.0.0.1', 0, 8, [0x00, 0xaa, 0xfa, 0xb1, 0x00], (err, value) => { | ||
expect(err.message).to.eql('ERR_TIMEOUT'); | ||
expect(value).to.eql(undefined); | ||
client.close(); | ||
next(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
const expect = require('chai').expect; | ||
const utils = require('./utils'); | ||
|
||
describe('bacstack - getEnrollmentSummary integration', () => { | ||
it('should return a timeout error if no device is available', (next) => { | ||
const client = new utils.bacnetClient({adpuTimeout: 200}); | ||
client.getEnrollmentSummary('127.0.0.1', 0, {notificationClassFilter: 5}, (err, value) => { | ||
expect(err.message).to.eql('ERR_TIMEOUT'); | ||
expect(value).to.eql(undefined); | ||
client.close(); | ||
next(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
const expect = require('chai').expect; | ||
const utils = require('./utils'); | ||
|
||
describe('bacstack - unconfirmedEventNotification integration', () => { | ||
it('should correctly send a telegram', () => { | ||
const client = new utils.bacnetClient({adpuTimeout: 200}); | ||
const date = new Date(); | ||
date.setMilliseconds(880); | ||
client.unconfirmedEventNotification('127.0.0.1', { | ||
processId: 3, | ||
initiatingObjectId: {type: 60, instance: 12}, | ||
eventObjectId: {type: 61, instance: 1121}, | ||
timeStamp: {type: 2, value: date}, | ||
notificationClass: 9, | ||
priority: 7, | ||
eventType: 0, | ||
messageText: 'Test1234$', | ||
notifyType: 1, | ||
ackRequired: true, | ||
fromState: 5, | ||
toState: 6, | ||
changeOfBitstringReferencedBitString: {bitsUsed: 24, value: [0xaa, 0xaa, 0xaa]}, | ||
changeOfBitstringStatusFlags: {bitsUsed: 24, value: [0xaa, 0xaa, 0xaa]} | ||
}); | ||
client.close(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
|
||
const expect = require('chai').expect; | ||
const utils = require('./utils'); | ||
|
||
describe('bacstack - unconfirmedPrivateTransfer integration', () => { | ||
it('should correctly send a telegram', () => { | ||
const client = new utils.bacnetClient({adpuTimeout: 200}); | ||
client.unconfirmedPrivateTransfer('127.0.0.1', 0, 7, [0x00, 0xaa, 0xfa, 0xb1, 0x00]); | ||
client.close(); | ||
}); | ||
}); |