From 07bdb07703176d60fcf024f69b0a4bb7ad2374cf Mon Sep 17 00:00:00 2001 From: Sevket Goekay Date: Tue, 11 Aug 2015 16:20:00 +0200 Subject: [PATCH] always accept a start transaction regardless of idTag status until now a transaction request was only processed when the idTag was "Accepted" according to database. but this can cause some problems with the behavior of various charging stations. therefore, we relax the constraints and expect the charging station to act on the contents of sent idTagInfo --- pom.xml | 2 +- .../CentralSystemService12_Service.java | 22 ++++++---------- .../CentralSystemService15_Service.java | 26 +++++++------------ 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/pom.xml b/pom.xml index 5ac9667be..af0b32e11 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 de.rwth.idsg steve - 1.0.10 + 1.0.11 jar diff --git a/src/main/java/de/rwth/idsg/steve/service/CentralSystemService12_Service.java b/src/main/java/de/rwth/idsg/steve/service/CentralSystemService12_Service.java index f77d70e37..20b169133 100644 --- a/src/main/java/de/rwth/idsg/steve/service/CentralSystemService12_Service.java +++ b/src/main/java/de/rwth/idsg/steve/service/CentralSystemService12_Service.java @@ -99,23 +99,17 @@ public DiagnosticsStatusNotificationResponse diagnosticsStatusNotification(Diagn public StartTransactionResponse startTransaction(StartTransactionRequest parameters, String chargeBoxIdentity) { log.debug("Executing startTransaction for {}", chargeBoxIdentity); - // Get the authorization info of the user String idTag = parameters.getIdTag(); - IdTagInfo idTagInfo = userService.getIdTagInfoV12(idTag); - - StartTransactionResponse response = new StartTransactionResponse().withIdTagInfo(idTagInfo); - - if (AuthorizationStatus.ACCEPTED.equals(idTagInfo.getStatus())) { - int connectorId = parameters.getConnectorId(); - Timestamp startTimestamp = new Timestamp(parameters.getTimestamp().getMillis()); - String startMeterValue = Integer.toString(parameters.getMeterStart()); + int connectorId = parameters.getConnectorId(); + Timestamp startTimestamp = new Timestamp(parameters.getTimestamp().getMillis()); + String startMeterValue = Integer.toString(parameters.getMeterStart()); - Integer transactionId = ocppServerRepository.insertTransaction12(chargeBoxIdentity,connectorId, idTag, - startTimestamp, startMeterValue); + Integer transactionId = ocppServerRepository.insertTransaction12(chargeBoxIdentity, connectorId, idTag, + startTimestamp, startMeterValue); - response.setTransactionId(transactionId); - } - return response; + return new StartTransactionResponse() + .withIdTagInfo(userService.getIdTagInfoV12(idTag)) + .withTransactionId(transactionId); } public StopTransactionResponse stopTransaction(StopTransactionRequest parameters, String chargeBoxIdentity) { diff --git a/src/main/java/de/rwth/idsg/steve/service/CentralSystemService15_Service.java b/src/main/java/de/rwth/idsg/steve/service/CentralSystemService15_Service.java index 0c1e00ad9..55af9f088 100644 --- a/src/main/java/de/rwth/idsg/steve/service/CentralSystemService15_Service.java +++ b/src/main/java/de/rwth/idsg/steve/service/CentralSystemService15_Service.java @@ -112,25 +112,19 @@ public DiagnosticsStatusNotificationResponse diagnosticsStatusNotification(Diagn public StartTransactionResponse startTransaction(StartTransactionRequest parameters, String chargeBoxIdentity) { log.debug("Executing startTransaction for {}", chargeBoxIdentity); - // Get the authorization info of the user String idTag = parameters.getIdTag(); - IdTagInfo idTagInfo = userService.getIdTagInfoV15(idTag); - - StartTransactionResponse response = new StartTransactionResponse().withIdTagInfo(idTagInfo); - - if (AuthorizationStatus.ACCEPTED.equals(idTagInfo.getStatus())) { - int connectorId = parameters.getConnectorId(); - Integer reservationId = parameters.getReservationId(); - Timestamp startTimestamp = new Timestamp(parameters.getTimestamp().getMillis()); + int connectorId = parameters.getConnectorId(); + Integer reservationId = parameters.getReservationId(); + Timestamp startTimestamp = new Timestamp(parameters.getTimestamp().getMillis()); + String startMeterValue = Integer.toString(parameters.getMeterStart()); - String startMeterValue = Integer.toString(parameters.getMeterStart()); - Integer transactionId = ocppServerRepository.insertTransaction15(chargeBoxIdentity, connectorId, idTag, - startTimestamp, startMeterValue, - reservationId); + Integer transactionId = ocppServerRepository.insertTransaction15(chargeBoxIdentity, connectorId, idTag, + startTimestamp, startMeterValue, + reservationId); - response.setTransactionId(transactionId); - } - return response; + return new StartTransactionResponse() + .withIdTagInfo(userService.getIdTagInfoV15(idTag)) + .withTransactionId(transactionId); } public StopTransactionResponse stopTransaction(StopTransactionRequest parameters, String chargeBoxIdentity) {