/// <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)); }
/// <summary> /// Create a new virtual charging pool. /// </summary> /// <param name="ChargingStationOperator">A charging station operator.</param> /// <param name="ChargingPoolId">The charging station identification for the charging station to be created.</param> /// <param name="ChargingPoolConfigurator">An optional delegate to configure the new (local) charging station.</param> /// <param name="VirtualChargingPoolConfigurator">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 ChargingPool CreateVirtualPool(this ChargingStationOperator ChargingStationOperator, ChargingPool_Id ChargingPoolId, I18NString Description = null, ChargingPoolAdminStatusTypes InitialAdminStatus = ChargingPoolAdminStatusTypes.Operational, ChargingPoolStatusTypes InitialStatus = ChargingPoolStatusTypes.Available, String EllipticCurve = "P-256", ECPrivateKeyParameters PrivateKey = null, PublicKeyCertificates PublicKeyCertificates = null, TimeSpan?SelfCheckTimeSpan = null, UInt16 MaxAdminStatusListSize = VirtualChargingPool.DefaultMaxAdminStatusListSize, UInt16 MaxStatusListSize = VirtualChargingPool.DefaultMaxStatusListSize, Action <ChargingPool> ChargingPoolConfigurator = null, Action <VirtualChargingPool> VirtualChargingPoolConfigurator = null, Action <ChargingPool> OnSuccess = null, Action <ChargingStationOperator, ChargingPool_Id> OnError = null) { #region Initial checks if (ChargingStationOperator == null) { throw new ArgumentNullException(nameof(ChargingStationOperator), "The given charging station operator must not be null!"); } #endregion return(ChargingStationOperator.CreateChargingPool(ChargingPoolId, ChargingPoolConfigurator, newstation => { var virtualstation = new VirtualChargingPool(newstation.Id, ChargingStationOperator.RoamingNetwork, Description, InitialAdminStatus, InitialStatus, EllipticCurve, PrivateKey, PublicKeyCertificates, SelfCheckTimeSpan, MaxAdminStatusListSize, MaxStatusListSize); VirtualChargingPoolConfigurator?.Invoke(virtualstation); return virtualstation; }, OnSuccess: OnSuccess, OnError: OnError)); }