X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2F1.6%2FOCPP16RequestService.ts;h=b9643469a791831937d9774e4ef0b9fb68abacbf;hb=923ac728c8636e5d8e7cc387ade07990385c6fdd;hp=74c00daa8f42335383b7d5d7f603cdd40fd90303;hpb=d5490a13c341153af159d4b2ed745d32dc38452f;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 74c00daa..b9643469 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -2,8 +2,6 @@ import type { ValidateFunction } from 'ajv' -import { OCPP16Constants } from './OCPP16Constants.js' -import { OCPP16ServiceUtils } from './OCPP16ServiceUtils.js' import type { ChargingStation } from '../../../charging-station/index.js' import { OCPPError } from '../../../exception/index.js' import { @@ -28,6 +26,8 @@ import { import { Constants, generateUUID } from '../../../utils/index.js' import { OCPPRequestService } from '../OCPPRequestService.js' import type { OCPPResponseService } from '../OCPPResponseService.js' +import { OCPP16Constants } from './OCPP16Constants.js' +import { OCPP16ServiceUtils } from './OCPP16ServiceUtils.js' const moduleName = 'OCPP16RequestService' @@ -167,11 +167,21 @@ export class OCPP16RequestService extends OCPPRequestService { public async requestHandler( chargingStation: ChargingStation, commandName: OCPP16RequestCommand, - commandParams?: JsonType, + commandParams?: RequestType, params?: RequestParams ): Promise { // FIXME?: add sanity checks on charging station availability, connector availability, connector status, etc. if (OCPP16ServiceUtils.isRequestCommandSupported(chargingStation, commandName)) { + // Post request actions hook + switch (commandName) { + case OCPP16RequestCommand.START_TRANSACTION: + await OCPP16ServiceUtils.sendAndSetConnectorStatus( + chargingStation, + (commandParams as OCPP16StartTransactionRequest).connectorId, + OCPP16ChargePointStatus.Preparing + ) + break + } return (await this.sendMessage( chargingStation, generateUUID(),