Commit | Line | Data |
---|---|---|
17e9e8ce JB |
1 | import type { WebSocket } from 'ws'; |
2 | ||
69074173 JB |
3 | import type { ChargingStationAutomaticTransactionGeneratorConfiguration } from './AutomaticTransactionGenerator'; |
4 | import type { ChargingStationInfo } from './ChargingStationInfo'; | |
5 | import type { ChargingStationOcppConfiguration } from './ChargingStationOcppConfiguration'; | |
6 | import type { ConnectorStatus } from './ConnectorStatus'; | |
7 | import type { EvseStatus } from './Evse'; | |
8 | import type { JsonObject } from './JsonType'; | |
9 | import type { BootNotificationResponse } from './ocpp/Responses'; | |
10 | import type { Statistics } from './Statistics'; | |
268a74bb | 11 | import { type WorkerData, type WorkerMessage, WorkerMessageEvents } from '../worker'; |
d070d967 | 12 | |
ef4932d8 | 13 | interface ChargingStationWorkerOptions extends JsonObject { |
d070d967 JB |
14 | elementStartDelay?: number; |
15 | } | |
16 | ||
98dc07fa JB |
17 | export interface ChargingStationWorkerData extends WorkerData { |
18 | index: number; | |
19 | templateFile: string; | |
d070d967 | 20 | chargingStationWorkerOptions?: ChargingStationWorkerOptions; |
98dc07fa JB |
21 | } |
22 | ||
09989bb8 | 23 | export type EvseStatusWorkerType = Omit<EvseStatus, 'connectors'> & { |
52952bf8 JB |
24 | connectors?: ConnectorStatus[]; |
25 | }; | |
26 | ||
32de5a57 | 27 | export interface ChargingStationData extends WorkerData { |
452a82ca | 28 | started: boolean; |
8d8599f0 JB |
29 | stationInfo: ChargingStationInfo; |
30 | connectors: ConnectorStatus[]; | |
09989bb8 | 31 | evses: EvseStatusWorkerType[]; |
8d8599f0 | 32 | ocppConfiguration: ChargingStationOcppConfiguration; |
17e9e8ce JB |
33 | wsState?: |
34 | | typeof WebSocket.CONNECTING | |
35 | | typeof WebSocket.OPEN | |
36 | | typeof WebSocket.CLOSING | |
37 | | typeof WebSocket.CLOSED; | |
1895299d | 38 | bootNotificationResponse?: BootNotificationResponse; |
c72f6634 | 39 | automaticTransactionGenerator?: ChargingStationAutomaticTransactionGeneratorConfiguration; |
32de5a57 LM |
40 | } |
41 | ||
42 | enum ChargingStationMessageEvents { | |
721646e9 JB |
43 | started = 'started', |
44 | stopped = 'stopped', | |
45 | updated = 'updated', | |
46 | performanceStatistics = 'performanceStatistics', | |
98dc07fa JB |
47 | } |
48 | ||
98dc07fa JB |
49 | export const ChargingStationWorkerMessageEvents = { |
50 | ...WorkerMessageEvents, | |
32de5a57 | 51 | ...ChargingStationMessageEvents, |
edd13439 JB |
52 | } as const; |
53 | export type ChargingStationWorkerMessageEvents = WorkerMessageEvents | ChargingStationMessageEvents; | |
98dc07fa | 54 | |
53e5fd67 JB |
55 | export type ChargingStationWorkerMessageData = ChargingStationData | Statistics; |
56 | ||
c72f6634 JB |
57 | export type ChargingStationWorkerMessage<T extends ChargingStationWorkerMessageData> = Omit< |
58 | WorkerMessage<T>, | |
59 | 'id' | |
60 | > & { | |
98dc07fa | 61 | id: ChargingStationWorkerMessageEvents; |
17e9e8ce | 62 | }; |