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 type OCPP20StatusNotificationRequest
,
24 } from
'./2.0/Requests';
25 import type { MessageType
} from
'./MessageType';
27 export const RequestCommand
= {
28 ...OCPP16RequestCommand
,
29 ...OCPP20RequestCommand
,
31 export type RequestCommand
= OCPP16RequestCommand
| OCPP20RequestCommand
;
33 export type OutgoingRequest
= [MessageType
.CALL_MESSAGE
, string, RequestCommand
, JsonType
];
35 export type RequestParams
= {
36 skipBufferingOnError
?: boolean;
37 triggerMessage
?: boolean;
41 export const IncomingRequestCommand
= {
42 ...OCPP16IncomingRequestCommand
,
43 ...OCPP20IncomingRequestCommand
,
45 export type IncomingRequestCommand
= OCPP16IncomingRequestCommand
| OCPP20IncomingRequestCommand
;
47 export type IncomingRequest
= [MessageType
.CALL_MESSAGE
, string, IncomingRequestCommand
, JsonType
];
49 export type ResponseCallback
= (payload
: JsonType
, requestPayload
: JsonType
) => void;
51 export type ErrorCallback
= (error
: OCPPError
, requestStatistic
?: boolean) => void;
53 export type CachedRequest
= [
56 RequestCommand
| IncomingRequestCommand
,
60 export const MessageTrigger
= {
61 ...OCPP16MessageTrigger
,
63 export type MessageTrigger
= OCPP16MessageTrigger
;
65 export type BootNotificationRequest
= OCPP16BootNotificationRequest
| OCPP20BootNotificationRequest
;
67 export type HeartbeatRequest
= OCPP16HeartbeatRequest
;
69 export type StatusNotificationRequest
=
70 | OCPP16StatusNotificationRequest
71 | OCPP20StatusNotificationRequest
;
73 export type MeterValuesRequest
= OCPP16MeterValuesRequest
;
75 export type DataTransferRequest
= OCPP16DataTransferRequest
;
77 export type DiagnosticsStatusNotificationRequest
= OCPP16DiagnosticsStatusNotificationRequest
;
79 export type FirmwareStatusNotificationRequest
= OCPP16FirmwareStatusNotificationRequest
;
81 export type IncomingRequestHandler
= (
82 chargingStation
: ChargingStation
,
83 commandPayload
: JsonType
84 ) => JsonType
| Promise
<JsonType
>;
86 export const AvailabilityType
= {
87 ...OCPP16AvailabilityType
,
89 export type AvailabilityType
= OCPP16AvailabilityType
;
91 export const DiagnosticsStatus
= {
92 ...OCPP16DiagnosticsStatus
,
94 export type DiagnosticsStatus
= OCPP16DiagnosticsStatus
;
96 export const FirmwareStatus
= {
97 ...OCPP16FirmwareStatus
,
99 export type FirmwareStatus
= OCPP16FirmwareStatus
;
101 export type ResponseType
= JsonType
| OCPPError
;