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