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