}
public start(): void {
- if (this.checkChargingStation() === false) {
+ if (
+ ChargingStationUtils.checkChargingStation(this.chargingStation, this.logPrefix()) === false
+ ) {
return;
}
if (this.started === true) {
}
public startConnector(connectorId: number): void {
- if (this.checkChargingStation(connectorId) === false) {
+ if (
+ ChargingStationUtils.checkChargingStation(
+ this.chargingStation,
+ this.logPrefix(connectorId)
+ ) === false
+ ) {
return;
}
if (this.connectorsStatus.has(connectorId) === false) {
this.connectorsStatus.get(connectorId).rejectedStartTransactionRequests++;
}
}
-
- private checkChargingStation(connectorId?: number): boolean {
- if (this.chargingStation.started === false && this.chargingStation.starting === false) {
- logger.warn(`${this.logPrefix(connectorId)} charging station is stopped, cannot proceed`);
- return false;
- }
- return true;
- }
}
.digest('hex');
}
+ public static checkChargingStation(chargingStation: ChargingStation, logPrefix: string): boolean {
+ if (chargingStation.started === false && chargingStation.starting === false) {
+ logger.warn(`${logPrefix} charging station is stopped, cannot proceed`);
+ return false;
+ }
+ return true;
+ }
+
public static getTemplateMaxNumberOfConnectors(stationTemplate: ChargingStationTemplate): number {
const templateConnectors = stationTemplate?.Connectors;
if (!templateConnectors) {
maxDelay = 30,
minDelay = 15
): Promise<void> {
- chargingStation.stopAutomaticTransactionGenerator();
+ if (
+ ChargingStationUtils.checkChargingStation(chargingStation, chargingStation.logPrefix()) ===
+ false
+ ) {
+ return;
+ }
for (const connectorId of chargingStation.connectors.keys()) {
if (
connectorId > 0 &&
}
} while (transactionsStarted);
await Utils.sleep(Utils.getRandomInteger(maxDelay, minDelay) * 1000);
+ if (
+ ChargingStationUtils.checkChargingStation(chargingStation, chargingStation.logPrefix()) ===
+ false
+ ) {
+ return;
+ }
await chargingStation.ocppRequestService.requestHandler<
OCPP16FirmwareStatusNotificationRequest,
OCPP16FirmwareStatusNotificationResponse