Hook the OCPP 2.0 stack into the main code
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPRequestService.ts
index da39fb9e4367f6dfa7a0ad93388c987d7a88190d..125baf4073366623f05c67797d6e375ef532f148 100644 (file)
@@ -10,13 +10,13 @@ import type { JsonObject, JsonType } from '../../types/JsonType';
 import { ErrorType } from '../../types/ocpp/ErrorType';
 import { MessageType } from '../../types/ocpp/MessageType';
 import {
-  ErrorCallback,
-  IncomingRequestCommand,
-  OutgoingRequest,
+  type ErrorCallback,
+  type IncomingRequestCommand,
+  type OutgoingRequest,
   RequestCommand,
-  RequestParams,
-  ResponseCallback,
-  ResponseType,
+  type RequestParams,
+  type ResponseCallback,
+  type ResponseType,
 } from '../../types/ocpp/Requests';
 import type { ErrorResponse, Response } from '../../types/ocpp/Responses';
 import Constants from '../../utils/Constants';
@@ -189,10 +189,10 @@ export default abstract class OCPPRequestService {
           // Check if wsConnection opened
           if (chargingStation.isWebSocketConnectionOpened() === true) {
             // Yes: Send Message
-            const beginId = PerformanceStatistics.beginMeasure(commandName);
+            const beginId = PerformanceStatistics.beginMeasure(commandName as string);
             // FIXME: Handle sending error
             chargingStation.wsConnection.send(messageToSend);
-            PerformanceStatistics.endMeasure(commandName, beginId);
+            PerformanceStatistics.endMeasure(commandName as string, beginId);
             logger.debug(
               `${chargingStation.logPrefix()} >> Command '${commandName}' sent ${this.getMessageTypeString(
                 messageType
@@ -376,10 +376,10 @@ export default abstract class OCPPRequestService {
   }
 
   // eslint-disable-next-line @typescript-eslint/no-unused-vars
-  public abstract requestHandler<RequestType extends JsonType, ResponseType extends JsonType>(
+  public abstract requestHandler<ReqType extends JsonType, ResType extends JsonType>(
     chargingStation: ChargingStation,
     commandName: RequestCommand,
     commandParams?: JsonType,
     params?: RequestParams
-  ): Promise<ResponseType>;
+  ): Promise<ResType>;
 }