X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPResponseService.ts;h=1bc4a8a8f6ae3a713da40be7ca0079aa96ae5865;hb=b2b606263e2676354259164d532ff9aa91ccdf87;hp=c66a16dad839a4fbcd47e250341d4d6e15b9a823;hpb=2896e06dc8d72adf7150b23c941079f622f6f37c;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPResponseService.ts b/src/charging-station/ocpp/OCPPResponseService.ts index c66a16da..1bc4a8a8 100644 --- a/src/charging-station/ocpp/OCPPResponseService.ts +++ b/src/charging-station/ocpp/OCPPResponseService.ts @@ -1,7 +1,7 @@ import Ajv, { type JSONSchemaType } from 'ajv'; import ajvFormats from 'ajv-formats'; -import { OCPPServiceUtils } from './internal'; +import { OCPPServiceUtils } from './OCPPServiceUtils'; import type { ChargingStation } from '../../charging-station'; import { OCPPError } from '../../exception'; import type { @@ -11,7 +11,7 @@ import type { OCPPVersion, RequestCommand, } from '../../types'; -import { logger } from '../../utils/Logger'; +import { logger } from '../../utils'; const moduleName = 'OCPPResponseService'; @@ -31,8 +31,18 @@ export abstract class OCPPResponseService { multipleOfPrecision: 2, }); ajvFormats(this.ajv); - this.responseHandler.bind(this); - this.validateResponsePayload.bind(this); + this.responseHandler = this.responseHandler.bind(this) as ( + chargingStation: ChargingStation, + commandName: RequestCommand, + payload: JsonType, + requestPayload: JsonType + ) => Promise; + this.validateResponsePayload = this.validateResponsePayload.bind(this) as ( + chargingStation: ChargingStation, + commandName: RequestCommand, + schema: JSONSchemaType, + payload: T + ) => boolean; } public static getInstance(this: new () => T): T { @@ -48,7 +58,7 @@ export abstract class OCPPResponseService { schema: JSONSchemaType, payload: T ): boolean { - if (chargingStation.getPayloadSchemaValidation() === false) { + if (chargingStation.getOcppStrictCompliance() === false) { return true; } const validate = this.ajv.compile(schema);