X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FMessageChannelUtils.ts;h=446ecfbbdef0b0ee2371e57b8a0668459e165024;hb=63a402d3bbdc7ab6e997ed6eab164e9ff4af371a;hp=9a88d17266dfdc4dceeab44930e5732e2109ad75;hpb=bbc6c09253da8c84496ef229c27c404a1d69ebfb;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/MessageChannelUtils.ts b/src/charging-station/MessageChannelUtils.ts index 9a88d172..446ecfbb 100644 --- a/src/charging-station/MessageChannelUtils.ts +++ b/src/charging-station/MessageChannelUtils.ts @@ -1,10 +1,10 @@ +import type { ChargingStation } from './internal'; import { - ChargingStationData, - ChargingStationWorkerMessage, + type ChargingStationData, + type ChargingStationWorkerMessage, ChargingStationWorkerMessageEvents, -} from '../types/ChargingStationWorker'; -import type Statistics from '../types/Statistics'; -import type ChargingStation from './ChargingStation'; + type Statistics, +} from '../types'; export class MessageChannelUtils { private constructor() { @@ -15,7 +15,7 @@ export class MessageChannelUtils { chargingStation: ChargingStation ): ChargingStationWorkerMessage { return { - id: ChargingStationWorkerMessageEvents.STARTED, + id: ChargingStationWorkerMessageEvents.started, data: MessageChannelUtils.buildChargingStationDataPayload(chargingStation), }; } @@ -24,7 +24,7 @@ export class MessageChannelUtils { chargingStation: ChargingStation ): ChargingStationWorkerMessage { return { - id: ChargingStationWorkerMessageEvents.STOPPED, + id: ChargingStationWorkerMessageEvents.stopped, data: MessageChannelUtils.buildChargingStationDataPayload(chargingStation), }; } @@ -33,7 +33,7 @@ export class MessageChannelUtils { chargingStation: ChargingStation ): ChargingStationWorkerMessage { return { - id: ChargingStationWorkerMessageEvents.UPDATED, + id: ChargingStationWorkerMessageEvents.updated, data: MessageChannelUtils.buildChargingStationDataPayload(chargingStation), }; } @@ -42,7 +42,7 @@ export class MessageChannelUtils { statistics: Statistics ): ChargingStationWorkerMessage { return { - id: ChargingStationWorkerMessageEvents.PERFORMANCE_STATISTICS, + id: ChargingStationWorkerMessageEvents.performanceStatistics, data: statistics, }; } @@ -51,14 +51,24 @@ export class MessageChannelUtils { chargingStation: ChargingStation ): ChargingStationData { return { - hashId: chargingStation.hashId, + started: chargingStation.started, stationInfo: chargingStation.stationInfo, - stopped: chargingStation.stopped, - bootNotificationResponse: chargingStation.bootNotificationResponse, connectors: [...chargingStation.connectors.values()].map( // eslint-disable-next-line @typescript-eslint/no-unused-vars ({ transactionSetInterval, ...connectorStatusRest }) => connectorStatusRest ), + ocppConfiguration: chargingStation.ocppConfiguration, + wsState: chargingStation?.wsConnection?.readyState, + bootNotificationResponse: chargingStation.bootNotificationResponse, + ...(chargingStation.automaticTransactionGenerator && { + automaticTransactionGenerator: { + automaticTransactionGenerator: + chargingStation.automaticTransactionGenerator.configuration, + automaticTransactionGeneratorStatuses: [ + ...chargingStation.automaticTransactionGenerator.connectorsStatus.values(), + ], + }, + }), }; } }