Cgw.T28181.T28181VideoMonitor.GetAllCameras C# (CSharp) Method

GetAllCameras() public method

获取摄像头列表及分组信息
public GetAllCameras ( bool fromMonitorSys, List &cameraList, List &groupList, List &nodeRelationList ) : SmcErr
fromMonitorSys bool
cameraList List 摄像头列表
groupList List 组信息
nodeRelationList List 分组关系
return Cgw.SmcError.SmcErr
        public SmcErr GetAllCameras(bool fromMonitorSys, out List<Camera> cameraList, out List<CameraGroup> groupList, out List<NodeRelation> nodeRelationList)
        {
            cameraList = new List<Camera>();
            groupList = new List<CameraGroup>();
            nodeRelationList = new List<NodeRelation>();

            for (int i = 1; i < 10000; i++)
            {
                Camera cs = new Camera("41552873131314642203" + i.ToString(), i.ToString());
                cs.DeviceType = "01";
                cs.Status = CameraStatus.Online;
                //cs.ParentID = "41552873135005642565";
                cameraList.Add(cs);
            }

            //CameraGroup group = new CameraGroup("41552873135005642565","group");
            //groupList.Add(group);

            //NodeRelation rea = new NodeRelation("41552873135005642565", new List<string>(), NodeType.GROUP);
            //nodeRelationList.Add(rea);

            for (int i = 1; i < 10000; i++)
            {
                NodeRelation rea1 = new NodeRelation("41552873131314642203" + i.ToString(), new List<string>(), NodeType.CAMERA);
                nodeRelationList.Add(rea1);
            }

            return new CgwError();

            //NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            //logEx.Trace("Enter: T28181VideoMonitor.GetAllCameras().");

            //SmcErr err = new CgwError();
            //cameraList = new List<Camera>();
            //groupList = new List<CameraGroup>();
            //nodeRelationList = new List<NodeRelation>();

            //if (fromMonitorSys)
            //{
            //    //开始查询设备列表
            //    Thread th = new Thread(new ThreadStart(()
            //        =>
            //    {
            //        GetAllCamerasTimer(null, null);
            //    }));
            //    th.Priority = ThreadPriority.Highest;
            //    th.Start();
            //    //等待结束查询
            //    th.Join();
            //}

            //if (this.cameraOperateLock.TryEnterReadLock(CgwConst.ENTER_LOCK_WAIT_TIME))
            //{
            //    try
            //    {
            //        #region 深度克隆数据
            //        foreach (Camera ivsCamera in this.cameraList)
            //        {
            //            //从缓存获取
            //            Camera camera = new Camera(ivsCamera.No, ivsCamera.Name);
            //            camera.Status = ivsCamera.Status;
            //            cameraList.Add(camera);
            //        }
            //        foreach (CameraGroup cameraGroup in this.groupList)
            //        {
            //            CameraGroup cameraGroupTemp = new CameraGroup(cameraGroup.No, cameraGroup.Name);
            //            groupList.Add(cameraGroupTemp);
            //        }
            //        foreach (NodeRelation nodeRelation in this.nodeRelationList)
            //        {
            //            NodeRelation nodeRelationTemp = new NodeRelation(nodeRelation.No, nodeRelation.Path, nodeRelation.Type);
            //            nodeRelationList.Add(nodeRelationTemp);
            //        }
            //        #endregion
            //    }
            //    catch (Exception e)
            //    {
            //        err.SetErrorNo(CgwError.GET_ALL_CAMERAS_FAILED);
            //        logEx.Error("Get all cameras failed.Execption message:{0}", e.Message);
            //        return err;
            //    }
            //    finally
            //    {
            //        this.cameraOperateLock.ExitReadLock();
            //    }
            //}
            //logEx.Info("cameraList.{0}", cameraList.Count);
            //logEx.Info("groupList.{0}", groupList.Count);
            //logEx.Info("nodeRelationList.{0}", nodeRelationList.Count);
            //logEx.Info("Get all cameras success.");
            //return err;
        }