protected constructor(ocppResponseService: OCPPResponseService) {
this.ocppResponseService = ocppResponseService;
+ this.ajv = new Ajv();
+ ajvFormats(this.ajv);
this.requestHandler.bind(this);
this.sendResponse.bind(this);
this.sendError.bind(this);
- this.ajv = new Ajv();
- ajvFormats(this.ajv);
+ this.internalSendMessage.bind(this);
+ this.buildMessageToSend.bind(this);
+ this.validateRequestPayload.bind(this);
}
public static getInstance<T extends OCPPRequestService>(
this: new (ocppResponseService: OCPPResponseService) => T,
ocppResponseService: OCPPResponseService
): T {
- if (!OCPPRequestService.instance) {
+ if (OCPPRequestService.instance === null) {
OCPPRequestService.instance = new this(ocppResponseService);
}
return OCPPRequestService.instance as T;
error: Error,
params: HandleErrorParams<EmptyObject> = { throwError: true }
): void {
- logger.error(chargingStation.logPrefix() + ' Request command %s error: %j', commandName, error);
+ logger.error(chargingStation.logPrefix() + ' Request command %s error:', commandName, error);
if (params?.throwError) {
throw error;
}