Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions acs-service-setup/dumps/edge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions edge-ads/lib/ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -78,6 +82,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

Expand Down Expand Up @@ -147,6 +153,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()
Expand Down