Add status notification support to trigger message OCPP command
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / 1.6 / OCPP16ResponseService.ts
index c7bf6fdb74dc592414aebbcba4f644e90cca494d..f2a08a1656b339f79ba5830b62cb2d96c575ace5 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,9 +58,9 @@ export default class OCPP16ResponseService extends OCPPResponseService {
     ]);
   }
 
-  public async handleResponse(
+  public async responseHandler(
     commandName: OCPP16RequestCommand,
-    payload: JsonType | string,
+    payload: JsonType,
     requestPayload: JsonType
   ): Promise<void> {
     if (
@@ -138,17 +136,8 @@ export default class OCPP16ResponseService extends OCPPResponseService {
     }
   }
 
-  private handleResponseHeartbeat(
-    payload: OCPP16HeartbeatResponse,
-    requestPayload: OCPP16HeartbeatRequest
-  ): void {
-    logger.debug(
-      this.chargingStation.logPrefix() +
-        ' Heartbeat response received: %j to Heartbeat request: %j',
-      payload,
-      requestPayload
-    );
-  }
+  // eslint-disable-next-line @typescript-eslint/no-empty-function
+  private handleResponseHeartbeat(): void {}
 
   private handleResponseAuthorize(
     payload: OCPP16AuthorizeResponse,
@@ -317,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, {
@@ -326,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, {
@@ -379,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, {
@@ -411,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, {
@@ -427,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, {
@@ -438,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, {
@@ -474,27 +463,9 @@ export default class OCPP16ResponseService extends OCPPResponseService {
     }
   }
 
-  private handleResponseStatusNotification(
-    payload: OCPP16StatusNotificationRequest,
-    requestPayload: OCPP16StatusNotificationResponse
-  ): void {
-    logger.debug(
-      this.chargingStation.logPrefix() +
-        ' Status notification response received: %j to StatusNotification request: %j',
-      payload,
-      requestPayload
-    );
-  }
+  // eslint-disable-next-line @typescript-eslint/no-empty-function
+  private handleResponseStatusNotification(): void {}
 
-  private handleResponseMeterValues(
-    payload: OCPP16MeterValuesRequest,
-    requestPayload: OCPP16MeterValuesResponse
-  ): void {
-    logger.debug(
-      this.chargingStation.logPrefix() +
-        ' MeterValues response received: %j to MeterValues request: %j',
-      payload,
-      requestPayload
-    );
-  }
+  // eslint-disable-next-line @typescript-eslint/no-empty-function
+  private handleResponseMeterValues(): void {}
 }