repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
eslint: report missed TS rules in the shared rules
[e-mobility-charging-stations-simulator.git]
/
src
/
charging-station
/
ChargingStation.ts
diff --git
a/src/charging-station/ChargingStation.ts
b/src/charging-station/ChargingStation.ts
index 40b846217556023b671d8f31a0f5d7996cc2bd0c..85a62c589d2549e96fd86249cf3fa0e72e80aef0 100644
(file)
--- a/
src/charging-station/ChargingStation.ts
+++ b/
src/charging-station/ChargingStation.ts
@@
-216,7
+216,10
@@
export default class ChargingStation {
}
public isRegistered(): boolean {
}
public isRegistered(): boolean {
- return !this.isInUnknownState() && (this.isInAcceptedState() || this.isInPendingState());
+ return (
+ this.isInUnknownState() === false &&
+ (this.isInAcceptedState() === true || this.isInPendingState() === true)
+ );
}
public isChargingStationAvailable(): boolean {
}
public isChargingStationAvailable(): boolean {
@@
-704,9
+707,9
@@
export default class ChargingStation {
): Promise<StopTransactionResponse> {
const transactionId = this.getConnectorStatus(connectorId).transactionId;
if (
): Promise<StopTransactionResponse> {
const transactionId = this.getConnectorStatus(connectorId).transactionId;
if (
- this.getBeginEndMeterValues() &&
- this.getOcppStrictCompliance() &&
- !this.getOutOfOrderEndMeterValues()
+ this.getBeginEndMeterValues()
=== true
&&
+ this.getOcppStrictCompliance()
=== true
&&
+ this.getOutOfOrderEndMeterValues() === false
) {
// FIXME: Implement OCPP version agnostic helpers
const transactionEndMeterValue = OCPP16ServiceUtils.buildTransactionEndMeterValue(
) {
// FIXME: Implement OCPP version agnostic helpers
const transactionEndMeterValue = OCPP16ServiceUtils.buildTransactionEndMeterValue(
@@
-1196,10
+1199,17
@@
export default class ChargingStation {
}
// Initialize transaction attributes on connectors
for (const connectorId of this.connectors.keys()) {
}
// Initialize transaction attributes on connectors
for (const connectorId of this.connectors.keys()) {
+ if (connectorId > 0 && this.getConnectorStatus(connectorId).transactionStarted === true) {
+ logger.warn(
+ `${this.logPrefix()} Connector ${connectorId} at initialization has a transaction started: ${
+ this.getConnectorStatus(connectorId).transactionId
+ }`
+ );
+ }
if (
connectorId > 0 &&
(this.getConnectorStatus(connectorId).transactionStarted === undefined ||
if (
connectorId > 0 &&
(this.getConnectorStatus(connectorId).transactionStarted === undefined ||
- this.getConnectorStatus(connectorId).transactionStarted ===
false
)
+ this.getConnectorStatus(connectorId).transactionStarted ===
null
)
) {
this.initializeConnectorStatus(connectorId);
}
) {
this.initializeConnectorStatus(connectorId);
}
@@
-1326,7
+1336,7
@@
export default class ChargingStation {
logger.info(
`${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.toString()} succeeded`
);
logger.info(
`${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.toString()} succeeded`
);
- if (
!this.isRegistered()
) {
+ if (
this.isRegistered() === false
) {
// Send BootNotification
let registrationRetryCount = 0;
do {
// Send BootNotification
let registrationRetryCount = 0;
do {
@@
-1336,7
+1346,7
@@
export default class ChargingStation {
>(this, RequestCommand.BOOT_NOTIFICATION, this.bootNotificationRequest, {
skipBufferingOnError: true,
});
>(this, RequestCommand.BOOT_NOTIFICATION, this.bootNotificationRequest, {
skipBufferingOnError: true,
});
- if (
!this.isRegistered()
) {
+ if (
this.isRegistered() === false
) {
this.getRegistrationMaxRetries() !== -1 && registrationRetryCount++;
await Utils.sleep(
this.bootNotificationResponse?.interval
this.getRegistrationMaxRetries() !== -1 && registrationRetryCount++;
await Utils.sleep(
this.bootNotificationResponse?.interval
@@
-1345,12
+1355,12
@@
export default class ChargingStation {
);
}
} while (
);
}
} while (
-
!this.isRegistered()
&&
+
this.isRegistered() === false
&&
(registrationRetryCount <= this.getRegistrationMaxRetries() ||
this.getRegistrationMaxRetries() === -1)
);
}
(registrationRetryCount <= this.getRegistrationMaxRetries() ||
this.getRegistrationMaxRetries() === -1)
);
}
- if (this.isRegistered()) {
+ if (this.isRegistered()
=== true
) {
if (this.isInAcceptedState()) {
await this.startMessageSequence();
}
if (this.isInAcceptedState()) {
await this.startMessageSequence();
}
@@
-1764,8
+1774,7
@@
export default class ChargingStation {
} else if (
!this.getConnectorStatus(connectorId)?.status &&
(this.isChargingStationAvailable() === false ||
} else if (
!this.getConnectorStatus(connectorId)?.status &&
(this.isChargingStationAvailable() === false ||
- (this.isChargingStationAvailable() === true &&
- this.isConnectorAvailable(connectorId) === false))
+ this.isConnectorAvailable(connectorId) === false)
) {
chargePointStatus = ChargePointStatus.UNAVAILABLE;
} else if (
) {
chargePointStatus = ChargePointStatus.UNAVAILABLE;
} else if (
@@
-1841,9
+1850,7
@@
export default class ChargingStation {
if (webSocketPingInterval > 0 && !this.webSocketPingSetInterval) {
this.webSocketPingSetInterval = setInterval(() => {
if (this.isWebSocketConnectionOpened() === true) {
if (webSocketPingInterval > 0 && !this.webSocketPingSetInterval) {
this.webSocketPingSetInterval = setInterval(() => {
if (this.isWebSocketConnectionOpened() === true) {
- this.wsConnection.ping((): void => {
- /* This is intentional */
- });
+ this.wsConnection.ping();
}
}, webSocketPingInterval * 1000);
logger.info(
}
}, webSocketPingInterval * 1000);
logger.info(