X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStationWorkerBroadcastChannel.ts;h=30cef34eb2e5e7898bfa728aa86488199df597b8;hb=69074173770c04bc5e5aa744b655edf9491daa46;hp=6ffa0f14d648b86941bddd2e764efefb3b2231fb;hpb=268a74bb051fcbbad532fd833f0d8fd2b33b6c64;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts index 6ffa0f14..30cef34e 100644 --- a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts @@ -1,6 +1,6 @@ import type { ChargingStation } from './ChargingStation'; import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils'; -import { OCPP16ServiceUtils } from './ocpp/1.6/OCPP16ServiceUtils'; +import { OCPP16ServiceUtils } from './ocpp'; import { WorkerBroadcastChannel } from './WorkerBroadcastChannel'; import { BaseError, type OCPPError } from '../exception'; import { @@ -37,9 +37,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 +90,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 +256,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 +272,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 = {