CgwMonitorManage.T28181.T28181VideoMonitor.GetAllCamerasTimer C# (CSharp) Method

GetAllCamerasTimer() private method

获取摄像头列表及分组信息定时器 1、获取系统中所有的域 2、循环所有的域,查询域下面的分组,递归处理,获取节点关系 3、查询设备列表
private GetAllCamerasTimer ( object sender, System e ) : void
sender object
e System
return void
        private void GetAllCamerasTimer(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (getDeviceEndFlg)
            {
                getDeviceEndFlg = false;
                //查询设备未完成,需要阻塞直到查询结束
                System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();

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

                try
                {
                    //获取设备列表
                    sipStack.GetDeviceList(serverSignalGateway, deviceID);

                    //开始计时
                    stopwatch.Start();

                    //查询结束或者超时时结束等待
                    while (!getDeviceEndFlg && stopwatch.ElapsedMilliseconds < iQueryDeviceTimeOut)
                    {
                        Thread.Sleep(CgwConst.Thread_Sleep_Time);
                    }
                    if (stopwatch.ElapsedMilliseconds >= iQueryDeviceTimeOut)
                    {
                        logEx.Warn("GetAllCamerasTimer Timeout");
                        sipStack.isRefreshSucess = false;
                    }
                }
                catch (System.Exception ex)
                {
                    logEx.Error("GetAllCamerasTimer failed.Exception message:{0}", ex.Message);
                    sipStack.isRefreshSucess = false;
                }
                finally
                {
                    //停止计时、获取设备完成标志复位
                    stopwatch.Stop();
                    getDeviceEndFlg = true;

                    logEx.Debug("cameraList.{0}", cameraList.Count);
                    logEx.Debug("groupList.{0}", groupList.Count);
                    logEx.Debug("nodeRelationList.{0}", nodeRelationList.Count);
                    logEx.Debug("Leave: T28181VideoMonitor.GetAllCamerasTimer().");
                }
            }
        }