1 import { OCPP16DiagnosticsStatus
} from
'./1.6/DiagnosticsStatus';
2 import type { OCPP16MeterValuesRequest
} from
'./1.6/MeterValues';
4 OCPP16AvailabilityType
,
5 type OCPP16BootNotificationRequest
,
6 type OCPP16CancelReservationRequest
,
7 type OCPP16DataTransferRequest
,
8 type OCPP16DiagnosticsStatusNotificationRequest
,
10 type OCPP16FirmwareStatusNotificationRequest
,
11 type OCPP16HeartbeatRequest
,
12 OCPP16IncomingRequestCommand
,
15 type OCPP16ReserveNowRequest
,
16 type OCPP16StatusNotificationRequest
,
17 } from
'./1.6/Requests';
18 import { OperationalStatusEnumType
} from
'./2.0/Common';
20 type OCPP20BootNotificationRequest
,
21 OCPP20IncomingRequestCommand
,
23 type OCPP20StatusNotificationRequest
,
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';
30 export const RequestCommand
= {
31 ...OCPP16RequestCommand
,
32 ...OCPP20RequestCommand
,
34 export type RequestCommand
= OCPP16RequestCommand
| OCPP20RequestCommand
;
36 export type OutgoingRequest
= [MessageType
.CALL_MESSAGE
, string, RequestCommand
, JsonType
];
38 export interface RequestParams
{
39 skipBufferingOnError
?: boolean;
40 triggerMessage
?: boolean;
44 export const IncomingRequestCommand
= {
45 ...OCPP16IncomingRequestCommand
,
46 ...OCPP20IncomingRequestCommand
,
48 export type IncomingRequestCommand
= OCPP16IncomingRequestCommand
| OCPP20IncomingRequestCommand
;
50 export type IncomingRequest
= [MessageType
.CALL_MESSAGE
, string, IncomingRequestCommand
, JsonType
];
52 export type ResponseCallback
= (payload
: JsonType
, requestPayload
: JsonType
) => void;
54 export type ErrorCallback
= (error
: OCPPError
, requestStatistic
?: boolean) => void;
56 export type CachedRequest
= [
59 RequestCommand
| IncomingRequestCommand
,
63 export const MessageTrigger
= {
64 ...OCPP16MessageTrigger
,
66 export type MessageTrigger
= OCPP16MessageTrigger
;
68 export type BootNotificationRequest
= OCPP16BootNotificationRequest
| OCPP20BootNotificationRequest
;
70 export type HeartbeatRequest
= OCPP16HeartbeatRequest
;
72 export type StatusNotificationRequest
=
73 | OCPP16StatusNotificationRequest
74 | OCPP20StatusNotificationRequest
;
76 export type MeterValuesRequest
= OCPP16MeterValuesRequest
;
78 export type DataTransferRequest
= OCPP16DataTransferRequest
;
80 export type DiagnosticsStatusNotificationRequest
= OCPP16DiagnosticsStatusNotificationRequest
;
82 export type FirmwareStatusNotificationRequest
= OCPP16FirmwareStatusNotificationRequest
;
84 export type IncomingRequestHandler
= (
85 chargingStation
: ChargingStation
,
86 commandPayload
: JsonType
,
87 ) => JsonType
| Promise
<JsonType
>;
89 export const AvailabilityType
= {
90 ...OCPP16AvailabilityType
,
91 ...OperationalStatusEnumType
,
93 export type AvailabilityType
= OCPP16AvailabilityType
| OperationalStatusEnumType
;
95 export const DiagnosticsStatus
= {
96 ...OCPP16DiagnosticsStatus
,
98 export type DiagnosticsStatus
= OCPP16DiagnosticsStatus
;
100 export const FirmwareStatus
= {
101 ...OCPP16FirmwareStatus
,
103 export type FirmwareStatus
= OCPP16FirmwareStatus
;
105 export type ResponseType
= JsonType
| OCPPError
;
107 export type ReserveNowRequest
= OCPP16ReserveNowRequest
;
109 export type CancelReservationRequest
= OCPP16CancelReservationRequest
;