X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPRequestService.ts;h=c089c86a1af4092dd57e1deb281dab48c9d7769a;hb=b0342994636646699094b2d16a767d6d902d2bde;hp=125baf4073366623f05c67797d6e375ef532f148;hpb=edd134392e237a3242dc2093341df70244c51472;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 125baf40..c089c86a 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -1,5 +1,4 @@ -import type { JSONSchemaType } from 'ajv'; -import Ajv from 'ajv-draft-04'; +import Ajv, { type JSONSchemaType } from 'ajv'; import ajvFormats from 'ajv-formats'; import OCPPError from '../../exception/OCPPError'; @@ -9,6 +8,7 @@ import type { HandleErrorParams } from '../../types/Error'; import type { JsonObject, JsonType } from '../../types/JsonType'; import { ErrorType } from '../../types/ocpp/ErrorType'; import { MessageType } from '../../types/ocpp/MessageType'; +import type { OCPPVersion } from '../../types/ocpp/OCPPVersion'; import { type ErrorCallback, type IncomingRequestCommand, @@ -30,14 +30,16 @@ const moduleName = 'OCPPRequestService'; export default abstract class OCPPRequestService { private static instance: OCPPRequestService | null = null; + private readonly version: OCPPVersion; private readonly ajv: Ajv; private readonly ocppResponseService: OCPPResponseService; - protected constructor(ocppResponseService: OCPPResponseService) { - this.ocppResponseService = ocppResponseService; + protected constructor(version: OCPPVersion, ocppResponseService: OCPPResponseService) { + this.version = version; this.ajv = new Ajv(); ajvFormats(this.ajv); + this.ocppResponseService = ocppResponseService; this.requestHandler.bind(this); this.sendMessage.bind(this); this.sendResponse.bind(this);