You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2024/02/08 21:54:12 UTC
(plc4x) branch develop updated: fix: Made sure plc-values are serialized in LittleEndian format
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new f132b0b943 fix: Made sure plc-values are serialized in LittleEndian format
f132b0b943 is described below
commit f132b0b9439af8f29da70e97dade79bcca9bf6d7
Author: Christofer Dutz <cd...@apache.org>
AuthorDate: Thu Feb 8 22:53:59 2024 +0100
fix: Made sure plc-values are serialized in LittleEndian format
---
.../main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java
index 882b79ff09..df0db0fa13 100644
--- a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java
+++ b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java
@@ -1063,6 +1063,7 @@ public class AdsProtocolLogic extends Plc4xProtocolBase<AmsTCPPacket> implements
serializedTag -> serializedTag.length).sum();
// Copy all serialized tags into one buffer.
+ // This is intentionally not "LittleEndian" as we're just concatenating the serialized values.
WriteBufferByteBased writeBuffer = new WriteBufferByteBased(serializedSize);
for (byte[] serializedTag : serializedTags) {
try {
@@ -1117,7 +1118,7 @@ public class AdsProtocolLogic extends Plc4xProtocolBase<AmsTCPPacket> implements
// Get the data type, allocate enough memory and serialize the value based on the
// structure defined by the data type.
AdsDataTypeTableEntry dataType = dataTypeTable.get(datatypeName);
- WriteBufferByteBased writeBuffer = new WriteBufferByteBased((int) dataType.getSize());
+ WriteBufferByteBased writeBuffer = new WriteBufferByteBased((int) dataType.getSize(), ByteOrder.LITTLE_ENDIAN);
List<AdsDataTypeArrayInfo> arrayInfo = dataType.getArrayInfo();
serializeInternal(plcValue, dataType, arrayInfo, writeBuffer);
return writeBuffer.getBytes();