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 2022/03/31 14:47:59 UTC
[plc4x] 06/10: fix(plc4j/s7): Fixed some issues in the freshly merged S7 PR
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
commit 00a857af424cc4cabc1f6afeb18d5310dd200669
Author: cdutz <ch...@c-ware.de>
AuthorDate: Thu Mar 31 16:44:23 2022 +0200
fix(plc4j/s7): Fixed some issues in the freshly merged S7 PR
---
plc4go/assets/testing/protocols/s7/DriverTestsuite.xml | 14 +++++++-------
.../java/s7/readwrite/configuration/S7Configuration.java | 6 +++---
.../plc4x/java/s7/readwrite/context/S7DriverContext.java | 10 ++++++----
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/plc4go/assets/testing/protocols/s7/DriverTestsuite.xml b/plc4go/assets/testing/protocols/s7/DriverTestsuite.xml
index 04bf261..3c1173f 100644
--- a/plc4go/assets/testing/protocols/s7/DriverTestsuite.xml
+++ b/plc4go/assets/testing/protocols/s7/DriverTestsuite.xml
@@ -47,13 +47,6 @@
</COTPPacketConnectionRequest>
<parameters isList="true">
<COTPParameter>
- <parameterType dataType="uint" bitLength="8">194</parameterType>
- <parameterLength dataType="uint" bitLength="8">2</parameterLength>
- <COTPParameterCalledTsap>
- <tsapId dataType="uint" bitLength="16">256</tsapId>
- </COTPParameterCalledTsap>
- </COTPParameter>
- <COTPParameter>
<parameterType dataType="uint" bitLength="8">193</parameterType>
<parameterLength dataType="uint" bitLength="8">2</parameterLength>
<COTPParameterCallingTsap>
@@ -61,6 +54,13 @@
</COTPParameterCallingTsap>
</COTPParameter>
<COTPParameter>
+ <parameterType dataType="uint" bitLength="8">194</parameterType>
+ <parameterLength dataType="uint" bitLength="8">2</parameterLength>
+ <COTPParameterCalledTsap>
+ <tsapId dataType="uint" bitLength="16">256</tsapId>
+ </COTPParameterCalledTsap>
+ </COTPParameter>
+ <COTPParameter>
<parameterType dataType="uint" bitLength="8">192</parameterType>
<parameterLength dataType="uint" bitLength="8">1</parameterLength>
<COTPParameterTpduSize>
diff --git a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/configuration/S7Configuration.java b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/configuration/S7Configuration.java
index 385bb97..854440e 100644
--- a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/configuration/S7Configuration.java
+++ b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/configuration/S7Configuration.java
@@ -1,5 +1,5 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
@@ -161,8 +161,8 @@ public class S7Configuration implements Configuration, TcpTransportConfiguration
", local-slot=" + localSlot +
", local-tsap=" + localTsap +
", remote-rack=" + remoteRack +
- ", remot-slot=" + remoteSlot +
- ", remot-tsap=" + remoteTsap +
+ ", remote-slot=" + remoteSlot +
+ ", remote-tsap=" + remoteTsap +
", pduSize=" + pduSize +
", maxAmqCaller=" + maxAmqCaller +
", maxAmqCallee=" + maxAmqCallee +
diff --git a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/context/S7DriverContext.java b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/context/S7DriverContext.java
index 69eb544..b5b0abc 100644
--- a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/context/S7DriverContext.java
+++ b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/readwrite/context/S7DriverContext.java
@@ -51,7 +51,10 @@ public class S7DriverContext implements DriverContext, HasConfiguration<S7Config
this.calledTsapId = configuration.remoteTsap;
}
this.controllerType = configuration.controllerType == null ? S7ControllerType.ANY : S7ControllerType.valueOf(configuration.controllerType);
-
+
+ // Initialize the parameters with initial version (Will be updated during the login process)
+ this.cotpTpduSize = getNearestMatchingTpduSize((short) configuration.getPduSize());
+
// The Siemens LOGO device seems to only work with very limited settings,
// so we're overriding some of the defaults.
if (this.controllerType == S7ControllerType.LOGO && configuration.pduSize == 1024) {
@@ -63,10 +66,9 @@ public class S7DriverContext implements DriverContext, HasConfiguration<S7Config
// I have never seen this happen in reality. Making is smaller would unnecessarily limit the
// size, so we're setting it to the maximum that can be included.
this.pduSize = cotpTpduSize.getSizeInBytes() - 16;
+
+ throw new RuntimeException("Hutz");
}
-
- // Initialize the parameters with initial version (Will be updated during the login process)
- this.cotpTpduSize = getNearestMatchingTpduSize((short) configuration.getPduSize());
this.maxAmqCaller = configuration.maxAmqCaller;
this.maxAmqCallee = configuration.maxAmqCallee;