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/05/27 19:03:14 UTC

(plc4x) branch develop updated: fix: Fixed a bug that caused the ADS discoverer to generate an invalid connection-string.

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 4226376f91 fix: Fixed a bug that caused the ADS discoverer to generate an invalid connection-string.
4226376f91 is described below

commit 4226376f9198ba1f963714487115613d76b71420
Author: Christofer Dutz <cd...@apache.org>
AuthorDate: Mon May 27 21:01:56 2024 +0200

    fix: Fixed a bug that caused the ADS discoverer to generate an invalid connection-string.
---
 .../apache/plc4x/java/ads/discovery/AdsPlcDiscoverer.java    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/discovery/AdsPlcDiscoverer.java b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/discovery/AdsPlcDiscoverer.java
index db80710b48..8f12e608fb 100644
--- a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/discovery/AdsPlcDiscoverer.java
+++ b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/discovery/AdsPlcDiscoverer.java
@@ -112,18 +112,18 @@ public class AdsPlcDiscoverer implements PlcDiscoverer {
 
                                             if (hostNameBlock != null) {
                                                 Map<String, String> options = new HashMap<>();
-                                                options.put("sourceAmsNetId", inet4Address.getHostAddress() + ".1.1");
-                                                options.put("sourceAmsPort", "65534");
-                                                options.put("targetAmsNetId", remoteAmsNetId.getOctet1() + "." + remoteAmsNetId.getOctet2() + "." + remoteAmsNetId.getOctet3() + "." + remoteAmsNetId.getOctet4() + "." + remoteAmsNetId.getOctet5() + "." + remoteAmsNetId.getOctet6());
+                                                options.put("source-ams-net-id", inet4Address.getHostAddress() + ".1.1");
+                                                options.put("source-ams-port", "65534");
+                                                options.put("target-ams-net-id", remoteAmsNetId.getOctet1() + "." + remoteAmsNetId.getOctet2() + "." + remoteAmsNetId.getOctet3() + "." + remoteAmsNetId.getOctet4() + "." + remoteAmsNetId.getOctet5() + "." + remoteAmsNetId.getOctet6());
                                                 // TODO: Check if this is legit, or if we can get the information from somewhere.
-                                                options.put("targetAmsPort", "851");
+                                                options.put("target-ams-port", "851");
 
                                                 Map<String, PlcValue> attributes = new HashMap<>();
-                                                attributes.put("hostName", new PlcSTRING(hostNameBlock.getHostName().getText()));
+                                                attributes.put("host-name", new PlcSTRING(hostNameBlock.getHostName().getText()));
                                                 if (versionBlock != null) {
                                                     byte[] versionData = versionBlock.getVersionData();
                                                     int patchVersion = ((int) versionData[3] & 0xFF) << 8 | ((int) versionData[2] & 0xFF);
-                                                    attributes.put("twinCatVersion", new PlcSTRING(String.format("%d.%d.%d", (short) versionData[0] & 0xFF, (short) versionData[1] & 0xFF, patchVersion)));
+                                                    attributes.put("twin-cat-version", new PlcSTRING(String.format("%d.%d.%d", (short) versionData[0] & 0xFF, (short) versionData[1] & 0xFF, patchVersion)));
                                                 }
                                                 if (fingerprintBlock != null) {
                                                     attributes.put("fingerprint", new PlcSTRING(new String(fingerprintBlock.getData())));