/// <summary> /// A copy method from one RadioPacketModel to the current /// </summary> /// <param name="Packet"></param> public void Copy(RadioBasicsModel Packet) { this.MACAddress = Packet.MACAddress; this.IPAddress = Packet.IPAddress; this.Gateway = Packet.Gateway; this.Netmask = Packet.Netmask; this.HTTPPort = Packet.HTTPPort; this.Password = Packet.Password; this.IsUpdateSent = Packet.IsUpdateSent; }
/// <summary> /// Parses the Answer type response UDP packet from a radio control /// </summary> /// <param name="packet">packet received from radio answer discovery</param> public static RadioBasicsModel ParseFinderPacket(byte[] packet) { RadioBasicsModel Info = new RadioBasicsModel(); int offset = 2; // Offset 2 MAC Address - 6 bytes Info.MACAddress = ParseMAC(packet, ref offset); // Offset 8 IP Address - 4 bytes Info.IPAddress = ParseIP(packet, ref offset).ToString(); // Offset 12 Gateway - 4 bytes Info.Gateway = ParseIP(packet, ref offset).ToString(); // Offset 16 Netmask - 4 bytes Info.Netmask = ParseIP(packet, ref offset).ToString(); // Offset 20 HTTP Port - 2 bytes Info.HTTPPort = BitConverter.ToUInt16(packet, offset); offset += 2; // Offset 22 Password - 32 bytes Info.Password = ASCIIEncoding.ASCII.GetString(packet, offset, 32); return Info; }