You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2018/08/23 13:53:53 UTC
[incubator-plc4x] branch master updated: [ADS] added TODOs/Notes
about the broken types in ADS
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
The following commit(s) were added to refs/heads/master by this push:
new ddad4ad [ADS] added TODOs/Notes about the broken types in ADS
ddad4ad is described below
commit ddad4add14ee62ffd1a6215c2d2467eda17f6383
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Aug 23 15:53:49 2018 +0200
[ADS] added TODOs/Notes about the broken types in ADS
---
.../java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java | 1 +
.../java/org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocol.java | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
index 4cc69dd..d7ecbd7 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
@@ -195,6 +195,7 @@ public class AdsTcpPlcConnection extends AdsAbstractPlcConnection implements Plc
Invoke.NONE,
indexGroup,
indexOffset,
+ // TODO: length determination doesn't work here really as this is only known within the plc or by the developer
Length.of(LittleEndianDecoder.getLengthFor(datatype, 1)),
transmissionMode,
MaxDelay.of(0),
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocol.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocol.java
index b4a3a0d..78634f8 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocol.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocol.java
@@ -184,6 +184,7 @@ public class Plc4x2AdsProtocol extends MessageToMessageCodec<AmsPacket, PlcReque
Invoke invokeId = Invoke.of(correlationBuilder.incrementAndGet());
IndexGroup indexGroup = IndexGroup.of(adsAddress.getIndexGroup());
IndexOffset indexOffset = IndexOffset.of(adsAddress.getIndexOffset());
+ // TODO: length determination doesn't work here really as this is only known within the plc or by the developer
Length length = Length.of(calculateLength(readRequestItem.getDatatype(), readRequestItem.getSize()));
AmsPacket amsPacket = AdsReadRequest.of(targetAmsNetId, targetAmsPort, sourceAmsNetId, sourceAmsPort, invokeId, indexGroup, indexOffset, length);
LOGGER.debug("encoded read request {}", amsPacket);
@@ -192,7 +193,7 @@ public class Plc4x2AdsProtocol extends MessageToMessageCodec<AmsPacket, PlcReque
}
private long calculateLength(Class<?> dataType, int size) {
- return LittleEndianDecoder.getLengthFor(dataType, 4) * size;
+ return LittleEndianDecoder.getLengthFor(dataType, 16) * size;
}
private void encodeProprietaryRequest(PlcRequestContainer<PlcRequest, PlcResponse> msg, List<Object> out) throws PlcProtocolException {