StabilityBin::StabilityBin(ContextProvider::Service& s): isStableProperty(s, "Position.Stable"), isShakyProperty(s, "Position.Shaky"), accelerometerReader(10), cutterFilter(4.0), avgVarFilter(60), stabilityFilter(&isStableProperty, &isShakyProperty, STABILITY_THRESHOLD, UNSTABILITY_THRESHOLD, STABILITY_HYSTERESIS), sessionId(0) { add(&accelerometerReader, "accelerometer"); add(&normalizerFilter, "normalizerfilter"); add(&cutterFilter, "cutterfilter"); add(&avgVarFilter, "avgvarfilter"); add(&stabilityFilter, "stabilityfilter"); join("accelerometer", "source", "normalizerfilter", "sink"); join("normalizerfilter", "source", "cutterfilter", "sink"); join("cutterfilter", "source", "avgvarfilter", "sink"); join("avgvarfilter", "source", "stabilityfilter", "sink"); // Context group group.add(isStableProperty); group.add(isShakyProperty); connect(&group, SIGNAL(firstSubscriberAppeared()), this, SLOT(startRun())); connect(&group, SIGNAL(lastSubscriberDisappeared()), this, SLOT(stopRun())); }
// CShell线程结束 void frmLog::onComplete() { if ((ui.chkRepeat->isChecked()) && (isRunning)) startRun(); else changeRunBtnState(false); }
/*! */ void pAcquisitionWindow::setupConnections() { connect(m_transportBar, SIGNAL(start()), this, SLOT(startRun())); connect(m_transportBar, SIGNAL(stop()), this, SLOT(stopRun())); connect(m_runController, SIGNAL(runStarted()), this, SLOT(disableTabs())); connect(m_runController, SIGNAL(runStopped()), this, SLOT(enableTabs())); connect(m_runController, SIGNAL(runStopped()), this, SLOT(stop())); connect(m_runController, SIGNAL(stationIdSet(int)), m_daqDisplay, SLOT(updateStationId(int))); connect(m_runController, SIGNAL(runIdChanged(int)), m_daqDisplay, SLOT(updateRunId(int))); connect(m_runController, SIGNAL(statusChanged(QString)), m_daqDisplay, SLOT(updateStatus(QString))); connect(m_runController, SIGNAL(numDataBlocksChanged(int)), m_daqDisplay, SLOT(updateNumDataBlocks(int))); connect(m_runController, SIGNAL(numEventsChanged(int)), m_daqDisplay, SLOT(updateNumEvents(int))); connect(m_runController, SIGNAL(elapsedSecondsChanged(int)), m_daqDisplay, SLOT(updateElapsedSeconds(int))); connect(m_runController, SIGNAL(averageEventRateChanged(double)), m_daqDisplay, SLOT(updateAverageDaqRate(double))); //connect(m_runController, SIGNAL(instantEventRateChanged(double)), //m_daqDisplay, SLOT(updateInstantDaqRate(double))); connect(m_runController->xpolFpga(), SIGNAL(vrefRead(unsigned short, double)), this, SLOT(displayReference(unsigned short, double))); connect(m_thresholdSettingTab->getRefreshRefButton(), SIGNAL(clicked()), m_runController->xpolFpga(), SLOT(readVrefDac())); connect(m_userPreferencesTab, SIGNAL(visualizetionModeChanged(int)), this, SLOT(changeVisualizationMode(int))); }
OrientationBin::OrientationBin(ContextProvider::Service& s): topEdgeProperty(s, "Screen.TopEdge"), isCoveredProperty(s, "Screen.IsCovered"), isFlatProperty(s, "Position.IsFlat"), accelerometerReader(10), topEdgeReader(10), faceReader(10), screenInterpreterFilter(&topEdgeProperty, &isCoveredProperty, &isFlatProperty), sessionId(0) { add(&topEdgeReader, "topedge"); add(&faceReader, "face"); add(&screenInterpreterFilter, "screeninterpreterfilter"); // Create a branching filter chain join("topedge", "source", "screeninterpreterfilter", "sink"); join("face", "source", "screeninterpreterfilter", "sink"); // Context group group.add(topEdgeProperty); group.add(isCoveredProperty); group.add(isFlatProperty); connect(&group, SIGNAL(firstSubscriberAppeared()), this, SLOT(startRun())); connect(&group, SIGNAL(lastSubscriberDisappeared()), this, SLOT(stopRun())); // Set default values (if the default isn't Unknown) topEdgeProperty.setValue("top"); isCoveredProperty.setValue(false); isFlatProperty.setValue(false); }
void MainWindow::autoStart() { if(autoRun>0) { ui->ckbAuto->setCheckState(Qt::Checked); int startret = startRun(); } else ui->ckbAuto->setCheckState(Qt::Unchecked); }
/* 解析代码后,执行代码 */ void frmLog::onRun() { if (isRunning) { stopRun(); } else { startRun(); } }
void MainWindow::on_btStart_clicked() { if(bStart) { ui->lbInfo->setText(garun); } else if(QFile::exists(filename)) { int startret = startRun(); } else { ui->lbInfo->setText(ganotfind); } }
TestActivity(QCoreApplication *app): QObject(app) { application = app; run_count = 2; activity = new BackgroundActivity(this); connect(activity, SIGNAL(running()), this, SLOT(startRun())); connect(activity, SIGNAL(stopped()), application, SLOT(quit())); #if 0 activity->setWakeupFrequency(BackgroundActivity::ThirtySeconds); activity->wait(); #else activity->wait(BackgroundActivity::ThirtySeconds); #endif }
void MainWindow::on_btOpen_clicked() { if(!bStart) { //QMessageBox::information(this, "Warning", "GoAgentUI is running!", QMessageBox::Ok | QMessageBox::Cancel); QString tmpFileName = QFileDialog::getOpenFileName( this, "Open Proxy.py", QDir::currentPath(), "Python files (*.py);;All files(*.*)"); if (!tmpFileName.isNull()) { //用户选择了文件 filename = tmpFileName; int startret = startRun(); int saveRet = saveSetting(); } else // 用户取消选择 ui->lbInfo->setText(ganotfind); } else { ui->lbInfo->setText(garun); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); _marker_detector.setMinMaxSize(0.0001,0.5); ui->cameraResolutionComboBox->addItem("640x480"); ui->cameraResolutionComboBox->addItem("1920x1080"); _serial_port = new QSerialPort(); refreshSerialPortOptions(); connect(ui->serialConnectButton,SIGNAL(clicked()),SLOT(updateSerialPort())); connect(ui->serialDisconnectButton,SIGNAL(clicked()),SLOT(disconnectSerialPort())); connect(_serial_port,SIGNAL(readyRead()),SLOT(receiveData())); connect(ui->sendSerialDataButton,SIGNAL(clicked()),SLOT(sendTextEditSerialData())); connect(ui->sendSerialDataLineEdit,SIGNAL(returnPressed()),SLOT(sendTextEditSerialData())); connect(ui->refreshSerialOptionsButton,SIGNAL(clicked()),SLOT(refreshSerialPortOptions())); loadDefaultSettings(); //applySettings(); //Timer connects to the kcamera object to call grabFrame every 30 milliseconds _timer = new QTimer(this); connect(_timer,SIGNAL(timeout()),SLOT(update())); _timer->start(20); //Update video every 20ms QTimer* video_timer = new QTimer(this); connect(video_timer,SIGNAL(timeout()),SLOT(updateVideo())); video_timer->start(20); connect(ui->applySettingsButton,SIGNAL(clicked()),SLOT(applySettings())); QFileDialog* file_dialog = new QFileDialog(); connect(file_dialog,SIGNAL(fileSelected(QString)),ui->calibrationFileLineEdit,SLOT(setText(QString))); connect(ui->browseCalibrationFileButton,SIGNAL(clicked()),file_dialog,SLOT(open())); //Connections for selecting view (image/2D trace) connect(ui->viewSelectComboBox,SIGNAL(currentIndexChanged(QString)),SLOT(selectView(QString))); connect(ui->saveSentDataButton,SIGNAL(clicked()),SLOT(saveSentData())); connect(ui->clearSentDataButton,SIGNAL(clicked()),SLOT(clearSentData())); ui->markerTracePlot->addGraph(); ui->markerTracePlot->graph(0)->addData(1.5,1.5); ui->markerTracePlot->graph(0)->addData(1.9,1.9); ui->markerTracePlot->graph(0)->addData(1.5,1.9); ui->markerTracePlot->graph(0)->setScatterStyle(QCPScatterStyle::ssCross); ui->markerTracePlot->replot(); _running = false; _frame_count = 0; connect(ui->startRunButton,SIGNAL(clicked()),this,SLOT(startRun())); connect(ui->stopRunButton,SIGNAL(clicked()),this,SLOT(stopRun())); _received_data_max_length = 1000; _sent_data_max_length = 1000; //Camera Sliders connect(ui->brightnessSlider, SIGNAL(valueChanged(int)), this, SLOT(updateBrightness(int))); connect(ui->sharpnessSlider, SIGNAL(valueChanged(int)), this, SLOT(updateSharpness(int))); connect(ui->autofocusCheckbox, SIGNAL(toggled(bool)), this, SLOT(updateAutoFocus(bool))); connect(ui->focusSlider, SIGNAL(valueChanged(int)), this, SLOT(updateFocus(int))); }
void Tresenv::run() { // '-c' and '-r' option: configuration to activate, and run numbers to run. // Both command-line options take precedence over inifile settings. // (NOTE: inifile settings *already* got read at this point! as EnvirBase::setup() // invokes readOptions()). const char *configname = args->optionValue('c'); if (configname) opt_configname = configname; if (opt_configname.empty()) opt_configname = "General"; const char *runstoexec = args->optionValue('r'); if (runstoexec) opt_runstoexec = runstoexec; // if the list of runs is not given explicitly, must execute all runs if (opt_runstoexec.empty()) { int n = cfg->getNumRunsInConfig(opt_configname.c_str()); //note: may throw exception if (n==0) { ev.printfmsg("Error: Configuration `%s' generates 0 runs", opt_configname.c_str()); exitcode = 1; return; } else { char buf[32]; sprintf(buf, (n==1 ? "%d" : "0..%d"), n-1); opt_runstoexec = buf; } } ::fflush(fout); setupnetwork_done = false; startrun_done = false; ::fflush(fout); cfg->activateConfig(opt_configname.c_str(), 0); const char *itervars = cfg->getVariable(CFGVAR_ITERATIONVARS2); if (itervars && strlen(itervars)>0) ::fprintf(fout, "Scenario: %s\n", itervars); ::fprintf(fout, "Assigned runID=%s\n", cfg->getVariable(CFGVAR_RUNID)); readPerRunOptions(); // find network cModuleType *network = resolveNetwork(opt_network_name.c_str()); ASSERT(network); // set up network ::fprintf(fout, "Setting up network `%s'...\n", opt_network_name.c_str()); ::fflush(fout); setupNetwork(network); setupnetwork_done = true; // prepare for simulation run ::fprintf(fout, "Initializing...\n"); ::fflush(fout); disable_tracing = opt_expressmode; startRun(); startrun_done = true; // run the simulation ::fprintf(fout, "\nRunning simulation...\n"); ::fflush(fout); }