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 | |
71ac2bd7 | 14 | export interface ChargingStationOptions extends JsonObject { |
afbb8202 | 15 | supervisionUrls?: string | string[] |
9a08f38e | 16 | persistentConfiguration?: boolean |
71ac2bd7 | 17 | autoStart?: boolean |
52c58949 | 18 | autoRegister?: boolean |
43e04bb7 JB |
19 | enableStatistics?: boolean |
20 | ocppStrictCompliance?: boolean | |
1feac591 | 21 | stopTransactionsOnStopped?: boolean |
d070d967 JB |
22 | } |
23 | ||
98dc07fa | 24 | export interface ChargingStationWorkerData extends WorkerData { |
66a7748d JB |
25 | index: number |
26 | templateFile: string | |
71ac2bd7 | 27 | options?: ChargingStationOptions |
98dc07fa JB |
28 | } |
29 | ||
09989bb8 | 30 | export type EvseStatusWorkerType = Omit<EvseStatus, 'connectors'> & { |
66a7748d JB |
31 | connectors?: ConnectorStatus[] |
32 | } | |
52952bf8 | 33 | |
32de5a57 | 34 | export interface ChargingStationData extends WorkerData { |
66a7748d JB |
35 | started: boolean |
36 | stationInfo: ChargingStationInfo | |
37 | connectors: ConnectorStatus[] | |
38 | evses: EvseStatusWorkerType[] | |
39 | ocppConfiguration: ChargingStationOcppConfiguration | |
1d41bc6b | 40 | supervisionUrl: string |
17e9e8ce | 41 | wsState?: |
66a7748d JB |
42 | | typeof WebSocket.CONNECTING |
43 | | typeof WebSocket.OPEN | |
44 | | typeof WebSocket.CLOSING | |
45 | | typeof WebSocket.CLOSED | |
46 | bootNotificationResponse?: BootNotificationResponse | |
47 | automaticTransactionGenerator?: ChargingStationAutomaticTransactionGeneratorConfiguration | |
32de5a57 LM |
48 | } |
49 | ||
50 | enum ChargingStationMessageEvents { | |
a223d9be | 51 | performanceStatistics = 'performanceStatistics' |
98dc07fa JB |
52 | } |
53 | ||
98dc07fa JB |
54 | export const ChargingStationWorkerMessageEvents = { |
55 | ...WorkerMessageEvents, | |
db54d2e0 | 56 | ...ChargingStationEvents, |
66a7748d JB |
57 | ...ChargingStationMessageEvents |
58 | } as const | |
59 | // eslint-disable-next-line @typescript-eslint/no-redeclare | |
db54d2e0 JB |
60 | export type ChargingStationWorkerMessageEvents = |
61 | | WorkerMessageEvents | |
62 | | ChargingStationEvents | |
66a7748d | 63 | | ChargingStationMessageEvents |
98dc07fa | 64 | |
244c1396 JB |
65 | export interface ChargingStationWorkerEventError extends WorkerData { |
66 | event: WorkerMessageEvents | |
67 | name: string | |
68 | message: string | |
69 | stack?: string | |
70 | } | |
71 | ||
72 | export type ChargingStationWorkerMessageData = | |
73 | | ChargingStationData | |
74 | | Statistics | |
75 | | ChargingStationWorkerEventError | |
53e5fd67 | 76 | |
c72f6634 | 77 | export type ChargingStationWorkerMessage<T extends ChargingStationWorkerMessageData> = Omit< |
66a7748d JB |
78 | WorkerMessage<T>, |
79 | 'event' | |
c72f6634 | 80 | > & { |
66a7748d JB |
81 | event: ChargingStationWorkerMessageEvents |
82 | } |