From: Jérôme Benoit Date: Fri, 1 Oct 2021 19:28:50 +0000 (+0200) Subject: Refine some type definitions X-Git-Tag: v1.1.22~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=9239b49afd9a0cf6a6a2008d9c907fe42072f29b;p=e-mobility-charging-stations-simulator.git Refine some type definitions Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index b7fff801..edcd312d 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -655,7 +655,7 @@ export default class ChargingStation { private async onMessage(data: Data): Promise { let [messageType, messageId, commandName, commandPayload, errorDetails]: IncomingRequest = [0, '', '' as IncomingRequestCommand, {}, {}]; let responseCallback: (payload: Record | string, requestPayload: Record) => void; - let rejectCallback: (error: OCPPError) => void; + let rejectCallback: (error: OCPPError, requestStatistic?: boolean) => void; let requestCommandName: RequestCommand | IncomingRequestCommand; let requestPayload: Record; let cachedRequest: CachedRequest; diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index f3f64514..842b6446 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -101,7 +101,8 @@ export default abstract class OCPPRequestService { } private buildMessageToSend(messageId: string, commandParams: Record, messageType: MessageType, commandName: RequestCommand | IncomingRequestCommand, - responseCallback: (payload: Record | string, requestPayload: Record) => Promise, rejectCallback: (error: OCPPError) => void): string { + responseCallback: (payload: Record | string, requestPayload: Record) => Promise, + rejectCallback: (error: OCPPError, requestStatistic?: boolean) => void): string { let messageToSend: string; // Type of message switch (messageType) { diff --git a/src/types/ocpp/Requests.ts b/src/types/ocpp/Requests.ts index f32db002..bf3bd76d 100644 --- a/src/types/ocpp/Requests.ts +++ b/src/types/ocpp/Requests.ts @@ -36,4 +36,4 @@ export type Request = [MessageType, string, RequestCommand, Record, Record]; -export type CachedRequest = [(payload: Record | string, requestPayload: Record) => void, (error: OCPPError) => void, RequestCommand | IncomingRequestCommand, Record]; +export type CachedRequest = [(payload: Record | string, requestPayload: Record) => void, (error: OCPPError, requestStatistic?: boolean) => void, RequestCommand | IncomingRequestCommand, Record];