Exit of we fail to connect
This commit is contained in:
parent
cb8e890ace
commit
efaa3f4d38
@ -2,7 +2,7 @@
|
||||
* @author Martin Karkowski
|
||||
* @email m.karkowski@zema.de
|
||||
* @create date 2020-03-02 11:37:50
|
||||
* @modify date 2021-01-04 18:45:37
|
||||
* @modify date 2021-07-30 07:49:17
|
||||
* @desc [description]
|
||||
*/
|
||||
|
||||
@ -165,8 +165,8 @@ export class BeckhoffPlc extends BasePlcModule implements IPLCModule {
|
||||
const _options = generateAdsOptions(options);
|
||||
this._logger.debug(
|
||||
"Creating new ADS-Client " +
|
||||
_this.identifier +
|
||||
" with the following settings",
|
||||
_this.identifier +
|
||||
" with the following settings",
|
||||
JSON.stringify(_options)
|
||||
);
|
||||
|
||||
@ -182,12 +182,10 @@ export class BeckhoffPlc extends BasePlcModule implements IPLCModule {
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
this._client.on("error", (err) => {
|
||||
this._logger.error(
|
||||
"Beckhoff Client " + _this.identifier + " got Error",
|
||||
err
|
||||
);
|
||||
});
|
||||
this._logger.error(
|
||||
"Beckhoff Client " + _this.identifier + " got Error",
|
||||
err
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@ -246,10 +244,10 @@ export class BeckhoffPlc extends BasePlcModule implements IPLCModule {
|
||||
if (this._logger.enabledFor(Logger.DEBUG)) {
|
||||
_this._logger.debug(
|
||||
"updating io " +
|
||||
name +
|
||||
" to: \"" +
|
||||
handle.value.toString() +
|
||||
"\""
|
||||
name +
|
||||
" to: \"" +
|
||||
handle.value.toString() +
|
||||
"\""
|
||||
);
|
||||
}
|
||||
// Forward the content to the element.
|
||||
@ -326,13 +324,16 @@ export class BeckhoffPlc extends BasePlcModule implements IPLCModule {
|
||||
if (maxRetries > 0) {
|
||||
this._logger.warn(
|
||||
"Failed getting the Configuration. Retry left " +
|
||||
maxRetries.toString()
|
||||
maxRetries.toString()
|
||||
);
|
||||
this._logger.trace(err);
|
||||
// Start a Time
|
||||
setTimeout(_this._getConfig.apply, 1000, _this, maxRetries - 1);
|
||||
} else {
|
||||
this._logger.error("Failed getting the Configuration", err);
|
||||
// Failed to connect to the PLC.
|
||||
// Exit the System.
|
||||
process.exit();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -472,15 +473,15 @@ export class BeckhoffPlc extends BasePlcModule implements IPLCModule {
|
||||
// Log the Subscribe events
|
||||
_this._logger.debug(
|
||||
(type === "output" ? "subscribing " : "publishing on ") +
|
||||
path
|
||||
path
|
||||
);
|
||||
|
||||
_this._logger.debug(
|
||||
"Setting \"" +
|
||||
name +
|
||||
"\" to \"" +
|
||||
defaultValue.toString() +
|
||||
"\""
|
||||
name +
|
||||
"\" to \"" +
|
||||
defaultValue.toString() +
|
||||
"\""
|
||||
);
|
||||
}
|
||||
|
||||
@ -515,8 +516,8 @@ export class BeckhoffPlc extends BasePlcModule implements IPLCModule {
|
||||
// Writing is not allowed, give a hint.
|
||||
_this._logger.debug(
|
||||
"client not updating \"" +
|
||||
handle.symname +
|
||||
"\". System running without write access!"
|
||||
handle.symname +
|
||||
"\". System running without write access!"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user