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

C++ sendMsg函数代码示例

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

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



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

示例1: setupUi

dlgIRC::dlgIRC()
{
    setupUi(this);
    session = new IrcSession(this);
    irc->setOpenExternalLinks ( true );
    setUnifiedTitleAndToolBarOnMac( true );
    connect( irc, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));
    connect( session, SIGNAL(messageReceived(IrcMessage*)), this, SLOT(onMessageReceived(IrcMessage*)));
    connect( session, SIGNAL(connected()), this, SLOT(onConnected()));
    connect( lineEdit, SIGNAL(returnPressed()), this, SLOT(sendMsg()));

    QFile file( QDir::homePath()+"/.config/mudlet/irc_nick" );
    file.open( QIODevice::ReadOnly );
    QDataStream ifs( & file );
    QString nick;
    ifs >> nick;
    file.close();

    if( nick.isEmpty() )
    {
        nick = tr("Mudlet%1").arg(QString::number(rand()%10000));
        QFile file( QDir::homePath()+"/.config/mudlet/irc_nick" );
        file.open( QIODevice::WriteOnly | QIODevice::Unbuffered );
        QDataStream ofs( & file );
        ofs << nick;
        file.close();
    }

    session->setNickName(nick);
    mNick = nick;
    session->setUserName("mudlet");
    session->setRealName(mudlet::self()->version);
    session->setHost("irc.freenode.net");
    session->setPort(6667);
    session->open();
}
开发者ID:EldFitheach,项目名称:Mudlet,代码行数:36,代码来源:dlgIRC.cpp


示例2: LOGFMTE

bool IServerApp::sendMsg(  uint32_t nSessionID , const char* pBuffer , uint16_t nLen, bool bBroadcast )
{
	if ( isConnected() == false )
	{
		LOGFMTE("target svr is not connect , send msg failed") ;
		return false ;
	}
	stMsgTransferData msgTransData ;
	msgTransData.nSenderPort = getLocalSvrMsgPortType() ;
	msgTransData.bBroadCast = bBroadcast ;
	msgTransData.nSessionID = nSessionID ;
	int nLne = sizeof(msgTransData) ;
	if ( nLne + nLen >= MAX_MSG_BUFFER_LEN )
	{
		stMsg* pmsg = (stMsg*)pBuffer ;
		LOGFMTE("msg send to session id = %d , is too big , cannot send , msg id = %d ",nSessionID,pmsg->usMsgType) ;
		return false;
	}
	memcpy_s(m_pSendBuffer ,sizeof(m_pSendBuffer),&msgTransData,nLne);
	memcpy_s(m_pSendBuffer + nLne ,sizeof(m_pSendBuffer) - nLne, pBuffer,nLen );
	nLne += nLen ;
	sendMsg(m_pSendBuffer,nLne);
	return true ;
}
开发者ID:BillXu,项目名称:NewProject,代码行数:24,代码来源:ISeverApp.cpp


示例3: sendMsg

 void TcpThread::opeatorData()
 {
      OperatorSql w;
      char ch = data[2].at(0).toAscii(); //将QChar 转换为标准C语言的ASCII,上网找了,switch在QT中只能支持整型对象
                      //操作数据库

      if (!w.createConnection()) {


         sendMsg(tr("SQL_LINK_ERROR"));

         return;
      }


/*
      if(!w.verifyUser(data[0],data[1]))//用户名密码错误
     {


         sendMsg(tr("USER_PASSWORD_ERROR"));
         tcpSocket->disconnectFromHost();//断开连接
      QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
         qDebug()<< tr("用户或者密码不正确!")<<"\n";

         return;
     }

*/

       QString sqlstr = data[3];//取出SQL语句
         switch(ch)
         {

             case 'Q':  {

            w.queryRecode(sqlstr);

             saveLog();
             break;//保存日志
         }
         case 'A':  {
            if(w.addRecode(sqlstr))
            {
            sendMsg(tr("ADD_SUCCESS"));
            saveLog();
             break;
            }
            else
             {
                 sendMsg(tr("ADD_FAILED"));
                 break;
             }
             }
         case 'D': {

            if(w.deleteRecode(sqlstr))
            {
             sendMsg(tr("DELETE_SUCCESS")) ;
             saveLog();
             break;
         }
            else
             {
                 sendMsg(tr("DELETE_FAILED"));
                 break;
             }
              }
         case 'U':   {
            if( w.updateRecode(sqlstr)) {
              sendMsg(tr("UPDATE_SUCCESS"));
             saveLog();
             break;
         }
         else
                 {
                     sendMsg(tr("UPDATE_FAILED"));
                     break;
                 }
            }
             default:  sendMsg(tr("UNKOWN_ERROR")); break;


        }

}
开发者ID:sunjunior,项目名称:Application-with-QT-SDK,代码行数:86,代码来源:tcpthread.cpp


示例4: move

bool
Monitor::coach_move( const char * command )
{
    char obj[128];
    double x = 0.0, y = 0.0, ang = 0.0, velx = 0.0, vely = 0.0;

    int n = std::sscanf( command,
                         " ( move ( %127[^)] ) %lf %lf %lf %lf %lf ) ",
                         obj, &x, &y, &ang, &velx, &vely );

    if ( n < 3
         || std::isnan( x ) != 0
         || std::isnan( y ) != 0
         || std::isnan( ang ) != 0
         || std::isnan( velx ) != 0
         || std::isnan( vely ) != 0 )
    {
        sendMsg( MSG_BOARD, "(error illegal_object_form)" );
        return false;
    }

    std::string obj_name = "(";
    obj_name += obj;
    obj_name += ')';

    if ( obj_name == BALL_NAME )
    {
        M_stadium.clearBallCatcher();

        if ( n == 3 || n == 4 )
        {
            M_stadium.moveBall( PVector( x, y ), PVector( 0.0, 0.0 ) );
        }
        else if ( n == 6 )
        {
            M_stadium.moveBall( PVector( x, y ), PVector( velx, vely ) );
        }
        else
        {
            sendMsg( MSG_BOARD, "(error illegal_command_form)" );
            return false;
        }
    }
    else
    {
        char teamname[128];
        int unum = 0;

        if ( std::sscanf( obj_name.c_str(),
                          PLAYER_NAME_FORMAT,
                          teamname, &unum ) != 2
             || unum < 1
             || MAX_PLAYER < unum )
        {
            sendMsg( MSG_BOARD, "(error illegal_object_form)" );
            return false;
        }

        Side side = ( M_stadium.teamLeft().name() == teamname
                      ? LEFT
                      : M_stadium.teamRight().name() == teamname
                      ? RIGHT
                      : NEUTRAL );

        PVector pos( x, y );
        PVector vel( velx, vely );
        ang = Deg2Rad( rcss::bound( ServerParam::instance().minMoment(),
                                    ang,
                                    ServerParam::instance().maxMoment() ) );
        if ( n == 3 )
        {
            M_stadium.movePlayer( side, unum, pos, NULL, NULL );
        }
        else if ( n == 4 )
        {
            M_stadium.movePlayer( side, unum, pos, &ang, NULL );
        }
        else if ( n == 6 )
        {
            M_stadium.movePlayer( side, unum, pos, &ang, &vel );
        }
        else
        {
            sendMsg( MSG_BOARD, "(error illegal_command_form)" );
            return false;
        }
    }

    sendMsg( MSG_BOARD, "(ok move)" );
    return true;
}
开发者ID:edymanoloiu,项目名称:FotbalRobotic,代码行数:91,代码来源:monitor.cpp


示例5: sendMsg

void elFlowPort::sendCmd( const std::string& cmd )
{
    sendMsg( cmd.c_str(), cmd.size(), false );
}
开发者ID:bchjoerni,项目名称:mlab,代码行数:4,代码来源:elflowport.cpp


示例6: contextMnu

void IdDialog::IdListCustomPopupMenu( QPoint )
{
	QMenu contextMnu( this );


	std::list<RsGxsId> own_identities ;
	rsIdentity->getOwnIds(own_identities) ;

	QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
	if (item) {
		uint32_t item_flags = item->data(RSID_COL_KEYID,Qt::UserRole).toUInt() ;

		if(!(item_flags & RSID_FILTER_OWNED_BY_YOU))
		{
			if(own_identities.size() <= 1)
			{
				QAction *action = contextMnu.addAction(QIcon(":/images/chat_24.png"), tr("Chat with this person"), this, SLOT(chatIdentity()));

				if(own_identities.empty())
					action->setEnabled(false) ;
				else
					action->setData(QString::fromStdString((own_identities.front()).toStdString())) ;
			}
			else
			{
				QMenu *mnu = contextMnu.addMenu(QIcon(":/images/chat_24.png"),tr("Chat with this person as...")) ;

				for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
				{
					RsIdentityDetails idd ;
					rsIdentity->getIdDetails(*it,idd) ;

					QPixmap pixmap ;

					if(idd.mAvatar.mSize == 0 || !pixmap.loadFromData(idd.mAvatar.mData, idd.mAvatar.mSize, "PNG"))
						pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(*it)) ;

					QAction *action = mnu->addAction(QIcon(pixmap), QString("%1 (%2)").arg(QString::fromUtf8(idd.mNickname.c_str()), QString::fromStdString((*it).toStdString())), this, SLOT(chatIdentity()));
					action->setData(QString::fromStdString((*it).toStdString())) ;
				}
			}

			contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message to this person"), this, SLOT(sendMsg()));
		}
	}

	contextMnu.addSeparator();

	contextMnu.addAction(ui->editIdentity);
	contextMnu.addAction(ui->removeIdentity);
	
	contextMnu.addSeparator();

	contextMnu.exec(QCursor::pos());
}
开发者ID:rodneyrod,项目名称:RetroShare,代码行数:55,代码来源:IdDialog.cpp


示例7: sendMsg

//
// bool sendState(toID)
// Last modified: 27Aug2006
//
// Attempts to send the state of the cell
// to the neighbor with the parameterized ID,
// returning true if successful, false otherwise.
//
// Returns:     true if successful, false otherwise
// Parameters:
//      toID    in      the ID of the receiving neighbor
//
bool Cell::sendState(const GLint toID)
{
    return sendMsg(new State(*this), toID, STATE);
}   // sendState(const GLint)
开发者ID:dtbinh,项目名称:lego-rover-formation,代码行数:16,代码来源:Cell.cpp


示例8: obp_canraw


//.........这里部分代码省略.........
			break;
		    case PARAM_CANRAW_SENDID:
			protocolConfig->recvID = args->args[ARG_VALUE_1];
			createCommandResultMsg(FBID_PROTOCOL_SPEC,
					       ERR_CODE_NO_ERR, 0, NULL);
			break;
		    default:
			createCommandResultMsg(FBID_PROTOCOL_SPEC,
					       ERR_CODE_OS_UNKNOWN_COMMAND,
					       0,
					       ERR_CODE_OS_UNKNOWN_COMMAND_TEXT);
			break;
		    }
		    break;
//>>>> oobdtemple protocol MSG_OTHERS >>>>    
		case FBID_BUS_GENERIC:
		case FBID_BUS_SPEC:
		    actBus_param(args);	/* forward the received params to the underlying bus. */
		    break;
		default:
		    createCommandResultMsg(FBID_PROTOCOL_SPEC,
					   ERR_CODE_OS_UNKNOWN_COMMAND,
					   0,
					   ERR_CODE_OS_UNKNOWN_COMMAND_TEXT);
		    break;
		}
//<<<< oobdtemple protocol MSG_OTHERS <<<<
//>>>> oobdtemple protocol MSG_INIT >>>>    
	    case MSG_INIT:
		if (protocolBuffer != NULL) {
		    protocolBuffer->len = 0;
		}
//<<<< oobdtemple protocol MSG_INIT <<<<
//>>>> oobdtemple protocol MSG_PROTOCOL_STOP >>>>    
		break;
	    case MSG_PROTOCOL_STOP:
		keeprunning = 0;
		break;
//<<<< oobdtemple protocol MSG_PROTOCOL_STOP <<<<
//>>>> oobdtemple protocol MSG_SEND_BUFFER >>>>    
	    case MSG_SEND_BUFFER:
		/* let's Dance: Starting the transfer protocol */
//<<<< oobdtemple protocol MSG_SEND_BUFFER <<<<
		if (protocolBuffer->len > 0) {
		    actBufferPos = 0;
		    for (; sendMoreFrames(protocolBuffer, &actBufferPos, &protocolConfig->showBusTransfer, &stateMachine_state, &timeout, printdata_CAN, actBus_send););	// fire all in one shot.
//>>>> oobdtemple protocol MSG_SEND_BUFFER_2 >>>>    
		} else {	/* no data to send? */
		    createCommandResultMsg
			(FBID_PROTOCOL_GENERIC, ERR_CODE_NO_ERR, 0, NULL);
		    /* just release the input again */
		    if (pdPASS !=
			sendMsg(MSG_SERIAL_RELEASE, inputQueue, NULL)) {
			printser_string("Input queue is full!");
			DEBUGPRINT
			    ("FATAL ERROR: input queue is full!\n", 'a');
		    }
		}
		break;
//<<<< oobdtemple protocol MSG_SEND_BUFFER_2 <<<<
//>>>> oobdtemple protocol MSG_TICK >>>>    
	    case MSG_TICK:
//<<<< oobdtemple protocol MSG_TICK <<<<
		if (timeout > 0) {	/* we just waiting for the next frame to send */
		    if (timeout == 1) {	/* time's gone... */
			for (; sendMoreFrames(protocolBuffer, &actBufferPos, &protocolConfig->showBusTransfer, &stateMachine_state, &timeout, printdata_CAN, actBus_send););	// fire all in one shot.
			if (timeout < 2) {	//
			    protocolBuffer->len = 0;
			    createCommandResultMsg
				(FBID_PROTOCOL_GENERIC,
				 ERR_CODE_NO_ERR, 0, NULL);
			    stateMachine_state = SM_CANRAW_STANDBY;
			    if (pdPASS !=
				sendMsg(MSG_SERIAL_RELEASE, inputQueue,
					NULL)) {
				printser_string("INPQUE_FULL");
				DEBUGPRINT
				    ("FATAL ERROR: input queue is full!\n",
				     'a');
			    }
			}
		    }
		    timeout--;
		}
//>>>> oobdtemple protocol final >>>>    
		break;
	    }
	    disposeMsg(msg);
	}
	/* vTaskDelay (5000 / portTICK_PERIOD_MS); */

    }

    /* Do all cleanup here to finish task */
    actBus_close();
    vPortFree(protocolConfig);
    freeODPBuffer(protocolBuffer);
    xSemaphoreGive(protocollBinarySemaphore);
    vTaskDelete(NULL);
}
开发者ID:fkuppens,项目名称:oobd,代码行数:101,代码来源:odp_canraw.c


示例9: main

int main()
{
	unsigned long nMsg = 0;
	char *cmnd, *uname1, *uname2;
	int k;
	user *users = NULL;
	
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	
	cmnd = (char*)malloc(sizeof(char)*10);
	while(scanf("%s", cmnd)!=EOF)
	{
		if(DEBUG)
			printf("cmnd read: %s\n", cmnd);
			
		if(!strcmp(cmnd, "ADD"))
		{
			uname1 = getUser();
			if(users==NULL)
				init(uname1, &users);
			else
				addUser(uname1, users);
		}
		else if(!strcmp(cmnd, "FOLLOW"))
		{
			uname1 = getUser(), uname2 = getUser();
			follow(uname1, uname2, users);
		}
		else if(!strcmp(cmnd, "SEND"))
		{
			uname1 = getUser();
			sendMsg(uname1, ++nMsg, users);
		}
		else if(!strcmp(cmnd, "RESEND"))
		{
			uname1 = getUser();
			scanf("%d", &k);
			resendMsg(uname1, k, users);
		}
		else if(!strcmp(cmnd, "INACTIVE"))
		{
			uname1 = getUser();
			inactivate(uname1, users);
		}
		else if(!strcmp(cmnd, "ACTIVE"))
		{
			uname1 = getUser();
			activate(uname1, users);
		}
		else //UNFOLLOW
		{
			uname1 = getUser(), uname2 = getUser();
			unfollow(uname1, uname2, users);
		}
	}
	
	user *cur = users;
	do
	{
		print(*cur);
		cur = cur->next;
	}
	while(cur!=users);
	
	return 0;
}
开发者ID:Trietptm-on-Coding-Algorithms,项目名称:Algorithms-1,代码行数:67,代码来源:the3.c


示例10: sendMsg

// Get the msg types for Destination and Position.
void PathingController::receivePosMsg(const owr_messages::position &msg) {
   currLat = msg.latitude;
   currLong = msg.longitude;
   currHeading = msg.heading;
   sendMsg();
}
开发者ID:bluesat,项目名称:owr_software,代码行数:7,代码来源:PathingController.cpp


示例11: pthread_mutex_lock

int
ManagerFilter::handleNeedMore(AHData* msg)
{
    int* iMsg = (int*)msg->getData();
    int pId = iMsg[0];
    int mId = iMsg[1];

    pthread_mutex_lock(&mLog);
//    log << "Received work request from " << pId << " with mId: " << mId;
//    log << ", expected mId: " << lastId[pId]+1 << std::endl;
    pthread_mutex_unlock(&mLog);

    // Handle Work Request
    // Check if we should answer the request.
    if (mId <= lastId[pId] ) return 1;

    int* pMsg;
    size_t msgSize = 0;
    pthread_mutex_lock(&mWorkQueue);
    // If we have work
    if (!workQueue.empty()) 
    {
        // Mark that he has work and update lastId
        hasWork[pId] = true;
        lastId[pId]++;

        // Build char message
        std::list<Candidate> workToSend;
        workToSend.push_front(workQueue.front());
        workQueue.pop();
        pMsg = list2Msg(workToSend, pId, msgSize);
    }
    // If we don't have work
    else
    {
        // Mark no work for this pId
        hasWork[pId] = false;

        // Loop through all known clients, to see if someone has work
        bool someWork = false;
        std::map<int,bool>::iterator it;
        for (it = hasWork.begin(); it != hasWork.end(); it++) 
        {
            if (it->second)
            {
                someWork = true;
                break;
            }
        }

        // If none has work to do, we can stop
        if (!someWork) 
        {
            pMsg = buildEowMsg(msgSize);
            closeEventList(this->sNeedMore);
            closeEventList(this->sNewWork);
        }
        // Otherwise, ask for work
        else
        {
            // Send msg
            pthread_mutex_lock(&mStatus);
            if (!this->hasRequest) {
                this->hasRequest = true;
                AHData* askForMore = new AHData(new int(msgId), sizeof(int), 
                                                sWorkRequest);
                sendMsg(askForMore);
            }
            pthread_mutex_unlock(&mStatus);
            pMsg = 0;
        }
    }
    pthread_mutex_unlock(&mWorkQueue);

    if (msgSize != 0)
    {
        std::cout << ">>>>> MANAGER <<<<<<" << std::endl;
        std::cout << " >> MSG: " << pMsg << std::endl;
        AHData* d = new AHData(pMsg, msgSize, sOut);
        sendMsg(d);
    }

    delete msg;
    return 1; 
}
开发者ID:leolvt,项目名称:FSPD-SCORP,代码行数:85,代码来源:ManagerFilter.cpp


示例12: sendMsg

ssize_t CClient::sendWlcomeMsg(){
    string ret = "220 SimpleFtpServer\r\n";
    return sendMsg(ret);
}
开发者ID:jrubin123,项目名称:SimpleFtpServer,代码行数:4,代码来源:CClient.cpp


示例13: mBlogId

/** Constructor */
CreateBlogMsg::CreateBlogMsg(std::string cId ,QWidget* parent, Qt::WFlags flags)
: mBlogId(cId), QMainWindow (parent, flags)
{
	/* Invoke the Qt Designer generated object setup routine */
	ui.setupUi(this);

	setAttribute ( Qt::WA_DeleteOnClose, true );

	setupFileActions();
  setupEditActions();
  setupViewActions();
  setupInsertActions();
  setupParagraphActions();
  
  setAcceptDrops(true);
	setStartupText();
	
	newBlogMsg();
		
	ui.toolBar_2->addAction(ui.actionIncreasefontsize);
  ui.toolBar_2->addAction(ui.actionDecreasefontsize);
  ui.toolBar_2->addAction(ui.actionBlockquoute);
  ui.toolBar_2->addAction(ui.actionOrderedlist);
  ui.toolBar_2->addAction(ui.actionUnorderedlist);
  ui.toolBar_2->addAction(ui.actionBlockquoute);
  ui.toolBar_2->addAction(ui.actionCode);
  ui.toolBar_2->addAction(ui.actionsplitPost);
  
  setupTextActions();

	connect(ui.actionPublish, SIGNAL(triggered()), this, SLOT(sendMsg()));
	connect(ui.actionNew, SIGNAL(triggered()), this, SLOT (fileNew()));
	
	connect(ui.actionIncreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeIncrease()));
  connect(ui.actionDecreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeDecrease()));
  connect(ui.actionBlockquoute, SIGNAL (triggered()), this, SLOT (blockQuote()));
  connect(ui.actionCode, SIGNAL (triggered()), this, SLOT (toggleCode()));
  connect(ui.actionsplitPost, SIGNAL (triggered()), this, SLOT (addPostSplitter()));  
  connect(ui.actionOrderedlist, SIGNAL (triggered()), this, SLOT (addOrderedList()));
  connect(ui.actionUnorderedlist, SIGNAL (triggered()), this, SLOT (addUnorderedList()));

  //connect(webView, SIGNAL(loadFinished(bool)),this, SLOT(updateTextEdit()));
  connect( ui.msgEdit, SIGNAL( textChanged(const QString &)), this, SLOT(updateTextEdit()));
  
  connect( ui.msgEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)),
            this, SLOT(currentCharFormatChanged(QTextCharFormat)));
  connect( ui.msgEdit, SIGNAL(cursorPositionChanged()),
            this, SLOT(cursorPositionChanged()));
	
	QPalette palette = QApplication::palette();
  codeBackground = palette.color( QPalette::Active, QPalette::Midlight );
  
  fontChanged(ui.msgEdit->font());
  colorChanged(ui.msgEdit->textColor());
  alignmentChanged(ui.msgEdit->alignment());
  
    connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)),
            actionSave, SLOT(setEnabled(bool)));
    connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)),
            this, SLOT(setWindowModified(bool)));
    connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)),
            actionUndo, SLOT(setEnabled(bool)));
    connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)),
            ui.actionUndo, SLOT(setEnabled(bool)));        
    connect( ui.msgEdit->document(), SIGNAL(redoAvailable(bool)),
            actionRedo, SLOT(setEnabled(bool)));

    setWindowModified( ui.msgEdit->document()->isModified());
    actionSave->setEnabled( ui.msgEdit->document()->isModified());
    actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable());
    ui.actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable());
    actionRedo->setEnabled( ui.msgEdit->document()->isRedoAvailable());

    connect(actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo()));
    connect(ui.actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo()));
    connect(actionRedo, SIGNAL(triggered()), ui.msgEdit, SLOT(redo()));
    
    actionCut->setEnabled(false);
    actionCopy->setEnabled(false);

    connect(actionCut, SIGNAL(triggered()), ui.msgEdit, SLOT(cut()));
    connect(actionCopy, SIGNAL(triggered()), ui.msgEdit, SLOT(copy()));
    connect(actionPaste, SIGNAL(triggered()), ui.msgEdit, SLOT(paste()));
    
    connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool)));
    connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool)));
    
#ifndef QT_NO_CLIPBOARD
    connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
#endif
  
  //defaultCharFormat
  defaultCharFormat = ui.msgEdit->currentCharFormat();

  const QFont defaultFont = ui.msgEdit->document()->defaultFont();
  defaultCharFormat.setFont( defaultFont );
  defaultCharFormat.setForeground( ui.msgEdit->currentCharFormat().foreground() );
  defaultCharFormat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) );
  defaultCharFormat.setBackground( palette.color( QPalette::Active,
//.........这里部分代码省略.........
开发者ID:boukeversteegh,项目名称:retroshare,代码行数:101,代码来源:CreateBlogMsg.cpp


示例14: solver

int solver(int *map, int x1, int y1, int x2, int y2, int *stones, int n)
{
	int i;
	int x, y;

	/*
	printf("(%d, %d) ~ (%d, %d)\n\n", x1, y1, x2, y2);

	printf("Map\n");
	for (y=0; y<32; y++) {
		printf("\t");
		for (x=0; x<32; x++) printf("%d", MAP(x, y));
		printf("\n");
	}
	printf("\n");

	printf("Stones\n");
	for (i=0; i<n; i++) {
		printf("\tstone %d\n", i+1);
		for (y=0; y<8; y++) {
			printf("\t\t");
			for (x=0; x<8; x++) printf("%d", STONE(i, x, y));
			printf("\n");
		}
	}
	printf("\n");
	*/

	/* Solutions for light.txt */
	char *solutions[] = {
		"H 0 2 2\n",
		"H 0 2 2\nT 0 -6 0\n",
		"H 0 2 2\nT 0 -6 0\n\nH 0 1 -1\n",
		NULL
	};

	printf("Solutions\n");
	for (i=0; (solutions[i] != NULL); i++) {
		sleep(5);
		printf("Solutin %d\n", i+1);

		// Padding
		int j, line = 0;
		for (j=0; (solutions[i][j] != '\0'); j++) {
			if (solutions[i][j] == '\n') line++;
		}

		// Like a START BIT
		sendMsg("S");

		// Main
		sendMsg(solutions[i]);
		for (j=0; j<(n - line); j++) sendMsg("");

		// Prepare for next problem
		if (sendMsg("E") == EXIT_FAILURE)
			return EXIT_SUCCESS;	// transition to `Ready state`
	}

	// Forced termination
	return EXIT_FAILURE;
}
开发者ID:KNCT-KPC,项目名称:Bungo,代码行数:62,代码来源:sample.cpp


示例15: Marmote_StopStreaming

void Marmote_StopStreaming(FT_HANDLE ftHandle)
{
	uint8_t dummy;
	sendMsg(ftHandle, SDR, STOP_STREAMING, &dummy, 0);
}
开发者ID:kitnic,项目名称:marmote,代码行数:5,代码来源:MarmoteControl.cpp


示例16: odp_canraw_recvdata

void odp_canraw_recvdata(data_packet * p, UBaseType_t callFromISR)
{
    extern print_cbf printdata_CAN;
    extern printChar_cbf printChar;
    extern protocolConfigPtr actProtConfigPtr;
    struct CanRawConfig *protocolConfig;
    short ByteCnt;

    if (callFromISR)
	xTickNew = (uint16_t) xTaskGetTickCountFromISR();
    else
	xTickNew = (uint16_t) xTaskGetTickCount();

    if (xTickNew < xTickOld)	// check for xTick overflow
	xTickOld = 0;

    if (xTickCurrent >= 59999)	// limit timestamp to 0-59999 tick (ms)
	xTickCurrent = 0;

    xTickCurrent = xTickCurrent + (xTickNew - xTickOld);
    xTickOld = xTickNew;	// set latest value to xTickOld for next duration
    p->timestamp = xTickCurrent;

    protocolConfig = actProtConfigPtr;
    if (protocolConfig != NULL) {
	if (protocolConfig->showBusTransfer == 1) {	//normal output
	    MsgData *msg;
	    extern QueueHandle_t protocolQueue;
	    if (NULL != (msg = createDataMsg(p))) {
		UBaseType_t res = 0;
		if (callFromISR) {
		    res = sendMsgFromISR(MSG_BUS_RECV, protocolQueue, msg);
		} else {
		    res = sendMsg(MSG_BUS_RECV, protocolQueue, msg);
		}
		if (res != pdPASS) {
		    disposeMsg(msg);
		    DEBUGPRINT("FATAL ERROR: protocol queue is full!\n",
			       'a');
		}
	    } else {
		DEBUGPRINT("FATAL ERROR: Out of Heap space!l\n", 'a');
	    }
	}
	if (protocolConfig->showBusTransfer == 2) {	//normal output, but straight from the ISR
	    printdata_CAN(MSG_BUS_RECV, p, printChar);
	}
	if (protocolConfig->showBusTransfer == 3) {
	    // Lawicel format: Estimated out of http://lxr.free-electrons.com/source/drivers/net/can/slcan.c line 110 cc.
	    if (p->recv & 0x80000000) {	// Bit 32 set, so it's an extended CAN ID
		printser_string("T");
		printser_uint32ToHex(p->recv & 0x1FFFFFFF);
	    } else {
		printser_string("t");
		printser_int((p->recv & 0x700) >> 8, 10);
		printser_uint8ToHex(p->recv & 0x00FF);
	    }
	    printser_int(p->len, 10);
	    ByteCnt = 0;
	    while (ByteCnt != p->len) {
		printser_uint8ToHex(p->data[ByteCnt]);
		ByteCnt++;
	    }
	    if (p->err == 0x01)
		printser_string("FFFF");	// if error occurs set timestamp to 0xFFFF
	    else
		printser_uint16ToHex(p->timestamp * portTICK_PERIOD_MS & 0xFFFF);	//reduce down to 16 bit = 65536 ms = ~ 1 min
	    printLF();
	}
	if (protocolConfig->showBusTransfer == 4) {
	    printser_uint8ToRaw(255);	//startbyte
	    printser_uint8ToRaw((p->len & 0xF) |	// bit 0-3: DLC
				((p->err & 3) << 4) |	//bit 4-5 : Error flag
				(((p->recv & 0x80000000) ? 1 : 0) << 5)	//bit 6: Extended CAN ID
		);		//Status flag
	    printser_uint16ToRawCoded(p->timestamp * portTICK_PERIOD_MS & 0xFFFF);	//reduce down to 16 bit = 65536 ms = ~ 1 min
	    if ((p->recv & 0x80000000)) {	// Bit 32 set, so it's an exended CAN ID
		printser_uint32ToRawCoded(p->recv & 0x1FFFFFFF);
	    } else {
		printser_uint16ToRawCoded(p->recv & 0x1FFFFFFF);
	    }
	    int i;

	    for (i = 0; i < p->len; i++) {
		printser_uint8ToRawCoded(p->data[i]);
	    }
	}
    }
}
开发者ID:fkuppens,项目名称:oobd,代码行数:89,代码来源:odp_canraw.c


示例17: handleButton

/*
 * Handler for all the buttons
 * The actual keyboard message to send is passed through evt->extra.
 */
int handleButton (struct pgEvent * evt)
{
  sendMsg (evt->extra);

  return 1;
}
开发者ID:scanlime,项目名称:picogui,代码行数:10,代码来源:pgboard_cmds.c


示例18: RsGxsUpdateBroadcastPage

/** Constructor */
IdDialog::IdDialog(QWidget *parent) :
    RsGxsUpdateBroadcastPage(rsIdentity, parent),
    ui(new Ui::IdDialog)
{
	ui->setupUi(this);

	mIdQueue = NULL;

	/* Setup UI helper */
	mStateHelper = new UIStateHelper(this);
//	mStateHelper->addWidget(IDDIALOG_IDLIST, ui->idTreeWidget);
	mStateHelper->addLoadPlaceholder(IDDIALOG_IDLIST, ui->idTreeWidget, false);
	mStateHelper->addClear(IDDIALOG_IDLIST, ui->idTreeWidget);

	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_Nickname);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_KeyId);
//	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_GpgHash);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_GpgId);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_GpgName);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_Type);
    mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_LastUsed);
    mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->toolButton_Reputation);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->line_RatingOverall);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->line_RatingImplicit);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->line_RatingOwn);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->line_RatingPeers);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->repModButton);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->repMod_Accept);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->repMod_Ban);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->repMod_Negative);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->repMod_Positive);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->repMod_Custom);
	mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->repMod_spinBox);

	mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_Nickname);
	mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_GpgName);
	mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_KeyId);
//	mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_GpgHash);
	mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_GpgId);
	mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_Type);
	mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_GpgName);
    mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_LastUsed);
    mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->line_RatingOverall);
	mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->line_RatingImplicit);
	mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->line_RatingOwn);
	mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->line_RatingPeers);

	mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_Nickname);
	mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_KeyId);
//	mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_GpgHash);
	mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_GpgId);
	mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_Type);
    mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_GpgName);
    mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_LastUsed);
    mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->line_RatingOverall);
	mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->line_RatingImplicit);
	mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->line_RatingOwn);
	mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->line_RatingPeers);

	//mStateHelper->addWidget(IDDIALOG_REPLIST, ui->treeWidget_RepList);
	//mStateHelper->addLoadPlaceholder(IDDIALOG_REPLIST, ui->treeWidget_RepList);
	//mStateHelper->addClear(IDDIALOG_REPLIST, ui->treeWidget_RepList);

	/* Connect signals */
	connect(ui->toolButton_NewId, SIGNAL(clicked()), this, SLOT(addIdentity()));
	connect(ui->todoPushButton, SIGNAL(clicked()), this, SLOT(todo()));

	connect(ui->removeIdentity, SIGNAL(triggered()), this, SLOT(removeIdentity()));
	connect(ui->editIdentity, SIGNAL(triggered()), this, SLOT(editIdentity()));
	connect(ui->chatIdentity, SIGNAL(triggered()), this, SLOT(chatIdentity()));

	connect(ui->idTreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelection()));
	connect(ui->idTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(IdListCustomPopupMenu(QPoint)));

	connect(ui->filterComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterComboBoxChanged()));
	connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
	connect(ui->repModButton, SIGNAL(clicked()), this, SLOT(modifyReputation()));
	
	connect(ui->messageButton, SIGNAL(clicked()), this, SLOT(sendMsg()));

	ui->avlabel->setPixmap(QPixmap(":/images/user/friends64.png"));
	ui->headerTextLabel->setText(tr("People"));

	/* Initialize splitter */
	ui->splitter->setStretchFactor(0, 1);
	ui->splitter->setStretchFactor(1, 0);

	QList<int> sizes;
	sizes << width() << 500; // Qt calculates the right sizes
	ui->splitter->setSizes(sizes);

	/* Add filter types */
    ui->filterComboBox->addItem(tr("All"), RSID_FILTER_ALL);
    ui->filterComboBox->addItem(tr("Owned by you"), RSID_FILTER_OWNED_BY_YOU);
    ui->filterComboBox->addItem(tr("Linked to your node"), RSID_FILTER_YOURSELF);
    ui->filterComboBox->addItem(tr("Linked to neighbor nodes"), RSID_FILTER_FRIENDS);
    ui->filterComboBox->addItem(tr("Linked to distant nodes"), RSID_FILTER_OTHERS);
    ui->filterComboBox->addItem(tr("Anonymous"), RSID_FILTER_PSEUDONYMS);
	ui->filterComboBox->setCurrentIndex(0);
//.........这里部分代码省略.........
开发者ID:rodneyrod,项目名称:RetroShare,代码行数:101,代码来源:IdDialog.cpp


示例19: switch

double RobotController::onAction(ActionEvent &evt)
{
    switch(m_state){

  // 初期姿勢を設定 seting initial pose
  case 0: {
    //broadcastMsgToSrv("Let's start the clean up task\n");
    sendMsg("VoiceReco_Service","Let's start the clean up task\n");
    double angL1 =m_my->getJointAngle("LARM_JOINT1")*180.0/(PI);
    double angL4 =m_my->getJointAngle("LARM_JOINT4")*180.0/(PI);
    double angR1 =m_my->getJointAngle("RARM_JOINT1")*180.0/(PI);
    double angR4 =m_my->getJointAngle("RARM_JOINT4")*180.0/(PI);
    double thetaL1 = -20-angL1;
    double thetaL4 = -160-angL4;
    double thetaR1 = -20-angR1;
    double thetaR4 = -160-angR4;
    if(thetaL1<0) m_my->setJointVelocity("LARM_JOINT1", -m_jvel, 0.0);
    else m_my->setJointVelocity("LARM_JOINT1", m_jvel, 0.0);
    if(thetaL4<0) m_my->setJointVelocity("LARM_JOINT4", -m_jvel, 0.0);
    else m_my->setJointVelocity("LARM_JOINT4", m_jvel, 0.0);
    if(thetaR1<0) m_my->setJointVelocity("RARM_JOINT1", -m_jvel, 0.0);
    else m_my->setJointVelocity("RARM_JOINT1", m_jvel, 0.0);
    if(thetaR4<0) m_my->setJointVelocity("RARM_JOINT4", -m_jvel, 0.0);
    else m_my->setJointVelocity("RARM_JOINT4", m_jvel, 0.0);
    m_time_LA1 = DEG2RAD(abs(thetaL1))/ m_jvel + evt.time();
    m_time_LA4 = DEG2RAD(abs(thetaL4))/ m_jvel + evt.time();
    m_time_RA1 = DEG2RAD(abs(thetaR1))/ m_jvel + evt.time();
    m_time_RA4 = DEG2RAD(abs(thetaR4))/ m_jvel + evt.time();
    m_state = 1;
    break;
  }
  // 初期姿勢に移動 moving initial pose
  case 1: {
    if(evt.time() >= m_time_LA1) m_my->setJointVelocity("LARM_JOINT1", 0.0, 0.0);
    if(evt.time() >= m_time_LA4) m_my->setJointVelocity("LARM_JOINT4", 0.0, 0.0);
    if(evt.time() >= m_time_RA1) m_my->setJointVelocity("RARM_JOINT1", 0.0, 0.0);
    if(evt.time() >= m_time_RA4) m_my->setJointVelocity("RARM_JOINT4", 0.0, 0.0);
    if(evt.time() >= m_time_LA1 && evt.time() >= m_time_LA4
    && evt.time() >= m_time_RA1 && evt.time() >= m_time_RA4){
	// 位置Aの方向に回転を開始します setting position a for rotating
	//broadcastMsgToSrv("Moving to the table");
	m_time = rotateTowardObj(pos_a, m_vel, evt.time());
	m_state = 2;
    }
    break;
  }
  // 位置Aの方向に回転 rotating to position a
  case 2: {
    // 回転終了
    if(evt.time() >= m_time){
      m_my->setWheelVelocity(0.0, 0.0);
      // 位置Aに移動します setting position a for moving
      m_time = goToObj(pos_a, m_vel*4, 0.0, evt.time());
      m_state = 3;
    }
    break;
  }
  // 位置Aに移動 moving to position a
  case 3: {
    // 位置Aに到着
    if(evt.time() >= m_time){
      m_my->setWheelVelocity(0.0, 0.0);
      // 位置Bの方向に回転を開始します setting position b for rotating
      m_time = rotateTowardObj(pos_b, m_vel, evt.time());
      m_state = 4;
    }
    break;
  }
  // 位置Bの方向に回転 rotating to position b
  case 4: {
    // 回転終了
    if(evt.time() >= m_time){
      m_my->setWheelVelocity(0.0, 0.0);
      // 位置Bに移動します setting position b for moving
      m_time = goToObj(pos_b, m_vel*4, 0.0, evt.time());
      m_state = 5;
    }
    break;
  }
  // 位置Bに移動 moving to position b
  case 5: {
    // 位置Bに到着
    if(evt.time() >= m_time){
      m_my->setWheelVelocity(0.0, 0.0);
      // テーブルの方向に回転を開始します setting table position for rotating
      SimObj *table = getObj("table_0");
      Vector3d pos;
      table->getPosition(pos);
      m_time = rotateTowardObj(pos, m_vel, evt.time());
      m_state = 6;
    }
    break;
  }
  // テーブルの方向に回転 rotating to table
  case 6: {
    // 回転終了
    if(evt.time() >= m_time){
      m_my->setWheelVelocity(0.0, 0.0);
      // ゴミがある場所と名前を取得します
      // ゴミが見つからなかった
//.........这里部分代码省略.........
开发者ID:Aharobot,项目名称:samples,代码行数:101,代码来源:cleanUpRobot.cpp


示例20: sendMsg

bool SSMP1commands::sendStopTalkingCmd()
{
	char stopmsg[4] =  

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ sendNotification函数代码示例发布时间:2022-05-30
下一篇:
C++ sendHeader函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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