From: Jérôme Benoit Date: Tue, 25 Apr 2023 22:09:46 +0000 (+0200) Subject: fix: align enums key casing if used in compound X-Git-Tag: v1.2.12~71 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=0d6f335fa2cc78fc960d485f48fac41e8047972e;p=e-mobility-charging-stations-simulator.git fix: align enums key casing if used in compound Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index bd96d646..46fae181 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -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) ); - 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)); - 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(stationInfo?.Evses[evse])); - this.evses.get(evseId).availability = AvailabilityType.OPERATIVE; + this.evses.get(evseId).availability = AvailabilityType.Operative; } } } else { diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index 7a2a3cb8..424ee43a 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -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; diff --git a/src/types/ocpp/1.6/Requests.ts b/src/types/ocpp/1.6/Requests.ts index b482d140..73401d35 100644 --- a/src/types/ocpp/1.6/Requests.ts +++ b/src/types/ocpp/1.6/Requests.ts @@ -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 {