Align some types definition in UI
[e-mobility-charging-stations-simulator.git] / src / charging-station / ui-server / ui-services / AbstractUIService.ts
index 2cfd85fa97081eafa45116a2d5f886c1ef4f97a2..729b816dd15c2c9d1ee8a0215480601365f598d7 100644 (file)
@@ -22,9 +22,11 @@ import type { AbstractUIServer } from '../AbstractUIServer';
 const moduleName = 'AbstractUIService';
 
 export default abstract class AbstractUIService {
-  protected static readonly ProcedureNameToBroadCastChannelProcedureNameMap: Omit<
+  private static readonly ProcedureNameToBroadCastChannelProcedureNameMap: Omit<
     Record<ProcedureName, BroadcastChannelProcedureName>,
-    'startSimulator' | 'stopSimulator' | 'listChargingStations'
+    | ProcedureName.START_SIMULATOR
+    | ProcedureName.STOP_SIMULATOR
+    | ProcedureName.LIST_CHARGING_STATIONS
   > = {
     [ProcedureName.START_CHARGING_STATION]: BroadcastChannelProcedureName.START_CHARGING_STATION,
     [ProcedureName.STOP_CHARGING_STATION]: BroadcastChannelProcedureName.STOP_CHARGING_STATION,
@@ -37,6 +39,7 @@ export default abstract class AbstractUIService {
     [ProcedureName.START_TRANSACTION]: BroadcastChannelProcedureName.START_TRANSACTION,
     [ProcedureName.STOP_TRANSACTION]: BroadcastChannelProcedureName.STOP_TRANSACTION,
     [ProcedureName.AUTHORIZE]: BroadcastChannelProcedureName.AUTHORIZE,
+    [ProcedureName.BOOT_NOTIFICATION]: BroadcastChannelProcedureName.BOOT_NOTIFICATION,
     [ProcedureName.STATUS_NOTIFICATION]: BroadcastChannelProcedureName.STATUS_NOTIFICATION,
     [ProcedureName.HEARTBEAT]: BroadcastChannelProcedureName.HEARTBEAT,
     [ProcedureName.METER_VALUES]: BroadcastChannelProcedureName.METER_VALUES,
@@ -127,7 +130,21 @@ export default abstract class AbstractUIService {
     return this.broadcastChannelRequests.get(uuid) ?? 0;
   }
 
-  protected sendBroadcastChannelRequest(
+  protected handleProtocolRequest(
+    uuid: string,
+    procedureName: ProcedureName,
+    payload: RequestPayload
+  ): void {
+    this.sendBroadcastChannelRequest(
+      uuid,
+      AbstractUIService.ProcedureNameToBroadCastChannelProcedureNameMap[
+        procedureName
+      ] as BroadcastChannelProcedureName,
+      payload
+    );
+  }
+
+  private sendBroadcastChannelRequest(
     uuid: string,
     procedureName: BroadcastChannelProcedureName,
     payload: BroadcastChannelRequestPayload
@@ -154,20 +171,6 @@ export default abstract class AbstractUIService {
     this.broadcastChannelRequests.set(uuid, expectedNumberOfResponses);
   }
 
-  protected handleProtocolRequest(
-    uuid: string,
-    procedureName: ProcedureName,
-    payload: RequestPayload
-  ): void {
-    this.sendBroadcastChannelRequest(
-      uuid,
-      AbstractUIService.ProcedureNameToBroadCastChannelProcedureNameMap[
-        procedureName
-      ] as BroadcastChannelProcedureName,
-      payload
-    );
-  }
-
   private handleListChargingStations(): ResponsePayload {
     return {
       status: ResponseStatus.SUCCESS,