Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Position"/> class.
 /// </summary>
 /// <param name="coords">Coordinates to encode.</param>
 /// <param name="table">The primary or secondary symbole table.</param>
 /// <param name="symbol">The APRS symbol code from the table given.</param>
 /// <param name="amb">Ambiguity to use on the coordinates.</param>
 public Position(GeoCoordinate?coords = null, char?table = null, char?symbol = null, int?amb = null)
 {
     Coordinates           = coords ?? Coordinates;
     SymbolTableIdentifier = table ?? SymbolTableIdentifier;
     SymbolCode            = symbol ?? SymbolCode;
     Ambiguity             = amb ?? Ambiguity;
 }
Exemple #2
0
        PullEVSEData(this IEMPClient IEMPClient,
                     Provider_Id?ProviderId     = null,
                     GeoCoordinate?SearchCenter = null,
                     Single DistanceKM          = 0f,
                     DateTime?LastCall          = null,
                     GeoCoordinatesResponseFormats?GeoCoordinatesResponseFormat = GeoCoordinatesResponseFormats.DecimalDegree,
                     IEnumerable <Operator_Id> OperatorIdFilter = null,
                     IEnumerable <Country> CountryCodeFilter    = null,

                     DateTime?Timestamp = null,
                     CancellationToken?CancellationToken = null,
                     EventTracking_Id EventTrackingId    = null,
                     TimeSpan?RequestTimeout             = null)


        => IEMPClient.PullEVSEData(new PullEVSEDataRequest(ProviderId ?? IEMPClient.DefaultProviderId.Value,
                                                           SearchCenter,
                                                           DistanceKM,
                                                           LastCall,
                                                           GeoCoordinatesResponseFormat,
                                                           OperatorIdFilter,
                                                           CountryCodeFilter,

                                                           Timestamp,
                                                           CancellationToken,
                                                           EventTrackingId,
                                                           RequestTimeout ?? IEMPClient.RequestTimeout));
Exemple #3
0
        public void AddOrUpdateCPInfo(WWCP.ChargingPool_Id ChargingPoolId,
                                      Address Address,
                                      GeoCoordinate?PoolLocation,
                                      String ChargingStationXMLId,
                                      EVSE_Id EVSEId)
        {
            ChargingPoolInfo _ChargingPoolInfo = null;

            // Existing charging pool...
            if (_ChargingPools.TryGetValue(ChargingPoolId, out _ChargingPoolInfo))
            {
                _ChargingPoolInfo.AddOrUpdateCSInfo(ChargingStationXMLId, EVSEId);
            }

            // ...or a new one!
            else
            {
                _ChargingPoolInfo = new ChargingPoolInfo(this, ChargingPoolId, Address, PoolLocation);
                _ChargingPoolInfo.AddOrUpdateCSInfo(ChargingStationXMLId.IsNotNullOrEmpty()
                                                        ? ChargingStationXMLId
                                                        : WWCP.ChargingStation_Id.Create(EVSEId.ToWWCP().Value).ToString(),
                                                    EVSEId);

                _ChargingPools.Add(_ChargingPoolInfo.PoolId, _ChargingPoolInfo);
            }
        }
Exemple #4
0
    internal static void AppendTo(StringBuilder builder, GeoCoordinate?coordinate, VCdVersion version)
    {
        Debug.Assert(builder != null);

        if (coordinate is null)
        {
            return;
        }

        CultureInfo culture = CultureInfo.InvariantCulture;

        string latitude  = coordinate.Latitude.ToString("F6", culture);
        string longitude = coordinate.Longitude.ToString("F6", culture);

        switch (version)
        {
        case VCdVersion.V2_1:
        case VCdVersion.V3_0:
            _ = builder.Append(latitude).Append(';').Append(longitude);
            break;

        default:
            _ = builder.Append("geo:").Append(latitude).Append(',').Append(longitude);
            break;
        }//switch
    }
Exemple #5
0
        /// <summary>
        /// Create a valid charging pool identification based on the given parameters.
        /// </summary>
        /// <param name="OperatorId">The identification of an Charging Station Operator.</param>
        /// <param name="Address">The address of the charging pool.</param>
        /// <param name="GeoLocation">The geo location of the charging pool.</param>
        /// <param name="Length">The maximum size of the generated charging pool identification suffix [12 &lt; n &lt; 50].</param>
        /// <param name="Mapper">A delegate to modify a generated charging pool identification suffix.</param>
        public static ChargingPool_Id Generate(Operator_Id OperatorId,
                                               Address Address,
                                               GeoCoordinate?GeoLocation = null,
                                               String HelperId           = "",
                                               Byte Length = 15,
                                               Func <String, String> Mapper = null)
        {
            if (Length < 12)
            {
                Length = 12;
            }

            if (Length > 50)
            {
                Length = 50;
            }

            var Suffíx = new SHA1CryptoServiceProvider().
                         ComputeHash(Encoding.UTF8.GetBytes(
                                         String.Concat(
                                             OperatorId.ToString(),
                                             Address.ToString(),
                                             GeoLocation?.ToString() ?? "",
                                             HelperId ?? ""
                                             )
                                         )).
                         ToHexString().
                         SubstringMax(Length).
                         ToUpper();

            return(Parse(OperatorId,
                         Mapper != null
                            ? Mapper(Suffíx)
                            : Suffíx));
        }
Exemple #6
0
        public async Task PtvApi_GetAddress_CountryInEnglish_ShouldReturnCorrectCoordinates()
        {
            PtvGeocoder   api     = new PtvGeocoder(_url, _user, _token);
            GeoCoordinate?address = await api.GeocodeAsync("Katwilgweg", "2", "2050", "Antwerpen", "", "Belgium");

            AssertCoordinates(address.GetValueOrDefault(), 4.359231, 51.219501);
        }
Exemple #7
0
        public async Task PtvApi_GetAddressByText_AllAccurateParameters_ISO3_ShouldReturnCorrectCoordinates(string street, string country, double x, double y)
        {
            PtvGeocoder   api     = new PtvGeocoder(_url, _user, _token);
            GeoCoordinate?address = await api.GeocodeAsync(street, country);

            AssertCoordinates(address.GetValueOrDefault(), x, y);
        }
Exemple #8
0
        public async Task PtvApi_GetAddressByText_ShouldReturnCorrectCoordinates(string address, string country, double x, double y)
        {
            PtvGeocoder   api    = new PtvGeocoder(_url, _user, _token);
            GeoCoordinate?result = await api.GeocodeAsync(address, country);

            AssertCoordinates(result.GetValueOrDefault(), x, y);
        }
 public ImporterForwardingInfo(Action <DateTime, ImporterForwardingInfo, RoamingNetwork_Id?, RoamingNetwork_Id?> OnChangedCallback,
                               IEnumerable <ChargingStationOperator> ChargingStationOperators,
                               ChargingStation_Id?StationId       = null,
                               String StationName                 = "",
                               String StationServiceTag           = "",
                               Address StationAddress             = null,
                               GeoCoordinate?StationGeoCoordinate = null,
                               IEnumerable <EVSE_Id> EVSEIds      = null,
                               String PhoneNumber                 = null,
                               Timestamped <ChargingStationAdminStatusTypes>?AdminStatus = null,
                               DateTime?Created     = null,
                               Boolean OutOfService = false,
                               ChargingStationOperator ForwardedToOperator = null)
 {
     this._OnForwardingChanged     = OnChangedCallback;
     this.ChargingStationOperators = ChargingStationOperators;
     this._EVSEIds             = EVSEIds != null ? new HashSet <EVSE_Id>(EVSEIds) : new HashSet <EVSE_Id>();
     this.StationId            = StationId.HasValue            ? StationId.Value               : ChargingStation_Id.Create(EVSEIds).Value;
     this.StationName          = StationName;
     this.StationServiceTag    = StationServiceTag;
     this.StationAddress       = StationAddress;
     this.StationGeoCoordinate = StationGeoCoordinate;
     this._AdminStatus         = AdminStatus != null ? AdminStatus.Value             : new Timestamped <ChargingStationAdminStatusTypes>(ChargingStationAdminStatusTypes.Operational);
     this.PhoneNumber          = PhoneNumber;
     this.Created      = Created != null ? Created.Value                 : DateTime.UtcNow;
     this.OutOfService = OutOfService;
     this.LastTimeSeen = this.Created;
     this._ForwardedToChargingStationOperator = ForwardedToOperator;
 }
        public ChargingPoolInfo(CPInfoList CPInfoList,
                                WWCP.ChargingPool_Id PoolId,
                                Address Address,
                                GeoCoordinate?GeoLocation)
        {
            #region Initial checks

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

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

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

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

            #endregion

            this.CPInfoList        = CPInfoList;
            this.PoolId            = PoolId;
            this.Address           = Address;
            this.GeoLocation       = GeoLocation;
            this._ChargingStations = new List <ChargeStationInfo>();
        }
        /// <summary>
        /// Create an OICP PullEVSEStatus XML/SOAP request.
        /// </summary>
        /// <param name="ProviderId">The unique identification of the EVSP.</param>
        /// <param name="SearchCenter">An optional geo coordinate of the search center.</param>
        /// <param name="DistanceKM">An optional search distance relative to the search center.</param>
        /// <param name="EVSEStatusFilter">An optional EVSE status as filter criteria.</param>
        ///
        /// <param name="Timestamp">The optional timestamp of the request.</param>
        /// <param name="CancellationToken">An optional token to cancel this request.</param>
        /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param>
        /// <param name="RequestTimeout">An optional timeout for this request.</param>
        public PullEVSEStatusRequest(Provider_Id ProviderId,
                                     GeoCoordinate?SearchCenter       = null,
                                     Single DistanceKM                = 0f,
                                     EVSEStatusTypes?EVSEStatusFilter = null,

                                     DateTime?Timestamp = null,
                                     CancellationToken?CancellationToken = null,
                                     EventTracking_Id EventTrackingId    = null,
                                     TimeSpan?RequestTimeout             = null)

            : base(Timestamp,
                   CancellationToken,
                   EventTrackingId,
                   RequestTimeout)

        {
            #region Initial checks

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

            #endregion

            this.ProviderId       = ProviderId;
            this.SearchCenter     = SearchCenter;
            this.DistanceKM       = DistanceKM;
            this.EVSEStatusFilter = EVSEStatusFilter;
        }
Exemple #12
0
        /// <summary>
        /// Create a new Open Data blog posting.
        /// </summary>
        /// <param name="Id">The unique identification of this blog posting.</param>
        /// <param name="Text">The (multi-language) text of this blog posting.</param>
        /// <param name="PublicationDate">The timestamp of the publication of this blog posting.</param>
        /// <param name="GeoLocation">An optional geographical location of this blog posting.</param>
        /// <param name="Tags">An enumeration of multi-language tags and their relevance.</param>
        /// <param name="PrivacyLevel">Whether the blog posting will be shown in blog posting listings, or not.</param>
        /// <param name="IsHidden">The blog posting is hidden.</param>
        /// <param name="Signatures">All signatures of this blog posting.</param>
        /// <param name="DataSource">The source of all this data, e.g. an automatic importer.</param>
        public BlogPosting(BlogPosting_Id Id,
                           I18NString Text,
                           DateTime?PublicationDate        = null,
                           GeoCoordinate?GeoLocation       = null,
                           IEnumerable <TagRelevance> Tags = null,
                           PrivacyLevel?PrivacyLevel       = null,
                           Boolean IsHidden = false,
                           IEnumerable <BlogPostingSignature> Signatures = null,
                           String DataSource = "")

            : base(Id,
                   DefaultJSONLDContext,
                   null,
                   DataSource)

        {
            this.Text            = Text;
            this.PublicationDate = PublicationDate ?? DateTime.Now;
            this.GeoLocation     = GeoLocation;
            this.Tags            = Tags ?? new TagRelevance[0];
            this.PrivacyLevel    = PrivacyLevel ?? social.OpenData.UsersAPI.PrivacyLevel.Private;
            this.IsHidden        = false;
            this.Signatures      = Signatures ?? new BlogPostingSignature[0];

            CalcHash();
        }
Exemple #13
0
        /// <summary>
        /// Return a JSON representation of the given GeoLocation.
        /// </summary>
        /// <param name="GeoLocation">A GeoLocation.</param>
        /// <param name="JPropertyKey">The name of the JSON property key to use.</param>
        public static JProperty ToJSON(this GeoCoordinate?GeoLocation, String JPropertyKey)
        {
            if (!GeoLocation.HasValue)
            {
                return(null);
            }

            return(new JProperty(JPropertyKey,
                                 GeoLocation.Value.ToJSON()));
        }
Exemple #14
0
 public EVSEInfo(WWCP.ChargingPool_Id PoolId,
                 Address PoolAddress,
                 GeoCoordinate?PoolLocation,
                 WWCP.ChargingStation_Id StationId)
 {
     this.PoolId       = PoolId;
     this.PoolAddress  = PoolAddress;
     this.PoolLocation = PoolLocation;
     this.StationId    = StationId;
 }
Exemple #15
0
        private void ProcessResult(GeocoderResult result)
        {
            var location = GetLocation(result.Element);

            var distanceToNewPlace = location.HasValue
                ? GeoUtils.Distance(location.Value, _coordinate)
                : 50; // NOTE give element some weight as we don't know its geometry

            var distanceToOldPlace = _currentLocation.HasValue
                ? GeoUtils.Distance(_currentLocation.Value, _coordinate)
                : float.MaxValue;

            if (location.HasValue && distanceToNewPlace <= distanceToOldPlace)
            {
                _text.text       = result.DisplayName;
                _currentLocation = location.Value;
            }
        }
Exemple #16
0
        PullEVSEStatus(this IEMPClient IEMPClient,
                       Provider_Id?ProviderId           = null,
                       GeoCoordinate?SearchCenter       = null,
                       Single DistanceKM                = 0f,
                       EVSEStatusTypes?EVSEStatusFilter = null,

                       DateTime?Timestamp = null,
                       CancellationToken?CancellationToken = null,
                       EventTracking_Id EventTrackingId    = null,
                       TimeSpan?RequestTimeout             = null)


        => IEMPClient.PullEVSEStatus(new PullEVSEStatusRequest(ProviderId ?? IEMPClient.DefaultProviderId.Value,
                                                               SearchCenter,
                                                               DistanceKM,
                                                               EVSEStatusFilter,

                                                               Timestamp,
                                                               CancellationToken,
                                                               EventTrackingId,
                                                               RequestTimeout ?? IEMPClient.RequestTimeout));
Exemple #17
0
            /// <summary>
            /// Create a new Posting builder.
            /// </summary>
            /// <param name="Text">The (multi-language) text of this blog posting.</param>
            /// <param name="PublicationDate">The timestamp of the publication of this blog posting.</param>
            /// <param name="GeoLocation">An optional geographical location of this blog posting.</param>
            /// <param name="Tags">An enumeration of multi-language tags and their relevance.</param>
            /// <param name="PrivacyLevel">Whether the blog posting will be shown in blog posting listings, or not.</param>
            /// <param name="IsHidden">The blog posting is hidden.</param>
            /// <param name="Signatures">All signatures of this blog posting.</param>
            /// <param name="DataSource">The source of all this data, e.g. an automatic importer.</param>
            public Builder(I18NString Text,
                           DateTime?PublicationDate        = null,
                           GeoCoordinate?GeoLocation       = null,
                           IEnumerable <TagRelevance> Tags = null,
                           PrivacyLevel?PrivacyLevel       = null,
                           Boolean IsHidden = false,
                           IEnumerable <BlogPostingSignature> Signatures = null,
                           String DataSource = "")

                : this(BlogPosting_Id.Random(),
                       Text,
                       PublicationDate,
                       GeoLocation,
                       Tags,
                       PrivacyLevel,
                       IsHidden,
                       Signatures,
                       DataSource)

            {
            }
Exemple #18
0
            /// <summary>
            /// Create a new Posting builder.
            /// </summary>
            /// <param name="Id">The unique identification of this blog posting.</param>
            /// <param name="Text">The (multi-language) text of this blog posting.</param>
            /// <param name="PublicationDate">The timestamp of the publication of this blog posting.</param>
            /// <param name="GeoLocation">An optional geographical location of this blog posting.</param>
            /// <param name="Tags">An enumeration of multi-language tags and their relevance.</param>
            /// <param name="PrivacyLevel">Whether the blog posting will be shown in blog posting listings, or not.</param>
            /// <param name="IsHidden">The blog posting is hidden.</param>
            /// <param name="Signatures">All signatures of this blog posting.</param>
            /// <param name="DataSource">The source of all this data, e.g. an automatic importer.</param>
            public Builder(BlogPosting_Id Id,
                           I18NString Text,
                           DateTime?PublicationDate        = null,
                           GeoCoordinate?GeoLocation       = null,
                           IEnumerable <TagRelevance> Tags = null,
                           PrivacyLevel?PrivacyLevel       = null,
                           Boolean IsHidden = false,
                           IEnumerable <BlogPostingSignature> Signatures = null,
                           String DataSource = "")

            {
                this.Id              = Id;
                this.Text            = Text;
                this.PublicationDate = PublicationDate ?? DateTime.Now;
                this.GeoLocation     = GeoLocation;
                this.Tags            = Tags ?? new TagRelevance[0];
                this.PrivacyLevel    = PrivacyLevel ?? social.OpenData.UsersAPI.PrivacyLevel.Private;
                this.IsHidden        = false;
                this.Signatures      = Signatures ?? new BlogPostingSignature[0];
                this.DataSource      = DataSource;
            }
Exemple #19
0
        /// <summary>
        /// Create an OICP PullEVSEData XML/SOAP request.
        /// The request might either have none, 'SearchCenter + DistanceKM' or 'LastCall' parameters.
        /// Because of limitations at Hubject the SearchCenter and LastCall parameters can not be used at the same time!
        /// </summary>
        /// <param name="ProviderId">The unique identification of the EVSP.</param>
        /// <param name="SearchCenter">An optional geo coordinate of the search center.</param>
        /// <param name="DistanceKM">An optional search distance relative to the search center.</param>
        /// <param name="LastCall">An optional timestamp of the last call. Cannot be combined with 'SearchCenter'.</param>
        /// <param name="GeoCoordinatesResponseFormat">An optional response format for representing geo coordinates.</param>
        /// <param name="OperatorIdFilter">Only return EVSEs belonging to the given optional enumeration of EVSE operators.</param>
        /// <param name="CountryCodeFilter">An optional enumeration of countries whose EVSE's a provider wants to retrieve.</param>
        ///
        /// <param name="Timestamp">The optional timestamp of the request.</param>
        /// <param name="CancellationToken">An optional token to cancel this request.</param>
        /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param>
        /// <param name="RequestTimeout">An optional timeout for this request.</param>
        public PullEVSEDataRequest(Provider_Id ProviderId,
                                   GeoCoordinate?SearchCenter = null,
                                   Single DistanceKM          = 0f,
                                   DateTime?LastCall          = null,
                                   GeoCoordinatesResponseFormats?GeoCoordinatesResponseFormat = GeoCoordinatesResponseFormats.DecimalDegree,
                                   IEnumerable <Operator_Id> OperatorIdFilter = null,
                                   IEnumerable <Country> CountryCodeFilter    = null,

                                   DateTime?Timestamp = null,
                                   CancellationToken?CancellationToken = null,
                                   EventTracking_Id EventTrackingId    = null,
                                   TimeSpan?RequestTimeout             = null)

            : base(Timestamp,
                   CancellationToken,
                   EventTrackingId,
                   RequestTimeout)

        {
            #region Initial checks

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

            #endregion

            this.ProviderId                   = ProviderId;
            this.SearchCenter                 = SearchCenter;
            this.DistanceKM                   = DistanceKM;
            this.LastCall                     = LastCall;
            this._OperatorIdFilter            = OperatorIdFilter != null ? new HashSet <Operator_Id>(OperatorIdFilter)  : new HashSet <Operator_Id>();
            this._CountryCodeFilter           = CountryCodeFilter != null ? new HashSet <Country>    (CountryCodeFilter) : new HashSet <Country>();
            this.GeoCoordinatesResponseFormat = GeoCoordinatesResponseFormat ?? GeoCoordinatesResponseFormats.DecimalDegree;
        }
Exemple #20
0
        //ToDo: Add OperatorIdFilter and CountryCodeFilter
        #region (static) TryParse(PullEVSEDataXML,  out PullEVSEData, ..., OnException = null, ...)

        /// <summary>
        /// Try to parse the given XML representation of an OICP pull EVSE data request.
        /// </summary>
        /// <param name="PullEVSEDataXML">The XML to parse.</param>
        /// <param name="PullEVSEData">The parsed pull EVSE data request.</param>
        /// <param name="CustomPullEVSEDataRequestParser">A delegate to parse custom PullEVSEData requests.</param>
        /// <param name="OnException">An optional delegate called whenever an exception occured.</param>
        ///
        /// <param name="Timestamp">The optional timestamp of the request.</param>
        /// <param name="CancellationToken">An optional token to cancel this request.</param>
        /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param>
        /// <param name="RequestTimeout">An optional timeout for this request.</param>
        public static Boolean TryParse(XElement PullEVSEDataXML,
                                       out PullEVSEDataRequest PullEVSEData,
                                       CustomXMLParserDelegate <PullEVSEDataRequest> CustomPullEVSEDataRequestParser = null,
                                       OnExceptionDelegate OnException = null,

                                       DateTime?Timestamp = null,
                                       CancellationToken?CancellationToken = null,
                                       EventTracking_Id EventTrackingId    = null,
                                       TimeSpan?RequestTimeout             = null)

        {
            try
            {
                if (PullEVSEDataXML.Name != OICPNS.EVSEData + "eRoamingPullEvseData")
                {
                    PullEVSEData = null;
                    return(false);
                }

                #region Parse the optional search center

                GeoCoordinate?GeoCoordinates = null;
                Single        Radius         = 0f;

                var SearchCenterXML = PullEVSEDataXML.Element(OICPNS.EVSEData + "SearchCenter");
                if (SearchCenterXML != null)
                {
                    #region Parse Google format

                    var GoogleXML = SearchCenterXML.Element(OICPNS.CommonTypes + "Google");
                    if (GoogleXML != null)
                    {
                        var GeoArray = GoogleXML.ElementValueOrFail(OICPNS.CommonTypes + "Coordinates").
                                       Split(new String[] { " " }, StringSplitOptions.None);

                        GeoCoordinates = new GeoCoordinate(Latitude.Parse(GeoArray[0]),
                                                           Longitude.Parse(GeoArray[1]));
                    }

                    #endregion

                    #region Parse DecimalDegree format

                    var DecimalDegreeXML = SearchCenterXML.Element(OICPNS.CommonTypes + "DecimalDegree");
                    if (DecimalDegreeXML != null)
                    {
                        GeoCoordinates = new GeoCoordinate(DecimalDegreeXML.MapValueOrFail(OICPNS.CommonTypes + "Latitude",
                                                                                           Latitude.Parse),
                                                           DecimalDegreeXML.MapValueOrFail(OICPNS.CommonTypes + "Longitude",
                                                                                           Longitude.Parse));
                    }

                    #endregion

                    Radius = SearchCenterXML.MapValueOrFail(OICPNS.CommonTypes + "Radius",
                                                            Single.Parse);
                }

                #endregion

                PullEVSEData = new PullEVSEDataRequest(PullEVSEDataXML.MapValueOrFail(OICPNS.EVSEData + "ProviderID",
                                                                                      Provider_Id.Parse),
                                                       GeoCoordinates,
                                                       Radius,

                                                       PullEVSEDataXML.MapValueOrNullable(OICPNS.EVSEData + "LastCall",
                                                                                          DateTime.Parse),

                                                       PullEVSEDataXML.MapValueOrFail(OICPNS.EVSEData + "GeoCoordinatesResponseFormat",
                                                                                      s => (GeoCoordinatesResponseFormats)Enum.Parse(typeof(GeoCoordinatesResponseFormats), s)),

                                                       null,
                                                       null,

                                                       Timestamp,
                                                       CancellationToken,
                                                       EventTrackingId,
                                                       RequestTimeout

                                                       );


                if (CustomPullEVSEDataRequestParser != null)
                {
                    PullEVSEData = CustomPullEVSEDataRequestParser(PullEVSEDataXML,
                                                                   PullEVSEData);
                }

                return(true);
            }
            catch (Exception e)
            {
                OnException?.Invoke(DateTime.UtcNow, PullEVSEDataXML, e);

                PullEVSEData = null;
                return(false);
            }
        }
Exemple #21
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);
        }
Exemple #22
0
 /// <summary>
 /// Return a JSON representation of the given GeoLocation.
 /// </summary>
 /// <param name="GeoLocation">A geographical location.</param>
 public static JObject ToJSON(this GeoCoordinate?GeoLocation)
 => GeoLocation?.ToJSON();
Exemple #23
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);
        }
Exemple #24
0
 public Task <StatusPull <EVSEStatus> > PullEVSEStatus(DateTime?LastCall = null, GeoCoordinate?SearchCenter = null, float DistanceKM = 0, EVSEStatusTypes?EVSEStatusFilter = null, eMobilityProvider_Id?ProviderId = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null)
 {
     throw new NotImplementedException();
 }
Exemple #25
0
 public Task <POIDataPull <org.GraphDefined.WWCP.EVSE> > PullEVSEData(DateTime?LastCall = null, GeoCoordinate?SearchCenter = null, float DistanceKM = 0, eMobilityProvider_Id?ProviderId = null, IEnumerable <ChargingStationOperator_Id> OperatorIdFilter = null, IEnumerable <Country> CountryCodeFilter = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null)
 {
     throw new NotImplementedException();
 }