// 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';
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';
if (
connectorStatus?.transactionRemoteStarted === true &&
chargingStation.getAuthorizeRemoteTxRequests() === true &&
- chargingStation.getRemoteAuthorization() === true &&
+ chargingStation.stationInfo?.remoteAuthorization === true &&
connectorStatus?.idTagLocalAuthorized === false &&
connectorStatus?.idTagAuthorized === false
) {
ReservationTerminationReason.TRANSACTION_STARTED,
);
}
- chargingStation.getBeginEndMeterValues() &&
+ chargingStation.stationInfo?.beginEndMeterValues &&
(await chargingStation.ocppRequestService.requestHandler<
OCPP16MeterValuesRequest,
OCPP16MeterValuesResponse
);
chargingStation.startMeterValues(
connectorId,
- configuredMeterValueSampleInterval
+ configuredMeterValueSampleInterval !== undefined
? secondsToMilliseconds(convertToInt(configuredMeterValueSampleInterval.value))
: Constants.DEFAULT_METER_VALUES_INTERVAL,
);
OCPP16ChargePointStatus.Available,
);
}
- parentPort?.postMessage(buildUpdatedMessage(chargingStation));
}
private async handleResponseStopTransaction(
);
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
}
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