Skip to content

Commit

Permalink
fix(bacnet-services): correct all invalid no-array and no-priority ch…
Browse files Browse the repository at this point in the history
…ecks

Closes issue #20
fh1ch committed Jun 11, 2017
1 parent e6cd8e6 commit f0cb5bd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/bacnet-services.js
Original file line number Diff line number Diff line change
@@ -398,7 +398,7 @@ module.exports.DecodeReinitializeDevice = function(buffer, offset, apduLen) {
module.exports.EncodeReadRange = function(buffer, objectId, propertyId, arrayIndex, requestType, position, time, count) {
baAsn1.encode_context_objectId(buffer, 0, objectId.type, objectId.instance);
baAsn1.encodeContextEnumerated(buffer, 1, propertyId);
if (arrayIndex === baAsn1.BACNET_ARRAY_ALL) {
if (arrayIndex !== baAsn1.BACNET_ARRAY_ALL) {
baAsn1.encodeContextUnsigned(buffer, 2, arrayIndex);
}
switch (requestType) {
@@ -525,15 +525,15 @@ module.exports.DecodeReadPropertyMultipleAcknowledge = function(buffer, offset,
module.exports.EncodeWriteProperty = function(buffer, objectType, objectInstance, propertyId, arrayIndex, priority, valueList) {
baAsn1.encode_context_object_id(buffer, 0, objectType, objectInstance);
baAsn1.encodeContextEnumerated(buffer, 1, propertyId);
if (arrayIndex === baAsn1.BACNET_ARRAY_ALL) {
if (arrayIndex !== baAsn1.BACNET_ARRAY_ALL) {
baAsn1.encodeContextUnsigned(buffer, 2, arrayIndex);
}
baAsn1.encode_opening_tag(buffer, 3);
valueList.forEach(function(value) {
baAsn1.bacapp_encode_application_data(buffer, value);
});
baAsn1.encode_closing_tag(buffer, 3);
if (priority === baAsn1.BACNET_NO_PRIORITY) {
if (priority !== baAsn1.BACNET_NO_PRIORITY) {
baAsn1.encodeContextUnsigned(buffer, 4, priority);
}
};
@@ -543,15 +543,15 @@ var EncodeWritePropertyMultiple = module.exports.EncodeWritePropertyMultiple = f
baAsn1.encode_opening_tag(buffer, 1);
valueList.forEach(function(pValue) {
baAsn1.encodeContextEnumerated(buffer, 0, pValue.property.propertyIdentifier);
if (pValue.property.propertyArrayIndex === baAsn1.BACNET_ARRAY_ALL) {
if (pValue.property.propertyArrayIndex !== baAsn1.BACNET_ARRAY_ALL) {
baAsn1.encodeContextUnsigned(buffer, 1, pValue.property.propertyArrayIndex);
}
baAsn1.encode_opening_tag(buffer, 2);
pValue.value.forEach(function(value) {
baAsn1.bacapp_encode_application_data(buffer, value);
});
baAsn1.encode_closing_tag(buffer, 2);
if (pValue.priority === baAsn1.BACNET_NO_PRIORITY) {
if (pValue.priority !== baAsn1.BACNET_NO_PRIORITY) {
baAsn1.encodeContextUnsigned(buffer, 3, pValue.priority);
}
});

0 comments on commit f0cb5bd

Please sign in to comment.