X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcharging-station%2Focpp%2FOCPPIncomingRequestService.ts;h=85fd88e70ebaa624ef454a80493e52cc1dd8f748;hb=44ebef4c21047693fbc194aa9b7f90578465e29a;hp=0ea55a63515f0f479a627299625c1703e5442c15;hpb=e1d9a0f4d6ff1a90048e9a694fd12b7031cc6961;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPIncomingRequestService.ts b/src/charging-station/ocpp/OCPPIncomingRequestService.ts index 0ea55a63..85fd88e7 100644 --- a/src/charging-station/ocpp/OCPPIncomingRequestService.ts +++ b/src/charging-station/ocpp/OCPPIncomingRequestService.ts @@ -33,11 +33,15 @@ export abstract class OCPPIncomingRequestService extends AsyncResource { multipleOfPrecision: 2, }); ajvFormats(this.ajv); - this.incomingRequestHandler = this.incomingRequestHandler.bind(this) as ( + this.incomingRequestHandler = this.incomingRequestHandler.bind(this) as < + ReqType extends JsonType, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + ResType extends JsonType, + >( chargingStation: ChargingStation, messageId: string, commandName: IncomingRequestCommand, - commandPayload: JsonType, + commandPayload: ReqType, ) => Promise; this.validateIncomingRequestPayload = this.validateIncomingRequestPayload.bind(this) as < T extends JsonType, @@ -99,7 +103,7 @@ export abstract class OCPPIncomingRequestService extends AsyncResource { OCPPServiceUtils.ajvErrorsToErrorType(validate.errors!), 'Incoming request PDU is invalid', commandName, - JSON.stringify(validate.errors, null, 2), + JSON.stringify(validate.errors, undefined, 2), ); } @@ -110,10 +114,11 @@ export abstract class OCPPIncomingRequestService extends AsyncResource { return OCPPConstants.OCPP_RESPONSE_REJECTED; } - public abstract incomingRequestHandler( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public abstract incomingRequestHandler( chargingStation: ChargingStation, messageId: string, commandName: IncomingRequestCommand, - commandPayload: JsonType, + commandPayload: ReqType, ): Promise; }