const moduleName = 'OCPP20IncomingRequestService'
export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
- protected jsonSchemasValidateFunction: Map<
- OCPP20IncomingRequestCommand,
- ValidateFunction<JsonType>
- >
+ protected payloadValidateFunctions: Map<OCPP20IncomingRequestCommand, ValidateFunction<JsonType>>
private readonly incomingRequestHandlers: Map<
OCPP20IncomingRequestCommand,
this.incomingRequestHandlers = new Map<OCPP20IncomingRequestCommand, IncomingRequestHandler>([
[OCPP20IncomingRequestCommand.CLEAR_CACHE, this.handleRequestClearCache.bind(this)]
])
- this.jsonSchemasValidateFunction = new Map<
+ this.payloadValidateFunctions = new Map<
OCPP20IncomingRequestCommand,
ValidateFunction<JsonType>
>([
response,
commandName
)
+ // Emit command name event to allow delayed handling
+ this.emit(commandName, chargingStation, commandPayload, response)
}
private validatePayload (
commandName: OCPP20IncomingRequestCommand,
commandPayload: JsonType
): boolean {
- if (this.jsonSchemasValidateFunction.has(commandName)) {
+ if (this.payloadValidateFunctions.has(commandName)) {
return this.validateIncomingRequestPayload(chargingStation, commandName, commandPayload)
}
logger.warn(