diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/APDUComplexAck.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/APDUComplexAck.go index 8067857bcb5..85820d6dc44 100644 --- a/plc4go/internal/plc4go/bacnetip/readwrite/model/APDUComplexAck.go +++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/APDUComplexAck.go @@ -290,7 +290,7 @@ func APDUComplexAckParse(readBuffer utils.ReadBuffer, apduLength uint16) (*APDUC if pullErr := readBuffer.PullContext("serviceAck"); pullErr != nil { return nil, pullErr } - _val, _err := BACnetServiceAckParse(readBuffer, uint16(apduLength)-uint16(uint16(uint16(uint16(2))+uint16(uint16(utils.InlineIf(segmentedMessage, func() interface{} { return uint16(uint16(2)) }, func() interface{} { return uint16(uint16(0)) }).(uint16)))))) + _val, _err := BACnetServiceAckParse(readBuffer, uint16(apduLength)-uint16(uint16(uint16(uint16(3))+uint16(uint16(utils.InlineIf(segmentedMessage, func() interface{} { return uint16(uint16(2)) }, func() interface{} { return uint16(uint16(0)) }).(uint16)))))) switch { case errors.Is(_err, utils.ParseAssertError{}) || errors.Is(_err, io.EOF): readBuffer.Reset(currentPos) diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataUnspecified.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataUnspecified.go index 7c27699ee5d..268a10f2573 100644 --- a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataUnspecified.go +++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetConstructedDataUnspecified.go @@ -112,7 +112,7 @@ func (m *BACnetConstructedDataUnspecified) GetHasData() bool { _ = propertyIdentifier content := m.Content _ = content - return bool(bool((len(m.GetData())) == (0))) + return bool(bool((len(m.GetData())) != (0))) } /////////////////////// @@ -213,7 +213,7 @@ func BACnetConstructedDataUnspecifiedParse(readBuffer utils.ReadBuffer, tagNumbe } // Virtual field - _hasData := bool((len(data)) == (0)) + _hasData := bool((len(data)) != (0)) hasData := bool(_hasData) _ = hasData diff --git a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetReadAccessProperty.go b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetReadAccessProperty.go index 3b0a520bedb..a7c357eb4b5 100644 --- a/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetReadAccessProperty.go +++ b/plc4go/internal/plc4go/bacnetip/readwrite/model/BACnetReadAccessProperty.go @@ -144,7 +144,7 @@ func BACnetReadAccessPropertyParse(readBuffer utils.ReadBuffer, objectType BACne if pullErr := readBuffer.PullContext("propertyIdentifier"); pullErr != nil { return nil, pullErr } - _propertyIdentifier, _propertyIdentifierErr := BACnetContextTagParse(readBuffer, uint8(uint8(0)), BACnetDataType(BACnetDataType_BACNET_PROPERTY_IDENTIFIER)) + _propertyIdentifier, _propertyIdentifierErr := BACnetContextTagParse(readBuffer, uint8(uint8(2)), BACnetDataType(BACnetDataType_BACNET_PROPERTY_IDENTIFIER)) if _propertyIdentifierErr != nil { return nil, errors.Wrap(_propertyIdentifierErr, "Error parsing 'propertyIdentifier' field") } @@ -160,7 +160,7 @@ func BACnetReadAccessPropertyParse(readBuffer utils.ReadBuffer, objectType BACne if pullErr := readBuffer.PullContext("arrayIndex"); pullErr != nil { return nil, pullErr } - _val, _err := BACnetContextTagParse(readBuffer, uint8(1), BACnetDataType_UNSIGNED_INTEGER) + _val, _err := BACnetContextTagParse(readBuffer, uint8(3), BACnetDataType_UNSIGNED_INTEGER) switch { case errors.Is(_err, utils.ParseAssertError{}) || errors.Is(_err, io.EOF): readBuffer.Reset(currentPos) diff --git a/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/ManualBacNetDecoder.java b/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/ManualBacNetDecoder.java index 7aba82b35fb..2593b888331 100644 --- a/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/ManualBacNetDecoder.java +++ b/plc4j/drivers/bacnet/src/test/java/org/apache/plc4x/java/bacnetip/ManualBacNetDecoder.java @@ -26,7 +26,7 @@ public class ManualBacNetDecoder { public static void main(String[] args) throws Exception { - final byte[] bytes = Hex.decodeHex("810a002b01040205790109011c020000142c000002f93a06b24e09552e44434a00002f096f2e8204002f4f"); + final byte[] bytes = Hex.decodeHex("810a001b010030030e0c020000011e294c39014ec4020000014f1f"); ReadBuffer readBuffer = new ReadBufferByteBased(bytes); final BVLC packet = BVLC.staticParse(readBuffer); System.out.println(packet); diff --git a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec index a3d40bcdb4c..eefac12b1c9 100644 --- a/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec +++ b/protocols/bacnetip/src/main/resources/protocols/bacnetip/bacnetip.mspec @@ -213,7 +213,7 @@ [simple uint 8 originalInvokeId ] [optional uint 8 sequenceNumber 'segmentedMessage' ] [optional uint 8 proposedWindowSize 'segmentedMessage' ] - [optional BACnetServiceAck('apduLength - (2 + (segmentedMessage ? 2 : 0))') + [optional BACnetServiceAck('apduLength - (3 + (segmentedMessage ? 2 : 0))') serviceAck '!segmentedMessage' ] // TODO: maybe we should put this in the discriminated types below [optional uint 8 segmentServiceChoice 'segmentedMessage && sequenceNumber != 0'] @@ -639,9 +639,9 @@ ] [type BACnetReadAccessProperty(BACnetObjectType objectType) - [simple BACnetContextTagPropertyIdentifier('0', 'BACnetDataType.BACNET_PROPERTY_IDENTIFIER') + [simple BACnetContextTagPropertyIdentifier('2', 'BACnetDataType.BACNET_PROPERTY_IDENTIFIER') propertyIdentifier ] - [optional BACnetContextTagUnsignedInteger('1', 'BACnetDataType.UNSIGNED_INTEGER') + [optional BACnetContextTagUnsignedInteger('3', 'BACnetDataType.UNSIGNED_INTEGER') arrayIndex ] [optional BACnetConstructedData('4', 'objectType', 'propertyIdentifier') propertyValue ] @@ -1576,7 +1576,7 @@ data terminated 'STATIC_CALL("isBACnetConstructedDataClosingTag", readBuffer, false, tagNumber)' ] - [virtual bit hasData 'COUNT(data) == 0'] + [virtual bit hasData 'COUNT(data) != 0'] [optional BACnetContextTagPropertyIdentifier('0', 'BACnetDataType.BACNET_PROPERTY_IDENTIFIER') propertyIdentifier 'hasData' ]