public void AddOrUpdateCSInfo(String ChargingStationXMLId, EVSE_Id EVSEId) { var ExCSInfos = ChargingStationXMLId.IsNotNullOrEmpty() ? _ChargingStations. FirstOrDefault(CSInfo => CSInfo.StationXMLId == ChargingStationXMLId) : _ChargingStations. FirstOrDefault(CSInfo => CSInfo.StationId == WWCP.ChargingStation_Id.Create(EVSEId.ToWWCP().Value)); if (ChargingStationXMLId.IsNullOrEmpty()) { } if (ExCSInfos == null) { AddCSInfo(ChargingStationXMLId.IsNotNullOrEmpty() ? ChargingStationXMLId : WWCP.ChargingStation_Id.Create(EVSEId.ToWWCP().Value).ToString(), EVSEId); } else { ExCSInfos.AddEVSEId(EVSEId); Check(); } }
private void AddCSInfo(String ChargingStationXMLId, EVSE_Id EVSEId) { var _CSInfo = new ChargeStationInfo(this, ChargingStationXMLId, EVSEId); this._ChargingStations.Add(_CSInfo); Check(); }
/// <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; }
public ChargeStationInfo(ChargingPoolInfo ChargePoolInfo, String StationXMLId, EVSE_Id EVSEId) { #region Initial checks if (ChargePoolInfo == null) { throw new ArgumentNullException(nameof(ChargePoolInfo), "The given charging pool information must not be null!"); } #endregion this.ChargePoolInfo = ChargePoolInfo; this.StationXMLId = StationXMLId ?? ""; this._EVSEIds = new List <EVSE_Id> { EVSEId }; Check(); }
public Boolean Contains(EVSE_Id EVSEId) => _EVSEs.ContainsKey(EVSEId);
public void Check() { if (_StationId.HasValue) { return; } EVSE_Id __EVSEId; WWCP.ChargingStation_Id __StationId; // 1st: Try to use the given ChargingStationId from the XML... if (WWCP.ChargingStation_Id.TryParse(StationXMLId, out __StationId)) { _StationId = __StationId; } else if (EVSE_Id.TryParse(StationXMLId, out __EVSEId)) { _StationId = WWCP.ChargingStation_Id.Parse(WWCP.ChargingStation_Id.Parse(__EVSEId.OperatorId.ToWWCP().Value, __EVSEId.Suffix).ToString()); } else if (StationXMLId.StartsWith(_EVSEIds[0].OperatorId.ToWWCP().Value.ToString(WWCP.OperatorIdFormats.DIN), StringComparison.Ordinal)) { if (WWCP.ChargingStation_Id.TryParse(_EVSEIds[0].OperatorId.ToWWCP().Value.ToString(WWCP.OperatorIdFormats.DIN) + "S" + StationXMLId.Substring(_EVSEIds[0].OperatorId.ToWWCP().Value.ToString(WWCP.OperatorIdFormats.DIN).Length + 1), out __StationId)) { _StationId = __StationId; } } else if (StationXMLId.StartsWith(_EVSEIds[0].OperatorId.ToWWCP().Value.ToString(WWCP.OperatorIdFormats.ISO), StringComparison.Ordinal)) { if (WWCP.ChargingStation_Id.TryParse(_EVSEIds[0].OperatorId.ToWWCP().Value.ToString(WWCP.OperatorIdFormats.ISO) + "S" + StationXMLId.Substring(_EVSEIds[0].OperatorId.ToWWCP().Value.ToString(WWCP.OperatorIdFormats.ISO).Length + 1), out __StationId)) { _StationId = __StationId; } } else if (StationXMLId.StartsWith(_EVSEIds[0].OperatorId.ToWWCP().Value.ToString(WWCP.OperatorIdFormats.ISO_STAR), StringComparison.Ordinal)) { if (WWCP.ChargingStation_Id.TryParse(_EVSEIds[0].OperatorId.ToWWCP().Value.ToString(WWCP.OperatorIdFormats.ISO_STAR) + "S" + StationXMLId.Substring(_EVSEIds[0].OperatorId.ToWWCP().Value.ToString(WWCP.OperatorIdFormats.ISO_STAR).Length + 2), out __StationId)) { _StationId = __StationId; } } // 2nd: Try to use a modified StationXML Id... if (!_StationId.HasValue && StationXMLId.IsNotNullOrEmpty()) { _StationId = WWCP.ChargingStation_Id.Parse(_EVSEIds[0].OperatorId.ToWWCP().Value, InvalidCharactersRegEx.Replace(MappedCharactersRegEx.Replace(StationXMLId.ToUpper(), "*"), "").SubstringMax(50)); } // 3rd: Try to use the given EVSE Ids to find a common prefix... if (!_StationId.HasValue && StationXMLId.IsNullOrEmpty()) { _StationId = WWCP.ChargingStation_Id.Create(_EVSEIds.Select(evse => evse.ToWWCP().Value)); } if (!_StationId.HasValue) { } }
public void AddEVSEId(EVSE_Id EVSEId) { this._EVSEIds.Add(EVSEId); Check(); }