X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2F1.6%2FOCPP16ResponseService.ts;h=146778141abdbcc3c72b7860d2fde9b5d8792c8e;hb=33276ba6a447f0beb92b934d2b8d5cb08eababb4;hp=03bf136720ef590d3bfc4d74934b4ea420ce9754;hpb=9ff486f4329a4902e8bcd280c0649a74cb31e4df;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 03bf1367..14677814 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts @@ -1,7 +1,5 @@ // Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved. -import { parentPort } from 'node:worker_threads'; - import type { JSONSchemaType } from 'ajv'; import { secondsToMilliseconds } from 'date-fns'; @@ -53,13 +51,7 @@ import { type SetChargingProfileResponse, type UnlockConnectorResponse, } from '../../../types'; -import { - Constants, - buildUpdatedMessage, - convertToInt, - isNullOrUndefined, - logger, -} from '../../../utils'; +import { Constants, convertToInt, isNullOrUndefined, logger } from '../../../utils'; import { OCPPResponseService } from '../OCPPResponseService'; const moduleName = 'OCPP16ResponseService'; @@ -523,7 +515,7 @@ export class OCPP16ResponseService extends OCPPResponseService { if ( connectorStatus?.transactionRemoteStarted === true && chargingStation.getAuthorizeRemoteTxRequests() === true && - chargingStation.getRemoteAuthorization() === true && + chargingStation.stationInfo?.remoteAuthorization === true && connectorStatus?.idTagLocalAuthorized === false && connectorStatus?.idTagAuthorized === false ) { @@ -636,7 +628,7 @@ export class OCPP16ResponseService extends OCPPResponseService { ReservationTerminationReason.TRANSACTION_STARTED, ); } - chargingStation.getBeginEndMeterValues() && + chargingStation.stationInfo?.beginEndMeterValues && (await chargingStation.ocppRequestService.requestHandler< OCPP16MeterValuesRequest, OCPP16MeterValuesResponse @@ -664,7 +656,7 @@ export class OCPP16ResponseService extends OCPPResponseService { ); chargingStation.startMeterValues( connectorId, - configuredMeterValueSampleInterval + configuredMeterValueSampleInterval !== undefined ? secondsToMilliseconds(convertToInt(configuredMeterValueSampleInterval.value)) : Constants.DEFAULT_METER_VALUES_INTERVAL, ); @@ -700,7 +692,6 @@ export class OCPP16ResponseService extends OCPPResponseService { OCPP16ChargePointStatus.Available, ); } - parentPort?.postMessage(buildUpdatedMessage(chargingStation)); } private async handleResponseStopTransaction( @@ -719,9 +710,9 @@ export class OCPP16ResponseService extends OCPPResponseService { ); return; } - chargingStation.getBeginEndMeterValues() === true && - chargingStation.getOcppStrictCompliance() === false && - chargingStation.getOutOfOrderEndMeterValues() === true && + chargingStation.stationInfo?.beginEndMeterValues === true && + chargingStation.stationInfo?.ocppStrictCompliance === false && + chargingStation.stationInfo?.outOfOrderEndMeterValues === true && (await chargingStation.ocppRequestService.requestHandler< OCPP16MeterValuesRequest, OCPP16MeterValuesResponse @@ -757,12 +748,11 @@ export class OCPP16ResponseService extends OCPPResponseService { } resetConnectorStatus(chargingStation.getConnectorStatus(transactionConnectorId!)!); chargingStation.stopMeterValues(transactionConnectorId!); - parentPort?.postMessage(buildUpdatedMessage(chargingStation)); const logMsg = `${chargingStation.logPrefix()} Transaction with id ${ requestPayload.transactionId } STOPPED on ${ chargingStation.stationInfo.chargingStationId - }#${transactionConnectorId} with status '${payload.idTagInfo?.status ?? 'undefined'}'`; + }#${transactionConnectorId} with status '${payload.idTagInfo?.status}'`; if ( isNullOrUndefined(payload.idTagInfo) || payload.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED