import { ErrorType } from '../../../types/ocpp/ErrorType';
import { OCPPVersion } from '../../../types/ocpp/OCPPVersion';
import type { RequestParams } from '../../../types/ocpp/Requests';
-import logger from '../../../utils/Logger';
import Utils from '../../../utils/Utils';
import type ChargingStation from '../../ChargingStation';
import OCPPRequestService from '../OCPPRequestService';
const moduleName = 'OCPP20RequestService';
export default class OCPP20RequestService extends OCPPRequestService {
- private jsonSchemas: Map<OCPP20RequestCommand, JSONSchemaType<JsonObject>>;
+ protected jsonSchemas: Map<OCPP20RequestCommand, JSONSchemaType<JsonObject>>;
public constructor(ocppResponseService: OCPPResponseService) {
if (new.target?.name === moduleName) {
);
}
- protected getRequestPayloadValidationSchema(
- chargingStation: ChargingStation,
- commandName: OCPP20RequestCommand
- ): JSONSchemaType<JsonObject> | false {
- if (this.jsonSchemas.has(commandName) === true) {
- return this.jsonSchemas.get(commandName);
- }
- logger.warn(
- `${chargingStation.logPrefix()} ${moduleName}.getPayloadValidationSchema: No JSON schema found for command ${commandName} PDU validation`
- );
- return false;
- }
-
private buildRequestPayload<Request extends JsonType>(
chargingStation: ChargingStation,
commandName: OCPP20RequestCommand,