private void LoadNeighbourTable(GXXmlReader reader) { List <GXDLMSNeighbourTable> list = new List <Objects.GXDLMSNeighbourTable>(); if (reader.IsStartElement("NeighbourTable", true)) { while (reader.IsStartElement("Item", true)) { GXDLMSNeighbourTable it = new GXDLMSNeighbourTable(); it.ShortAddress = (ushort)reader.ReadElementContentAsInt("ShortAddress"); it.Enabled = reader.ReadElementContentAsInt("Enabled") != 0; it.ToneMap = reader.ReadElementContentAsString("ToneMap"); it.Modulation = (Modulation)reader.ReadElementContentAsInt("Modulation"); it.TxGain = (sbyte)reader.ReadElementContentAsInt("TxGain"); it.TxRes = (GainResolution)reader.ReadElementContentAsInt("TxRes"); it.TxCoeff = reader.ReadElementContentAsString("TxCoeff"); it.Lqi = (byte)reader.ReadElementContentAsInt("Lqi"); it.PhaseDifferential = (sbyte)reader.ReadElementContentAsInt("PhaseDifferential"); it.TMRValidTime = (byte)reader.ReadElementContentAsInt("TMRValidTime"); it.NeighbourValidTime = (byte)reader.ReadElementContentAsInt("NeighbourValidTime"); list.Add(it); } reader.ReadEndElement("NeighbourTable"); } NeighbourTable = list.ToArray(); }
void IGXDLMSBase.SetValue(GXDLMSSettings settings, ValueEventArgs e) { if (e.Index == 1) { LogicalName = GXCommon.ToLogicalName(e.Value); } else if (e.Index == 2) { ShortAddress = Convert.ToUInt16(e.Value); } else if (e.Index == 3) { RcCoord = Convert.ToUInt16(e.Value); } else if (e.Index == 4) { PANId = Convert.ToUInt16(e.Value); } else if (e.Index == 5) { KeyTable.Clear(); if (e.Value != null) { foreach (object v in (object[])e.Value) { object[] tmp = (object[])v; KeyTable.Add(new GXKeyValuePair <byte, byte[]>(Convert.ToByte(tmp[0]), (byte[])tmp[1])); } } } else if (e.Index == 6) { FrameCounter = Convert.ToUInt32(e.Value); } else if (e.Index == 7) { ToneMask = (string)e.Value; } else if (e.Index == 8) { TmrTtl = Convert.ToByte(e.Value); } else if (e.Index == 9) { MaxFrameRetries = Convert.ToByte(e.Value); } else if (e.Index == 10) { NeighbourTableEntryTtl = Convert.ToByte(e.Value); } else if (e.Index == 11) { List <GXDLMSNeighbourTable> list = new List <GXDLMSNeighbourTable>(); if (e.Value != null) { foreach (object v in (object[])e.Value) { object[] tmp = (object[])v; GXDLMSNeighbourTable it = new GXDLMSNeighbourTable(); it.ShortAddress = Convert.ToUInt16(tmp[0]); it.Enabled = Convert.ToBoolean(tmp[1]); it.ToneMap = (string)tmp[2]; it.Modulation = (Modulation)Convert.ToInt32(tmp[3]); it.TxGain = Convert.ToSByte(tmp[4]); it.TxRes = (GainResolution)Convert.ToInt32(tmp[5]); it.TxCoeff = (string)tmp[6]; it.Lqi = Convert.ToByte(tmp[7]); it.PhaseDifferential = Convert.ToSByte(tmp[8]); it.TMRValidTime = Convert.ToByte(tmp[9]); it.NeighbourValidTime = Convert.ToByte(tmp[10]); list.Add(it); } } NeighbourTable = list.ToArray(); } else if (e.Index == 12) { HighPriorityWindowSize = Convert.ToByte(e.Value); } else if (e.Index == 13) { CscmFairnessLimit = Convert.ToByte(e.Value); } else if (e.Index == 14) { BeaconRandomizationWindowLength = Convert.ToByte(e.Value); } else if (e.Index == 15) { A = Convert.ToByte(e.Value); } else if (e.Index == 16) { K = Convert.ToByte(e.Value); } else if (e.Index == 17) { MinCwAttempts = Convert.ToByte(e.Value); } else if (e.Index == 18) { CenelecLegacyMode = Convert.ToByte(e.Value); } else if (e.Index == 19) { FccLegacyMode = Convert.ToByte(e.Value); } else if (e.Index == 20) { MaxBe = Convert.ToByte(e.Value); } else if (e.Index == 21) { MaxCsmaBackoffs = Convert.ToByte(e.Value); } else if (e.Index == 22) { MinBe = Convert.ToByte(e.Value); } else { e.Error = ErrorCode.ReadWriteDenied; } }