3 buildChargingStationAutomaticTransactionGeneratorConfiguration
,
6 } from
'./ChargingStationConfigurationUtils';
7 import type { ChargingStation
} from
'../charging-station';
9 type ChargingStationData
,
10 type ChargingStationWorkerMessage
,
11 ChargingStationWorkerMessageEvents
,
15 export const buildStartedMessage
= (
16 chargingStation
: ChargingStation
17 ): ChargingStationWorkerMessage
<ChargingStationData
> => {
19 id
: ChargingStationWorkerMessageEvents
.started
,
20 data
: buildChargingStationDataPayload(chargingStation
),
24 export const buildStoppedMessage
= (
25 chargingStation
: ChargingStation
26 ): ChargingStationWorkerMessage
<ChargingStationData
> => {
28 id
: ChargingStationWorkerMessageEvents
.stopped
,
29 data
: buildChargingStationDataPayload(chargingStation
),
33 export const buildUpdatedMessage
= (
34 chargingStation
: ChargingStation
35 ): ChargingStationWorkerMessage
<ChargingStationData
> => {
37 id
: ChargingStationWorkerMessageEvents
.updated
,
38 data
: buildChargingStationDataPayload(chargingStation
),
42 export const buildPerformanceStatisticsMessage
= (
43 statistics
: Statistics
44 ): ChargingStationWorkerMessage
<Statistics
> => {
46 id
: ChargingStationWorkerMessageEvents
.performanceStatistics
,
51 const buildChargingStationDataPayload
= (chargingStation
: ChargingStation
): ChargingStationData
=> {
53 started
: chargingStation
.started
,
54 stationInfo
: chargingStation
.stationInfo
,
55 connectors
: buildConnectorsStatus(chargingStation
),
56 evses
: buildEvsesStatus(chargingStation
, OutputFormat
.worker
),
57 ocppConfiguration
: chargingStation
.ocppConfiguration
,
58 wsState
: chargingStation
?.wsConnection
?.readyState
,
59 bootNotificationResponse
: chargingStation
.bootNotificationResponse
,
60 ...(chargingStation
.automaticTransactionGenerator
&& {
61 automaticTransactionGenerator
:
62 buildChargingStationAutomaticTransactionGeneratorConfiguration(chargingStation
),