]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor: add unit suffixes to time-related constants and fix heartbeat unit mismatch
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 3 Apr 2026 20:06:40 +0000 (22:06 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 3 Apr 2026 20:06:40 +0000 (22:06 +0200)
- Rename 19 constants to include _MS or _SECONDS suffix (Constants, OCPPConstants, WorkerConstants)
- Remove redundant // Ms and // Seconds comments from definitions
- Fix pre-existing bug: resetLimits set HeartbeatInterval to 60000 seconds instead of 60
- Remove 97 redundant heartbeatInterval overrides in tests (mock default already correct)

62 files changed:
src/charging-station/AutomaticTransactionGenerator.ts
src/charging-station/Bootstrap.ts
src/charging-station/ChargingStation.ts
src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts
src/charging-station/ocpp/1.6/OCPP16ResponseService.ts
src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts
src/charging-station/ocpp/2.0/OCPP20VariableManager.ts
src/charging-station/ocpp/2.0/OCPP20VariableRegistry.ts
src/charging-station/ocpp/OCPPConstants.ts
src/charging-station/ocpp/OCPPRequestService.ts
src/utils/Configuration.ts
src/utils/Constants.ts
src/utils/Utils.ts
src/worker/WorkerConstants.ts
src/worker/index.ts
tests/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.test.ts
tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-TriggerMessage.test.ts
tests/charging-station/ocpp/1.6/OCPP16Integration-Transactions.test.ts
tests/charging-station/ocpp/1.6/OCPP16RequestService-CallChain.test.ts
tests/charging-station/ocpp/1.6/OCPP16ResponseService-SimpleHandlers.test.ts
tests/charging-station/ocpp/1.6/OCPP16TestUtils.ts
tests/charging-station/ocpp/2.0/OCPP20CertSigningRetryManager.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-CertificateSigned.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-ClearCache.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-CustomerInformation.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-DataTransfer.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-DeleteCertificate.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetBaseReport.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetInstalledCertificateIds.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetLog.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetTransactionStatus.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetVariables.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-InstallCertificate.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-MasterPass.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStartTransaction.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStopTransaction.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-SetNetworkProfile.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-SetVariables.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-TriggerMessage.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-UnlockConnector.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-UpdateFirmware.test.ts
tests/charging-station/ocpp/2.0/OCPP20Integration-Certificate.test.ts
tests/charging-station/ocpp/2.0/OCPP20Integration.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-CallChain.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-DataTransfer.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-FirmwareStatusNotification.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-ISO15118.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-LogStatusNotification.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-MeterValues.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-NotifyReport.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-SecurityEventNotification.test.ts
tests/charging-station/ocpp/2.0/OCPP20RequestService-SignCertificate.test.ts
tests/charging-station/ocpp/2.0/OCPP20ResponseService-BootNotification.test.ts
tests/charging-station/ocpp/2.0/OCPP20ResponseService-SimpleHandlers.test.ts
tests/charging-station/ocpp/2.0/OCPP20ResponseService-TransactionEvent.test.ts
tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-ReconnectDelay.test.ts
tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-StatusNotification.test.ts
tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent.test.ts
tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts
tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts
tests/charging-station/ocpp/OCPPServiceUtils-meterValues.test.ts
tests/utils/Utils.test.ts

index 12a0d5ea5f0dd7c4f553e231df7fda415e24ff3b..6a73c97e56b272f303d588ccdc967673254f57a4 100644 (file)
@@ -497,7 +497,7 @@ export class AutomaticTransactionGenerator {
         )
         logged = true
       }
-      await sleep(Constants.DEFAULT_ATG_WAIT_TIME)
+      await sleep(Constants.DEFAULT_ATG_WAIT_TIME_MS)
     }
   }
 
@@ -512,7 +512,7 @@ export class AutomaticTransactionGenerator {
         )
         logged = true
       }
-      await sleep(Constants.DEFAULT_ATG_WAIT_TIME)
+      await sleep(Constants.DEFAULT_ATG_WAIT_TIME_MS)
     }
   }
 
@@ -527,7 +527,7 @@ export class AutomaticTransactionGenerator {
         )
         logged = true
       }
-      await sleep(Constants.DEFAULT_ATG_WAIT_TIME)
+      await sleep(Constants.DEFAULT_ATG_WAIT_TIME_MS)
     }
   }
 }
index d82574c625b07b8241b1233928eb10cc837b6d4b..c9408cf0af0a3993f9d9162ad71bf00bc67c5a95 100644 (file)
@@ -586,13 +586,13 @@ export class Bootstrap extends EventEmitter implements IBootstrap {
     return await new Promise<string>((resolve, reject: (reason?: unknown) => void) => {
       const waitTimeout = setTimeout(() => {
         const timeoutMessage = `Timeout ${formatDurationMilliSeconds(
-          Constants.STOP_CHARGING_STATIONS_TIMEOUT
+          Constants.STOP_CHARGING_STATIONS_TIMEOUT_MS
         )} reached at stopping charging stations`
         logger.warn(
           `${this.logPrefix()} ${moduleName}.waitChargingStationsStopped: ${timeoutMessage}`
         )
         reject(new BaseError(timeoutMessage))
-      }, Constants.STOP_CHARGING_STATIONS_TIMEOUT)
+      }, Constants.STOP_CHARGING_STATIONS_TIMEOUT_MS)
       waitChargingStationEvents(
         this,
         ChargingStationWorkerMessageEvents.stopped,
index d98164b268d1db939ca5142ebad9e9536ad860c2..3f64f267375c19f30d00db6ee71ea4b4416cbde9 100644 (file)
@@ -447,10 +447,10 @@ export class ChargingStation extends EventEmitter {
     if (getConfigurationKey(this, StandardParametersKey.ConnectionTimeOut) != null) {
       return convertToInt(
         getConfigurationKey(this, StandardParametersKey.ConnectionTimeOut)?.value ??
-          Constants.DEFAULT_EV_CONNECTION_TIMEOUT
+          Constants.DEFAULT_EV_CONNECTION_TIMEOUT_SECONDS
       )
     }
-    return Constants.DEFAULT_EV_CONNECTION_TIMEOUT
+    return Constants.DEFAULT_EV_CONNECTION_TIMEOUT_SECONDS
   }
 
   /**
@@ -604,9 +604,9 @@ export class ChargingStation extends EventEmitter {
     }
     this.stationInfo?.autoRegister === false &&
       logger.warn(
-        `${this.logPrefix()} Heartbeat interval configuration key not set, using default value: ${Constants.DEFAULT_HEARTBEAT_INTERVAL.toString()}`
+        `${this.logPrefix()} Heartbeat interval configuration key not set, using default value: ${Constants.DEFAULT_HEARTBEAT_INTERVAL_MS.toString()}`
       )
-    return Constants.DEFAULT_HEARTBEAT_INTERVAL
+    return Constants.DEFAULT_HEARTBEAT_INTERVAL_MS
   }
 
   public getLocalAuthListEnabled (): boolean {
@@ -694,7 +694,7 @@ export class ChargingStation extends EventEmitter {
   public getWebSocketPingInterval (): number {
     return getConfigurationKey(this, StandardParametersKey.WebSocketPingInterval) != null
       ? convertToInt(getConfigurationKey(this, StandardParametersKey.WebSocketPingInterval)?.value)
-      : Constants.DEFAULT_WS_PING_INTERVAL
+      : Constants.DEFAULT_WS_PING_INTERVAL_SECONDS
   }
 
   public hasConnector (connectorId: number): boolean {
@@ -852,7 +852,7 @@ export class ChargingStation extends EventEmitter {
     params?: { closeOpened?: boolean; terminateOpened?: boolean }
   ): void {
     options = {
-      handshakeTimeout: secondsToMilliseconds(Constants.DEFAULT_WS_HANDSHAKE_TIMEOUT),
+      handshakeTimeout: secondsToMilliseconds(Constants.DEFAULT_WS_HANDSHAKE_TIMEOUT_SECONDS),
       ...this.stationInfo?.wsOptions,
       ...options,
     }
@@ -1150,8 +1150,8 @@ export class ChargingStation extends EventEmitter {
           try {
             await promiseWithTimeout(
               this.stopMessageSequence(reason, stopTransactions),
-              Constants.STOP_MESSAGE_SEQUENCE_TIMEOUT,
-              `Timeout ${formatDurationMilliSeconds(Constants.STOP_MESSAGE_SEQUENCE_TIMEOUT)} reached at stopping message sequence`
+              Constants.STOP_MESSAGE_SEQUENCE_TIMEOUT_MS,
+              `Timeout ${formatDurationMilliSeconds(Constants.STOP_MESSAGE_SEQUENCE_TIMEOUT_MS)} reached at stopping message sequence`
             )
           } catch (error: unknown) {
             logger.error(`${this.logPrefix()} Error while stopping message sequence:`, error)
@@ -1484,7 +1484,7 @@ export class ChargingStation extends EventEmitter {
         jitterPercent: 0.2,
         retryNumber: this.wsConnectionRetryCount,
       })
-      : secondsToMilliseconds(Constants.DEFAULT_WS_RECONNECT_DELAY)
+      : secondsToMilliseconds(Constants.DEFAULT_WS_RECONNECT_DELAY_SECONDS)
   }
 
   private getStationInfo (options?: ChargingStationOptions): ChargingStationInfo {
@@ -2099,7 +2099,7 @@ export class ChargingStation extends EventEmitter {
       addConfigurationKey(
         this,
         StandardParametersKey.ConnectionTimeOut,
-        Constants.DEFAULT_EV_CONNECTION_TIMEOUT.toString()
+        Constants.DEFAULT_EV_CONNECTION_TIMEOUT_SECONDS.toString()
       )
     }
     this.saveOcppConfiguration()
@@ -2331,8 +2331,8 @@ export class ChargingStation extends EventEmitter {
                 baseDelayMs:
                   this.bootNotificationResponse?.interval != null
                     ? secondsToMilliseconds(this.bootNotificationResponse.interval)
-                    : Constants.DEFAULT_BOOT_NOTIFICATION_INTERVAL,
-                jitterMs: Constants.DEFAULT_WS_RECONNECT_TIMEOUT_OFFSET,
+                    : Constants.DEFAULT_BOOT_NOTIFICATION_INTERVAL_MS,
+                jitterMs: Constants.DEFAULT_WS_RECONNECT_TIMEOUT_OFFSET_MS,
                 retryNumber: registrationRetryCount,
               })
             )
@@ -2375,8 +2375,8 @@ export class ChargingStation extends EventEmitter {
       ++this.wsConnectionRetryCount
       const reconnectDelay = this.getReconnectDelay()
       const reconnectTimeout =
-        reconnectDelay - Constants.DEFAULT_WS_RECONNECT_TIMEOUT_OFFSET > 0
-          ? reconnectDelay - Constants.DEFAULT_WS_RECONNECT_TIMEOUT_OFFSET
+        reconnectDelay - Constants.DEFAULT_WS_RECONNECT_TIMEOUT_OFFSET_MS > 0
+          ? reconnectDelay - Constants.DEFAULT_WS_RECONNECT_TIMEOUT_OFFSET_MS
           : 0
       logger.error(
         `${this.logPrefix()} WebSocket connection retry in ${formatDurationMilliSeconds(reconnectDelay)}, timeout ${formatDurationMilliSeconds(reconnectTimeout)}`
@@ -2594,7 +2594,7 @@ export class ChargingStation extends EventEmitter {
       if (!this.isWebSocketConnectionOpened() || isEmpty(this.messageQueue)) {
         this.clearIntervalFlushMessageBuffer()
       }
-    }, Constants.DEFAULT_MESSAGE_BUFFER_FLUSH_INTERVAL)
+    }, Constants.DEFAULT_MESSAGE_BUFFER_FLUSH_INTERVAL_MS)
   }
 
   private async startMessageSequence (ATGStopAbsoluteDuration?: boolean): Promise<void> {
index 902cbedb41729cd6cbe51bbae371f1b2780a2811..a2adb481455aff10b87d05ad684832c3138043bf 100644 (file)
@@ -419,7 +419,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
           )
           return key != null
             ? secondsToMilliseconds(convertToInt(key.value))
-            : Constants.DEFAULT_METER_VALUES_INTERVAL
+            : Constants.DEFAULT_METER_VALUES_INTERVAL_MS
         })()
     return await this.chargingStation.ocppRequestService.requestHandler<
       MeterValuesRequest,
index b60ce5e92fcfc9fdf085055f84abc96ca5f99b1d..d43330325776bd3f73ce22d5d7823b2cb1b32981 100644 (file)
@@ -451,7 +451,7 @@ export class OCPP16ResponseService extends OCPPResponseService {
         connectorId,
         configuredMeterValueSampleInterval != null
           ? secondsToMilliseconds(convertToInt(configuredMeterValueSampleInterval.value))
-          : Constants.DEFAULT_METER_VALUES_INTERVAL
+          : Constants.DEFAULT_METER_VALUES_INTERVAL_MS
       )
     } else {
       logger.warn(
index 0b949562298cad1fd1eb99716ace52b10c82e0c0..7dc41c2bf1a27d04ba3898b90d1efb74f00695a7 100644 (file)
@@ -430,7 +430,7 @@ export class OCPP20ServiceUtils {
       chargingStation,
       OCPP20ComponentName.SampledDataCtrlr,
       OCPP20RequiredVariableName.TxUpdatedInterval,
-      Constants.DEFAULT_TX_UPDATED_INTERVAL
+      Constants.DEFAULT_TX_UPDATED_INTERVAL_SECONDS
     )
   }
 
index 6a20a04f10cbfe863c768e96167db680678cf349..e8093ed801445a5de4881d95cd51abc69c9be22d 100644 (file)
@@ -678,7 +678,7 @@ export class OCPP20VariableManager {
       variableMetadata.variable === (OCPP20RequiredVariableName.TxUpdatedInterval as string) &&
       !value
     ) {
-      value = Constants.DEFAULT_TX_UPDATED_INTERVAL.toString()
+      value = Constants.DEFAULT_TX_UPDATED_INTERVAL_SECONDS.toString()
     }
 
     value = applyPostProcess(chargingStation, variableMetadata, value)
index c2687bd4f81ecee6fd2564875092f5e71a412422..efafaab8fb0fb4b82c3d06e2cc0d423daababb77 100644 (file)
@@ -603,7 +603,7 @@ export const VARIABLE_REGISTRY: Record<string, VariableMetadata> = {
     allowZero: true,
     component: OCPP20ComponentName.ChargingStation,
     dataType: DataEnumType.integer,
-    defaultValue: Constants.DEFAULT_WS_PING_INTERVAL.toString(),
+    defaultValue: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS.toString(),
     description:
       'Interval in seconds between WebSocket ping (keep-alive) frames. 0 disables pings.',
     max: 3600,
@@ -1465,7 +1465,7 @@ export const VARIABLE_REGISTRY: Record<string, VariableMetadata> = {
   )]: {
     component: OCPP20ComponentName.OCPPCommCtrlr,
     dataType: DataEnumType.integer,
-    defaultValue: millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL).toString(),
+    defaultValue: millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL_MS).toString(),
     description: 'Interval between Heartbeat messages.',
     max: 86400,
     maxLength: 10,
@@ -1523,7 +1523,7 @@ export const VARIABLE_REGISTRY: Record<string, VariableMetadata> = {
     allowZero: true,
     component: OCPP20ComponentName.OCPPCommCtrlr,
     dataType: DataEnumType.integer,
-    defaultValue: Constants.DEFAULT_WS_PING_INTERVAL.toString(),
+    defaultValue: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS.toString(),
     description:
       '0 disables client side websocket Ping/Pong. Positive values are interpreted as number of seconds between pings. Negative values are not allowed.',
     min: 0,
@@ -1594,7 +1594,7 @@ export const VARIABLE_REGISTRY: Record<string, VariableMetadata> = {
   )]: {
     component: OCPP20ComponentName.OCPPCommCtrlr,
     dataType: DataEnumType.integer,
-    defaultValue: Constants.DEFAULT_MESSAGE_TIMEOUT.toString(),
+    defaultValue: Constants.DEFAULT_MESSAGE_TIMEOUT_SECONDS.toString(),
     description: 'Timeout (in seconds) waiting for responses to general OCPP messages.',
     instance: 'Default',
     max: 3600,
@@ -1904,7 +1904,7 @@ export const VARIABLE_REGISTRY: Record<string, VariableMetadata> = {
   )]: {
     component: OCPP20ComponentName.SampledDataCtrlr,
     dataType: DataEnumType.integer,
-    defaultValue: Constants.DEFAULT_TX_UPDATED_INTERVAL.toString(),
+    defaultValue: Constants.DEFAULT_TX_UPDATED_INTERVAL_SECONDS.toString(),
     description:
       'Interval between sampling of metering data for Updated TransactionEvent messages.',
     max: 3600,
@@ -2351,7 +2351,7 @@ export const VARIABLE_REGISTRY: Record<string, VariableMetadata> = {
   [buildRegistryKey(OCPP20ComponentName.TxCtrlr, OCPP20RequiredVariableName.EVConnectionTimeOut)]: {
     component: OCPP20ComponentName.TxCtrlr,
     dataType: DataEnumType.integer,
-    defaultValue: Constants.DEFAULT_EV_CONNECTION_TIMEOUT.toString(),
+    defaultValue: Constants.DEFAULT_EV_CONNECTION_TIMEOUT_SECONDS.toString(),
     description: 'Timeout for EV to establish connection.',
     max: 3600,
     maxLength: 10,
index 0583649b2002f82124b278a9213b4243291c282f..a79edf6c6e8e0e43453ec44500bf0d40a8b47f5a 100644 (file)
@@ -159,7 +159,7 @@ export class OCPPConstants {
     status: TriggerMessageStatus.REJECTED,
   })
 
-  static readonly OCPP_WEBSOCKET_TIMEOUT = 60000 // Ms
+  static readonly OCPP_WEBSOCKET_TIMEOUT_MS = 60000
 
   static readonly UNKNOWN_OCPP_COMMAND = 'unknown OCPP command' as
     | IncomingRequestCommand
index 1278e14ed8778da14677302af6417619eeb3657f..771d8dd1b28cb7c9abeb4aa346bde0be6a70de7c 100644 (file)
@@ -393,7 +393,7 @@ export abstract class OCPPRequestService {
               new OCPPError(
                 ErrorType.GENERIC_ERROR,
                 `Timeout ${formatDurationMilliSeconds(
-                  OCPPConstants.OCPP_WEBSOCKET_TIMEOUT
+                  OCPPConstants.OCPP_WEBSOCKET_TIMEOUT_MS
                 )} reached for ${
                   params.skipBufferingOnError === false ? '' : 'non '
                 }buffered message id '${messageId}' with content '${messageToSend}'`,
@@ -401,7 +401,7 @@ export abstract class OCPPRequestService {
                 messagePayload instanceof OCPPError ? messagePayload.details : undefined
               )
             )
-          }, OCPPConstants.OCPP_WEBSOCKET_TIMEOUT)
+          }, OCPPConstants.OCPP_WEBSOCKET_TIMEOUT_MS)
           chargingStation.wsConnection?.send(messageToSend, (error?: Error) => {
             PerformanceStatistics.endMeasure(commandName, beginId)
             clearTimeout(sendTimeout)
index 39e95297a313cef8a99484160afb70d1774e8737..deb6d3fd3fc5e9de331044869d04f282daf53b4d 100644 (file)
@@ -20,10 +20,10 @@ import {
 } from '../types/index.js'
 import {
   checkWorkerProcessType,
-  DEFAULT_ELEMENT_ADD_DELAY,
+  DEFAULT_ELEMENT_ADD_DELAY_MS,
   DEFAULT_POOL_MAX_SIZE,
   DEFAULT_POOL_MIN_SIZE,
-  DEFAULT_WORKER_START_DELAY,
+  DEFAULT_WORKER_START_DELAY_MS,
   WorkerProcessType,
 } from '../worker/index.js'
 import { checkDeprecatedConfigurationKeys } from './ConfigurationMigration.js'
@@ -72,16 +72,16 @@ const defaultLogConfiguration: LogConfiguration = {
   format: 'simple',
   level: 'info',
   rotate: true,
-  statisticsInterval: Constants.DEFAULT_LOG_STATISTICS_INTERVAL,
+  statisticsInterval: Constants.DEFAULT_LOG_STATISTICS_INTERVAL_SECONDS,
 }
 
 const defaultWorkerConfiguration: WorkerConfiguration = {
-  elementAddDelay: DEFAULT_ELEMENT_ADD_DELAY,
+  elementAddDelay: DEFAULT_ELEMENT_ADD_DELAY_MS,
   elementsPerWorker: 'auto',
   poolMaxSize: DEFAULT_POOL_MAX_SIZE,
   poolMinSize: DEFAULT_POOL_MIN_SIZE,
   processType: WorkerProcessType.workerSet,
-  startDelay: DEFAULT_WORKER_START_DELAY,
+  startDelay: DEFAULT_WORKER_START_DELAY_MS,
 }
 
 // eslint-disable-next-line @typescript-eslint/no-extraneous-class
index 1dbde98f0077ed802ae7131097a50d957b3756cf..5953ec6311a8c358c60425694710195c8b11968b 100644 (file)
@@ -20,7 +20,7 @@ export class Constants {
       stopAfterHours: 0.25,
     })
 
-  static readonly DEFAULT_ATG_WAIT_TIME = 1000 // Ms
+  static readonly DEFAULT_ATG_WAIT_TIME_MS = 1000
 
   static readonly DEFAULT_AUTH_CACHE_CLEANUP_INTERVAL_SECONDS = 300
 
@@ -32,25 +32,25 @@ export class Constants {
 
   static readonly DEFAULT_AUTH_CACHE_TTL_SECONDS = 3600
 
-  static readonly DEFAULT_BOOT_NOTIFICATION_INTERVAL = 60000 // Ms
+  static readonly DEFAULT_BOOT_NOTIFICATION_INTERVAL_MS = 60000
 
   static readonly DEFAULT_CIRCULAR_BUFFER_CAPACITY = 386
 
-  static readonly DEFAULT_EV_CONNECTION_TIMEOUT = 180 // Seconds
+  static readonly DEFAULT_EV_CONNECTION_TIMEOUT_SECONDS = 180
 
   static readonly DEFAULT_FLUCTUATION_PERCENT = 5
 
   static readonly DEFAULT_HASH_ALGORITHM = 'sha384'
 
-  static readonly DEFAULT_HEARTBEAT_INTERVAL = 60000 // Ms
+  static readonly DEFAULT_HEARTBEAT_INTERVAL_MS = 60000
 
-  static readonly DEFAULT_LOG_STATISTICS_INTERVAL = 60 // Seconds
+  static readonly DEFAULT_LOG_STATISTICS_INTERVAL_SECONDS = 60
 
-  static readonly DEFAULT_MESSAGE_BUFFER_FLUSH_INTERVAL = 60000 // Ms
+  static readonly DEFAULT_MESSAGE_BUFFER_FLUSH_INTERVAL_MS = 60000
 
-  static readonly DEFAULT_MESSAGE_TIMEOUT = 30 // Seconds
+  static readonly DEFAULT_MESSAGE_TIMEOUT_SECONDS = 30
 
-  static readonly DEFAULT_METER_VALUES_INTERVAL = 60000 // Ms
+  static readonly DEFAULT_METER_VALUES_INTERVAL_MS = 60000
 
   static readonly DEFAULT_PERFORMANCE_DIRECTORY = 'performance'
 
@@ -83,7 +83,7 @@ export class Constants {
     reconnectExponentialDelay: false,
     registrationMaxRetries: -1,
     remoteAuthorization: true,
-    resetTime: 30000, // Ms
+    resetTime: 30000,
     stationInfoPersistentConfiguration: true,
     stopTransactionsOnStopped: true,
     supervisionUrlOcppConfiguration: false,
@@ -92,15 +92,15 @@ export class Constants {
     useConnectorId0: true,
   })
 
-  static readonly DEFAULT_TX_UPDATED_INTERVAL = 30 // Seconds
+  static readonly DEFAULT_TX_UPDATED_INTERVAL_SECONDS = 30
 
   static readonly DEFAULT_UI_SERVER_HOST = 'localhost'
   static readonly DEFAULT_UI_SERVER_PORT = 8080
 
-  static readonly DEFAULT_WS_HANDSHAKE_TIMEOUT = 30 // Seconds
-  static readonly DEFAULT_WS_PING_INTERVAL = 30 // Seconds
-  static readonly DEFAULT_WS_RECONNECT_DELAY = 30 // Seconds
-  static readonly DEFAULT_WS_RECONNECT_TIMEOUT_OFFSET = 1000 // Ms
+  static readonly DEFAULT_WS_HANDSHAKE_TIMEOUT_SECONDS = 30
+  static readonly DEFAULT_WS_PING_INTERVAL_SECONDS = 30
+  static readonly DEFAULT_WS_RECONNECT_DELAY_SECONDS = 30
+  static readonly DEFAULT_WS_RECONNECT_TIMEOUT_OFFSET_MS = 1000
 
   static readonly EMPTY_FROZEN_OBJECT = Object.freeze({})
 
@@ -112,11 +112,11 @@ export class Constants {
 
   // Node.js setInterval/setTimeout maximum safe delay value (2^31-1 ms ≈ 24.8 days)
   // Values exceeding this limit cause Node.js to reset the delay to 1ms
-  static readonly MAX_SETINTERVAL_DELAY = 2147483647 // Ms
+  static readonly MAX_SETINTERVAL_DELAY_MS = 2147483647
 
   static readonly PERFORMANCE_RECORDS_TABLE = 'performance_records'
 
-  static readonly STOP_CHARGING_STATIONS_TIMEOUT = 60000 // Ms
+  static readonly STOP_CHARGING_STATIONS_TIMEOUT_MS = 60000
 
-  static readonly STOP_MESSAGE_SEQUENCE_TIMEOUT = 30000 // Ms
+  static readonly STOP_MESSAGE_SEQUENCE_TIMEOUT_MS = 30000
 }
index b7dbeef9ff85e1d9adf7ca291df5b509b2917d81..88d58011481f33912fccbcbf42de22897368f291 100644 (file)
@@ -425,7 +425,7 @@ export const computeExponentialBackOffDelay = (options: {
  * @see https://nodejs.org/api/timers.html#settimeoutcallback-delay-args
  */
 export const clampToSafeTimerValue = (delayMs: number): number => {
-  return Math.min(Math.max(0, delayMs), Constants.MAX_SETINTERVAL_DELAY)
+  return Math.min(Math.max(0, delayMs), Constants.MAX_SETINTERVAL_DELAY_MS)
 }
 
 /**
index 5f4084f57b123459b8d107fa4c15debb2fb5c84e..b7460257ed7f3ac0f8c7ccf3b860aae5d1d46c63 100644 (file)
@@ -10,8 +10,8 @@ export const EMPTY_FUNCTION = Object.freeze(() => {
 
 export const workerSetVersion = '1.0.1'
 
-export const DEFAULT_ELEMENT_ADD_DELAY = 0
-export const DEFAULT_WORKER_START_DELAY = 500
+export const DEFAULT_ELEMENT_ADD_DELAY_MS = 0
+export const DEFAULT_WORKER_START_DELAY_MS = 500
 export const DEFAULT_POOL_MIN_SIZE = Math.max(1, Math.floor(availableParallelism() / 2))
 export const DEFAULT_POOL_MAX_SIZE = Math.max(
   DEFAULT_POOL_MIN_SIZE,
@@ -28,10 +28,10 @@ export const DEFAULT_POOL_OPTIONS: Readonly<ThreadPoolOptions> = Object.freeze({
 })
 
 export const DEFAULT_WORKER_OPTIONS: Readonly<WorkerOptions> = Object.freeze({
-  elementAddDelay: DEFAULT_ELEMENT_ADD_DELAY,
+  elementAddDelay: DEFAULT_ELEMENT_ADD_DELAY_MS,
   elementsPerWorker: DEFAULT_ELEMENTS_PER_WORKER,
   poolMaxSize: DEFAULT_POOL_MAX_SIZE,
   poolMinSize: DEFAULT_POOL_MIN_SIZE,
   poolOptions: DEFAULT_POOL_OPTIONS,
-  workerStartDelay: DEFAULT_WORKER_START_DELAY,
+  workerStartDelay: DEFAULT_WORKER_START_DELAY_MS,
 })
index 003081708ff329121f2750789468734dc9c7af9c..16740ed93c6a57339122aad2ebf489b75a1cb861 100644 (file)
@@ -1,10 +1,10 @@
 export type { WorkerAbstract } from './WorkerAbstract.js'
 export {
-  DEFAULT_ELEMENT_ADD_DELAY,
+  DEFAULT_ELEMENT_ADD_DELAY_MS,
   DEFAULT_ELEMENTS_PER_WORKER,
   DEFAULT_POOL_MAX_SIZE,
   DEFAULT_POOL_MIN_SIZE,
-  DEFAULT_WORKER_START_DELAY,
+  DEFAULT_WORKER_START_DELAY_MS,
 } from './WorkerConstants.js'
 export { WorkerFactory } from './WorkerFactory.js'
 export {
index b92fcc840139faae84feead92246d2cdb0297885..71da1cb889562e51b04bbc68dcd4f456f6f21b3d 100644 (file)
@@ -181,9 +181,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return SUCCESS for SIGN_CERTIFICATE with Accepted status', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -200,9 +199,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return FAILURE for SIGN_CERTIFICATE with Rejected status', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -221,9 +219,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return SUCCESS for GET_15118_EV_CERTIFICATE with Accepted status', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -240,9 +237,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return FAILURE for GET_15118_EV_CERTIFICATE with Failed status', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -261,9 +257,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return SUCCESS for GET_CERTIFICATE_STATUS with Accepted status', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -280,9 +275,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return FAILURE for GET_CERTIFICATE_STATUS with Failed status', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -301,9 +295,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return SUCCESS for LOG_STATUS_NOTIFICATION with empty response', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -320,9 +313,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return FAILURE for LOG_STATUS_NOTIFICATION with non-empty response', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -339,9 +331,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return SUCCESS for NOTIFY_CUSTOMER_INFORMATION with empty response', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -358,9 +349,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return FAILURE for NOTIFY_CUSTOMER_INFORMATION with non-empty response', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -377,9 +367,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return SUCCESS for NOTIFY_REPORT with empty response', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -396,9 +385,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return FAILURE for NOTIFY_REPORT with non-empty response', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -415,9 +403,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return SUCCESS for SECURITY_EVENT_NOTIFICATION with empty response', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -434,9 +421,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return FAILURE for SECURITY_EVENT_NOTIFICATION with non-empty response', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -455,9 +441,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return SUCCESS for TRANSACTION_EVENT with empty response', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -475,9 +460,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return SUCCESS for TRANSACTION_EVENT with no idTokenInfo', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -495,9 +479,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return SUCCESS for TRANSACTION_EVENT with Accepted idTokenInfo', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
@@ -514,9 +497,8 @@ await describe('ChargingStationWorkerBroadcastChannel', async () => {
     await it('should return FAILURE for TRANSACTION_EVENT with Blocked idTokenInfo', () => {
       const { station } = createMockChargingStation({
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       instance = new ChargingStationWorkerBroadcastChannel(station)
index d2ec110c74a83ab8554d0556475dcfcaefd158c0..861c8fab971911165d00a1541e0591372fde7a49 100644 (file)
@@ -276,14 +276,13 @@ await describe('OCPP16IncomingRequestService — TriggerMessage', async () => {
       const { station: rejectStation } = createMockChargingStation({
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 2,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         ocppRequestService: {
           requestHandler: rejectingMock,
         },
         stationInfo: {
           ocppVersion: OCPPVersion.VERSION_16,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       const request: OCPP16TriggerMessageRequest = {
index 1e5fc22972dd58d69ba43f29bdaa4f87ffcd204c..93903de91a7253f8c4757a30b4cd500705d26d0b 100644 (file)
@@ -55,7 +55,6 @@ function createIntegrationContext (): {
   const { station } = createMockChargingStation({
     baseName: TEST_CHARGING_STATION_BASE_NAME,
     connectorsCount: 2,
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     ocppRequestService: {
       requestHandler: () => Promise.resolve({}),
     },
@@ -63,7 +62,7 @@ function createIntegrationContext (): {
       ocppStrictCompliance: false,
       ocppVersion: OCPPVersion.VERSION_16,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
 
   // IncomingRequest service (handles RemoteStart/Stop from CSMS)
index f89a49e1a41396b12d6633d602fb38a61d373da7..defd32eecf47f074342d19af5ab74cf43a1d5068 100644 (file)
@@ -44,7 +44,6 @@ await describe('OCPP 1.6 Request Call Chain — requestHandler → buildRequestP
     const { station: mockStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 2,
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       ocppRequestService: {
         requestHandler: async () => Promise.resolve({} as JsonType),
       },
@@ -52,7 +51,7 @@ await describe('OCPP 1.6 Request Call Chain — requestHandler → buildRequestP
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_16,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
   })
index 487ef5831de7e3ef0e3fa397787cf56ca572af0e..fa540be7439750ea79a5348dda4f50cfaad4b5d9 100644 (file)
@@ -38,12 +38,11 @@ function createSimpleHandlerStation (): MockChargingStation {
   const { station } = createMockChargingStation({
     baseName: TEST_CHARGING_STATION_BASE_NAME,
     connectorsCount: 1,
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     stationInfo: {
       ocppStrictCompliance: false,
       ocppVersion: OCPPVersion.VERSION_16,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
   return station as MockChargingStation
 }
index 2d1043e580a1e3b45806e21dc6a36af5a045c883..490be5c45ffb1702fdff3a61b6e0cb54591a98ae 100644 (file)
@@ -4,6 +4,7 @@
  *   and configuration key helpers for OCPP 1.6 unit and integration tests.
  */
 
+import { millisecondsToSeconds } from 'date-fns'
 import { mock } from 'node:test'
 
 import type { ChargingStation } from '../../../../src/charging-station/index.js'
@@ -139,13 +140,12 @@ export function createOCPP16IncomingRequestTestContext (
   const { station } = createMockChargingStation({
     baseName,
     connectorsCount,
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     stationInfo: {
       ocppStrictCompliance: false,
       ocppVersion: OCPPVersion.VERSION_16,
       ...stationInfo,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
 
   return { incomingRequestService, station, testableService }
@@ -164,7 +164,6 @@ export function createOCPP16ListenerStation (baseName: string): {
   const { station } = createMockChargingStation({
     baseName,
     connectorsCount: 2,
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     ocppRequestService: {
       requestHandler: requestHandlerMock,
     },
@@ -172,7 +171,7 @@ export function createOCPP16ListenerStation (baseName: string): {
       ocppStrictCompliance: false,
       ocppVersion: OCPPVersion.VERSION_16,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
   return { requestHandlerMock, station }
 }
@@ -194,13 +193,12 @@ export function createOCPP16RequestTestContext (
   const { station } = createMockChargingStation({
     baseName,
     connectorsCount: 2,
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     stationInfo: {
       ocppStrictCompliance: false,
       ocppVersion: OCPPVersion.VERSION_16,
       ...stationInfo,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
 
   return { requestService, station, testableRequestService }
@@ -225,13 +223,12 @@ export function createOCPP16ResponseTestContext (
   const { station } = createMockChargingStation({
     baseName,
     connectorsCount: 2,
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     stationInfo: {
       ocppStrictCompliance: false,
       ocppVersion: OCPPVersion.VERSION_16,
       ...stationInfo,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
 
   return { responseService, station }
@@ -255,14 +252,13 @@ export function createStandardStation (
   const { station } = createMockChargingStation({
     baseName,
     connectorsCount,
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     stationInfo: {
       ocppStrictCompliance: false,
       ocppVersion: OCPPVersion.VERSION_16,
       resetTime: 5000,
       ...stationInfo,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
 
   return station as MockChargingStation
@@ -327,7 +323,7 @@ export function resetLimits (chargingStation: ChargingStation) {
   upsertConfigurationKey(
     chargingStation,
     OCPP16StandardParametersKey.HeartbeatInterval,
-    Constants.DEFAULT_HEARTBEAT_INTERVAL.toString()
+    millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL_MS).toString()
   )
 }
 
index b06ce77561fc4d4a9a9bf32cf5f3ce583d7a09ec..fe12d5a11e2d794b0358a00da53ae846faada819 100644 (file)
@@ -44,14 +44,13 @@ await describe('OCPP20CertSigningRetryManager', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 1,
       evseConfiguration: { evsesCount: 1 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       ocppRequestService: {
         requestHandler: requestHandlerMock,
       },
       stationInfo: {
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = newStation
 
index c80a3a44a36fdeef01632d2e4e6ef6b444e770da..f22f3e2b861b419378ecc455193b50687b16a7a4 100644 (file)
@@ -49,12 +49,11 @@ await describe('I04 - CertificateSigned', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
     stationWithCertManager = createStationWithCertificateManager(
@@ -182,12 +181,11 @@ await describe('I04 - CertificateSigned', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 1,
         evseConfiguration: { evsesCount: 1 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: {
           ocppStrictCompliance: false,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       // certificateManager is not set on this station (not present by default)
index 3b612a31cb8e983a604889f3f49fd6f4b4699c8a..336936199758ad72d8d1d80fbb59ead8d259eddf 100644 (file)
@@ -31,12 +31,11 @@ await describe('C11 - Clear Authorization Data in Authorization Cache', async ()
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
     incomingRequestService = new OCPP20IncomingRequestService()
index a6063f8f526e35302faec898010be363d79dc6d4..ea8d0eb9647dbca51e21b5a4f935b504f08df256 100644 (file)
@@ -33,12 +33,11 @@ await describe('N32 - CustomerInformation', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
     testableService = createTestableIncomingRequestService(new OCPP20IncomingRequestService())
index dc801aeb1f96eb181a7d057b314629044df932ce..bd6d895d71636498fb25547b5f38d5e93adc084b 100644 (file)
@@ -25,12 +25,11 @@ await describe('P01 - DataTransfer', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
     testableService = createTestableIncomingRequestService(new OCPP20IncomingRequestService())
index 9ca69b2f76a4dd1a7a0a8921e90c32645ae203c1..131818a87655453af109e03616c7496834371dc7 100644 (file)
@@ -56,12 +56,11 @@ await describe('I04 - DeleteCertificate', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
 
@@ -177,12 +176,11 @@ await describe('I04 - DeleteCertificate', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 3,
         evseConfiguration: { evsesCount: 3 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: {
           ocppStrictCompliance: false,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       const stationNoCertManager =
index 2bfdc5b00bc48e68fd33de35b178ee184b12c583..954bf0e2c964b03bb7ec4951fd0183ec0dad3446 100644 (file)
@@ -54,18 +54,17 @@ await describe('B07 - Get Base Report', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       ocppConfiguration: {
         configurationKey: [
           {
             key: StandardParametersKey.HeartbeatInterval,
             readonly: false,
-            value: millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL).toString(),
+            value: millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL_MS).toString(),
           },
           {
             key: StandardParametersKey.MeterValueSampleInterval,
             readonly: false,
-            value: millisecondsToSeconds(Constants.DEFAULT_METER_VALUES_INTERVAL).toString(),
+            value: millisecondsToSeconds(Constants.DEFAULT_METER_VALUES_INTERVAL_MS).toString(),
           },
         ],
       },
@@ -77,7 +76,7 @@ await describe('B07 - Get Base Report', async () => {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
 
index 51e38d7f41317037225acb461cf691f251cb4644..f9f32bfcc63f90957db206fa78f2cfbd566e45a2 100644 (file)
@@ -40,12 +40,11 @@ await describe('I04 - GetInstalledCertificateIds', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
 
@@ -239,12 +238,11 @@ await describe('I04 - GetInstalledCertificateIds', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 3,
         evseConfiguration: { evsesCount: 3 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: {
           ocppStrictCompliance: false,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       // Explicitly set to null/undefined
index b6ba97157a0f68a5734b5d4c9944717e17511469..0a896fbe0a8b718ec634f3715ce1a50cdb10eabb 100644 (file)
@@ -39,12 +39,11 @@ await describe('K01 - GetLog', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 1,
       evseConfiguration: { evsesCount: 1 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
     testableService = createTestableIncomingRequestService(new OCPP20IncomingRequestService())
index 7f9ed90412e917d06779afe0d0949596c952c9ba..9e0ea95d5f0249689a7ec7f5166193c81d184dab 100644 (file)
@@ -28,12 +28,11 @@ await describe('D14 - GetTransactionStatus', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
     testableService = createTestableIncomingRequestService(new OCPP20IncomingRequestService())
index 6789d323e378409319fe0feb6fc508a5881deb3a..52cdfdfe24e738ba24f9683e9090dbf20aa55e85 100644 (file)
@@ -45,12 +45,11 @@ await describe('B06 - Get Variables', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = newStation
     incomingRequestService = new OCPP20IncomingRequestService()
@@ -91,7 +90,7 @@ await describe('B06 - Get Variables', async () => {
     assert.strictEqual(firstResult.attributeType, AttributeEnumType.Actual)
     assert.strictEqual(
       firstResult.attributeValue,
-      millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL).toString()
+      millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL_MS).toString()
     )
     assert.strictEqual(firstResult.component.name, OCPP20ComponentName.OCPPCommCtrlr)
     assert.strictEqual(firstResult.variable.name, OCPP20OptionalVariableName.HeartbeatInterval)
@@ -101,7 +100,10 @@ await describe('B06 - Get Variables', async () => {
     const secondResult = response.getVariableResult[1]
     assert.strictEqual(secondResult.attributeStatus, GetVariableStatusEnumType.Accepted)
     assert.strictEqual(secondResult.attributeType, AttributeEnumType.Actual)
-    assert.strictEqual(secondResult.attributeValue, Constants.DEFAULT_WS_PING_INTERVAL.toString())
+    assert.strictEqual(
+      secondResult.attributeValue,
+      Constants.DEFAULT_WS_PING_INTERVAL_SECONDS.toString()
+    )
     assert.strictEqual(secondResult.component.name, OCPP20ComponentName.ChargingStation)
     assert.strictEqual(secondResult.variable.name, OCPP20OptionalVariableName.WebSocketPingInterval)
     assert.strictEqual(secondResult.attributeStatusInfo, undefined)
index 1bef26db7989f06b913e7646c050c673d12edcd4..4793d4e8a0a1ba0ad77300559de8f54528e0e363 100644 (file)
@@ -47,12 +47,11 @@ await describe('I03 - InstallCertificate', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     mockStation = initialStation
 
index bd30481beabfbcfa216f098cdef291900fc6c6f6..c9ee625c46f5f540a64d90b0b3d3d84e5ef17d2a 100644 (file)
@@ -42,7 +42,6 @@ await describe('C12.FR.09 - MasterPassGroupId Check', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       ocppRequestService: {
         requestHandler: async () => Promise.resolve({}),
       },
@@ -50,7 +49,7 @@ await describe('C12.FR.09 - MasterPassGroupId Check', async () => {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     mockStation = station
     const incomingRequestService = new OCPP20IncomingRequestService()
index ea4e6d945ec97950b38c1f3ebad41b80f608f685..4eea501f810dfee6a8ed1efadb8c46119adf2939 100644 (file)
@@ -63,7 +63,6 @@ await describe('F01 & F02 - Remote Start Transaction', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       ocppRequestService: {
         requestHandler: async () => Promise.resolve({}),
       },
@@ -71,7 +70,7 @@ await describe('F01 & F02 - Remote Start Transaction', async () => {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     mockStation = station
     incomingRequestService = new OCPP20IncomingRequestService()
@@ -194,7 +193,6 @@ await describe('F01 & F02 - Remote Start Transaction', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       ocppRequestService: {
         requestHandler: async () => Promise.resolve({}),
       },
@@ -202,7 +200,7 @@ await describe('F01 & F02 - Remote Start Transaction', async () => {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
 
     const stationId = spyChargingStation.stationInfo?.chargingStationId ?? 'unknown'
@@ -682,7 +680,6 @@ await describe('F01 & F02 - Remote Start Transaction', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME + '-FAIL-START',
         connectorsCount: 1,
         evseConfiguration: { evsesCount: 1 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         ocppRequestService: {
           requestHandler: async (_chargingStation: unknown, commandName: unknown) => {
             if (commandName === OCPP20RequestCommand.TRANSACTION_EVENT) {
@@ -696,7 +693,7 @@ await describe('F01 & F02 - Remote Start Transaction', async () => {
           ocppStrictCompliance: false,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       const failStationId = failStation.stationInfo?.chargingStationId ?? 'unknown'
index d2029e2d7addd71da1df27c476f524fc444a82fe..45ec00276de25bfa44863917278ce9a15e02ae98 100644 (file)
@@ -303,7 +303,6 @@ await describe('F03 - Remote Stop Transaction', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME + '-FAIL',
         connectorsCount: 1,
         evseConfiguration: { evsesCount: 1 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         ocppRequestService: {
           requestHandler: async (_chargingStation: unknown, commandName: unknown) => {
             if (commandName === OCPP20RequestCommand.TRANSACTION_EVENT) {
@@ -317,7 +316,7 @@ await describe('F03 - Remote Stop Transaction', async () => {
           ocppStrictCompliance: false,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       const failStationId = failStation.stationInfo?.chargingStationId ?? 'unknown'
index 7191b61f642df9cc78c2eec0057045c38c9081bc..525bc75b6ea95ecab342ed66cf81c81bf6e89537 100644 (file)
@@ -33,12 +33,11 @@ await describe('B43 - SetNetworkProfile', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
     testableService = createTestableIncomingRequestService(new OCPP20IncomingRequestService())
index 71261d5926bd1d94c88668123232c3490aa611ab..487bf2f9512b011e0589d224b1683943c2b271e1 100644 (file)
@@ -51,12 +51,11 @@ await describe('B05 - Set Variables', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     mockStation = station
     incomingRequestService = new OCPP20IncomingRequestService()
@@ -75,14 +74,14 @@ await describe('B05 - Set Variables', async () => {
       setVariableData: [
         {
           attributeType: AttributeEnumType.Actual,
-          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL + 1).toString(),
+          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL_SECONDS + 1).toString(),
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20OptionalVariableName.WebSocketPingInterval },
         },
         {
           attributeType: AttributeEnumType.Actual,
           attributeValue: (
-            millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL) + 1
+            millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL_MS) + 1
           ).toString(),
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20OptionalVariableName.HeartbeatInterval },
@@ -214,7 +213,7 @@ await describe('B05 - Set Variables', async () => {
       setVariableData: [
         // Accepted
         {
-          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL + 3).toString(),
+          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL_SECONDS + 3).toString(),
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20OptionalVariableName.WebSocketPingInterval },
         },
@@ -234,7 +233,7 @@ await describe('B05 - Set Variables', async () => {
         // Unsupported attribute type (WebSocketPingInterval)
         {
           attributeType: AttributeEnumType.Target,
-          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL + 10).toString(),
+          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL_SECONDS + 10).toString(),
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20OptionalVariableName.WebSocketPingInterval },
         },
@@ -274,7 +273,7 @@ await describe('B05 - Set Variables', async () => {
       setVariableData: [
         {
           attributeType: AttributeEnumType.Target,
-          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL + 6).toString(),
+          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL_SECONDS + 6).toString(),
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20OptionalVariableName.WebSocketPingInterval },
         },
@@ -310,8 +309,8 @@ await describe('B05 - Set Variables', async () => {
 
   // FR: B07.FR.10
   await it('should persist HeartbeatInterval and WebSocketPingInterval after setting', () => {
-    const hbNew = (millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL) + 20).toString()
-    const wsNew = (Constants.DEFAULT_WS_PING_INTERVAL + 20).toString()
+    const hbNew = (millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL_MS) + 20).toString()
+    const wsNew = (Constants.DEFAULT_WS_PING_INTERVAL_SECONDS + 20).toString()
     const setRequest: OCPP20SetVariablesRequest = {
       setVariableData: [
         {
@@ -400,13 +399,13 @@ await describe('B05 - Set Variables', async () => {
     const request: OCPP20SetVariablesRequest = {
       setVariableData: [
         {
-          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL + 2).toString(),
+          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL_SECONDS + 2).toString(),
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20OptionalVariableName.WebSocketPingInterval },
         },
         {
           attributeValue: (
-            millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL) + 2
+            millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL_MS) + 2
           ).toString(),
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20OptionalVariableName.HeartbeatInterval },
index a0730e3a7087e05ad7c556149189e17b571575b0..7867bd8ce056b6f1f26132f6cd25828fd92d9683 100644 (file)
@@ -44,14 +44,13 @@ function createTriggerMessageStation (): {
     baseName: TEST_CHARGING_STATION_BASE_NAME,
     connectorsCount: 3,
     evseConfiguration: { evsesCount: 3 },
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     ocppRequestService: {
       requestHandler: requestHandlerMock,
     },
     stationInfo: {
       ocppVersion: OCPPVersion.VERSION_201,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
   const mockStation = station as MockChargingStation
   return { mockStation, requestHandlerMock }
@@ -564,14 +563,13 @@ await describe('F06 - TriggerMessage', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 3,
         evseConfiguration: { evsesCount: 3 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         ocppRequestService: {
           requestHandler: rejectingMock,
         },
         stationInfo: {
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       const request: OCPP20TriggerMessageRequest = {
index f31dc83aab80095049d5da895d9e3d7b0a2e48f6..09d144645cc7b29b7b6f17634432da79a8f603ff 100644 (file)
@@ -41,14 +41,13 @@ function createUnlockConnectorStation (): {
     baseName: TEST_CHARGING_STATION_BASE_NAME,
     connectorsCount: 3,
     evseConfiguration: { evsesCount: 3 },
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     ocppRequestService: {
       requestHandler: requestHandlerMock,
     },
     stationInfo: {
       ocppVersion: OCPPVersion.VERSION_201,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
   return { mockStation: station as MockChargingStation, requestHandlerMock }
 }
@@ -164,14 +163,13 @@ await describe('F05 - UnlockConnector', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 2,
         evseConfiguration: { evsesCount: 1 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         ocppRequestService: {
           requestHandler: requestHandlerMock,
         },
         stationInfo: {
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
       const multiConnectorStation = station as MockChargingStation
 
index 239dedce59ada267f48fb73c130152ea26a0057a..4b120bb5eb3f4aec79060c5c9006fd6fda384783 100644 (file)
@@ -44,12 +44,11 @@ await describe('L01/L02 - UpdateFirmware', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 1,
       evseConfiguration: { evsesCount: 1 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
     testableService = createTestableIncomingRequestService(new OCPP20IncomingRequestService())
@@ -83,7 +82,6 @@ await describe('L01/L02 - UpdateFirmware', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 1,
         evseConfiguration: { evsesCount: 1 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         ocppRequestService: {
           requestHandler: mock.fn(async () => Promise.resolve({})),
         },
@@ -91,7 +89,7 @@ await describe('L01/L02 - UpdateFirmware', async () => {
           ocppStrictCompliance: false,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
       createStationWithCertificateManager(stationWithCert, certManager)
 
@@ -118,12 +116,11 @@ await describe('L01/L02 - UpdateFirmware', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 1,
         evseConfiguration: { evsesCount: 1 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: {
           ocppStrictCompliance: false,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
       createStationWithCertificateManager(stationWithCert, certManager)
 
@@ -165,12 +162,11 @@ await describe('L01/L02 - UpdateFirmware', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 2,
         evseConfiguration: { evsesCount: 2 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: {
           ocppStrictCompliance: false,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       // Set an active transaction on EVSE 1's connector
@@ -202,12 +198,11 @@ await describe('L01/L02 - UpdateFirmware', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 2,
         evseConfiguration: { evsesCount: 2 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: {
           ocppStrictCompliance: false,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       const request: OCPP20UpdateFirmwareRequest = {
index 97d9d318e1e2544b5fa54cc81d846ff9fb364adc..d4301e7499173de0f7001a17f61dfa540aedf490 100644 (file)
@@ -34,7 +34,6 @@ function createIntegrationStation (): ChargingStation {
     baseName: TEST_CHARGING_STATION_BASE_NAME,
     connectorsCount: 3,
     evseConfiguration: { evsesCount: 3 },
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     ocppRequestService: {
       requestHandler: async () => Promise.resolve({}),
     },
@@ -42,7 +41,7 @@ function createIntegrationStation (): ChargingStation {
       ocppStrictCompliance: false,
       ocppVersion: OCPPVersion.VERSION_201,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
   return station
 }
index 69d3b4e80bbb7c14b2e95d4ae768f61ae8ef15bf..892ea8627e2c9761cb05114b8332896eed2f6634 100644 (file)
@@ -37,7 +37,6 @@ function createIntegrationStation (): ChargingStation {
     baseName: TEST_CHARGING_STATION_BASE_NAME,
     connectorsCount: 3,
     evseConfiguration: { evsesCount: 3 },
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     ocppRequestService: {
       requestHandler: async () => Promise.resolve({}),
     },
@@ -45,7 +44,7 @@ function createIntegrationStation (): ChargingStation {
       ocppStrictCompliance: false,
       ocppVersion: OCPPVersion.VERSION_201,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
   return station
 }
index 3f536b001745447e80a7c3fb33b6407b2530c087..ee4c618c4b978f4258db1598d1b28a28fa002a44 100644 (file)
@@ -43,12 +43,11 @@ await describe('OCPP 2.0 Request Call Chain — requestHandler → buildRequestP
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
   })
index a20ea121127313b874d7b70ca925642386df2b77..7f0b2481bea7b0126afd7580e6a368b610c376c3 100644 (file)
@@ -34,12 +34,11 @@ await describe('P02 - DataTransfer', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 1,
       evseConfiguration: { evsesCount: 1 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = newStation
 
index 4239018f6d56f393ca506afa927d07fdea74f4ed..dada4577199c7ca3e74387ed217835c03ab3d44f 100644 (file)
@@ -35,12 +35,11 @@ await describe('J01 - FirmwareStatusNotification', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 1,
       evseConfiguration: { evsesCount: 1 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = newStation
 
index 6945a31644928cfbc9a0f6c6078e785151b7f4c7..ef3498f76bef00e4514f5d1bc635990c5cf70263 100644 (file)
@@ -41,12 +41,11 @@ await describe('OCPP20 ISO15118 Request Service', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 3,
         evseConfiguration: { evsesCount: 3 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: {
           ocppStrictCompliance: false,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
       station = newStation
     })
@@ -208,12 +207,11 @@ await describe('OCPP20 ISO15118 Request Service', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 3,
         evseConfiguration: { evsesCount: 3 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: {
           ocppStrictCompliance: false,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
       station = result.station
     })
@@ -334,12 +332,11 @@ await describe('OCPP20 ISO15118 Request Service', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 1,
         evseConfiguration: { evsesCount: 1 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: {
           ocppStrictCompliance: false,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
       station = result.station
     })
index 3c8a05345cb3aaba083f8e5ff046f8c32ab7b760..cc4612e05313622b56a5fbc4a9826e0b1576d350 100644 (file)
@@ -35,12 +35,11 @@ await describe('M04 - LogStatusNotification', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 1,
       evseConfiguration: { evsesCount: 1 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = newStation
 
index 7b99540d2ace559a491f8ca26a0ec739b600c007..9b1ad5e68c5f85956ae93c7ea1385bd21a494006 100644 (file)
@@ -34,12 +34,11 @@ await describe('G01 - MeterValues', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 1,
       evseConfiguration: { evsesCount: 1 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = newStation
 
index 32b0d1b308438e9300babb7db639d04204931e7a..f9c4dd95f73137be705aac3a654653997da7bc8c 100644 (file)
@@ -45,7 +45,6 @@ await describe('B07/B08 - NotifyReport', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         chargePointModel: TEST_CHARGE_POINT_MODEL,
         chargePointSerialNumber: TEST_CHARGE_POINT_SERIAL_NUMBER,
@@ -54,7 +53,7 @@ await describe('B07/B08 - NotifyReport', async () => {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = createdStation
   })
index 7988c3538b35f8f65cd059c2a53b1649f42e50d7..e9c4b1d59d1ee65408a31e429744d36eae23d779 100644 (file)
@@ -33,12 +33,11 @@ await describe('A04 - SecurityEventNotification', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 1,
       evseConfiguration: { evsesCount: 1 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = newStation
 
index 5139b6b99c0e032c0883c9ef71f7362f8087e156..4ad278bef37e90974c8a3d94b8352001f4aea45f 100644 (file)
@@ -34,12 +34,11 @@ await describe('I02 - SignCertificate Request', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = createdStation
     station.ocppConfiguration = {
@@ -348,12 +347,11 @@ await describe('I02 - SignCertificate Request', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 1,
         evseConfiguration: { evsesCount: 1 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: {
           ocppStrictCompliance: false,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
 
       stationWithoutCertManager.ocppConfiguration = {
index a49a71d869f274e99f5ff09187c96de531a0bf87..b8d36afe4bd5392b15d11deb1e0ff27aaeaa6cfd 100644 (file)
@@ -43,13 +43,12 @@ function createBootNotificationStation (): MockChargingStation {
   const { station } = createMockChargingStation({
     baseName: TEST_CHARGING_STATION_BASE_NAME,
     connectorsCount: 1,
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     stationInfo: {
       // Bypass AJV schema validation — tests focus on handler logic
       ocppStrictCompliance: false,
       ocppVersion: OCPPVersion.VERSION_201,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
   return station as MockChargingStation
 }
index c2b80f60b5cd9d4d9deb7de0a2e6bf41e1117cb5..a370e835f5e47601850dd58437a2135cc3613c77 100644 (file)
@@ -30,12 +30,11 @@ function createSimpleHandlerStation (): MockChargingStation {
   const { station } = createMockChargingStation({
     baseName: TEST_CHARGING_STATION_BASE_NAME,
     connectorsCount: 1,
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     stationInfo: {
       ocppStrictCompliance: false,
       ocppVersion: OCPPVersion.VERSION_201,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
   return station as MockChargingStation
 }
index 1dd2826e1bca39b41add3859e5176b384f85febd..c992b0657a55dfdd74fdaec20a7a2dddb49b7049 100644 (file)
@@ -83,12 +83,11 @@ await describe('D01 - TransactionEvent Response', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 1,
       evseConfiguration: { evsesCount: 1 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = mockStation
     // Set connector transactionId to the UUID string used in request payloads
@@ -282,12 +281,11 @@ await describe('D01 - TransactionEvent Response', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 2,
       evseConfiguration: { evsesCount: 2 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     setupConnectorWithTransaction(multiStation, 1, { transactionId: 10 })
     const connector1 = multiStation.getConnectorStatus(1)
index d8c428b1064b0bbcd782ba6b09f2c3b863affa5c..0f7958405e27d11684873f4bd35cbdfbd132bd9c 100644 (file)
@@ -17,7 +17,6 @@ import {
   OCPP20OptionalVariableName,
   OCPPVersion,
 } from '../../../../src/types/index.js'
-import { Constants } from '../../../../src/utils/index.js'
 import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js'
 import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js'
 import { createMockChargingStation } from '../../ChargingStationTestUtils.js'
@@ -74,7 +73,6 @@ await describe('OCPP20ServiceUtils.computeReconnectDelay', async () => {
     const { station: mockStation } = createMockChargingStation({
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 1,
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         chargingStationId: TEST_CHARGING_STATION_BASE_NAME,
         ocppVersion: OCPPVersion.VERSION_201,
index 4dd4760885815c234af950d9a3934dd2947ffe8c..1543f643ea8a237bb176024ae8e56e8c4d152869 100644 (file)
@@ -29,12 +29,11 @@ await describe('OCPP20ServiceUtils', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 2,
       evseConfiguration: { evsesCount: 2 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: true,
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     mockStation = station
   })
index 9e69ba96ffb01c3c88bd711a911f32930e5eefc6..d8c93355bb1f6a8375b861ee3c5fd9f725afd106 100644 (file)
@@ -99,7 +99,6 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 3,
         evseConfiguration: { evsesCount: 3 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         ocppRequestService: {
           requestHandler: async () => Promise.resolve({} as EmptyObject),
         },
@@ -107,7 +106,7 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
           ocppStrictCompliance: true,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
       mockStation = station
       resetLimits(mockStation)
@@ -333,7 +332,6 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
           baseName: TEST_CHARGING_STATION_BASE_NAME,
           connectorsCount: 1,
           evseConfiguration: { evsesCount: 1 },
-          heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
           ocppRequestService: {
             requestHandler: () => {
               throw new Error('Network error')
@@ -343,7 +341,7 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
             ocppStrictCompliance: true,
             ocppVersion: OCPPVersion.VERSION_201,
           },
-          websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+          websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
         })
 
         const connectorId = 1
@@ -507,7 +505,6 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
           baseName: TEST_CHARGING_STATION_BASE_NAME,
           connectorsCount: 1,
           evseConfiguration: { evsesCount: 1 },
-          heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
           ocppRequestService: {
             requestHandler: () => {
               throw new Error('Context test error')
@@ -517,7 +514,7 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
             ocppStrictCompliance: true,
             ocppVersion: OCPPVersion.VERSION_201,
           },
-          websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+          websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
         })
 
         const connectorId = 1
@@ -588,7 +585,6 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 3,
         evseConfiguration: { evsesCount: 3 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         ocppRequestService: {
           requestHandler: async () => Promise.resolve({} as EmptyObject),
         },
@@ -596,7 +592,7 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
           ocppStrictCompliance: true,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
       mockStation = station
       resetLimits(mockStation)
@@ -1935,7 +1931,6 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
           baseName: TEST_CHARGING_STATION_BASE_NAME,
           connectorsCount: 1,
           evseConfiguration: { evsesCount: 1 },
-          heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
           ocppRequestService: {
             requestHandler: errorOnSecondMock,
           },
@@ -1943,7 +1938,7 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
             ocppStrictCompliance: true,
             ocppVersion: OCPPVersion.VERSION_201,
           },
-          websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+          websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
         })
 
         errorStation.isWebSocketConnectionOpened = () => false
@@ -2278,7 +2273,6 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
           baseName: TEST_CHARGING_STATION_BASE_NAME,
           connectorsCount: 1,
           evseConfiguration: { evsesCount: 1 },
-          heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
           ocppRequestService: {
             requestHandler: () => {
               throw new Error('Network timeout')
@@ -2288,7 +2282,7 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
             ocppStrictCompliance: true,
             ocppVersion: OCPPVersion.VERSION_201,
           },
-          websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+          websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
         })
 
         // Mock WebSocket as open
@@ -2330,7 +2324,7 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
     await it('should return default interval when TxUpdatedInterval is not configured', () => {
       const interval = OCPP20ServiceUtils.getTxUpdatedInterval(station)
 
-      assert.strictEqual(interval, Constants.DEFAULT_TX_UPDATED_INTERVAL * 1000)
+      assert.strictEqual(interval, Constants.DEFAULT_TX_UPDATED_INTERVAL_SECONDS * 1000)
     })
 
     await it('should return configured interval in milliseconds', () => {
@@ -2360,7 +2354,7 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
 
       const interval = OCPP20ServiceUtils.getTxUpdatedInterval(station)
 
-      assert.strictEqual(interval, Constants.DEFAULT_TX_UPDATED_INTERVAL * 1000)
+      assert.strictEqual(interval, Constants.DEFAULT_TX_UPDATED_INTERVAL_SECONDS * 1000)
     })
 
     await it('should return default for zero value', () => {
@@ -2375,7 +2369,7 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
 
       const interval = OCPP20ServiceUtils.getTxUpdatedInterval(station)
 
-      assert.strictEqual(interval, Constants.DEFAULT_TX_UPDATED_INTERVAL * 1000)
+      assert.strictEqual(interval, Constants.DEFAULT_TX_UPDATED_INTERVAL_SECONDS * 1000)
     })
 
     await it('should return default for negative value', () => {
@@ -2390,7 +2384,7 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
 
       const interval = OCPP20ServiceUtils.getTxUpdatedInterval(station)
 
-      assert.strictEqual(interval, Constants.DEFAULT_TX_UPDATED_INTERVAL * 1000)
+      assert.strictEqual(interval, Constants.DEFAULT_TX_UPDATED_INTERVAL_SECONDS * 1000)
     })
   })
 
@@ -2704,7 +2698,6 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 3,
         evseConfiguration: { evsesCount: 3 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         ocppRequestService: {
           requestHandler: async () => Promise.resolve({} as EmptyObject),
         },
@@ -2712,7 +2705,7 @@ await describe('OCPP20 TransactionEvent ServiceUtils', async () => {
           ocppStrictCompliance: true,
           ocppVersion: OCPPVersion.VERSION_201,
         },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
       station = s
       resetLimits(station)
index 1752fc4a47dbeb1cd83d3467d923fed96041d8e1..e9950d8eecae8179189fb69f200ba0d259e8c47a 100644 (file)
@@ -136,7 +136,6 @@ export function createMockStationWithRequestTracking (): MockStationWithTracking
     baseName: TEST_CHARGING_STATION_BASE_NAME,
     connectorsCount: 3,
     evseConfiguration: { evsesCount: 3 },
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     ocppRequestService: {
       requestHandler: requestHandlerMock,
     },
@@ -144,7 +143,7 @@ export function createMockStationWithRequestTracking (): MockStationWithTracking
       ocppStrictCompliance: true,
       ocppVersion: OCPPVersion.VERSION_201,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
 
   station.isWebSocketConnectionOpened = () => isOnline
@@ -182,13 +181,12 @@ export function createOCPP20RequestTestContext (
     baseName,
     connectorsCount: 3,
     evseConfiguration: { evsesCount: 3 },
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     stationInfo: {
       ocppStrictCompliance: false,
       ocppVersion: OCPPVersion.VERSION_201,
       ...stationInfo,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
 
   return { requestService, station, testableRequestService }
@@ -486,13 +484,12 @@ export const ResetTestFixtures = {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppStrictCompliance: false,
         ocppVersion: OCPPVersion.VERSION_201,
         resetTime: 5000,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     const mockStation = station as MockChargingStation
     mockStation.getNumberOfRunningTransactions = () => runningTransactions
@@ -699,7 +696,6 @@ export function createOCPP20ListenerStation (baseName: string): {
     baseName,
     connectorsCount: 3,
     evseConfiguration: { evsesCount: 3 },
-    heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
     ocppRequestService: {
       requestHandler: requestHandlerMock,
     },
@@ -707,7 +703,7 @@ export function createOCPP20ListenerStation (baseName: string): {
       ocppStrictCompliance: false,
       ocppVersion: OCPPVersion.VERSION_201,
     },
-    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+    websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
   })
   return { requestHandlerMock, station }
 }
index bced6777fbfbc3a005f4cc168e5a371f7f1e2668..ead290f86b9483ecfeebddb63aaef85b2ef2a531 100644 (file)
@@ -76,7 +76,6 @@ await describe('B05 - OCPP20VariableManager', async () => {
       baseName: TEST_CHARGING_STATION_BASE_NAME,
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       ocppConfiguration: {
         configurationKey: [
           {
@@ -85,7 +84,7 @@ await describe('B05 - OCPP20VariableManager', async () => {
               StandardParametersKey.HeartbeatInterval
             ),
             readonly: false,
-            value: millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL).toString(),
+            value: millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL_MS).toString(),
           },
           {
             key: buildConfigKey(
@@ -93,14 +92,14 @@ await describe('B05 - OCPP20VariableManager', async () => {
               StandardParametersKey.WebSocketPingInterval
             ),
             readonly: false,
-            value: Constants.DEFAULT_WS_PING_INTERVAL.toString(),
+            value: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS.toString(),
           },
         ],
       },
       stationInfo: {
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     station = newStation
   })
@@ -149,7 +148,7 @@ await describe('B05 - OCPP20VariableManager', async () => {
       assert.strictEqual(result[0].attributeType, AttributeEnumType.Actual)
       assert.strictEqual(
         result[0].attributeValue,
-        millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL).toString()
+        millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL_MS).toString()
       )
       assert.strictEqual(result[0].component.name, OCPP20ComponentName.OCPPCommCtrlr)
       assert.strictEqual(result[0].variable.name, OCPP20OptionalVariableName.HeartbeatInterval)
@@ -159,7 +158,7 @@ await describe('B05 - OCPP20VariableManager', async () => {
       assert.strictEqual(result[1].attributeType, AttributeEnumType.Actual)
       assert.strictEqual(
         result[1].attributeValue,
-        Constants.DEFAULT_EV_CONNECTION_TIMEOUT.toString()
+        Constants.DEFAULT_EV_CONNECTION_TIMEOUT_SECONDS.toString()
       )
       assert.strictEqual(result[1].component.name, OCPP20ComponentName.TxCtrlr)
       assert.strictEqual(result[1].variable.name, OCPP20RequiredVariableName.EVConnectionTimeOut)
@@ -359,7 +358,7 @@ await describe('B05 - OCPP20VariableManager', async () => {
       assert.strictEqual(result[0].attributeType, AttributeEnumType.Actual)
       assert.strictEqual(
         result[0].attributeValue,
-        millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL).toString()
+        millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL_MS).toString()
       )
       assert.strictEqual(result[0].component.name, OCPP20ComponentName.OCPPCommCtrlr)
       assert.strictEqual(result[0].variable.name, OCPP20OptionalVariableName.HeartbeatInterval)
@@ -367,14 +366,20 @@ await describe('B05 - OCPP20VariableManager', async () => {
       // Second variable: WebSocketPingInterval
       assert.strictEqual(result[1].attributeStatus, GetVariableStatusEnumType.Accepted)
       assert.strictEqual(result[1].attributeType, AttributeEnumType.Actual)
-      assert.strictEqual(result[1].attributeValue, Constants.DEFAULT_WS_PING_INTERVAL.toString())
+      assert.strictEqual(
+        result[1].attributeValue,
+        Constants.DEFAULT_WS_PING_INTERVAL_SECONDS.toString()
+      )
       assert.strictEqual(result[1].component.name, OCPP20ComponentName.ChargingStation)
       assert.strictEqual(result[1].variable.name, OCPP20OptionalVariableName.WebSocketPingInterval)
       assert.strictEqual(result[1].attributeStatusInfo, undefined)
       // Third variable: MessageTimeout
       assert.strictEqual(result[2].attributeStatus, GetVariableStatusEnumType.Accepted)
       assert.strictEqual(result[2].attributeType, AttributeEnumType.Actual)
-      assert.strictEqual(result[2].attributeValue, Constants.DEFAULT_MESSAGE_TIMEOUT.toString())
+      assert.strictEqual(
+        result[2].attributeValue,
+        Constants.DEFAULT_MESSAGE_TIMEOUT_SECONDS.toString()
+      )
       assert.strictEqual(result[2].component.name, OCPP20ComponentName.OCPPCommCtrlr)
       assert.strictEqual(result[2].component.instance, 'Default')
       assert.strictEqual(result[2].variable.name, OCPP20RequiredVariableName.MessageTimeout)
@@ -486,14 +491,14 @@ await describe('B05 - OCPP20VariableManager', async () => {
     await it('should accept setting writable variables (Actual default)', () => {
       const request: OCPP20SetVariableDataType[] = [
         {
-          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL + 1).toString(),
+          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL_SECONDS + 1).toString(),
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20OptionalVariableName.WebSocketPingInterval },
         },
         {
           attributeType: AttributeEnumType.Actual,
           attributeValue: (
-            millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL) + 1
+            millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL_MS) + 1
           ).toString(),
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20OptionalVariableName.HeartbeatInterval },
@@ -598,7 +603,7 @@ await describe('B05 - OCPP20VariableManager', async () => {
     await it('should handle multiple mixed SetVariables in one call', () => {
       const request: OCPP20SetVariableDataType[] = [
         {
-          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL + 2).toString(),
+          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL_SECONDS + 2).toString(),
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20OptionalVariableName.WebSocketPingInterval },
         },
@@ -796,7 +801,7 @@ await describe('B05 - OCPP20VariableManager', async () => {
       const request: OCPP20SetVariableDataType[] = [
         {
           attributeType: AttributeEnumType.Target,
-          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL + 5).toString(),
+          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL_SECONDS + 5).toString(),
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20OptionalVariableName.WebSocketPingInterval },
         },
@@ -817,7 +822,7 @@ await describe('B05 - OCPP20VariableManager', async () => {
       const req: OCPP20SetVariableDataType[] = [
         {
           attributeValue: (
-            millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL) + 10
+            millisecondsToSeconds(Constants.DEFAULT_HEARTBEAT_INTERVAL_MS) + 10
           ).toString(),
           component: { name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20OptionalVariableName.HeartbeatInterval },
@@ -900,7 +905,7 @@ await describe('B05 - OCPP20VariableManager', async () => {
       ])[0]
       const posRes = manager.setVariables(station, [
         {
-          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL + 10).toString(),
+          attributeValue: (Constants.DEFAULT_WS_PING_INTERVAL_SECONDS + 10).toString(),
           component: { name: OCPP20ComponentName.ChargingStation },
           variable: { name: OCPP20OptionalVariableName.WebSocketPingInterval },
         },
@@ -959,7 +964,7 @@ await describe('B05 - OCPP20VariableManager', async () => {
     await it('should validate EVConnectionTimeOut positive integer >0 and reject invalid', () => {
       const okRes = manager.setVariables(station, [
         {
-          attributeValue: (Constants.DEFAULT_EV_CONNECTION_TIMEOUT + 5).toString(),
+          attributeValue: (Constants.DEFAULT_EV_CONNECTION_TIMEOUT_SECONDS + 5).toString(),
           component: { name: OCPP20ComponentName.TxCtrlr },
           variable: { name: OCPP20RequiredVariableName.EVConnectionTimeOut },
         },
@@ -1030,7 +1035,7 @@ await describe('B05 - OCPP20VariableManager', async () => {
     await it('should validate MessageTimeout positive integer >0 and reject invalid', () => {
       const okRes = manager.setVariables(station, [
         {
-          attributeValue: (Constants.DEFAULT_MESSAGE_TIMEOUT + 5).toString(),
+          attributeValue: (Constants.DEFAULT_MESSAGE_TIMEOUT_SECONDS + 5).toString(),
           component: { instance: 'Default', name: OCPP20ComponentName.OCPPCommCtrlr },
           variable: { name: OCPP20RequiredVariableName.MessageTimeout },
         },
@@ -1169,7 +1174,10 @@ await describe('B05 - OCPP20VariableManager', async () => {
       ])[0]
       assert.strictEqual(res.attributeStatus, GetVariableStatusEnumType.Accepted)
       assert.strictEqual(res.attributeStatusInfo, undefined)
-      assert.strictEqual(res.attributeValue, Constants.DEFAULT_EV_CONNECTION_TIMEOUT.toString())
+      assert.strictEqual(
+        res.attributeValue,
+        Constants.DEFAULT_EV_CONNECTION_TIMEOUT_SECONDS.toString()
+      )
       const after = getConfigurationKey(
         station,
         buildConfigKey(OCPP20ComponentName.TxCtrlr, OCPP20RequiredVariableName.EVConnectionTimeOut)
@@ -1753,11 +1761,10 @@ await describe('B05 - OCPP20VariableManager', async () => {
       baseName: 'MMStation',
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
 
     await it('should return NotSupportedAttributeType for MinSet HeartbeatInterval', () => {
@@ -2220,23 +2227,21 @@ await describe('B05 - OCPP20VariableManager', async () => {
       baseName: 'StationA',
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         hashId: 'station-a-hash',
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
     const { station: stationB } = createMockChargingStation({
       baseName: 'StationB',
       connectorsCount: 3,
       evseConfiguration: { evsesCount: 3 },
-      heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
       stationInfo: {
         hashId: 'station-b-hash',
         ocppVersion: OCPPVersion.VERSION_201,
       },
-      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+      websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
     })
 
     try {
@@ -2269,7 +2274,10 @@ await describe('B05 - OCPP20VariableManager', async () => {
         },
       ])[0]
       assert.strictEqual(resultB.attributeStatus, GetVariableStatusEnumType.Accepted)
-      assert.strictEqual(resultB.attributeValue, Constants.DEFAULT_EV_CONNECTION_TIMEOUT.toString())
+      assert.strictEqual(
+        resultB.attributeValue,
+        Constants.DEFAULT_EV_CONNECTION_TIMEOUT_SECONDS.toString()
+      )
     } finally {
       VARIABLE_REGISTRY[registryKey].defaultValue = originalDefault
       manager.invalidateMappingsCache()
index 031f2e2ff04f6563eb99c6a67e75a9b085dee65b..0255a3025f17835c7ea7fa51843913644cb72827 100644 (file)
@@ -76,9 +76,8 @@ await describe('buildMeterValue', async () => {
       const { station: s } = createMockChargingStation({
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 1,
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_16 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
       station = s
       const connectorStatus = station.getConnectorStatus(1)
@@ -112,9 +111,8 @@ await describe('buildMeterValue', async () => {
         baseName: TEST_CHARGING_STATION_BASE_NAME,
         connectorsCount: 1,
         evseConfiguration: { evsesCount: 1 },
-        heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
         stationInfo: { ocppVersion: OCPPVersion.VERSION_201 },
-        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+        websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
       })
       station = s
       const connectorStatus = station.getConnectorStatus(1)
@@ -192,16 +190,14 @@ await describe('buildMeterValue', async () => {
               baseName: TEST_CHARGING_STATION_BASE_NAME,
               connectorsCount: 1,
               evseConfiguration: { evsesCount: 1 },
-              heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
               stationInfo: { ocppVersion: version },
-              websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+              websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
             }
           : {
               baseName: TEST_CHARGING_STATION_BASE_NAME,
               connectorsCount: 1,
-              heartbeatInterval: Constants.DEFAULT_HEARTBEAT_INTERVAL,
               stationInfo: { ocppVersion: version },
-              websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL,
+              websocketPingInterval: Constants.DEFAULT_WS_PING_INTERVAL_SECONDS,
             }
         const { station: s } = createMockChargingStation(opts)
         const connectorStatus = s.getConnectorStatus(1)
index 84d3c4231526ffa00f4df5ac0f162a832a825c17..3e84e211d0462d126ccbd3cc9a62c4a0ace0d4f7 100644 (file)
@@ -537,20 +537,20 @@ await describe('Utils', async () => {
     )
   })
 
-  await it('should clamp values to safe timer range (0 to MAX_SETINTERVAL_DELAY)', () => {
+  await it('should clamp values to safe timer range (0 to MAX_SETINTERVAL_DELAY_MS)', () => {
     assert.strictEqual(clampToSafeTimerValue(0), 0)
     assert.strictEqual(clampToSafeTimerValue(1000), 1000)
     assert.strictEqual(
-      clampToSafeTimerValue(Constants.MAX_SETINTERVAL_DELAY),
-      Constants.MAX_SETINTERVAL_DELAY
+      clampToSafeTimerValue(Constants.MAX_SETINTERVAL_DELAY_MS),
+      Constants.MAX_SETINTERVAL_DELAY_MS
     )
     assert.strictEqual(
-      clampToSafeTimerValue(Constants.MAX_SETINTERVAL_DELAY + 1),
-      Constants.MAX_SETINTERVAL_DELAY
+      clampToSafeTimerValue(Constants.MAX_SETINTERVAL_DELAY_MS + 1),
+      Constants.MAX_SETINTERVAL_DELAY_MS
     )
     assert.strictEqual(
       clampToSafeTimerValue(Number.MAX_SAFE_INTEGER),
-      Constants.MAX_SETINTERVAL_DELAY
+      Constants.MAX_SETINTERVAL_DELAY_MS
     )
     assert.strictEqual(clampToSafeTimerValue(-1), 0)
     assert.strictEqual(clampToSafeTimerValue(-1000), 0)