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=80ed03b61bc6de9adede1d450464473d512eb4f8;hpb=7671fa0be211e944f027ebd83f3a0ad64c2ef2d6;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 80ed03b6..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, @@ -612,7 +629,7 @@ export class OCPP16ResponseService extends OCPPResponseService { }#${transactionConnectorId.toString()} for idTag '${requestPayload.idTag}'` ); if (chargingStation.stationInfo.powerSharedByConnectors) { - chargingStation.powerDivider++; + ++chargingStation.powerDivider; } const configuredMeterValueSampleInterval = ChargingStationConfigurationUtils.getConfigurationKey( @@ -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 '${