public void SetDataCallBackFunc(DataCallBack dataCallBack)
{
NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
logEx.Trace("Enter: VideoMonitorManage.SetVideoDataCallBackFunc({0})", dataCallBack);
//向上回调,平台管理接到码流后,对摄像头编号加上平台标识,再执行回调转发码流
this.dataCallBack = dataCallBack;
//向下注册回调,在该回调函数VideoDataCallBackFunc内要先对摄像头编号加上平台标识
DataCallBack callBack = this.DataCallBackFunc;
if (this.monitorsOperateLock.TryEnterReadLock(CgwConst.ENTER_LOCK_WAIT_TIME))
{
try
{
foreach (KeyValuePair<string, IVideoMonitor> monitor in monitorsDictionary)
{
IVideoMonitor videoMonitor = monitor.Value;
videoMonitor.SetDataCallBackFunc(callBack, monitor.Key);
}
}
catch (Exception e)
{
logEx.Error("Set VideoDataCallBackFunc failed.Execption message:{0}", e.Message);
}
finally
{
this.monitorsOperateLock.ExitReadLock();
}
}
logEx.Trace("Set VideoDataCallBackFunc success.");
}