X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStationWorkerBroadcastChannel.ts;h=c03c4acb81db8aae2a01efee281e5558fbfb3a81;hb=db59d71ee08527ee544ce78b1a947c4713b6beea;hp=1a2943a71c842f90c83b3c1a68bc6de17f9affc5;hpb=368a6eda4a2cb8f8f6daaf44fb029fa18bfdbff4;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts index 1a2943a7..c03c4acb 100644 --- a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts @@ -1,7 +1,9 @@ -import type { ChargingStation } from './ChargingStation'; -import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils'; +import { + type ChargingStation, + ChargingStationConfigurationUtils, + WorkerBroadcastChannel, +} from './internal'; import { OCPP16ServiceUtils } from './ocpp'; -import { WorkerBroadcastChannel } from './WorkerBroadcastChannel'; import { BaseError, type OCPPError } from '../exception'; import { AuthorizationStatus, @@ -37,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'; @@ -92,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) => @@ -253,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` ); @@ -269,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 = {