Example #1
0
        private void SocketDataReceived(object sender, DataReceivedEventArgs e)
        {
            string response = Encoding.UTF8.GetString(e.Data);
            var    xmldoc   = new System.Xml.XmlDocument();

            xmldoc.LoadXml(response);

            if (xmldoc.DocumentElement.Name != "LogicBox")
            {
                return;
            }

            var protoAttr = xmldoc.DocumentElement.Attributes["protocol"];

            if ((protoAttr == null) || (protoAttr.Value != "MCP V3.0"))
            {
                return;
            }

            var macAttr = xmldoc.DocumentElement.Attributes["mac"];

            if (macAttr == null)
            {
                return;
            }

            var    hostName = e.RemoteAddress;
            string mac      = macAttr.Value.Replace(":", "");

            if (this.AlreadyDiscovered(mac))
            {
                return;
            }

            var conn = new HoermannClient(e.RemoteAddress, "4000", mac);

            this.AddDevice(mac, conn);
        }
Example #2
0
 internal HoermannDevice(HoermannAdapter adapter, HoermannClient conn, string Name, string VendorName, string Model, string Version, string SerialNumber, string Description)
     : base(adapter, Name, VendorName, Model, Version, SerialNumber, Description)
 {
     _conn = conn;
 }