Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Commit

Permalink
Add support for ConnectionTimeOut standard parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <[email protected]>
  • Loading branch information
Jérôme Benoit committed Jun 13, 2021
1 parent 18b2d50 commit 291cb25
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: -)
Expand Down
5 changes: 4 additions & 1 deletion src/charging-station/ChargingStation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/utils/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 291cb25

Please sign in to comment.