private void GetAllCamerasTimer(object sender, System.Timers.ElapsedEventArgs e)
{
//查询设备未完成,需要阻塞直到查询结束
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: T28181VideoMonitor.GetAllCamerasTimer().");
try
{
//获取设备列表
sipStack.GetDeviceList(username, deviceID);
//开始计时
stopwatch.Start();
//查询结束或者超时时结束等待
while (!getDeviceEndFlg && stopwatch.ElapsedMilliseconds < iQueryDeviceTimeOut )
{
Thread.Sleep(CgwConst.Thread_Sleep_Time);
}
if (stopwatch.ElapsedMilliseconds >= iQueryDeviceTimeOut)
{
logEx.Warn("GetAllCamerasTimer Timeout");
}
}
catch (System.Exception ex)
{
logEx.Error("GetAllCamerasTimer failed.Exception message:{0}", ex.Message);
}
finally
{
//停止计时、获取设备完成标志复位
stopwatch.Stop();
getDeviceEndFlg = false;
logEx.Info("cameraList.{0}", cameraList.Count);
logEx.Info("groupList.{0}", groupList.Count);
logEx.Info("nodeRelationList.{0}", nodeRelationList.Count);
logEx.Trace("Leave: T28181VideoMonitor.GetAllCamerasTimer().");
}
}