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';
17 type OCPP20BootNotificationRequest
,
18 OCPP20IncomingRequestCommand
,
20 } from
'./2.0/Requests';
21 import type { MessageType
} from
'./MessageType';
23 export const RequestCommand
= {
24 ...OCPP16RequestCommand
,
25 ...OCPP20RequestCommand
,
27 export type RequestCommand
= OCPP16RequestCommand
| OCPP20RequestCommand
;
29 export type OutgoingRequest
= [MessageType
.CALL_MESSAGE
, string, RequestCommand
, JsonType
];
31 export type RequestParams
= {
32 skipBufferingOnError
?: boolean;
33 triggerMessage
?: boolean;
36 export const IncomingRequestCommand
= {
37 ...OCPP16IncomingRequestCommand
,
38 ...OCPP20IncomingRequestCommand
,
40 export type IncomingRequestCommand
= OCPP16IncomingRequestCommand
| OCPP20IncomingRequestCommand
;
42 export type IncomingRequest
= [MessageType
.CALL_MESSAGE
, string, IncomingRequestCommand
, JsonType
];
44 export type ResponseCallback
= (payload
: JsonType
, requestPayload
: JsonType
) => void;
46 export type ErrorCallback
= (error
: OCPPError
, requestStatistic
?: boolean) => void;
48 export type CachedRequest
= [
51 RequestCommand
| IncomingRequestCommand
,
55 export const MessageTrigger
= {
56 ...OCPP16MessageTrigger
,
58 export type MessageTrigger
= OCPP16MessageTrigger
;
60 export type BootNotificationRequest
= OCPP16BootNotificationRequest
| OCPP20BootNotificationRequest
;
62 export type HeartbeatRequest
= OCPP16HeartbeatRequest
;
64 export type StatusNotificationRequest
= OCPP16StatusNotificationRequest
;
66 export type MeterValuesRequest
= OCPP16MeterValuesRequest
;
68 export type DataTransferRequest
= OCPP16DataTransferRequest
;
70 export type IncomingRequestHandler
= (
71 chargingStation
: ChargingStation
,
72 commandPayload
: JsonType
73 ) => JsonType
| Promise
<JsonType
>;
75 export const AvailabilityType
= {
76 ...OCPP16AvailabilityType
,
78 export type AvailabilityType
= OCPP16AvailabilityType
;
80 export const DiagnosticsStatus
= {
81 ...OCPP16DiagnosticsStatus
,
83 export type DiagnosticsStatus
= OCPP16DiagnosticsStatus
;
85 export type ResponseType
= JsonType
| OCPPError
;