public eMobilityStationCouldNotBeCreated(eMobilityProvider eMobilityProvider,
                                                 eMobilityStation_Id eMobilityStation_Id)

            : base(eMobilityProvider.RoamingNetwork,
                   "The given e-mobility station identification '" + eMobilityStation_Id + "' already exists at the given '" + eMobilityProvider.Id + "' e-mobility provider!")

        {
        }
        public eMobilityStationException(eMobilityProvider eMobilityProvider,
                                         String Message)

            : base(eMobilityProvider.RoamingNetwork,
                   Message)

        {
        }
Exemplo n.º 3
0
        /// <summary>
        /// An exception thrown whenever an electric vehicle already exists within the given e-mobility provider.
        /// </summary>
        /// <param name="eMobilityProvider">The e-mobility provider.</param>
        /// <param name="eVehicleId">The electric vehicle identification.</param>
        public eVehicleAlreadyExists(eMobilityProvider eMobilityProvider,
                                     eVehicle_Id eVehicleId)

            : base(eMobilityProvider.RoamingNetwork,
                   "The given electric vehicle identification '" + eVehicleId + "' already exists within the given '" + eMobilityProvider.Id + "' e-mobility provider!")

        {
        }
        public eMobilityStationAlreadyExists(eMobilityProvider eMobilityProvider,
                                             eMobilityStation_Id eMobilityStationId)

            : base(eMobilityProvider.RoamingNetwork,
                   "The given e-mobility station identification '" + eMobilityStationId + "' already exists within the given '" + eMobilityProvider.Id + "' e-mobility provider!")

        {
        }
Exemplo n.º 5
0
        /// <summary>
        /// An electric vehicle exception within the given e-mobility provider.
        /// </summary>
        /// <param name="eMobilityProvider">The e-mobility provider.</param>
        /// <param name="Message">An exception message.</param>
        /// <param name="InnerException">An inner exception.</param>
        public eVehicleException(eMobilityProvider eMobilityProvider,
                                 String Message,
                                 Exception InnerException)

            : base(eMobilityProvider.RoamingNetwork,
                   Message,
                   InnerException)

        {
        }
Exemplo n.º 6
0
        /// <summary>
        /// Create a new e-mobility station having the given identification.
        /// </summary>
        /// <param name="Id">The unique identification of the e-mobility station pool.</param>
        /// <param name="MaxAdminStatusListSize">The default size of the admin status list.</param>
        internal eMobilityStation(eMobilityStation_Id Id,
                                  eMobilityProvider Provider,
                                  Action <eMobilityStation> Configurator = null,
                                  RemoteEMobilityStationCreatorDelegate RemoteeMobilityStationCreator = null,
                                  eMobilityStationAdminStatusType AdminStatus = eMobilityStationAdminStatusType.Operational,
                                  UInt16 MaxAdminStatusListSize = DefaultMaxAdminStatusListSize)

            : base(Id)

        {
            #region Initial checks

            if (Provider == null)
            {
                throw new ArgumentNullException(nameof(Provider), "The e-mobility provider must not be null!");
            }

            #endregion

            #region Init data and properties

            this.Provider = Provider;

            this.Name        = new I18NString();
            this.Description = new I18NString();

            this._UserComment            = new I18NString();
            this._ServiceProviderComment = new I18NString();
            //this.GeoLocation                 = new GeoCoordinate();

            this._ParkingSpaces = new List <ParkingSpace>();

            this._PaymentOptions = new ReactiveSet <PaymentOptions>();

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

            #endregion

            #region Init events


            #endregion

            #region Link events

            this._AdminStatusSchedule.OnStatusChanged += (Timestamp, EventTrackingId, StatusSchedule, OldStatus, NewStatus)
                                                         => UpdateAdminStatus(Timestamp, EventTrackingId, OldStatus, NewStatus);

            //// eMobilityStation events
            //this.OnEVSEAddition.           OnVoting       += (timestamp, station, evse, vote)      => ChargingPool.EVSEAddition.           SendVoting      (timestamp, station, evse, vote);
            //this.OnEVSEAddition.           OnNotification += (timestamp, station, evse)            => ChargingPool.EVSEAddition.           SendNotification(timestamp, station, evse);

            //this.OnEVSERemoval.            OnVoting       += (timestamp, station, evse, vote)      => ChargingPool.EVSERemoval .           SendVoting      (timestamp, station, evse, vote);
            //this.OnEVSERemoval.            OnNotification += (timestamp, station, evse)            => ChargingPool.EVSERemoval .           SendNotification(timestamp, station, evse);

            //// EVSE events
            //this.SocketOutletAddition.     OnVoting       += (timestamp, evse, outlet, vote)       => ChargingPool.SocketOutletAddition.   SendVoting      (timestamp, evse, outlet, vote);
            //this.SocketOutletAddition.     OnNotification += (timestamp, evse, outlet)             => ChargingPool.SocketOutletAddition.   SendNotification(timestamp, evse, outlet);

            //this.SocketOutletRemoval.      OnVoting       += (timestamp, evse, outlet, vote)       => ChargingPool.SocketOutletRemoval.    SendVoting      (timestamp, evse, outlet, vote);
            //this.SocketOutletRemoval.      OnNotification += (timestamp, evse, outlet)             => ChargingPool.SocketOutletRemoval.    SendNotification(timestamp, evse, outlet);

            #endregion

            this.OnPropertyChanged += UpdateData;

            Configurator?.Invoke(this);

            this.RemoteeMobilityStation = RemoteeMobilityStationCreator?.Invoke(this);
        }
Exemplo n.º 7
0
        CreateOICPv2_2_CPORoamingProvider(this RoamingNetwork RoamingNetwork,
                                          CSORoamingProvider_Id Id,
                                          I18NString Name,
                                          OICPv2_2.EMP.EMPRoaming EMPRoaming,

                                          OICPv2_2.EMP.EVSEDataRecord2EVSEDelegate EVSEDataRecord2EVSE = null,

                                          OICPv2_2.EVSEOperatorFilterDelegate EVSEOperatorFilter = null,

                                          TimeSpan?PullDataServiceEvery          = null,
                                          Boolean DisablePullData                = false,
                                          TimeSpan?PullDataServiceRequestTimeout = null,

                                          TimeSpan?PullStatusServiceEvery          = null,
                                          Boolean DisablePullStatus                = false,
                                          TimeSpan?PullStatusServiceRequestTimeout = null,

                                          eMobilityProvider DefaultProvider = null,
                                          GeoCoordinate?DefaultSearchCenter = null,
                                          UInt64?DefaultDistanceKM          = null,

                                          Action <OICPv2_2.EMP.WWCPCSOAdapter> OICPConfigurator = null,
                                          Action <ICSORoamingProvider> Configurator             = 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 (EMPRoaming == null)
            {
                throw new ArgumentNullException(nameof(EMPRoaming), "The given EMP Roaming must not be null!");
            }

            #endregion

            var NewRoamingProvider = new OICPv2_2.EMP.WWCPCSOAdapter(Id,
                                                                     Name,
                                                                     RoamingNetwork,
                                                                     EMPRoaming,

                                                                     EVSEDataRecord2EVSE,

                                                                     EVSEOperatorFilter,

                                                                     PullDataServiceEvery,
                                                                     DisablePullData,
                                                                     PullDataServiceRequestTimeout,

                                                                     PullStatusServiceEvery,
                                                                     DisablePullStatus,
                                                                     PullStatusServiceRequestTimeout,

                                                                     DefaultProvider,
                                                                     null,
                                                                     DefaultSearchCenter,
                                                                     DefaultDistanceKM);


            OICPConfigurator?.Invoke(NewRoamingProvider);

            return(RoamingNetwork.
                   CreateNewRoamingProvider(NewRoamingProvider,
                                            Configurator) as OICPv2_2.EMP.WWCPCSOAdapter);
        }
Exemplo n.º 8
0
        CreateOICPv2_3_CPORoamingProvider(this RoamingNetwork RoamingNetwork,
                                          CSORoamingProvider_Id Id,
                                          I18NString Name,
                                          OICPv2_3.EMP.EMPRoaming EMPRoaming,

                                          OICPv2_3.EMP.EVSEDataRecord2EVSEDelegate EVSEDataRecord2EVSE = null,

                                          Boolean PullEVSEData_IsDisabled      = false,
                                          TimeSpan?PullEVSEData_InitialDelay   = null,
                                          TimeSpan?PullEVSEData_Every          = null,
                                          UInt32?PullEVSEData_RequestPageSize  = null,
                                          TimeSpan?PullEVSEData_RequestTimeout = null,

                                          IEnumerable <OICPv2_3.Operator_Id> PullEVSEData_OperatorIdFilter                 = null,
                                          IEnumerable <Country> PullEVSEData_CountryCodeFilter                             = null,
                                          IEnumerable <OICPv2_3.AccessibilityTypes> PullEVSEData_AccessibilityFilter       = null,
                                          IEnumerable <OICPv2_3.AuthenticationModes> PullEVSEData_AuthenticationModeFilter = null,
                                          IEnumerable <OICPv2_3.CalibrationLawDataAvailabilities> PullEVSEData_CalibrationLawDataAvailabilityFilter = null,
                                          Boolean?PullEVSEData_RenewableEnergyFilter     = null,
                                          Boolean?PullEVSEData_IsHubjectCompatibleFilter = null,
                                          Boolean?PullEVSEData_IsOpen24HoursFilter       = null,

                                          Boolean PullEVSEStatus_IsDisabled      = false,
                                          TimeSpan?PullEVSEStatus_InitialDelay   = null,
                                          TimeSpan?PullEVSEStatus_Every          = null,
                                          TimeSpan?PullEVSEStatus_RequestTimeout = null,

                                          Boolean GetChargeDetailRecords_IsDisabled      = false,
                                          TimeSpan?GetChargeDetailRecords_InitialDelay   = null,
                                          TimeSpan?GetChargeDetailRecords_Every          = null,
                                          TimeSpan?GetChargeDetailRecords_RequestTimeout = null,

                                          eMobilityProvider DefaultProvider      = null,
                                          eMobilityProvider_Id?DefaultProviderId = null,
                                          GeoCoordinate?DefaultSearchCenter      = null,
                                          UInt64?DefaultDistanceKM = null,

                                          Action <OICPv2_3.EMP.WWCPCSOAdapter> OICPConfigurator = null,
                                          Action <ICSORoamingProvider> Configurator             = null)

        {
            #region Initial checks

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

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

            if (EMPRoaming is null)
            {
                throw new ArgumentNullException(nameof(EMPRoaming), "The given EMP Roaming must not be null!");
            }

            #endregion

            var newRoamingProvider = new OICPv2_3.EMP.WWCPCSOAdapter(Id,
                                                                     Name,
                                                                     RoamingNetwork,
                                                                     EMPRoaming,

                                                                     EVSEDataRecord2EVSE,

                                                                     PullEVSEData_IsDisabled,
                                                                     PullEVSEData_InitialDelay,
                                                                     PullEVSEData_Every,
                                                                     PullEVSEData_RequestPageSize,
                                                                     PullEVSEData_RequestTimeout,

                                                                     PullEVSEData_OperatorIdFilter,
                                                                     PullEVSEData_CountryCodeFilter,
                                                                     PullEVSEData_AccessibilityFilter,
                                                                     PullEVSEData_AuthenticationModeFilter,
                                                                     PullEVSEData_CalibrationLawDataAvailabilityFilter,
                                                                     PullEVSEData_RenewableEnergyFilter,
                                                                     PullEVSEData_IsHubjectCompatibleFilter,
                                                                     PullEVSEData_IsOpen24HoursFilter,

                                                                     PullEVSEStatus_IsDisabled,
                                                                     PullEVSEStatus_InitialDelay,
                                                                     PullEVSEStatus_Every,
                                                                     PullEVSEStatus_RequestTimeout,

                                                                     GetChargeDetailRecords_IsDisabled,
                                                                     GetChargeDetailRecords_InitialDelay,
                                                                     GetChargeDetailRecords_Every,
                                                                     GetChargeDetailRecords_RequestTimeout,

                                                                     DefaultProvider,
                                                                     DefaultProviderId,
                                                                     DefaultSearchCenter,
                                                                     DefaultDistanceKM);


            OICPConfigurator?.Invoke(newRoamingProvider);

            return(RoamingNetwork.
                   CreateNewRoamingProvider(newRoamingProvider,
                                            Configurator) as OICPv2_3.EMP.WWCPCSOAdapter);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Return a JSON representation for the given e-mobility provider.
        /// </summary>
        /// <param name="eMobilityProvider">An e-mobility provider.</param>
        /// <param name="Embedded">Whether this data is embedded into another data structure, e.g. into a roaming network.</param>
        public static JObject ToJSON(this eMobilityProvider eMobilityProvider,
                                     Boolean Embedded = false,
                                     InfoStatus ExpandRoamingNetworkId = InfoStatus.ShowIdOnly,
                                     InfoStatus ExpandBrandIds         = InfoStatus.ShowIdOnly,
                                     InfoStatus ExpandDataLicenses     = InfoStatus.ShowIdOnly)


        => eMobilityProvider == null

                   ? null

                   : JSONObject.Create(

            new JProperty("@id", eMobilityProvider.Id.ToString()),

            Embedded
                             ? new JProperty("@context", "https://open.charging.cloud/contexts/wwcp+json/eMobilityProvider")
                             : null,

            new JProperty("name", eMobilityProvider.Name.ToJSON()),

            eMobilityProvider.Description.IsNeitherNullNorEmpty()
                             ? eMobilityProvider.Description.ToJSON("description")
                             : null,

            eMobilityProvider.DataSource.ToJSON("DataSource"),

            ExpandDataLicenses.Switch(
                () => new JProperty("dataLicenseIds", new JArray(eMobilityProvider.DataLicenses.SafeSelect(license => license.Id.ToString()))),
                () => new JProperty("dataLicenses", eMobilityProvider.DataLicenses.ToJSON())),

            #region Embedded means it is served as a substructure of e.g. a charging station operator

            Embedded
                             ? null
                             : ExpandRoamingNetworkId.Switch(
                () => new JProperty("roamingNetworkId", eMobilityProvider.RoamingNetwork.Id.ToString()),
                () => new JProperty("roamingNetwork", eMobilityProvider.RoamingNetwork.ToJSON(Embedded:                   true,
                                                                                              ExpandEMobilityProviderId:  InfoStatus.Hidden,
                                                                                              ExpandChargingPoolIds:      InfoStatus.Hidden,
                                                                                              ExpandChargingStationIds:   InfoStatus.Hidden,
                                                                                              ExpandEVSEIds:              InfoStatus.Hidden,
                                                                                              ExpandBrandIds:             InfoStatus.Hidden,
                                                                                              ExpandDataLicenses:         InfoStatus.Hidden))),

            #endregion

            eMobilityProvider.Address != null
                             ? eMobilityProvider.Address.ToJSON("address")
                             : null,

            // LogoURI
            // API
            // MainKeys
            // RobotKeys
            // Endpoints
            // DNS SRV

            eMobilityProvider.Logo.IsNotNullOrEmpty()
                             ? new JProperty("logos", JSONArray.Create(
                                                 JSONObject.Create(
                                                     new JProperty("uri", eMobilityProvider.Logo),
                                                     new JProperty("description", I18NString.Empty.ToJSON())
                                                     )
                                                 ))
                             : null,

            eMobilityProvider.Homepage.IsNotNullOrEmpty()
                             ? new JProperty("homepage", eMobilityProvider.Homepage)
                             : null,

            eMobilityProvider.HotlinePhoneNumber.IsNotNullOrEmpty()
                             ? new JProperty("hotline", eMobilityProvider.HotlinePhoneNumber)
                             : null,

            eMobilityProvider.DataLicenses.Any()
                             ? new JProperty("dataLicenses", new JArray(eMobilityProvider.DataLicenses.Select(license => license.ToJSON())))
                             : null

            );
Exemplo n.º 10
0
        /// <summary>
        /// Create a new e-vehicle having the given identification.
        /// </summary>
        /// <param name="Id">The unique identification of the e-vehicle pool.</param>
        /// <param name="MaxAdminStatusListSize">The default size of the admin status list.</param>
        internal eVehicle(eVehicle_Id Id,
                          eMobilityProvider Provider,
                          Action <eVehicle> Configurator = null,
                          RemoteEVehicleCreatorDelegate RemoteEVehicleCreator = null,
                          eVehicleAdminStatusType AdminStatus = eVehicleAdminStatusType.Operational,
                          eVehicleStatusType Status           = eVehicleStatusType.Available,
                          UInt16 MaxAdminStatusListSize       = DefaultMaxAdminStatusListSize,
                          UInt16 MaxStatusListSize            = DefaultMaxStatusListSize)

            : base(Id)

        {
            #region Initial checks

            if (Provider == null)
            {
                throw new ArgumentNullException(nameof(Provider), "The e-mobility provider must not be null!");
            }

            #endregion

            #region Init data and properties

            this.Provider = Provider;

            this.Description = new I18NString();

            this._UserComment            = new I18NString();
            this._ServiceProviderComment = new I18NString();
            this.GeoLocation             = null;

            this._PaymentOptions = new ReactiveSet <PaymentOptions>();

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

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

            #endregion

            #region Init events


            #endregion

            #region Link events

            this._AdminStatusSchedule.OnStatusChanged += (Timestamp, EventTrackingId, StatusSchedule, OldStatus, NewStatus)
                                                         => UpdateAdminStatus(Timestamp, EventTrackingId, OldStatus, NewStatus);

            this._StatusSchedule.OnStatusChanged += (Timestamp, EventTrackingId, StatusSchedule, OldStatus, NewStatus)
                                                    => UpdateStatus(Timestamp, EventTrackingId, OldStatus, NewStatus);

            #endregion

            this.OnPropertyChanged += UpdateData;

            Configurator?.Invoke(this);

            this.RemoteEVehicle = RemoteEVehicleCreator?.Invoke(this);
        }