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