private flushMessageBuffer(): void {
if (this.messageBuffer.size > 0) {
- this.messageBuffer.forEach((message) => {
+ for (const message of this.messageBuffer.values()) {
let beginId: string;
let commandName: RequestCommand;
const [messageType] = JSON.parse(message) as OutgoingRequest | Response | ErrorResponse;
)} payload sent: ${message}`
);
this.messageBuffer.delete(message);
- });
+ }
}
}
logger.error(`${this.logPrefix()} ${errorMsg}`);
throw new BaseError(errorMsg);
}
- // Deprecation template keys section
- ChargingStationUtils.warnDeprecatedTemplateKey(
- stationTemplate,
- 'supervisionUrl',
+ ChargingStationUtils.warnTemplateKeysDeprecation(
this.templateFile,
- this.logPrefix(),
- "Use 'supervisionUrls' instead"
- );
- ChargingStationUtils.convertDeprecatedTemplateKey(
stationTemplate,
- 'supervisionUrl',
- 'supervisionUrls'
- );
- ChargingStationUtils.warnDeprecatedTemplateKey(
- stationTemplate,
- 'authorizationFile',
- this.templateFile,
- this.logPrefix(),
- "Use 'idTagsFile' instead"
- );
- ChargingStationUtils.convertDeprecatedTemplateKey(
- stationTemplate,
- 'authorizationFile',
- 'idTagsFile'
+ this.logPrefix()
);
const stationInfo: ChargingStationInfo =
ChargingStationUtils.stationTemplateToStationInfo(stationTemplate);
private getStationInfo(): ChargingStationInfo {
const stationInfoFromTemplate: ChargingStationInfo = this.getStationInfoFromTemplate();
const stationInfoFromFile: ChargingStationInfo | undefined = this.getStationInfoFromFile();
- // Priority: charging station info from template > charging station info from configuration file > charging station info attribute
+ // Priority:
+ // 1. charging station info from template
+ // 2. charging station info from configuration file
+ // 3. charging station info attribute
if (stationInfoFromFile?.templateHash === stationInfoFromTemplate.templateHash) {
if (this.stationInfo?.infoHash === stationInfoFromFile?.infoHash) {
return this.stationInfo;
}
if (
connectorId > 0 &&
- (this.getConnectorStatus(connectorId)?.transactionStarted === undefined ||
- this.getConnectorStatus(connectorId)?.transactionStarted === null)
+ Utils.isNullOrUndefined(this.getConnectorStatus(connectorId)?.transactionStarted)
) {
this.initializeConnectorStatus(connectorId);
}
// Set default status
connectorStatus = ConnectorStatusEnum.Available;
}
- await this.ocppRequestService.requestHandler<
- StatusNotificationRequest,
- StatusNotificationResponse
- >(
- this,
- RequestCommand.STATUS_NOTIFICATION,
- OCPPServiceUtils.buildStatusNotificationRequest(this, connectorId, connectorStatus)
- );
- this.getConnectorStatus(connectorId).status = connectorStatus;
+ await OCPPServiceUtils.sendAndSetConnectorStatus(this, connectorId, connectorStatus);
}
if (this.stationInfo?.firmwareStatus === FirmwareStatus.Installing) {
await this.ocppRequestService.requestHandler<