build(deps-dev): apply updates
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPServiceUtils.ts
index 9d410963ddd8dcf9210d10ae346ebc1f673acc6f..f7a5d61ceb772f23d4da6b7fc5e394848ca52d8f 100644 (file)
@@ -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<T>(obj[key] as T);
+        OCPPServiceUtils.convertDateToISOString<T>(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<T extends JsonType>(
     filePath: string,
     ocppVersion: OCPPVersion,