UI Protocol: add Authorize command support
[e-mobility-charging-stations-simulator.git] / src / charging-station / ui-server / ui-services / UIService001.ts
index 4740b7d738e2c99829232ba86dcfe9326648c571..4be6a2f2b16f1903a78c0941016a65d1ce594eb5 100644 (file)
@@ -43,6 +43,18 @@ export default class UIService001 extends AbstractUIService {
       ProcedureName.STOP_AUTOMATIC_TRANSACTION_GENERATOR,
       this.handleStopAutomaticTransactionGenerator.bind(this) as ProtocolRequestHandler
     );
+    this.requestHandlers.set(
+      ProcedureName.AUTHORIZE,
+      this.handleAuthorize.bind(this) as ProtocolRequestHandler
+    );
+    this.requestHandlers.set(
+      ProcedureName.STATUS_NOTIFICATION,
+      this.handleStatusNotification.bind(this) as ProtocolRequestHandler
+    );
+    this.requestHandlers.set(
+      ProcedureName.HEARTBEAT,
+      this.handleHeartbeat.bind(this) as ProtocolRequestHandler
+    );
   }
 
   private handleStartChargingStation(uuid: string, payload: RequestPayload): void {
@@ -96,4 +108,20 @@ export default class UIService001 extends AbstractUIService {
       payload
     );
   }
+
+  private handleAuthorize(uuid: string, payload: RequestPayload): void {
+    this.sendBroadcastChannelRequest(uuid, BroadcastChannelProcedureName.AUTHORIZE, payload);
+  }
+
+  private handleStatusNotification(uuid: string, payload: RequestPayload): void {
+    this.sendBroadcastChannelRequest(
+      uuid,
+      BroadcastChannelProcedureName.STATUS_NOTIFICATION,
+      payload
+    );
+  }
+
+  private handleHeartbeat(uuid: string, payload: RequestPayload): void {
+    this.sendBroadcastChannelRequest(uuid, BroadcastChannelProcedureName.HEARTBEAT, payload);
+  }
 }