Comment out performance statistics debug code
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / Requests.ts
index 99a3f817b064301c55d396c28f11a557c0c6b90e..1aa015b6c956500e953a0d3bc23caa590f244dbe 100644 (file)
@@ -6,8 +6,10 @@ import type { OCPP16MeterValuesRequest } from './1.6/MeterValues';
 import {
   OCPP16AvailabilityType,
   OCPP16BootNotificationRequest,
+  OCPP16DataTransferRequest,
   OCPP16HeartbeatRequest,
   OCPP16IncomingRequestCommand,
+  OCPP16MessageTrigger,
   OCPP16RequestCommand,
   OCPP16StatusNotificationRequest,
 } from './1.6/Requests';
@@ -21,10 +23,10 @@ export const RequestCommand = {
 
 export type OutgoingRequest = [MessageType.CALL_MESSAGE, string, RequestCommand, JsonType];
 
-export interface RequestParams {
+export type RequestParams = {
   skipBufferingOnError?: boolean;
   triggerMessage?: boolean;
-}
+};
 
 export type IncomingRequestCommand = OCPP16IncomingRequestCommand;
 
@@ -34,13 +36,23 @@ export const IncomingRequestCommand = {
 
 export type IncomingRequest = [MessageType.CALL_MESSAGE, string, IncomingRequestCommand, JsonType];
 
+export type ResponseCallback = (payload: JsonType, requestPayload: JsonType) => void;
+
+export type ErrorCallback = (error: OCPPError, requestStatistic?: boolean) => void;
+
 export type CachedRequest = [
-  (payload: JsonType, requestPayload: JsonType) => void,
-  (error: OCPPError, requestStatistic?: boolean) => void,
+  ResponseCallback,
+  ErrorCallback,
   RequestCommand | IncomingRequestCommand,
   JsonType
 ];
 
+export type MessageTrigger = OCPP16MessageTrigger;
+
+export const MessageTrigger = {
+  ...OCPP16MessageTrigger,
+};
+
 export type BootNotificationRequest = OCPP16BootNotificationRequest;
 
 export type HeartbeatRequest = OCPP16HeartbeatRequest;
@@ -49,6 +61,8 @@ export type StatusNotificationRequest = OCPP16StatusNotificationRequest;
 
 export type MeterValuesRequest = OCPP16MeterValuesRequest;
 
+export type DataTransferRequest = OCPP16DataTransferRequest;
+
 export type IncomingRequestHandler = (
   chargingStation: ChargingStation,
   commandPayload: JsonType