X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPRequestService.ts;h=29c740a187310d11fe5a0dedf4ea3e05de8d016c;hb=81e3cc3895d5dc289404c72459246d2b5215fe82;hp=921945e82cdea1bb92bee6373092151d12f8771c;hpb=07561812b72072b6d9f20997be86a42ee88e15a2;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 921945e8..29c740a1 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -28,7 +28,7 @@ const moduleName = 'OCPPRequestService'; export default abstract class OCPPRequestService { private static instance: OCPPRequestService | null = null; - private ajv: Ajv; + private readonly ajv: Ajv; private readonly ocppResponseService: OCPPResponseService; @@ -37,6 +37,7 @@ export default abstract class OCPPRequestService { this.ajv = new Ajv(); ajvFormats(this.ajv); this.requestHandler.bind(this); + this.sendMessage.bind(this); this.sendResponse.bind(this); this.sendError.bind(this); this.internalSendMessage.bind(this); @@ -158,11 +159,13 @@ export default abstract class OCPPRequestService { } ): Promise { if ( - (chargingStation.isInUnknownState() && commandName === RequestCommand.BOOT_NOTIFICATION) || - (!chargingStation.getOcppStrictCompliance() && chargingStation.isInUnknownState()) || - chargingStation.isInAcceptedState() || - (chargingStation.isInPendingState() && - (params.triggerMessage || messageType === MessageType.CALL_RESULT_MESSAGE)) + (chargingStation.isInUnknownState() === true && + commandName === RequestCommand.BOOT_NOTIFICATION) || + (chargingStation.getOcppStrictCompliance() === false && + chargingStation.isInUnknownState() === true) || + chargingStation.isInAcceptedState() === true || + (chargingStation.isInPendingState() === true && + (params.triggerMessage === true || messageType === MessageType.CALL_RESULT_MESSAGE)) ) { // eslint-disable-next-line @typescript-eslint/no-this-alias const self = this;