Commit | Line | Data |
---|---|---|
8114d10e | 1 | import type ChargingStation from '../../charging-station/ChargingStation'; |
6c1761d4 JB |
2 | import type OCPPError from '../../exception/OCPPError'; |
3 | import type { JsonType } from '../JsonType'; | |
8114d10e | 4 | import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus'; |
6c1761d4 | 5 | import type { OCPP16MeterValuesRequest } from './1.6/MeterValues'; |
e7aeea18 JB |
6 | import { |
7 | OCPP16AvailabilityType, | |
953d6b02 JB |
8 | type OCPP16BootNotificationRequest, |
9 | type OCPP16DataTransferRequest, | |
c9a4f9ea | 10 | type OCPP16DiagnosticsStatusNotificationRequest, |
d4c84337 | 11 | OCPP16FirmwareStatus, |
c9a4f9ea | 12 | type OCPP16FirmwareStatusNotificationRequest, |
953d6b02 | 13 | type OCPP16HeartbeatRequest, |
e7aeea18 | 14 | OCPP16IncomingRequestCommand, |
c60ed4b8 | 15 | OCPP16MessageTrigger, |
e7aeea18 | 16 | OCPP16RequestCommand, |
953d6b02 | 17 | type OCPP16StatusNotificationRequest, |
e7aeea18 | 18 | } from './1.6/Requests'; |
d270cc87 JB |
19 | import { |
20 | type OCPP20BootNotificationRequest, | |
21 | OCPP20IncomingRequestCommand, | |
22 | OCPP20RequestCommand, | |
23 | } from './2.0/Requests'; | |
6c1761d4 | 24 | import type { MessageType } from './MessageType'; |
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; | |
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 | ||
67 | export type StatusNotificationRequest = OCPP16StatusNotificationRequest; | |
68 | ||
69 | export type MeterValuesRequest = OCPP16MeterValuesRequest; | |
70 | ||
91a7d3ea JB |
71 | export type DataTransferRequest = OCPP16DataTransferRequest; |
72 | ||
c9a4f9ea JB |
73 | export type DiagnosticsStatusNotificationRequest = OCPP16DiagnosticsStatusNotificationRequest; |
74 | ||
75 | export type FirmwareStatusNotificationRequest = OCPP16FirmwareStatusNotificationRequest; | |
76 | ||
e3018bc4 JB |
77 | export type IncomingRequestHandler = ( |
78 | chargingStation: ChargingStation, | |
79 | commandPayload: JsonType | |
80 | ) => JsonType | Promise<JsonType>; | |
81 | ||
c0560973 | 82 | export const AvailabilityType = { |
e7aeea18 | 83 | ...OCPP16AvailabilityType, |
edd13439 JB |
84 | } as const; |
85 | export type AvailabilityType = OCPP16AvailabilityType; | |
47e22477 JB |
86 | |
87 | export const DiagnosticsStatus = { | |
e7aeea18 | 88 | ...OCPP16DiagnosticsStatus, |
edd13439 JB |
89 | } as const; |
90 | export type DiagnosticsStatus = OCPP16DiagnosticsStatus; | |
e3018bc4 | 91 | |
d4c84337 JB |
92 | export const FirmwareStatus = { |
93 | ...OCPP16FirmwareStatus, | |
94 | } as const; | |
95 | export type FirmwareStatus = OCPP16FirmwareStatus; | |
96 | ||
e3018bc4 | 97 | export type ResponseType = JsonType | OCPPError; |