Snippets

OICP 2.1 Remote Reservation Start | C#

Created by Julius Poessnecker
1
2
3
4
5
6
7
The service description can be found in the OICP 2.1.

Section:
3.2.1 eRoamingAuthorizeRemoteReservationStart

To download the latest OICP Version, please visit our website:
https://www.hubject.com/downloads/
/// <summary>
/// Initialize the OICP HTTP/SOAP/XML server using IPAddress.Any.
/// </summary>
/// <param name="TCPPort">The TCP listing port.</param>
/// <param name="URIPrefix">An optional prefix for the HTTP URIs.</param>
public CPOServer(IPPort  TCPPort,
                 String  URIPrefix = "")


/// <summary>
/// Initiate a remote reservation of the given charging session at the given EVSE
/// and for the given Provider/eMAId.
/// </summary>
/// <param name="Timestamp">The timestamp of the request.</param>
/// <param name="RoamingNetworkId">The unique identification for the roaming network.</param>
/// <param name="SessionId">The unique identification for this charging session.</param>
/// <param name="PartnerSessionId">The unique identification for this charging session on the partner side.</param>
/// <param name="ProviderId">The unique identification of the e-mobility service provider.</param>
/// <param name="eMAId">The unique identification of the e-mobility account.</param>
/// <param name="EVSEId">The unique identification of an EVSE.</param>
/// <param name="ChargingProductId">The unique identification of the choosen charging product at the given EVSE.</param>
/// <param name="CancellationToken">A token to cancel this task.</param>
/// <returns>A RemoteReservationStartResult task.</returns>
public delegate Task<RemoteReservationStartResult> OnRemoteReservationStartDelegate(DateTime            Timestamp,
                                                              RoamingNetwork_Id   RoamingNetworkId,
                                                              ChargingSession_Id  SessionId,
                                                              ChargingSession_Id  PartnerSessionId,
                                                              EVSP_Id             ProviderId,
                                                              eMA_Id              eMAId,
                                                              EVSE_Id             EVSEId,
                                                              ChargingProduct_Id  ChargingProductId,
                                                              CancellationToken   CancellationToken);

/// <summary>
/// An event fired whenever a remote reservation command was received.
/// </summary>
public event OnRemoteReservationStartDelegate OnRemoteReservationStart;
var CPOServer = new CPOServer(new IPPort(3103));

CPOServer.OnRemoteReservationStart(async (Timestamp,
                               RoamingNetworkId,
                               SessionId,
                               PartnerSessionId,
                               ProviderId,
                               eMAId,
                               EVSEId,
                               ChargingProductId,
                               CancellationToken) => {

    Console.WriteLine("[" +                  Timestamp.        ToString() +
                      "] RemoteStart in '" + RoamingNetworkId. ToString() +
                      "' from '"           + ProviderId.       ToString() +
                      "' for '"            + eMAId.            ToString() +
                      "' at '"             + EVSEId.           ToString() +
                      "' / '"              + ChargingProductId.ToString() +
                      "'");

    return await Task.FromResult(RemoteReservationStartResult.Success);

});

Comments (0)

HTTPS SSH

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