repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Properly build once the firmwareUpgrade default values
[e-mobility-charging-stations-simulator.git]
/
src
/
charging-station
/
ocpp
/
OCPPResponseService.ts
diff --git
a/src/charging-station/ocpp/OCPPResponseService.ts
b/src/charging-station/ocpp/OCPPResponseService.ts
index 3f69655ec82dfaa573bb04b269e244c45c3a4102..7cedf888ed367399fa242a221f18384b8f11b00f 100644
(file)
--- a/
src/charging-station/ocpp/OCPPResponseService.ts
+++ b/
src/charging-station/ocpp/OCPPResponseService.ts
@@
-1,10
+1,10
@@
-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';
import ajvFormats from 'ajv-formats';
import OCPPError from '../../exception/OCPPError';
-import type { JsonType } from '../../types/JsonType';
-import type { RequestCommand } from '../../types/ocpp/Requests';
+import type { JsonObject, JsonType } from '../../types/JsonType';
+import type { OCPPVersion } from '../../types/ocpp/OCPPVersion';
+import type { IncomingRequestCommand, RequestCommand } from '../../types/ocpp/Requests';
import logger from '../../utils/Logger';
import type ChargingStation from '../ChargingStation';
import { OCPPServiceUtils } from './OCPPServiceUtils';
import logger from '../../utils/Logger';
import type ChargingStation from '../ChargingStation';
import { OCPPServiceUtils } from './OCPPServiceUtils';
@@
-13,10
+13,19
@@
const moduleName = 'OCPPResponseService';
export default abstract class OCPPResponseService {
private static instance: OCPPResponseService | null = null;
export default abstract class OCPPResponseService {
private static instance: OCPPResponseService | null = null;
+ private readonly version: OCPPVersion;
private readonly ajv: Ajv;
private readonly ajv: Ajv;
+ public abstract jsonIncomingRequestResponseSchemas: Map<
+ IncomingRequestCommand,
+ JSONSchemaType<JsonObject>
+ >;
- protected constructor() {
- this.ajv = new Ajv();
+ protected constructor(version: OCPPVersion) {
+ this.version = version;
+ this.ajv = new Ajv({
+ keywords: ['javaType'],
+ multipleOfPrecision: 2,
+ });
ajvFormats(this.ajv);
this.responseHandler.bind(this);
this.validateResponsePayload.bind(this);
ajvFormats(this.ajv);
this.responseHandler.bind(this);
this.validateResponsePayload.bind(this);
@@
-43,7
+52,7
@@
export default abstract class OCPPResponseService {
return true;
}
logger.error(
return true;
}
logger.error(
- `${chargingStation.logPrefix()} ${moduleName}.validateResponsePayload:
R
esponse PDU is invalid: %j`,
+ `${chargingStation.logPrefix()} ${moduleName}.validateResponsePayload:
Command '${commandName}' r
esponse PDU is invalid: %j`,
validate.errors
);
throw new OCPPError(
validate.errors
);
throw new OCPPError(