Skip to content

Commit

Permalink
fix(bacnet-client): use decodeCOVNotify for COV handling
Browse files Browse the repository at this point in the history
Closes issue #69
  • Loading branch information
Klemensas authored and fh1ch committed Dec 11, 2017
1 parent 1280270 commit 967f154
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/bacnet-client.js
Expand Up @@ -175,9 +175,9 @@ module.exports = function(options) {
if (!result) return debug('Received invalid writePropertyMultiple message');
self.emit('writePropertyMultiple', {address: address, invokeId: invokeId, request: result});
} else if (service === baEnum.BacnetConfirmedServices.SERVICE_CONFIRMED_COV_NOTIFICATION) {
result = baServices.decodeCOVNotifyUnconfirmed(buffer, offset, length);
if (!result) return debug('Received invalid covNotifyUnconfirmed message');
self.emit('covNotifyUnconfirmed', {address: address, invokeId: invokeId, request: result});
result = baServices.decodeCOVNotify(buffer, offset, length);
if (!result) return debug('Received invalid covNotify message');
self.emit('covNotify', {address: address, invokeId: invokeId, request: result});
} else if (service === baEnum.BacnetConfirmedServices.SERVICE_CONFIRMED_ATOMIC_WRITE_FILE) {
result = baServices.decodeAtomicWriteFile(buffer, offset, length);
if (!result) return debug('Received invalid atomicWriteFile message');
Expand Down Expand Up @@ -256,10 +256,9 @@ module.exports = function(options) {
if (!result) return debug('Received invalid WhoHas message');
self.emit('whoHas', {address: address, lowLimit: result.lowLimit, highLimit: result.highLimit, objId: result.objId, objName: result.objName});
} else if (service === baEnum.BacnetUnconfirmedServices.SERVICE_UNCONFIRMED_COV_NOTIFICATION) {
debug('TODO: Implement COVNotify');
//result = baServices.decodeCOVNotifyUnconfirmed(buffer, offset, length);
//if (!result) return debug('Received invalid COVNotify message');
//self.emit('covNotify', address, result.subscriberProcessIdentifier, result.initiatingDeviceIdentifier, result.monitoredObjectIdentifier, result.timeRemaining, result.values);
result = baServices.decodeCOVNotify(buffer, offset, length);
if (!result) return debug('Received invalid covNotifyUnconfirmed message');
self.emit('covNotifyUnconfirmed', {address: address, request: result});
} else if (service === baEnum.BacnetUnconfirmedServices.SERVICE_UNCONFIRMED_TIME_SYNCHRONIZATION) {
result = baServices.decodeTimeSync(buffer, offset, length);
if (!result) return debug('Received invalid TimeSync message');
Expand Down

0 comments on commit 967f154

Please sign in to comment.