X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=src%2Fcharging-station%2FChargingStationWorkerBroadcastChannel.ts;h=8d6cb1c62ac7ff647f1cbbf8a6cf6a240c1520ea;hb=59395dc149654128f2996f4999bccb66270f54e4;hp=4dc295c3531bb887fd32441fb2418d30eb6c6f81;hpb=78202038ffd2aca15aa97f45bc66ba42f40f2ec4;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts index 4dc295c3..8d6cb1c6 100644 --- a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts @@ -13,7 +13,7 @@ import { type HeartbeatRequest, type MeterValuesRequest, RequestCommand, - RequestParams, + type RequestParams, type StatusNotificationRequest, } from '../types/ocpp/Requests'; import { @@ -113,14 +113,18 @@ export default class ChargingStationWorkerBroadcastChannel extends WorkerBroadca this.chargingStation.ocppRequestService.requestHandler< StopTransactionRequest, StartTransactionResponse - >(this.chargingStation, RequestCommand.STOP_TRANSACTION, { - meterStop: this.chargingStation.getEnergyActiveImportRegisterByTransactionId( - requestPayload.transactionId, - true - ), - ...requestPayload, - requestParams, - }), + >( + this.chargingStation, + RequestCommand.STOP_TRANSACTION, + { + meterStop: this.chargingStation.getEnergyActiveImportRegisterByTransactionId( + requestPayload.transactionId, + true + ), + ...requestPayload, + }, + requestParams + ), ], [ BroadcastChannelProcedureName.AUTHORIZE, @@ -184,20 +188,26 @@ export default class ChargingStationWorkerBroadcastChannel extends WorkerBroadca return this.chargingStation.ocppRequestService.requestHandler< MeterValuesRequest, MeterValuesResponse - >(this.chargingStation, RequestCommand.METER_VALUES, { - meterValue: [ - OCPP16ServiceUtils.buildMeterValue( - this.chargingStation, - requestPayload.connectorId, - this.chargingStation.getConnectorStatus(requestPayload.connectorId)?.transactionId, - configuredMeterValueSampleInterval - ? Utils.convertToInt(configuredMeterValueSampleInterval.value) * 1000 - : Constants.DEFAULT_METER_VALUES_INTERVAL - ), - ], - ...requestPayload, - requestParams, - }); + >( + this.chargingStation, + RequestCommand.METER_VALUES, + { + meterValue: [ + // FIXME: Implement OCPP version agnostic helpers + OCPP16ServiceUtils.buildMeterValue( + this.chargingStation, + requestPayload.connectorId, + this.chargingStation.getConnectorStatus(requestPayload.connectorId) + ?.transactionId, + configuredMeterValueSampleInterval + ? Utils.convertToInt(configuredMeterValueSampleInterval.value) * 1000 + : Constants.DEFAULT_METER_VALUES_INTERVAL + ), + ], + ...requestPayload, + }, + requestParams + ); }, ], [