Linter fixes.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 4 Apr 2021 20:13:11 +0000 (22:13 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 4 Apr 2021 20:13:11 +0000 (22:13 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/charging-station/AutomaticTransactionGenerator.ts
src/charging-station/ocpp/1.6/OCCP16IncomingRequestService.ts
src/charging-station/ocpp/1.6/OCPP16RequestService.ts
src/charging-station/ocpp/OCPPRequestService.ts
src/utils/Utils.ts

index 763533ed82e12269cb56183708bf0ae7720ab6a0..bb8d75b3ecaacbc06095c73e8216f395915b231e 100644 (file)
@@ -46,7 +46,8 @@ export default class AutomaticTransactionGenerator {
       const transactionId = this.chargingStation.getConnector(Utils.convertToInt(connector)).transactionId;
       if (this.chargingStation.getConnector(Utils.convertToInt(connector)).transactionStarted) {
         logger.info(this.logPrefix(Utils.convertToInt(connector)) + ' ATG OVER. Stop transaction ' + transactionId.toString());
-        await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId), this.chargingStation.getTransactionIdTag(transactionId), reason);
+        await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId),
+          this.chargingStation.getTransactionIdTag(transactionId), reason);
       }
     }
     this.timeToStop = true;
index 0f7e4dab30bcbb0bb610fde7efc26973a8e565c8..5a41771d57ca0c4c9638acacfaed5d28a1420a2f 100644 (file)
@@ -62,7 +62,8 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer
     }
     if (this.chargingStation.getConnector(connectorId)?.transactionStarted) {
       const transactionId = this.chargingStation.getConnector(connectorId).transactionId;
-      const stopResponse = await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId), this.chargingStation.getTransactionIdTag(transactionId), OCPP16StopTransactionReason.UNLOCK_COMMAND);
+      const stopResponse = await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId),
+        this.chargingStation.getTransactionIdTag(transactionId), OCPP16StopTransactionReason.UNLOCK_COMMAND);
       if (stopResponse.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) {
         return Constants.OCPP_RESPONSE_UNLOCKED;
       }
@@ -295,7 +296,8 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer
       if (Utils.convertToInt(connector) > 0 && this.chargingStation.getConnector(Utils.convertToInt(connector))?.transactionId === transactionId) {
         await this.chargingStation.ocppRequestService.sendStatusNotification(Utils.convertToInt(connector), OCPP16ChargePointStatus.FINISHING);
         this.chargingStation.getConnector(Utils.convertToInt(connector)).status = OCPP16ChargePointStatus.FINISHING;
-        await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId), this.chargingStation.getTransactionIdTag(transactionId));
+        await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId),
+          this.chargingStation.getTransactionIdTag(transactionId));
         return Constants.OCPP_RESPONSE_ACCEPTED;
       }
     }
index 7470b3426c2cddbc44e85092353a74007259bad1..4e82845307b2dc0ddc6ae77e27d12512911026cb 100644 (file)
@@ -45,7 +45,8 @@ export default class OCPP16RequestService extends OCPPRequestService {
     }
   }
 
-  public async sendStatusNotification(connectorId: number, status: OCPP16ChargePointStatus, errorCode: OCPP16ChargePointErrorCode = OCPP16ChargePointErrorCode.NO_ERROR): Promise<void> {
+  public async sendStatusNotification(connectorId: number, status: OCPP16ChargePointStatus,
+      errorCode: OCPP16ChargePointErrorCode = OCPP16ChargePointErrorCode.NO_ERROR): Promise<void> {
     try {
       const payload: StatusNotificationRequest = {
         connectorId,
@@ -83,7 +84,8 @@ export default class OCPP16RequestService extends OCPPRequestService {
     }
   }
 
-  public async sendStopTransaction(transactionId: number, meterStop: number, idTag?: string, reason: OCPP16StopTransactionReason = OCPP16StopTransactionReason.NONE): Promise<OCPP16StopTransactionResponse> {
+  public async sendStopTransaction(transactionId: number, meterStop: number, idTag?: string,
+      reason: OCPP16StopTransactionReason = OCPP16StopTransactionReason.NONE): Promise<OCPP16StopTransactionResponse> {
     try {
       const payload: StopTransactionRequest = {
         transactionId,
index 2c2a8a5bed90647880397991a04b65353d7d06b8..290316ccd748b7938bb24b33f3e0e8d31481f0da 100644 (file)
@@ -21,7 +21,8 @@ export default abstract class OCPPRequestService {
     this.ocppResponseService = ocppResponseService;
   }
 
-  public async sendMessage(messageId: string, commandParams: any, messageType: MessageType = MessageType.CALL_RESULT_MESSAGE, commandName: RequestCommand | IncomingRequestCommand): Promise<any> {
+  public async sendMessage(messageId: string, commandParams: any, messageType: MessageType = MessageType.CALL_RESULT_MESSAGE,
+      commandName: RequestCommand | IncomingRequestCommand): Promise<any> {
     // eslint-disable-next-line @typescript-eslint/no-this-alias
     const self = this;
     // Send a message through wsConnection
index 1a0d7b70c1fb26feea3e95886b2ea0c4d4fb1126..e4bc6a7b723f89ff593fff7dee1f9aba97ce2a74 100644 (file)
@@ -104,14 +104,14 @@ export default class Utils {
     return Math.floor(Math.random() * max + 1);
   }
 
-  static roundTo(number: number, scale: number): number {
+  static roundTo(numberValue: number, scale: number): number {
     const roundPower = Math.pow(10, scale);
-    return Math.round(number * roundPower) / roundPower;
+    return Math.round(numberValue * roundPower) / roundPower;
   }
 
-  static truncTo(number: number, scale: number): number {
+  static truncTo(numberValue: number, scale: number): number {
     const truncPower = Math.pow(10, scale);
-    return Math.trunc(number * truncPower) / truncPower;
+    return Math.trunc(numberValue * truncPower) / truncPower;
   }
 
   static getRandomFloatRounded(max: number, min = 0, scale = 2): number {