X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPRequestService.ts;h=a3eca0700ac40126ca601d3471ba11a4c9c26a8d;hb=99100f9c8709a7ead56c1e2745db80a75e8f6f79;hp=4d279ade78aa27ef99abb6143eff8fb2cc025c6d;hpb=e2baeffc85dcc52c9b7c96a0f3de1a52e7ef5b89;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 4d279ade..a3eca070 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -1,9 +1,6 @@ import _Ajv, { type ValidateFunction } from 'ajv' import _ajvFormats from 'ajv-formats' -import { OCPPConstants } from './OCPPConstants.js' -import type { OCPPResponseService } from './OCPPResponseService.js' -import { OCPPServiceUtils } from './OCPPServiceUtils.js' import type { ChargingStation } from '../../charging-station/index.js' import { OCPPError } from '../../exception/index.js' import { PerformanceStatistics } from '../../performance/index.js' @@ -29,6 +26,9 @@ import { handleSendMessageError, logger } from '../../utils/index.js' +import { OCPPConstants } from './OCPPConstants.js' +import type { OCPPResponseService } from './OCPPResponseService.js' +import { OCPPServiceUtils } from './OCPPServiceUtils.js' type Ajv = _Ajv.default // eslint-disable-next-line @typescript-eslint/no-redeclare const Ajv = _Ajv.default @@ -245,7 +245,7 @@ export abstract class OCPPRequestService { // eslint-disable-next-line @typescript-eslint/no-this-alias const self = this // Send a message through wsConnection - return await new Promise((resolve, reject) => { + return await new Promise((resolve, reject: (reason?: unknown) => void) => { /** * Function that will receive the request's response * @@ -383,7 +383,11 @@ export abstract class OCPPRequestService { params.skipBufferingOnError === false ? '' : 'non ' }buffered message id '${messageId}' with content '${messageToSend}'`, commandName, - { name: error.name, message: error.message, stack: error.stack } + { + name: error.name, + message: error.message, + stack: error.stack + } ) ) } @@ -477,12 +481,10 @@ export abstract class OCPPRequestService { ]) } - // eslint-disable-next-line @typescript-eslint/no-unused-vars public abstract requestHandler( chargingStation: ChargingStation, commandName: RequestCommand, - // FIXME: should be ReqType - commandParams?: JsonType, + commandParams?: ReqType, params?: RequestParams ): Promise }