const logger = require('../utils/Logger');
+const Constants = require('../utils/Constants');
const Utils = require('../utils/Utils');
const {performance, PerformanceObserver} = require('perf_hooks');
const startResponse = await startTransaction(connectorId, this);
if (startResponse.idTagInfo.status !== 'Accepted') {
logger.info(this._basicFormatLog(connectorId) + ' transaction rejected');
- await Utils.sleep(2000);
+ await Utils.sleep(Constants.CHARGING_STATION_ATG_WAIT_TIME);
} else {
// Wait until end of transaction
const wait = Utils.getRandomInt(this._chargingStation._stationInfo.AutomaticTransactionGenerator.maxDuration,
await sendMeterValues(connectorID, interval, this);
}, interval);
} else {
- logger.info(`${this._basicFormatLog()} Charging station MeterValueSampleInterval configuration set to ${interval}ms, not sending MeterValues`);
+ logger.error(`${this._basicFormatLog()} Charging station MeterValueSampleInterval configuration set to ${interval}ms, not sending MeterValues`);
}
}
}
if (this._isSocketRestart) {
this._basicStartMessageSequence();
- if (this._messageQueue.length > 0) {
+ if (!Utils.isEmptyArray(this._messageQueue)) {
this._messageQueue.forEach((message) => {
if (this._wsConnection && this._wsConnection.readyState === WebSocket.OPEN) {
this._wsConnection.send(message);
}
handleResponseStatusNotification(payload, requestPayload) {
- logger.debug(this._basicFormatLog() + ' Status notification response received: %j to status notification request: %j', payload, requestPayload);
+ logger.debug(this._basicFormatLog() + ' Status notification response received: %j to StatusNotification request: %j', payload, requestPayload);
}
handleResponseMeterValues(payload, requestPayload) {
static STATUS_NOTIFICATION_TIMEOUT = 500;
static START_TRANSACTION_TIMEOUT = 500;
- static CHARGING_STATION_DEFAULT_RESET_TIME = 60000 // ms;
+ static CHARGING_STATION_DEFAULT_RESET_TIME = 60000; // ms
+ static CHARGING_STATION_ATG_WAIT_TIME = 2000; // ms
}
module.exports = Constants;