X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.ts;h=36cd0958fffe778f3cb68c0402be8b3285f58f4f;hb=55ae7b758f478a2beb4557bbc96363fb913dcc73;hp=aa68abdf346cdc251f99cc856708e173a7cc0cb4;hpb=1fdb60b661afed4d26796cb0a2ed15e78f3b40a7;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index aa68abdf..36cd0958 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -711,7 +711,10 @@ export class ChargingStation extends EventEmitter { } } - public async stop (reason?: StopTransactionReason, stopTransactions?: boolean): Promise { + public async stop ( + reason?: StopTransactionReason, + stopTransactions = this.stationInfo?.stopTransactionsOnStopped + ): Promise { if (this.started) { if (!this.stopping) { this.stopping = true @@ -1169,7 +1172,7 @@ export class ChargingStation extends EventEmitter { stationInfo.resetTime = stationTemplate.resetTime != null ? secondsToMilliseconds(stationTemplate.resetTime) - : Constants.CHARGING_STATION_DEFAULT_RESET_TIME + : Constants.DEFAULT_CHARGING_STATION_RESET_TIME return stationInfo } @@ -1865,7 +1868,10 @@ export class ChargingStation extends EventEmitter { this.emit(ChargingStationEvents.updated) } - private getCachedRequest (messageType: MessageType, messageId: string): CachedRequest | undefined { + private getCachedRequest ( + messageType: MessageType | undefined, + messageId: string + ): CachedRequest | undefined { const cachedRequest = this.requests.get(messageId) if (Array.isArray(cachedRequest)) { return cachedRequest @@ -2028,8 +2034,8 @@ export class ChargingStation extends EventEmitter { commandName ?? requestCommandName ?? Constants.UNKNOWN_COMMAND // eslint-disable-next-line @typescript-eslint/no-base-to-string }' message '${data.toString()}'${ - messageType !== MessageType.CALL_MESSAGE - ? ` matching cached request '${JSON.stringify(this.requests.get(messageId))}'` + this.requests.has(messageId) + ? ` matching cached request '${JSON.stringify(this.getCachedRequest(messageType, messageId))}'` : '' } processing error:`, error @@ -2222,7 +2228,7 @@ export class ChargingStation extends EventEmitter { private async stopMessageSequence ( reason?: StopTransactionReason, - stopTransactions = this.stationInfo?.stopTransactionsOnStopped + stopTransactions?: boolean ): Promise { this.internalStopMessageSequence() // Stop ongoing transactions