示例#1
0
        /// <summary>
        /// 软终端初始化
        /// </summary>
        /// <param name="addr"></param>
        /// <returns></returns>
        public SmcErr Init(InitSotParam param)
        {
            SmcErr err = new CgwError();

            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);

            try
            {
                SoftTerminalCallback handler = new SoftTerminalCallback();
                handler.NlogHandler      = new NLogCallback(this.WriteLog);
                handler.IFrameHandler    = this.makeIFrameCallback;
                handler.errReportHandler = this.errReportCallback;
                bool isSuccess = this.softTerminalAdapter.RegistSotCallback(handler);
                if (!isSuccess)
                {
                    logEx.Trace("Init Regist callback failed.");
                    err.SetErrorNo(CgwError.ERR_CGW_CHANNEL_SOT_REGIST_CALLBACK_FAIL);
                    return(err);
                }

                err = this.softTerminalAdapter.Init(param);
                if (!err.IsSuccess())
                {
                    logEx.Trace("Init failed.");
                    return(err);
                }
            }
            catch (System.Exception ex)
            {
                logEx.Error(ex, "Init Exception.");
            }


            logEx.Trace("Init successfully.");
            return(err);
        }
示例#2
0
        /// <summary>
        /// 软终端初始化
        /// </summary>
        /// <param name="addr"></param>
        /// <returns></returns>
        public SmcErr Init(InitSotParam param)
        {
            SmcErr err = new CgwError();
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);

            try
            {
                SoftTerminalCallback handler = new SoftTerminalCallback();
                handler.NlogHandler = new NLogCallback(this.WriteLog);
                handler.IFrameHandler = this.makeIFrameCallback;
                handler.errReportHandler = this.errReportCallback;
                bool isSuccess = this.softTerminalAdapter.RegistSotCallback(handler);
                if (!isSuccess)
                {
                    logEx.Trace("Init Regist callback failed.");
                    err.SetErrorNo(CgwError.ERR_CGW_CHANNEL_SOT_REGIST_CALLBACK_FAIL);
                    return err;
                }

                err = this.softTerminalAdapter.Init(param);
                if (!err.IsSuccess())
                {
                    logEx.Trace("Init failed.");
                    return err;
                }
            }
            catch (System.Exception ex)
            {
                logEx.Error(ex, "Init Exception.");
            }

            logEx.Trace("Init successfully.");
            return err;
        }