Commit | Line | Data |
---|---|---|
17e9e8ce JB |
1 | import type { WebSocket } from 'ws'; |
2 | ||
c72f6634 | 3 | import type { ChargingStationAutomaticTransactionGeneratorConfiguration } from './AutomaticTransactionGenerator'; |
981ebfbe | 4 | import type { ChargingStationInfo } from './ChargingStationInfo'; |
6c1761d4 JB |
5 | import type { ConnectorStatus } from './ConnectorStatus'; |
6 | import type { JsonObject } from './JsonType'; | |
7 | import type { BootNotificationResponse } from './ocpp/Responses'; | |
8a36b1eb | 8 | import type { Statistics } from './Statistics'; |
8114d10e | 9 | import { WorkerData, WorkerMessage, WorkerMessageEvents } from './Worker'; |
d070d967 | 10 | |
e3822d6f | 11 | export interface ChargingStationWorkerOptions extends JsonObject { |
d070d967 JB |
12 | elementStartDelay?: number; |
13 | } | |
14 | ||
98dc07fa JB |
15 | export interface ChargingStationWorkerData extends WorkerData { |
16 | index: number; | |
17 | templateFile: string; | |
d070d967 | 18 | chargingStationWorkerOptions?: ChargingStationWorkerOptions; |
98dc07fa JB |
19 | } |
20 | ||
32de5a57 | 21 | export interface ChargingStationData extends WorkerData { |
32de5a57 | 22 | stationInfo: ChargingStationInfo; |
452a82ca | 23 | started: boolean; |
17e9e8ce JB |
24 | wsState?: |
25 | | typeof WebSocket.CONNECTING | |
26 | | typeof WebSocket.OPEN | |
27 | | typeof WebSocket.CLOSING | |
28 | | typeof WebSocket.CLOSED; | |
ce7a4fc3 | 29 | bootNotificationResponse: BootNotificationResponse; |
32de5a57 | 30 | connectors: ConnectorStatus[]; |
c72f6634 | 31 | automaticTransactionGenerator?: ChargingStationAutomaticTransactionGeneratorConfiguration; |
32de5a57 LM |
32 | } |
33 | ||
34 | enum ChargingStationMessageEvents { | |
ee0f106b JB |
35 | STARTED = 'started', |
36 | STOPPED = 'stopped', | |
32de5a57 | 37 | UPDATED = 'updated', |
e7aeea18 | 38 | PERFORMANCE_STATISTICS = 'performanceStatistics', |
98dc07fa JB |
39 | } |
40 | ||
32de5a57 | 41 | export type ChargingStationWorkerMessageEvents = WorkerMessageEvents | ChargingStationMessageEvents; |
98dc07fa JB |
42 | |
43 | export const ChargingStationWorkerMessageEvents = { | |
44 | ...WorkerMessageEvents, | |
32de5a57 | 45 | ...ChargingStationMessageEvents, |
98dc07fa JB |
46 | }; |
47 | ||
53e5fd67 JB |
48 | export type ChargingStationWorkerMessageData = ChargingStationData | Statistics; |
49 | ||
c72f6634 JB |
50 | export type ChargingStationWorkerMessage<T extends ChargingStationWorkerMessageData> = Omit< |
51 | WorkerMessage<T>, | |
52 | 'id' | |
53 | > & { | |
98dc07fa | 54 | id: ChargingStationWorkerMessageEvents; |
17e9e8ce | 55 | }; |