Example #1
0
        /// <summary>
        /// 监控平台加载器,轮询加载,直到成功
        /// </summary>
        /// <param name="loginInfo"></param>
        private void LoginThread(Object loginInfoObj)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: eLTEVideoMonitor.LoginThread().");

            try
            {
                eLTELoginInfo loginInfo = loginInfoObj as eLTELoginInfo;

                if (loginInfo == null)
                {
                    logEx.Error("loginInfoObj is Null.");
                    return;
                }
                if (loginInfo.NotFirstLogin == true)
                {
                    //登陆失败,等待一分后再次尝试登陆
                    Thread.Sleep(5000);
                }

                //本机IP 
                //string localIP = GetLocalIP(ip, iPort, ilocalPort);
                if (string.IsNullOrEmpty(localIP))
                {
                    localIP = GetLocalIP(ip, iPort, ilocalPort);
                }

                logEx.Trace("Call eLTEVideoMonitor.Login({0},{1},{2},{3}).", loginInfo.Ip, loginInfo.Port, loginInfo.User, localIP);

                //设置登录服务器IP、本地IP、用户名、密码、sip端口等信息
                ELTE_RESULT result = (ELTE_RESULT)lteSdkClient.Set_Login_Info(loginInfo.Ip, localIP, loginInfo.User, loginInfo.Pwd, loginInfo.Port.ToString(), Convert.ToInt32(loginInfo.User));
                if (result != ELTE_RESULT.RET_SUCCESS)
                {
                    logEx.Error("Set_Login_Info failed.Monitor id:{0}.ip:{1}, port:{2}, user:{3}", this.monitorId, loginInfo.Ip, loginInfo.Port, loginInfo.User);
                }

                //发起视频回传成功后,在状态变化事件中处理视频接收  
                if (callP2pvideo == null)
                {
                    callP2pvideo = P2pStatusDelegateFun;
                    eLTEInterface.SetP2pVideoCallStaCallBack(callP2pvideo);

                    callResStatus = CallbackResStatusDelegateFun;
                    eLTEInterface.SetResStaCallBack(callResStatus);

                    callUserStatus = CallUserStatusDelegateFun;
                    eLTEInterface.SetUserStaCallBack(callUserStatus);

                    callProvisionAllResync = CallProvisionAllDelegateFun;
                    eLTEInterface.SetProvisionAllResyncCallBack(callProvisionAllResync);

                    callModuleStatus = CallModuleStatusDelegateFun;
                    eLTEInterface.SetModStaCallBack(callModuleStatus);

                    //设置rtp转码回调函数
                    frameDataCallBack = FrameDataCallBackFun;

                    //初始化rtp转码模块
                    rtpAdapter.ESDK_RTP_Init();

                    //设置NETSOURCE日志目录
                    IVS_NETSOURCE_RESULT iNet = NetSourcedInterface.IVS_NETSOURCE_Init(AppDomain.CurrentDomain.BaseDirectory + "\\logs");
                    if (iNet != IVS_NETSOURCE_RESULT.SUCCESS)
                    {
                        logEx.Error("SipStackAdapter.IVS_NETSOURCE_Init Failed.");
                    }
                }

                //初始化上下文,启动SDK 
                result = (ELTE_RESULT)lteSdkClient.SDK_START();
                if (result != ELTE_RESULT.RET_SUCCESS)
                {
                    logEx.Fatal("eLTEVideoMonitor.SDK_START failed.Monitor id:{0}.ip:{1}, port:{2}, user:{3},ErrorNo:{4}", this.monitorId, loginInfo.Ip, loginInfo.Port, loginInfo.User,(int)result);
                    //服务器端返回错误, 操作被调度机拒绝
                    if ((int)(result) == -40097)
                    {
                        logEx.Fatal("Login to eLTEVideoMonitor failed,elte remote failed,elte refuse to connect.");
                    }
                }
                else
                {
                    isLoginSuccess = true;
                    logEx.Info("eLTEVideoMonitor.SDK_START success.Monitor id:{0}.ip:{1}, port:{2}, user:{3}.", this.monitorId, loginInfo.Ip, loginInfo.Port, loginInfo.User);
                }

            }
            catch (System.Exception ex)
            {
                logEx.Error("Load eLTEVideoMonitor failed. Exception message:{0}.", ex.Message);
            }
        }
Example #2
0
 public static extern void SetModStaCallBack(callbackModuleStatusDelegate callback);
Example #3
0
 public static extern void SetModStaCallBack(callbackModuleStatusDelegate callback);