当前位置: 首页>>代码示例>>C++>>正文


C++ JEvent::GetEventType方法代码示例

本文整理汇总了C++中JEvent::GetEventType方法的典型用法代码示例。如果您正苦于以下问题:C++ JEvent::GetEventType方法的具体用法?C++ JEvent::GetEventType怎么用?C++ JEvent::GetEventType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JEvent的用法示例。


在下文中一共展示了JEvent::GetEventType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetContactRsp

JUINT32 JPhoneAgent::GetContactRsp(JPjSipUaContactList* pPjSipUaContactList)
{
    JUINT32 uiRet = JFAILURE;
    JEvent* pEvent = JNULL;
    JSOCKADDR_IN stAddr;
    JEVT_TYPE pType = JEVT_NONE;
    JPjSipUaContactList* pPjSipUaContactListBody = JNULL;
    JUINT32 uiInterval = 0;
    JUINT32 uiIdx = 0;
    JCHAR pBuf[JCOMM_MSG_BUF_LEN] = {0};
    JCommEngine* pCommEngine = JNULL;
    JListItem<JEvent>* pListItem = JNULL;

    JLogAutoPtr clsLogAutoPtr(JSingleton<JLog>::instance(), 
        JLOG_MOD_PHONE_AGENT, "JPhoneAgent::GetContactRsp");

	if (!pPjSipUaContactList)
	{
		return JFAILURE;
	}
	else
	{
		pPjSipUaContactList->Clear();
	}

    while(1)
    {
        if (!uiInterval)
        {
            uiInterval = JPHONE_AGENT_SELECT_TIME;
        }
        else
        {
            uiInterval = JPHONE_AGENT_SELECT_TIME2;
        }

        pCommEngine = m_pAgentThread->GetCommEngineGroup().HasMessage(uiInterval);
        if (pCommEngine && pCommEngine == m_pAgentThread->GetNotifyCommEngine())
        {
            uiRet = pCommEngine->RecvMessage(pBuf, JCOMM_MSG_BUF_LEN, &stAddr);
            if (uiRet == 1 && SafeStrcmp(pBuf, "1") ==0)
            {
                pListItem = m_pAgentThread->DeQueueEvent();
                if (pListItem)
                {
                    pEvent = pListItem->GetData();
                    if (pEvent)
                    {
                        pType = pEvent->GetEventType();
                        pPjSipUaContactListBody = dynamic_cast<JPjSipUaContactList*>(pEvent->GetBody());

						//check the response and save the data
                        if (pType == JEVT_SIPUA_GET_CONTACT_LIST_RSP && pPjSipUaContactListBody)
                        {
        					for (uiIdx=0; uiIdx<JPJSIP_MAX_NUMBER; uiIdx++)
        					{
        						if(!pPjSipUaContactListBody->GetContactNumber(uiIdx).GetLength())
        						{
        							break;
        						}

        	                	pPjSipUaContactList->SetContactNumber(uiIdx, 
        	                		pPjSipUaContactListBody->GetContactNumber(uiIdx));
        					}
                        }
                    }

                    delete pListItem;
                }
            }
        }
        else
        {
            break;
        }
    }

    return JSUCCESS;
}
开发者ID:weiganyi,项目名称:jphone,代码行数:79,代码来源:JPhoneAgent.cpp

示例2: GetDaemonCfgRsp

JUINT32 JPhoneAgent::GetDaemonCfgRsp(JDaemonCfg* pDaemonCfg)
{
    JUINT32 uiRet = JFAILURE;
    JEvent* pEvent = JNULL;
    JSOCKADDR_IN stAddr;
    JEVT_TYPE pType = JEVT_NONE;
    JDaemonCfg* pDaemonCfgBody = JNULL;
    JUINT32 uiInterval = 0;
    JCHAR pBuf[JCOMM_MSG_BUF_LEN] = {0};
    JCommEngine* pCommEngine = JNULL;
    JListItem<JEvent>* pListItem = JNULL;

    JLogAutoPtr clsLogAutoPtr(JSingleton<JLog>::instance(), 
        JLOG_MOD_PHONE_AGENT, "JPhoneAgent::GetDaemonCfgRsp");

	if (!pDaemonCfg)
	{
		return JFAILURE;
	}
	else
	{
		pDaemonCfg->Clear();
	}

    while(1)
    {
    	//first select time is 500ms, the second is 100ms, because normally the response
    	//be received in the 500ms after request be sent, so it will make it more likely to 
    	//receive response at the first select loop.
        if (!uiInterval)
        {
            uiInterval = JPHONE_AGENT_SELECT_TIME;
        }
        else
        {
            uiInterval = JPHONE_AGENT_SELECT_TIME2;
        }

		//if response event be received, first a notify message "1" be received
		//the get event for the thread queue, because it's through queue read/write
		//while communication happens between two threads of one process.
        pCommEngine = m_pAgentThread->GetCommEngineGroup().HasMessage(uiInterval);
        if (pCommEngine && pCommEngine == m_pAgentThread->GetNotifyCommEngine())
        {
            uiRet = pCommEngine->RecvMessage(pBuf, JCOMM_MSG_BUF_LEN, &stAddr);
            if (uiRet == 1 && SafeStrcmp(pBuf, "1") ==0)
            {
                pListItem = m_pAgentThread->DeQueueEvent();
                if (pListItem)
                {
                    pEvent = pListItem->GetData();
                    if (pEvent)
                    {
                        pType = pEvent->GetEventType();
                        pDaemonCfgBody = dynamic_cast<JDaemonCfg*>(pEvent->GetBody());

						//check the response and save the data
                        if (pType == JEVT_DAEMON_GET_CFG_RSP && pDaemonCfgBody)
                        {
                        	pDaemonCfg->SetSaveMethod(pDaemonCfgBody->GetSaveMethod());
                        }
                    }

                    delete pListItem;
                }
            }
        }
        else
        {
            break;
        }
    }

    return JSUCCESS;
}
开发者ID:weiganyi,项目名称:jphone,代码行数:75,代码来源:JPhoneAgent.cpp

示例3: GetLogCfgRsp

JUINT32 JPhoneAgent::GetLogCfgRsp(JLogCfg* pLogCfg)
{
    JUINT32 uiRet = JFAILURE;
    JEvent* pEvent = JNULL;
    JSOCKADDR_IN stAddr;
    JEVT_TYPE pType = JEVT_NONE;
    JLogCfg* pLogCfgBody = JNULL;
    JUINT32 uiInterval = 0;
    JCHAR pBuf[JCOMM_MSG_BUF_LEN] = {0};
    JCommEngine* pCommEngine = JNULL;
    JListItem<JEvent>* pListItem = JNULL;

    JLogAutoPtr clsLogAutoPtr(JSingleton<JLog>::instance(), 
        JLOG_MOD_PHONE_AGENT, "JPhoneAgent::GetLogCfgRsp");

	if (!pLogCfg)
	{
		return JFAILURE;
	}
	else
	{
		pLogCfg->Clear();
	}

    while(1)
    {
        if (!uiInterval)
        {
            uiInterval = JPHONE_AGENT_SELECT_TIME;
        }
        else
        {
            uiInterval = JPHONE_AGENT_SELECT_TIME2;
        }

        pCommEngine = m_pAgentThread->GetCommEngineGroup().HasMessage(uiInterval);
        if (pCommEngine && pCommEngine == m_pAgentThread->GetNotifyCommEngine())
        {
            uiRet = pCommEngine->RecvMessage(pBuf, JCOMM_MSG_BUF_LEN, &stAddr);
            if (uiRet == 1 && SafeStrcmp(pBuf, "1") ==0)
            {
                pListItem = m_pAgentThread->DeQueueEvent();
                if (pListItem)
                {
                    pEvent = pListItem->GetData();
                    if (pEvent)
                    {
                        pType = pEvent->GetEventType();
                        pLogCfgBody = dynamic_cast<JLogCfg*>(pEvent->GetBody());

						//check the response and save the data
                        if (pType == JEVT_LOG_GET_CFG_RSP && pLogCfgBody)
                        {
                        	pLogCfg->SetLogAddress(pLogCfgBody->GetLogAddress());
                        	pLogCfg->SetLogPort(pLogCfgBody->GetLogPort());
                        	pLogCfg->SetOutputFile(pLogCfgBody->GetOutputFile());
                        	pLogCfg->SetOutputRemote(pLogCfgBody->GetOutputRemote());
                        }
                    }

                    delete pListItem;
                }
            }
        }
        else
        {
            break;
        }
    }

    return JSUCCESS;
}
开发者ID:weiganyi,项目名称:jphone,代码行数:72,代码来源:JPhoneAgent.cpp

示例4: GetStatusRsp

JUINT32 JPhoneAgent::GetStatusRsp(JPjSipUaCallStatus* pPjSipUaCallStatus)
{
    JUINT32 uiRet = JFAILURE;
    JEvent* pEvent = JNULL;
    JSOCKADDR_IN stAddr;
    JEVT_TYPE pType = JEVT_NONE;
    JPjSipUaCallStatus* pPjSipUaCallStatusBody = JNULL;
    JUINT32 uiInterval = 0;
    JCHAR pBuf[JCOMM_MSG_BUF_LEN] = {0};
    JCommEngine* pCommEngine = JNULL;
    JListItem<JEvent>* pListItem = JNULL;

    JLogAutoPtr clsLogAutoPtr(JSingleton<JLog>::instance(), 
        JLOG_MOD_PHONE_AGENT, "JPhoneAgent::GetStatusRsp");

	if (!pPjSipUaCallStatus)
	{
		return JFAILURE;
	}
	else
	{
		pPjSipUaCallStatus->Clear();
	}

    while(1)
    {
        if (!uiInterval)
        {
            uiInterval = JPHONE_AGENT_SELECT_TIME;
        }
        else
        {
            uiInterval = JPHONE_AGENT_SELECT_TIME2;
        }

        pCommEngine = m_pAgentThread->GetCommEngineGroup().HasMessage(uiInterval);
        if (pCommEngine && pCommEngine == m_pAgentThread->GetNotifyCommEngine())
        {
            uiRet = pCommEngine->RecvMessage(pBuf, JCOMM_MSG_BUF_LEN, &stAddr);
            if (uiRet == 1 && SafeStrcmp(pBuf, "1") ==0)
            {
                pListItem = m_pAgentThread->DeQueueEvent();
                if (pListItem)
                {
                    pEvent = pListItem->GetData();
                    if (pEvent)
                    {
                        pType = pEvent->GetEventType();
                        pPjSipUaCallStatusBody = dynamic_cast<JPjSipUaCallStatus*>(pEvent->GetBody());

                        if (pType == JEVT_SIPUA_GET_CALL_STATUS_RSP && pPjSipUaCallStatusBody)
                        {
                        	pPjSipUaCallStatus->SetNumber(pPjSipUaCallStatusBody->GetNumber());
                        	pPjSipUaCallStatus->SetStatus(pPjSipUaCallStatusBody->GetStatus());
                        }
                    }

                    delete pListItem;
                }
            }
        }
        else
        {
            break;
        }
    }

    return JSUCCESS;
}
开发者ID:gothame,项目名称:jphone,代码行数:69,代码来源:JPhoneAgent.cpp


注:本文中的JEvent::GetEventType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。