X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStationWorkerBroadcastChannel.ts;h=c03c4acb81db8aae2a01efee281e5558fbfb3a81;hb=fc28853f03af7666e2f55a244b787157fddadfbc;hp=02febe4ab81d3a275d0b5a216dfe7f172f622eb0;hpb=2896e06dc8d72adf7150b23c941079f622f6f37c;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts index 02febe4a..c03c4acb 100644 --- a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts @@ -39,9 +39,7 @@ import { type StopTransactionRequest, type StopTransactionResponse, } from '../types'; -import { Constants } from '../utils/Constants'; -import { logger } from '../utils/Logger'; -import { Utils } from '../utils/Utils'; +import { Constants, Utils, logger } from '../utils'; const moduleName = 'ChargingStationWorkerBroadcastChannel'; @@ -94,6 +92,11 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne (requestPayload?: BroadcastChannelRequestPayload) => this.chargingStation.stopAutomaticTransactionGenerator(requestPayload?.connectorIds), ], + [ + BroadcastChannelProcedureName.SET_SUPERVISION_URL, + (requestPayload?: BroadcastChannelRequestPayload) => + this.chargingStation.setSupervisionUrl(requestPayload?.url as string), + ], [ BroadcastChannelProcedureName.START_TRANSACTION, async (requestPayload?: BroadcastChannelRequestPayload) => @@ -255,12 +258,12 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne } const [uuid, command, requestPayload] = validatedMessageEvent.data as BroadcastChannelRequest; if ( - requestPayload?.hashIds !== undefined && + !Utils.isNullOrUndefined(requestPayload?.hashIds) && requestPayload?.hashIds?.includes(this.chargingStation.stationInfo.hashId) === false ) { return; } - if (requestPayload?.hashId !== undefined) { + if (!Utils.isNullOrUndefined(requestPayload?.hashId)) { logger.error( `${this.chargingStation.logPrefix()} ${moduleName}.requestHandler: 'hashId' field usage in PDU is deprecated, use 'hashIds' array instead` ); @@ -271,8 +274,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne try { commandResponse = await this.commandHandler(command, requestPayload); if ( - commandResponse === undefined || - commandResponse === null || + Utils.isNullOrUndefined(commandResponse) || Utils.isEmptyObject(commandResponse as CommandResponse) ) { responsePayload = {