Ejemplo n.º 1
0
        internal GenericAPI(RoamingNetwork        RoamingNetwork,
                            String                HTTPServerName          = DefaultHTTPServerName,
                            IPPort                HTTPServerPort          = null,
                            String                URIPrefix               = "",
                            Func<String, Stream>  GetRessources           = null,

                            String                ServiceName             = DefaultHTTPServerName,
                            EMailAddress          APIEMailAddress         = null,
                            PgpPublicKeyRing      APIPublicKeyRing        = null,
                            PgpSecretKeyRing      APISecretKeyRing        = null,
                            String                APIPassphrase           = null,
                            EMailAddressList      APIAdminEMail           = null,
                            SMTPClient            APISMTPClient           = null,

                            DNSClient             DNSClient               = null,
                            String                LogfileName             = DefaultLogfileName)
            : this(RoamingNetwork,
                   new HTTPServer(DefaultServerName: DefaultHTTPServerName).AttachTCPPorts(HTTPServerPort != null ? HTTPServerPort : DefaultHTTPServerPort),
                   URIPrefix,
                   GetRessources,

                   ServiceName,
                   APIEMailAddress,
                   APIPublicKeyRing,
                   APISecretKeyRing,
                   APIPassphrase,
                   APIAdminEMail,
                   APISMTPClient,

                   LogfileName)
        {
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialize the OCPI HTTP server using IPAddress.Any, http port 8080 and maybe start the server.
        /// </summary>
        internal GenericAPI(RoamingNetwork RoamingNetwork,
                            HTTPServer HTTPServer,
                            String URIPrefix = "/ext/OCPI",
                            Func <String, Stream> GetRessources = null,

                            String ServiceName                = DefaultHTTPServerName,
                            EMailAddress APIEMailAddress      = null,
                            PgpPublicKeyRing APIPublicKeyRing = null,
                            PgpSecretKeyRing APISecretKeyRing = null,
                            String APIPassphrase              = null,
                            EMailAddressList APIAdminEMail    = null,
                            SMTPClient APISMTPClient          = null,

                            String LogfileName = DefaultLogfileName)

        {
            #region Initial checks

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

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

            if (URIPrefix.IsNullOrEmpty())
            {
                throw new ArgumentNullException("URIPrefix", "The given parameter must not be null or empty!");
            }

            if (!URIPrefix.StartsWith("/"))
            {
                URIPrefix = "/" + URIPrefix;
            }

            #endregion

            #region Init data

            this._HTTPServer    = HTTPServer;
            this._GetRessources = GetRessources;
            this._URIPrefix     = URIPrefix;

            this._ServiceName      = ServiceName;
            this._APIEMailAddress  = APIEMailAddress;
            this._APIPublicKeyRing = APIPublicKeyRing;
            this._APISecretKeyRing = APISecretKeyRing;
            this._APIPassphrase    = APIPassphrase;
            this._APIAdminEMail    = APIAdminEMail;
            this._APISMTPClient    = APISMTPClient;

            this._DNSClient = HTTPServer.DNSClient;

            #endregion

            RegisterURITemplates();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a new Navigation Service Provider (NSP)
        /// having the given NSP_Id.
        /// </summary>
        /// <param name="Id">The Navigation Service Provider Identification.</param>
        /// <param name="RoamingNetwork">The associated roaming network.</param>
        internal NavigationServiceProvider(NavigationServiceProvider_Id Id,
                                           RoamingNetwork RoamingNetwork)

            : base(Id)

        {
            #region Initial checks

            if (Id == null)
            {
                throw new ArgumentNullException("Id", "The unique identification of the navigation service provider must not be null!");
            }

            if (RoamingNetwork == null)
            {
                throw new ArgumentNullException("RoamingNetwork", "The roaming network must not be null!");
            }

            #endregion

            #region Init data and properties

            this._RoamingNetwork = RoamingNetwork;

            this._Name        = new I18NString();
            this._Description = new I18NString();

            this._RegisteredChargingPools = new ConcurrentDictionary <ChargingPool_Id, ChargingPool>();

            #endregion
        }
Ejemplo n.º 4
0
        public RoamingNetworkInfo(Tracker_Id TrackerId,
                                  String IncomingURI,
                                  DateTime ExpiredAfter,

                                  RoamingNetwork RoamingNetwork,
                                  Byte priority,
                                  Byte weight,
                                  String hostname,
                                  IPPort port,
                                  TransportTypes transport,
                                  String uriPrefix,
                                  HTTPContentType contentType,
                                  ProtocolTypes protocolType,
                                  IEnumerable <String> PublicKeys)

            : this(TrackerId,
                   IncomingURI,
                   ExpiredAfter,

                   RoamingNetwork.Id,
                   priority,
                   weight,
                   hostname,
                   port,
                   transport,
                   uriPrefix,
                   contentType,
                   protocolType,
                   PublicKeys)

        {
            this.RoamingNetwork = RoamingNetwork;
        }
Ejemplo n.º 5
0
        internal GenericAPI(RoamingNetwork RoamingNetwork,
                            String HTTPServerName = DefaultHTTPServerName,
                            IPPort HTTPServerPort = null,
                            String URIPrefix      = "",
                            Func <String, Stream> GetRessources = null,

                            String ServiceName                = DefaultHTTPServerName,
                            EMailAddress APIEMailAddress      = null,
                            PgpPublicKeyRing APIPublicKeyRing = null,
                            PgpSecretKeyRing APISecretKeyRing = null,
                            String APIPassphrase              = null,
                            EMailAddressList APIAdminEMail    = null,
                            SMTPClient APISMTPClient          = null,

                            DNSClient DNSClient = null,
                            String LogfileName  = DefaultLogfileName)

            : this(RoamingNetwork,
                   new HTTPServer(DefaultServerName : DefaultHTTPServerName).AttachTCPPorts(HTTPServerPort != null ? HTTPServerPort : DefaultHTTPServerPort),
                   URIPrefix,
                   GetRessources,

                   ServiceName,
                   APIEMailAddress,
                   APIPublicKeyRing,
                   APISecretKeyRing,
                   APIPassphrase,
                   APIAdminEMail,
                   APISMTPClient,

                   LogfileName)

        {
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Create an instance of the OCPI HTTP API for Charge Point Operators
        /// using a newly created HTTP server.
        /// </summary>
        public CPOAPI(RoamingNetwork RoamingNetwork,
                      String HTTPServerName = DefaultHTTPServerName,
                      IPPort HTTPServerPort = null,
                      String URIPrefix      = "",

                      String ServiceName                = DefaultHTTPServerName,
                      EMailAddress APIEMailAddress      = null,
                      PgpSecretKeyRing APISecretKeyRing = null,
                      String APIPassphrase              = null,
                      EMailAddressList APIAdminEMail    = null,
                      SMTPClient APISMTPClient          = null,

                      DNSClient DNSClient = null,
                      String LogfileName  = DefaultLogfileName)

            : base(RoamingNetwork,
                   HTTPServerName,
                   HTTPServerPort != null ? HTTPServerPort : DefaultHTTPServerPort,
                   URIPrefix,
                   ResourceName => typeof(CPOAPI).Assembly.GetManifestResourceStream("org.GraphDefined.WWCP.OCPIv2_1.HTTPAPI.CPOAPI.HTTPRoot." + ResourceName),

                   ServiceName,
                   APIEMailAddress,
                   null,//OpenPGP.ReadPublicKeyRing(typeof(CPOAPI).Assembly.GetManifestResourceStream("org.GraphDefined.WWCP.OCPIv2_1.HTTPAPI.GenericAPI.HTTPRoot.robot@offenes-jena_pubring.gpg")),
                   APISecretKeyRing,
                   APIPassphrase,
                   APIAdminEMail,
                   APISMTPClient,

                   DNSClient,
                   LogfileName)

        {
            RegisterCPOURITemplates();
        }
Ejemplo n.º 7
0
        public static RoamingNetworkInfo Create(this RoamingNetwork RoamingNetwork,
                                                Tracker_Id TrackerId,
                                                DateTime ExpiredAfter,

                                                Byte priority,
                                                Byte weight,
                                                String hostname,
                                                IPPort port,
                                                TransportTypes transport,
                                                String uriPrefix,
                                                HTTPContentType contentType,
                                                ProtocolTypes protocolType,
                                                IEnumerable <String> PublicKeys)
        {
            return(new RoamingNetworkInfo(TrackerId,
                                          "",
                                          ExpiredAfter,
                                          RoamingNetwork.Id,
                                          priority,
                                          weight,
                                          hostname,
                                          port,
                                          transport,
                                          uriPrefix,
                                          contentType,
                                          protocolType,
                                          PublicKeys));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Create an instance of the OCPI HTTP API for Charge Point Operators
        /// using a newly created HTTP server.
        /// </summary>
        public CPOAPI(RoamingNetwork    RoamingNetwork,
                      String            HTTPServerName    = DefaultHTTPServerName,
                      IPPort            HTTPServerPort    = null,
                      String            URIPrefix         = "",

                      String            ServiceName       = DefaultHTTPServerName,
                      EMailAddress      APIEMailAddress   = null,
                      PgpSecretKeyRing  APISecretKeyRing  = null,
                      String            APIPassphrase     = null,
                      EMailAddressList  APIAdminEMail     = null,
                      SMTPClient        APISMTPClient     = null,

                      DNSClient         DNSClient         = null,
                      String            LogfileName       = DefaultLogfileName)
            : base(RoamingNetwork,
                   HTTPServerName,
                   HTTPServerPort != null ? HTTPServerPort : DefaultHTTPServerPort,
                   URIPrefix,
                   ResourceName => typeof(CPOAPI).Assembly.GetManifestResourceStream("org.GraphDefined.WWCP.OCPIv2_1.HTTPAPI.CPOAPI.HTTPRoot." + ResourceName),

                   ServiceName,
                   APIEMailAddress,
                   null,//OpenPGP.ReadPublicKeyRing(typeof(CPOAPI).Assembly.GetManifestResourceStream("org.GraphDefined.WWCP.OCPIv2_1.HTTPAPI.GenericAPI.HTTPRoot.robot@offenes-jena_pubring.gpg")),
                   APISecretKeyRing,
                   APIPassphrase,
                   APIAdminEMail,
                   APISMTPClient,

                   DNSClient,
                   LogfileName)
        {
            RegisterCPOURITemplates();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// An exception thrown whenever a e-mobility provider already exists within the given roaming network.
        /// </summary>
        /// <param name="RoamingNetwork">The roaming network.</param>
        /// <param name="NavigationProviderId">The e-mobility provider identification.</param>
        public NavigationProviderAlreadyExists(RoamingNetwork RoamingNetwork,
                                               NavigationProvider_Id NavigationProviderId)

            : base(RoamingNetwork,
                   "The given e-mobility provider identification '" + NavigationProviderId + "' already exists within the given '" + RoamingNetwork.Id + "' roaming network!")

        {
        }
Ejemplo n.º 10
0
        /// <summary>
        /// An e-mobility provider exception within the given roaming network.
        /// </summary>
        /// <param name="RoamingNetwork">The roaming network.</param>
        /// <param name="Message">An exception message.</param>
        public GridOperatorException(RoamingNetwork RoamingNetwork,
                                     String Message)

            : base(RoamingNetwork,
                   Message)

        {
        }
Ejemplo n.º 11
0
        /// <summary>
        /// An exception thrown whenever a e-mobility provider already exists within the given roaming network.
        /// </summary>
        /// <param name="RoamingNetwork">The roaming network.</param>
        /// <param name="GridOperatorId">The e-mobility provider identification.</param>
        public GridOperatorAlreadyExists(RoamingNetwork RoamingNetwork,
                                         GridOperator_Id GridOperatorId)

            : base(RoamingNetwork,
                   "The given e-mobility provider identification '" + GridOperatorId + "' already exists within the given '" + RoamingNetwork.Id + "' roaming network!")

        {
        }
Ejemplo n.º 12
0
        /// <summary>
        /// An exception thrown whenever a parking operator already exists within the given roaming network.
        /// </summary>
        /// <param name="RoamingNetwork">The roaming network.</param>
        /// <param name="ParkingOperatorId">The parking operator identification.</param>
        public ParkingOperatorAlreadyExists(RoamingNetwork RoamingNetwork,
                                            ParkingOperator_Id ParkingOperatorId)

            : base(RoamingNetwork,
                   "The given parking operator identification '" + ParkingOperatorId + "' already exists within the given '" + RoamingNetwork.Id + "' roaming network!")

        {
        }
Ejemplo n.º 13
0
        /// <summary>
        /// An e-mobility provider exception within the given roaming network.
        /// </summary>
        /// <param name="RoamingNetwork">The roaming network.</param>
        /// <param name="Message">An exception message.</param>
        public NavigationProviderException(RoamingNetwork RoamingNetwork,
                                           String Message)

            : base(RoamingNetwork,
                   Message)

        {
        }
Ejemplo n.º 14
0
        /// <summary>
        /// An exception thrown whenever a smart city already exists within the given roaming network.
        /// </summary>
        /// <param name="RoamingNetwork">The roaming network.</param>
        /// <param name="SmartCityId">The smart city identification.</param>
        public SmartCityAlreadyExists(RoamingNetwork RoamingNetwork,
                                      SmartCity_Id SmartCityId)

            : base(RoamingNetwork,
                   "The given smart city identification '" + SmartCityId + "' already exists within the given '" + RoamingNetwork.Id + "' roaming network!")

        {
        }
Ejemplo n.º 15
0
        public EMPRoamingProviderAlreadyExists(RoamingNetwork RoamingNetwork,
                                               EMPRoamingProvider_Id RoamingProviderId)

            : base(RoamingNetwork,
                   "The given e-mobility roaming provider identification '" + RoamingProviderId + "' already exists within the given '" + RoamingNetwork.Id + "' roaming network!")

        {
        }
Ejemplo n.º 16
0
        /// <summary>
        /// An smart city exception within the given roaming network.
        /// </summary>
        /// <param name="RoamingNetwork">The roaming network.</param>
        /// <param name="Message">An exception message.</param>
        public SmartCityException(RoamingNetwork RoamingNetwork,
                                  String Message)

            : base(RoamingNetwork,
                   Message)

        {
        }
Ejemplo n.º 17
0
        public CSORoamingProviderAlreadyExists(RoamingNetwork RoamingNetwork,
                                               CSORoamingProvider_Id RoamingProviderId)

            : base(RoamingNetwork,
                   "The given charging station roaming provider identification '" + RoamingProviderId + "' already exists within the given '" + RoamingNetwork.Id + "' roaming network!")

        {
        }
        /// <summary>
        /// An exception thrown whenever a charging station operator already exists within the given roaming network.
        /// </summary>
        /// <param name="RoamingNetwork">The roaming network.</param>
        /// <param name="ChargingStationOperatorId">The charging station operator identification.</param>
        /// <param name="Name">The multi-language name of the charging station operator.</param>
        public ChargingStationOperatorAlreadyExists(RoamingNetwork RoamingNetwork,
                                                    ChargingStationOperator_Id ChargingStationOperatorId,
                                                    I18NString Name)

            : base(RoamingNetwork,
                   "The given charging station operator identification '" + ChargingStationOperatorId + "' with name '" + Name?.FirstText() + "' already exists within the given '" + RoamingNetwork.Id + "' roaming network!")

        {
        }
Ejemplo n.º 19
0
        /// <summary>
        /// An e-mobility provider exception within the given roaming network.
        /// </summary>
        /// <param name="RoamingNetwork">The roaming network.</param>
        /// <param name="Message">An exception message.</param>
        /// <param name="InnerException">An inner exception.</param>
        public GridOperatorException(RoamingNetwork RoamingNetwork,
                                     String Message,
                                     Exception InnerException)

            : base(RoamingNetwork,
                   Message,
                   InnerException)

        {
        }
Ejemplo n.º 20
0
        public OCPICSOAdapter(CSORoamingProvider_Id Id,
                              I18NString Name,
                              RoamingNetwork RoamingNetwork)

            : base(Id,
                   Name,
                   RoamingNetwork)

        {
        }
Ejemplo n.º 21
0
        public OCPIEMPAdapter(EMPRoamingProvider_Id Id,
                              I18NString Name,
                              RoamingNetwork RoamingNetwork)

            : base(Id,
                   Name,
                   RoamingNetwork)

        {
        }
Ejemplo n.º 22
0
        /// <summary>
        /// An smart city exception within the given roaming network.
        /// </summary>
        /// <param name="RoamingNetwork">The roaming network.</param>
        /// <param name="Message">An exception message.</param>
        /// <param name="InnerException">An inner exception.</param>
        public SmartCityException(RoamingNetwork RoamingNetwork,
                                  String Message,
                                  Exception InnerException)

            : base(RoamingNetwork,
                   Message,
                   InnerException)

        {
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Create a parking reservation.
        /// </summary>
        public ParkingReservation(ParkingReservation_Id ReservationId,
                                  DateTime Timestamp,
                                  DateTime StartTime,
                                  TimeSpan Duration,
                                  DateTime EndTime,
                                  TimeSpan ConsumedReservationTime,
                                  ParkingReservationLevel ReservationLevel,

                                  eMobilityProvider_Id?ProviderId = null,
                                  eMobilityAccount_Id?eMAId       = null,

                                  RoamingNetwork RoamingNetwork       = null,
                                  ChargingPool_Id?ParkingPoolId       = null,
                                  ChargingStation_Id?ParkingStationId = null,
                                  EVSE_Id?EVSEId = null,
                                  ParkingProduct_Id?ParkingProductId = null,

                                  IEnumerable <Auth_Token> AuthTokens      = null,
                                  IEnumerable <eMobilityAccount_Id> eMAIds = null,
                                  IEnumerable <UInt32> PINs = null)

        {
            #region Initial checks

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

            #endregion

            this._ReservationId           = ReservationId;
            this._Timestamp               = Timestamp.ToUniversalTime();
            this._StartTime               = StartTime.ToUniversalTime();
            this._Duration                = Duration;
            this._EndTime                 = StartTime.ToUniversalTime() + Duration;
            this._ConsumedReservationTime = ConsumedReservationTime;
            this._ReservationLevel        = ReservationLevel;

            this.ProviderId = ProviderId;
            this.eMAId      = eMAId;

            this.RoamingNetwork   = RoamingNetwork;
            this.ParkingPoolId    = ParkingPoolId;
            this.ParkingStationId = ParkingStationId;
            this.EVSEId           = EVSEId;
            this.ParkingProductId = ParkingProductId;

            this._AuthTokens = AuthTokens != null ? new HashSet <Auth_Token>(AuthTokens) : new HashSet <Auth_Token>();
            this._eMAIds     = eMAIds != null ? new HashSet <eMobilityAccount_Id>    (eMAIds)     : new HashSet <eMobilityAccount_Id>();
            this._PINs       = PINs != null ? new HashSet <UInt32>    (PINs)       : new HashSet <UInt32>();
        }
Ejemplo n.º 24
0
        public void Test0()
        {
            var _rn = new RoamingNetwork(RoamingNetwork_Id.Parse("Test1"));
            var _op = _rn.CreateChargingStationOperator(ChargingStationOperator_Id.Parse("DE*822"));
            var _cp = _op.CreateChargingPool();

            _cp.StatusAggregationDelegate = report => {
                var max   = report.Max(v => v.Value);
                var max_n = report.Where(o => o.Value == max);
                return((ChargingPoolStatusTypes)max_n.OrderBy(o => o.Key).First().Key);
            };
            _cp.OnStatusChanged += async(ts, EventTrackingId, pool, os, ns) => { Console.WriteLine("New pool state: " + ns.Value); };

            var s1 = _cp.CreateChargingStation(ChargingStation_Id.Random(_op.Id));

            s1.StatusAggregationDelegate = report => {
                var max   = report.Max(v => v.Value);
                var max_n = report.Where(o => o.Value == max);
                return((ChargingStationStatusTypes)max_n.OrderBy(o => o.Key).First().Key);
            };
            s1.OnStatusChanged += async(ts, EventTrackingId, sta, os, ns) => { Console.WriteLine("New station #1 state: " + ns.Value); };

            var e1 = s1.CreateEVSE(EVSE_Id.Parse("DE*822*E1111*1"));
            var e2 = s1.CreateEVSE(EVSE_Id.Parse("DE*822*E1111*2"));
            var e3 = s1.CreateEVSE(EVSE_Id.Parse("DE*822*E1111*3"));
            var s2 = _cp.CreateChargingStation(ChargingStation_Id.Random(_op.Id));

            s2.StatusAggregationDelegate = report => {
                var max   = report.Max(v => v.Value);
                var max_n = report.Where(o => o.Value == max);
                return((ChargingStationStatusTypes)max_n.OrderBy(o => o.Key).First().Key);
            };
            s2.OnStatusChanged += async(ts, EventTrackingId, sta, os, ns) => { Console.WriteLine("New station #2 state: " + ns.Value); };

            var f1 = s2.CreateEVSE(EVSE_Id.Parse("DE*822*E2222*1"));
            var f2 = s2.CreateEVSE(EVSE_Id.Parse("DE*822*E2222*2"));
            var f3 = s2.CreateEVSE(EVSE_Id.Parse("DE*822*E2222*3"));


            e1.Status = EVSEStatusTypes.Available;
            e2.Status = EVSEStatusTypes.Available;
            e3.Status = EVSEStatusTypes.Available;

            f1.Status = EVSEStatusTypes.Available;
            f2.Status = EVSEStatusTypes.Available;
            f3.Status = EVSEStatusTypes.Available;

            e2.Status = EVSEStatusTypes.Charging;
            e3.Status = EVSEStatusTypes.Charging;
        }
Ejemplo n.º 25
0
        ///// <summary>
        ///// An event fired whenever new EVSE data will be send upstream.
        ///// </summary>
        //public event OnPushEVSEDataRequestDelegate OnPushEVSEDataRequest;

        ///// <summary>
        ///// An event fired whenever new EVSE data had been sent upstream.
        ///// </summary>
        //public event OnPushEVSEDataResponseDelegate OnPushEVSEDataResponse;

        #endregion

        #region OnEVSEStatusPush/-Pushed

        ///// <summary>
        ///// An event fired whenever new EVSE status will be send upstream.
        ///// </summary>
        //public event OnPushEVSEStatusRequestDelegate OnPushEVSEStatusRequest;

        ///// <summary>
        ///// An event fired whenever new EVSE status had been sent upstream.
        ///// </summary>
        //public event OnPushEVSEStatusResponseDelegate OnPushEVSEStatusResponse;

        #endregion

        #endregion

        #region Constructor(s)

        /// <summary>
        /// Create a new e-mobility (service) provider having the given
        /// unique identification.
        /// </summary>
        /// <param name="Id">The unique e-mobility provider identification.</param>
        /// <param name="RoamingNetwork">The associated roaming network.</param>
        internal NavigationProvider(NavigationProvider_Id Id,
                                    RoamingNetwork RoamingNetwork,
                                    Action <NavigationProvider> Configurator = null,
                                    RemoteNavigationProviderCreatorDelegate RemoteNavigationProviderCreator = null,
                                    I18NString Name        = null,
                                    I18NString Description = null,
                                    NavigationProviderPriority Priority           = null,
                                    NavigationProviderAdminStatusType AdminStatus = NavigationProviderAdminStatusType.Available,
                                    NavigationProviderStatusType Status           = NavigationProviderStatusType.Available,
                                    UInt16 MaxAdminStatusListSize = DefaultMaxAdminStatusListSize,
                                    UInt16 MaxStatusListSize      = DefaultMaxStatusListSize)

            : base(Id)

        {
            #region Initial checks

            if (RoamingNetwork == null)
            {
                throw new ArgumentNullException(nameof(NavigationProvider), "The roaming network must not be null!");
            }

            #endregion

            #region Init data and properties

            this.RoamingNetwork = RoamingNetwork;

            this._Name         = Name ?? new I18NString();
            this._Description  = Description ?? new I18NString();
            this._DataLicenses = new List <DataLicense>();

            this.Priority = Priority ?? new NavigationProviderPriority(0);

            this._AdminStatusSchedule = new StatusSchedule <NavigationProviderAdminStatusType>();
            this._AdminStatusSchedule.Insert(AdminStatus);

            this._StatusSchedule = new StatusSchedule <NavigationProviderStatusType>();
            this._StatusSchedule.Insert(Status);

            #endregion

            Configurator?.Invoke(this);

            this.RemoteNavigationProvider = RemoteNavigationProviderCreator?.Invoke(this);
        }
Ejemplo n.º 26
0
        public Tracker RemoveRoamingNetwork(RoamingNetwork RoamingNetwork)
        {
            #region Initial checks

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

            #endregion

            //RoamingNetwork _RoamingNetwork = null;

            //if (!_LocalRoamingNetworks.TryRemove(RoamingNetwork.Id, out _RoamingNetwork))
            //    throw new ArgumentException("The given roaming network could not be removed!");

            return(this);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Create a charging reservation.
        /// </summary>
        public ChargingReservation(DateTime Timestamp,
                                   DateTime StartTime,
                                   TimeSpan Duration,
                                   DateTime EndTime,
                                   ChargingReservationLevel ReservationLevel,

                                   EVSP_Id ProviderId = null,
                                   eMA_Id eMAId       = null,

                                   RoamingNetwork RoamingNetwork        = null,
                                   ChargingPool_Id ChargingPoolId       = null,
                                   ChargingStation_Id ChargingStationId = null,
                                   EVSE_Id EVSEId = null,
                                   ChargingProduct_Id ChargingProductId = null,

                                   IEnumerable <Auth_Token> AuthTokens = null,
                                   IEnumerable <eMA_Id> eMAIds         = null,
                                   IEnumerable <UInt32> PINs           = null)

            : this(ChargingReservation_Id.New,
                   Timestamp,
                   StartTime,
                   Duration,
                   EndTime,
                   TimeSpan.FromSeconds(0),
                   ReservationLevel,

                   ProviderId,
                   eMAId,

                   RoamingNetwork,
                   ChargingPoolId,
                   ChargingStationId,
                   EVSEId,
                   ChargingProductId,

                   AuthTokens,
                   eMAIds,
                   PINs)

        {
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Create a new Electric Vehicle Service Provider (EVSP)
        /// having the given EVSProvider_Id.
        /// </summary>
        /// <param name="Id">The ChargingPool Id.</param>
        /// <param name="RoamingNetwork">The associated roaming network.</param>
        internal EVSP(EVSP_Id Id,
                      RoamingNetwork RoamingNetwork)

            : base(Id)

        {
            #region Initial Checks

            if (RoamingNetwork == null)
            {
                throw new ArgumentNullException("RoamingNetwork", "The given roaming network must not be null!");
            }

            #endregion

            this._RoamingNetwork = RoamingNetwork;

            this.Name        = new I18NString();
            this.Description = new I18NString();
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Create a new e-Mobility Roaming Provider (EMRP)
        /// having the given unique roaming provider identification and name.
        /// </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 name="RoamingNetwork">The associated roaming network.</param>
        /// <param name="OperatorRoamingService">The attached local or remote EVSE operator roaming service.</param>
        /// <param name="eMobilityRoamingService">The attached local or remote e-mobility roaming service.</param>
        internal ARoamingProvider(RoamingProvider_Id Id,
                                  I18NString Name,
                                  RoamingNetwork RoamingNetwork)

            : base(Id)

        {
            #region Initial Checks

            if (Name.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(Name), "The given roaming network must not be null!");
            }

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

            #endregion

            this._Name           = Name;
            this._RoamingNetwork = RoamingNetwork;
        }
Ejemplo n.º 30
0
 public Task <PushEVSEDataResult> UpdateStaticData(RoamingNetwork RoamingNetwork, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 31
0
        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);
        }
Ejemplo n.º 32
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);
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Initialize the OCPI HTTP server using IPAddress.Any, http port 8080 and maybe start the server.
        /// </summary>
        internal GenericAPI(RoamingNetwork        RoamingNetwork,
                            HTTPServer            HTTPServer,
                            String                URIPrefix               = "/ext/OCPI",
                            Func<String, Stream>  GetRessources           = null,

                            String                ServiceName             = DefaultHTTPServerName,
                            EMailAddress          APIEMailAddress         = null,
                            PgpPublicKeyRing      APIPublicKeyRing        = null,
                            PgpSecretKeyRing      APISecretKeyRing        = null,
                            String                APIPassphrase           = null,
                            EMailAddressList      APIAdminEMail           = null,
                            SMTPClient            APISMTPClient           = null,

                            String                LogfileName             = DefaultLogfileName)
        {
            #region Initial checks

            if (RoamingNetwork == null)
                throw new ArgumentNullException("RoamingNetwork", "The given parameter must not be null!");

            if (HTTPServer == null)
                throw new ArgumentNullException("HTTPServer", "The given parameter must not be null!");

            if (URIPrefix.IsNullOrEmpty())
                throw new ArgumentNullException("URIPrefix", "The given parameter must not be null or empty!");

            if (!URIPrefix.StartsWith("/"))
                URIPrefix = "/" + URIPrefix;

            #endregion

            #region Init data

            this._HTTPServer              = HTTPServer;
            this._GetRessources           = GetRessources;
            this._URIPrefix               = URIPrefix;

            this._ServiceName             = ServiceName;
            this._APIEMailAddress         = APIEMailAddress;
            this._APIPublicKeyRing        = APIPublicKeyRing;
            this._APISecretKeyRing        = APISecretKeyRing;
            this._APIPassphrase           = APIPassphrase;
            this._APIAdminEMail           = APIAdminEMail;
            this._APISMTPClient           = APISMTPClient;

            this._DNSClient               = HTTPServer.DNSClient;

            #endregion

            RegisterURITemplates();
        }