From: Jérôme Benoit Date: Thu, 23 Sep 2021 09:46:03 +0000 (+0200) Subject: Consistently use idTag for RFID tag X-Git-Tag: v1.1.7~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f4bf2abdd27ce5ddb64d0efd3763608320efc8d8;p=e-mobility-charging-stations-simulator.git Consistently use idTag for RFID tag Signed-off-by: Jérôme Benoit --- 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]; }