From: Jérôme Benoit Date: Fri, 10 Nov 2023 20:35:29 +0000 (+0100) Subject: fix: fix types in stationInfo properties refactoring X-Git-Tag: v1.2.24~19 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=9a77cc079c7f2f8ac53f95d1f54f41c4a2d833f8;p=e-mobility-charging-stations-simulator.git fix: fix types in stationInfo properties refactoring Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index ae5f0fd1..282b6aef 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -782,7 +782,7 @@ export class ChargingStation extends EventEmitter { this.wsConnection = new WebSocket( this.wsConnectionUrl, - `ocpp${this.stationInfo.ocppVersion}`, + `ocpp${this.stationInfo?.ocppVersion}`, options, ); @@ -1259,7 +1259,7 @@ export class ChargingStation extends EventEmitter { } private initializeOcppServices(): void { - const ocppVersion = this.stationInfo.ocppVersion; + const ocppVersion = this.stationInfo?.ocppVersion; switch (ocppVersion) { case OCPPVersion.VERSION_16: this.ocppIncomingRequestService = @@ -1756,7 +1756,7 @@ export class ChargingStation extends EventEmitter { } while ( this.isRegistered() === false && (registrationRetryCount <= this.stationInfo.registrationMaxRetries! || - this.stationInfo?.registrationMaxRetries) === -1 + this.stationInfo?.registrationMaxRetries === -1) ); } if (this.isRegistered() === true) { @@ -1823,7 +1823,7 @@ export class ChargingStation extends EventEmitter { private async handleIncomingMessage(request: IncomingRequest): Promise { const [messageType, messageId, commandName, commandPayload] = request; - if (this.stationInfo.enableStatistics === true) { + if (this.stationInfo?.enableStatistics === true) { this.performanceStatistics?.addRequestStatistic(commandName, messageType); } logger.debug(