Skip to content

Commit e17501f

Browse files
committed
refactor: use enum.Meta
1 parent 8dc59b0 commit e17501f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/asn1.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ const bacappDecodeData = (buffer, offset, maxLength, tagDataType, lenValueType)
10861086
};
10871087

10881088
const bacappContextTagType = (property, tagNumber) => {
1089-
let tag = baEnum.ApplicationTags.MAX_BACNET_APPLICATION_TAG;
1089+
let tag = baEnum.Meta.ApplicationTags.max;
10901090
switch (property) {
10911091
case baEnum.PropertyIds.PROP_ACTUAL_SHED_LEVEL:
10921092
case baEnum.PropertyIds.PROP_REQUESTED_SHED_LEVEL:
@@ -1520,13 +1520,13 @@ const bacappDecodeContextApplicationData = (buffer, offset, maxOffset, objectTyp
15201520
if (!subResult) return;
15211521
if (subResult.value === 0) {
15221522
len += subResult.len;
1523-
result = bacappDecodeApplicationData(buffer, offset + len, maxOffset, baEnum.ObjectTypes.MAX_BACNET_OBJECT_TYPE, baEnum.PropertyIds.MAX_BACNET_PROPERTY_ID);
1523+
result = bacappDecodeApplicationData(buffer, offset + len, maxOffset, baEnum.Meta.ObjectType.max, baEnum.Meta.PropertyIdentifier.max);
15241524
if (!result) return;
15251525
list.push(result);
15261526
len += result.len;
15271527
} else {
15281528
const overrideTagNumber = bacappContextTagType(propertyId, subResult.tagNumber);
1529-
if (overrideTagNumber !== baEnum.ApplicationTags.MAX_BACNET_APPLICATION_TAG) {
1529+
if (overrideTagNumber !== baEnum.Meta.ApplicationTags.max) {
15301530
subResult.tagNumber = overrideTagNumber;
15311531
}
15321532
let bacappResult = bacappDecodeData(buffer, offset + len + subResult.len, maxOffset, subResult.tagNumber, subResult.value);

lib/services.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ module.exports.encodeReadProperty = (buffer, objectType, objectInstance, propert
585585
if (objectType <= baAsn1.BACNET_MAX_OBJECT) {
586586
baAsn1.encodeContextObjectId(buffer, 0, objectType, objectInstance);
587587
}
588-
if (propertyId <= baEnum.PropertyIds.MAX_BACNET_PROPERTY_ID) {
588+
if (propertyId <= baEnum.Meta.PropertyIdentifier.max) {
589589
baAsn1.encodeContextEnumerated(buffer, 1, propertyId);
590590
}
591591
if (arrayIndex !== baAsn1.BACNET_ARRAY_ALL) {

0 commit comments

Comments
 (0)