X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcharging-station%2Focpp%2FOCPPServiceUtils.ts;h=26b7a4ee5ccc4db42c48209eade339d08e2bf941;hb=1bf29f5be7c0ffe3d029e447ecb50da55bfd8948;hp=4b232033f70b1f71509e8034b4b6978a3a8194d8;hpb=268a74bb051fcbbad532fd833f0d8fd2b33b6c64;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index 4b232033..26b7a4ee 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -2,6 +2,7 @@ import fs from 'node:fs'; import type { DefinedError, ErrorObject, JSONSchemaType } from 'ajv'; +import { type ChargingStation, ChargingStationConfigurationUtils } from '../../charging-station'; import { BaseError } from '../../exception'; import { ChargePointErrorCode, @@ -23,12 +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 type { ChargingStation } from '../ChargingStation'; -import { ChargingStationConfigurationUtils } from '../ChargingStationConfigurationUtils'; +import { Constants, FileUtils, Utils, logger } from '../../utils'; export class OCPPServiceUtils { protected constructor() { @@ -170,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,