X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2F1.6%2FOCPP16IncomingRequestService.ts;h=8dc9135fa7b80e314b0880214fd029f0f7c9a8db;hb=1b6498baa159ac6ebd4eda9008cde367640bf3ed;hp=6df6f75f09c08f9be541a6bd7de025aab8c46574;hpb=dc6617020896c78ee5b3d4ef2513c98b4d61f06f;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index 6df6f75f..8dc9135f 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -131,7 +131,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer commandName: OCPP16IncomingRequestCommand, commandPayload: JsonType ): Promise { - let result: JsonType; + let response: JsonType; if ( this.chargingStation.getOcppStrictCompliance() && this.chargingStation.isInPendingState() && @@ -154,8 +154,8 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer ) { if (this.incomingRequestHandlers.has(commandName)) { try { - // Call the method to build the result - result = await this.incomingRequestHandlers.get(commandName)(commandPayload); + // Call the method to build the response + response = await this.incomingRequestHandlers.get(commandName)(commandPayload); } catch (error) { // Log logger.error(this.chargingStation.logPrefix() + ' Handle request error: %j', error); @@ -184,19 +184,17 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer commandName ); } - // Send the built result - await this.chargingStation.ocppRequestService.sendResult(messageId, result, commandName); + // Send the built response + await this.chargingStation.ocppRequestService.sendResponse(messageId, response, commandName); } // Simulate charging station restart private handleRequestReset(commandPayload: ResetRequest): DefaultResponse { // eslint-disable-next-line @typescript-eslint/no-misused-promises setImmediate(async (): Promise => { - await this.chargingStation.stop( + await this.chargingStation.reset( (commandPayload.type + 'Reset') as OCPP16StopTransactionReason ); - await Utils.sleep(this.chargingStation.stationInfo.resetTime); - this.chargingStation.start(); }); logger.info( `${this.chargingStation.logPrefix()} ${