本文整理汇总了C++中TaoMessage类的典型用法代码示例。如果您正苦于以下问题:C++ TaoMessage类的具体用法?C++ TaoMessage怎么用?C++ TaoMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TaoMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例8: getButtonInfo
TaoStatus TaoPhoneComponentAdaptor::getButtonInfo(TaoMessage& rMsg)
{
rMsg.setMsgSubType(TaoMessage::RESPONSE_PHONECOMPONENT);
if (mpSvrTransport->postMessage(rMsg))
return TAO_SUCCESS;
return TAO_FAILURE;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}