From: Jérôme Benoit Date: Fri, 7 Jul 2023 21:19:53 +0000 (+0200) Subject: feat: make ocppStrictCompliance define payloadSchemaValidation default X-Git-Tag: v1.2.18~65 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b03c86f2f90f1390805570e296d16af071d4b2c7;p=e-mobility-charging-stations-simulator.git feat: make ocppStrictCompliance define payloadSchemaValidation default Signed-off-by: Jérôme Benoit --- diff --git a/README.md b/README.md index 3bbc77e9..592b3eab 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ But the modifications to test have to be done to the files in the build target d | amperageLimitationUnit | A/cA/dA/mA | A | string | charging stations amperage limit unit | | enableStatistics | true/false | false | boolean | enable charging stations statistics | | mustAuthorizeAtRemoteStart | true/false | true | boolean | always send authorize at remote start transaction when AuthorizeRemoteTxRequests is enabled | -| payloadSchemaValidation | true/false | true | boolean | validate OCPP commands PDU against [OCA](https://www.openchargealliance.org/) JSON schemas | +| payloadSchemaValidation | true/false | true if ocppStrictCompliance is true/false if ocppStrictCompliance is false | boolean | validate OCPP commands PDU against [OCA](https://www.openchargealliance.org/) JSON schemas | | beginEndMeterValues | true/false | false | boolean | enable Transaction.{Begin,End} MeterValues | | outOfOrderEndMeterValues | true/false | false | boolean | send Transaction.End MeterValues out of order. Need to relax OCPP specifications strict compliance ('ocppStrictCompliance' parameter) | | meteringPerTransaction | true/false | true | boolean | enable metering history on a per transaction basis | diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 77e93ed6..022f11bb 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -251,6 +251,19 @@ export class ChargingStation { } public getPayloadSchemaValidation(): boolean { + if ( + this.getOcppStrictCompliance() === true && + (isNullOrUndefined(this.stationInfo.payloadSchemaValidation) || + this.stationInfo.payloadSchemaValidation === false) + ) { + return true; + } else if ( + this.getOcppStrictCompliance() === false && + (isNullOrUndefined(this.stationInfo.payloadSchemaValidation) || + this.stationInfo.payloadSchemaValidation === true) + ) { + return false; + } return this.stationInfo.payloadSchemaValidation ?? true; }