1 import type ChargingStation from
'../../charging-station/ChargingStation';
2 import type OCPPError from
'../../exception/OCPPError';
3 import type { JsonType
} from
'../JsonType';
4 import { OCPP16DiagnosticsStatus
} from
'./1.6/DiagnosticsStatus';
5 import type { OCPP16MeterValuesRequest
} from
'./1.6/MeterValues';
7 OCPP16AvailabilityType
,
8 type OCPP16BootNotificationRequest
,
9 type OCPP16DataTransferRequest
,
10 type OCPP16DiagnosticsStatusNotificationRequest
,
12 type OCPP16FirmwareStatusNotificationRequest
,
13 type OCPP16HeartbeatRequest
,
14 OCPP16IncomingRequestCommand
,
17 type OCPP16StatusNotificationRequest
,
18 } from
'./1.6/Requests';
20 type OCPP20BootNotificationRequest
,
21 OCPP20IncomingRequestCommand
,
23 } from
'./2.0/Requests';
24 import type { MessageType
} from
'./MessageType';
26 export const RequestCommand
= {
27 ...OCPP16RequestCommand
,
28 ...OCPP20RequestCommand
,
30 export type RequestCommand
= OCPP16RequestCommand
| OCPP20RequestCommand
;
32 export type OutgoingRequest
= [MessageType
.CALL_MESSAGE
, string, RequestCommand
, JsonType
];
34 export type RequestParams
= {
35 skipBufferingOnError
?: boolean;
36 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
= OCPP16StatusNotificationRequest
;
69 export type MeterValuesRequest
= OCPP16MeterValuesRequest
;
71 export type DataTransferRequest
= OCPP16DataTransferRequest
;
73 export type DiagnosticsStatusNotificationRequest
= OCPP16DiagnosticsStatusNotificationRequest
;
75 export type FirmwareStatusNotificationRequest
= OCPP16FirmwareStatusNotificationRequest
;
77 export type IncomingRequestHandler
= (
78 chargingStation
: ChargingStation
,
79 commandPayload
: JsonType
80 ) => JsonType
| Promise
<JsonType
>;
82 export const AvailabilityType
= {
83 ...OCPP16AvailabilityType
,
85 export type AvailabilityType
= OCPP16AvailabilityType
;
87 export const DiagnosticsStatus
= {
88 ...OCPP16DiagnosticsStatus
,
90 export type DiagnosticsStatus
= OCPP16DiagnosticsStatus
;
92 export const FirmwareStatus
= {
93 ...OCPP16FirmwareStatus
,
95 export type FirmwareStatus
= OCPP16FirmwareStatus
;
97 export type ResponseType
= JsonType
| OCPPError
;