Reorganize more sensibly types definition
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / 1.6 / OCPP16RequestService.ts
index 4acaaac128400a85fc01f864d7001abe9409e719..f4f1782ee97a6716e81206a1917c926221dd6e30 100644 (file)
@@ -16,7 +16,7 @@ import { OCPP16ChargePointErrorCode } from '../../../types/ocpp/1.6/ChargePointE
 import { OCPP16ChargePointStatus } from '../../../types/ocpp/1.6/ChargePointStatus';
 import { OCPP16DiagnosticsStatus } from '../../../types/ocpp/1.6/DiagnosticsStatus';
 import { OCPP16ServiceUtils } from './OCPP16ServiceUtils';
-import OCPPError from '../OCPPError';
+import OCPPError from '../../../exception/OCPPError';
 import OCPPRequestService from '../OCPPRequestService';
 import Utils from '../../../utils/Utils';
 import logger from '../../../utils/Logger';
@@ -378,6 +378,15 @@ export default class OCPP16RequestService extends OCPPRequestService {
     }
   }
 
+  public async sendResult(messageId: string, resultMessageData: Record<string, unknown>, commandName: OCPP16RequestCommand | OCPP16IncomingRequestCommand): Promise<unknown> {
+    try {
+      // Send error
+      return await this.sendMessage(messageId, resultMessageData, MessageType.CALL_RESULT_MESSAGE, commandName);
+    } catch (err) {
+      this.handleRequestError(commandName as OCPP16RequestCommand, err as Error);
+    }
+  }
+
   public async sendError(messageId: string, error: OCPPError, commandName: OCPP16RequestCommand | OCPP16IncomingRequestCommand): Promise<unknown> {
     try {
       // Send error