Beispiel #1
0
        /// <summary>
        /// Check if the given enumeration of charging stations and their current status
        /// contains the given pair of charging station identification and status.
        /// </summary>
        /// <param name="ChargingStationStatus">An enumeration of charging stations and their current status.</param>
        /// <param name="Id">An charging station identification.</param>
        /// <param name="Status">An charging station status.</param>
        public static Boolean Contains(this IEnumerable <ChargingStationStatus> ChargingStationStatus,
                                       ChargingStation_Id Id,
                                       ChargingStationStatusTypes Status)
        {
            foreach (var status in ChargingStationStatus)
            {
                if (status.Id == Id &&
                    status.Status == Status)
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// Create a new virtual charging station.
        /// </summary>
        /// <param name="ChargingPool">A charging pool.</param>
        /// <param name="ChargingStationId">The charging station identification for the charging station to be created.</param>
        /// <param name="ChargingStationConfigurator">An optional delegate to configure the new (local) charging station.</param>
        /// <param name="VirtualChargingStationConfigurator">An optional delegate to configure the new virtual charging station.</param>
        /// <param name="OnSuccess">An optional delegate for reporting success.</param>
        /// <param name="OnError">An optional delegate for reporting an error.</param>
        public static ChargingStation CreateVirtualStation(this ChargingPool ChargingPool,
                                                           ChargingStation_Id ChargingStationId,
                                                           I18NString Description = null,
                                                           ChargingStationAdminStatusTypes InitialAdminStatus = ChargingStationAdminStatusTypes.Operational,
                                                           ChargingStationStatusTypes InitialStatus           = ChargingStationStatusTypes.Available,
                                                           String EllipticCurve = "P-256",
                                                           ECPrivateKeyParameters PrivateKey           = null,
                                                           PublicKeyCertificates PublicKeyCertificates = null,
                                                           TimeSpan?SelfCheckTimeSpan    = null,
                                                           UInt16 MaxAdminStatusListSize = VirtualChargingStation.DefaultMaxAdminStatusListSize,
                                                           UInt16 MaxStatusListSize      = VirtualChargingStation.DefaultMaxStatusListSize,
                                                           Action <ChargingStation> ChargingStationConfigurator = null,
                                                           Action <VirtualChargingStation> VirtualChargingStationConfigurator = null,
                                                           Action <ChargingStation> OnSuccess = null,
                                                           Action <ChargingPool, ChargingStation_Id> OnError = null)
        {
            #region Initial checks

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

            #endregion

            return(ChargingPool.CreateChargingStation(ChargingStationId,
                                                      ChargingStationConfigurator,
                                                      newstation => {
                var virtualstation = new VirtualChargingStation(newstation.Id,
                                                                ChargingPool.RoamingNetwork,
                                                                Description,
                                                                InitialAdminStatus,
                                                                InitialStatus,
                                                                EllipticCurve,
                                                                PrivateKey,
                                                                PublicKeyCertificates,
                                                                SelfCheckTimeSpan,
                                                                MaxAdminStatusListSize,
                                                                MaxStatusListSize);

                VirtualChargingStationConfigurator?.Invoke(virtualstation);

                return virtualstation;
            },

                                                      OnSuccess: OnSuccess,
                                                      OnError:   OnError));
        }