commandPayload: RemoteStopTransactionRequest,
): Promise<GenericResponse> {
const transactionId = commandPayload.transactionId;
- const remoteStopTransaction = async (connectorId: number): Promise<GenericResponse> => {
- await OCPP16ServiceUtils.sendAndSetConnectorStatus(
- chargingStation,
- connectorId,
- OCPP16ChargePointStatus.Finishing,
- );
- const stopResponse = await chargingStation.stopTransactionOnConnector(
- connectorId,
- OCPP16StopTransactionReason.REMOTE,
- );
- if (stopResponse.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) {
- return OCPP16Constants.OCPP_RESPONSE_ACCEPTED;
- }
- return OCPP16Constants.OCPP_RESPONSE_REJECTED;
- };
if (chargingStation.hasEvses) {
for (const [evseId, evseStatus] of chargingStation.evses) {
if (evseId > 0) {
for (const [connectorId, connectorStatus] of evseStatus.connectors) {
if (connectorStatus.transactionId === transactionId) {
- return remoteStopTransaction(connectorId);
+ return OCPP16ServiceUtils.remoteStopTransaction(chargingStation, connectorId);
}
}
}
connectorId > 0 &&
chargingStation.getConnectorStatus(connectorId)?.transactionId === transactionId
) {
- return remoteStopTransaction(connectorId);
+ return OCPP16ServiceUtils.remoteStopTransaction(chargingStation, connectorId);
}
}
}
type ClearChargingProfileRequest,
CurrentType,
ErrorType,
+ type GenericResponse,
type JsonType,
type MeasurandPerPhaseSampledValueTemplates,
type MeasurandValues,
MeterValueContext,
MeterValueLocation,
MeterValueUnit,
+ OCPP16AuthorizationStatus,
OCPP16AvailabilityType,
type OCPP16ChangeAvailabilityResponse,
OCPP16ChargePointStatus,
OCPP16RequestCommand,
type OCPP16SampledValue,
OCPP16StandardParametersKey,
+ OCPP16StopTransactionReason,
type OCPP16SupportedFeatureProfiles,
OCPPVersion,
type SampledValueTemplate,
return meterValues;
}
+ public static remoteStopTransaction = async (
+ chargingStation: ChargingStation,
+ connectorId: number,
+ ): Promise<GenericResponse> => {
+ await OCPP16ServiceUtils.sendAndSetConnectorStatus(
+ chargingStation,
+ connectorId,
+ OCPP16ChargePointStatus.Finishing,
+ );
+ const stopResponse = await chargingStation.stopTransactionOnConnector(
+ connectorId,
+ OCPP16StopTransactionReason.REMOTE,
+ );
+ if (stopResponse.idTagInfo?.status === OCPP16AuthorizationStatus.ACCEPTED) {
+ return OCPP16Constants.OCPP_RESPONSE_ACCEPTED;
+ }
+ return OCPP16Constants.OCPP_RESPONSE_REJECTED;
+ };
+
public static changeAvailability = async (
chargingStation: ChargingStation,
connectorId: number,