X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPServiceUtils.ts;h=f7a5d61ceb772f23d4da6b7fc5e394848ca52d8f;hb=a7bb184512dd064b5da4dc125d652b6b40ceffee;hp=9d410963ddd8dcf9210d10ae346ebc1f673acc6f;hpb=2896e06dc8d72adf7150b23c941079f622f6f37c;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index 9d410963..f7a5d61c 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -24,10 +24,7 @@ import { StandardParametersKey, type StatusNotificationRequest, } from '../../types'; -import { Constants } from '../../utils/Constants'; -import { FileUtils } from '../../utils/FileUtils'; -import { logger } from '../../utils/Logger'; -import { Utils } from '../../utils/Utils'; +import { Constants, FileUtils, Utils, logger } from '../../utils'; export class OCPPServiceUtils { protected constructor() { @@ -139,7 +136,7 @@ export class OCPPServiceUtils { if (obj[key] instanceof Date) { (obj as JsonObject)[key] = (obj[key] as Date).toISOString(); } else if (obj[key] !== null && typeof obj[key] === 'object') { - this.convertDateToISOString(obj[key] as T); + OCPPServiceUtils.convertDateToISOString(obj[key] as T); } } } @@ -169,6 +166,14 @@ export class OCPPServiceUtils { } } + public static startHeartbeatInterval(chargingStation: ChargingStation, interval: number): void { + if (!chargingStation.heartbeatSetInterval) { + chargingStation.startHeartbeat(); + } else if (chargingStation.getHeartbeatInterval() !== interval) { + chargingStation.restartHeartbeat(); + } + } + protected static parseJsonSchemaFile( filePath: string, ocppVersion: OCPPVersion,