示例#1
0
 /// <summary>
 /// Create a new EVSE status record.
 /// </summary>
 /// <param name="Id">The ID that identifies the charging spot.</param>
 /// <param name="Status">The status of the charging spot.</param>
 /// <param name="CustomData">Optional customer specific data, e.g. in combination with custom parsers and serializers.</param>
 public EVSEStatusRecord(EVSE_Id Id,
                         EVSEStatusTypes Status,
                         JObject CustomData = null)
 {
     this.Id         = Id;
     this.Status     = Status;
     this.CustomData = CustomData;
 }
示例#2
0
        /// <summary>
        /// Create a new OICP EVSE status record.
        /// </summary>
        /// <param name="Id">The unique identification of an EVSE.</param>
        /// <param name="Status">The current status of an EVSE.</param>
        /// <param name="CustomData">An optional dictionary of customer-specific data.</param>
        public EVSEStatusRecord(EVSE_Id Id,
                                EVSEStatusTypes Status,
                                IReadOnlyDictionary <String, Object> CustomData = null)

            : base(CustomData)

        {
            this.Id     = Id;
            this.Status = Status;
        }
示例#3
0
        /// <summary>
        /// Create a new EVSE status.
        /// </summary>
        /// <param name="Id">The unique identification of the EVSE.</param>
        /// <param name="Status">The current status of the EVSE.</param>
        /// <param name="Timestamp">The timestamp of the status change of the EVSE.</param>
        /// <param name="CustomData">An optional dictionary of customer-specific data.</param>
        public EVSEStatus(EVSE_Id Id,
                          EVSEStatusTypes Status,
                          DateTime Timestamp,
                          IReadOnlyDictionary <String, Object> CustomData = null)

            : this(Id,
                   new Timestamped <EVSEStatusTypes>(Timestamp, Status),
                   CustomData)

        {
        }
示例#4
0
        /// <summary>
        /// Create a new virtual charging station.
        /// </summary>
        /// <param name="ChargingStation">A charging station.</param>
        /// <param name="EVSEId">The EVSE identification for the EVSE to be created.</param>
        /// <param name="EVSEConfigurator">An optional delegate to configure the new (local) EVSE.</param>
        /// <param name="VirtualEVSEConfigurator">An optional delegate to configure the new EVSE.</param>
        /// <param name="OnSuccess">An optional delegate for reporting success.</param>
        /// <param name="OnError">An optional delegate for reporting an error.</param>
        public static EVSE CreateVirtualEVSE(this ChargingStation ChargingStation,
                                             EVSE_Id EVSEId,
                                             I18NString Description = null,
                                             EVSEAdminStatusTypes InitialAdminStatus = EVSEAdminStatusTypes.Operational,
                                             EVSEStatusTypes InitialStatus           = EVSEStatusTypes.Available,
                                             EnergyMeter_Id?EnergyMeterId            = null,
                                             String EllipticCurve = "P-256",
                                             ECPrivateKeyParameters PrivateKey           = null,
                                             PublicKeyCertificates PublicKeyCertificates = null,
                                             TimeSpan?SelfCheckTimeSpan     = null,
                                             UInt16 MaxAdminStatusListSize  = VirtualEVSE.DefaultMaxAdminStatusListSize,
                                             UInt16 MaxStatusListSize       = VirtualEVSE.DefaultMaxStatusListSize,
                                             Action <EVSE> EVSEConfigurator = null,
                                             Action <VirtualEVSE> VirtualEVSEConfigurator = null,
                                             Action <EVSE> OnSuccess = null,
                                             Action <ChargingStation, EVSE_Id> OnError = null)
        {
            #region Initial checks

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

            #endregion

            return(ChargingStation.CreateEVSE(EVSEId,
                                              EVSEConfigurator,
                                              newevse => {
                var virtualevse = new VirtualEVSE(newevse.Id,
                                                  ChargingStation.RoamingNetwork,
                                                  Description,
                                                  InitialAdminStatus,
                                                  InitialStatus,
                                                  EnergyMeterId,
                                                  EllipticCurve,
                                                  PrivateKey,
                                                  PublicKeyCertificates,
                                                  SelfCheckTimeSpan,
                                                  MaxAdminStatusListSize,
                                                  MaxStatusListSize);

                VirtualEVSEConfigurator?.Invoke(virtualevse);

                return virtualevse;
            },

                                              OnSuccess: OnSuccess,
                                              OnError:   OnError));
        }
示例#5
0
        /// <summary>
        /// Check if the given enumeration of EVSEs and their current status
        /// contains the given pair of EVSE identification and status.
        /// </summary>
        /// <param name="EVSEStatus">An enumeration of EVSEs and their current status.</param>
        /// <param name="Id">An EVSE identification.</param>
        /// <param name="Status">An EVSE status.</param>
        public static Boolean Contains(this IEnumerable <EVSEStatus> EVSEStatus,
                                       EVSE_Id Id,
                                       EVSEStatusTypes Status)
        {
            foreach (var status in EVSEStatus)
            {
                if (status.Id == Id &&
                    status.Status == Status)
                {
                    return(true);
                }
            }

            return(false);
        }
示例#6
0
        /// <summary>
        /// Convert a WWCP EVSE status into an eMIP EVSE busy status.
        /// </summary>
        /// <param name="EVSEStatusType"></param>
        /// <returns></returns>
        public static EVSEBusyStatusTypes ToEMIP(this EVSEStatusTypes EVSEStatusType)
        {
            switch (EVSEStatusType)
            {
            case EVSEStatusTypes.Available:
                return(EVSEBusyStatusTypes.Free);

            case EVSEStatusTypes.Reserved:
                return(EVSEBusyStatusTypes.Reserved);

            // case EVSEStatusTypes.Charging:
            // case EVSEStatusTypes.DoorNotClosed:
            // case EVSEStatusTypes.Faulted:
            // case EVSEStatusTypes.Offline:
            // case EVSEStatusTypes.OutOfService:
            // case EVSEStatusTypes.PluggedIn:
            // case EVSEStatusTypes.WaitingForPlugin:

            default:
                return(EVSEBusyStatusTypes.Busy);
            }
        }
示例#7
0
 /// <summary>
 /// Set the status.
 /// </summary>
 /// <param name="NewStatus">A new status.</param>
 /// <param name="Timestamp">The timestamp when this change was detected.</param>
 public void SetStatus(EVSEStatusTypes NewStatus,
                       DateTime Timestamp)
 {
     _StatusSchedule.Insert(NewStatus, Timestamp);
 }
示例#8
0
 /// <summary>
 /// Set the current status.
 /// </summary>
 /// <param name="NewStatus">A new status.</param>
 public void SetStatus(EVSEStatusTypes NewStatus)
 {
     _StatusSchedule.Insert(NewStatus);
 }