CgwMonitorManage.T28181.SipStackAdapter.GetDeviceItem C# (CSharp) Method

GetDeviceItem() private static method

根据消息体解析设备
private static GetDeviceItem ( string strBody ) : void
strBody string 查询返回的消息
return void
        private static void GetDeviceItem(string strBody)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: SipStackAdapter.GetDeviceItem().");

            //解析返回的XML数据返回数据对象
            XmlNode node = XmlUtil.ProcessResponseMsg(strBody, "DeviceList");
            List<DeviceItem> list = XmlUtil.DeserializeToList<DeviceItem>(node);

            if (list == null)
            {
                return;
            }

            try
            {
                foreach (DeviceItem item in list)
                {
                    if (!deviceList.Contains(item, new DeviceItemCompare()))
                    {
                        deviceList.Add(item);
                    }
                    else
                    {
                        logEx.Warn("SipStackAdapter.GetDeviceItem DeviceItem.DeviceID = {0} duplicate", item.DeviceID);
                        return;
                    }
                }

                //获取数据完成
                if (deviceNum == deviceList.Count)
                {
                    if (ReceivedAllDevice != null)
                    {
                        logEx.Trace("SipStackAdapter.GetDeviceItem Start ReceivedAllDevice");
                        // 接收完所有设备,通知上层处理单元
                        ReceivedAllDevice(null, null);

                        //回收系统内存
                        GC.Collect();
                        GC.WaitForFullGCComplete(CgwConst.Thread_Sleep_Time);
                    }
                }
            }
            catch (System.Exception ex)
            {
                logEx.Error("SipStackAdapter Get all cameras failed.Execption message:{0}", ex.Message);
            }
        }