Search in sources :

Example 1 with StopTransactionResponse

use of ocpp.cs._2015._10.StopTransactionResponse in project steve by RWTH-i5-IDSG.

the class CentralSystemService16_Service method stopTransaction.

public StopTransactionResponse stopTransaction(StopTransactionRequest parameters, String chargeBoxIdentity) {
    int transactionId = parameters.getTransactionId();
    String stopReason = parameters.isSetReason() ? parameters.getReason().value() : null;
    UpdateTransactionParams params = UpdateTransactionParams.builder().chargeBoxId(chargeBoxIdentity).transactionId(transactionId).stopTimestamp(parameters.getTimestamp()).stopMeterValue(Integer.toString(parameters.getMeterStop())).stopReason(stopReason).build();
    ocppServerRepository.updateTransaction(params);
    if (parameters.isSetTransactionData()) {
        ocppServerRepository.insertMeterValues(chargeBoxIdentity, parameters.getTransactionData(), transactionId);
    }
    // Get the authorization info of the user
    if (parameters.isSetIdTag()) {
        IdTagInfo idTagInfo = ocppTagService.getIdTagInfo(parameters.getIdTag());
        return new StopTransactionResponse().withIdTagInfo(idTagInfo);
    } else {
        return new StopTransactionResponse();
    }
}
Also used : IdTagInfo(ocpp.cs._2015._10.IdTagInfo) StopTransactionResponse(ocpp.cs._2015._10.StopTransactionResponse) UpdateTransactionParams(de.rwth.idsg.steve.repository.dto.UpdateTransactionParams)

Aggregations

UpdateTransactionParams (de.rwth.idsg.steve.repository.dto.UpdateTransactionParams)1 IdTagInfo (ocpp.cs._2015._10.IdTagInfo)1 StopTransactionResponse (ocpp.cs._2015._10.StopTransactionResponse)1