refactor: remove unneeded condition at changing availability
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 31 Jul 2023 14:44:44 +0000 (16:44 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 31 Jul 2023 14:44:44 +0000 (16:44 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts

index 35da1670922aa1ee60212334e7f90fb562eec9a6..b70be6fadc8170728fcd06abcda9d88e6e73afc7 100644 (file)
@@ -838,13 +838,8 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
       }
       responses.push(response);
     }
-    if (
-      responses.includes(OCPP16Constants.OCPP_AVAILABILITY_RESPONSE_SCHEDULED) &&
-      !responses.includes(OCPP16Constants.OCPP_AVAILABILITY_RESPONSE_REJECTED)
-    ) {
+    if (responses.includes(OCPP16Constants.OCPP_AVAILABILITY_RESPONSE_SCHEDULED)) {
       return OCPP16Constants.OCPP_AVAILABILITY_RESPONSE_SCHEDULED;
-    } else if (responses.includes(OCPP16Constants.OCPP_AVAILABILITY_RESPONSE_REJECTED)) {
-      return OCPP16Constants.OCPP_AVAILABILITY_RESPONSE_REJECTED;
     }
     return OCPP16Constants.OCPP_AVAILABILITY_RESPONSE_ACCEPTED;
   };
@@ -996,25 +991,25 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
     }
   }
 
-  private static getMeasurandDefaultUnit(
-    measurandType: OCPP16MeterValueMeasurand,
-  ): MeterValueUnit | undefined {
-    switch (measurandType) {
-      case OCPP16MeterValueMeasurand.CURRENT_EXPORT:
-      case OCPP16MeterValueMeasurand.CURRENT_IMPORT:
-      case OCPP16MeterValueMeasurand.CURRENT_OFFERED:
-        return MeterValueUnit.AMP;
-      case OCPP16MeterValueMeasurand.ENERGY_ACTIVE_EXPORT_REGISTER:
-      case OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER:
-        return MeterValueUnit.WATT_HOUR;
-      case OCPP16MeterValueMeasurand.POWER_ACTIVE_EXPORT:
-      case OCPP16MeterValueMeasurand.POWER_ACTIVE_IMPORT:
-      case OCPP16MeterValueMeasurand.POWER_OFFERED:
-        return MeterValueUnit.WATT;
-      case OCPP16MeterValueMeasurand.STATE_OF_CHARGE:
-        return MeterValueUnit.PERCENT;
-      case OCPP16MeterValueMeasurand.VOLTAGE:
-        return MeterValueUnit.VOLT;
-    }
-  }
+  // private static getMeasurandDefaultUnit(
+  //   measurandType: OCPP16MeterValueMeasurand,
+  // ): MeterValueUnit | undefined {
+  //   switch (measurandType) {
+  //     case OCPP16MeterValueMeasurand.CURRENT_EXPORT:
+  //     case OCPP16MeterValueMeasurand.CURRENT_IMPORT:
+  //     case OCPP16MeterValueMeasurand.CURRENT_OFFERED:
+  //       return MeterValueUnit.AMP;
+  //     case OCPP16MeterValueMeasurand.ENERGY_ACTIVE_EXPORT_REGISTER:
+  //     case OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER:
+  //       return MeterValueUnit.WATT_HOUR;
+  //     case OCPP16MeterValueMeasurand.POWER_ACTIVE_EXPORT:
+  //     case OCPP16MeterValueMeasurand.POWER_ACTIVE_IMPORT:
+  //     case OCPP16MeterValueMeasurand.POWER_OFFERED:
+  //       return MeterValueUnit.WATT;
+  //     case OCPP16MeterValueMeasurand.STATE_OF_CHARGE:
+  //       return MeterValueUnit.PERCENT;
+  //     case OCPP16MeterValueMeasurand.VOLTAGE:
+  //       return MeterValueUnit.VOLT;
+  //   }
+  // }
 }