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