Fix broadcast channel payload cleanup for ATG
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 25 Sep 2022 22:04:58 +0000 (00:04 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 25 Sep 2022 22:04:58 +0000 (00:04 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
e-mobility-charging-stations-simulator.code-workspace
src/charging-station/ChargingStation.ts
src/charging-station/ChargingStationWorkerBroadcastChannel.ts

index e0dbb0cdbff0da7c305ab49ce523f7bc29398bb4..b99ab1deeece0eb6d4b5490fd45e6e972912f3c5 100644 (file)
@@ -1,11 +1,10 @@
 {
-       "folders": [
-               {
-                       "path": "."
-               },
-               {
-                       "path": "src/ui/web"
-               }
-       ],
-       "settings": {}
-}
\ No newline at end of file
+  "folders": [
+    {
+      "path": "."
+    },
+    {
+      "path": "src/ui/web"
+    }
+  ]
+}
index 9fabd2a59a0ee69d4c25e301151a45d56ce081f8..d70223e367eb2ecf0b6ef2b656ae475d1b2d66ad 100644 (file)
@@ -711,13 +711,15 @@ export default class ChargingStation {
     }
   }
 
-  public startAutomaticTransactionGenerator(connectorIds?: number[]): void {
-    if (!this.automaticTransactionGenerator) {
-      this.automaticTransactionGenerator = AutomaticTransactionGenerator.getInstance(
+  public startAutomaticTransactionGenerator(
+    connectorIds?: number[],
+    automaticTransactionGeneratorConfiguration?: AutomaticTransactionGeneratorConfiguration
+  ): void {
+    this.automaticTransactionGenerator = AutomaticTransactionGenerator.getInstance(
+      automaticTransactionGeneratorConfiguration ??
         this.getAutomaticTransactionGeneratorConfigurationFromTemplate(),
-        this
-      );
-    }
+      this
+    );
     if (!Utils.isEmptyArray(connectorIds)) {
       for (const connectorId of connectorIds) {
         this.automaticTransactionGenerator.startConnector(connectorId);
index 274267ca446ade938bfd2e519fdf692a5b2f29d7..00780f2f6ed0000c352b0d417ea567ddc2ea1382 100644 (file)
@@ -268,7 +268,7 @@ export default class ChargingStationWorkerBroadcastChannel extends WorkerBroadca
     [
       BroadcastChannelProcedureName.START_AUTOMATIC_TRANSACTION_GENERATOR,
       BroadcastChannelProcedureName.STOP_AUTOMATIC_TRANSACTION_GENERATOR,
-    ].includes(command) === true && delete requestPayload.connectorIds;
+    ].includes(command) === false && delete requestPayload.connectorIds;
   }
 
   private commandResponseToResponsePayload(