- if (new.target?.name === moduleName) {
- throw new TypeError(`Cannot construct ${new.target?.name} instances directly`);
- }
- super(ocppResponseService);
- this.jsonSchemas = new Map<OCPP20RequestCommand, JSONSchemaType<JsonObject>>();
- this.buildRequestPayload.bind(this);
- this.validatePayload.bind(this);
+ // if (new.target?.name === moduleName) {
+ // throw new TypeError(`Cannot construct ${new.target?.name} instances directly`);
+ // }
+ super(OCPPVersion.VERSION_20, ocppResponseService);
+ this.jsonSchemas = new Map<OCPP20RequestCommand, JSONSchemaType<JsonObject>>([
+ [
+ OCPP20RequestCommand.BOOT_NOTIFICATION,
+ OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20BootNotificationRequest>(
+ 'assets/json-schemas/ocpp/2.0/BootNotificationRequest.json',
+ moduleName,
+ 'constructor',
+ ),
+ ],
+ [
+ OCPP20RequestCommand.HEARTBEAT,
+ OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20HeartbeatRequest>(
+ 'assets/json-schemas/ocpp/2.0/HeartbeatRequest.json',
+ moduleName,
+ 'constructor',
+ ),
+ ],
+ [
+ OCPP20RequestCommand.STATUS_NOTIFICATION,
+ OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20StatusNotificationRequest>(
+ 'assets/json-schemas/ocpp/2.0/StatusNotificationRequest.json',
+ moduleName,
+ 'constructor',
+ ),
+ ],
+ ]);
+ this.buildRequestPayload = this.buildRequestPayload.bind(this) as <Request extends JsonType>(
+ chargingStation: ChargingStation,
+ commandName: OCPP20RequestCommand,
+ commandParams?: JsonType,
+ ) => Request;