From: Jérôme Benoit Date: Sun, 13 Jun 2021 20:39:33 +0000 (+0200) Subject: Add support for ConnectionTimeOut standard parameter X-Git-Tag: v1.0.19~1 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=291cb255bec471875566d94ea674b7f476a2b7a1;p=e-mobility-charging-stations-simulator.git Add support for ConnectionTimeOut standard parameter Signed-off-by: Jérôme Benoit --- diff --git a/README.md b/README.md index 0a24123d..5246171d 100644 --- a/README.md +++ b/README.md @@ -218,7 +218,7 @@ All kind of OCPP parameters are supported in a charging station template. The li - :white_check_mark: AuthorizeRemoteTxRequests (type: boolean) (units: -) - :x: ClockAlignedDataInterval (type: integer) (units: seconds) -- :x: ConnectionTimeOut (type: integer) (units: seconds) +- :white_check_mark: ConnectionTimeOut (type: integer) (units: seconds) - :x: GetConfigurationMaxKeys (type: integer) (units: -) - :white_check_mark: HeartbeatInterval (type: integer) (units: seconds) - :x: LocalAuthorizeOffline (type: boolean) (units: -) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 10806bd2..e0845e75 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -707,13 +707,16 @@ export default class ChargingStation { // 0 for disabling private getConnectionTimeout(): number | undefined { + if (this.getConfigurationKey(StandardParametersKey.ConnectionTimeOut)) { + return parseInt(this.getConfigurationKey(StandardParametersKey.ConnectionTimeOut).value) ?? Constants.DEFAULT_CONNECTION_TIMEOUT; + } if (!Utils.isUndefined(this.stationInfo.connectionTimeout)) { return this.stationInfo.connectionTimeout; } if (!Utils.isUndefined(Configuration.getConnectionTimeout())) { return Configuration.getConnectionTimeout(); } - return 30; + return Constants.DEFAULT_CONNECTION_TIMEOUT; } // -1 for unlimited, 0 for disabling diff --git a/src/utils/Constants.ts b/src/utils/Constants.ts index 706ef41c..a7e274a7 100644 --- a/src/utils/Constants.ts +++ b/src/utils/Constants.ts @@ -36,4 +36,6 @@ export default class Constants { static readonly DEFAULT_WORKER_POOL_MIN_SIZE = 4; static readonly DEFAULT_WORKER_POOL_MAX_SIZE = 16; static readonly DEFAULT_CHARGING_STATIONS_PER_WORKER = 1; + + static readonly DEFAULT_CONNECTION_TIMEOUT = 30; }