/// <summary> /// Convert a WWCP EVSE identification into an eMIP EVSE identification. /// </summary> /// <param name="EVSEId">A WWCP EVSE identification.</param> /// <param name="CustomEVSEIdMapper">A delegate to customize the mapping of EVSE identifications.</param> public static EVSE_Id?ToEMIP(this WWCP.EVSE_Id EVSEId, CustomEVSEIdMapperDelegate CustomEVSEIdMapper = null) { if (EVSE_Id.TryParse(CustomEVSEIdMapper != null ? CustomEVSEIdMapper(EVSEId.ToString()) : EVSEId.ToString(), out EVSE_Id eMIPEVSEId)) { return(eMIPEVSEId); } return(null); }
/// <summary> /// Attach the eMIP+ WebAPI to the given HTTP server. /// </summary> /// <param name="HTTPServer">A HTTP server.</param> /// <param name="URLPathPrefix">An optional prefix for the HTTP URIs.</param> /// <param name="HTTPRealm">The HTTP realm, if HTTP Basic Authentication is used.</param> /// <param name="HTTPLogins">An enumeration of logins for an optional HTTP Basic Authentication.</param> /// /// <param name="XMLNamespaces">An optional delegate to process the XML namespaces.</param> /// <param name="XMLPostProcessing">An optional delegate to process the XML after its final creation.</param> public WebAPI(HTTPServer <RoamingNetworks, RoamingNetwork> HTTPServer, HTTPPath?URLPathPrefix = null, String HTTPRealm = DefaultHTTPRealm, IEnumerable <KeyValuePair <String, String> > HTTPLogins = null, XMLNamespacesDelegate XMLNamespaces = null, XMLPostProcessingDelegate XMLPostProcessing = null, CustomOperatorIdMapperDelegate CustomOperatorIdMapper = null, CustomEVSEIdMapperDelegate CustomEVSEIdMapper = null) { this.HTTPServer = HTTPServer ?? throw new ArgumentNullException(nameof(HTTPServer), "The given HTTP server must not be null!"); this.URLPathPrefix = URLPathPrefix ?? DefaultURLPathPrefix; this.HTTPRealm = HTTPRealm.IsNotNullOrEmpty() ? HTTPRealm : DefaultHTTPRealm; this.HTTPLogins = HTTPLogins ?? new KeyValuePair <String, String> [0]; this.DNSClient = HTTPServer.DNSClient; this.XMLNamespaces = XMLNamespaces; this.XMLPostProcessing = XMLPostProcessing; this.CustomOperatorIdMapper = CustomOperatorIdMapper; this.CustomEVSEIdMapper = CustomEVSEIdMapper; this._CPOAdapters = new List <WWCPCPOAdapter>(); // Link HTTP events... HTTPServer.RequestLog += (HTTPProcessor, ServerTimestamp, Request) => RequestLog.WhenAll(HTTPProcessor, ServerTimestamp, Request); HTTPServer.ResponseLog += (HTTPProcessor, ServerTimestamp, Request, Response) => ResponseLog.WhenAll(HTTPProcessor, ServerTimestamp, Request, Response); HTTPServer.ErrorLog += (HTTPProcessor, ServerTimestamp, Request, Response, Error, LastException) => ErrorLog.WhenAll(HTTPProcessor, ServerTimestamp, Request, Response, Error, LastException); var LogfilePrefix = "HTTPSSEs" + Path.DirectorySeparatorChar; this.DebugLog = HTTPServer.AddJSONEventSource(EventIdentification: DebugLogId, URLTemplate: this.URLPathPrefix + "/DebugLog", MaxNumberOfCachedEvents: 10000, RetryIntervall: TimeSpan.FromSeconds(5), EnableLogging: true, LogfilePrefix: LogfilePrefix); RegisterURITemplates(); }
CreateeMIPv0_7_4_CSORoamingProvider(this RoamingNetwork RoamingNetwork, EMPRoamingProvider_Id Id, I18NString Name, I18NString Description, CPORoaming CPORoaming, eMIPv0_7_4.Partner_Id PartnerId, ChargingStationOperator DefaultOperator, WWCPChargeDetailRecord2ChargeDetailRecordDelegate WWCPChargeDetailRecord2eMIPChargeDetailRecord = null, IncludeEVSEIdDelegate IncludeEVSEIds = null, IncludeEVSEDelegate IncludeEVSEs = null, IncludeChargingStationIdDelegate IncludeChargingStationIds = null, IncludeChargingStationDelegate IncludeChargingStations = null, IncludeChargingPoolIdDelegate IncludeChargingPoolIds = null, IncludeChargingPoolDelegate IncludeChargingPools = null, ChargeDetailRecordFilterDelegate ChargeDetailRecordFilter = null, CustomOperatorIdMapperDelegate CustomOperatorIdMapper = null, CustomEVSEIdMapperDelegate CustomEVSEIdMapper = null, TimeSpan?SendHeartbeatsEvery = null, TimeSpan?ServiceCheckEvery = null, TimeSpan?StatusCheckEvery = null, TimeSpan?CDRCheckEvery = null, Boolean DisableSendHeartbeats = false, Boolean DisablePushData = false, Boolean DisablePushStatus = false, Boolean DisableAuthentication = false, Boolean DisableSendChargeDetailRecords = false, Action <eMIPv0_7_4.CPO.WWCPCPOAdapter> eMIPConfigurator = null, Action <IEMPRoamingProvider> Configurator = null, String EllipticCurve = "P-256", ECPrivateKeyParameters PrivateKey = null, PublicKeyCertificates PublicKeyCertificates = null, CounterValues?CPOClientSendHeartbeatCounter = null, CounterValues?CPOClientSetChargingPoolAvailabilityStatusCounter = null, CounterValues?CPOClientSetChargingStationAvailabilityStatusCounter = null, CounterValues?CPOClientSetEVSEAvailabilityStatusCounter = null, CounterValues?CPOClientSetChargingConnectorAvailabilityStatusCounter = null, CounterValues?CPOClientSetEVSEBusyStatusCounter = null, CounterValues?CPOClientSetEVSESyntheticStatusCounter = null, CounterValues?CPOClientGetServiceAuthorisationCounter = null, CounterValues?CPOClientSetSessionEventReportCounter = null, CounterValues?CPOClientSetChargeDetailRecordCounter = null) { #region Initial checks if (RoamingNetwork == null) { throw new ArgumentNullException(nameof(RoamingNetwork), "The given roaming network must not be null!"); } if (Id == null) { throw new ArgumentNullException(nameof(Id), "The given unique roaming provider identification must not be null!"); } if (Name.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(Name), "The given roaming provider name must not be null or empty!"); } if (CPORoaming is null) { throw new ArgumentNullException(nameof(CPORoaming), "The given CPO roaming must not be null!"); } #endregion var NewRoamingProvider = new WWCPCPOAdapter(Id, Name, Description, RoamingNetwork, CPORoaming, PartnerId, DefaultOperator, IncludeEVSEIds, IncludeEVSEs, IncludeChargingStationIds, IncludeChargingStations, IncludeChargingPoolIds, IncludeChargingPools, ChargeDetailRecordFilter, CustomOperatorIdMapper, CustomEVSEIdMapper, //EVSE2EVSEDataRecord, //EVSEStatusUpdate2EVSEStatusRecord, WWCPChargeDetailRecord2eMIPChargeDetailRecord, SendHeartbeatsEvery, ServiceCheckEvery, StatusCheckEvery, CDRCheckEvery, DisableSendHeartbeats, DisablePushData, DisablePushStatus, DisableAuthentication, DisableSendChargeDetailRecords, EllipticCurve, PrivateKey, PublicKeyCertificates); eMIPConfigurator?.Invoke(NewRoamingProvider); return(RoamingNetwork. CreateNewRoamingProvider(NewRoamingProvider, Configurator) as WWCPCPOAdapter); }
CreateOICPv2_2_EMPRoamingProvider(this RoamingNetwork RoamingNetwork, EMPRoamingProvider_Id Id, I18NString Name, I18NString Description, OICPv2_2.CPO.CPORoaming CPORoaming, OICPv2_2.CPO.EVSE2EVSEDataRecordDelegate EVSE2EVSEDataRecord = null, OICPv2_2.CPO.EVSEStatusUpdate2EVSEStatusRecordDelegate EVSEStatusUpdate2EVSEStatusRecord = null, OICPv2_2.CPO.WWCPChargeDetailRecord2ChargeDetailRecordDelegate WWCPChargeDetailRecord2OICPChargeDetailRecord = null, ChargingStationOperator DefaultOperator = null, OperatorIdFormats DefaultOperatorIdFormat = OperatorIdFormats.ISO_STAR, ChargingStationOperatorNameSelectorDelegate OperatorNameSelector = null, IncludeEVSEIdDelegate IncludeEVSEIds = null, IncludeEVSEDelegate IncludeEVSEs = null, ChargeDetailRecordFilterDelegate ChargeDetailRecordFilter = null, CustomEVSEIdMapperDelegate CustomEVSEIdMapper = null, TimeSpan?ServiceCheckEvery = null, TimeSpan?StatusCheckEvery = null, TimeSpan?CDRCheckEvery = null, Boolean DisablePushData = false, Boolean DisablePushStatus = false, Boolean DisableAuthentication = false, Boolean DisableSendChargeDetailRecords = false, Action <OICPv2_2.CPO.WWCPEMPAdapter> OICPConfigurator = null, Action <IEMPRoamingProvider> Configurator = null, String EllipticCurve = "P-256", ECPrivateKeyParameters PrivateKey = null, PublicKeyCertificates PublicKeyCertificates = null, DNSClient DNSClient = null) { #region Initial checks if (RoamingNetwork == null) { throw new ArgumentNullException(nameof(RoamingNetwork), "The given roaming network must not be null!"); } if (Id == null) { throw new ArgumentNullException(nameof(Id), "The given unique roaming provider identification must not be null!"); } if (Name.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(Name), "The given roaming provider name must not be null or empty!"); } if (CPORoaming == null) { throw new ArgumentNullException(nameof(CPORoaming), "The given CPO Roaming must not be null!"); } #endregion var NewRoamingProvider = new OICPv2_2.CPO.WWCPEMPAdapter(Id, Name, Description, RoamingNetwork, CPORoaming, EVSE2EVSEDataRecord, EVSEStatusUpdate2EVSEStatusRecord, WWCPChargeDetailRecord2OICPChargeDetailRecord, DefaultOperator, DefaultOperatorIdFormat, OperatorNameSelector, IncludeEVSEIds, IncludeEVSEs, ChargeDetailRecordFilter, CustomEVSEIdMapper, ServiceCheckEvery, StatusCheckEvery, CDRCheckEvery, DisablePushData, DisablePushStatus, DisableAuthentication, DisableSendChargeDetailRecords, EllipticCurve, PrivateKey, PublicKeyCertificates, DNSClient); OICPConfigurator?.Invoke(NewRoamingProvider); return(RoamingNetwork. CreateNewRoamingProvider(NewRoamingProvider, Configurator) as OICPv2_2.CPO.WWCPEMPAdapter); }