Snippets

OICP 2.1 Pull EVSE Status | 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.1 eRoamingPullEVSEStatus
+
+To download the latest OICP Version, please visit our website:
+https://www.hubject.com/downloads/
Created by Gregor Schermuly

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

  • Ignore whitespace
  • Hide word diff
+/**
+ * Create a new OICP v2.0 PullEVSEStatus request.
+ *
+ * @param ProviderId the unique identification of the EVSE service provider for this request.
+ * @return a new PullEVSEStatusRequest builder object.
+ */
+public PullEVSEStatusRequest PullEVSEStatus(final EVSP_Id  ProviderId)
+{ ... }
+
+[...]
+
+/**
+ * Create a new OICP v2.0 PullEVSEStatus request.
+ *
+ * @param ProviderId the unique identification of the EV service provider for this request.
+ * @param SearchCenter the geocoordinates of the center of the search request.
+ * @param DistanceKM the size of the search request area.
+ * @param EVSEStatusFilter the status of the EVSEs to return.
+ * @return a new PullEVSEStatus request builder object.
+ */
+public PullEVSEStatusRequest PullEVSEStatus(final EMPClient      EMPClient,
+                                            final EVSP_Id        ProviderId,
+                                            final GeoCoordinate  SearchCenter,
+                                            final Double         DistanceKM,
+                                            final EVSEStatus     EVSEStatusFilter)
+{ ... }
+
+
+// PullEVSEStatusRequest builder methods
+
+/**
+ * Set the geocoordinates of the search request.
+ *
+ * @param GeoCoordinate the geocoordinates of the center of the search request.
+ * @param DistanceKM radius of the search request.
+ * @return the PullEVSEStatus request builder object.
+ */
+public PullEVSEStatusRequest setSearchCenter(final GeoCoordinate  GeoCoordinate,
+                                             final Double         DistanceKM)
+{ ... }
+
+
+/**
+ * Set the geocoordinates of the search request.
+ *
+ * @param Longitude the longitude of the center of the search request.
+ * @param Latitude the latitude of the center of the search request.
+ * @param DistanceKM radius of the search request.
+ * @return the PullEVSEStatus request builder object.
+ */
+public PullEVSEStatusRequest setSearchCenter(final Longitude  Longitude,
+                                             final Latitude   Latitude,
+                                             final Double     DistanceKM)
+{ ... }
+
+
+/**
+ * Set the the status of the EVSEs to return.
+ *
+ * @param EVSEStatusFilter the status of the EVSEs to return.
+ * @return the PullEVSEStatus request builder object.
+ */
+public PullEVSEStatusRequest setEVSEStatusFilter(final EVSEStatus  EVSEStatusFilter)
+{
+{ ... }

File (2) Example.java Added

  • Ignore whitespace
  • Hide word diff
+CompletableFuture req = new EMPClient("api.playground.hubject.com").
+
+    PullEVSEStatus(EVSP_Id.Parse("DE*GDF")).
+        setSearchCenter(Latitude. Parse(49.731102),
+                        Longitude.Parse(10.142533),
+                        100.0).
+        setEVSEStatusFilter(EVSEStatus.Available).
+
+    Run(EVSEStatus -> {
+
+        if (EVSEStatus.getStatusCode().hasResult())
+
+            System.out.println(
+                EVSEStatus.getOperatorEVSEStatus().
+                    map   (evsestatus -> "'" + evsestatus.getOperatorName() +
+                                         "' has " +
+                                            evsestatus.getEVSEStatusRecords().count() +
+                                         " available EVSEs").
+
+                    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.