Skip to content

Commit

Permalink
refactor: use enum.Meta
Browse files Browse the repository at this point in the history
  • Loading branch information
dopry committed Mar 8, 2018
1 parent 1735ee8 commit 96ff4d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/asn1.js
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ const bacappDecodeData = (buffer, offset, maxLength, tagDataType, lenValueType)
};

const bacappContextTagType = (property, tagNumber) => {
let tag = baEnum.ApplicationTags.MAX_BACNET_APPLICATION_TAG;
let tag = baEnum.Meta.ApplicationTags.max;
switch (property) {
case baEnum.PropertyIds.PROP_ACTUAL_SHED_LEVEL:
case baEnum.PropertyIds.PROP_REQUESTED_SHED_LEVEL:
Expand Down Expand Up @@ -1520,13 +1520,13 @@ const bacappDecodeContextApplicationData = (buffer, offset, maxOffset, objectTyp
if (!subResult) return;
if (subResult.value === 0) {
len += subResult.len;
result = bacappDecodeApplicationData(buffer, offset + len, maxOffset, baEnum.ObjectTypes.MAX_BACNET_OBJECT_TYPE, baEnum.PropertyIds.MAX_BACNET_PROPERTY_ID);
result = bacappDecodeApplicationData(buffer, offset + len, maxOffset, baEnum.Meta.ObjectType.max, baEnum.Meta.PropertyIdentifier.max);
if (!result) return;
list.push(result);
len += result.len;
} else {
const overrideTagNumber = bacappContextTagType(propertyId, subResult.tagNumber);
if (overrideTagNumber !== baEnum.ApplicationTags.MAX_BACNET_APPLICATION_TAG) {
if (overrideTagNumber !== baEnum.Meta.ApplicationTags.max) {
subResult.tagNumber = overrideTagNumber;
}
let bacappResult = bacappDecodeData(buffer, offset + len + subResult.len, maxOffset, subResult.tagNumber, subResult.value);
Expand Down
2 changes: 1 addition & 1 deletion lib/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ module.exports.encodeReadProperty = (buffer, objectType, objectInstance, propert
if (objectType <= baAsn1.BACNET_MAX_OBJECT) {
baAsn1.encodeContextObjectId(buffer, 0, objectType, objectInstance);
}
if (propertyId <= baEnum.PropertyIds.MAX_BACNET_PROPERTY_ID) {
if (propertyId <= baEnum.Meta.PropertyIdentifier.max) {
baAsn1.encodeContextEnumerated(buffer, 1, propertyId);
}
if (arrayIndex !== baAsn1.BACNET_ARRAY_ALL) {
Expand Down

0 comments on commit 96ff4d2

Please sign in to comment.