const moduleName = 'OCPP16ResponseService'
export class OCPP16ResponseService extends OCPPResponseService {
- public jsonSchemasIncomingRequestResponseValidateFunction: Map<
+ public incomingRequestResponsePayloadValidateFunctions: Map<
OCPP16IncomingRequestCommand,
ValidateFunction<JsonType>
>
- protected jsonSchemasValidateFunction: Map<OCPP16RequestCommand, ValidateFunction<JsonType>>
+ protected payloadValidateFunctions: Map<OCPP16RequestCommand, ValidateFunction<JsonType>>
private readonly responseHandlers: Map<OCPP16RequestCommand, ResponseHandler>
public constructor () {
[OCPP16RequestCommand.DATA_TRANSFER, this.emptyResponseHandler],
[OCPP16RequestCommand.FIRMWARE_STATUS_NOTIFICATION, this.emptyResponseHandler]
])
- this.jsonSchemasValidateFunction = new Map<OCPP16RequestCommand, ValidateFunction<JsonType>>([
+ this.payloadValidateFunctions = new Map<OCPP16RequestCommand, ValidateFunction<JsonType>>([
[
OCPP16RequestCommand.BOOT_NOTIFICATION,
this.ajv
.bind(this)
]
])
- this.jsonSchemasIncomingRequestResponseValidateFunction = new Map<
+ this.incomingRequestResponsePayloadValidateFunctions = new Map<
OCPP16IncomingRequestCommand,
ValidateFunction<JsonType>
>([
[
OCPP16IncomingRequestCommand.RESET,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
'assets/json-schemas/ocpp/1.6/ResetResponse.json',
],
[
OCPP16IncomingRequestCommand.CLEAR_CACHE,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
'assets/json-schemas/ocpp/1.6/ClearCacheResponse.json',
],
[
OCPP16IncomingRequestCommand.CHANGE_AVAILABILITY,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ChangeAvailabilityResponse>(
'assets/json-schemas/ocpp/1.6/ChangeAvailabilityResponse.json',
],
[
OCPP16IncomingRequestCommand.UNLOCK_CONNECTOR,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<UnlockConnectorResponse>(
'assets/json-schemas/ocpp/1.6/UnlockConnectorResponse.json',
],
[
OCPP16IncomingRequestCommand.GET_CONFIGURATION,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<GetConfigurationResponse>(
'assets/json-schemas/ocpp/1.6/GetConfigurationResponse.json',
],
[
OCPP16IncomingRequestCommand.CHANGE_CONFIGURATION,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<ChangeConfigurationResponse>(
'assets/json-schemas/ocpp/1.6/ChangeConfigurationResponse.json',
],
[
OCPP16IncomingRequestCommand.GET_COMPOSITE_SCHEDULE,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16GetCompositeScheduleResponse>(
'assets/json-schemas/ocpp/1.6/GetCompositeScheduleResponse.json',
],
[
OCPP16IncomingRequestCommand.SET_CHARGING_PROFILE,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<SetChargingProfileResponse>(
'assets/json-schemas/ocpp/1.6/SetChargingProfileResponse.json',
],
[
OCPP16IncomingRequestCommand.CLEAR_CHARGING_PROFILE,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ClearChargingProfileResponse>(
'assets/json-schemas/ocpp/1.6/ClearChargingProfileResponse.json',
],
[
OCPP16IncomingRequestCommand.REMOTE_START_TRANSACTION,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
'assets/json-schemas/ocpp/1.6/RemoteStartTransactionResponse.json',
],
[
OCPP16IncomingRequestCommand.REMOTE_STOP_TRANSACTION,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
'assets/json-schemas/ocpp/1.6/RemoteStopTransactionResponse.json',
],
[
OCPP16IncomingRequestCommand.GET_DIAGNOSTICS,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<GetDiagnosticsResponse>(
'assets/json-schemas/ocpp/1.6/GetDiagnosticsResponse.json',
],
[
OCPP16IncomingRequestCommand.TRIGGER_MESSAGE,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16TriggerMessageResponse>(
'assets/json-schemas/ocpp/1.6/TriggerMessageResponse.json',
],
[
OCPP16IncomingRequestCommand.DATA_TRANSFER,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16DataTransferResponse>(
'assets/json-schemas/ocpp/1.6/DataTransferResponse.json',
],
[
OCPP16IncomingRequestCommand.UPDATE_FIRMWARE,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16UpdateFirmwareResponse>(
'assets/json-schemas/ocpp/1.6/UpdateFirmwareResponse.json',
],
[
OCPP16IncomingRequestCommand.RESERVE_NOW,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<OCPP16ReserveNowResponse>(
'assets/json-schemas/ocpp/1.6/ReserveNowResponse.json',
],
[
OCPP16IncomingRequestCommand.CANCEL_RESERVATION,
- this.ajv
+ this.ajvIncomingRequest
.compile(
OCPP16ServiceUtils.parseJsonSchemaFile<GenericResponse>(
'assets/json-schemas/ocpp/1.6/CancelReservationResponse.json',
commandName: OCPP16RequestCommand,
payload: JsonType
): boolean {
- if (this.jsonSchemasValidateFunction.has(commandName)) {
+ if (this.payloadValidateFunctions.has(commandName)) {
return this.validateResponsePayload(chargingStation, commandName, payload)
}
logger.warn(