Beispiel #1
0
        /// <summary>
        /// Parse the given string as an Electric Mobility Account (driver contract) (eMA_Id).
        /// </summary>
        /// <param name="Text">A text representation of an Electric Mobility Account (driver contract) identification.</param>
        /// <param name="eMAId">The parsed Electric Mobility Account (driver contract) identification.</param>
        public static Boolean TryParse(String Text, out eMA_Id eMAId)
        {
            #region Initial checks

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

            eMAId = null;

            #endregion

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

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

            EVSP_Id __ProviderId = null;

            if (EVSP_Id.TryParse(_MatchCollection[0].Groups[1].Value, out __ProviderId))
            {
                eMAId = new eMA_Id(__ProviderId.ToString() + "*" + _MatchCollection[0].Groups[6].Value + "*" + _MatchCollection[0].Groups[8].Value);
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// Parse the given string as an Electric Mobility Account (driver contract) (eMA_Id).
        /// </summary>
        /// <param name="Text">A text representation of an Electric Mobility Account (driver contract) identification.</param>
        public static eMA_Id Parse(String Text)
        {
            #region Initial checks

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

            #endregion

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

            if (_MatchCollection.Count != 1)
            {
                throw new ArgumentException("The given string can not be parsed as eMA identification!", nameof(Text));
            }

            EVSP_Id __ProviderId = null;

            if (EVSP_Id.TryParse(_MatchCollection[0].Groups[1].Value, out __ProviderId))
            {
                return(new eMA_Id(__ProviderId.ToString() + "*" + _MatchCollection[0].Groups[6].Value + "*" + _MatchCollection[0].Groups[8].Value));
            }

            throw new ArgumentException("The given string can not be parsed as eMA identification!", nameof(Text));
        }
Beispiel #3
0
        /// <summary>
        /// Create a charge detail record for the given charging session (identification).
        /// </summary>
        /// <param name="SessionId">The unique charging session identification.</param>
        /// <param name="ChargingReservation">An optional charging reservation used for charging.</param>
        ///
        /// <param name="EVSE">The EVSE of the EVSE used for charging.</param>
        /// <param name="ChargingStation">The charging station of the charging station used for charging.</param>
        /// <param name="ChargingPool">The charging pool of the charging pool used for charging.</param>
        /// <param name="EVSEOperator">The EVSE operator used for charging.</param>
        /// <param name="ChargingProductId">An unqiue identification for the consumed charging product.</param>
        ///
        /// <param name="ReservationTime">Optional timestamps when the reservation started and ended.</param>
        /// <param name="ParkingTime">Optional timestamps when the parking started and ended.</param>
        /// <param name="SessionTime">Optional timestamps when the charging session started and ended.</param>
        ///
        /// <param name="EnergyMeterId">An optional unique identification of the energy meter.</param>
        /// <param name="EnergyMeteringValues">An optional enumeration of intermediate energy metering values.</param>
        /// <param name="MeteringSignature">An optional signature for the metering values.</param>
        ///
        /// <param name="IdentificationStart">The identification for the start of the charging process.</param>
        /// <param name="IdentificationStop">The identification for the stop of the charging process.</param>
        public ChargeDetailRecord(ChargingSession_Id SessionId,
                                  ChargingReservation Reservation      = null,
                                  ChargingReservation_Id ReservationId = null,

                                  EVSEOperator EVSEOperator       = null,
                                  ChargingPool ChargingPool       = null,
                                  ChargingStation ChargingStation = null,
                                  EVSE EVSE      = null,
                                  EVSE_Id EVSEId = null,
                                  ChargingProduct_Id ChargingProductId = null,

                                  EVSP_Id ProviderId = null,

                                  StartEndDateTime?ReservationTime = null,
                                  StartEndDateTime?ParkingTime     = null,
                                  StartEndDateTime?SessionTime     = null,

                                  EnergyMeter_Id EnergyMeterId = null,
                                  IEnumerable <Timestamped <Double> > EnergyMeteringValues = null,
                                  String MeteringSignature = null,

                                  AuthInfo IdentificationStart = null,
                                  AuthInfo IdentificationStop  = null)

        {
            #region Initial checks

            if (SessionId == null)
            {
                throw new ArgumentNullException("Id", "The charging session identification must not be null!");
            }

            #endregion

            this._SessionId = SessionId;

            this._Reservation     = Reservation;
            this._ReservationId   = ReservationId != null ? ReservationId : Reservation != null ? Reservation.Id : null;
            this._ReservationTime = ReservationTime;

            this._EVSE              = EVSE;
            this._EVSEId            = EVSE != null ? EVSE.Id : EVSEId;
            this._ChargingStation   = ChargingStation;
            this._ChargingPool      = ChargingPool;
            this._EVSEOperator      = EVSEOperator;
            this._ChargingProductId = ChargingProductId;

            this._ParkingTime = ParkingTime;
            this._SessionTime = SessionTime;

            this._EnergyMeterId        = EnergyMeterId;
            this._EnergyMeteringValues = EnergyMeteringValues != null ? EnergyMeteringValues : new Timestamped <Double> [0];

            this._IdentificationStart = IdentificationStart;
            this._IdentificationStop  = IdentificationStop;
        }
 /// <summary>
 /// The authorize start operation is not allowed (ev customer is blocked).
 /// </summary>
 /// <param name="AuthorizatorId">An authorizator identification.</param>
 /// <param name="ProviderId">The unique identification of the ev service provider.</param>
 /// <param name="Description">An optional description of the auth start result.</param>
 /// <param name="AdditionalInfo">An optional additional message.</param>
 public static AuthStopChargingStationResult Blocked(Authorizator_Id AuthorizatorId,
                                                     EVSP_Id ProviderId,
                                                     String Description    = null,
                                                     String AdditionalInfo = null)
 {
     return(new AuthStopChargingStationResult(AuthorizatorId,
                                              AuthStopChargingStationResultType.Blocked,
                                              ProviderId,
                                              Description,
                                              AdditionalInfo));
 }
Beispiel #5
0
 /// <summary>
 /// The authorize start was not successful (e.g. ev customer is unkown).
 /// </summary>
 /// <param name="AuthorizatorId">An authorizator identification.</param>
 /// <param name="ProviderId">The unique identification of the ev service provider.</param>
 /// <param name="Description">An optional description of the auth start result.</param>
 /// <param name="AdditionalInfo">An optional additional message.</param>
 public static AuthStartResult NotAuthorized(Authorizator_Id AuthorizatorId,
                                             EVSP_Id ProviderId,
                                             String Description    = null,
                                             String AdditionalInfo = null)
 {
     return(new AuthStartResult(AuthorizatorId,
                                AuthStartResultType.NotAuthorized,
                                ProviderId,
                                Description,
                                AdditionalInfo));
 }
Beispiel #6
0
        /// <summary>
        /// Create a charging reservation.
        /// </summary>
        public ChargingReservation(ChargingReservation_Id ReservationId,
                                   DateTime Timestamp,
                                   DateTime StartTime,
                                   TimeSpan Duration,
                                   DateTime EndTime,
                                   TimeSpan ConsumedReservationTime,
                                   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)

        {
            #region Initial checks

            if (ReservationId == null)
            {
                throw new ArgumentNullException(nameof(ReservationId), "The given charging 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._ChargingPoolId    = ChargingPoolId;
            this._ChargingStationId = ChargingStationId;
            this._EVSEId            = EVSEId;
            this._ChargingProductId = ChargingProductId;

            this._AuthTokens = AuthTokens != null ? new HashSet <Auth_Token>(AuthTokens) : new HashSet <Auth_Token>();
            this._eMAIds     = eMAIds != null ? new HashSet <eMA_Id>    (eMAIds)     : new HashSet <eMA_Id>();
            this._PINs       = PINs != null ? new HashSet <UInt32>    (PINs)       : new HashSet <UInt32>();
        }
 /// <summary>
 /// The authorize start was successful.
 /// </summary>
 /// <param name="AuthorizatorId">An authorizator identification.</param>
 /// <param name="SessionId">The charging session identification for the authorize start operation.</param>
 /// <param name="ProviderId">The unique identification of the ev service provider.</param>
 /// <param name="Description">An optional description of the auth start result.</param>
 /// <param name="AdditionalInfo">An optional additional message.</param>
 /// <param name="ListOfAuthStopTokens">An optional enumeration of authorize stop tokens.</param>
 /// <param name="ListOfAuthStopPINs">An optional enumeration of authorize stop PINs.</param>
 public static AuthStartChargingStationResult Authorized(Authorizator_Id AuthorizatorId,
                                                         ChargingSession_Id SessionId,
                                                         EVSP_Id ProviderId,
                                                         String Description    = null,
                                                         String AdditionalInfo = null,
                                                         IEnumerable <Auth_Token> ListOfAuthStopTokens = null,
                                                         IEnumerable <UInt32> ListOfAuthStopPINs       = null)
 {
     return(new AuthStartChargingStationResult(AuthorizatorId,
                                               SessionId,
                                               ProviderId,
                                               Description,
                                               AdditionalInfo,
                                               ListOfAuthStopTokens,
                                               ListOfAuthStopPINs));
 }
Beispiel #8
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)

        {
        }
        /// <summary>
        /// Create a new authorize stop result.
        /// </summary>
        /// <param name="AuthorizatorId">The identification of the authorizing entity.</param>
        /// <param name="Result">The authorize stop result type.</param>
        /// <param name="ProviderId">An optional identification of the ev service provider.</param>
        /// <param name="Description">An optional description of the auth stop result.</param>
        /// <param name="AdditionalInfo">An optional additional message.</param>
        private AuthStopChargingStationResult(Authorizator_Id AuthorizatorId,
                                              AuthStopChargingStationResultType Result,
                                              EVSP_Id ProviderId    = null,
                                              String Description    = null,
                                              String AdditionalInfo = null)
        {
            #region Initial checks

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

            #endregion

            this._AuthorizatorId = AuthorizatorId;
            this._Result         = Result;
            this._ProviderId     = ProviderId;
            this._Description    = Description != null ? Description    : String.Empty;
            this._AdditionalInfo = AdditionalInfo != null ? AdditionalInfo : String.Empty;
        }
        /// <summary>
        /// Create a new successful authorize start result.
        /// </summary>
        /// <param name="AuthorizatorId">The identification of the authorizing entity.</param>
        /// <param name="SessionId">The charging session identification for the authorize start operation.</param>
        /// <param name="ProviderId">The unique identification of the ev service provider.</param>
        /// <param name="Description">An optional description of the auth start result.</param>
        /// <param name="AdditionalInfo">An optional additional message.</param>
        /// <param name="ListOfAuthStopTokens">An optional enumeration of authorize stop tokens.</param>
        /// <param name="ListOfAuthStopPINs">An optional enumeration of authorize stop PINs.</param>
        private AuthStartChargingStationResult(Authorizator_Id AuthorizatorId,
                                               ChargingSession_Id SessionId,
                                               EVSP_Id ProviderId,
                                               String Description    = null,
                                               String AdditionalInfo = null,
                                               IEnumerable <Auth_Token> ListOfAuthStopTokens = null,
                                               IEnumerable <UInt32> ListOfAuthStopPINs       = null)
        {
            #region Initial checks

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

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

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

            #endregion

            this._Result               = AuthStartChargingStationResultType.Authorized;
            this._AuthorizatorId       = AuthorizatorId;
            this._SessionId            = SessionId;
            this._ProviderId           = ProviderId;
            this._Description          = Description != null ? Description          : String.Empty;
            this._AdditionalInfo       = AdditionalInfo != null ? AdditionalInfo       : String.Empty;
            this._ListOfAuthStopTokens = ListOfAuthStopTokens != null ? ListOfAuthStopTokens : new Auth_Token[0];
            this._ListOfAuthStopPINs   = ListOfAuthStopPINs != null ? ListOfAuthStopPINs   : new UInt32[0];
        }
 public EVServiceProviderAlreadyExists(EVSP_Id EVServiceProvider_Id,
                                       RoamingNetwork_Id RoamingNetwork_Id)
     : base("The given EV service provider identification '" + EVServiceProvider_Id + "' already exists within the given '" + RoamingNetwork_Id + "' roaming network!")
 {
 }