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