Snippets

OICP 2.1 Pull EVSE Status by ID | Java

Updated by Julius Poessnecker

File (0) OICP Added

  • Ignore whitespace
  • Hide word diff
+The service description can be found in the OICP 2.1 (EMP).
+
+Section:
+3.5.2 eRoamingPullEVSEStatusById
+
+To download the latest OICP Version, please visit our website:
+https://www.hubject.com/downloads/
Created by Gregor Schermuly

File (1) Pull EVSE Status by ID | Java.java Added

  • Ignore whitespace
  • Hide word diff
+/**
+ * Create a new OICP v2.0 PullEVSEStatusById request.
+ *
+ * @param ProviderId the unique identification of the EV service provider for this request.
+ * @param EVSEIds an array of EVSE Ids to query their status.
+ * @return a new PullEVSEStatusById request builder object.
+ */
+public PullEVSEStatusByIdRequest PullEVSEStatusById(final EVSP_Id     ProviderId,
+                                                    final EVSE_Id...  EVSEIds)
+{ ... }
+
+/**
+ * Create a new OICP v2.0 PullEVSEStatusById request.
+ *
+ * @param ProviderId the unique identification of the EV service provider for this request.
+ * @param EVSEIds a stream of EVSE Ids to query their status.
+ * @return a new PullEVSEStatusById request builder object.
+ */
+public PullEVSEStatusByIdRequest PullEVSEStatusById(final EVSP_Id          ProviderId,
+                                                    final Stream<EVSE_Id>  EVSEIds)
+{ ... }

File (2) Example.java Added

  • Ignore whitespace
  • Hide word diff
+CompletableFuture req = new EMPClient("api.playground.hubject.com").
+
+    PullEVSEStatusById(EVSP_Id.Parse("DE*GDF"),
+                       Stream.of(EVSE_Id.Parse("DE*GEF*E123456789*1"),
+                                 EVSE_Id.Parse("+49*822*083431571*1"))).
+
+    Run(EVSEStatus -> {
+
+        if (EVSEStatus.getStatusCode().hasResult())
+            System.out.println(
+                    EVSEStatus.getEVSEStatusRecords().
+                               map(evsedatarecords -> "EVSE '" + evsedatarecords.getId() +
+                                                      "' has status '" +
+                                                      evsedatarecords.getStatus().toString() +
+                                                      "'" ).
+
+                               reduce((a, b) -> a + System.lineSeparator() + b).
+                               get());
+
+        else {
+            System.out.println(EVSEStatus.getStatusCode().getCode());
+            System.out.println(EVSEStatus.getStatusCode().getDescription());
+            System.out.println(EVSEStatus.getStatusCode().getAdditionalInfo());
+        }
+
+    });
+
+// Wait for the future to complete...
+req.get();
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.