void INDI_P::processSetButton() { switch (dataProp->getType()) { case INDI_TEXT: if (!strcmp(dataProp->getName(), "TIME_UTC")) newTime(); else sendText(); break; case INDI_NUMBER: sendText(); break; case INDI_BLOB: sendBlob(); break; default: break; } }
bool SSMTP::send(MIMEmessage *message) { log.clear(); int mSize = message->getMIMEText().toLatin1().size(); /* calc timeout for slowly 56 kbps connection */ messageRespTimeout = (mSize / (56000/8)) * 1000; if (!tcpConnect()) return false; if (!waitForResponse()) return false; if (!checkRespCode(220)) return false; if (!sendCmd("EHLO " + smtp_name,250)) return false; if (!smtp_user.isEmpty() || smtp_pass.isEmpty()) { if (!sendCmd("AUTH LOGIN",334)) return false; if (!sendCmd(smtp_user.toUtf8().toBase64(),334)) return false; if (!sendCmd(smtp_pass.toUtf8().toBase64(),235)) return false; } if (!sendCmd("MAIL FROM: " + message->getFromEmail(),250)) return false; for (int i=0; i < message->rcptList()->count(); ++i) { if (!sendCmd("RCPT TO: " + message->rcptList()->at(i),250)) return false; } if (!sendCmd("DATA",354)) return false; sendText(message->getMIMEText(),true); sendText("."); if (!waitForResponse(true)) return false; if (!checkRespCode(250)) return false; if (!sendCmd("QUIT",221)) return false; tcpDisconnect(); return true; }
void main() { configure(); setPID(); sendText("Starting..."); //while(1) // checkSonar('L'); /*********************** Starting Point ***************************/ LEVEL1_STATE = NOT_REACHED; sendText("Starting Block "); LEVEL = 0; while(isAllWhite()) moveStraightSlow(); LEVEL = 1; sendText("Level 1 Starting "); LEVEL1_STATE = REACHED; stop(); /*********************** Level 1 Starting ***************************/ moveForward(205,200); delay_ms(100); while(!isAllBlack()){ //lineFollowNormalWorked(); if( Scout==1 &&(Sensor3==1 || Sensor4==1 || Sensor5==1 || Sensor6==1 || Sensor7==1) && Sensor1==0 && Sensor2==0 && Sensor8==0 && Sensor9==0) lineFollowPID(); else lineFollowNormalWorked(); } stop(); sendText(" End of Level 1. Level 2 Starting "); LEVEL1_STATE = COMPLETED; LEVEL2_STATE = REACHED; LEVEL = 2; /*********************** Level 2 Starting ***************************/ while(!isAllWhite()){ goThroughObstaclesJay(); } stop(); sendText(" End of Level 2. Level 3 Starting "); LEVEL2_STATE = COMPLETED; LEVEL3_STATE = REACHED; LEVEL = 3; /*********************** Level 3 Starting ***************************/ level3Aligning(); while(!isAllBlack()){ stop(); } /*********************** Complete ***************************/ }
double RobotController::onAction(ActionEvent &evt) { #if 1 sendText(evt.time(), "Robot2", "hello!"); #else double distance = 10.0; sendText(evt.time(), NULL, "hello!", distance); #endif return 3.0; }
bool UFuncBin::handleCommand(UServerInMsg * msg, void * extra) { bool ask4help; const int MVL = 1000; char val[MVL]; bool replySend = false; bool gotOpenLog; bool gotOpenLogValue = false; bool gotVerbose; bool gotVerboseValue = false; UTime t; // check for parameters - one parameter is tested for - 'help' // the help value is ignored, e.g. if help="bark", then // the value "bark" will be in the 'helpValue' string. ask4help = msg->tag.getAttValue("help", val, MVL); // get all other parameters gotOpenLog = msg->tag.getAttValueBool("log", &gotOpenLogValue, true); gotVerbose = msg->tag.getAttValueBool("verbose", &gotVerboseValue, true); // if (ask4help) { // create the reply in XML-like (html - like) format sendHelpStart("BIN"); sendText("--- available BIN options (mission poly lines and points)\n"); sendText("verbose[=false] Posibly more messages to server console\n"); sendText("log[=false] Open [or close] logfile\n"); sendText("help This message\n"); sendText("--------\n"); sendHelpDone(); replySend = true; } else { // resource is available, so make a reply if (gotVerbose) { bin->verbose = gotVerboseValue; sendInfo("done"); replySend = true; } if (gotOpenLog) { bin->openLog(gotOpenLogValue); sendInfo("done"); replySend = true; } } if (not replySend) sendInfo(msg, "no poly action performed (no command option?)"); // return true if the function is handled with a positive result return true; }
/* ** TH1 command: combobox NAME TEXT-LIST NUMLINES ** ** Generate an HTML combobox. NAME is both the name of the ** CGI parameter and the name of a variable that contains the ** currently selected value. TEXT-LIST is a list of possible ** values for the combobox. NUMLINES is 1 for a true combobox. ** If NUMLINES is greater than one then the display is a listbox ** with the number of lines given. */ static int comboboxCmd( Th_Interp *interp, void *p, int argc, const char **argv, int *argl ){ if( argc!=4 ){ return Th_WrongNumArgs(interp, "combobox NAME TEXT-LIST NUMLINES"); } if( enableOutput ){ int height; Blob name; int nValue; const char *zValue; char *z, *zH; int nElem; int *aszElem; char **azElem; int i; if( Th_ToInt(interp, argv[3], argl[3], &height) ) return TH_ERROR; Th_SplitList(interp, argv[2], argl[2], &azElem, &aszElem, &nElem); blob_init(&name, (char*)argv[1], argl[1]); zValue = Th_Fetch(blob_str(&name), &nValue); z = mprintf("<select name=\"%z\" size=\"%d\">", htmlize(blob_buffer(&name), blob_size(&name)), height); sendText(z, -1, 0); free(z); blob_reset(&name); for(i=0; i<nElem; i++){ zH = htmlize((char*)azElem[i], aszElem[i]); if( zValue && aszElem[i]==nValue && memcmp(zValue, azElem[i], nValue)==0 ){ z = mprintf("<option value=\"%s\" selected=\"selected\">%s</option>", zH, zH); }else{ z = mprintf("<option value=\"%s\">%s</option>", zH, zH); } free(zH); sendText(z, -1, 0); free(z); } sendText("</select>", -1, 0); Th_Free(interp, azElem); } return TH_OK; }
chatRoom::chatRoom(int rId, QTcpSocket *socket, QTabWidget *tab, MainUser* mainUser, QMap<int, User*>* global) : ui(new Ui::ChatRoom) { ui->setupUi(this); this->tab = tab; this->roomID = rId; this->tabID = tab->count(); //asd //ChatRoomInterFace *inf = new ChatRoomInterFace; this->mainUser = mainUser; QString roomName = intToChar(rId); tab->addTab(this, "Private(" + roomName + ")"); this->display = ui->plainTextEdit; this->input = ui->textEdit; this->sendButton = ui->pushButton; this->sendFile = ui->pushButton_4; this->leaveRoom = ui->pushButton_3; this->add = ui->pushButton_2; this->userlist = ui->listWidget; this->socket = socket; this->uname = ui->lineEdit; this->sendButton->installEventFilter(this); this->input->installEventFilter(this); connect(sendButton, SIGNAL(clicked()), this, SLOT(sendText())); connect(leaveRoom, SIGNAL(clicked()), this, SLOT(leave())); connect(add, SIGNAL(clicked()), this, SLOT(inviteUser())); connect(sendFile, SIGNAL(clicked()), this, SLOT(sendFileSlot())); this->global = global; userNr = 0; //if() }
void Yukari::save(std::string sentence, std::string outFilePath, BOOL isSync) { SendMessage(yukari, WM_ACTIVATE, WA_ACTIVE, NULL); SendMessage(yukari, WM_COMMAND, COMMAND_SELECT_ALL, NULL); SendMessage(yukari, WM_CHAR, _T(' '), NULL); // クリップボードに読み上げさせたい文章を設定 Clipboard::setClipboardText(sentence); // クリップボードの内容を貼り付け SendMessage(yukari, WM_ACTIVATE, WA_ACTIVE, NULL); SendMessage(yukari, WM_COMMAND, COMMAND_PASTE, 0); // 保存ボタンを探して押す HWND saveButton = SearchSaveButton(yukari); PostMessage(saveButton, NULL, 0, 0); Sleep(WAIT_TIME); // "音声ファイルの保存" ウィンドウを探す SearchHwndParam ssdp; EnumWindows(Yukari::SearchSaveDialog, (LPARAM)&ssdp); HWND saveDialog = ssdp.hwnd; // ファイル名テキストエリアを探す HWND saveFilePath = SearchSaveFilePath(saveDialog); // ファイル名をテキストエリアに挿入 sendText(saveFilePath, outFilePath); // "保存(S)" ボタン押下 HWND save_button_in_save_dialog = SearchSaveButtonInSaveDialog(saveDialog); PostMessage(save_button_in_save_dialog, BM_CLICK, 0, 0); Sleep(WAIT_TIME); // "音声ファイルの保存" 上書き確認ダイアログを探す SearchHwndParam ssdp2; EnumWindows(Yukari::SearchConfirmationOverwriteDialog, (LPARAM)&ssdp2); HWND confirmationOverwriteDialog = ssdp2.hwnd; if (confirmationOverwriteDialog != NULL) { HWND yes_button_in_confirmation_overwrite_dialog = SearchYesButtonInConfirmationOverwriteDialog(confirmationOverwriteDialog); PostMessage(yes_button_in_confirmation_overwrite_dialog, BM_CLICK, 0, 0); } // 音声保存中ダイアログが消えるまで待機 // TODO: タイムアウト入れるか検討する while (1) { Sleep(END_PLAY_CHECK_INTERVAL); SearchHwndParam ssdp; ssdp.hwnd = NULL; EnumWindows(SearchSavingDialog, (LPARAM)&ssdp); if (ssdp.hwnd == NULL) { break; } } }
void NetWidgets::sendData() { if (!sf::Keyboard::isKeyPressed(sf::Keyboard::Return)) return; std::string toWrite = chatEntry->GetText(); chatEntry->SetText(""); sendText(toWrite); }
// class ChatWidget --> ChatWidget::ChatWidget():base_pixmap("image/system/chatface/base.png") { setFlags(ItemIsFocusable); setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::LeftButton); base = new QGraphicsRectItem(QRectF(base_pixmap.rect()), this); QPushButton *returnButton, *chatfaceButton, *easytextButton; returnButton=addButton("returnBt",-1); chatfaceButton=addButton("chatfaceBt",24); easytextButton=addButton("easytextBt",48+1); chat_face_board = new MyPixmapItem(QPixmap("image/system/chatface/faceboard.png"),this); chat_face_board->setSize(160,180); chat_face_board->setPos(-160 + 74,-180-1);// 24+24+24+2=74 chat_face_board->setZValue(1); chat_face_board->setVisible(false); chat_face_board->itemName="faceboard"; easy_text_board=new MyPixmapItem(QPixmap("image/system/chatface/easytextboard.png"),this); easy_text_board->setSize(180,222); easy_text_board->setPos(-180 + 74,-222-1); easy_text_board->setZValue(1); easy_text_board->setVisible(false); easy_text_board->itemName="easytextboard"; connect (chat_face_board,SIGNAL(my_pixmap_item_msg(QString)),this,SIGNAL(chat_widget_msg(QString))); connect (easy_text_board,SIGNAL(my_pixmap_item_msg(QString)),this,SIGNAL(chat_widget_msg(QString))); connect(chatfaceButton, SIGNAL(clicked()), this, SLOT(showFaceBoard())); connect(easytextButton, SIGNAL(clicked()), this, SLOT(showEasyTextBoard())); connect(returnButton, SIGNAL(clicked()), this, SLOT(sendText())); }
//COnstructor MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //Server object ser = new Server(); //THread for server m_thread = new QThread; //Connection to signal the server class to start working and checking for messages connect(this, SIGNAL(startServer()), ser, SLOT(doWork())); //Connection to notify the GUI to update connect(ser, SIGNAL(sendText(QString)), this, SLOT(writeText(QString))); //Start the thread ser->moveToThread(m_thread); m_thread->start(); //Start the server working to check for messages emit startServer(); }
int SerialPort::SetCommand(const char* command, const char* term) { if (!initialized_) return ERR_PORT_NOTINITIALIZED; int retv = DEVICE_OK; std::string sendText(command); if (term != 0) sendText += term; // send characters one by one to accomodate slow devices size_t written = 0; if (transmitCharWaitMs_ < 0.001) { pPort_->WriteCharactersAsynchronously(sendText.c_str(), (int) sendText.length() ); written = sendText.length(); } else { for( std::string::iterator jj = sendText.begin(); jj != sendText.end(); ++jj) { const MM::MMTime maxTime (5, 0); MM::MMTime startTime (GetCurrentMMTime()); pPort_->WriteOneCharacterAsynchronously(*jj ); CDeviceUtils::SleepMs((long)(0.5+transmitCharWaitMs_)); ++written; } } if( DEVICE_OK == retv) LogMessage( (std::string("SetCommand -> ") + sendText.substr(0,written)).c_str(), true); return retv; }
void INDI_P::newTime() { INDI_E * timeEle; //INDI_P *SDProp; timeEle = getElement("UTC"); if (!timeEle) return; TimeDialog timedialog ( KStars::Instance()->data()->ut(), KStars::Instance()->data()->geo(), KStars::Instance(), true ); if ( timedialog.exec() == QDialog::Accepted ) { QTime newTime( timedialog.selectedTime() ); QDate newDate( timedialog.selectedDate() ); timeEle->setText(QString("%1-%2-%3T%4:%5:%6") .arg(newDate.year()).arg(newDate.month()) .arg(newDate.day()).arg(newTime.hour()) .arg(newTime.minute()).arg(newTime.second())); sendText(); } else return; /*SDProp = pp->pg->dp->findProp("TIME_LST"); if (!SDProp) return; timeEle = SDProp->findElement("LST"); if (!timeEle) return; timeEle->write_w->setText(ksw->data()->lst()->toHMSString()); SDProp->newText();*/ }
void KileAbbrevView::slotMouseButtonClicked(int button, QListViewItem *item, const QPoint &, int) { if ( button==1 && item ) { emit( sendText( item->text(KileAbbrevView::ALVexpansion) ) ); } }
bool SSMTP::sendCmd(const QString &cmd, int respCode) { sendText(cmd); if (!waitForResponse(false)) return false; if (!checkRespCode(respCode)) return false; return true; }
void checkSonar(char Sensor){ if(Sensor == 'L'){ distanceSonar = getDistanceSonar2('L'); if(distanceSonar < 10) sendText("Obstacle" ); } else if(Sensor == 'M'){ distanceSonar = getDistanceSonar2('M'); if(distanceSonar < 10) sendText("Obstacle" ); } else if(Sensor == 'R'){ distanceSonar = getDistanceSonar2('R'); if(distanceSonar < 10) sendText("Obstacle" ); } delay_ms(500); }
void MavlinkComm::sendText(uint8_t severity, const prog_char_t *str) { mavlink_statustext_t m; uint8_t i; for (i = 0; i < sizeof(m.text); i++) { m.text[i] = pgm_read_byte((const prog_char *) (str++)); } if (i < sizeof(m.text)) m.text[i] = 0; sendText(severity, (const char *) m.text); }
/* CONSTRUCTOR */ MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui_(new Ui::MainWindow) { sock_ = 0; log_ = false; ui_->setupUi(this); connect(ui_->pushButton, SIGNAL(clicked()), this, SLOT(sendText())); connect(ui_->actionConnect, SIGNAL(triggered()), this, SLOT(openDlg())); connect(ui_->actionQuit_2, SIGNAL(triggered()), QApplication::instance(), SLOT(quit())); connect(ui_->actionClose, SIGNAL(triggered()), this, SLOT(disconnectFromServer())); connect(this, SIGNAL(destroyed()), this, SLOT(disconnectFromServer())); }
void sendSingle(void) { sendText(); if (estgbconf.imgfile) sendPicture(estgbconf.imgfile); if (estgbconf.videofile) sendVideo(estgbconf.videofile); if (estgbconf.audiofile) sendAudio(estgbconf.audiofile); if (estgbconf.docfile) sendDocument(estgbconf.docfile); }
void showBuffer(RING_BUFFER *aBuffer) { int i; char msg[25]; return; for (i = 0; i < aBuffer->bytes; i++) { sprintf(msg, "Byte %i:%i\n\r", i, aBuffer->buffer[ aBuffer->SOB + i + 1]); sendText(msg); } }
void FormKeyboard::on_pushButton_OK_clicked() { if(isBeep)beep(50000,1010); emit sendText(ui->lineEdit->text()); if(m_isClose) close(); else { str.clear(); ui->lineEdit->setText(str); } }
//! [socketDisconnected] void RfCommClient::socketDisconnected() { // Note: it seems that the "disconnected" signal is not emitted by the socket, so this never gets called qDebug() << __PRETTY_FUNCTION__ << "Got socketDisconnected"; emit disconnected(); stopClient(); // now reconnect and send text string startClient(serviceInfo); connect(&lagTimer, SIGNAL(timeout()), this, SLOT(sendText())); lagTimer.start(); }
void sendMultiple(void) { char *imgmask = NULL, *imgdir = NULL; char *vidmask = NULL, *viddir = NULL; char *audiomask = NULL, *auddir = NULL; char *docmask = NULL, *docdir = NULL; sendText(); if (estgbconf.imgfile) { imgmask = strdup(basename(estgbconf.imgfile)); imgdir = strdup(estgbconf.imgfile); imgdir = dirname(imgdir); estgbconf.mask = imgmask; if (estgbconf.isPicsMediagroup) processWildcard_group(imgdir, sendPicturesGroup); else processWildcard_s(imgdir, sendPicture); } if (estgbconf.videofile) { vidmask = strdup(basename(estgbconf.videofile)); viddir = strdup(estgbconf.videofile); viddir = dirname(viddir); estgbconf.mask = vidmask; processWildcard_s(viddir, sendVideo); } if (estgbconf.audiofile) { audiomask = strdup(basename(estgbconf.audiofile)); auddir = strdup(estgbconf.audiofile); auddir = dirname(auddir); estgbconf.mask = audiomask; processWildcard_s(auddir, sendAudio); } if (estgbconf.docfile) { docmask = strdup(basename(estgbconf.docfile)); docdir = strdup(estgbconf.docfile); docdir = dirname(docdir); estgbconf.mask = docmask; processWildcard_s(docdir, sendDocument); } free(imgmask); free(vidmask); free(audiomask); free(docmask); free(imgdir); free(viddir); free(auddir); free(docdir); estgbconf.mask = NULL; }
void GsmTrack::slReadSerial() { QByteArray data = gsmSerial->readAll().trimmed(); //qDebug() << "the date:: " << data << endl; emit sendData(data); if(data.contains("+CSQ: ")){ int csq; int csq_tail; std::sscanf(data.data(), "+CSQ: %d,%d", &csq, &csq_tail); qDebug("the csq is:: %d\n", csq); if(csq <= 10 || csq > 31){ emit sendCsq(0); return; } emit sendCsq(csq); } // 读取网络类型与网路配置 if(data.contains("^SYSCFG: ")){ int type; std::sscanf(data.data(), "^SYSCFG: %d", &type); if(type == 13){ emit sendText("2G network it is!!"); }else if(type == 2){ emit sendText("3G network it is!!"); } } // 基站信息 // BASE:: "AT+CREG=2;+CREG?" // OUT :: +CREG: 2,1,"A5D3","19E420F",2 if(data.contains("+CREG: ")){ qDebug() << data << endl; QByteArrayList cregList = data.split(','); emit sendBase(QLatin1String( cregList.at(2) + "," + cregList.at(3) )); } }
void MainWindow::keyPressEvent(QKeyEvent *event) { qDebug("qPressEvent"); if (event->key() == Qt::Key_Return) { emit( sendText( textEdit->toPlainText() ) ); textEdit->clear(); } if (event->key() == Qt::Key_V) { qDebug("ctrlv"); } }
/* ** TH command: puts STRING ** TH command: html STRING ** ** Output STRING as HTML (html) or unchanged (puts). */ static int putsCmd( Th_Interp *interp, void *pConvert, int argc, const char **argv, int *argl ){ if( argc!=2 ){ return Th_WrongNumArgs(interp, "puts STRING"); } sendText((char*)argv[1], argl[1], pConvert!=0); return TH_OK; }
/* * Constructs a GetMsgDialog as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ GetMsgDialog::GetMsgDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "GetMsgDialog" ); setSizeGripEnabled( TRUE ); QWidget* privateLayoutWidget = new QWidget( this, "layout4" ); privateLayoutWidget->setGeometry( QRect( 20, 10, 488, 250 ) ); layout4 = new QVBoxLayout( privateLayoutWidget, 11, 6, "layout4"); incomingTextEdit = new QTextEdit( privateLayoutWidget, "incomingTextEdit" ); incomingTextEdit->setEnabled( TRUE ); layout4->addWidget( incomingTextEdit ); msgText = new QTextEdit( privateLayoutWidget, "msgText" ); layout4->addWidget( msgText ); layout3 = new QHBoxLayout( 0, 0, 6, "layout3"); Horizontal_Spacing2 = new QSpacerItem( 320, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout3->addItem( Horizontal_Spacing2 ); sendbt = new QPushButton( privateLayoutWidget, "sendbt" ); layout3->addWidget( sendbt ); buttonCancel = new QPushButton( privateLayoutWidget, "buttonCancel" ); buttonCancel->setAutoDefault( TRUE ); layout3->addWidget( buttonCancel ); layout4->addLayout( layout3 ); languageChange(); resize( QSize(533, 298).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); // signals and slots connections connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( sendbt, SIGNAL( clicked() ), this, SLOT( sendText() ) ); connect( msgText, SIGNAL( returnPressed() ), this, SLOT( sendText() ) ); }
void TextEditorRemoteNode::inputsUpdated( qint64 pTimeStamp ) { NodeControlBase::inputsUpdated( pTimeStamp ); if( mPinInputPackets->isUpdated( pTimeStamp ) ) { processIncomingVariant( variant( mPinInputPackets ) ); } if( mPinInputText->isUpdated( pTimeStamp ) ) { sendText( variant( mPinInputText ).toString() ); } }
chatRoom::chatRoom(QTcpSocket *socket, QMap<int, User*>* global, QPlainTextEdit *display, QTextEdit *input, QPushButton *send, MainUser *mainUser) { this->global = global; this->display = display; this->input = input; this->sendButton = send; this->socket = socket; this->mainUser = mainUser; this->roomID = 0; this->userlist = NULL; this->sendButton->installEventFilter(this); this->input->installEventFilter(this); userNr = 0; connect(sendButton, SIGNAL(clicked()), this, SLOT(sendText())); }
void test17 () { printf("\n\n<TEST 17> send other textual events\n"); DebugStr ("--> use g or G to send other textual events to 'msDisplay' and go to the next test\n"); sendText (typeTextual, "Hello"); sendText (typeCopyright, "Mozart"); sendText (typeSeqName, "Concerto"); sendText (typeInstrName, "Piano"); sendText (typeLyric, "Hiiiiiii"); sendText (typeMarker, "mark 1"); sendText (typeCuePoint, "Reverb here"); }