UI Server: dedupe some code in helpers
[e-mobility-charging-stations-simulator.git] / src / types / UIProtocol.ts
index 4c25c58e921175b7f41535012591228d9feb24ff..1939fdd5802120683bc0b6ad701c31a7952d5630 100644 (file)
@@ -17,8 +17,9 @@ export type ProtocolRequest = [string, ProcedureName, RequestPayload];
 export type ProtocolResponse = [string, ResponsePayload];
 
 export type ProtocolRequestHandler = (
-  payload: RequestPayload
-) => ResponsePayload | Promise<ResponsePayload>;
+  uuid?: string,
+  payload?: RequestPayload
+) => undefined | Promise<undefined> | ResponsePayload | Promise<ResponsePayload>;
 
 export enum ProcedureName {
   LIST_CHARGING_STATIONS = 'listChargingStations',
@@ -28,9 +29,13 @@ export enum ProcedureName {
   STOP_TRANSACTION = 'stopTransaction',
   START_SIMULATOR = 'startSimulator',
   STOP_SIMULATOR = 'stopSimulator',
+  OPEN_CONNECTION = 'openConnection',
+  CLOSE_CONNECTION = 'closeConnection',
 }
+
 export interface RequestPayload extends JsonObject {
   hashId?: string;
+  hashIds?: string[];
 }
 
 export enum ResponseStatus {