From f7f98c68f78566039b7d6f53391e874d79a8b022 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 15 Apr 2022 12:44:51 +0200 Subject: [PATCH] Properly name OCPP command handler methods MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../AutomaticTransactionGenerator.ts | 12 +++--- src/charging-station/ChargingStation.ts | 38 +++++++++--------- src/charging-station/UIWebSocketServer.ts | 2 +- .../ocpp/1.6/OCPP16IncomingRequestService.ts | 40 +++++++++---------- .../ocpp/1.6/OCPP16RequestService.ts | 6 +-- .../ocpp/1.6/OCPP16ResponseService.ts | 16 ++++---- .../ocpp/OCPPIncomingRequestService.ts | 2 +- .../ocpp/OCPPRequestService.ts | 6 +-- .../ocpp/OCPPResponseService.ts | 2 +- .../AbstractUIService.ts | 2 +- 10 files changed, 62 insertions(+), 64 deletions(-) diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index a8bd79ac..23f78833 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -278,7 +278,7 @@ export default class AutomaticTransactionGenerator { this.chargingStation.getConnectorStatus(connectorId).authorizeIdTag = idTag; // Authorize idTag const authorizeResponse: AuthorizeResponse = - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< AuthorizeRequest, AuthorizeResponse >(RequestCommand.AUTHORIZE, { @@ -289,7 +289,7 @@ export default class AutomaticTransactionGenerator { this.connectorsStatus.get(connectorId).acceptedAuthorizeRequests++; logger.info(this.logPrefix(connectorId) + ' start transaction for idTag ' + idTag); // Start transaction - startResponse = await this.chargingStation.ocppRequestService.sendMessageHandler< + startResponse = await this.chargingStation.ocppRequestService.requestHandler< StartTransactionRequest, StartTransactionResponse >(RequestCommand.START_TRANSACTION, { @@ -305,7 +305,7 @@ export default class AutomaticTransactionGenerator { } logger.info(this.logPrefix(connectorId) + ' start transaction for idTag ' + idTag); // Start transaction - startResponse = await this.chargingStation.ocppRequestService.sendMessageHandler< + startResponse = await this.chargingStation.ocppRequestService.requestHandler< StartTransactionRequest, StartTransactionResponse >(RequestCommand.START_TRANSACTION, { @@ -316,7 +316,7 @@ export default class AutomaticTransactionGenerator { return startResponse; } logger.info(this.logPrefix(connectorId) + ' start transaction without an idTag'); - startResponse = await this.chargingStation.ocppRequestService.sendMessageHandler< + startResponse = await this.chargingStation.ocppRequestService.requestHandler< StartTransactionRequest, StartTransactionResponse >(RequestCommand.START_TRANSACTION, { connectorId }); @@ -345,7 +345,7 @@ export default class AutomaticTransactionGenerator { connectorId, this.chargingStation.getEnergyActiveImportRegisterByTransactionId(transactionId) ); - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< MeterValuesRequest, MeterValuesResponse >(RequestCommand.METER_VALUES, { @@ -354,7 +354,7 @@ export default class AutomaticTransactionGenerator { meterValue: transactionEndMeterValue, }); } - stopResponse = await this.chargingStation.ocppRequestService.sendMessageHandler< + stopResponse = await this.chargingStation.ocppRequestService.requestHandler< StopTransactionRequest, StopTransactionResponse >(RequestCommand.STOP_TRANSACTION, { diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 4ed293e4..bfd3eb6f 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -442,7 +442,7 @@ export default class ChargingStation { ) { // eslint-disable-next-line @typescript-eslint/no-misused-promises this.heartbeatSetInterval = setInterval(async (): Promise => { - await this.ocppRequestService.sendMessageHandler( + await this.ocppRequestService.requestHandler( RequestCommand.HEARTBEAT ); }, this.getHeartbeatInterval()); @@ -514,7 +514,7 @@ export default class ChargingStation { this.getConnectorStatus(connectorId).transactionId, interval ); - await this.ocppRequestService.sendMessageHandler( + await this.ocppRequestService.requestHandler( RequestCommand.METER_VALUES, { connectorId, @@ -619,7 +619,7 @@ export default class ChargingStation { await this.stopMessageSequence(reason); for (const connectorId of this.connectors.keys()) { if (connectorId > 0) { - await this.ocppRequestService.sendMessageHandler< + await this.ocppRequestService.requestHandler< StatusNotificationRequest, StatusNotificationResponse >(RequestCommand.STATUS_NOTIFICATION, { @@ -1391,7 +1391,7 @@ export default class ChargingStation { // Send BootNotification let registrationRetryCount = 0; do { - this.bootNotificationResponse = await this.ocppRequestService.sendMessageHandler< + this.bootNotificationResponse = await this.ocppRequestService.requestHandler< BootNotificationRequest, BootNotificationResponse >( @@ -1510,7 +1510,7 @@ export default class ChargingStation { )}` ); // Process the call - await this.ocppIncomingRequestService.handleRequest( + await this.ocppIncomingRequestService.incomingRequestHandler( messageId, commandName, commandPayload @@ -1763,7 +1763,7 @@ export default class ChargingStation { private async startMessageSequence(): Promise { if (this.stationInfo.autoRegister) { - await this.ocppRequestService.sendMessageHandler< + await this.ocppRequestService.requestHandler< BootNotificationRequest, BootNotificationResponse >( @@ -1796,7 +1796,7 @@ export default class ChargingStation { this.getConnectorStatus(connectorId)?.bootStatus ) { // Send status in template at startup - await this.ocppRequestService.sendMessageHandler< + await this.ocppRequestService.requestHandler< StatusNotificationRequest, StatusNotificationResponse >(RequestCommand.STATUS_NOTIFICATION, { @@ -1812,7 +1812,7 @@ export default class ChargingStation { this.getConnectorStatus(connectorId)?.bootStatus ) { // Send status in template after reset - await this.ocppRequestService.sendMessageHandler< + await this.ocppRequestService.requestHandler< StatusNotificationRequest, StatusNotificationResponse >(RequestCommand.STATUS_NOTIFICATION, { @@ -1824,7 +1824,7 @@ export default class ChargingStation { this.getConnectorStatus(connectorId).bootStatus; } else if (!this.stopped && this.getConnectorStatus(connectorId)?.status) { // Send previous status at template reload - await this.ocppRequestService.sendMessageHandler< + await this.ocppRequestService.requestHandler< StatusNotificationRequest, StatusNotificationResponse >(RequestCommand.STATUS_NOTIFICATION, { @@ -1834,7 +1834,7 @@ export default class ChargingStation { }); } else { // Send default status - await this.ocppRequestService.sendMessageHandler< + await this.ocppRequestService.requestHandler< StatusNotificationRequest, StatusNotificationResponse >(RequestCommand.STATUS_NOTIFICATION, { @@ -1888,16 +1888,16 @@ export default class ChargingStation { connectorId, this.getEnergyActiveImportRegisterByTransactionId(transactionId) ); - await this.ocppRequestService.sendMessageHandler< - MeterValuesRequest, - MeterValuesResponse - >(RequestCommand.METER_VALUES, { - connectorId, - transactionId, - meterValue: transactionEndMeterValue, - }); + await this.ocppRequestService.requestHandler( + RequestCommand.METER_VALUES, + { + connectorId, + transactionId, + meterValue: transactionEndMeterValue, + } + ); } - await this.ocppRequestService.sendMessageHandler< + await this.ocppRequestService.requestHandler< StopTransactionRequest, StopTransactionResponse >(RequestCommand.STOP_TRANSACTION, { diff --git a/src/charging-station/UIWebSocketServer.ts b/src/charging-station/UIWebSocketServer.ts index 5ffc9e0c..11069551 100644 --- a/src/charging-station/UIWebSocketServer.ts +++ b/src/charging-station/UIWebSocketServer.ts @@ -53,7 +53,7 @@ export default class UIWebSocketServer extends Server { } this.uiServices .get(version) - .handleMessage(command, payload) + .messageHandler(command, payload) .catch(() => { logger.error( `${this.logPrefix()} Error while handling command %s message: %j`, diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index 1befa1c7..8d5d0a20 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -126,7 +126,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer ]); } - public async handleRequest( + public async incomingRequestHandler( messageId: string, commandName: OCPP16IncomingRequestCommand, commandPayload: JsonType @@ -235,7 +235,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer connectorId, this.chargingStation.getEnergyActiveImportRegisterByTransactionId(transactionId) ); - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16MeterValuesRequest, OCPP16MeterValuesResponse >(OCPP16RequestCommand.METER_VALUES, { @@ -244,7 +244,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer meterValue: transactionEndMeterValue, }); } - const stopResponse = await this.chargingStation.ocppRequestService.sendMessageHandler< + const stopResponse = await this.chargingStation.ocppRequestService.requestHandler< OCPP16StopTransactionRequest, OCPP16StopTransactionResponse >(OCPP16RequestCommand.STOP_TRANSACTION, { @@ -258,7 +258,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer } return Constants.OCPP_RESPONSE_UNLOCK_FAILED; } - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16StatusNotificationRequest, OCPP16StatusNotificationResponse >(OCPP16RequestCommand.STATUS_NOTIFICATION, { @@ -530,7 +530,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer } this.chargingStation.getConnectorStatus(id).availability = commandPayload.type; if (response === Constants.OCPP_AVAILABILITY_RESPONSE_ACCEPTED) { - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16StatusNotificationRequest, OCPP16StatusNotificationResponse >(OCPP16RequestCommand.STATUS_NOTIFICATION, { @@ -555,7 +555,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer return Constants.OCPP_AVAILABILITY_RESPONSE_SCHEDULED; } this.chargingStation.getConnectorStatus(connectorId).availability = commandPayload.type; - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16StatusNotificationRequest, OCPP16StatusNotificationResponse >(OCPP16RequestCommand.STATUS_NOTIFICATION, { @@ -575,7 +575,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer const transactionConnectorId = commandPayload.connectorId; const connectorStatus = this.chargingStation.getConnectorStatus(transactionConnectorId); if (transactionConnectorId) { - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16StatusNotificationRequest, OCPP16StatusNotificationResponse >(OCPP16RequestCommand.STATUS_NOTIFICATION, { @@ -599,7 +599,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer } else if (this.chargingStation.getMayAuthorizeAtRemoteStart()) { connectorStatus.authorizeIdTag = commandPayload.idTag; const authorizeResponse: OCPP16AuthorizeResponse = - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16AuthorizeRequest, OCPP16AuthorizeResponse >(OCPP16RequestCommand.AUTHORIZE, { @@ -624,7 +624,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer connectorStatus.transactionRemoteStarted = true; if ( ( - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16StartTransactionRequest, OCPP16StartTransactionResponse >(OCPP16RequestCommand.START_TRANSACTION, { @@ -669,7 +669,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer connectorStatus.transactionRemoteStarted = true; if ( ( - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16StartTransactionRequest, OCPP16StartTransactionResponse >(OCPP16RequestCommand.START_TRANSACTION, { @@ -715,7 +715,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer this.chargingStation.getConnectorStatus(connectorId).status !== OCPP16ChargePointStatus.AVAILABLE ) { - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16StatusNotificationRequest, OCPP16StatusNotificationResponse >(OCPP16RequestCommand.STATUS_NOTIFICATION, { @@ -772,7 +772,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer connectorId > 0 && this.chargingStation.getConnectorStatus(connectorId)?.transactionId === transactionId ) { - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16StatusNotificationRequest, OCPP16StatusNotificationResponse >(OCPP16RequestCommand.STATUS_NOTIFICATION, { @@ -793,7 +793,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer connectorId, this.chargingStation.getEnergyActiveImportRegisterByTransactionId(transactionId) ); - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16MeterValuesRequest, OCPP16MeterValuesResponse >(OCPP16RequestCommand.METER_VALUES, { @@ -802,7 +802,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer meterValue: transactionEndMeterValue, }); } - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16StopTransactionRequest, OCPP16StopTransactionResponse >(OCPP16RequestCommand.STOP_TRANSACTION, { @@ -868,7 +868,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer info.bytes / 1024 } bytes transferred from diagnostics archive ${info.name}` ); - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< DiagnosticsStatusNotificationRequest, DiagnosticsStatusNotificationResponse >(OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION, { @@ -880,7 +880,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer uri.pathname + diagnosticsArchive ); if (uploadResponse.code === 226) { - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< DiagnosticsStatusNotificationRequest, DiagnosticsStatusNotificationResponse >(OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION, { @@ -907,7 +907,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer OCPP16IncomingRequestCommand.GET_DIAGNOSTICS ); } catch (error) { - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< DiagnosticsStatusNotificationRequest, DiagnosticsStatusNotificationResponse >(OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION, { @@ -928,7 +928,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer uri.protocol } to transfer the diagnostic logs archive` ); - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< DiagnosticsStatusNotificationRequest, DiagnosticsStatusNotificationResponse >(OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION, { @@ -955,7 +955,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer case MessageTrigger.BootNotification: setTimeout(() => { this.chargingStation.ocppRequestService - .sendMessageHandler( + .requestHandler( OCPP16RequestCommand.BOOT_NOTIFICATION, { chargePointModel: @@ -987,7 +987,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer case MessageTrigger.Heartbeat: setTimeout(() => { this.chargingStation.ocppRequestService - .sendMessageHandler( + .requestHandler( OCPP16RequestCommand.HEARTBEAT, null, { diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index 64ce459c..62e96b52 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -22,7 +22,7 @@ export default class OCPP16RequestService extends OCPPRequestService { super(chargingStation, ocppResponseService); } - public async sendMessageHandler( + public async requestHandler( commandName: OCPP16RequestCommand, commandParams?: JsonType, params?: SendParams @@ -30,7 +30,7 @@ export default class OCPP16RequestService extends OCPPRequestService { if (Object.values(OCPP16RequestCommand).includes(commandName)) { return (await this.sendMessage( Utils.generateUUID(), - this.buildCommandPayload(commandName, commandParams), + this.buildRequestPayload(commandName, commandParams), commandName, params )) as unknown as Response; @@ -43,7 +43,7 @@ export default class OCPP16RequestService extends OCPPRequestService { ); } - private buildCommandPayload( + private buildRequestPayload( commandName: OCPP16RequestCommand, commandParams?: JsonType ): Request { diff --git a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts index c5971056..c96cea3a 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts @@ -11,13 +11,11 @@ import { } from '../../../types/ocpp/1.6/Transaction'; import { OCPP16BootNotificationRequest, - OCPP16HeartbeatRequest, OCPP16RequestCommand, OCPP16StatusNotificationRequest, } from '../../../types/ocpp/1.6/Requests'; import { OCPP16BootNotificationResponse, - OCPP16HeartbeatResponse, OCPP16RegistrationStatus, OCPP16StatusNotificationResponse, } from '../../../types/ocpp/1.6/Responses'; @@ -60,7 +58,7 @@ export default class OCPP16ResponseService extends OCPPResponseService { ]); } - public async handleResponse( + public async responseHandler( commandName: OCPP16RequestCommand, payload: JsonType | string, requestPayload: JsonType @@ -308,7 +306,7 @@ export default class OCPP16ResponseService extends OCPPResponseService { requestPayload.meterStart ); this.chargingStation.getBeginEndMeterValues() && - (await this.chargingStation.ocppRequestService.sendMessageHandler< + (await this.chargingStation.ocppRequestService.requestHandler< OCPP16MeterValuesRequest, OCPP16MeterValuesResponse >(OCPP16RequestCommand.METER_VALUES, { @@ -317,7 +315,7 @@ export default class OCPP16ResponseService extends OCPPResponseService { meterValue: this.chargingStation.getConnectorStatus(connectorId).transactionBeginMeterValue, })); - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16StatusNotificationRequest, OCPP16StatusNotificationResponse >(OCPP16RequestCommand.STATUS_NOTIFICATION, { @@ -370,7 +368,7 @@ export default class OCPP16ResponseService extends OCPPResponseService { this.chargingStation.getConnectorStatus(connectorId).status !== OCPP16ChargePointStatus.AVAILABLE ) { - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16StatusNotificationRequest, OCPP16StatusNotificationResponse >(OCPP16RequestCommand.STATUS_NOTIFICATION, { @@ -402,7 +400,7 @@ export default class OCPP16ResponseService extends OCPPResponseService { this.chargingStation.getBeginEndMeterValues() && !this.chargingStation.getOcppStrictCompliance() && this.chargingStation.getOutOfOrderEndMeterValues() && - (await this.chargingStation.ocppRequestService.sendMessageHandler< + (await this.chargingStation.ocppRequestService.requestHandler< OCPP16MeterValuesRequest, OCPP16MeterValuesResponse >(OCPP16RequestCommand.METER_VALUES, { @@ -418,7 +416,7 @@ export default class OCPP16ResponseService extends OCPPResponseService { !this.chargingStation.isChargingStationAvailable() || !this.chargingStation.isConnectorAvailable(transactionConnectorId) ) { - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16StatusNotificationRequest, OCPP16StatusNotificationResponse >(OCPP16RequestCommand.STATUS_NOTIFICATION, { @@ -429,7 +427,7 @@ export default class OCPP16ResponseService extends OCPPResponseService { this.chargingStation.getConnectorStatus(transactionConnectorId).status = OCPP16ChargePointStatus.UNAVAILABLE; } else { - await this.chargingStation.ocppRequestService.sendMessageHandler< + await this.chargingStation.ocppRequestService.requestHandler< OCPP16BootNotificationRequest, OCPP16BootNotificationResponse >(OCPP16RequestCommand.STATUS_NOTIFICATION, { diff --git a/src/charging-station/ocpp/OCPPIncomingRequestService.ts b/src/charging-station/ocpp/OCPPIncomingRequestService.ts index 8d34e734..b5f607f5 100644 --- a/src/charging-station/ocpp/OCPPIncomingRequestService.ts +++ b/src/charging-station/ocpp/OCPPIncomingRequestService.ts @@ -47,7 +47,7 @@ export default abstract class OCPPIncomingRequestService { } } - public abstract handleRequest( + public abstract incomingRequestHandler( messageId: string, commandName: IncomingRequestCommand, commandPayload: JsonType diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 021e09f3..9998d266 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -33,7 +33,7 @@ export default abstract class OCPPRequestService { ) { this.chargingStation = chargingStation; this.ocppResponseService = ocppResponseService; - this.sendMessageHandler.bind(this); + this.requestHandler.bind(this); this.sendResult.bind(this); this.sendError.bind(this); } @@ -210,7 +210,7 @@ export default abstract class OCPPRequestService { } // Handle the request's response try { - await self.ocppResponseService.handleResponse( + await self.ocppResponseService.responseHandler( commandName as RequestCommand, payload, requestPayload @@ -335,7 +335,7 @@ export default abstract class OCPPRequestService { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - public abstract sendMessageHandler( + public abstract requestHandler( commandName: RequestCommand, commandParams?: JsonType, params?: SendParams diff --git a/src/charging-station/ocpp/OCPPResponseService.ts b/src/charging-station/ocpp/OCPPResponseService.ts index d13a7d15..cfb1aa08 100644 --- a/src/charging-station/ocpp/OCPPResponseService.ts +++ b/src/charging-station/ocpp/OCPPResponseService.ts @@ -24,7 +24,7 @@ export default abstract class OCPPResponseService { return OCPPResponseService.instances.get(chargingStation.hashId) as T; } - public abstract handleResponse( + public abstract responseHandler( commandName: RequestCommand, payload: JsonType | string, requestPayload: JsonType diff --git a/src/charging-station/ui-websocket-services/AbstractUIService.ts b/src/charging-station/ui-websocket-services/AbstractUIService.ts index 0bc34bd9..680a73eb 100644 --- a/src/charging-station/ui-websocket-services/AbstractUIService.ts +++ b/src/charging-station/ui-websocket-services/AbstractUIService.ts @@ -16,7 +16,7 @@ export default abstract class AbstractUIService { ]); } - public async handleMessage(command: ProtocolCommand, payload: JsonType): Promise { + public async messageHandler(command: ProtocolCommand, payload: JsonType): Promise { let messageResponse: JsonType; if (this.messageHandlers.has(command)) { try { -- 2.34.1