Properly name OCPP command handler methods
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 15 Apr 2022 10:44:51 +0000 (12:44 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 15 Apr 2022 10:44:51 +0000 (12:44 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/AutomaticTransactionGenerator.ts
src/charging-station/ChargingStation.ts
src/charging-station/UIWebSocketServer.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/1.6/OCPP16RequestService.ts
src/charging-station/ocpp/1.6/OCPP16ResponseService.ts
src/charging-station/ocpp/OCPPIncomingRequestService.ts
src/charging-station/ocpp/OCPPRequestService.ts
src/charging-station/ocpp/OCPPResponseService.ts
src/charging-station/ui-websocket-services/AbstractUIService.ts

index a8bd79ac06d846ac6d3f0313a25de57c234856a3..23f78833e833e5f52d59974d8f89753069aec41d 100644 (file)
@@ -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, {
index 4ed293e4d8c8b91affb4dad96cc6da67c52a428b..bfd3eb6f4423ddc616de688b1620b3c17c9336d0 100644 (file)
@@ -442,7 +442,7 @@ export default class ChargingStation {
     ) {
       // eslint-disable-next-line @typescript-eslint/no-misused-promises
       this.heartbeatSetInterval = setInterval(async (): Promise<void> => {
-        await this.ocppRequestService.sendMessageHandler<HeartbeatRequest, HeartbeatResponse>(
+        await this.ocppRequestService.requestHandler<HeartbeatRequest, HeartbeatResponse>(
           RequestCommand.HEARTBEAT
         );
       }, this.getHeartbeatInterval());
@@ -514,7 +514,7 @@ export default class ChargingStation {
             this.getConnectorStatus(connectorId).transactionId,
             interval
           );
-          await this.ocppRequestService.sendMessageHandler<MeterValuesRequest, MeterValuesResponse>(
+          await this.ocppRequestService.requestHandler<MeterValuesRequest, MeterValuesResponse>(
             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<void> {
     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<MeterValuesRequest, MeterValuesResponse>(
+              RequestCommand.METER_VALUES,
+              {
+                connectorId,
+                transactionId,
+                meterValue: transactionEndMeterValue,
+              }
+            );
           }
-          await this.ocppRequestService.sendMessageHandler<
+          await this.ocppRequestService.requestHandler<
             StopTransactionRequest,
             StopTransactionResponse
           >(RequestCommand.STOP_TRANSACTION, {
index 5ffc9e0c640320a36f22fb3658afe7478747f32b..110695512093e77426937d1ecc3b74fbb858e139 100644 (file)
@@ -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`,
index 1befa1c7a678e8921d9fbe6c649d5284be81ac7f..8d5d0a20e27d86169f0efc86ec954efcfe8e9a2b 100644 (file)
@@ -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<OCPP16BootNotificationRequest, OCPP16BootNotificationResponse>(
+              .requestHandler<OCPP16BootNotificationRequest, OCPP16BootNotificationResponse>(
                 OCPP16RequestCommand.BOOT_NOTIFICATION,
                 {
                   chargePointModel:
@@ -987,7 +987,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer
         case MessageTrigger.Heartbeat:
           setTimeout(() => {
             this.chargingStation.ocppRequestService
-              .sendMessageHandler<OCPP16HeartbeatRequest, OCPP16HeartbeatResponse>(
+              .requestHandler<OCPP16HeartbeatRequest, OCPP16HeartbeatResponse>(
                 OCPP16RequestCommand.HEARTBEAT,
                 null,
                 {
index 64ce459cb315b735f5e28ece254bfb96bb20e154..62e96b52e4653f1c80d5d359066c34119a4a26e0 100644 (file)
@@ -22,7 +22,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
     super(chargingStation, ocppResponseService);
   }
 
-  public async sendMessageHandler<Request extends JsonType, Response extends JsonType>(
+  public async requestHandler<Request extends JsonType, Response extends JsonType>(
     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<Request>(commandName, commandParams),
+        this.buildRequestPayload<Request>(commandName, commandParams),
         commandName,
         params
       )) as unknown as Response;
@@ -43,7 +43,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
     );
   }
 
-  private buildCommandPayload<Request extends JsonType>(
+  private buildRequestPayload<Request extends JsonType>(
     commandName: OCPP16RequestCommand,
     commandParams?: JsonType
   ): Request {
index c59710560cc956ad3b79b13e3d8a3ee76a7833d8..c96cea3af7d1f85e1c0a2233c0d01043f07f5323 100644 (file)
@@ -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, {
index 8d34e734a19ad67f256752d80f958a22c1734cfa..b5f607f534abb3e98a8dfa0c1eb8842740fc88c6 100644 (file)
@@ -47,7 +47,7 @@ export default abstract class OCPPIncomingRequestService {
     }
   }
 
-  public abstract handleRequest(
+  public abstract incomingRequestHandler(
     messageId: string,
     commandName: IncomingRequestCommand,
     commandPayload: JsonType
index 021e09f369edb855d5be7d161e512f073d3504a3..9998d2661400b4a94293d2261d808b9cb7a71985 100644 (file)
@@ -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<Request extends JsonType, Response extends JsonType>(
+  public abstract requestHandler<Request extends JsonType, Response extends JsonType>(
     commandName: RequestCommand,
     commandParams?: JsonType,
     params?: SendParams
index d13a7d15aee2ca30a3eb79c4abec531937dcf0b1..cfb1aa08f45e75a42e88c31295daa0ad6b1389e4 100644 (file)
@@ -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
index 0bc34bd99772f6e2f5cde37d397717af5d69668e..680a73eb07ae0ea040396b1ab75df1165ef1e250 100644 (file)
@@ -16,7 +16,7 @@ export default abstract class AbstractUIService {
     ]);
   }
 
-  public async handleMessage(command: ProtocolCommand, payload: JsonType): Promise<void> {
+  public async messageHandler(command: ProtocolCommand, payload: JsonType): Promise<void> {
     let messageResponse: JsonType;
     if (this.messageHandlers.has(command)) {
       try {