const transactionId = this.chargingStation.getConnector(Utils.convertToInt(connector)).transactionId;
if (this.chargingStation.getConnector(Utils.convertToInt(connector)).transactionStarted) {
logger.info(this.logPrefix(Utils.convertToInt(connector)) + ' ATG OVER. Stop transaction ' + transactionId.toString());
- await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId), this.chargingStation.getTransactionIdTag(transactionId), reason);
+ await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId),
+ this.chargingStation.getTransactionIdTag(transactionId), reason);
}
}
this.timeToStop = true;
}
if (this.chargingStation.getConnector(connectorId)?.transactionStarted) {
const transactionId = this.chargingStation.getConnector(connectorId).transactionId;
- const stopResponse = await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId), this.chargingStation.getTransactionIdTag(transactionId), OCPP16StopTransactionReason.UNLOCK_COMMAND);
+ const stopResponse = await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId),
+ this.chargingStation.getTransactionIdTag(transactionId), OCPP16StopTransactionReason.UNLOCK_COMMAND);
if (stopResponse.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) {
return Constants.OCPP_RESPONSE_UNLOCKED;
}
if (Utils.convertToInt(connector) > 0 && this.chargingStation.getConnector(Utils.convertToInt(connector))?.transactionId === transactionId) {
await this.chargingStation.ocppRequestService.sendStatusNotification(Utils.convertToInt(connector), OCPP16ChargePointStatus.FINISHING);
this.chargingStation.getConnector(Utils.convertToInt(connector)).status = OCPP16ChargePointStatus.FINISHING;
- await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId), this.chargingStation.getTransactionIdTag(transactionId));
+ await this.chargingStation.ocppRequestService.sendStopTransaction(transactionId, this.chargingStation.getTransactionMeterStop(transactionId),
+ this.chargingStation.getTransactionIdTag(transactionId));
return Constants.OCPP_RESPONSE_ACCEPTED;
}
}
}
}
- public async sendStatusNotification(connectorId: number, status: OCPP16ChargePointStatus, errorCode: OCPP16ChargePointErrorCode = OCPP16ChargePointErrorCode.NO_ERROR): Promise<void> {
+ public async sendStatusNotification(connectorId: number, status: OCPP16ChargePointStatus,
+ errorCode: OCPP16ChargePointErrorCode = OCPP16ChargePointErrorCode.NO_ERROR): Promise<void> {
try {
const payload: StatusNotificationRequest = {
connectorId,
}
}
- public async sendStopTransaction(transactionId: number, meterStop: number, idTag?: string, reason: OCPP16StopTransactionReason = OCPP16StopTransactionReason.NONE): Promise<OCPP16StopTransactionResponse> {
+ public async sendStopTransaction(transactionId: number, meterStop: number, idTag?: string,
+ reason: OCPP16StopTransactionReason = OCPP16StopTransactionReason.NONE): Promise<OCPP16StopTransactionResponse> {
try {
const payload: StopTransactionRequest = {
transactionId,
this.ocppResponseService = ocppResponseService;
}
- public async sendMessage(messageId: string, commandParams: any, messageType: MessageType = MessageType.CALL_RESULT_MESSAGE, commandName: RequestCommand | IncomingRequestCommand): Promise<any> {
+ public async sendMessage(messageId: string, commandParams: any, messageType: MessageType = MessageType.CALL_RESULT_MESSAGE,
+ commandName: RequestCommand | IncomingRequestCommand): Promise<any> {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;
// Send a message through wsConnection
return Math.floor(Math.random() * max + 1);
}
- static roundTo(number: number, scale: number): number {
+ static roundTo(numberValue: number, scale: number): number {
const roundPower = Math.pow(10, scale);
- return Math.round(number * roundPower) / roundPower;
+ return Math.round(numberValue * roundPower) / roundPower;
}
- static truncTo(number: number, scale: number): number {
+ static truncTo(numberValue: number, scale: number): number {
const truncPower = Math.pow(10, scale);
- return Math.trunc(number * truncPower) / truncPower;
+ return Math.trunc(numberValue * truncPower) / truncPower;
}
static getRandomFloatRounded(max: number, min = 0, scale = 2): number {