fix: align enums key casing if used in compound
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 25 Apr 2023 22:09:46 +0000 (00:09 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 25 Apr 2023 22:09:46 +0000 (00:09 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/types/ocpp/1.6/Requests.ts

index bd96d646c773da0cee233562b42fc4b2b0c9cec6..46fae1811d4e0f7bdc7b435047bb60f9ff00c70a 100644 (file)
@@ -237,11 +237,11 @@ export class ChargingStation {
   }
 
   public isChargingStationAvailable(): boolean {
-    return this.getConnectorStatus(0)?.availability === AvailabilityType.OPERATIVE;
+    return this.getConnectorStatus(0)?.availability === AvailabilityType.Operative;
   }
 
   public isConnectorAvailable(id: number): boolean {
-    return id > 0 && this.getConnectorStatus(id)?.availability === AvailabilityType.OPERATIVE;
+    return id > 0 && this.getConnectorStatus(id)?.availability === AvailabilityType.Operative;
   }
 
   public getNumberOfConnectors(): number {
@@ -1288,7 +1288,7 @@ export class ChargingStation {
               lastConnectorId,
               Utils.cloneObject<ConnectorStatus>(connectorStatus)
             );
-            this.getConnectorStatus(lastConnectorId).availability = AvailabilityType.OPERATIVE;
+            this.getConnectorStatus(lastConnectorId).availability = AvailabilityType.Operative;
             if (Utils.isUndefined(this.getConnectorStatus(lastConnectorId)?.chargingProfiles)) {
               this.getConnectorStatus(lastConnectorId).chargingProfiles = [];
             }
@@ -1303,7 +1303,7 @@ export class ChargingStation {
             const connectorStatus = stationInfo?.Connectors[randConnectorId.toString()];
             this.checkStationInfoConnectorStatus(randConnectorId, connectorStatus);
             this.connectors.set(index, Utils.cloneObject<ConnectorStatus>(connectorStatus));
-            this.getConnectorStatus(index).availability = AvailabilityType.OPERATIVE;
+            this.getConnectorStatus(index).availability = AvailabilityType.Operative;
             if (Utils.isUndefined(this.getConnectorStatus(index)?.chargingProfiles)) {
               this.getConnectorStatus(index).chargingProfiles = [];
             }
@@ -1361,7 +1361,7 @@ export class ChargingStation {
         for (const evse in stationInfo?.Evses) {
           const evseId = Utils.convertToInt(evse);
           this.evses.set(evseId, Utils.cloneObject<EvseStatus>(stationInfo?.Evses[evse]));
-          this.evses.get(evseId).availability = AvailabilityType.OPERATIVE;
+          this.evses.get(evseId).availability = AvailabilityType.Operative;
         }
       }
     } else {
index 7a2a3cb8be57b15c21fd41f86f567298d584438e..424ee43a5a6a27a8b6e11bcf4849dc0186395716 100644 (file)
@@ -729,7 +729,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       return OCPP16Constants.OCPP_AVAILABILITY_RESPONSE_REJECTED;
     }
     const chargePointStatus: OCPP16ChargePointStatus =
-      commandPayload.type === OCPP16AvailabilityType.OPERATIVE
+      commandPayload.type === OCPP16AvailabilityType.Operative
         ? OCPP16ChargePointStatus.Available
         : OCPP16ChargePointStatus.Unavailable;
     if (connectorId === 0) {
@@ -753,7 +753,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
       connectorId > 0 &&
       (chargingStation.isChargingStationAvailable() === true ||
         (chargingStation.isChargingStationAvailable() === false &&
-          commandPayload.type === OCPP16AvailabilityType.INOPERATIVE))
+          commandPayload.type === OCPP16AvailabilityType.Inoperative))
     ) {
       if (chargingStation.getConnectorStatus(connectorId)?.transactionStarted === true) {
         chargingStation.getConnectorStatus(connectorId).availability = commandPayload.type;
index b482d1405e150f1e6178ee17126ca89bbd7a8e7a..73401d35ca1ee6573b3c993b17b419c9f36db551 100644 (file)
@@ -114,8 +114,8 @@ export interface SetChargingProfileRequest extends JsonObject {
 }
 
 export enum OCPP16AvailabilityType {
-  INOPERATIVE = 'Inoperative',
-  OPERATIVE = 'Operative',
+  Inoperative = 'Inoperative',
+  Operative = 'Operative',
 }
 
 export interface ChangeAvailabilityRequest extends JsonObject {