Fix OCPP request handler arguments usage in the inter-workers
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 14 Jan 2023 21:47:59 +0000 (22:47 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 14 Jan 2023 21:47:59 +0000 (22:47 +0100)
communication code

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStationWorkerBroadcastChannel.ts

index ea262a4c46bff108c6d204bafdcaf541c2d2f0f1..0fa3a155469697aa2e1515da39b2287906505949 100644 (file)
@@ -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,21 +188,26 @@ export default class ChargingStationWorkerBroadcastChannel extends WorkerBroadca
           return this.chargingStation.ocppRequestService.requestHandler<
             MeterValuesRequest,
             MeterValuesResponse
-          >(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,
-          });
+          >(
+            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
+          );
         },
       ],
       [