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