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