/// <summary>
        /// Create a new abstract crypto entity.
        /// </summary>
        /// <param name="Ids">The unique entity identifications.</param>
        /// <param name="RoamingNetwork">A WWCP roaming network.</param>
        protected ABaseEMobilityEntity(IEnumerable <TId> Ids,
                                       IRoamingNetwork RoamingNetwork,
                                       String EllipticCurve = "P-256",
                                       ECPrivateKeyParameters PrivateKey           = null,
                                       PublicKeyCertificates PublicKeyCertificates = null)

            : base(Ids,
                   RoamingNetwork,
                   EllipticCurve,
                   PrivateKey,
                   PublicKeyCertificates)

        {
        }
Beispiel #2
0
        /// <summary>
        /// Create a new abstract crypto entity.
        /// </summary>
        /// <param name="Id">The unique entity identification.</param>
        protected ACryptoEMobilityEntity(TId Id,
                                         IRoamingNetwork RoamingNetwork,
                                         String EllipticCurve = "P-256",
                                         ECPrivateKeyParameters PrivateKey           = null,
                                         PublicKeyCertificates PublicKeyCertificates = null)

            : base(Id)

        {
            this.RoamingNetwork = RoamingNetwork;
            this.EllipticCurve  = EllipticCurve ?? "P-256";
            this.ECP            = ECNamedCurveTable.GetByName(this.EllipticCurve);
            this.ECSpec         = new ECDomainParameters(ECP.Curve, ECP.G, ECP.N, ECP.H, ECP.GetSeed());
            this.C                     = (FpCurve)ECSpec.Curve;
            this.PrivateKey            = PrivateKey;
            this.PublicKeyCertificates = PublicKeyCertificates;
        }
Beispiel #3
0
        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_3_EMPRoamingProvider(this RoamingNetwork RoamingNetwork,
                                          EMPRoamingProvider_Id Id,
                                          I18NString Name,
                                          I18NString Description,
                                          OICPv2_3.CPO.CPORoaming CPORoaming,

                                          OICPv2_3.EVSE2EVSEDataRecordDelegate EVSE2EVSEDataRecord = null,
                                          OICPv2_3.EVSEStatusUpdate2EVSEStatusRecordDelegate EVSEStatusUpdate2EVSEStatusRecord = null,
                                          OICPv2_3.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_3.CPO.WWCPEMPAdapter> OICPConfigurator = null,
                                          Action <IEMPRoamingProvider> Configurator             = null,

                                          String EllipticCurve = "P-256",
                                          ECPrivateKeyParameters PrivateKey           = null,
                                          PublicKeyCertificates PublicKeyCertificates = null)

        {
            #region Initial checks

            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 (RoamingNetwork == null)
            {
                throw new ArgumentNullException(nameof(RoamingNetwork), "The given roaming network must not be null!");
            }

            if (CPORoaming == null)
            {
                throw new ArgumentNullException(nameof(CPORoaming), "The given CPORoaming must not be null!");
            }

            #endregion

            var NewRoamingProvider = new OICPv2_3.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);

            OICPConfigurator?.Invoke(NewRoamingProvider);

            return(RoamingNetwork.
                   CreateNewRoamingProvider(NewRoamingProvider,
                                            Configurator) as OICPv2_3.CPO.WWCPEMPAdapter);
        }
Beispiel #5
0
        /// <summary>
        /// Create a new WWCP wrapper for the OICP roaming client for Charging Station Operators/CPOs.
        /// </summary>
        /// <param name="Id">The unique identification of the roaming provider.</param>
        /// <param name="Name">The offical (multi-language) name of the roaming provider.</param>
        /// <param name="Description">An optional (multi-language) description of the charging station operator roaming provider.</param>
        /// <param name="RoamingNetwork">A WWCP roaming network.</param>
        ///
        /// <param name="IncludeEVSEIds">Only include the EVSE matching the given delegate.</param>
        /// <param name="IncludeEVSEs">Only include the EVSEs matching the given delegate.</param>
        ///
        /// <param name="FlushEVSEDataAndStatusEvery">The service check intervall.</param>
        /// <param name="FlushEVSEFastStatusEvery">The status check intervall.</param>
        /// <param name="FlushChargeDetailRecordsEvery">The charge detail record intervall.</param>
        ///
        /// <param name="DisablePushData">This service can be disabled, e.g. for debugging reasons.</param>
        /// <param name="DisablePushStatus">This service can be disabled, e.g. for debugging reasons.</param>
        /// <param name="DisableAuthentication">This service can be disabled, e.g. for debugging reasons.</param>
        /// <param name="DisableSendChargeDetailRecords">This service can be disabled, e.g. for debugging reasons.</param>
        ///
        /// <param name="DNSClient">The attached DNS service.</param>
        protected AWWCPCSOAdapter(CSORoamingProvider_Id Id,
                                  I18NString Name,
                                  I18NString Description,
                                  RoamingNetwork RoamingNetwork,

                                  IncludeEVSEIdDelegate IncludeEVSEIds = null,
                                  IncludeEVSEDelegate IncludeEVSEs     = null,

                                  TimeSpan?FlushEVSEDataAndStatusEvery   = null,
                                  TimeSpan?FlushEVSEFastStatusEvery      = null,
                                  TimeSpan?FlushChargeDetailRecordsEvery = null,

                                  Boolean DisablePushData                = false,
                                  Boolean DisablePushStatus              = false,
                                  Boolean DisableAuthentication          = false,
                                  Boolean DisableSendChargeDetailRecords = false,

                                  String EllipticCurve = "P-256",
                                  ECPrivateKeyParameters PrivateKey           = null,
                                  PublicKeyCertificates PublicKeyCertificates = null,

                                  DNSClient DNSClient = null)

            : base(Id,
                   RoamingNetwork,
                   EllipticCurve,
                   PrivateKey,
                   PublicKeyCertificates)

        {
            this.Name        = Name;
            this.Description = Description;

            this._ISendData   = this as ISendData;
            this._ISendStatus = this as ISendStatus;

            this._IncludeEVSEIds = IncludeEVSEIds ?? (evseid => true);
            this._IncludeEVSEs   = IncludeEVSEs ?? (evse => true);

            this.DisablePushData                = DisablePushData;
            this.DisablePushStatus              = DisablePushStatus;
            this.DisableAuthentication          = DisableAuthentication;
            this.DisableSendChargeDetailRecords = DisableSendChargeDetailRecords;

            this.FlushEVSEDataAndStatusEvery   = FlushEVSEDataAndStatusEvery ?? DefaultFlushEVSEDataAndStatusEvery;
            this.FlushEVSEFastStatusEvery      = FlushEVSEFastStatusEvery ?? DefaultFlushEVSEFastStatusEvery;
            this.FlushChargeDetailRecordsEvery = FlushChargeDetailRecordsEvery ?? DefaultFlushChargeDetailRecordsEvery;

            this.FlushEVSEDataAndStatusTimer   = new Timer(FlushEVSEDataAndStatus);
            this.FlushEVSEFastStatusTimer      = new Timer(FlushEVSEFastStatus);
            this.FlushChargeDetailRecordsTimer = new Timer(FlushChargeDetailRecords);

            this.EVSEsUpdateLog            = new Dictionary <EVSE, List <PropertyUpdateInfos> >();
            this.ChargingStationsUpdateLog = new Dictionary <ChargingStation, List <PropertyUpdateInfos> >();
            this.ChargingPoolsUpdateLog    = new Dictionary <ChargingPool, List <PropertyUpdateInfos> >();

            this.DNSClient = DNSClient;

            this.EVSEsToAddQueue    = new HashSet <EVSE>();
            this.EVSEsToUpdateQueue = new HashSet <EVSE>();
            this.EVSEsToRemoveQueue = new HashSet <EVSE>();
            this.EVSEAdminStatusChangesFastQueue    = new List <EVSEAdminStatusUpdate>();
            this.EVSEAdminStatusChangesDelayedQueue = new List <EVSEAdminStatusUpdate>();
            this.EVSEStatusChangesFastQueue         = new List <EVSEStatusUpdate>();
            this.EVSEStatusChangesDelayedQueue      = new List <EVSEStatusUpdate>();
        }