SIP_SDK_MESSAGE() private method

private SIP_SDK_MESSAGE ( string pDeviceID, string pBody ) : EM_SIP_RESULT
pDeviceID string
pBody string
return EM_SIP_RESULT
Esempio n. 1
0
        /// <summary>
        /// 云台控制
        /// </summary>
        /// <param name="deviceID">设备编码</param>
        /// <param name="PTZCmd">云台控制命令</param>
        /// <param name="controlPriority">优先级</param>
        /// <returns></returns>
        public EM_SIP_RESULT PtzControl(string deviceID, string ptzCmd, string controlPriority)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: SipStackAdapter.PtzControl deviceID = {0}.", deviceID);
            EM_SIP_RESULT iRet = EM_SIP_RESULT.RET_FAILURE;

            try
            {
                //设备目录查询消息体
                string xmlstr = @"<?xml version='1.0'?><Control><CmdType>DeviceControl</CmdType><SN>" + DeviceControlSN + "</SN><DeviceID>" + deviceID + @"</DeviceID>
                                    <PTZCmd>" + ptzCmd + @"</PTZCmd>
                                    <Info>
                                    <ControlPriority>" + controlPriority + @"</ControlPriority>
                                    </Info></Control>";
                DeviceControlSN++;
                iRet = SipSDKInterface.SIP_SDK_MESSAGE(deviceID, xmlstr);
                if (iRet != EM_SIP_RESULT.RET_SUCCESS)
                {
                    logEx.Error("SipStackAdapter.PtzControl Error = {0}.", Enum.GetName(typeof(EM_SIP_RESULT), iRet));
                }
                logEx.Trace("Leave: SipStackAdapter.PtzControl deviceID = {0}.", deviceID);
            }
            catch (System.Exception ex)
            {
                logEx.Error("SipStackAdapter.PtzControl Error = {0}.", ex.ToString());
                iRet = EM_SIP_RESULT.RET_FAILURE;
            }
            return(iRet);
        }
Esempio n. 2
0
        /// <summary>
        /// sip保活
        /// </summary>
        /// <param name="localSignalGateway">网关对接T28181监控平台时,网关视为监控平台外域,该编码是标识网关的域编码,即是监控平台配置界面添加网关时的外域编码。</param>
        public void StartKeepalive(string serverID, string localID)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: T28181VideoMonitor.StartConnectRegisterSip().");
            EM_SIP_RESULT iRet = EM_SIP_RESULT.RET_FAILURE;

            //初始话定时器
            this.keepLiveTimer.AutoReset = true;
            this.keepLiveTimer.Elapsed  += new System.Timers.ElapsedEventHandler((x, y)
                                                                                 =>
            {
                //sip保活,deviceID为用户名
                string strBody = @"<?xml version='1.0'?><Notify><CmdType>Keepalive</CmdType><SN>" + KeepaliveSN + "</SN><DeviceID>" + localID + "</DeviceID><Status>OK</Status></Notify>";
                KeepaliveSN++;
                iRet = SipSDKInterface.SIP_SDK_MESSAGE(serverID, strBody);
                if (iRet != EM_SIP_RESULT.RET_SUCCESS)
                {
                    logEx.Warn("SipStackAdapter.Keepalive Failed");
                    //保活失败,重新注册. zWX231378 .2015/6/24
                    SIP_SDK_REGISTER();
                }
                else
                {
                    logEx.Trace("SipStackAdapter.Keepalive Success");
                }
            });
            //保活时间为10秒
            this.keepLiveTimer.Interval = CgwConst.Thread_Sleep_Time * 10;
            keepLiveTimer.Start();
        }
Esempio n. 3
0
        /// <summary>
        /// 获取系统设备列表
        /// </summary>
        /// <param name="serverSignalGateway">要查询的域编码</param>
        /// <param name="deviceID">要查询的根设备编码</param>
        public void GetDeviceList(string serverSignalGateway, string deviceID)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: SipStackAdapter.GetDeviceList deviceID = {0}.", deviceID);

            try
            {
                //设备总数清空
                if (deviceItemOperateLock.TryEnterWriteLock(CgwConst.ENTER_LOCK_WAIT_TIME))
                {
                    deviceNum = 0;
                    deviceList.Clear();
                }
            }
            finally
            {
                deviceItemOperateLock.ExitWriteLock();
            }

            try
            {
                //设备目录查询消息体
                string xmlstr = "<?xml version='1.0'?>" +
                                "<Query><CmdType>Catalog</CmdType><SN>" + iCateLogSN + "</SN><DeviceID>" + deviceID + "</DeviceID></Query>";

                iCateLogSN++;
                EM_SIP_RESULT iRet = SipSDKInterface.SIP_SDK_MESSAGE(serverSignalGateway, xmlstr);
                if (iRet != EM_SIP_RESULT.RET_SUCCESS)
                {
                    logEx.Error("SipStackAdapter.GetDeviceList Error = {0}.", Enum.GetName(typeof(EM_SIP_RESULT), iRet));
                    isRefreshSucess = false;
                }
                logEx.Trace("Leave: SipStackAdapter.GetDeviceList deviceID = {0}.", deviceID);
            }
            catch (System.Exception ex)
            {
                logEx.Error("SipStackAdapter.GetDeviceList Error = {0}.", ex.ToString());
                isRefreshSucess = false;
            }
        }