Skip to content

Commit

Permalink
feat(bacnet): fixed wrong calculations of length headers
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Apr 14, 2022
1 parent bbee159 commit 843cd77
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func CreateBACnetTagHeaderBalanced(isContext bool, id uint8, value uint32) *BACn
}

func CreateBACnetApplicationTagObjectIdentifier(objectType uint16, instance uint32) *BACnetApplicationTagObjectIdentifier {
header := NewBACnetTagHeader(0xC, TagClass_APPLICATION_TAGS, uint8(requiredLength(uint(objectType))), nil, nil, nil, nil)
header := NewBACnetTagHeader(0xC, TagClass_APPLICATION_TAGS, uint8(4), nil, nil, nil, nil)
objectTypeEnum := BACnetObjectTypeByValue(objectType)
if objectType >= 128 || !BACnetObjectTypeKnows(objectType) {
objectTypeEnum = BACnetObjectType_VENDOR_PROPRIETARY_VALUE
Expand All @@ -360,7 +360,7 @@ func CreateBACnetApplicationTagObjectIdentifier(objectType uint16, instance uint
}

func CreateBACnetContextTagObjectIdentifier(tagNum uint8, objectType uint16, instance uint32) *BACnetContextTagObjectIdentifier {
header := NewBACnetTagHeader(tagNum, TagClass_CONTEXT_SPECIFIC_TAGS, uint8(requiredLength(uint(objectType))), nil, nil, nil, nil)
header := NewBACnetTagHeader(tagNum, TagClass_CONTEXT_SPECIFIC_TAGS, uint8(4), nil, nil, nil, nil)
objectTypeEnum := BACnetObjectTypeByValue(objectType)
if objectType >= 128 {
objectTypeEnum = BACnetObjectType_VENDOR_PROPRIETARY_VALUE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public static BACnetTagHeader createBACnetTagHeaderBalanced(boolean isContext, s
}

public static BACnetApplicationTagObjectIdentifier createBACnetApplicationTagObjectIdentifier(int objectType, long instance) {
BACnetTagHeader header = new BACnetTagHeader((byte) 0xC, TagClass.APPLICATION_TAGS, (byte) requiredLength(objectType), null, null, null, null);
BACnetTagHeader header = new BACnetTagHeader((byte) 0xC, TagClass.APPLICATION_TAGS, (byte) 4, null, null, null, null);
BACnetObjectType objectTypeEnum = BACnetObjectType.enumForValue(objectType);
if (objectType >= 128 || !BACnetObjectType.isDefined(objectType)) {
objectTypeEnum = BACnetObjectType.VENDOR_PROPRIETARY_VALUE;
Expand All @@ -399,7 +399,7 @@ public static BACnetApplicationTagObjectIdentifier createBACnetApplicationTagObj
}

public static BACnetContextTagObjectIdentifier createBACnetContextTagObjectIdentifier(byte tagNum, int objectType, long instance) {
BACnetTagHeader header = new BACnetTagHeader(tagNum, TagClass.CONTEXT_SPECIFIC_TAGS, (byte) requiredLength(objectType), null, null, null, null);
BACnetTagHeader header = new BACnetTagHeader(tagNum, TagClass.CONTEXT_SPECIFIC_TAGS, (byte) 4, null, null, null, null);
BACnetObjectType objectTypeEnum = BACnetObjectType.enumForValue(objectType);
if (objectType >= 128 || !BACnetObjectType.isDefined(objectType)) {
objectTypeEnum = BACnetObjectType.VENDOR_PROPRIETARY_VALUE;
Expand Down

0 comments on commit 843cd77

Please sign in to comment.