/// <summary> /// 重发关键帧 /// </summary> /// <param name="cameraNo">摄像头编号</param> /// <returns></returns> public SmcErr MakeIFrame(string cameraNo) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); logEx.Trace("Enter: VideoMonitorManage.MakeIFrame({0}).", cameraNo); IVideoMonitor videoMonitor; string decodedCameraNo; SmcErr err = DecoderCameraNo(cameraNo, out decodedCameraNo, out videoMonitor); if (err.IsSuccess()) { err = videoMonitor.MakeIFrame(decodedCameraNo); if (err.IsSuccess()) { logEx.Info("Make I Frame success.Camera no:{0}.", cameraNo); } else { logEx.Error("Make I Frame failed.Camera no:{0},Error Code:{1}.", cameraNo, err.ErrNo); } } else { logEx.Error("Make I Frame failed. Camera no is not found.Camera no:{0}.", cameraNo); } return(err); }
/// <summary> /// 停止云台控制,摄像头控制 /// </summary> /// <param name="cameraNo">摄像头编号</param> /// <param name="ptzCommandType">命令类型</param> /// <returns></returns> public SmcErr StopControlPtz(string cameraNo, PtzCommandType ptzCommandType) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); logEx.Trace("Enter: VideoMonitorManage.StopControlPtz({0}).", cameraNo); IVideoMonitor videoMonitor; string decodedCameraNo; SmcErr err = DecoderCameraNo(cameraNo, out decodedCameraNo, out videoMonitor); if (err.IsSuccess()) { err = videoMonitor.StopControlPtz(decodedCameraNo, ptzCommandType); if (err.IsSuccess()) { logEx.Info("Stop control ptz success.Camera no:{0},ptzCommandType:{1}.", cameraNo, ptzCommandType); } else { logEx.Error("Stop control ptz failed.Camera no:{0},ptzCommandType:{1},Error Code:{1} ", cameraNo, ptzCommandType, err.ErrNo); } } else { logEx.Error("Stop control ptz failed. Camera no is not found.Camera no:{0}.", cameraNo); } return(err); }
/// <summary> /// 设置摄像头麦克风状态 /// </summary> /// <param name="cameraNo">摄像头编号</param> /// <param name="isOn">麦克风是否开启</param> /// <returns></returns> public SmcErr SetMic(string cameraNo, bool isOn) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); logEx.Trace("Enter: VideoMonitorManage.SetMic({0},{1}).", cameraNo, isOn); IVideoMonitor videoMonitor; string decodedCameraNo; SmcErr err = DecoderCameraNo(cameraNo, out decodedCameraNo, out videoMonitor); if (err.IsSuccess()) { err = videoMonitor.SetMic(decodedCameraNo, isOn); if (err.IsSuccess()) { logEx.Info("Set camera Mic status success.Camera no:{0}, isOn:{1}.", cameraNo, isOn); } else { logEx.Error("Set camera Mic status failed. Camera no:{0}, isOn:{1}, Error Code:{2} ", cameraNo, isOn, err.ErrNo); } } else { logEx.Error("Set camera Mic status failed.Camera no is not found.Camera no:{0}, isOn:{1}.", cameraNo, isOn); } return(err); }
/// <summary> /// 停止预览 /// </summary> /// <param name="cameraNo">摄像头编号</param> /// <returns>返回错误码</returns> public SmcErr StopReceiveVideo(string cameraNo) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); logEx.Trace("Enter: VideoMonitorManage.StopReceiveVideo({0}).", cameraNo); IVideoMonitor videoMonitor; string decodedCameraNo; SmcErr err = DecoderCameraNo(cameraNo, out decodedCameraNo, out videoMonitor); if (err.IsSuccess()) { err = videoMonitor.StopReceiveVideo(decodedCameraNo); if (err.IsSuccess()) { logEx.Info("Stop receive camera video data success.Camera no:{0}.", cameraNo); } else { logEx.Error("Stop receive camera video data failed.Camera no:{0},Error Code:{1} ", cameraNo, err.ErrNo); } } else { logEx.Error("Stop receive camera video data failed.Camera no is not found.Camera no:{0}.", cameraNo); } return(err); }
/// <summary> /// 设置监控通道视频源 /// </summary> /// <param name="channelLabel">通道label</param> /// <param name="cameraNo">摄像头NO</param> /// <returns></returns> public SmcErr SwitchChannelVideoSource(string channelLabel, string cameraNo) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); SmcErr err = new SmcErr(); if (serviceControl.MonitorServiceRun()) { if (!string.IsNullOrEmpty(channelLabel)) { //切换通道关联 err = manageChannel.SwitchChannelRelation(channelLabel, cameraNo); } else { //监控通道号不能为空 err.SetErrorNo(CgwError.ERR_CGW_BUSINESS_CHANNELNO_NULL); } } else { err.SetErrorNo(Cgw.SmcError.CgwError.ERR_MONITOR_MANAGE_SERVICE_RESTARTING); } //日志记录 if (err.IsSuccess()) { logEx.Trace("SwitchChannelVideoSource Successful"); } else { logEx.Error("SwitchChannelVideoSource failed,ErrNo :{0}", err.ErrNo); } return(err); }
/// <summary> /// 分配监控通道 /// </summary> /// <param name="ChannelInfoList"></param> /// <returns></returns> public SmcErr AssignMonitorChannel(List <Common.ChannelInfo> ChannelInfoList) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); SmcErr err = new SmcErr(); if (serviceControl.MonitorServiceRun()) { err = manageChannel.AssignChannel(ChannelInfoList); } else { err.SetErrorNo(Cgw.SmcError.CgwError.ERR_MONITOR_MANAGE_SERVICE_RESTARTING); } //日志记录 if (err.IsSuccess()) { logEx.Trace("AssignMonitorChannel Successful"); } else { logEx.Error("AssignMonitorChannel failed,ErrNo :{0}", err.ErrNo); } return(err); }
/// <summary> /// 线程加载监控平台 /// </summary> private static void LoadMonitorTimer_Elapsed() { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); System.Threading.Thread.Sleep(1000); SmcErr smcErr = new SmcErr(); try { smcErr = CgwService.Instance().Load(); if (false == smcErr.IsSuccess()) { logEx.Error("CGW service Start failed! Errno :{0}", smcErr.ErrNo); NLog.LogManager.Flush(); System.Diagnostics.Process.GetCurrentProcess().Kill(); } else { logEx.Info("CGW service Start Success"); } } catch (Exception ex) { logEx.Fatal(ex, "CGW service LoadMonitor Failed!"); NLog.LogManager.Flush(); } }
/// <summary> /// 获取监控设备列表,返回摄像头基本信息,组基本信息,所属分组关系信息 /// </summary> public SmcErr QueryMonitorCamera(Cgw.Common.PlatformType platformType, Cgw.Common.PageParam pageParam, out List <Common.Camera> CameraInfoList, out List <Common.CameraGroup> CameraGroupList, out List <Common.NodeRelation> nodeRelationList, out Cgw.Common.PagesInfo pagesInfo) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); SmcErr err = new SmcErr(); CameraInfoList = null; CameraGroupList = null; nodeRelationList = null; pagesInfo = null; if (serviceControl.MonitorServiceRun()) { try { err = CgwMonitorManageAdapter.Instance().GetAllCameras(platformType, pageParam, out CameraInfoList, out CameraGroupList, out nodeRelationList, out pagesInfo, licenseInfo); } catch (Exception ex) { logEx.Trace("QueryMonitorCamera.Exception = {0}", ex.ToString()); } } else { err.SetErrorNo(Cgw.SmcError.CgwError.ERR_MONITOR_MANAGE_SERVICE_RESTARTING); } //日志记录 if (err.IsSuccess()) { logEx.Trace("QueryMonitorCamera Successful"); } else { logEx.Error("QueryMonitorCamera failed,ErrNo :{0}", err.ErrNo); } return(err); }
/// <summary> /// 加载监控平台,加载通道管理模块,加载license管理模块 /// </summary> /// <returns></returns> public SmcErr Load() { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); SmcErr err = new SmcErr(); //开启连接监控平台线程 this.connectMonitorManageServiceThread = new Thread(new ThreadStart(ConnectMonitorManageServiceTimer)); this.connectMonitorManageServiceThread.Start(); logEx.Info("ConnectMonitorManageServiceTimer Run"); //初始话定时器 this.monitorManageServiceKeepLiveTimer.AutoReset = true; this.monitorManageServiceKeepLiveTimer.Elapsed += new ElapsedEventHandler(MonitorManageServiceKeepLiveTimer_Elapsed); //保活时间间隔,5秒 this.monitorManageServiceKeepLiveTimer.Interval = CgwConst.MONITOR_MANAGE_KEEPLIVE_WAIT_TIME; this.monitorManageServiceKeepLiveTimer.Start(); manageChannel = new MonitorChannelRelationManager(); try { IPAddressEx ip = new IPAddressEx(ConfigSettings.CgwServiceIp); } catch (System.Exception ex) { logEx.Error("CgwService configuration files is error ,The IP address format is error,Please Check this configuration files! " + ex.ToString()); err.SetErrorNo(CgwError.ERR_CGW_CONFIGURE_FORMAT); } if (err.IsSuccess()) { InitSotParam param = new InitSotParam(); param.cgwIp = ConfigSettings.CgwServiceIp; param.audioType = ConfigSettings.CgwAudioProtocol; param.channelCallPort = ConfigSettings.CgwChanelCallPort; param.rtpStartPort = ConfigSettings.CgwChannelRTPStartPort; param.rtpPortCount = ConfigSettings.CgwChannelRTPPortCount; err = manageChannel.Init(param); } if (err.IsSuccess()) { logEx.Info("CgwServiceLoad Successful !"); } else { logEx.Error("CgwServiceLoad failed,ErrNo :{0}", err.ErrNo); } return(err); }
/// <summary> /// 记录操作日志 /// </summary> /// <param name="operateName">操作名称</param> /// <param name="err">错误码</param> public void RecordOperateLog(string operateName, SmcErr err) { if (err.IsSuccess()) { this.Info("{0} Succeed", operateName); } else { this.Error("{0} Failed,ErrNo:{1}", operateName, err.ErrNo); } }
/// <summary> /// Disconnect monitorPlat /// </summary> /// <returns></returns> public Cgw.SmcError.SmcErr DisconnectMonitor() { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); SmcErr err = new SmcErr(); err = MonitorChannelBll.Instance().Disconnect(); if (err.IsSuccess()) { logEx.Info("CgwService.Disconnect Successful !"); } return(err); }
/// <summary> /// 连接监控通道 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ConnectMonitorManageServiceTimer() { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); SmcErr err = new SmcErr(); while (true) { try { if (isNeedConnect) { //err = CgwMonitorManageAdapter.Instance().Connect(CommonFunction.SHA256Encrypt(ConfigSettings.ConnectMonitorManagePassword)); err = CgwMonitorManageAdapter.Instance().Connect(null); if (err.IsSuccess()) { logEx.Info("Load MonitorManageService Successful !"); isNeedConnect = false; isNeedKeepAliver = true; Thread th = new Thread(new ThreadStart(() => { while (true) { //建立连接后,需要查看监控通道关系中是否存在开启的视频,如果存在,需要重新打开视频 SmcErr refreshStatus = new SmcErr(); GetRefreshStatus(out refreshStatus); if (refreshStatus.ErrNo == Cgw.SmcError.CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END) { Thread.Sleep(1500); manageChannel.ReChannelVideo(); break; } Thread.Sleep(1000); } })); th.Start(); } } } catch (System.Exception ex) { logEx.Error("Load MonitorManageService.Exception = {0}", ex.ToString()); } finally { Thread.Sleep(CgwConst.CONNECT_MONITOR_MANAGE_WAIT_TIME); } } }
/// <summary> /// 刷新监控摄像头列表 /// </summary> /// <returns></returns> public SmcErr RefreshMonitorCamera() { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); logEx.Trace("Enter: VideoMonitorManage.RefreshMonitorCamera."); SmcErr err = new SmcErr(); //copy 一份,防止长时间占用锁 Dictionary <string, IVideoMonitor> monitorsDictionaryTemp = null; if (this.monitorsOperateLock.TryEnterReadLock(CgwConst.ENTER_LOCK_WAIT_TIME)) { try { monitorsDictionaryTemp = new Dictionary <string, IVideoMonitor>(monitorsDictionary); } catch (Exception e) { logEx.Error("RefreshMonitorCamera failed.Execption message:{0}", e.Message); } finally { this.monitorsOperateLock.ExitReadLock(); } } if (monitorsDictionaryTemp == null) { //记录日志,获取*监控平台的摄像头列表失败 logEx.Error("RefreshMonitorCamera from monitor failed.No any monitor."); err.SetErrorNo(CgwError.ERR_REFRESH_MONITOR_CAMERA_FAIL); return(err); } //循环已加载的所有的监控平台,将所有摄像头和分组组成一个list返回 foreach (KeyValuePair <string, IVideoMonitor> monitor in monitorsDictionaryTemp) { IVideoMonitor videoMonitor = monitor.Value; err = videoMonitor.RefreshMonitorCamera(); if (err.IsSuccess()) { logEx.Info("RefreshMonitorCamera success."); } else { logEx.Error("RefreshMonitorCamera failed."); err.SetErrorNo(CgwError.ERR_REFRESH_MONITOR_CAMERA_FAIL); break; } } return(err); }
/// <summary> /// 初始化融合网管服务 /// </summary> public void InitService() { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); //初始化监控平台 SmcErr err = new SmcErr(); err = MonitorChannelBll.Instance().LoadMonitor(); if (err.IsSuccess()) { logEx.Trace("Load VideoMonitor Successful !"); } else { logEx.Fatal("Load VideoMonitor Failed, ErrNo : {0}!", err.ErrNo); } }
/// <summary> /// Disconnect monitorPlat /// </summary> /// <returns></returns> public Cgw.SmcError.SmcErr Disconnect() { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); SmcErr err = new SmcErr(); //2015/2/13 停止服务,将状态重新赋值 isNeedKeepAliver = false; isNeedConnect = false; logEx.Info("Bll.Disconnect set isNeedKeepAliver=false,isNeedConnect=false."); err = CgwMonitorManageAdapter.Instance().Disconnect(); if (err.IsSuccess()) { logEx.Info("Bll.Disconnect Successful !"); } return(err); }
/// <summary> /// 线程Unload cgw /// </summary> /// <returns></returns> public SmcErr StopAllStream() { SmcErr err = new SmcErr(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); //Stop VideoData err = MonitorChannelBll.Instance().StopAllStream(); if (err.IsSuccess()) { logEx.Info("UnLoad CgwService Successful !"); } else { logEx.Fatal("UnLoad CgwService Failed, ErrNo : {0}!", err.ErrNo); } return(err); }
/// <summary> /// 获取控制项信息 /// </summary> /// <param name="err"></param> /// <param name="licMan"></param> private SmcErr GetControlLicItem(List <ConfigItem> configList) { LoggerEx logEx = new LoggerEx(log); SmcErr smcErr = new SmcErr(); CLicenseManagedAdapter licMan = new CLicenseManagedAdapter(); List <LKItemValue> licItemTypeList = new List <LKItemValue>(); smcErr = Convert2ErrNo(licMan.GetLicenseInfo(ref licItemTypeList)); if (smcErr.IsSuccess()) { licenseInfo.IsMonitorPlatform = false; licenseInfo.IsEltePlatform = false; foreach (LKItemValue item in licItemTypeList) { if (LicItemfType.LicItemMaxChannelNum == item.ItemID) { int licCountNew = Convert.ToInt32(item.ItemValue); if (licCount != licCountNew) { SessionManage.Instance().RemoveAllSession(); logEx.Trace("License have changed! the New Count is:{0}, the Old Count:{1} ", licCountNew.ToString(), licCount.ToString()); licCount = licCountNew; } } if (item.ItemID.ToString() == "LicItemMonitorEnable" && item.ItemValue.ToString() == "1") { licenseInfo.IsMonitorPlatform = true; } if (item.ItemID.ToString() == "LicItemELTEEnable" && item.ItemValue.ToString() == "1") { licenseInfo.IsEltePlatform = true; } logEx.Info("GetControlLicItem item:{0},{1}", item.ItemID, item.ItemValue); } } else { logEx.Warn("GetControlLicItem errNo:{0}", smcErr.ErrNo); } return(smcErr); }
/// <summary> /// 线程加载cgw /// </summary> /// <returns></returns> public SmcErr Load() { SmcErr err = new SmcErr(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); //初始化监控平台 err = MonitorChannelBll.Instance().Load(); if (err.IsSuccess()) { logEx.Trace("Load CgwService Successful !"); isLoadSuccess = true; } else { logEx.Fatal("Load CgwService Failed, ErrNo : {0}!", err.ErrNo); } return(err); }
/// <summary> /// 线程加载cgw /// </summary> /// <returns></returns> public SmcErr Load() { SmcErr err = new SmcErr(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); //初始化监控平台 err = VideoMonitorManage.Instance().Load(); VideoMonitorManage.Instance().SetDataCallBackFunc(DataCallBackFunc); if (err.IsSuccess()) { logEx.Trace("Load CgwMonitorManage Successful !"); isLoadSuccess = true; } else { logEx.Fatal("Load CgwMonitorManage Failed, ErrNo : {0}!", err.ErrNo); } return(err); }
/// <summary> /// 保活监控平台服务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void MonitorManageServiceKeepLiveTimer_Elapsed(object sender, ElapsedEventArgs e) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); SmcErr err = new SmcErr(); try { if (isNeedKeepAliver) { //Connect Monitor if (!serviceControl.MonitorServiceRun()) { isNeedConnect = true; //2015/2/13 Monitor服务不在线,将KeepAliver置为false,避免线程不断保活,待测试 isNeedKeepAliver = false; err.SetErrorNo(CgwError.ERR_MONITOR_MANAGE_SERVICE_RESTARTING); } else { err = CgwMonitorManageAdapter.Instance().KeepAliver(); } if (err.IsSuccess()) { logEx.Trace("MonitorManageServiceKeepLive Successful !"); } else { isNeedConnect = true; isNeedKeepAliver = false; logEx.Warn("MonitorManageServiceKeepLive Failed !"); } } } catch (System.Exception ex) { isNeedConnect = true; isNeedKeepAliver = false; logEx.Error("MonitorManageServiceKeepLive.Exception is {0}", ex.ToString()); } }
static void Main(string[] args) { SmcErr smcErr = new SmcErr(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); try { logEx.Info("Enter: Start Cgw Service"); CgwServiceInit cgwService = new CgwServiceInit(); smcErr = CgwService.Instance().InitService(); if (smcErr.IsSuccess()) { cgwService.InitServiceInfo(); string LocalServiceStartMode = CommonFunction.GetAppSetting("LocalServiceStartMode"); if (string.IsNullOrEmpty(LocalServiceStartMode)) { LocalServiceStartMode = "1"; } CgwService.Instance().LicenseInit(); Thread dbConnectionThread = new Thread(new ThreadStart(LoadMonitorTimer_Elapsed)); dbConnectionThread.Start(); ServiceRun.StarUpService(LocalServiceStartMode, "HUAWEI SMC 2.0 ConvergeGateway", cgwService); //logEx.Info("CGW service Start Successful!"); } else { logEx.Error("CGW service Start failed! Errno :{0}", smcErr.ErrNo); NLog.LogManager.Flush(); System.Diagnostics.Process.GetCurrentProcess().Kill(); } } catch (System.Exception e) { logEx.Fatal(e, "CGW service Start Failed!"); NLog.LogManager.Flush(); } }
/// <summary> /// 同步监控通道 /// </summary> /// <param name="ChannelInfoList"></param> /// <returns></returns> public SmcErr SyncMonitorChannel(ref List <Common.ChannelInfo> ChannelInfoList) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); SmcErr err = new SmcErr(); //if (serviceControl.MonitorServiceRun()) //{ err = manageChannel.SyncChannelInfo(ref ChannelInfoList, licCount); //} //else //{ // err.SetErrorNo(Cgw.SmcError.CgwError.ERR_MONITOR_MANAGE_SERVICE_RESTARTING); //} //日志记录 if (err.IsSuccess()) { logEx.Trace("SyncMonitorChannel Successful"); } else { logEx.Error("SyncMonitorChannel failed,ErrNo :{0}", err.ErrNo); } return(err); }
/// <summary> /// 注销监控平台资源 /// </summary> /// <returns></returns> public SmcErr Unload() { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); logEx.Info("Enter: VideoMonitorManage.Unload()."); SmcErr err = new CgwError(); if (this.monitorsOperateLock.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME)) { try { foreach (KeyValuePair <string, IVideoMonitor> monitor in monitorsDictionary) { IVideoMonitor videoMonitor = monitor.Value; SmcErr result = videoMonitor.Unload(); if (!result.IsSuccess()) { logEx.Error("Unload monitor failed.Monitor id:{0} ,Error code:{1}", monitor.Key, result.ErrNo); //一个失败,记录失败,继续其他平台卸载 err.SetErrorNo(result.ErrNo); continue; } } monitorsDictionary.Clear(); } catch (Exception e) { logEx.Error("Unload monitor failed..Execption message:{0}", e.Message); } finally { this.monitorsOperateLock.ExitWriteLock(); } } return(err); }
/// <summary> /// 获取监控摄像头列表刷新状态,返回结果为0是表示刷新完毕,为1是刷新操作中。当查询刷新状态为0时,可调用获取监控摄像头列表接口,获取刷新后监控摄像头列表 /// </summary> /// <returns></returns> public SmcErr GetRefreshStatus(out SmcErr refreshStatus) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); logEx.Trace("Enter: VideoMonitorManage.GetRefreshStatus."); refreshStatus = new SmcErr(); refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END; SmcErr err = new SmcErr(); //copy 一份,防止长时间占用锁 Dictionary <string, IVideoMonitor> monitorsDictionaryTemp = null; if (this.monitorsOperateLock.TryEnterReadLock(CgwConst.ENTER_LOCK_WAIT_TIME)) { try { monitorsDictionaryTemp = new Dictionary <string, IVideoMonitor>(monitorsDictionary); } catch (Exception e) { logEx.Error("GetRefreshStatus failed.Execption message:{0}", e.Message); } finally { this.monitorsOperateLock.ExitReadLock(); } } if (monitorsDictionaryTemp == null) { //记录日志,获取*监控平台的摄像头列表失败 logEx.Error("GetRefreshStatus from monitor failed.No any monitor."); err.SetErrorNo(CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED); return(err); } //循环已加载的所有的监控平台,将所有摄像头和分组组成一个list返回 SmcErr tempMonitor = new SmcErr(); tempMonitor.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END; SmcErr tempLTE = new SmcErr(); tempLTE.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END; foreach (KeyValuePair <string, IVideoMonitor> monitor in monitorsDictionaryTemp) { IVideoMonitor videoMonitor = monitor.Value; if (monitor.Key != "eLTE") { if (tempMonitor.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END) { err = videoMonitor.GetRefreshStatus(out tempMonitor); } } else { err = videoMonitor.GetRefreshStatus(out tempLTE); } if (!err.IsSuccess()) { logEx.Error("GetRefreshStatus failed."); err.SetErrorNo(CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED); refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED; return(err); } } //监控和elte都刷新完毕 if (tempMonitor.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END && tempLTE.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END) { refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END; } //监控和elte都刷新执行中 else if (tempMonitor.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_EXECUTING && tempLTE.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_EXECUTING) { refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_EXECUTING; } //监控和elte都刷新失败 else if (tempMonitor.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED && tempLTE.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED) { refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED; } //监控成功、elte失败 else if (tempMonitor.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END && tempLTE.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED) { refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_MONITOR_SUCCESS_ELTE_FAIL; } //监控成功、elte执行中 else if (tempMonitor.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END && tempLTE.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_EXECUTING) { refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_MONITOR_SUCCESS_ELTE_EXECUTING; } //监控执行中、elte成功 else if (tempMonitor.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_EXECUTING && tempLTE.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END) { refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_MONITOR_EXECUTING_ELTE_SUCCESS; } //监控执行中、elte失败 else if (tempMonitor.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_EXECUTING && tempLTE.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED) { refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_MONITOR_EXECUTING_ELTE_FAIL; } //监控失败、elte成功 else if (tempMonitor.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED && tempLTE.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END) { refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_MONITOR_FAIL_ELTE_SUCCESS; } //监控失败、elte执行中 else if (tempMonitor.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED && tempLTE.ErrNo == CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_EXECUTING) { refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_MONITOR_FAIL_ELTE_EXECUTING; } return(err); }