Skip to content

Commit

Permalink
always accept a start transaction regardless of idTag status
Browse files Browse the repository at this point in the history
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
  • Loading branch information
goekay committed Aug 11, 2015
1 parent 621d195 commit 07bdb07
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 31 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.rwth.idsg</groupId>
<artifactId>steve</artifactId>
<version>1.0.10</version>
<version>1.0.11</version>
<packaging>jar</packaging>

<developers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 07bdb07

Please sign in to comment.