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