GXMacPhyCommunication[] SetCommunications(IEnumerable <object> value) { List <GXMacPhyCommunication> data = new List <GXMacPhyCommunication>(); if (value != null) { foreach (object tmp in value) { List <object> it; if (tmp is List <object> ) { it = (List <object>)tmp; } else { it = new List <object>((object[])tmp); } GXMacPhyCommunication v = new GXMacPhyCommunication(); v.Eui = (byte[])it[0]; v.TxPower = Convert.ToSByte(it[1]); v.TxCoding = Convert.ToSByte(it[2]); v.RxCoding = Convert.ToSByte(it[3]); v.RxLvl = Convert.ToSByte(it[4]); v.Snr = Convert.ToSByte(it[5]); v.TxPowerModified = Convert.ToSByte(it[6]); v.TxCodingModified = Convert.ToSByte(it[7]); v.RxCodingModified = Convert.ToSByte(it[8]); data.Add(v); } } return(data.ToArray()); }
private GXMacPhyCommunication[] LoadCommunications(GXXmlReader reader) { List <GXMacPhyCommunication> list = new List <GXMacPhyCommunication>(); if (reader.IsStartElement("Communications", true)) { while (reader.IsStartElement("Item", true)) { GXMacPhyCommunication it = new GXMacPhyCommunication(); list.Add(it); it.Eui = GXCommon.HexToBytes(reader.ReadElementContentAsString("Eui")); it.TxPower = (sbyte)reader.ReadElementContentAsInt("TxPower"); it.TxCoding = (sbyte)reader.ReadElementContentAsInt("TxCoding"); it.RxCoding = (sbyte)reader.ReadElementContentAsInt("RxCoding"); it.RxLvl = (sbyte)reader.ReadElementContentAsInt("RxLvl"); it.Snr = (sbyte)reader.ReadElementContentAsInt("Snr"); it.TxPowerModified = (sbyte)reader.ReadElementContentAsInt("TxPowerModified"); it.TxCodingModified = (sbyte)reader.ReadElementContentAsInt("TxCodingModified"); it.RxCodingModified = (sbyte)reader.ReadElementContentAsInt("RxCodingModified"); } reader.ReadEndElement("Communications"); } return(list.ToArray()); }