fix: fix chalk invocation in configuration file handling code
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / Requests.ts
CommitLineData
69074173
JB
1import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus';
2import type { OCPP16MeterValuesRequest } from './1.6/MeterValues';
e7aeea18
JB
3import {
4 OCPP16AvailabilityType,
953d6b02
JB
5 type OCPP16BootNotificationRequest,
6 type OCPP16DataTransferRequest,
c9a4f9ea 7 type OCPP16DiagnosticsStatusNotificationRequest,
d4c84337 8 OCPP16FirmwareStatus,
c9a4f9ea 9 type OCPP16FirmwareStatusNotificationRequest,
953d6b02 10 type OCPP16HeartbeatRequest,
e7aeea18 11 OCPP16IncomingRequestCommand,
c60ed4b8 12 OCPP16MessageTrigger,
e7aeea18 13 OCPP16RequestCommand,
953d6b02 14 type OCPP16StatusNotificationRequest,
69074173
JB
15} from './1.6/Requests';
16import { OperationalStatusEnumType } from './2.0/Common';
17import {
d270cc87
JB
18 type OCPP20BootNotificationRequest,
19 OCPP20IncomingRequestCommand,
20 OCPP20RequestCommand,
6e939d9e 21 type OCPP20StatusNotificationRequest,
69074173
JB
22} from './2.0/Requests';
23import type { MessageType } from './MessageType';
24import type { ChargingStation } from '../../charging-station';
25import type { OCPPError } from '../../exception';
26import type { JsonType } from '../JsonType';
6a64534b 27
e3018bc4
JB
28export const RequestCommand = {
29 ...OCPP16RequestCommand,
953d6b02 30 ...OCPP20RequestCommand,
edd13439
JB
31} as const;
32export type RequestCommand = OCPP16RequestCommand | OCPP20RequestCommand;
e3018bc4 33
5cc4b63b 34export type OutgoingRequest = [MessageType.CALL_MESSAGE, string, RequestCommand, JsonType];
b3ec7bc1 35
83e00df1 36export type RequestParams = {
e3018bc4
JB
37 skipBufferingOnError?: boolean;
38 triggerMessage?: boolean;
8ec8e3d0 39 throwError?: boolean;
83e00df1 40};
e3018bc4 41
e3018bc4
JB
42export const IncomingRequestCommand = {
43 ...OCPP16IncomingRequestCommand,
953d6b02 44 ...OCPP20IncomingRequestCommand,
edd13439
JB
45} as const;
46export type IncomingRequestCommand = OCPP16IncomingRequestCommand | OCPP20IncomingRequestCommand;
e3018bc4 47
5cc4b63b 48export type IncomingRequest = [MessageType.CALL_MESSAGE, string, IncomingRequestCommand, JsonType];
b3ec7bc1 49
d900c8d7
JB
50export type ResponseCallback = (payload: JsonType, requestPayload: JsonType) => void;
51
52export type ErrorCallback = (error: OCPPError, requestStatistic?: boolean) => void;
53
b3ec7bc1 54export type CachedRequest = [
d900c8d7
JB
55 ResponseCallback,
56 ErrorCallback,
b3ec7bc1 57 RequestCommand | IncomingRequestCommand,
5cc4b63b 58 JsonType
b3ec7bc1
JB
59];
60
c60ed4b8
JB
61export const MessageTrigger = {
62 ...OCPP16MessageTrigger,
edd13439
JB
63} as const;
64export type MessageTrigger = OCPP16MessageTrigger;
c60ed4b8 65
d270cc87 66export type BootNotificationRequest = OCPP16BootNotificationRequest | OCPP20BootNotificationRequest;
c0560973 67
ef6fa3fb
JB
68export type HeartbeatRequest = OCPP16HeartbeatRequest;
69
6e939d9e
JB
70export type StatusNotificationRequest =
71 | OCPP16StatusNotificationRequest
72 | OCPP20StatusNotificationRequest;
ef6fa3fb
JB
73
74export type MeterValuesRequest = OCPP16MeterValuesRequest;
75
91a7d3ea
JB
76export type DataTransferRequest = OCPP16DataTransferRequest;
77
c9a4f9ea
JB
78export type DiagnosticsStatusNotificationRequest = OCPP16DiagnosticsStatusNotificationRequest;
79
80export type FirmwareStatusNotificationRequest = OCPP16FirmwareStatusNotificationRequest;
81
e3018bc4
JB
82export type IncomingRequestHandler = (
83 chargingStation: ChargingStation,
84 commandPayload: JsonType
85) => JsonType | Promise<JsonType>;
86
c0560973 87export const AvailabilityType = {
e7aeea18 88 ...OCPP16AvailabilityType,
2585c6e9 89 ...OperationalStatusEnumType,
edd13439 90} as const;
2585c6e9 91export type AvailabilityType = OCPP16AvailabilityType | OperationalStatusEnumType;
47e22477
JB
92
93export const DiagnosticsStatus = {
e7aeea18 94 ...OCPP16DiagnosticsStatus,
edd13439
JB
95} as const;
96export type DiagnosticsStatus = OCPP16DiagnosticsStatus;
e3018bc4 97
d4c84337
JB
98export const FirmwareStatus = {
99 ...OCPP16FirmwareStatus,
100} as const;
101export type FirmwareStatus = OCPP16FirmwareStatus;
102
e3018bc4 103export type ResponseType = JsonType | OCPPError;