• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TaoMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TaoMessage的典型用法代码示例。如果您正苦于以下问题:C++ TaoMessage类的具体用法?C++ TaoMessage怎么用?C++ TaoMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: atoi

TaoStatus TaoPhoneComponentAdaptor::getExtSpeakerNominalVolume(TaoMessage& rMsg)
{
        int volume = 0;
        int groupType = atoi(rMsg.getArgList());

        mpPhoneTask->taoGetNominalVolume(volume, groupType);

        if (volume > 10)
                volume = 10;
        if (volume < 0)
                volume = 0;

    char buff[MAXIMUM_INTEGER_STRING_LENGTH];
    sprintf(buff, "%d", volume);

        rMsg.setMsgSubType(TaoMessage::RESPONSE_PHONECOMPONENT);
        rMsg.setArgCnt(1);
        rMsg.setArgList(buff);


        if (mpSvrTransport->postMessage(rMsg))
        {
                return TAO_SUCCESS;
        }

        return TAO_FAILURE;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:27,代码来源:TaoPhoneComponentAdaptor.cpp


示例2: sendRequest

int TaoClientTask::sendRequest(TaoMessage& rMsg, OsMutex* pMutex, const OsTime& rTimeout)
{
        if (mpTaoServerTask)
        {
                rMsg.setMsgQueueHandle((TaoObjHandle) this);
                mpTaoServerTask->postMessage(rMsg);
                return 1;
        }
        else
        {
                osPrintf("\n++++++ TaoClientTask::sendRequest mpTaoServerTask = 0x%p +++++\n", mpTaoServerTask);
                osPrintf("\n++++++ %d %d +++++\n", rMsg.getMsgSubType(), rMsg.getCmd());
        }

        osPrintf("\n++++++ TaoClientTask::sendRequest %p %s : %d+++++\n", mpConnectionSocket, mRemoteHost.data(), mRemotePort);
        if (!mpConnectionSocket)
        {
                mMutex.acquireWrite();
                mpConnectionSocket = new OsConnectionSocket(mRemotePort, mRemoteHost);
                if (mpAgent)
                {
                        delete mpAgent;
                }
                mpAgent = new TaoTransportAgent(mpConnectionSocket, this);
                mpAgent->start();
                mMutex.releaseWrite();
        }

        int recvd = 0;
        if (mpConnectionSocket && mpConnectionSocket->isOk())
        {
                unsigned int sent;
                mMutex.acquireWrite();

            UtlString buffer;
            ssize_t bufferLen;
            rMsg.getBytes(&buffer, &bufferLen);

                size_t iSendSize = bufferLen + (sizeof(uint32_t)*2) ;

                char* pBuf = new char[iSendSize] ;

                uint32_t cookie = 0x1234ABCD ;
                uint32_t length = bufferLen ;
                memcpy(&pBuf[0], &cookie, sizeof(uint32_t)) ;
                memcpy(&pBuf[sizeof(uint32_t)], &length, sizeof(uint32_t)) ;
                memcpy(&pBuf[sizeof(uint32_t)*2], buffer.data(), bufferLen) ;
                sent = mpConnectionSocket->write(pBuf, iSendSize) ;

                delete pBuf ;

                if (sent > sizeof(uint32_t)*2)
                        sent -= sizeof(uint32_t)*2 ;

                mMutex.releaseWrite();
        }

        return recvd;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:59,代码来源:TaoClientTask.cpp


示例3: while

int TaoTransportAgent::run(void* runArg)
{
        UtlString remoteHostName;
        UtlString viaProtocol;
    UtlString fromIpAddress;

        while (mpSocket && mpSocket->isOk() && !isShuttingDown())
        {
                char          buffer[DEF_TAO_MAX_SOCKET_SIZE];
                unsigned long bytesRead;
                unsigned long cookie ;
                unsigned long length ;

                memset(buffer, 0, (DEF_TAO_MAX_SOCKET_SIZE * sizeof(char)));

                // Look for our next message, it should start with a '1234ABCD' marker
                bytesRead = mpSocket->read((char*) &cookie, sizeof(unsigned long)) ;
                while ((bytesRead > 0) && (cookie != 0x1234ABCD)) {
                        osPrintf("<<**>> Invalid data read from socket, trying to resynchronize...\n") ;
                        bytesRead = readUntilDone(mpSocket, (char*) &cookie, sizeof(unsigned long)) ;
                }
                // Okay, now read length
                if (bytesRead > 0) {
                        bytesRead = readUntilDone(mpSocket, (char*) &length, sizeof(unsigned long)) ;
                }
                // Finally read data
                if (bytesRead > 0) {
                        bytesRead = readUntilDone(mpSocket, buffer, length) ;

                        if (bytesRead != length) {
                                osPrintf("<<**>> TaoTransportAgent READ MISMATCH %lu != %lu\n", bytesRead, length) ;
                                bytesRead = 0 ;
                        }
                }

                if(bytesRead > 0)
                {
                        TaoMessage msg = TaoMessage(UtlString(buffer));
                        msg.setSocket((TaoObjHandle)this);      //stores pointer to this class

                        mpServer->postMessage(msg);
                }
                else if(bytesRead <= 0 || !mpSocket->isOk())
                {
                        // The socket has gone sour close down the client
                        mpSocket->getRemoteHostName(&remoteHostName);
                        osPrintf("Shutting down TaoTransportAgent: %s due to failed socket\n",
                                remoteHostName.data());
                        break;
                }
        }

#ifdef TEST_PRINT
        osPrintf("TaoTransportAgent: %s/%s exiting\r\n", remoteHostName.data(),
                viaName.data());
#endif
        return(0);
}
开发者ID:mranga,项目名称:sipxecs,代码行数:58,代码来源:TaoTransportAgent.cpp


示例4: getDisplayColumns

TaoStatus TaoPhoneComponentAdaptor::getDisplayColumns(TaoMessage& rMsg)
{
        if (rMsg.getArgList())
        {
                rMsg.setMsgSubType(TaoMessage::RESPONSE_PHONECOMPONENT);
                if (mpSvrTransport->postMessage(rMsg))
                        return TAO_SUCCESS;
        }

        return TAO_FAILURE;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:11,代码来源:TaoPhoneComponentAdaptor.cpp


示例5: getRingerInfo

TaoStatus TaoPhoneComponentAdaptor::getRingerInfo(TaoMessage& rMsg)
{
        if (rMsg.getArgCnt())
        {
                int index = atoi(rMsg.getArgList());

                PsMsg msg(PsMsg::RINGER_GET_INFO, this, index, 0);
                mpPhoneTask->postMessage(msg);

                return TAO_SUCCESS;
        }

        return TAO_FAILURE;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:14,代码来源:TaoPhoneComponentAdaptor.cpp


示例6: activateGroup

TaoStatus TaoPhoneComponentAdaptor::activateGroup(TaoMessage& rMsg)
{
        int     argCnt = rMsg.getArgCnt();

        if (argCnt != 1)
                return TAO_FAILURE;

        mpPhoneTask->activateGroup((PsMsg&) rMsg);

        rMsg.setMsgSubType(TaoMessage::RESPONSE_PHONECOMPONENT);
        if (mpSvrTransport->postMessage(rMsg))
                return TAO_SUCCESS;

    return TAO_FAILURE;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:15,代码来源:TaoPhoneComponentAdaptor.cpp


示例7: addCallListener

TaoStatus TaoListenerManager::addCallListener(TaoMessage& rMsg)
{
        TaoStatus ret = TAO_SUCCESS;
        UtlString terminalName;

        TaoString str(rMsg.getArgList(), TAOMESSAGE_DELIMITER);
        terminalName = str[0];

        if (terminalName.isNull() || 0 == terminalName.compareTo("0.0.0.0"))
        {
                if (mListenerCnt <= 0)
                {
                        terminalName = "127.0.0.1";
                        osPrintf("WARNING - TaoListenerManager::addCallListener: using invalid host, replaced with %s\n", terminalName.data());
                }
                else
                {
                        osPrintf("WARNING - TaoListenerManager::addCallListener: using invalid host %s, listener not added.\n", terminalName.data());
                        return TAO_FAILURE;
                }
        }

        mpCallMgr->addTaoListener(this);

        ret = addEventListener(terminalName.data(), TRUE);

        return ret;
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:28,代码来源:TaoListenerManager.cpp


示例8: getButtonInfo

TaoStatus TaoPhoneComponentAdaptor::getButtonInfo(TaoMessage& rMsg)
{
        rMsg.setMsgSubType(TaoMessage::RESPONSE_PHONECOMPONENT);
        if (mpSvrTransport->postMessage(rMsg))
                return TAO_SUCCESS;

        return TAO_FAILURE;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:8,代码来源:TaoPhoneComponentAdaptor.cpp


示例9: arg

TaoStatus TaoPhoneComponentAdaptor::setLampMode(TaoMessage& rMsg)
{
        TaoString arg(rMsg.getArgList(), TAOMESSAGE_DELIMITER);
        UtlString buttonInfo = arg[0];
        int mode = atoi(arg[1]);

        PsMsg msg(PsMsg::LAMP_SET_MODE, this, mode, 0);
        msg.setStringParam1(buttonInfo.data());

        mpPhoneTask->postMessage(msg);

        rMsg.setMsgSubType(TaoMessage::RESPONSE_PHONECOMPONENT);
        if (mpSvrTransport->postMessage(rMsg))
                return TAO_SUCCESS;

        return TAO_FAILURE;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:17,代码来源:TaoPhoneComponentAdaptor.cpp


示例10: removeEventListener

TaoStatus TaoListenerManager::removeEventListener(TaoMessage& rMsg)
{

        UtlString terminalName;
        TaoString str(rMsg.getArgList(), TAOMESSAGE_DELIMITER);
        terminalName = str[0];

        if (terminalName.isNull() || 0 == terminalName.compareTo("0.0.0.0"))
                terminalName = "127.0.0.1";

//    OsWriteLock lock(mListenerRWLock);

        if (mListenerCnt > 0)  // check if listener exists.
        {
                for (int i = 0; i < mListenerCnt; i++)
                {
                        if (mpListeners[i] && mpListeners[i]->mName.compareTo(terminalName) == 0)
                        {
                                mpListeners[i]->mRef--;
                                if (mpListeners[i]->mRef <= 0)
                                {
                                        osPrintf("*** TaoListenerManager::removeEventListener %s 0x%08x %d\n", terminalName.data(), (int)mpListeners[i], mpListeners[i]->mRef);
                                        if (mpListeners[i]->mpListenerPtr)
                                        {
                                                TaoEventListener* pListener = (TaoEventListener*) mpListeners[i]->mpListenerPtr;
                                                delete pListener;
                                        }
                                        delete mpListeners[i];
                                        mpListeners[i] = 0;
                                        mListenerCnt--;

                                        // find and delete the TaoTransportAgent
                                        TaoObjHandle object;
                                        if (TAO_SUCCESS == mpAgents->findValue(terminalName.data(), object))
                                        {
                                                if (object)
                                                {
                                                        osPrintf("TaoListenerManager removeEventListener TaoTransportAgent = %d\n", (int)object);
                                                        TaoTransportAgent *pAgent = (TaoTransportAgent *)object;
                                                        delete pAgent;
                                                }
                                        }
                                        else
                                                osPrintf("TaoListenerManager removeEventListener Failure! did not find socket %s\n", terminalName.data());

                                        if (TAO_SUCCESS == mpAgents->remove(terminalName.data()))
                                        {
                                                osPrintf(" **** TaoListenerManager removeEventListener socket removed %s ****\n", terminalName.data());
                                        }
                                        else
                                                osPrintf("TaoListenerManager removeEventListener Failure! did not remove socket %s\n", terminalName.data());
                                }
                        }
                }
        }

        return TAO_SUCCESS;
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:58,代码来源:TaoListenerManager.cpp


示例11: MpCodec_getLCDContrast

TaoStatus TaoPhoneComponentAdaptor::getDisplayContrast(TaoMessage& rMsg)
{
        int     argCnt = rMsg.getArgCnt();

        if (argCnt != 1)
                return TAO_FAILURE;

#ifdef _VXWORKS
        int nominal = 0;

        if (OS_SUCCESS == MpCodec_getLCDContrastRange(mLCDLow, mLCDHigh, nominal))
        {
                mLCDContrast = MpCodec_getLCDContrast();
                mLCDOffset = mLCDLow - 1;
                osPrintf("--- get LCD contrast level %d ---\n", mLCDContrast);
        }

        UtlString arg;
    char buff[MAXIMUM_INTEGER_STRING_LENGTH];

        int level = mLCDContrast - mLCDOffset;
        if (level < 1)
                level = 1;

    sprintf(buff, "%d", level);
        arg = buff + TAOMESSAGE_DELIMITER;

    sprintf(buff, "%d", 1);
        arg += buff + TAOMESSAGE_DELIMITER;

    sprintf(buff, "%d", (mLCDHigh - mLCDOffset));
        arg += buff + TAOMESSAGE_DELIMITER;

    sprintf(buff, "%d", (nominal - mLCDOffset));
        arg += buff;

        rMsg.setMsgSubType(TaoMessage::RESPONSE_PHONECOMPONENT);
        rMsg.setArgCnt(4);
        rMsg.setArgList(arg.data());
        if (mpSvrTransport->postMessage(rMsg))
                return TAO_SUCCESS;
#endif

    return TAO_FAILURE;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:45,代码来源:TaoPhoneComponentAdaptor.cpp


示例12: getGroupComponents

TaoStatus TaoPhoneComponentAdaptor::getGroupComponents(TaoMessage& rMsg)
{
        int size = atoi(rMsg.getArgList());

        PsMsg msg(PsMsg::PHONEGROUP_GET_COMPONENTS, this, size, 0);
        mpPhoneTask->postMessage(msg);

        return TAO_SUCCESS;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:9,代码来源:TaoPhoneComponentAdaptor.cpp


示例13: buttonDown

TaoStatus TaoPhoneComponentAdaptor::buttonDown(TaoMessage& rMsg)
{
        mInfo = rMsg.getArgList();

        int keyIndex = mpButtonTask->getButtonIndex(mInfo.data());
        if (keyIndex >= 0)
        {
                mpButtonTask->postEvent(PsMsg::BUTTON_DOWN, this, keyIndex);
        }
        else
                rMsg.setObjHandle((TaoObjHandle)TAO_INVALID_ARGUMENT);

        rMsg.setMsgSubType(TaoMessage::RESPONSE_PHONECOMPONENT);
        if (mpSvrTransport->postMessage(rMsg))
                return TAO_SUCCESS;

        return TAO_FAILURE;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:18,代码来源:TaoPhoneComponentAdaptor.cpp


示例14: osPrintf

// get feedback from ps, return to client via transport, used
// by all get and set calls
TaoStatus TaoPhoneComponentAdaptor::returnResult(TaoMessage& rMsg)
{

        osPrintf("->>entering TaoPhoneComponentAdaptor:: returnResult<<-\n");
        rMsg.setMsgSubType(TaoMessage::RESPONSE_PHONECOMPONENT);
        if (mpSvrTransport->postMessage(rMsg))
                return TAO_SUCCESS;

        return TAO_FAILURE;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:12,代码来源:TaoPhoneComponentAdaptor.cpp


示例15: sprintf

TaoStatus TaoPhoneComponentAdaptor::getRingerVolume(TaoMessage& rMsg)
{
        int volume = 0;
        mpPhoneTask->taoGetVolume(volume, PtComponentGroup::RINGER);

    char buff[MAXIMUM_INTEGER_STRING_LENGTH];
    sprintf(buff, "%d", volume);

        rMsg.setMsgSubType(TaoMessage::RESPONSE_PHONECOMPONENT);
        rMsg.setArgCnt(1);
        rMsg.setArgList(buff);


        if (mpSvrTransport->postMessage(rMsg))
        {
                return TAO_SUCCESS;
        }

        return TAO_FAILURE;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:20,代码来源:TaoPhoneComponentAdaptor.cpp


示例16: hookswMsg

TaoStatus TaoPhoneComponentAdaptor::getHookswCall(TaoMessage& rMsg)
{

        PsMsg hookswMsg(PsMsg::HOOKSW_GET_CALL, this, mHookswState, mHookswState);
        mpPhoneTask->postMessage(hookswMsg);

        rMsg.setMsgSubType(TaoMessage::RESPONSE_PHONECOMPONENT);
        if (mpSvrTransport->postMessage(rMsg))
                return TAO_SUCCESS;

        return TAO_FAILURE;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:12,代码来源:TaoPhoneComponentAdaptor.cpp


示例17: receiveMsg

UtlBoolean TaoClientTask::receiveMsg(TaoMessage& rMsg)
{
        TaoObjHandle appHandle = 0;

        appHandle = rMsg.getSocket();   // where the app pointer is stored
        if (appHandle)
        {
                OsProtectedEvent*               pEvent;
                TaoObjHandle    handle;
                UtlString               argList;
                int                             data;

                pEvent  = (OsProtectedEvent *)appHandle;
                handle  = rMsg.getTaoObjHandle();
                data    = rMsg.getArgCnt();
                argList = rMsg.getArgList();

                pEvent->setIntData(data);

                data = rMsg.getCmd();
                pEvent->setIntData2(data);
                pEvent->setStringData(argList);
                // If the event has already been signalled, clean up
        if(OS_ALREADY_SIGNALED == pEvent->signal(handle))
        {
            OsProtectEventMgr* eventMgr = OsProtectEventMgr::getEventMgr();
            eventMgr->release(pEvent);
        }

                return TRUE;
        }
        else
        {
                osPrintf("<<<< TaoClientTask::receiveMsg: no appHandle!! >>>>\n");
                return FALSE;
        }
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:37,代码来源:TaoClientTask.cpp


示例18: getAssociatedPhoneLamp

TaoStatus TaoPhoneComponentAdaptor::getAssociatedPhoneLamp(TaoMessage& rMsg)
{
        //// need work
        
        if (mpLamp)
        {
                

                rMsg.setMsgSubType(TaoMessage::RESPONSE_PHONECOMPONENT);
                if (mpSvrTransport->postMessage(rMsg))
                        return TAO_SUCCESS;
        }

    return TAO_FAILURE;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:15,代码来源:TaoPhoneComponentAdaptor.cpp


示例19: send

int TaoTransportAgent::send(TaoMessage& rMsg)
{
        UtlString buffer;
        ssize_t bufferLen;
        rMsg.getBytes(&buffer, &bufferLen);

        // send the msg to the transport, receive the response
        size_t sent = 0;
        if (mpSocket->isOk() && (bufferLen > 0))
        {
                mWriteSem.acquire() ;

                size_t iSendSize = bufferLen + (sizeof(uint32_t)*2) ;

                char* pBuf = new char[iSendSize] ;

                uint32_t cookie = 0x1234ABCD ;
                uint32_t length = bufferLen ;
                memcpy(&pBuf[0], &cookie, sizeof(uint32_t)) ;
                memcpy(&pBuf[sizeof(uint32_t)], &length, sizeof(uint32_t)) ;
                memcpy(&pBuf[sizeof(uint32_t)*2], buffer.data(), bufferLen) ;
                sent = mpSocket->write(pBuf, iSendSize) ;

                delete pBuf ;

                if (sent > (sizeof(uint32_t)*2))
                        sent -= sizeof(uint32_t)*2 ;

                mWriteSem.release() ;

                if (sent != length) {
                        osPrintf("<<**>> TaoTransportAgent WRITE MISMATCH %zu != %u\n", sent, length) ;
                        sent = 0 ;
                }
        }

        return sent;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:38,代码来源:TaoTransportAgent.cpp


示例20: send

int TaoTransportTask::send(TaoMessage& rMsg)
{
        unsigned int type = rMsg.getMsgSubType();
        unsigned int cmd = rMsg.getCmd();
        if ((TaoMessage::RESPONSE_PROVIDER == type) && (cmd == TaoMessage::SHUTDOWN))
        {
                TaoTransportAgent* pAgent = (TaoTransportAgent *) rMsg.getSocket();

                mpTaoListeningTask->shutdownAgent(pAgent);
                return 0;
        }

        // record this transaction in the transaction db
        rMsg.getMsgID();

        mpTransactionCnt->add();
        mpTransactionCnt->getRef();

        TaoObjHandle remoteServer = rMsg.getMsgQueueHandle();

        if (mClientHandle)
        {
                ((OsServerTask *) mClientHandle)->postMessage(rMsg);
                return 1;
        }
        else if (remoteServer)
        {
                ((OsServerTask *) remoteServer)->postMessage(rMsg);
                return 1;
        }

        // send the msg to the transport, receive the response
        int sent = 0;
        TaoTransportAgent* pAgent = (TaoTransportAgent *) rMsg.getSocket();
        if (pAgent && !pAgent->isShuttingDown())
        {
                sent = pAgent->send(rMsg);
        }

        return sent;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:41,代码来源:TaoTransportTask.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Tape类代码示例发布时间:2022-05-31
下一篇:
C++ TaoCrypt类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap