1 import type { ChargingStation
} from
'../../charging-station';
2 import type { OCPPError
} from
'../../exception';
6 OCPP16AvailabilityType
,
7 type OCPP16BootNotificationRequest
,
8 type OCPP16DataTransferRequest
,
9 OCPP16DiagnosticsStatus
,
10 type OCPP16DiagnosticsStatusNotificationRequest
,
12 type OCPP16FirmwareStatusNotificationRequest
,
13 type OCPP16HeartbeatRequest
,
14 OCPP16IncomingRequestCommand
,
16 type OCPP16MeterValuesRequest
,
18 type OCPP16StatusNotificationRequest
,
19 type OCPP20BootNotificationRequest
,
20 OCPP20IncomingRequestCommand
,
22 type OCPP20StatusNotificationRequest
,
25 export const RequestCommand
= {
26 ...OCPP16RequestCommand
,
27 ...OCPP20RequestCommand
,
29 export type RequestCommand
= OCPP16RequestCommand
| OCPP20RequestCommand
;
31 export type OutgoingRequest
= [MessageType
.CALL_MESSAGE
, string, RequestCommand
, JsonType
];
33 export type RequestParams
= {
34 skipBufferingOnError
?: boolean;
35 triggerMessage
?: boolean;
39 export const IncomingRequestCommand
= {
40 ...OCPP16IncomingRequestCommand
,
41 ...OCPP20IncomingRequestCommand
,
43 export type IncomingRequestCommand
= OCPP16IncomingRequestCommand
| OCPP20IncomingRequestCommand
;
45 export type IncomingRequest
= [MessageType
.CALL_MESSAGE
, string, IncomingRequestCommand
, JsonType
];
47 export type ResponseCallback
= (payload
: JsonType
, requestPayload
: JsonType
) => void;
49 export type ErrorCallback
= (error
: OCPPError
, requestStatistic
?: boolean) => void;
51 export type CachedRequest
= [
54 RequestCommand
| IncomingRequestCommand
,
58 export const MessageTrigger
= {
59 ...OCPP16MessageTrigger
,
61 export type MessageTrigger
= OCPP16MessageTrigger
;
63 export type BootNotificationRequest
= OCPP16BootNotificationRequest
| OCPP20BootNotificationRequest
;
65 export type HeartbeatRequest
= OCPP16HeartbeatRequest
;
67 export type StatusNotificationRequest
=
68 | OCPP16StatusNotificationRequest
69 | OCPP20StatusNotificationRequest
;
71 export type MeterValuesRequest
= OCPP16MeterValuesRequest
;
73 export type DataTransferRequest
= OCPP16DataTransferRequest
;
75 export type DiagnosticsStatusNotificationRequest
= OCPP16DiagnosticsStatusNotificationRequest
;
77 export type FirmwareStatusNotificationRequest
= OCPP16FirmwareStatusNotificationRequest
;
79 export type IncomingRequestHandler
= (
80 chargingStation
: ChargingStation
,
81 commandPayload
: JsonType
82 ) => JsonType
| Promise
<JsonType
>;
84 export const AvailabilityType
= {
85 ...OCPP16AvailabilityType
,
87 export type AvailabilityType
= OCPP16AvailabilityType
;
89 export const DiagnosticsStatus
= {
90 ...OCPP16DiagnosticsStatus
,
92 export type DiagnosticsStatus
= OCPP16DiagnosticsStatus
;
94 export const FirmwareStatus
= {
95 ...OCPP16FirmwareStatus
,
97 export type FirmwareStatus
= OCPP16FirmwareStatus
;
99 export type ResponseType
= JsonType
| OCPPError
;