Beispiel #1
0
        public void Stop(ChargingReservation_Id Id,
                         DateTime?Timestamp = null,
                         AAuthentication StopAuthentication = null)
        {
            lock (InternalData)
            {
                if (InternalData.TryGetValue(Id, out ChargingReservationCollection reservationCollection))
                {
                    var reservation = reservationCollection.LastOrDefault();
                    if (reservation != null)
                    {
                        reservation.EndTime = Timestamp ?? DateTime.UtcNow;

                        if (StopAuthentication != null)
                        {
                            reservation.StopAuthentication = StopAuthentication;
                        }

                        LogIt("stop",
                              Id,
                              "reservations",
                              new JArray(reservation.ToJSON()));
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Create a new auth info status.
        /// </summary>
        /// <param name="AuthInfo">The unique identification of an auth info.</param>
        /// <param name="Status">The current status of an auth info.</param>
        public AuthInfoStatus(AAuthentication AuthInfo,
                              AuthInfoStatusType Status)

        {
            this.Id     = AuthInfo ?? throw new ArgumentNullException(nameof(AuthInfo), "The given unique identification of an auth info must not be null!");
            this.Status = Status;
        }
Beispiel #3
0
 public SessionInfo(AAuthentication Token)
 {
     this.Created = DateTime.UtcNow;
     this.ListOfAuthStopTokens = new List <AAuthentication>()
     {
         Token
     };
 }
Beispiel #4
0
        public static Boolean IsDefined(this AAuthentication Authentication)

        => Authentication != null &&
        (Authentication.AuthToken.HasValue ||
         Authentication.QRCodeIdentification != null ||
         Authentication.PlugAndChargeIdentification.HasValue ||
         Authentication.RemoteIdentification.HasValue ||
         Authentication.PIN.HasValue ||
         Authentication.PublicKey != null);
        public void Remove(ChargingSession_Id ChargingSessionId,
                           AAuthentication Authentication)
        {
            lock (InternalData)
            {
                if (InternalData.TryGetValue(ChargingSessionId, out ChargingSession session))
                {
                    InternalData.Remove(session.Id);
                    session.AuthenticationStop = Authentication;

                    LogIt("remove",
                          session.Id,
                          "chargingSession",
                          session.ToJSON());
                }
            }
        }
Beispiel #6
0
        public SignedMeteringValue(DateTime Timestamp,
                                   Double MeterValue,
                                   EnergyMeter_Id MeterId,
                                   EVSE_Id EVSEId,
                                   AAuthentication UserId,
                                   PgpPublicKey PublicKey,
                                   String lastSignature = "",
                                   String Signature     = "")
        {
            this.Timestamp     = Timestamp;
            this.MeterValue    = MeterValue;
            this.MeterId       = MeterId;
            this.EVSEId        = EVSEId;
            this.UserId        = UserId;
            this.PublicKey     = PublicKey;
            this.lastSignature = lastSignature != null?lastSignature.Trim() : "";

            this.Signature = Signature != null?Signature.Trim() : "";

            if (UserId == null)
            {
                new ArgumentNullException(nameof(UserId), "A signed meter value must have some kind of user identification!");
            }
        }
Beispiel #7
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="SessionTime">The timestamps when the charging session started and ended.</param>
        /// <param name="Duration">The duration of the charging session, whenever it is more than the time span between its start- and endtime, e.g. caused by a tariff granularity of 15 minutes.</param>
        ///
        /// <param name="EVSE">The EVSE used for charging.</param>
        /// <param name="EVSEId">The identification of the EVSE used for charging.</param>
        /// <param name="ChargingStation">The charging station of the charging station used for charging.</param>
        /// <param name="ChargingStationId">The identification of the charging station used for charging.</param>
        /// <param name="ChargingPool">The charging pool of the charging pool used for charging.</param>
        /// <param name="ChargingPoolId">The identification of the charging pool used for charging.</param>
        /// <param name="ChargingStationOperator">The charging station operator used for charging.</param>
        /// <param name="ChargingStationOperatorId">The identification of the charging station operator used for charging.</param>
        /// <param name="ChargingProduct">The consumed charging product.</param>
        /// <param name="ChargingPrice">The charging price.</param>
        ///
        /// <param name="AuthenticationStart">The authentication used for starting this charging process.</param>
        /// <param name="AuthenticationStop">The authentication used for stopping this charging process.</param>
        /// <param name="ProviderIdStart">The identification of the e-mobility provider used for starting this charging process.</param>
        /// <param name="ProviderIdStop">The identification of the e-mobility provider used for stopping this charging process.</param>
        ///
        /// <param name="Reservation">The optional charging reservation used before charging.</param>
        /// <param name="ReservationId">The optional charging reservation identification used before charging.</param>
        /// <param name="ReservationTime">Optional timestamps when the reservation started and ended.</param>
        ///
        /// <param name="ParkingSpaceId">The optional identification of the parkging space.</param>
        /// <param name="ParkingTime">Optional timestamps when the parking started and ended.</param>
        /// <param name="ParkingFee">The optional fee for parking.</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="CustomData">An optional dictionary of customer-specific data.</param>
        public ChargeDetailRecord(ChargingSession_Id SessionId,
                                  StartEndDateTime?SessionTime,
                                  TimeSpan?Duration = null,

                                  EVSE EVSE      = null,
                                  EVSE_Id?EVSEId = null,
                                  ChargingStation ChargingStation                      = null,
                                  ChargingStation_Id?ChargingStationId                 = null,
                                  ChargingPool ChargingPool                            = null,
                                  ChargingPool_Id?ChargingPoolId                       = null,
                                  ChargingStationOperator ChargingStationOperator      = null,
                                  ChargingStationOperator_Id?ChargingStationOperatorId = null,
                                  ChargingProduct ChargingProduct                      = null,
                                  Decimal?ChargingPrice = null,

                                  AAuthentication AuthenticationStart  = null,
                                  AAuthentication AuthenticationStop   = null,
                                  eMobilityProvider_Id?ProviderIdStart = null,
                                  eMobilityProvider_Id?ProviderIdStop  = null,

                                  ChargingReservation Reservation      = null,
                                  ChargingReservation_Id?ReservationId = null,
                                  StartEndDateTime?ReservationTime     = null,

                                  ParkingSpace_Id?ParkingSpaceId = null,
                                  StartEndDateTime?ParkingTime   = null,
                                  Decimal?ParkingFee             = null,

                                  EnergyMeter_Id?EnergyMeterId = null,
                                  IEnumerable <Timestamped <Single> > EnergyMeteringValues = null,
                                  IEnumerable <SignedMeteringValue> SignedMeteringValues   = null,
                                  IEnumerable <String> Signatures = null,

                                  IReadOnlyDictionary <String, Object> CustomData = null)

            : base(CustomData)

        {
            this.SessionId   = SessionId;
            this.SessionTime = SessionTime;
            this.Duration    = Duration;

            this.EVSE                      = EVSE;
            this.EVSEId                    = EVSEId ?? EVSE?.Id;
            this.ChargingStation           = ChargingStation;
            this.ChargingStationId         = ChargingStationId ?? ChargingStation?.Id;
            this.ChargingPool              = ChargingPool;
            this.ChargingPoolId            = ChargingPoolId ?? ChargingPool?.Id;
            this.ChargingStationOperator   = ChargingStationOperator;
            this.ChargingStationOperatorId = ChargingStationOperatorId ?? ChargingStationOperator?.Id;
            this.ChargingProduct           = ChargingProduct;
            this.ChargingPrice             = ChargingPrice;

            this.IdentificationStart = AuthenticationStart;
            this.IdentificationStop  = AuthenticationStop;
            this.ProviderIdStart     = ProviderIdStart;
            this.ProviderIdStop      = ProviderIdStop;

            this.Reservation     = Reservation;
            this.ReservationId   = ReservationId ?? Reservation?.Id;
            this.ReservationTime = ReservationTime;

            this.ParkingSpaceId = ParkingSpaceId;
            this.ParkingTime    = ParkingTime;
            this.ParkingFee     = ParkingFee;

            this.EnergyMeterId        = EnergyMeterId;
            this.EnergyMeteringValues = EnergyMeteringValues ?? new Timestamped <Single> [0];
            this.SignedMeteringValues = SignedMeteringValues ?? new SignedMeteringValue[0];
            this._Signatures          = Signatures.SafeAny()  ? new HashSet <String>(Signatures) : new HashSet <String>();

            if (SignedMeteringValues.SafeAny() && !EnergyMeteringValues.SafeAny())
            {
                this.EnergyMeteringValues = SignedMeteringValues.Select(svalue => new Timestamped <Single>(svalue.Timestamp,
                                                                                                           (Single)svalue.MeterValue));
            }
        }
Beispiel #8
0
 public static Boolean IsNull(this AAuthentication Authentication)
 => !IsDefined(Authentication);