Пример #1
0
        public static List<PDS> decodeXml(XmlDocument xmlDoc)
        {
            XmlNode Attr = xmlDoc.SelectSingleNode("//Attribute");
            foreach(XmlNode node in Attr.ChildNodes )
            {
                IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(node["IPAddress"].InnerText), 6038 );

                PDS60Ca pds = new PDS60Ca(Network.GetInstance(), endPoint);

            }
            return null;
        }
Пример #2
0
        private void HandleCallback(IAsyncResult result)
        {
            NetworkState state = (NetworkState)result.AsyncState;
            state.Socket.EndReceive(result);
            IPEndPoint newDevice = new IPEndPoint(GetAddressFromResponse(state.Buffer), 6038);

            String model = GetModelFromResponse(state.Buffer);
            PDS pds;
            if(model.Equals("SPDS-480ca"))
                pds = new PDS480Ca(this, newDevice);
            else if(model.Equals("PDS-60ca"))
                pds = new PDS60Ca(this, newDevice);
            else
              throw new InvalidOperationException("No handler available for PDS type: " + model);

            if (!_pdss.Contains(pds))
                _pdss.Add(pds);
            Console.WriteLine("Found Device '" + model + "' at endpoint:" + newDevice);
        }