From f4bf2abdd27ce5ddb64d0efd3763608320efc8d8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 23 Sep 2021 11:46:03 +0200 Subject: [PATCH] Consistently use idTag for RFID tag MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../AutomaticTransactionGenerator.ts | 16 ++++++++-------- src/charging-station/ChargingStation.ts | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index 58a40f61..b27e1564 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -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; diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index be94dadd..dc95782d 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -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]; } -- 2.34.1