Add trigger message type feature flag in charging station template
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / Requests.ts
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';
6 import {
7 OCPP16AvailabilityType,
8 OCPP16BootNotificationRequest,
9 OCPP16HeartbeatRequest,
10 OCPP16IncomingRequestCommand,
11 OCPP16MessageTrigger,
12 OCPP16RequestCommand,
13 OCPP16StatusNotificationRequest,
14 } from './1.6/Requests';
15 import type { MessageType } from './MessageType';
16
17 export type RequestCommand = OCPP16RequestCommand;
18
19 export const RequestCommand = {
20 ...OCPP16RequestCommand,
21 };
22
23 export type OutgoingRequest = [MessageType.CALL_MESSAGE, string, RequestCommand, JsonType];
24
25 export type RequestParams = {
26 skipBufferingOnError?: boolean;
27 triggerMessage?: boolean;
28 };
29
30 export type IncomingRequestCommand = OCPP16IncomingRequestCommand;
31
32 export const IncomingRequestCommand = {
33 ...OCPP16IncomingRequestCommand,
34 };
35
36 export type IncomingRequest = [MessageType.CALL_MESSAGE, string, IncomingRequestCommand, JsonType];
37
38 export type CachedRequest = [
39 (payload: JsonType, requestPayload: JsonType) => void,
40 (error: OCPPError, requestStatistic?: boolean) => void,
41 RequestCommand | IncomingRequestCommand,
42 JsonType
43 ];
44
45 export type MessageTrigger = OCPP16MessageTrigger;
46
47 export const MessageTrigger = {
48 ...OCPP16MessageTrigger,
49 };
50
51 export type BootNotificationRequest = OCPP16BootNotificationRequest;
52
53 export type HeartbeatRequest = OCPP16HeartbeatRequest;
54
55 export type StatusNotificationRequest = OCPP16StatusNotificationRequest;
56
57 export type MeterValuesRequest = OCPP16MeterValuesRequest;
58
59 export type IncomingRequestHandler = (
60 chargingStation: ChargingStation,
61 commandPayload: JsonType
62 ) => JsonType | Promise<JsonType>;
63
64 export type AvailabilityType = OCPP16AvailabilityType;
65
66 export const AvailabilityType = {
67 ...OCPP16AvailabilityType,
68 };
69
70 export type DiagnosticsStatus = OCPP16DiagnosticsStatus;
71
72 export const DiagnosticsStatus = {
73 ...OCPP16DiagnosticsStatus,
74 };
75
76 export type ResponseType = JsonType | OCPPError;