From: Jérôme Benoit Date: Mon, 5 Sep 2022 21:33:47 +0000 (+0200) Subject: UI protocol: remove hashId field support to route requests X-Git-Tag: v1.1.72~21 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2afb4d15045cdb5f521a5d57859ba23505afc852;p=e-mobility-charging-stations-simulator.git UI protocol: remove hashId field support to route requests Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts index 81996076..3000626e 100644 --- a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts @@ -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;