From: Jérôme Benoit Date: Sat, 12 Mar 2022 09:44:31 +0000 (+0100) Subject: Add getter for supervisionUrlOcppKey value X-Git-Tag: v1.1.55~21 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a59737e33418e805972d57d8f52aa3bc0f28d51e;p=e-mobility-charging-stations-simulator.git Add getter for supervisionUrlOcppKey value Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 75094ceb..cc0fd47f 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -105,9 +105,7 @@ export default class ChargingStation { get wsConnectionUrl(): URL { return this.getSupervisionUrlOcppConfiguration() ? new URL( - this.getConfigurationKey( - this.stationInfo.supervisionUrlOcppKey ?? VendorDefaultParametersKey.ConnectionUrl - ).value + + this.getConfigurationKey(this.getSupervisionUrlOcppKey()).value + '/' + this.stationInfo.chargingStationId ) @@ -720,6 +718,10 @@ export default class ChargingStation { } } + private getSupervisionUrlOcppKey(): string { + return this.stationInfo.supervisionUrlOcppKey ?? VendorDefaultParametersKey.ConnectionUrl; + } + private getSupervisionUrlOcppConfiguration(): boolean { return this.stationInfo.supervisionUrlOcppConfiguration ?? false; } @@ -951,12 +953,10 @@ export default class ChargingStation { private initOcppParameters(): void { if ( this.getSupervisionUrlOcppConfiguration() && - !this.getConfigurationKey( - this.stationInfo.supervisionUrlOcppKey ?? VendorDefaultParametersKey.ConnectionUrl - ) + !this.getConfigurationKey(this.getSupervisionUrlOcppKey()) ) { this.addConfigurationKey( - this.stationInfo.supervisionUrlOcppKey ?? VendorDefaultParametersKey.ConnectionUrl, + this.getSupervisionUrlOcppKey(), this.getConfiguredSupervisionUrl().href, { reboot: true } );