Consistently use idTag for RFID tag
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 23 Sep 2021 09:46:03 +0000 (11:46 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 23 Sep 2021 09:46:03 +0000 (11:46 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/charging-station/AutomaticTransactionGenerator.ts
src/charging-station/ChargingStation.ts

index 58a40f61aa014f0720816ad1a70f1f7d9e58da50..b27e15648792e527836a5f10868a776739789ae7 100644 (file)
@@ -114,27 +114,27 @@ export default class AutomaticTransactionGenerator {
     const beginId = PerformanceStatistics.beginMeasure(measureId);
     let startResponse: StartTransactionResponse;
     if (this.chargingStation.hasAuthorizedTags()) {
-      const tagId = this.chargingStation.getRandomTagId();
+      const idTag = this.chargingStation.getRandomIdTag();
       if (this.chargingStation.getAutomaticTransactionGeneratorRequireAuthorize()) {
-        // Authorize tagId
-        const authorizeResponse = await this.chargingStation.ocppRequestService.sendAuthorize(connectorId, tagId);
+        // Authorize idTag
+        const authorizeResponse = await this.chargingStation.ocppRequestService.sendAuthorize(connectorId, idTag);
         if (authorizeResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) {
-          logger.info(this.logPrefix(connectorId) + ' start transaction for tagID ' + tagId);
+          logger.info(this.logPrefix(connectorId) + ' start transaction for idTag ' + idTag);
           // Start transaction
-          startResponse = await this.chargingStation.ocppRequestService.sendStartTransaction(connectorId, tagId);
+          startResponse = await this.chargingStation.ocppRequestService.sendStartTransaction(connectorId, idTag);
           PerformanceStatistics.endMeasure(measureId, beginId);
           return startResponse;
         }
         PerformanceStatistics.endMeasure(measureId, beginId);
         return authorizeResponse;
       }
-      logger.info(this.logPrefix(connectorId) + ' start transaction for tagID ' + tagId);
+      logger.info(this.logPrefix(connectorId) + ' start transaction for idTag ' + idTag);
       // Start transaction
-      startResponse = await this.chargingStation.ocppRequestService.sendStartTransaction(connectorId, tagId);
+      startResponse = await this.chargingStation.ocppRequestService.sendStartTransaction(connectorId, idTag);
       PerformanceStatistics.endMeasure(measureId, beginId);
       return startResponse;
     }
-    logger.info(this.logPrefix(connectorId) + ' start transaction without a tagID');
+    logger.info(this.logPrefix(connectorId) + ' start transaction without a idTag');
     startResponse = await this.chargingStation.ocppRequestService.sendStartTransaction(connectorId);
     PerformanceStatistics.endMeasure(measureId, beginId);
     return startResponse;
index be94daddfe0fadeaf61c6b5778d13e0a947a6d1b..dc95782d7aa78462e6bbe453fa39e33d08f97b84 100644 (file)
@@ -84,7 +84,7 @@ export default class ChargingStation {
     return this.bootNotificationRequest;
   }
 
-  public getRandomTagId(): string {
+  public getRandomIdTag(): string {
     const index = Math.floor(Utils.secureRandom() * this.authorizedTags.length);
     return this.authorizedTags[index];
   }