X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2F1.6%2FOCPP16ResponseService.ts;h=5d87f633e1f262004fb1232a157c5b5abd417976;hb=b1f1b0f6ea0a9a5da396e20083071857e40c538c;hp=1999473d74690e03fce39af5a261d44b450c5930;hpb=1fe0632adfa4067470497e2de02249fc84a4e218;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts index 1999473d..5d87f633 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts @@ -35,6 +35,7 @@ import { type OCPP16MeterValuesRequest, type OCPP16MeterValuesResponse, OCPP16RequestCommand, + type OCPP16ReserveNowResponse, OCPP16StandardParametersKey, type OCPP16StartTransactionRequest, type OCPP16StartTransactionResponse, @@ -49,7 +50,7 @@ import { type SetChargingProfileResponse, type UnlockConnectorResponse, } from '../../../types'; -import { Constants, MessageChannelUtils, Utils, logger } from '../../../utils'; +import { Constants, Utils, buildUpdatedMessage, logger } from '../../../utils'; import { OCPPResponseService } from '../OCPPResponseService'; const moduleName = 'OCPP16ResponseService'; @@ -283,6 +284,22 @@ export class OCPP16ResponseService extends OCPPResponseService { 'constructor' ), ], + [ + OCPP16IncomingRequestCommand.RESERVE_NOW, + OCPP16ServiceUtils.parseJsonSchemaFile( + 'assets/json-schemas/ocpp/1.6/ReserveNowResponse.json', + moduleName, + 'constructor' + ), + ], + [ + OCPP16IncomingRequestCommand.CANCEL_RESERVATION, + OCPP16ServiceUtils.parseJsonSchemaFile( + 'assets/json-schemas/ocpp/1.6/CancelReservationResponse.json', + moduleName, + 'constructor' + ), + ], ]); this.validatePayload = this.validatePayload.bind(this) as ( chargingStation: ChargingStation, @@ -641,7 +658,7 @@ export class OCPP16ResponseService extends OCPPResponseService { ): Promise { ChargingStationUtils.resetConnectorStatus(chargingStation.getConnectorStatus(connectorId)); chargingStation.stopMeterValues(connectorId); - parentPort?.postMessage(MessageChannelUtils.buildUpdatedMessage(chargingStation)); + parentPort?.postMessage(buildUpdatedMessage(chargingStation)); if ( chargingStation.getConnectorStatus(connectorId)?.status !== OCPP16ChargePointStatus.Available ) { @@ -707,7 +724,7 @@ export class OCPP16ResponseService extends OCPPResponseService { chargingStation.getConnectorStatus(transactionConnectorId) ); chargingStation.stopMeterValues(transactionConnectorId); - parentPort?.postMessage(MessageChannelUtils.buildUpdatedMessage(chargingStation)); + parentPort?.postMessage(buildUpdatedMessage(chargingStation)); const logMsg = `${chargingStation.logPrefix()} Transaction with id ${requestPayload.transactionId.toString()} STOPPED on ${ chargingStation.stationInfo.chargingStationId }#${transactionConnectorId?.toString()} with status '${