UI protocol: remove hashId field support to route requests
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 5 Sep 2022 21:33:47 +0000 (23:33 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 5 Sep 2022 21:33:47 +0000 (23:33 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStationWorkerBroadcastChannel.ts

index 81996076211150a75e9c7a9c597a1628a8250916..3000626eced8cbd712fc6e047082cd9d54753a18 100644 (file)
@@ -51,24 +51,17 @@ export default class ChargingStationWorkerBroadcastChannel extends WorkerBroadca
     const [uuid, command, requestPayload] = this.validateMessageEvent(messageEvent)
       .data as BroadcastChannelRequest;
 
-    if (requestPayload?.hashIds !== undefined || requestPayload?.hashId !== undefined) {
-      if (
-        requestPayload?.hashId === undefined &&
-        requestPayload?.hashIds?.includes(this.chargingStation.stationInfo.hashId) === false
-      ) {
-        return;
-      }
-      if (
-        requestPayload?.hashIds === undefined &&
-        requestPayload?.hashId !== this.chargingStation.stationInfo.hashId
-      ) {
-        return;
-      }
-      if (requestPayload?.hashId !== undefined) {
-        logger.warn(
-          `${this.chargingStation.logPrefix()} ${moduleName}.requestHandler: 'hashId' field usage in PDU is deprecated, use 'hashIds' instead`
-        );
-      }
+    if (
+      requestPayload?.hashIds !== undefined &&
+      requestPayload?.hashIds?.includes(this.chargingStation.stationInfo.hashId) === false
+    ) {
+      return;
+    }
+    if (requestPayload?.hashId !== undefined) {
+      logger.error(
+        `${this.chargingStation.logPrefix()} ${moduleName}.requestHandler: 'hashId' field usage in PDU is deprecated, use 'hashIds' instead`
+      );
+      return;
     }
 
     let responsePayload: BroadcastChannelResponsePayload;