Beispiel #1
0
        /// <summary>
        /// Generate a new unique identification of an Electric Vehicle Charging Station (EVCS Id).
        /// </summary>
        /// <param name="OperatorId">The unique identification of an EVSE operator.</param>
        /// <param name="Mapper">A delegate to modify the newly generated charging station identification.</param>
        /// <param name="IdFormat">The (EVSE-)format of the charging station identification [old|new].</param>
        public static ChargingStation_Id Random(EVSEOperator_Id OperatorId,
                                                Func <String, String> Mapper = null,
                                                IdFormatType IdFormat        = IdFormatType.NEW)
        {
            #region Initial checks

            if (OperatorId == null)
            {
                throw new ArgumentException("The parameter must not be null!", "OperatorId");
            }

            #endregion

            return(new ChargingStation_Id(OperatorId,
                                          Mapper != null ? Mapper(_Random.RandomString(12)) : _Random.RandomString(12),
                                          IdFormat));
        }
Beispiel #2
0
        /// <summary>
        /// Parse the given string as an EVSE identification.
        /// </summary>
        public static EVSE_Id Parse(EVSEOperator_Id OperatorId, String IdSuffix)
        {
            #region Initial checks

            if (OperatorId == null)
            {
                throw new ArgumentNullException(nameof(OperatorId), "The EVSE operator identification must not be null or empty!");
            }

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

            #endregion

            return(EVSE_Id.Parse(OperatorId.ToString() + "*" + IdSuffix));
        }
Beispiel #3
0
        /// <summary>
        /// Parse the given string as a charging pool identification (EVCS Id).
        /// </summary>
        /// <param name="OperatorId">The unique identification of an EVSE operator.</param>
        /// <param name="IdSuffix">A text representation of a charging pool identification.</param>
        /// <param name="ChargingPoolId">The parsed charging pool identification.</param>
        public static Boolean TryParse(EVSEOperator_Id OperatorId,
                                       String IdSuffix,
                                       out ChargingPool_Id ChargingPoolId)
        {
            #region Initial checks

            if (OperatorId == null || IdSuffix.IsNullOrEmpty())
            {
                ChargingPoolId = null;
                return(false);
            }

            #endregion

            try
            {
                ChargingPoolId = null;

                var _MatchCollection = Regex.Matches(IdSuffix.Trim().ToUpper(),
                                                     IdSuffix_RegEx,
                                                     RegexOptions.IgnorePatternWhitespace);

                if (_MatchCollection.Count != 1)
                {
                    return(false);
                }

                ChargingPoolId = new ChargingPool_Id(OperatorId,
                                                     _MatchCollection[0].Groups[0].Value,
                                                     OperatorId.Format);

                return(true);
            }
            catch (Exception e)
            { }

            ChargingPoolId = null;
            return(false);
        }
Beispiel #4
0
        /// <summary>
        /// Parse the given string as a charging pool identification (EVCS Id).
        /// </summary>
        /// <param name="Text">A text representation of a charging pool identification.</param>
        public static ChargingPool_Id Parse(String Text)
        {
            #region Initial checks

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

            #endregion

            var _MatchCollection = Regex.Matches(Text.Trim().ToUpper(),
                                                 ChargingPoolId_RegEx,
                                                 RegexOptions.IgnorePatternWhitespace);

            if (_MatchCollection.Count != 1)
            {
                throw new ArgumentException("Illegal charging pool identification '" + Text + "'!", "Text");
            }

            EVSEOperator_Id __EVSEOperatorId = null;

            if (EVSEOperator_Id.TryParse(_MatchCollection[0].Groups[1].Value, out __EVSEOperatorId))
            {
                return(new ChargingPool_Id(__EVSEOperatorId,
                                           _MatchCollection[0].Groups[2].Value,
                                           IdFormatType.NEW));
            }

            if (EVSEOperator_Id.TryParse(_MatchCollection[0].Groups[3].Value, out __EVSEOperatorId))
            {
                return(new ChargingPool_Id(__EVSEOperatorId,
                                           _MatchCollection[0].Groups[4].Value,
                                           IdFormatType.OLD));
            }


            throw new ArgumentException("Illegal charging pool identification '" + Text + "'!", "Text");
        }
Beispiel #5
0
 public Task <Acknowledgement> PushEVSEStatus(ChargingStation ChargingStation, ActionType ActionType = ActionType.update, EVSEOperator_Id OperatorId = null, string OperatorName = null, Func <EVSE, bool> IncludeEVSEs = null, TimeSpan?QueryTimeout = default(TimeSpan?))
 {
     return(Task.FromResult(new Acknowledgement(true)));
 }
Beispiel #6
0
 public Task <Acknowledgement> PushEVSEStatus(ILookup <EVSEOperator_Id, EVSEStatus> GroupedEVSEs, ActionType ActionType = ActionType.update, EVSEOperator_Id OperatorId = null, string OperatorName = null, TimeSpan?QueryTimeout = default(TimeSpan?))
 {
     return(Task.FromResult(new Acknowledgement(true)));
 }
Beispiel #7
0
        public Task <Acknowledgement> PushEVSEStatus(EVSEStatus EVSEStatus, ActionType ActionType = ActionType.update, EVSEOperator_Id OperatorId = null, string OperatorName = null, TimeSpan?QueryTimeout = default(TimeSpan?))
        {
            this._EVSEStatusDiffDelegate(new EVSEStatusDiff(DateTime.Now, EVSEStatus.Id.OperatorId, null, new KeyValuePair <EVSE_Id, EVSEStatusType>[] { new KeyValuePair <EVSE_Id, EVSEStatusType>(EVSEStatus.Id, EVSEStatus.Status) }, null));

            return(Task.FromResult(new Acknowledgement(true)));
        }
Beispiel #8
0
 public Task <Acknowledgement> EnqueueEVSEStatusUpdate(EVSEStatus EVSEStatus, ActionType ActionType = ActionType.update, EVSEOperator_Id OperatorId = null, string OperatorName = null, TimeSpan?QueryTimeout = default(TimeSpan?))
 {
     throw new NotImplementedException();
 }
Beispiel #9
0
 public Task <Acknowledgement> PushEVSEData(RoamingNetwork RoamingNetwork, ActionType ActionType = ActionType.fullLoad, EVSEOperator_Id OperatorId = null, string OperatorName = null, Func <EVSE, bool> IncludeEVSEs = null, TimeSpan?QueryTimeout = default(TimeSpan?))
 {
     throw new NotImplementedException();
 }
Beispiel #10
0
 public Task <Acknowledgement> PushEVSEData(EVSE EVSE, ActionType ActionType = ActionType.insert, EVSEOperator_Id OperatorId = null, string OperatorName = null, TimeSpan?QueryTimeout = default(TimeSpan?))
 {
     throw new NotImplementedException();
 }
Beispiel #11
0
 public Task <Acknowledgement> PushEVSEData(ILookup <EVSEOperator, EVSE> GroupedEVSEs, ActionType ActionType = ActionType.fullLoad, EVSEOperator_Id OperatorId = null, string OperatorName = null, TimeSpan?QueryTimeout = default(TimeSpan?))
 {
     throw new NotImplementedException();
 }
Beispiel #12
0
        /// <summary>
        /// Parse the given string as a charging station identification (EVCS Id).
        /// </summary>
        /// <param name="Text">A text representation of a charging station identification.</param>
        /// <param name="ChargingStationId">The parsed charging station identification.</param>
        public static Boolean TryParse(String Text, out ChargingStation_Id ChargingStationId)
        {
            #region Initial checks

            if (Text.IsNullOrEmpty())
            {
                ChargingStationId = null;
                return(false);
            }

            #endregion

            try
            {
                ChargingStationId = null;

                var _MatchCollection = Regex.Matches(Text.Trim().ToUpper(),
                                                     ChargingStationId_RegEx,
                                                     RegexOptions.IgnorePatternWhitespace);

                if (_MatchCollection.Count != 1)
                {
                    return(false);
                }

                EVSEOperator_Id __EVSEOperatorId = null;

                // New format...
                if (EVSEOperator_Id.TryParse(_MatchCollection[0].Groups[1].Value, out __EVSEOperatorId))
                {
                    ChargingStationId = new ChargingStation_Id(__EVSEOperatorId,
                                                               _MatchCollection[0].Groups[2].Value,
                                                               IdFormatType.NEW);

                    return(true);
                }

                // Old format...
                else if (EVSEOperator_Id.TryParse(_MatchCollection[0].Groups[3].Value, out __EVSEOperatorId))
                {
                    ChargingStationId = new ChargingStation_Id(__EVSEOperatorId,
                                                               _MatchCollection[0].Groups[4].Value,
                                                               IdFormatType.OLD);

                    return(true);
                }

                // New format without the 'S'...
                else if (EVSEOperator_Id.TryParse(_MatchCollection[0].Groups[5].Value, out __EVSEOperatorId))
                {
                    ChargingStationId = new ChargingStation_Id(__EVSEOperatorId,
                                                               _MatchCollection[0].Groups[6].Value,
                                                               IdFormatType.NEW);

                    return(true);
                }

                // Old format without the 'S'...
                else if (EVSEOperator_Id.TryParse(_MatchCollection[0].Groups[7].Value, out __EVSEOperatorId))
                {
                    ChargingStationId = new ChargingStation_Id(__EVSEOperatorId,
                                                               _MatchCollection[0].Groups[8].Value,
                                                               IdFormatType.OLD);

                    return(true);
                }
            }
            catch (Exception e)
            { }

            ChargingStationId = null;
            return(false);
        }
 public ChargingStationGroupAlreadyExists(ChargingStationGroup_Id ChargingStationGroupId,
                                          EVSEOperator_Id EVSEOperator_Id)
     : base("The given charging station group identification '" + ChargingStationGroupId + "' already exists within the given '" + EVSEOperator_Id + "' EVSE operator!")
 {
 }
 public ChargingPoolAlreadyExists(ChargingPool_Id ChargingPool_Id,
                                  EVSEOperator_Id EVSEOperator_Id)
     : base("The given charging pool identification '" + ChargingPool_Id + "' already exists within the given '" + EVSEOperator_Id + "' EVSE operator!")
 {
 }
 public EVSEOperatorAlreadyExists(EVSEOperator_Id EVSEOperator_Id,
                                  RoamingNetwork_Id RoamingNetwork_Id)
     : base("The given EVSE operator identification '" + EVSEOperator_Id + "' already exists within the given '" + RoamingNetwork_Id + "' roaming network!")
 {
 }