repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: convert remote stop transaction to two stages request
[e-mobility-charging-stations-simulator.git]
/
src
/
charging-station
/
ocpp
/
2.0
/
OCPP20IncomingRequestService.ts
diff --git
a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts
b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts
index cfc58323ed8ad4cf597c1a2b3b9227b86f8ba2cd..67f3a61b492529ca0a2ae2bb487200035ff59569 100644
(file)
--- a/
src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts
+++ b/
src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts
@@
-19,10
+19,7
@@
import { OCPPIncomingRequestService } from '../OCPPIncomingRequestService.js'
const moduleName = 'OCPP20IncomingRequestService'
export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
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,
private readonly incomingRequestHandlers: Map<
OCPP20IncomingRequestCommand,
@@
-37,7
+34,7
@@
export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
this.incomingRequestHandlers = new Map<OCPP20IncomingRequestCommand, IncomingRequestHandler>([
[OCPP20IncomingRequestCommand.CLEAR_CACHE, this.handleRequestClearCache.bind(this)]
])
this.incomingRequestHandlers = new Map<OCPP20IncomingRequestCommand, IncomingRequestHandler>([
[OCPP20IncomingRequestCommand.CLEAR_CACHE, this.handleRequestClearCache.bind(this)]
])
- this.
jsonSchemasValidateFunction
= new Map<
+ this.
payloadValidateFunctions
= new Map<
OCPP20IncomingRequestCommand,
ValidateFunction<JsonType>
>([
OCPP20IncomingRequestCommand,
ValidateFunction<JsonType>
>([
@@
-138,6
+135,8
@@
export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
response,
commandName
)
response,
commandName
)
+ // Emit command name event to allow delayed handling
+ this.emit(commandName, chargingStation, commandPayload, response)
}
private validatePayload (
}
private validatePayload (
@@
-145,7
+144,7
@@
export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
commandName: OCPP20IncomingRequestCommand,
commandPayload: JsonType
): boolean {
commandName: OCPP20IncomingRequestCommand,
commandPayload: JsonType
): boolean {
- if (this.
jsonSchemasValidateFunction
.has(commandName)) {
+ if (this.
payloadValidateFunctions
.has(commandName)) {
return this.validateIncomingRequestPayload(chargingStation, commandName, commandPayload)
}
logger.warn(
return this.validateIncomingRequestPayload(chargingStation, commandName, commandPayload)
}
logger.warn(