]>
Commit | Line | Data |
---|---|---|
1 | import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus'; | |
2 | import type { OCPP16MeterValuesRequest } from './1.6/MeterValues'; | |
3 | import { | |
4 | OCPP16AvailabilityType, | |
5 | type OCPP16BootNotificationRequest, | |
6 | type OCPP16CancelReservationRequest, | |
7 | type OCPP16DataTransferRequest, | |
8 | type OCPP16DiagnosticsStatusNotificationRequest, | |
9 | OCPP16FirmwareStatus, | |
10 | type OCPP16FirmwareStatusNotificationRequest, | |
11 | type OCPP16HeartbeatRequest, | |
12 | OCPP16IncomingRequestCommand, | |
13 | OCPP16MessageTrigger, | |
14 | OCPP16RequestCommand, | |
15 | type OCPP16ReserveNowRequest, | |
16 | type OCPP16StatusNotificationRequest, | |
17 | } from './1.6/Requests'; | |
18 | import { OperationalStatusEnumType } from './2.0/Common'; | |
19 | import { | |
20 | type OCPP20BootNotificationRequest, | |
21 | OCPP20IncomingRequestCommand, | |
22 | OCPP20RequestCommand, | |
23 | type OCPP20StatusNotificationRequest, | |
24 | } from './2.0/Requests'; | |
25 | import type { MessageType } from './MessageType'; | |
26 | import type { ChargingStation } from '../../charging-station'; | |
27 | import type { OCPPError } from '../../exception'; | |
28 | import type { JsonType } from '../JsonType'; | |
29 | ||
30 | export const RequestCommand = { | |
31 | ...OCPP16RequestCommand, | |
32 | ...OCPP20RequestCommand, | |
33 | } as const; | |
34 | export type RequestCommand = OCPP16RequestCommand | OCPP20RequestCommand; | |
35 | ||
36 | export type OutgoingRequest = [MessageType.CALL_MESSAGE, string, RequestCommand, JsonType]; | |
37 | ||
38 | export type RequestParams = { | |
39 | skipBufferingOnError?: boolean; | |
40 | triggerMessage?: boolean; | |
41 | throwError?: boolean; | |
42 | }; | |
43 | ||
44 | export const IncomingRequestCommand = { | |
45 | ...OCPP16IncomingRequestCommand, | |
46 | ...OCPP20IncomingRequestCommand, | |
47 | } as const; | |
48 | export type IncomingRequestCommand = OCPP16IncomingRequestCommand | OCPP20IncomingRequestCommand; | |
49 | ||
50 | export type IncomingRequest = [MessageType.CALL_MESSAGE, string, IncomingRequestCommand, JsonType]; | |
51 | ||
52 | export type ResponseCallback = (payload: JsonType, requestPayload: JsonType) => void; | |
53 | ||
54 | export type ErrorCallback = (error: OCPPError, requestStatistic?: boolean) => void; | |
55 | ||
56 | export type CachedRequest = [ | |
57 | ResponseCallback, | |
58 | ErrorCallback, | |
59 | RequestCommand | IncomingRequestCommand, | |
60 | JsonType, | |
61 | ]; | |
62 | ||
63 | export const MessageTrigger = { | |
64 | ...OCPP16MessageTrigger, | |
65 | } as const; | |
66 | export type MessageTrigger = OCPP16MessageTrigger; | |
67 | ||
68 | export type BootNotificationRequest = OCPP16BootNotificationRequest | OCPP20BootNotificationRequest; | |
69 | ||
70 | export type HeartbeatRequest = OCPP16HeartbeatRequest; | |
71 | ||
72 | export type StatusNotificationRequest = | |
73 | | OCPP16StatusNotificationRequest | |
74 | | OCPP20StatusNotificationRequest; | |
75 | ||
76 | export type MeterValuesRequest = OCPP16MeterValuesRequest; | |
77 | ||
78 | export type DataTransferRequest = OCPP16DataTransferRequest; | |
79 | ||
80 | export type DiagnosticsStatusNotificationRequest = OCPP16DiagnosticsStatusNotificationRequest; | |
81 | ||
82 | export type FirmwareStatusNotificationRequest = OCPP16FirmwareStatusNotificationRequest; | |
83 | ||
84 | export type IncomingRequestHandler = ( | |
85 | chargingStation: ChargingStation, | |
86 | commandPayload: JsonType, | |
87 | ) => JsonType | Promise<JsonType>; | |
88 | ||
89 | export const AvailabilityType = { | |
90 | ...OCPP16AvailabilityType, | |
91 | ...OperationalStatusEnumType, | |
92 | } as const; | |
93 | export type AvailabilityType = OCPP16AvailabilityType | OperationalStatusEnumType; | |
94 | ||
95 | export const DiagnosticsStatus = { | |
96 | ...OCPP16DiagnosticsStatus, | |
97 | } as const; | |
98 | export type DiagnosticsStatus = OCPP16DiagnosticsStatus; | |
99 | ||
100 | export const FirmwareStatus = { | |
101 | ...OCPP16FirmwareStatus, | |
102 | } as const; | |
103 | export type FirmwareStatus = OCPP16FirmwareStatus; | |
104 | ||
105 | export type ResponseType = JsonType | OCPPError; | |
106 | ||
107 | export type ReserveNowRequest = OCPP16ReserveNowRequest; | |
108 | ||
109 | export type CancelReservationRequest = OCPP16CancelReservationRequest; |