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