Snippets

OICP 2.1 Pull EVSE Status | 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.5.1 eRoamingPullEVSEStatus

To download the latest OICP Version, please visit our website:
https://www.hubject.com/downloads/
/**
 * 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)
{
{ ... }
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();

Comments (0)

HTTPS SSH

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