From d5bff457459d6ca6cae1c14483f83daaf22e2907 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 21 Aug 2021 22:06:59 +0200 Subject: [PATCH] Cleanup: rename isWebSocketOpened to isWebSocketConnectionOpened MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStation.ts | 10 +++++----- src/charging-station/ocpp/OCPPRequestService.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 5c83b7f2..dbabf1e5 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -103,7 +103,7 @@ export default class ChargingStation { } } - public isWebSocketOpen(): boolean { + public isWebSocketConnectionOpened(): boolean { return this.wsConnection?.readyState === WebSocket.OPEN; } @@ -330,7 +330,7 @@ export default class ChargingStation { this.getConnector(Utils.convertToInt(connector)).status = ChargePointStatus.UNAVAILABLE; } } - if (this.isWebSocketOpen()) { + if (this.isWebSocketConnectionOpened()) { this.wsConnection.close(); } if (this.getEnableStatistics()) { @@ -613,7 +613,7 @@ export default class ChargingStation { if (this.isRegistered()) { await this.startMessageSequence(); this.hasStopped && (this.hasStopped = false); - if (this.hasSocketRestarted && this.isWebSocketOpen()) { + if (this.hasSocketRestarted && this.isWebSocketConnectionOpened()) { this.flushMessageQueue(); } } else { @@ -887,7 +887,7 @@ export default class ChargingStation { : 0; if (webSocketPingInterval > 0 && !this.webSocketPingSetInterval) { this.webSocketPingSetInterval = setInterval(() => { - if (this.isWebSocketOpen()) { + if (this.isWebSocketConnectionOpened()) { this.wsConnection.ping((): void => { }); } }, webSocketPingInterval * 1000); @@ -945,7 +945,7 @@ export default class ChargingStation { if (!Utils.isNullOrUndefined(this.stationInfo.supervisionUser) && !Utils.isNullOrUndefined(this.stationInfo.supervisionPassword)) { options.auth = `${this.stationInfo.supervisionUser}:${this.stationInfo.supervisionPassword}`; } - if (this.isWebSocketOpen() && forceCloseOpened) { + if (this.isWebSocketConnectionOpened() && forceCloseOpened) { this.wsConnection.close(); } let protocol; diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index ccc6fc2b..5b1f981c 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -49,7 +49,7 @@ export default abstract class OCPPRequestService { break; } // Check if wsConnection opened and charging station registered - if (this.chargingStation.isWebSocketOpen() && (this.chargingStation.isRegistered() || commandName === RequestCommand.BOOT_NOTIFICATION)) { + if (this.chargingStation.isWebSocketConnectionOpened() && (this.chargingStation.isRegistered() || commandName === RequestCommand.BOOT_NOTIFICATION)) { if (this.chargingStation.getEnableStatistics()) { this.chargingStation.performanceStatistics.addRequestStatistic(commandName, messageType); } -- 2.34.1