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 OCPP16HeartbeatRequest
,
11 OCPP16IncomingRequestCommand
,
14 type OCPP16StatusNotificationRequest
,
15 } from
'./1.6/Requests';
16 import { OCPP20IncomingRequestCommand
, OCPP20RequestCommand
} from
'./2.0/Requests';
17 import type { MessageType
} from
'./MessageType';
19 export const RequestCommand
= {
20 ...OCPP16RequestCommand
,
21 ...OCPP20RequestCommand
,
23 export type RequestCommand
= OCPP16RequestCommand
| OCPP20RequestCommand
;
25 export type OutgoingRequest
= [MessageType
.CALL_MESSAGE
, string, RequestCommand
, JsonType
];
27 export type RequestParams
= {
28 skipBufferingOnError
?: boolean;
29 triggerMessage
?: boolean;
32 export const IncomingRequestCommand
= {
33 ...OCPP16IncomingRequestCommand
,
34 ...OCPP20IncomingRequestCommand
,
36 export type IncomingRequestCommand
= OCPP16IncomingRequestCommand
| OCPP20IncomingRequestCommand
;
38 export type IncomingRequest
= [MessageType
.CALL_MESSAGE
, string, IncomingRequestCommand
, JsonType
];
40 export type ResponseCallback
= (payload
: JsonType
, requestPayload
: JsonType
) => void;
42 export type ErrorCallback
= (error
: OCPPError
, requestStatistic
?: boolean) => void;
44 export type CachedRequest
= [
47 RequestCommand
| IncomingRequestCommand
,
51 export const MessageTrigger
= {
52 ...OCPP16MessageTrigger
,
54 export type MessageTrigger
= OCPP16MessageTrigger
;
56 export type BootNotificationRequest
= OCPP16BootNotificationRequest
;
58 export type HeartbeatRequest
= OCPP16HeartbeatRequest
;
60 export type StatusNotificationRequest
= OCPP16StatusNotificationRequest
;
62 export type MeterValuesRequest
= OCPP16MeterValuesRequest
;
64 export type DataTransferRequest
= OCPP16DataTransferRequest
;
66 export type IncomingRequestHandler
= (
67 chargingStation
: ChargingStation
,
68 commandPayload
: JsonType
69 ) => JsonType
| Promise
<JsonType
>;
71 export const AvailabilityType
= {
72 ...OCPP16AvailabilityType
,
74 export type AvailabilityType
= OCPP16AvailabilityType
;
76 export const DiagnosticsStatus
= {
77 ...OCPP16DiagnosticsStatus
,
79 export type DiagnosticsStatus
= OCPP16DiagnosticsStatus
;
81 export type ResponseType
= JsonType
| OCPPError
;