From e23f3b0cd2b857389665e73b245bdece498250f0 Mon Sep 17 00:00:00 2001 From: Alex Godbehere Date: Tue, 22 Jul 2025 15:46:03 +0100 Subject: [PATCH 1/4] Increase debug level of ADS driver to 3 --- edge-ads/lib/ads.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/edge-ads/lib/ads.js b/edge-ads/lib/ads.js index d6a3c8a19..70b2508dc 100644 --- a/edge-ads/lib/ads.js +++ b/edge-ads/lib/ads.js @@ -78,6 +78,8 @@ export class ADSHandler { // Create the ADS client instance with our configuration this.client = new Client(clientConfig); + this.client.setDebugLevel(3); + // Set up connection event handlers // These handlers manage the connection lifecycle and notify the Edge Agent From b3d0d9185d2b81b6b1a5f7826a9cf9b5848bd541 Mon Sep 17 00:00:00 2001 From: Alex Godbehere Date: Tue, 22 Jul 2025 15:46:20 +0100 Subject: [PATCH 2/4] Attempt to disconnect ADS driver before reconnect --- edge-ads/lib/ads.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/edge-ads/lib/ads.js b/edge-ads/lib/ads.js index 70b2508dc..6a80446c9 100644 --- a/edge-ads/lib/ads.js +++ b/edge-ads/lib/ads.js @@ -149,6 +149,13 @@ export class ADSHandler { this.log("Connecting to ADS target %s at %s", conf.targetAmsNetId, conf.routerAddress); + try { + this.log("Disconnecting before connect...") + this.client.disconnect() + } catch (e) { + this.log("Could not disconnect before connect: %o", e); + } + // Attempt connection to the ADS target // This returns a Promise that resolves with connection info or rejects with error return this.client.connect() From 04ab62e113a64b21c2bec4b18efb4aae7908edfe Mon Sep 17 00:00:00 2001 From: Alex Godbehere Date: Tue, 29 Jul 2025 14:45:25 +0100 Subject: [PATCH 3/4] Stop disconnecting before connect --- edge-ads/lib/ads.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/edge-ads/lib/ads.js b/edge-ads/lib/ads.js index 6a80446c9..94f0715ee 100644 --- a/edge-ads/lib/ads.js +++ b/edge-ads/lib/ads.js @@ -149,12 +149,12 @@ export class ADSHandler { this.log("Connecting to ADS target %s at %s", conf.targetAmsNetId, conf.routerAddress); - try { - this.log("Disconnecting before connect...") - this.client.disconnect() - } catch (e) { - this.log("Could not disconnect before connect: %o", e); - } + // try { + // this.log("Disconnecting before connect...") + // this.client.disconnect() + // } catch (e) { + // this.log("Could not disconnect before connect: %o", e); + // } // Attempt connection to the ADS target // This returns a Promise that resolves with connection info or rejects with error From 4177bab79951f606d7535595b3d1afdd6b6885ff Mon Sep 17 00:00:00 2001 From: Alex Godbehere Date: Thu, 31 Jul 2025 11:06:35 +0100 Subject: [PATCH 4/4] wip: Debugging --- acs-service-setup/dumps/edge.yaml | 10 ++++++++++ edge-ads/lib/ads.js | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/acs-service-setup/dumps/edge.yaml b/acs-service-setup/dumps/edge.yaml index ef76e2f13..1b251e4e3 100644 --- a/acs-service-setup/dumps/edge.yaml +++ b/acs-service-setup/dumps/edge.yaml @@ -629,6 +629,16 @@ configs: order: 7 title: Timeout Delay (ms) type: number + allowHalfOpen: + default: false + description: Allow a half-open connection + title: Allow Half-Open + type: boolean + rawClient: + default: false + description: Connect to a system without a PLC runtime + title: Raw client + type: boolean required: - targetAmsNetId - routerAddress diff --git a/edge-ads/lib/ads.js b/edge-ads/lib/ads.js index 94f0715ee..92e3145eb 100644 --- a/edge-ads/lib/ads.js +++ b/edge-ads/lib/ads.js @@ -38,6 +38,8 @@ export class ADSHandler { * @param {number} [conf.localAdsPort] - Local ADS port (auto-assigned if not specified) * @param {number} [conf.timeoutDelay=5000] - Connection timeout in milliseconds * @param {boolean} [conf.hideConsoleWarnings=true] - Hide ADS client console warnings + * @param {boolean} [conf.allowHalfOpen=false] - Allow half-open connections + * @param {boolean} [conf.rawClient=false] - Use raw client mode (no automatic reconnection) */ constructor(driver, conf) { this.driver = driver; @@ -64,6 +66,8 @@ export class ADSHandler { routerTcpPort: conf.routerTcpPort || 48898, // Default: ADS router port timeoutDelay: conf.timeoutDelay || 5000, // Default: 5 second timeout hideConsoleWarnings: conf.hideConsoleWarnings !== false, // Default: hide warnings + allowHalfOpen: conf.allowHalfOpen || false, // Default: don't allow half-open + rawClient: conf.rawClient || false, // Default: don't use raw client }; // Add optional local AMS configuration if specified