SmcErr类:设备服务错误码,错误码从0x50900000开始
示例#1
0
        /// <summary>
        /// 保存错误描述包括的扩展错误原因
        /// </summary>
        /// <param name="err">错误信息</param>
        public virtual void AddSmcErrInfo(SmcErr err)
        {
            if (null == this.ExternErrs)
            {
                this.ExternErrs = new List <SmcErr>();
            }

            if (null != err)
            {
                this.ExternErrs.Add(err);
            }
        }
示例#2
0
        /// <summary>
        /// 保存批量操作的错误描述
        /// </summary>
        /// <param name="err">错误信息</param>
        public virtual void AddMultipleErrs(SmcErr err)
        {
            if (null == this.MultipleErrs)
            {
                this.MultipleErrs = new List <SmcErr>();
            }

            if (null != err)
            {
                SmcErr oldErr = this.MultipleErrs.Find(delegate(SmcErr target) { return(target.ErrNo == err.ErrNo); });
                if (oldErr != null)
                {
                    try
                    {
                        if (err.ErrorInfoParam.ParametersDictionary != null && err.ErrorInfoParam.ParametersDictionary.Count > 0)
                        {
                            for (int i = 0; i < err.ErrorInfoParam.ParametersDictionary.Count; i++)
                            {
                                if (err.ErrorInfoParam.ParametersDictionary[i] != null && err.ErrorInfoParam.ParametersDictionary[i].Count > 0)
                                {
                                    for (int j = 0; j < err.ErrorInfoParam.ParametersDictionary[i].Count; j++)
                                    {
                                        if (err.ErrorInfoParam.ParametersDictionary[i][j].Name == oldErr.ErrorInfoParam.ParametersDictionary[i][j].Name &&
                                            err.ErrorInfoParam.ParametersDictionary[i][j].Value != oldErr.ErrorInfoParam.ParametersDictionary[i][j].Value)
                                        {
                                            //批量操作错误描述对象如果超过3个则用“...”代替
                                            if (oldErr.ErrorInfoParam.ParametersDictionary[i][j].Value.Split(',').Length < 3)
                                            {
                                                oldErr.ErrorInfoParam.ParametersDictionary[i][j].Value += ", " + err.ErrorInfoParam.ParametersDictionary[i][j].Value;
                                            }
                                            else if (oldErr.ErrorInfoParam.ParametersDictionary[i][j].Value.Split(',').Length == 3)
                                            {
                                                oldErr.ErrorInfoParam.ParametersDictionary[i][j].Value += ", ...";
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                else
                {
                    this.MultipleErrs.Add(err);
                }
            }
        }
示例#3
0
文件: Program.cs 项目: eSDK/esdk_Cgw
        /// <summary>
        /// 线程加载监控平台
        /// </summary>
        private static void LoadMonitorTimer_Elapsed()
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            System.Threading.Thread.Sleep(CgwConst.Thread_Sleep_Time);
            SmcErr smcErr = new SmcErr();
            try
            {

                smcErr = MonitorManageService.Instance().Load();
                if (false == smcErr.IsSuccess())
                {
                    logEx.Error("MonitorManageService Start failed! Errno :{0}", smcErr.ErrNo);
                    NLog.LogManager.Flush();
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                }
            }
            catch (Exception ex)
            {
                logEx.Fatal(ex, "MonitorManageService LoadMonitor Failed!");
                NLog.LogManager.Flush();
            }
        }
示例#4
0
        /// <summary>
        /// 保存错误描述包括的扩展错误原因
        /// </summary>
        /// <param name="err">错误信息</param>
        public virtual void AddSmcErrInfo(SmcErr err)
        {
            if (null == this.ExternErrs)
            {
                this.ExternErrs = new List<SmcErr>();
            }

            if (null != err)
            {
                this.ExternErrs.Add(err);
            }
        }
示例#5
0
        /// <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;
        }
示例#6
0
        /// <summary>
        /// 删除会话
        /// </summary>
        /// <param name="sessionGuid">会话Guid</param>
        /// <returns></returns>
        public SmcErr RemoveSession(Guid sessionGuid)
        {
            SmcErr err = new SmcErr();

            if (rwl.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME))
            {
                try
                {
                    CgwSession session;
                    if (sessionDict.TryGetValue(sessionGuid, out session))
                    {
                        if (session != null)
                        {
                            sessionDict.Remove(sessionGuid);
                            session = null;

                        }
                    }
                }
                finally
                {
                    rwl.ExitWriteLock();
                }
            }
            return err;
        }
示例#7
0
        /// <summary>
        /// 添加会话
        /// </summary>
        /// <param name="sessionGuid">会话GuidID</param>
        /// <param name="smcSession">会话数据</param>
        /// <returns></returns>
        public SmcErr AddSession(Guid sessionGuid, CgwSession smcSession)
        {
            SmcErr err = new SmcErr();

            if (rwl.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME))
            {
                try
                {
                    if (sessionDict.ContainsKey(sessionGuid))
                    {
                        sessionDict.Remove(sessionGuid);
                    }
                    sessionDict.Add(sessionGuid, smcSession);

                }
                finally
                {
                    rwl.ExitWriteLock();
                }
            }

            return err;
        }
示例#8
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
 /// <summary>
 /// 带异常信息的Warn类日志输出。
 /// </summary>
 /// <param name="err">错误码,即信息</param>
 /// <param name="e">e</param>
 /// <param name="message">message</param>
 /// <param name="args">args</param>
 public void Warn(SmcErr err, Exception e, string message, params object[] args)
 {
     if (this.Log.IsWarnEnabled)
     {
         this.WriteToLog(LogLevel.Warn, err, e, message, args);
     }
 }
示例#9
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
 /// <summary>
 /// Error类日志输出。
 /// </summary>
 /// <param name="err">错误码,即信息</param>
 /// <param name="args">args</param>
 public void Error(SmcErr err, params object[] args)
 {
     if (this.Log.IsErrorEnabled)
     {
         this.WriteToLog(LogLevel.Error, err, null, String.Empty, args);
     }
 }
示例#10
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
 /// <summary>
 /// Error类日志输出。
 /// </summary>
 /// <param name="err">错误码,即信息</param>
 /// <param name="message">message</param>
 /// <param name="args">args</param>
 public void Error(SmcErr err)
 {
     if (this.Log.IsErrorEnabled)
     {
         this.WriteToLog(LogLevel.Error, err, null, String.Empty, null);
     }
 }
示例#11
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
 /// <summary>
 /// 带异常信息的Debug日志输出。
 /// </summary>
 /// <param name="err">错误码,即信息</param>
 /// <param name="e">e</param>
 /// <param name="message">message</param>
 /// <param name="args">args</param>
 public void Debug(SmcErr err, Exception e, string message, params object[] args)
 {
     if (this.Log.IsDebugEnabled)
     {
         this.WriteToLog(LogLevel.Debug, err, e, message, args);
     }
 }
示例#12
0
        /// <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;
        }
示例#13
0
        /// <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;
        }
示例#14
0
        /// <summary>
        /// 获取监控摄像头列表刷新状态,返回结果为0是表示刷新完毕,为1是刷新操作中。当查询刷新状态为0时,可调用获取监控摄像头列表接口,获取刷新后监控摄像头列表
        /// </summary>
        /// <param name="refreshStatus">刷新状态</param>
        /// <returns></returns>
        public SmcErr GetRefreshStatus(out SmcErr refreshStatus)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: IvsVideoMonitor.GetRefreshStatus");
            SmcErr err = new CgwError();
            refreshStatus = new SmcErr();
            refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END;

            if (getDeviceEndFlg)
            {
                refreshStatus.ErrNo = sipStack.isRefreshSucess ? CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END : CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED;
            }
            else
            {
                refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_EXECUTING;
            }
            logEx.Info("GetRefreshStatus success.");
            return err;
        }
示例#15
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
 /// <summary>
 /// 带异常信息的Trace类日志输出。
 /// </summary>
 /// <param name="err">错误码,即信息</param>
 /// <param name="e">e</param>
 /// <param name="message">message</param>
 /// <param name="args">args</param>
 public void Trace(SmcErr err, Exception e, string message, params object[] args)
 {
     if (this.Log.IsTraceEnabled)
     {
         this.WriteToLog(LogLevel.Trace, err, e, message, args);
     }
 }
示例#16
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
 /// <summary>
 /// Warn类日志输出。
 /// </summary>
 /// <param name="err">错误码</param>
 /// <param name="args">参数</param>
 public void Warn(SmcErr err, params object[] args)
 {
     if (this.Log.IsWarnEnabled)
     {
         this.WriteToLog(LogLevel.Warn, err, null, String.Empty, args);
     }
 }
示例#17
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
 /// <summary>
 /// Error类日志输出。
 /// </summary>
 /// <param name="err">错误码,即信息</param>
 /// <param name="message">message</param>
 /// <param name="args">args</param>
 public void Error(SmcErr err, string message, params object[] args)
 {
     if (this.Log.IsErrorEnabled)
     {
         this.WriteToLog(LogLevel.Error, err, null, message, args);
     }
 }
示例#18
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
        /// <summary>
        /// 写入日志
        /// </summary>
        /// <param name="level">日志等级</param>
        /// <param name="err">err</param>
        private void WriteToLog(LogLevel level, SmcErr err, Exception e, string message, params object[] args)
        {
            //暂时先这样处理,保证log2console能够看到异常信息
            StringBuilder log = new StringBuilder();
            if (null != e)
            {
                log.AppendFormat("{0},{1}", e.Message, e.StackTrace);
                log.AppendLine();
                if (null != e.InnerException)
                {
                    log.AppendFormat("InnerException {0},{1}", e.InnerException.Message, e.InnerException.StackTrace);
                    log.AppendLine();
                }
            }

            if (null == args || (null != args && args.Length == 0))
            {
                log.Append(message);
            }
            else
            {
                log.AppendFormat(message, args);
            }

            LogEventInfo logEvent = new LogEventInfo(level, this.Log.Name, null, log.ToString(), null, null);
            if (null != err)
            {
                Param = err.GetXmlParamter();
                Model = err.GetModelName();
                ErrNo = err.ErrNo;
            }

            foreach (KeyValuePair<string, object> de in this.Properties)
            {
                logEvent.Properties[de.Key] = de.Value;
            }

            this.Log.Log(logEvent);
            //ClearProperties();
        }
示例#19
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
 /// <summary>
 /// Fatal类(致命)日志输出。
 /// </summary>
 /// <param name="err">错误码,即信息</param>
 /// <param name="args">args</param>
 public void Fatal(SmcErr err, params object[] args)
 {
     if (this.Log.IsFatalEnabled)
     {
         this.WriteToLog(LogLevel.Fatal, err, null, String.Empty, args);
     }
 }
示例#20
0
        /// <summary>
        /// 根据sessionId获取session
        /// </summary>
        /// <param name="sessionId">sessionId</param>
        /// <param name="sessions">session</param>
        /// <returns></returns>
        public SmcErr GetSessionsBySessionId(string sessionId, out CgwSession sessions)
        {
            SmcErr err = new SmcErr();
            sessions = null;

            if (rwl.TryEnterReadLock(CgwConst.ENTER_LOCK_WAIT_TIME))
            {
                try
                {

                    foreach (CgwSession cgwSession in sessionDict.Values)
                    {
                        if (cgwSession.SessionId == sessionId)
                        {
                            sessions = cgwSession;
                            break;
                        }
                    }
                }
                finally
                {
                    rwl.ExitReadLock();
                }
            }

            return err;
        }
示例#21
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
 /// <summary>
 /// 带异常信息的Fatal类日志输出。
 /// </summary>
 /// <param name="err">错误码,即信息</param>
 /// <param name="e">e</param>
 /// <param name="message">message</param>
 /// <param name="args">args</param>
 public void Fatal(SmcErr err, Exception e, string message, params object[] args)
 {
     if (this.Log.IsFatalEnabled)
     {
         this.WriteToLog(LogLevel.Fatal, err, e, message, args);
     }
 }
示例#22
0
        /// <summary>
        /// 删除会话
        /// </summary>
        /// <param name="sessionGuid">会话Guid</param>
        /// <returns></returns>
        public SmcErr RemoveSessionBySessionId(string sessionId)
        {
            SmcErr err = new SmcErr();
            if (rwl.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME))
            {
                try
                {
                    foreach (CgwSession cgwSession in sessionDict.Values)
                    {
                        if (cgwSession.SessionId == sessionId)
                        {
                            sessionDict.Remove(cgwSession.SessionGuid);
                            break;
                        }
                    }

                }
                finally
                {
                    rwl.ExitWriteLock();
                }
            }
            return err;
        }
示例#23
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
 /// <summary>
 /// Info类日志输出。
 /// </summary>
 /// <param name="err">错误码,即信息</param>
 /// <param name="message">message</param>
 /// <param name="args">args</param>
 public void Info(SmcErr err)
 {
     if (this.Log.IsInfoEnabled)
     {
         this.WriteToLog(LogLevel.Info, err, null, String.Empty, null);
     }
 }
示例#24
0
 /// <summary>
 /// 获取监控摄像头列表刷新状态,返回结果为0是表示刷新完毕,为1是刷新操作中。当查询刷新状态为0时,可调用获取监控摄像头列表接口,获取刷新后监控摄像头列表
 /// </summary>
 /// <param name="refreshStatus"></param>
 /// <returns></returns>
 public SmcErr GetRefreshStatus(out SmcErr refreshStatus)
 {
     SmcErr err = new CgwError();
     NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
     refreshStatus = new SmcErr();
     refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END;
     err = CheckSession(currentSessionID);
     //调任何接口前 需要判断监控平台是否加载成功
     if (err.IsSuccess())
     {
         err = VideoMonitorManage.Instance().GetRefreshStatus(out refreshStatus);
     }
     else
     {
         refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED;
     }
     if (err.IsSuccess())
     {
         logEx.Info("MonitorManageService GetRefreshStatus  Successful,Current Cgw IP is : {0}", CgwConst.ClientIp);
     }
     else
     {
         logEx.Error("MonitorManageService GetRefreshStatus failed,ErrNo :{0}", err.ErrNo);
     }
     return err;
 }
示例#25
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
 /// <summary>
 /// Info类日志输出。
 /// </summary>
 /// <param name="err">错误码</param>
 /// <param name="args">参数</param>
 public void Info(SmcErr err, params object[] args)
 {
     if (this.Log.IsInfoEnabled)
     {
         this.WriteToLog(LogLevel.Info, err, null, String.Empty, args);
     }
 }
示例#26
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
 /// <summary>
 /// Info类日志输出。
 /// </summary>
 /// <param name="err">错误码,即信息</param>
 /// <param name="message">message</param>
 /// <param name="args">args</param>
 public void Info(SmcErr err, string message, params object[] args)
 {
     if (this.Log.IsInfoEnabled)
     {
         this.WriteToLog(LogLevel.Info, err, null, message, args);
     }
 }
示例#27
0
文件: LoggerEx.cs 项目: eSDK/esdk_Cgw
 /// <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);
     }
 }
示例#28
0
        /// <summary>
        /// 获取监控摄像头列表刷新状态,返回结果为0是表示刷新完毕,为1是刷新操作中。当查询刷新状态为0时,可调用获取监控摄像头列表接口,获取刷新后监控摄像头列表
        /// </summary>
        /// <param name="refreshStatus">刷新状态</param>
        /// <returns></returns>
        public SmcErr GetRefreshStatus(out SmcErr refreshStatus)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: TiandyVideoMonitor.GetRefreshStatus");
            SmcErr err = new CgwError();
            refreshStatus = new SmcErr();
            refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END;

            if (refreshMonitorCameraOperateLock.TryEnterWriteLock(CgwConst.EFRESH_MONITOR_CAMERA_WAIT_TIME))
            {
                try
                {
                    refreshStatus.ErrNo = isRefreshSucess ? CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_END : CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_FAILED;
                }
                finally
                {
                    refreshMonitorCameraOperateLock.ExitWriteLock();
                }
            }
            else
            {
                refreshStatus.ErrNo = CgwError.ERR_DEVICE_LIST_REFRESH_STATUS_EXECUTING;
            }
            logEx.Info("GetRefreshStatus success.");
            return err;
        }
示例#29
0
        /// <summary>
        /// 保存批量操作的错误描述
        /// </summary>
        /// <param name="err">错误信息</param>
        public virtual void AddMultipleErrs(SmcErr err)
        {
            if (null == this.MultipleErrs)
            {
                this.MultipleErrs = new List<SmcErr>();
            }

            if (null != err)
            {
                SmcErr oldErr = this.MultipleErrs.Find(delegate(SmcErr target) { return target.ErrNo == err.ErrNo; });
                if (oldErr != null)
                {
                    try
                    {
                        if (err.ErrorInfoParam.ParametersDictionary != null && err.ErrorInfoParam.ParametersDictionary.Count > 0)
                        {
                            for (int i = 0; i < err.ErrorInfoParam.ParametersDictionary.Count; i++)
                            {
                                if (err.ErrorInfoParam.ParametersDictionary[i] != null && err.ErrorInfoParam.ParametersDictionary[i].Count > 0)
                                {
                                    for (int j = 0; j < err.ErrorInfoParam.ParametersDictionary[i].Count; j++)
                                    {
                                        if (err.ErrorInfoParam.ParametersDictionary[i][j].Name == oldErr.ErrorInfoParam.ParametersDictionary[i][j].Name &&
                                            err.ErrorInfoParam.ParametersDictionary[i][j].Value != oldErr.ErrorInfoParam.ParametersDictionary[i][j].Value)
                                        {
                                            //批量操作错误描述对象如果超过3个则用“...”代替
                                            if (oldErr.ErrorInfoParam.ParametersDictionary[i][j].Value.Split(',').Length < 3)
                                            {
                                                oldErr.ErrorInfoParam.ParametersDictionary[i][j].Value += ", " + err.ErrorInfoParam.ParametersDictionary[i][j].Value;
                                            }
                                            else if (oldErr.ErrorInfoParam.ParametersDictionary[i][j].Value.Split(',').Length == 3)
                                            {
                                                oldErr.ErrorInfoParam.ParametersDictionary[i][j].Value += ", ...";
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                else
                {
                    this.MultipleErrs.Add(err);
                }
            }
        }