Example #1
0
        /// <summary>
        /// Create a new eMIP roaming client for CPOs.
        /// </summary>
        /// <param name="CPOClient">A CPO client.</param>
        /// <param name="CPOServer">A CPO server.</param>
        public CPORoaming(CPOClient CPOClient,
                          CPOServer CPOServer)
        {
            this.CPOClient = CPOClient;
            this.CPOServer = CPOServer;

            // Link HTTP events...
            CPOServer.RequestLog  += (HTTPProcessor, ServerTimestamp, Request) => RequestLog.WhenAll(HTTPProcessor, ServerTimestamp, Request);
            CPOServer.ResponseLog += (HTTPProcessor, ServerTimestamp, Request, Response) => ResponseLog.WhenAll(HTTPProcessor, ServerTimestamp, Request, Response);
            CPOServer.ErrorLog    += (HTTPProcessor, ServerTimestamp, Request, Response, Error, LastException) => ErrorLog.WhenAll(HTTPProcessor, ServerTimestamp, Request, Response, Error, LastException);
        }
Example #2
0
        /// <summary>
        /// Create a new CPO roaming.
        /// </summary>
        /// <param name="CPOClient">A CPO client.</param>
        /// <param name="CPOServer">A CPO sever.</param>
        public CPORoaming(CPOClient CPOClient,
                          CPOServerAPI CPOServer)
        {
            this.CPOClient = CPOClient ?? throw new ArgumentNullException(nameof(CPOClient), "The given CPOClient must not be null!");
            this.CPOServer = CPOServer ?? throw new ArgumentNullException(nameof(CPOServer), "The given CPOServer must not be null!");

            // Link HTTP server events...
            CPOServer.RequestLog  += (HTTPProcessor, ServerTimestamp, Request) => RequestLog.WhenAll(HTTPProcessor, ServerTimestamp, Request);
            CPOServer.ResponseLog += (HTTPProcessor, ServerTimestamp, Request, Response) => ResponseLog.WhenAll(HTTPProcessor, ServerTimestamp, Request, Response);
            CPOServer.ErrorLog    += (HTTPProcessor, ServerTimestamp, Request, Response, Error, LastException) => ErrorLog.WhenAll(HTTPProcessor, ServerTimestamp, Request, Response, Error, LastException);
        }
            /// <summary>
            /// Create a new OICP CPO client logger using the default logging delegates.
            /// </summary>
            /// <param name="CPOClient">A OICP CPO client.</param>
            /// <param name="Context">A context of this API.</param>
            /// <param name="LogfileCreator">A delegate to create a log file from the given context and log file name.</param>
            public CPOClientLogger(CPOClient CPOClient,
                                   String Context = DefaultContext,
                                   LogfileCreatorDelegate LogfileCreator = null)

                : this(CPOClient,
                       Context.IsNotNullOrEmpty() ? Context : DefaultContext,
                       null,
                       null,
                       null,
                       null,

                       LogfileCreator : LogfileCreator)

            {
            }
        //public CustomMapperDelegate<Acknowledgement<PullAuthenticationDataRequest>, Acknowledgement<PullAuthenticationDataRequest>.Builder> CustomPullAuthenticationDataResponseMapper
        //{

        //    get
        //    {
        //        return CPOClient.CustomPullAuthenticationDataResponseMapper;
        //    }

        //    set
        //    {
        //        CPOClient.CustomPullAuthenticationDataResponseMapper = value;
        //    }

        //}

        #endregion

        #endregion

        #region Constructor(s)

        #region CPORoaming(CPOClient, CPOServer, ServerLoggingContext = CPOServerLogger.DefaultContext, LogfileCreator = null)

        /// <summary>
        /// Create a new OICP roaming client for CPOs.
        /// </summary>
        /// <param name="CPOClient">A CPO client.</param>
        /// <param name="CPOServer">A CPO sever.</param>
        /// <param name="ServerLoggingContext">An optional context for logging server methods.</param>
        /// <param name="LogfileCreator">A delegate to create a log file from the given context and logfile name.</param>
        public CPORoaming(CPOClient CPOClient,
                          CPOSOAPServer CPOServer,
                          String ServerLoggingContext           = CPOServerLogger.DefaultContext,
                          LogfileCreatorDelegate LogfileCreator = null)
        {
            this.CPOClient       = CPOClient ?? throw new ArgumentNullException(nameof(CPOClient), "The given CPOClient must not be null!");
            this.CPOServer       = CPOServer ?? throw new ArgumentNullException(nameof(CPOServer), "The given CPOServer must not be null!");
            this.CPOServerLogger = new CPOServerLogger(CPOServer,
                                                       ServerLoggingContext ?? CPOServerLogger.DefaultContext,
                                                       LogfileCreator);

            // Link HTTP events...
            CPOServer.RequestLog  += (HTTPProcessor, ServerTimestamp, Request) => RequestLog.WhenAll(HTTPProcessor, ServerTimestamp, Request);
            CPOServer.ResponseLog += (HTTPProcessor, ServerTimestamp, Request, Response) => ResponseLog.WhenAll(HTTPProcessor, ServerTimestamp, Request, Response);
            CPOServer.ErrorLog    += (HTTPProcessor, ServerTimestamp, Request, Response, Error, LastException) => ErrorLog.WhenAll(HTTPProcessor, ServerTimestamp, Request, Response, Error, LastException);
        }
        PushEVSEData(PushEVSEDataRequest Request)

        => CPOClient.PushEVSEData(Request);
Example #6
0
        SetSessionEventReport(SetSessionEventReportRequest Request)

        => CPOClient.SetSessionEventReport(Request);
Example #7
0
        GetServiceAuthorisation(GetServiceAuthorisationRequest Request)

        => CPOClient.GetServiceAuthorisation(Request);
Example #8
0
        SendChargingProgressNotification(ChargingProgressNotificationRequest Request)

        => CPOClient.SendChargingProgressNotification(Request);
        PullAuthenticationData(PullAuthenticationDataRequest Request)

        => CPOClient.PullAuthenticationData(Request);
Example #10
0
        AuthorizeStop(AuthorizeStopRequest Request)

        => CPOClient.AuthorizeStop(Request);
Example #11
0
        SetChargingStationAvailabilityStatus(SetChargingStationAvailabilityStatusRequest Request)

        => CPOClient.SetChargingStationAvailabilityStatus(Request);
Example #12
0
        SendHeartbeat(HeartbeatRequest Request)

        => CPOClient.SendHeartbeat(Request);
Example #13
0
            /// <summary>
            /// Create a new CPO client logger using the given logging delegates.
            /// </summary>
            /// <param name="CPOClient">A CPO client.</param>
            /// <param name="LoggingPath">The logging path.</param>
            /// <param name="Context">A context of this API.</param>
            ///
            /// <param name="LogHTTPRequest_toConsole">A delegate to log incoming HTTP requests to console.</param>
            /// <param name="LogHTTPResponse_toConsole">A delegate to log HTTP requests/responses to console.</param>
            /// <param name="LogHTTPRequest_toDisc">A delegate to log incoming HTTP requests to disc.</param>
            /// <param name="LogHTTPResponse_toDisc">A delegate to log HTTP requests/responses to disc.</param>
            ///
            /// <param name="LogHTTPRequest_toNetwork">A delegate to log incoming HTTP requests to a network target.</param>
            /// <param name="LogHTTPResponse_toNetwork">A delegate to log HTTP requests/responses to a network target.</param>
            /// <param name="LogHTTPRequest_toHTTPSSE">A delegate to log incoming HTTP requests to a HTTP client sent events source.</param>
            /// <param name="LogHTTPResponse_toHTTPSSE">A delegate to log HTTP requests/responses to a HTTP client sent events source.</param>
            ///
            /// <param name="LogHTTPError_toConsole">A delegate to log HTTP errors to console.</param>
            /// <param name="LogHTTPError_toDisc">A delegate to log HTTP errors to disc.</param>
            /// <param name="LogHTTPError_toNetwork">A delegate to log HTTP errors to a network target.</param>
            /// <param name="LogHTTPError_toHTTPSSE">A delegate to log HTTP errors to a HTTP client sent events source.</param>
            ///
            /// <param name="LogfileCreator">A delegate to create a log file from the given context and log file name.</param>
            public Logger(CPOClient CPOClient,
                          String LoggingPath,
                          String Context,

                          HTTPRequestLoggerDelegate LogHTTPRequest_toConsole,
                          HTTPResponseLoggerDelegate LogHTTPResponse_toConsole,
                          HTTPRequestLoggerDelegate LogHTTPRequest_toDisc,
                          HTTPResponseLoggerDelegate LogHTTPResponse_toDisc,

                          HTTPRequestLoggerDelegate LogHTTPRequest_toNetwork   = null,
                          HTTPResponseLoggerDelegate LogHTTPResponse_toNetwork = null,
                          HTTPRequestLoggerDelegate LogHTTPRequest_toHTTPSSE   = null,
                          HTTPResponseLoggerDelegate LogHTTPResponse_toHTTPSSE = null,

                          HTTPResponseLoggerDelegate LogHTTPError_toConsole = null,
                          HTTPResponseLoggerDelegate LogHTTPError_toDisc    = null,
                          HTTPResponseLoggerDelegate LogHTTPError_toNetwork = null,
                          HTTPResponseLoggerDelegate LogHTTPError_toHTTPSSE = null,

                          LogfileCreatorDelegate LogfileCreator = null)

                : base(CPOClient,
                       LoggingPath,
                       Context.IsNotNullOrEmpty() ? Context : DefaultContext,

                       LogHTTPRequest_toConsole,
                       LogHTTPResponse_toConsole,
                       LogHTTPRequest_toDisc,
                       LogHTTPResponse_toDisc,

                       LogHTTPRequest_toNetwork,
                       LogHTTPResponse_toNetwork,
                       LogHTTPRequest_toHTTPSSE,
                       LogHTTPResponse_toHTTPSSE,

                       LogHTTPError_toConsole,
                       LogHTTPError_toDisc,
                       LogHTTPError_toNetwork,
                       LogHTTPError_toHTTPSSE,

                       LogfileCreator)

            {
                this.CPOClient = CPOClient ?? throw new ArgumentNullException(nameof(CPOClient), "The given CPO client must not be null!");

                #region Register log events

                //RegisterEvent("SendHeartbeatRequest",
                //              handler => CPOClient.OnSendHeartbeatSOAPRequest  += handler,
                //              handler => CPOClient.OnSendHeartbeatSOAPRequest  -= handler,
                //              "SendHeartbeat", "Heartbeat", "requests", "all").
                //    RegisterDefaultConsoleLogTarget(this).
                //    RegisterDefaultDiscLogTarget(this);

                //RegisterEvent("SendHeartbeatResponse",
                //              handler => CPOClient.OnSendHeartbeatSOAPResponse += handler,
                //              handler => CPOClient.OnSendHeartbeatSOAPResponse -= handler,
                //              "SendHeartbeat", "Heartbeat", "Response", "all").
                //    RegisterDefaultConsoleLogTarget(this).
                //    RegisterDefaultDiscLogTarget(this);


                #endregion
            }
Example #14
0
        SendChargingErrorNotification(ChargingErrorNotificationRequest Request)

        => CPOClient.SendChargingErrorNotification(Request);
Example #15
0
        PushEVSEStatus(PushEVSEStatusRequest Request)

        => CPOClient.PushEVSEStatus(Request);
Example #16
0
        AuthorizeStart(AuthorizeStartRequest Request)

        => CPOClient.AuthorizeStart(Request);
Example #17
0
        SetEVSEAvailabilityStatus(SetEVSEAvailabilityStatusRequest Request)

        => CPOClient.SetEVSEAvailabilityStatus(Request);
Example #18
0
        SendChargeDetailRecord(SendChargeDetailRecordRequest Request)

        => CPOClient.SendChargeDetailRecord(Request);
Example #19
0
        SetChargingConnectorAvailabilityStatus(SetChargingConnectorAvailabilityStatusRequest Request)

        => CPOClient.SetChargingConnectorAvailabilityStatus(Request);
Example #20
0
        SetEVSEBusyStatus(SetEVSEBusyStatusRequest Request)

        => CPOClient.SetEVSEBusyStatus(Request);
Example #21
0
        SetEVSESyntheticStatus(SetEVSESyntheticStatusRequest Request)

        => CPOClient.SetEVSESyntheticStatus(Request);
Example #22
0
            /// <summary>
            /// Create a new CPO client logger using the given logging delegates.
            /// </summary>
            /// <param name="CPOClient">A CPO client.</param>
            /// <param name="LoggingPath">The logging path.</param>
            /// <param name="Context">A context of this API.</param>
            ///
            /// <param name="LogHTTPRequest_toConsole">A delegate to log incoming HTTP requests to console.</param>
            /// <param name="LogHTTPResponse_toConsole">A delegate to log HTTP requests/responses to console.</param>
            /// <param name="LogHTTPRequest_toDisc">A delegate to log incoming HTTP requests to disc.</param>
            /// <param name="LogHTTPResponse_toDisc">A delegate to log HTTP requests/responses to disc.</param>
            ///
            /// <param name="LogHTTPRequest_toNetwork">A delegate to log incoming HTTP requests to a network target.</param>
            /// <param name="LogHTTPResponse_toNetwork">A delegate to log HTTP requests/responses to a network target.</param>
            /// <param name="LogHTTPRequest_toHTTPSSE">A delegate to log incoming HTTP requests to a HTTP client sent events source.</param>
            /// <param name="LogHTTPResponse_toHTTPSSE">A delegate to log HTTP requests/responses to a HTTP client sent events source.</param>
            ///
            /// <param name="LogHTTPError_toConsole">A delegate to log HTTP errors to console.</param>
            /// <param name="LogHTTPError_toDisc">A delegate to log HTTP errors to disc.</param>
            /// <param name="LogHTTPError_toNetwork">A delegate to log HTTP errors to a network target.</param>
            /// <param name="LogHTTPError_toHTTPSSE">A delegate to log HTTP errors to a HTTP client sent events source.</param>
            ///
            /// <param name="LogfileCreator">A delegate to create a log file from the given context and log file name.</param>
            public Logger(CPOClient CPOClient,
                          String LoggingPath,
                          String Context,

                          HTTPRequestLoggerDelegate LogHTTPRequest_toConsole,
                          HTTPResponseLoggerDelegate LogHTTPResponse_toConsole,
                          HTTPRequestLoggerDelegate LogHTTPRequest_toDisc,
                          HTTPResponseLoggerDelegate LogHTTPResponse_toDisc,

                          HTTPRequestLoggerDelegate LogHTTPRequest_toNetwork   = null,
                          HTTPResponseLoggerDelegate LogHTTPResponse_toNetwork = null,
                          HTTPRequestLoggerDelegate LogHTTPRequest_toHTTPSSE   = null,
                          HTTPResponseLoggerDelegate LogHTTPResponse_toHTTPSSE = null,

                          HTTPResponseLoggerDelegate LogHTTPError_toConsole = null,
                          HTTPResponseLoggerDelegate LogHTTPError_toDisc    = null,
                          HTTPResponseLoggerDelegate LogHTTPError_toNetwork = null,
                          HTTPResponseLoggerDelegate LogHTTPError_toHTTPSSE = null,

                          LogfileCreatorDelegate LogfileCreator = null)

                : base(CPOClient,
                       LoggingPath,
                       Context.IsNotNullOrEmpty() ? Context : DefaultContext,

                       LogHTTPRequest_toConsole,
                       LogHTTPResponse_toConsole,
                       LogHTTPRequest_toDisc,
                       LogHTTPResponse_toDisc,

                       LogHTTPRequest_toNetwork,
                       LogHTTPResponse_toNetwork,
                       LogHTTPRequest_toHTTPSSE,
                       LogHTTPResponse_toHTTPSSE,

                       LogHTTPError_toConsole,
                       LogHTTPError_toDisc,
                       LogHTTPError_toNetwork,
                       LogHTTPError_toHTTPSSE,

                       LogfileCreator)

            {
                this.CPOClient = CPOClient ?? throw new ArgumentNullException(nameof(CPOClient), "The given CPO client must not be null!");

                #region PushEVSEData/Status

                RegisterEvent("PushEVSEDataHTTPRequest",
                              handler => CPOClient.OnPushEVSEDataHTTPRequest += handler,
                              handler => CPOClient.OnPushEVSEDataHTTPRequest -= handler,
                              "PushEVSEData", "push", "requests", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);

                RegisterEvent("PushEVSEDataHTTPResponse",
                              handler => CPOClient.OnPushEVSEDataHTTPResponse += handler,
                              handler => CPOClient.OnPushEVSEDataHTTPResponse -= handler,
                              "PushEVSEData", "push", "responses", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);


                RegisterEvent("PushEVSEStatusHTTPRequest",
                              handler => CPOClient.OnPushEVSEStatusHTTPRequest += handler,
                              handler => CPOClient.OnPushEVSEStatusHTTPRequest -= handler,
                              "PushEVSEStatus", "push", "requests", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);

                RegisterEvent("PushEVSEStatusHTTPResponse",
                              handler => CPOClient.OnPushEVSEStatusHTTPResponse += handler,
                              handler => CPOClient.OnPushEVSEStatusHTTPResponse -= handler,
                              "PushEVSEStatus", "push", "responses", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);

                #endregion

                #region AuthorizeStart/Stop

                RegisterEvent("AuthorizeStartHTTPRequest",
                              handler => CPOClient.OnAuthorizeStartHTTPRequest += handler,
                              handler => CPOClient.OnAuthorizeStartHTTPRequest -= handler,
                              "authorizeStart", "authorize", "requests", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);

                RegisterEvent("AuthorizeStartHTTPResponse",
                              handler => CPOClient.OnAuthorizeStartHTTPResponse += handler,
                              handler => CPOClient.OnAuthorizeStartHTTPResponse -= handler,
                              "authorizeStart", "authorize", "responses", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);


                RegisterEvent("AuthorizeStopHTTPRequest",
                              handler => CPOClient.OnAuthorizeStopHTTPRequest += handler,
                              handler => CPOClient.OnAuthorizeStopHTTPRequest -= handler,
                              "authorizeStop", "authorize", "requests", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);

                RegisterEvent("AuthorizeStopHTTPResponse",
                              handler => CPOClient.OnAuthorizeStopHTTPResponse += handler,
                              handler => CPOClient.OnAuthorizeStopHTTPResponse -= handler,
                              "authorizeStop", "authorize", "responses", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);

                #endregion

                #region ChargingNotifications

                RegisterEvent("ChargingStartNotificationHTTPRequest",
                              handler => CPOClient.OnChargingStartNotificationHTTPRequest += handler,
                              handler => CPOClient.OnChargingStartNotificationHTTPRequest -= handler,
                              "chargingStartNotification", "chargingNotifications", "requests", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);

                RegisterEvent("ChargingStartNotificationHTTPResponse",
                              handler => CPOClient.OnChargingStartNotificationHTTPResponse += handler,
                              handler => CPOClient.OnChargingStartNotificationHTTPResponse -= handler,
                              "chargingStartNotification", "chargingNotifications", "responses", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);


                RegisterEvent("ChargingProgressNotificationHTTPRequest",
                              handler => CPOClient.OnChargingProgressNotificationHTTPRequest += handler,
                              handler => CPOClient.OnChargingProgressNotificationHTTPRequest -= handler,
                              "chargingProgressNotification", "chargingNotifications", "requests", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);

                RegisterEvent("ChargingProgressNotificationHTTPResponse",
                              handler => CPOClient.OnChargingProgressNotificationHTTPResponse += handler,
                              handler => CPOClient.OnChargingProgressNotificationHTTPResponse -= handler,
                              "chargingProgressNotification", "chargingNotifications", "responses", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);


                RegisterEvent("ChargingEndNotificationHTTPRequest",
                              handler => CPOClient.OnChargingEndNotificationHTTPRequest += handler,
                              handler => CPOClient.OnChargingEndNotificationHTTPRequest -= handler,
                              "chargingEndNotification", "chargingNotifications", "requests", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);

                RegisterEvent("ChargingEndNotificationHTTPResponse",
                              handler => CPOClient.OnChargingEndNotificationHTTPResponse += handler,
                              handler => CPOClient.OnChargingEndNotificationHTTPResponse -= handler,
                              "chargingEndNotification", "chargingNotifications", "responses", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);


                RegisterEvent("ChargingErrorNotificationHTTPRequest",
                              handler => CPOClient.OnChargingErrorNotificationHTTPRequest += handler,
                              handler => CPOClient.OnChargingErrorNotificationHTTPRequest -= handler,
                              "authorizeStop", "chargingNotifications", "requests", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);

                RegisterEvent("ChargingErrorNotificationHTTPResponse",
                              handler => CPOClient.OnChargingErrorNotificationHTTPResponse += handler,
                              handler => CPOClient.OnChargingErrorNotificationHTTPResponse -= handler,
                              "chargingErrorNotification", "chargingNotifications", "responses", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);

                #endregion

                #region SendChargeDetailRecord

                RegisterEvent("SendChargeDetailRecordHTTPRequest",
                              handler => CPOClient.OnSendChargeDetailRecordHTTPRequest += handler,
                              handler => CPOClient.OnSendChargeDetailRecordHTTPRequest -= handler,
                              "sendChargeDetailRecord", "cdr", "requests", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);

                RegisterEvent("SendChargeDetailRecordHTTPResponse",
                              handler => CPOClient.OnSendChargeDetailRecordHTTPResponse += handler,
                              handler => CPOClient.OnSendChargeDetailRecordHTTPResponse -= handler,
                              "sendChargeDetailRecord", "cdr", "responses", "all").
                RegisterDefaultConsoleLogTarget(this).
                RegisterDefaultDiscLogTarget(this);

                #endregion
            }
Example #23
0
        SendChargingStartNotification(ChargingStartNotificationRequest Request)

        => CPOClient.SendChargingStartNotification(Request);