Snippets

OICP 2.1 Pull EVSE Data | Java

Created by Gregor Schermuly last modified Julius Poessnecker
1
2
3
4
5
6
7
The service description can be found in the OICP 2.1 (EMP).

Section:
3.4.1 eRoamingPullEVSEData

To download the latest OICP Version, please visit our website:
https://www.hubject.com/downloads/
/**
 * Create a new OICP PullEVSEData 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 LastCall the timestamp of the last call.
 * @return a new PullEVSEData request builder object.
 */
public PullEVSEDataRequest PullEVSEData(final EVSP_Id        ProviderId,
                                        final GeoCoordinate  SearchCenter,
                                        final Double         DistanceKM,
                                        final Date           LastCall)
{ ... }

/**
 * Create a new OICP PullEVSEData 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.
 * @return a new PullEVSEData request builder object.
 */
public PullEVSEDataRequest PullEVSEData(final EVSP_Id        ProviderId,
                                        final GeoCoordinate  SearchCenter,
                                        final Double         DistanceKM)
{ ... }

/**
 * Create a new OICP PullEVSEData request.
 *
 * @param ProviderId the unique identification of the EV service provider for this request.
 * @param LastCall the timestamp of the last call.
 * @return a new PullEVSEData request builder object.
 */
public PullEVSEDataRequest PullEVSEData(final EVSP_Id         ProviderId,
                                        final Date            LastCall)
{ ... }

/**
 * Create a new OICP PullEVSEData request.
 *
 * @param ProviderId the unique identification of the EVSE service provider for this request.
 * @return a new PullEVSEDataRequest builder object.
 */
public PullEVSEDataRequest PullEVSEData(final EVSP_Id  ProviderId)
{ ... }


// PullEVSEDataRequest 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 PullEVSEData request builder object.
 */
public PullEVSEDataRequest 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 PullEVSEData request builder object.
 */
public PullEVSEDataRequest setSearchCenter(final Longitude  Longitude,
                                           final Latitude   Latitude,
                                           final Double     DistanceKM)
{ ... }


/**
 * Set the timestamp of the last call.
 *
 * @param LastCall the timestamp of the last call.
 * @return the PullEVSEData request builder object.
 */
public PullEVSEDataRequest setLastCall(final Date  LastCall)
{ ... }
CompletableFuture req = new EMPClient("api.playground.hubject.com").

    PullEVSEData(EVSP_Id.Parse("DE*GDF")).
        setSearchCenter(Latitude. Parse(49.731102),
                        Longitude.Parse(10.142533),
                        100.0).

    Run(EVSEData -> {

        if (EVSEData.getStatusCode().hasResult())

            System.out.println(
                EVSEData.getOperatorEVSEData().
                    map   (evsedata -> "'" + evsedata.getOperatorName() +
                                       "' has " +
                                          evsedata.getEVSEDataRecords().count() +
                                        " EVSEs").

                    reduce((a, b)   -> a + System.lineSeparator() + b).
                    get());

        else
        {
            System.out.println(EVSEData.getStatusCode().getCode());
            System.out.println(EVSEData.getStatusCode().getDescription());
            System.out.println(EVSEData.getStatusCode().getAdditionalInfo());
        }

    });

// Wait for the future to complete...
req.get();

Comments (0)

HTTPS SSH

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