Example #1
0
        public void SetEVehicleAdminStatus(eVehicle_Id eVehicleId,
                                           IEnumerable <Timestamped <eVehicleAdminStatusType> > StatusList,
                                           ChangeMethods ChangeMethod = ChangeMethods.Replace)
        {
            eVehicle _eVehicle = null;

            if (TryGetEVehicleById(eVehicleId, out _eVehicle))
            {
                _eVehicle.SetAdminStatus(StatusList, ChangeMethod);
            }

            //if (SendUpstream)
            //{
            //
            //    RoamingNetwork.
            //        SendeVehicleAdminStatusDiff(new eVehicleAdminStatusDiff(DateTime.UtcNow,
            //                                               ChargingStationOperatorId:    Id,
            //                                               ChargingStationOperatorName:  Name,
            //                                               NewStatus:         new List<KeyValuePair<eVehicle_Id, eVehicleAdminStatusType>>(),
            //                                               ChangedStatus:     new List<KeyValuePair<eVehicle_Id, eVehicleAdminStatusType>>() {
            //                                                                          new KeyValuePair<eVehicle_Id, eVehicleAdminStatusType>(eVehicleId, NewStatus.Value)
            //                                                                      },
            //                                               RemovedIds:        new List<eVehicle_Id>()));
            //
            //}
        }
Example #2
0
        /// <summary>
        /// Insert the given enumeration of status entries.
        /// </summary>
        /// <param name="StatusList">An enumeration of status entries.</param>
        /// <param name="ChangeMethod">A change method.</param>
        public void Insert(IEnumerable <Timestamped <T> > StatusList,
                           ChangeMethods ChangeMethod = ChangeMethods.Replace)
        {
            lock (_StatusSchedule)
            {
                var _OldStatus = _CurrentStatus;

                switch (ChangeMethod)
                {
                case ChangeMethods.Insert:
                    break;

                case ChangeMethods.Replace:
                    _StatusSchedule.Clear();
                    break;
                }

                _StatusSchedule.AddRange(StatusList);

                // Remove any old status having the same timestamp!
                var NewStatusSchedule = _StatusSchedule.
                                        GroupBy(status => status.Timestamp).
                                        Select(group => group.
                                               OrderByDescending(status => status.Timestamp).
                                               First()).
                                        OrderByDescending(v => v.Timestamp).
                                        Take((Int32)_MaxStatusHistorySize).
                                        ToArray();

                _StatusSchedule.Clear();
                _StatusSchedule.AddRange(NewStatusSchedule);

                CheckCurrentStatus(_OldStatus);
            }
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the ChangingResultInfo class.
 /// </summary>
 /// <param name="state">The change method result.</param>
 public ChangingResultInfo(ChangeMethods state)
 {
     State = state;
     if (state == ChangeMethods.Invalid)
     {
         ErrorCode = ChangeErrorKinds.Service;
     }
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the ChangingResultInfo class.
 /// </summary>
 /// <param name="state">The change method result.</param>
 /// <param name="ex">The exception.</param>
 public ChangingResultInfo(ChangeMethods state, Exception ex)
     : this(ex)
 {
     State = state;
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the ChangingResultInfo class.
 /// </summary>
 /// <param name="state">The change method result.</param>
 /// <param name="message">The message.</param>
 public ChangingResultInfo(ChangeMethods state, string message)
     : this(state)
 {
     Message = message;
 }
Example #6
0
 /// <summary>
 /// Set the timestamped admin status.
 /// </summary>
 /// <param name="NewAdminStatusList">A list of new timestamped admin status.</param>
 /// <param name="ChangeMethod">The change mode.</param>
 public void SetAdminStatus(IEnumerable <Timestamped <eMobilityStationAdminStatusType> > NewAdminStatusList,
                            ChangeMethods ChangeMethod = ChangeMethods.Replace)
 {
     _AdminStatusSchedule.Insert(NewAdminStatusList, ChangeMethod);
 }
Example #7
0
 /// <summary>
 /// Set the timestamped admin status.
 /// </summary>
 /// <param name="NewStatusList">A list of new timestamped admin status.</param>
 /// <param name="ChangeMethod">The change mode.</param>
 public void SetAdminStatus(IEnumerable <Timestamped <ChargingStationGroupAdminStatusTypes> > NewStatusList,
                            ChangeMethods ChangeMethod = ChangeMethods.Replace)
 {
     _AdminStatusSchedule.Insert(NewStatusList, ChangeMethod);
 }
Example #8
0
 /// <summary>
 /// Set the timestamped status.
 /// </summary>
 /// <param name="NewStatusList">A list of new timestamped status.</param>
 /// <param name="ChangeMethod">The change mode.</param>
 public void SetStatus(IEnumerable <Timestamped <EVSEStatusTypes> > NewStatusList,
                       ChangeMethods ChangeMethod = ChangeMethods.Replace)
 {
     _StatusSchedule.Insert(NewStatusList, ChangeMethod);
 }