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