UI protocol: add OCPP heartbeat command support
[e-mobility-charging-stations-simulator.git] / src / charging-station / ui-server / ui-services / UIService001.ts
index 74403ceaaed5cbbbca6b99bc4b740f1da13519b6..57c34c2239a6ee573d7462d5e57c96b1157f2cfc 100644 (file)
@@ -47,6 +47,10 @@ export default class UIService001 extends AbstractUIService {
       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 {
@@ -108,4 +112,8 @@ export default class UIService001 extends AbstractUIService {
       payload
     );
   }
+
+  private handleHeartbeat(uuid: string, payload: RequestPayload): void {
+    this.sendBroadcastChannelRequest(uuid, BroadcastChannelProcedureName.HEARTBEAT, payload);
+  }
 }