X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2F1.6%2FOCPP16RequestService.ts;h=1fc89fa8c2d15b1bd0df8e3bed919d3063b6e2c3;hb=d18886407cdb8b8148c87492f2c953075e708401;hp=6ae6cf3225e208abba901fb3e560608b943f1158;hpb=caad9d6b03dbfc507da6d8e79ccbbaf74593e981;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index 6ae6cf32..1fc89fa8 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -8,6 +8,7 @@ import { MeterValueUnit, MeterValuesRequest, OCPP16MeterValue, OCPP16MeterValueM import Constants from '../../../utils/Constants'; import { ErrorType } from '../../../types/ocpp/ErrorType'; +import { JsonType } from '../../../types/JsonType'; import MeasurandPerPhaseSampledValueTemplates from '../../../types/MeasurandPerPhaseSampledValueTemplates'; import MeasurandValues from '../../../types/MeasurandValues'; import { MessageType } from '../../../types/ocpp/MessageType'; @@ -381,21 +382,21 @@ export default class OCPP16RequestService extends OCPPRequestService { } } - public async sendResult(messageId: string, resultMessageData: Record, commandName: OCPP16RequestCommand | OCPP16IncomingRequestCommand): Promise { + public async sendResult(messageId: string, resultMessageData: JsonType, commandName: OCPP16RequestCommand | OCPP16IncomingRequestCommand): Promise { try { // Send error - return await this.sendMessage(messageId, resultMessageData, MessageType.CALL_RESULT_MESSAGE, commandName); - } catch (err) { - this.handleRequestError(commandName as OCPP16RequestCommand, err as Error); + return await this.sendMessage(messageId, resultMessageData, MessageType.CALL_RESULT_MESSAGE, commandName) as JsonType; + } catch (error) { + this.handleRequestError(commandName as OCPP16RequestCommand, error as Error); } } - public async sendError(messageId: string, error: OCPPError, commandName: OCPP16RequestCommand | OCPP16IncomingRequestCommand): Promise { + public async sendError(messageId: string, ocppError: OCPPError, commandName: OCPP16RequestCommand | OCPP16IncomingRequestCommand): Promise { try { // Send error - return await this.sendMessage(messageId, error, MessageType.CALL_ERROR_MESSAGE, commandName); - } catch (err) { - this.handleRequestError(commandName as OCPP16RequestCommand, err as Error); + return await this.sendMessage(messageId, ocppError, MessageType.CALL_ERROR_MESSAGE, commandName) as JsonType; + } catch (error) { + this.handleRequestError(commandName as OCPP16RequestCommand, error as Error); } } }