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