Snippets

OICP 2.1 Authorize Remote Stop | C#

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.

Section:
3.1.4 eRoamingAuthorizeRemoteStop

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>
/// A delegate fired whenever a remote stop command was received.
/// </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="EVSEId">The unique identification of an EVSE.</param>
/// <param name="CancellationToken">A token to cancel this task.</param>
/// <returns>A RemoteStopResult task.</returns>
public delegate Task<RemoteStopResult> OnRemoteStopDelegate(DateTime            Timestamp,
                                                            RoamingNetwork_Id   RoamingNetworkId,
                                                            ChargingSession_Id  SessionId,
                                                            ChargingSession_Id  PartnerSessionId,
                                                            EVSP_Id             ProviderId,
                                                            EVSE_Id             EVSEId,
                                                            CancellationToken   CancellationToken);

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

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

    Console.WriteLine("[" +                 Timestamp.       ToString() +
                      "] RemoteStop in '" + RoamingNetworkId.ToString() +
                      "' from '"          + ProviderId.      ToString() +
                      "' at '"            + EVSEId.          ToString() +
                      "'");

    return await Task.FromResult(RemoteStopResult.Success);

});

Comments (0)

HTTPS SSH

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