refactor(simulator): permit to check if connector status transition is
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 17 Apr 2023 22:32:34 +0000 (00:32 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 17 Apr 2023 22:32:34 +0000 (00:32 +0200)
     allowed

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts

index 47c711af16fa7f5ba300bd51ab620b20f147188c..52157e3474578ed7b782645370f40c88e86667fa 100644 (file)
@@ -866,7 +866,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
     chargingStation: ChargingStation,
     connectorId: number,
     status: OCPP16ChargePointStatus
-  ): void {
+  ): boolean {
     if (
       connectorId === 0 &&
       !OCPP16Constants.OCPP16ChargePointStatusChargingStationTransition.has([
@@ -879,6 +879,7 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
           chargingStation.getConnectorStatus(connectorId).status
         } to ${status} is not allowed`
       );
+      return false;
     } else if (
       !OCPP16Constants.OCPP16ChargePointStatusConnectorTransition.has([
         chargingStation.getConnectorStatus(connectorId).status as OCPP16ChargePointStatus,
@@ -890,7 +891,9 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils {
           chargingStation.getConnectorStatus(connectorId).status
         } to ${status} is not allowed`
       );
+      return false;
     }
+    return true;
   }
 
   private static buildSampledValue(