Skip to content

Commit

Permalink
ChargePointServiceClient: rewrite the methods for remote start, stop …
Browse files Browse the repository at this point in the history
…and unlock for differentiation of internal and external tasks
  • Loading branch information
fnkbsi committed Jan 12, 2025
1 parent dc5c497 commit cae35e5
Showing 1 changed file with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,18 @@ public final int updateFirmware(UpdateFirmwareParams params,
@SafeVarargs
public final int remoteStartTransaction(RemoteStartTransactionParams params,
OcppCallback<String>... callbacks) {
return remoteStartTransaction(params, "Steve", callbacks);
}

RemoteStartTransactionTask task = new RemoteStartTransactionTask(params);
return addRemoteStartTask(task, callbacks);
}
@SafeVarargs
public final int remoteStartTransaction(RemoteStartTransactionParams params, String caller,
OcppCallback<String>... callbacks) {
RemoteStartTransactionTask task = new RemoteStartTransactionTask(params, caller);
return addRemoteStartTask(task, callbacks);
}

private int addRemoteStartTask(RemoteStartTransactionTask task,
OcppCallback<String>... callbacks) {
for (var callback : callbacks) {
task.addCallback(callback);
}
Expand All @@ -221,14 +225,19 @@ public final int remoteStartTransaction(RemoteStartTransactionParams params, Str
@SafeVarargs
public final int remoteStopTransaction(RemoteStopTransactionParams params,
OcppCallback<String>... callbacks) {
return remoteStopTransaction(params, "Steve", callbacks);
RemoteStopTransactionTask task = new RemoteStopTransactionTask(params);
return addRemoteStopTask(task,callbacks);

Check failure on line 229 in src/main/java/de/rwth/idsg/steve/service/ChargePointServiceClient.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] reported by reviewdog 🐶 ',' is not followed by whitespace. Raw Output: /github/workspace/./src/main/java/de/rwth/idsg/steve/service/ChargePointServiceClient.java:229:38: error: ',' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)
}

@SafeVarargs
public final int remoteStopTransaction(RemoteStopTransactionParams params, String caller,
OcppCallback<String>... callbacks) {
RemoteStopTransactionTask task = new RemoteStopTransactionTask(params, caller);
return addRemoteStopTask(task,callbacks);

Check failure on line 236 in src/main/java/de/rwth/idsg/steve/service/ChargePointServiceClient.java

View workflow job for this annotation

GitHub Actions / checkstyle

[checkstyle] reported by reviewdog 🐶 ',' is not followed by whitespace. Raw Output: /github/workspace/./src/main/java/de/rwth/idsg/steve/service/ChargePointServiceClient.java:236:38: error: ',' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)
}

private int addRemoteStopTask(RemoteStopTransactionTask task,
OcppCallback<String>... callbacks) {
for (var callback : callbacks) {
task.addCallback(callback);
}
Expand All @@ -243,13 +252,19 @@ public final int remoteStopTransaction(RemoteStopTransactionParams params, Strin
@SafeVarargs
public final int unlockConnector(UnlockConnectorParams params,
OcppCallback<String>... callbacks) {
return unlockConnector(params, "Steve", callbacks);
UnlockConnectorTask task = new UnlockConnectorTask(params);
return addUnlockConnectorTask(task, callbacks);
}

@SafeVarargs
public final int unlockConnector(UnlockConnectorParams params, String caller,
OcppCallback<String>... callbacks) {
UnlockConnectorTask task = new UnlockConnectorTask(params, caller);
return addUnlockConnectorTask(task, callbacks);
}

private int addUnlockConnectorTask(UnlockConnectorTask task,
OcppCallback<String>... callbacks) {
for (var callback : callbacks) {
task.addCallback(callback);
}
Expand Down

0 comments on commit cae35e5

Please sign in to comment.