bool WiimotePipeServerWrapper::sendWiimoteData(WiimoteData *wiimoteData1,WiimoteData *wiimoteData2,int sequenceNumber,DWORD current_time) { if(m_CommandPipeServer->isWiimoteLoggingOn()) { //If is false it indicates that logging was currently off. In that scenario when m_CommandPipeServer->isWiimoteLoggingOn() changes to true //it indicates logging request just came in. So need to initialize //For this case return right away and do not send packet as this packet is not initialized by the client. //The clietnt did not know before sending this message that recording was restarted if(!m_WiimoteLoggingOn) { startLogging(wiimoteData1,wiimoteData2); return true; } else sendDataPacket(wiimoteData1,wiimoteData2,sequenceNumber,current_time,false); } else { if(m_WiimoteLoggingOn) { stopLogging(); return WIIMOTE_LOGGING_STOPPED; } } logWiimoteData(wiimoteData1,wiimoteData2,sequenceNumber,current_time); return false; }
int main() { SOCKET sock = startClient(20015, "127.0.0.1"); if (sock != INVALID_SOCKET) { startLogging(sock); } return 0; }
int main(){ initLogging("f**k.txt"); startLogging(); printf("hello\n"); endLogging(); printTimeLog("main"); cleanLogging(); return 0; }
OsStatus startLogTask() { #ifdef _VXWORKS /* [ */ MpMisc.logMsgLimit = LOG_MSGQ_MAX_MSGS; MpMisc.logMsgSize = LOG_MSGQ_ITEM_LEN; if (NULL == startLogging(MpMisc.logMsgLimit, MpMisc.logMsgSize)) { return OS_UNSPECIFIED; } #endif /* _VXWORKS ] */ return OS_SUCCESS; }
/* * Entry point */ int main(int argc, char** argv) { bool testInstall = false; char* installPath = "/srv/PufferPanel"; char* installUser; char* distro = getDistro(); if (isEqual(distro, "ubuntu")) { installUser = "******"; } else if (isEqual(distro, "debian")) { installUser = "******"; } else if (isEqual(distro, "unknown")) { installUser = "******"; } else { installUser = "******"; } bool doLangOnly = false; bool doConfigOnly = false; /* * Process command line arguments */ int i = 1; while (i < argc) { if (isEqual(argv[i], "-u")) { if (i + 1 < argc - 1) { printUsage(argv[0]); return (EXIT_FAILURE); } else { i++; installUser = argv[i]; } } else if (isEqual(argv[i], "-t")) { testInstall = true; } else if (isEqual(argv[i], "-v")) { printf("PufferPanel Installer - Version C-%s (%s)\n", INSTALLERVERSION, PPVERSION); return (EXIT_SUCCESS); } else if (isEqual(argv[i], "-h")) { printUsage(argv[0]); return (EXIT_SUCCESS); } else { printUsage(argv[0]); return (EXIT_FAILURE); } i++; } startLogging(); int returnCode = innerMain(testInstall, installPath, installUser); closeLogging(); return returnCode; }
/** * The action that is triggered by the menu item which opens the * file and begins logging if successful */ void LoggingPlugin::toggleLogging() { if (state == IDLE) { QString fileName = QFileDialog::getSaveFileName(NULL, tr("Start Log"), tr("OP-%0.opl").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss")), tr("OpenPilot Log (*.opl)")); if (fileName.isEmpty()) { return; } startLogging(fileName); cmd->action()->setText(tr("Stop logging")); } else if (state == LOGGING) { stopLogging(); cmd->action()->setText(tr("Start logging...")); } }
void ExperimentController::toggleTempLogs(bool temperatureLogsState, bool debugTemperatureLogsState) { _settings.temperatureLogsState = temperatureLogsState; _settings.debugTemperatureLogsState = debugTemperatureLogsState; if (machineState() == IdleMachineState) { if (_settings.temperatureLogsState || _settings.debugTemperatureLogsState) { if (_settings.startTime == boost::posix_time::not_a_date_time) { _settings.startTime = boost::posix_time::microsec_clock::universal_time(); startLogging(); } } else stopLogging(); } }
ExperimentController::StartingResult ExperimentController::start(int experimentId) { if (OpticsInstance::getInstance()->lidOpen()) return LidIsOpen; Experiment experiment = _dbControl->getExperiment(experimentId); if (experiment.empty() || !experiment.protocol()) return ExperimentNotFound; else if (experiment.startedAt() != boost::posix_time::not_a_date_time) return ExperimentUsed; experiment.setStartedAt(boost::posix_time::microsec_clock::local_time()); if (machineState() != IdleMachineState) return MachineRunning; stopLogging(); { Poco::RWLock::ScopedWriteLock lock(*_machineMutex); _settings.temperatureLogsState = false; _settings.debugTemperatureLogsState = false; LidInstance::getInstance()->setTargetTemperature(experiment.protocol()->lidTemperature()); _dbControl->startExperiment(experiment); _machineState = LidHeatingMachineState; _experiment = std::move(experiment); LidInstance::getInstance()->setEnableMode(true); } startLogging(); return Started; }
/** * The action that is triggered by the menu item which opens the * file and begins logging if successful */ void LoggingPlugin::toggleLogging() { if(state == IDLE) { /*QFileDialog * fd = new QFileDialog(); fd->setAcceptMode(QFileDialog::AcceptSave); fd->setNameFilter("OpenPilot Log (*.opl)"); connect(fd, SIGNAL(fileSelected(QString)), this, SLOT(startLogging(QString))); fd->exec();*/ QString fileName = QFileDialog::getSaveFileName(NULL, tr("Start Log"), tr("OP-%0.opl").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss")), tr("OpenPilot Log (*.opl)")); if(!fileName.isEmpty()) startLogging(fileName); } else if(state == LOGGING) { stopLogging(); } }
void auto_logger_gps_sample_cb(const GpsSample* sample) { if (!auto_logger_state.cfg || !auto_logger_state.cfg->active) return; const tiny_millis_t uptime = getUptime(); if (!auto_logger_state.logging) { if (!should_start_logging(sample, uptime)) return; pr_info(LOG_PFX "Starting logging\r\n"); startLogging(); auto_logger_state.logging = true; } else { if (!should_stop_logging(sample, uptime)) return; pr_info(LOG_PFX "Stopping logging\r\n"); stopLogging(); auto_logger_state.logging = false; } }
int main(int argc, char *argv[]) { int c, i; long tmask = 0, sslMode=0,sslOMode=0, tracelevel=0; char * tracefile = NULL; #ifdef HAVE_UDS int enableUds=0; #endif int enableHttp=0,enableHttps=0,useChunking=0,doBa=0,enableInterOp=0,httpLocalOnly=0; int syslogLevel=LOG_ERR; long dSockets,sSockets,pSockets; char *pauseStr; /* SF 3462309 - If there is an instance running already, return */ int pid_found = 0; if ((pid_found = sfcb_is_running()) != 0) { mlogf(M_ERROR, M_SHOW, " --- A previous instance of sfcbd [%d] is running. Exiting.\n", pid_found); exit(1); } name = strrchr(argv[0], '/'); if (name != NULL) ++name; else name = argv[0]; collectStat=0; colorTrace=0; processName="sfcbd"; provPauseStr=getenv("SFCB_PAUSE_PROVIDER"); httpPauseStr=getenv("SFCB_PAUSE_CODEC"); currentProc=sfcBrokerPid=getpid(); restartArgc=argc; restartArgv=argv; exFlags = 0; static struct option const long_options[] = { { "config-file", required_argument, 0, 'c' }, { "daemon", no_argument, 0, 'd' }, { "help", no_argument, 0, 'h' }, { "color-trace", no_argument, 0, 'k' }, { "collect-stats", no_argument, 0, 's' }, { "syslog-level", required_argument, 0, 'l' }, { "trace-components", required_argument, 0, 't' }, { "version", no_argument, 0, 'v' }, { "disable-repository-default-inst-provider", no_argument, 0, 'i' }, { 0, 0, 0, 0 } }; while ((c = getopt_long(argc, argv, "c:dhkst:vil:", long_options, 0)) != -1) { switch(c) { case 0: break; case 'c': configfile = strdup(optarg); break; case 'd': daemon(0, 0); currentProc=sfcBrokerPid=getpid(); /* req. on some systems */ break; case 'h': usage(0); case 'k': colorTrace = 1; break; case 's': collectStat = 1; break; case 't': if (*optarg == '?') { fprintf(stdout, "--- Traceable Components: Int Hex\n"); for (i = 0; traceIds[i].id; i++) fprintf(stdout, "--- \t%18s: %d\t0x%05X\n", traceIds[i].id, traceIds[i].code, traceIds[i].code); exit(0); } else if (isdigit(*optarg)) { char *ep; tmask = strtol(optarg, &ep, 0); } else { fprintf(stderr, "Try %s -t ? for a list of the trace components and bitmasks.\n", name); exit(1); } break; case 'v': version(); case 'i': disableDefaultProvider=1; break; case 'l': if (strcmp(optarg,"LOG_ERR")==0) { syslogLevel=LOG_ERR; } else if (strcmp(optarg,"LOG_INFO")==0) { syslogLevel=LOG_INFO; } else if (strcmp(optarg,"LOG_DEBUG")==0) { syslogLevel=LOG_DEBUG; } else { fprintf(stderr,"Invalid value for syslog-level.\n"); usage(3); } break; default: usage(3); } } if (optind < argc) { fprintf(stderr,"SFCB not started: unrecognized config property %s\n",argv[optind]); usage(1); } startLogging(syslogLevel,1); mlogf(M_INFO,M_SHOW,"--- %s V" sfcHttpDaemonVersion " started - %d\n", name, currentProc); //get the creation timestamp for the sequence context struct timeval tv; struct timezone tz; gettimeofday(&tv, &tz); struct tm cttm; sfcBrokerStart = (char *) malloc(15 * sizeof(char)); memset((void *)sfcBrokerStart, 0, 15 * sizeof(char)); if (gmtime_r(&tv.tv_sec, &cttm) != NULL) { strftime((char *)sfcBrokerStart, 15, "%Y%m%d%H%M%S", &cttm); } if (collectStat) { mlogf(M_INFO,M_SHOW,"--- Statistics collection enabled\n"); remove("sfcbStat"); } setupControl(configfile); _SFCB_TRACE_INIT(); if (tmask == 0) { /* trace mask not specified, check in config file */ getControlNum("traceMask",&tmask); } if (tmask) { if (getControlNum("traceLevel",&tracelevel) || tracelevel == 0) { /* no tracelevel found in config file, use default */ tracelevel = 1; } if (getenv("SFCB_TRACE_FILE") == NULL && getControlChars("traceFile",&tracefile) == 0) { /* only set tracefile from config file if not specified via env */ _SFCB_TRACE_SETFILE(tracefile); } _SFCB_TRACE_START(tracelevel,tmask); } // SFCB_DEBUG #ifndef SFCB_DEBUG if (tmask) mlogf(M_ERROR,M_SHOW,"--- SCFB_DEBUG not configured. -t %d ignored\n",tmask); #endif if ((pauseStr=getenv("SFCB_PAUSE_PROVIDER"))) { printf("--- Provider pausing for: %s\n",pauseStr); } if (getControlBool("enableHttp", &enableHttp)) enableHttp=1; #ifdef HAVE_UDS if (getControlBool("enableUds", &enableUds)) enableUds=1; #endif #if defined USE_SSL if (getControlBool("enableHttps", &enableHttps)) enableHttps=0; sslMode=enableHttps; #ifdef HAVE_UDS sslOMode=sslMode & !enableHttp & !enableUds; #else sslOMode=sslMode & !enableHttp; #endif #else mlogf(M_INFO,M_SHOW,"--- SSL not configured\n"); enableHttps=0; sslMode=0; sslOMode=0; #endif if (getControlBool("useChunking", &useChunking)) useChunking=0; if (useChunking==0) mlogf(M_INFO,M_SHOW,"--- Chunking disabled\n"); if (getControlBool("doBasicAuth", &doBa)) doBa=0; if (!doBa) mlogf(M_INFO,M_SHOW,"--- User authentication disabled\n"); if (getControlBool("enableInterOp", &enableInterOp)) enableInterOp=0; if (getControlNum("httpProcs", (long*)&dSockets)) dSockets = 10; if (getControlNum("httpsProcs", (long*)&sSockets)) sSockets = 10; if (getControlNum("provProcs", (long*)&pSockets)) pSockets = 16; if (getControlBool("httpLocalOnly", &httpLocalOnly)) httpLocalOnly=0; if (httpLocalOnly) mlogf(M_INFO,M_SHOW,"--- External HTTP connections disabled; using loopback only\n"); if (getControlNum("providerSampleInterval", (long*)&provSampleInterval)) provSampleInterval = 30; if (getControlNum("providerTimeoutInterval", (long*)&provTimeoutInterval)) provTimeoutInterval = 60; if (getControlBool("providerAutoGroup", (int*)&provAutoGroup)) provAutoGroup=1; resultSockets=getSocketPair("sfcbd result"); sfcbSockets=getSocketPair("sfcbd sfcb"); if (enableInterOp==0) mlogf(M_INFO,M_SHOW,"--- InterOp namespace disabled\n"); else exFlags = exFlags | 2; if ((enableInterOp && pSockets < 4 ) || pSockets < 3) { /* adjusting provider number */ if (enableInterOp) { pSockets = 4; } else { pSockets = 3; } mlogf(M_INFO,M_SHOW, "--- Max provider process number adjusted to %d\n", pSockets); } // Check for whitespace trimming option if (getControlBool("trimWhitespace", &trimws)) { trimws = 0; } if ((enableHttp || enableHttps) && dSockets > 0) { startHttp = 1; } initSem(dSockets,sSockets,pSockets); initProvProcCtl(pSockets); init_sfcBroker(); initSocketPairs(pSockets,dSockets,sSockets); setSignal(SIGQUIT, handleSigquit,0); setSignal(SIGINT, handleSigquit,0); setSignal(SIGTERM, handleSigquit,0); setSignal(SIGHUP, handleSigHup,0); atexit(uninitGarbageCollector); startLocalConnectServer(); #ifndef LOCAL_CONNECT_ONLY_ENABLE if (startHttp) { startHttpd(argc, argv, sslMode); } #endif // LOCAL_CONNECT_ONLY_ENABLE #ifdef HAVE_JDBC //Start dbProtocol-Daemon if (startDbp) { if (sslMode) startDbpd(argc, argv,1); if (!sslOMode) startDbpd(argc, argv,0); } #endif setSignal(SIGSEGV, handleSigSegv,SA_ONESHOT); setSignal(SIGCHLD, handleSigChld,0); processProviderMgrRequests(); return 0; }
int Lua_StartLogging(lua_State *L) { startLogging(); return 0; }
Rover::Rover(PinName leftMotorPwm, PinName leftMotorBrake, PinName leftMotorDirection, PinName rightMotorPwm, PinName rightMotorBrake, PinName rightMotorDirection, PinName leftQeiChannelA, PinName leftQeiChannelB, PinName leftQeiIndex, int leftPulsesPerRev, PinName rightQeiChannelA, PinName rightQeiChannelB, PinName rightQeiIndex, int rightPulsesPerRev) : leftMotors(), rightMotors(), leftQei(leftQeiChannelA, leftQeiChannelB, leftQeiIndex, leftPulsesPerRev), rightQei(rightQeiChannelA, rightQeiChannelB, rightQeiIndex, rightPulsesPerRev), leftController(Kc, Ti, Td, PID_RATE), rightController(Kc, Ti, Td, PID_RATE), stateTicker(), logTicker(), imu(IMU_RATE_, GYRO_MEAS_ERROR, ACCELEROMETER_RATE, GYROSCOPE_RATE) { //--------------------------------- // Left motors and PID controller. //--------------------------------- //Motors. leftMotors.setPwmPin(leftMotorPwm); leftMotors.setBrakePin(leftMotorBrake); leftMotors.setDirectionPin(leftMotorDirection); leftMotors.initialize(); leftMotors.setDirection(BACKWARD); leftMotors.setBrake(BRAKE_OFF); //PID. leftController.setInputLimits(PID_IN_MIN, PID_IN_MAX); leftController.setOutputLimits(PID_OUT_MIN, PID_OUT_MAX); leftController.setBias(PID_BIAS); leftController.setMode(AUTO_MODE); leftPulses_ = 0; leftPrevPulses_ = 0; leftPwmDuty_ = 1.0; leftVelocity_ = 0.0; //---------------------------------- // Right motors and PID controller. //---------------------------------- //Motors. rightMotors.setPwmPin(rightMotorPwm); rightMotors.setBrakePin(rightMotorBrake); rightMotors.setDirectionPin(rightMotorDirection); rightMotors.initialize(); rightMotors.setDirection(FORWARD); rightMotors.setBrake(BRAKE_OFF); //PID. rightController.setInputLimits(PID_IN_MIN, PID_IN_MAX); rightController.setOutputLimits(PID_OUT_MIN, PID_OUT_MAX); rightController.setBias(PID_BIAS); rightController.setMode(AUTO_MODE); rightPulses_ = 0; rightPrevPulses_ = 0; rightPwmDuty_ = 1.0; rightVelocity_ = 0.0; //-------------------- // Working Variables. //-------------------- positionSetPoint_ = 0.0; headingSetPoint_ = 0.0; heading_ = 0.0; prevHeading_ = 0.0; degreesTurned_ = 0.0; leftStopFlag_ = 0; rightStopFlag_ = 0; logIndex = 0; //-------- // BEGIN! //-------- state_ = STATE_STATIONARY; stateTicker.attach(this, &Rover::doState, PID_RATE); startLogging(); }
void Window::createActions() { quitAction = new QAction(tr("&Quit"), this); quitAction->setIcon(QIcon(":/img/exit.png")); startAction = new QAction(tr("Sta&rt Logging"), this); startAction->setIcon(QIcon(":/img/start.png")); stopAction = new QAction(tr("&Stop Logging"), this); stopAction->setIcon(QIcon(":/img/stop.png")); profileAction = new QAction(tr("&Profile"), this); profileAction->setIcon(QIcon(":/img/profile.png")); histogramAction = new QAction(tr("Norm by &histogram"), this); histogramAction->setIcon(QIcon(":/img/histogram.png")); chiAction = new QAction(tr("&Chi-square probability count"), this); chiAction->setIcon(QIcon(":/img/chisquare.png")); medianAction = new QAction(tr("&Median filtering"), this); medianAction->setIcon(QIcon(":/img/filter16.png")); clearCleanAction = new QAction(tr("Delete clean logs"), this); clearCleanAction->setIcon(QIcon(":/img/filter_delete.png")); stopAction->setEnabled(false); //medianAction->setEnabled(false); quitAction->setShortcut(Qt::ALT + Qt::Key_Q); startAction->setShortcut(Qt::ALT + Qt::Key_R); stopAction->setShortcut(Qt::ALT + Qt::Key_S); profileAction->setShortcut(Qt::ALT + Qt::Key_P); histogramAction->setShortcut(Qt::ALT + Qt::Key_H); chiAction->setShortcut(Qt::ALT + Qt::Key_C); medianAction->setShortcut(Qt::ALT + Qt::Key_M); QObject::connect(profileAction, SIGNAL(triggered()), this, SLOT(changeProfile())); QObject::connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); QObject::connect(startAction, SIGNAL(triggered()), controller, SLOT(startLogging())); QObject::connect(stopAction, SIGNAL(triggered()), controller, SLOT(stopLogging())); QObject::connect(startAction, SIGNAL(triggered()), this, SLOT(startedLogging())); QObject::connect(stopAction, SIGNAL(triggered()), this, SLOT(stoppedLogging())); QObject::connect(controller, SIGNAL(showInfo(Log)), this, SLOT(appendLog(Log))); QObject::connect(controller, SIGNAL(showInfo(const QString&)), this, SLOT(appendLog(const QString&))); QObject::connect(histogramAction, SIGNAL(triggered()), this, SLOT(startHist())); QObject::connect(chiAction, SIGNAL(triggered()), this, SLOT(startChi())); QObject::connect(medianAction, SIGNAL(triggered()), this, SLOT(startMedian())); QObject::connect(clearCleanAction, SIGNAL(triggered()), this, SLOT(clearClean())); }
static bool parseArgs(Mpr *mpr, int argc, char **argv) { char *argp, *key, *value; int i, setWorkers; setWorkers = 0; for (nextArg = 1; nextArg < argc; nextArg++) { argp = argv[nextArg]; if (*argp != '-') { break; } if (strcmp(argp, "--benchmark") == 0 || strcmp(argp, "-b") == 0) { benchmark++; } else if (strcmp(argp, "--chunk") == 0) { if (nextArg >= argc) { return 0; } else { chunkSize = argv[++nextArg]; i = atoi(chunkSize); if (i < 0) { mprError(mpr, "Bad chunksize %d", i); return 0; } } } else if (strcmp(argp, "--continue") == 0) { continueOnErrors++; } else if (strcmp(argp, "--cookie") == 0) { if (nextArg >= argc) { return 0; } else { mprAddItem(headers, mprCreateKeyPair(headers, "Cookie", argv[++nextArg])); } } else if (strcmp(argp, "--debug") == 0 || strcmp(argp, "-D") == 0 || strcmp(argp, "--debugger") == 0) { mprSetDebugMode(mpr, 1); retries = 0; } else if (strcmp(argp, "--delete") == 0) { method = "DELETE"; } else if (strcmp(argp, "--form") == 0 || strcmp(argp, "-f") == 0) { if (nextArg >= argc) { return 0; } else { if (formData == 0) { formData = mprCreateList(mpr); } addFormVars(mpr, argv[++nextArg]); } } else if (strcmp(argp, "--header") == 0) { if (nextArg >= argc) { return 0; } else { key = argv[++nextArg]; if ((value = strchr(key, ':')) == 0) { mprError(mpr, "Bad header format. Must be \"key: value\""); return 0; } *value++ = '\0'; while (isspace((int) *value)) { value++; } mprAddItem(headers, mprCreateKeyPair(headers, key, value)); } } else if (strcmp(argp, "--host") == 0) { if (nextArg >= argc) { return 0; } else { host = argv[++nextArg]; } } else if (strcmp(argp, "--http") == 0) { if (nextArg >= argc) { return 0; } else { httpVersion = atoi(argv[++nextArg]); } } else if (strcmp(argp, "--iterations") == 0 || strcmp(argp, "-i") == 0) { if (nextArg >= argc) { return 0; } else { iterations = atoi(argv[++nextArg]); } } else if (strcmp(argp, "--log") == 0 || strcmp(argp, "-l") == 0) { if (nextArg >= argc) { return 0; } else { startLogging(mpr, argv[++nextArg]); } } else if (strcmp(argp, "--method") == 0) { if (nextArg >= argc) { return 0; } else { method = argv[++nextArg]; } } else if (strcmp(argp, "--noout") == 0 || strcmp(argp, "-n") == 0 || strcmp(argp, "--quiet") == 0 || strcmp(argp, "-q") == 0) { noout++; } else if (strcmp(argp, "--nofollow") == 0) { nofollow++; } else if (strcmp(argp, "--password") == 0 || strcmp(argp, "-p") == 0) { if (nextArg >= argc) { return 0; } else { password = argv[++nextArg]; } } else if (strcmp(argp, "--post") == 0) { method = "POST"; } else if (strcmp(argp, "--printable") == 0) { printable++; } else if (strcmp(argp, "--put") == 0) { method = "PUT"; } else if (strcmp(argp, "--range") == 0) { if (nextArg >= argc) { return 0; } else { if (ranges == 0) { ranges = mprAsprintf(mpr, -1, "bytes=%s", argv[++nextArg]); } else { ranges = mprStrcat(mpr, -1, ranges, ",", argv[++nextArg], NULL); } } } else if (strcmp(argp, "--retries") == 0 || strcmp(argp, "-r") == 0) { if (nextArg >= argc) { return 0; } else { retries = atoi(argv[++nextArg]); } } else if (strcmp(argp, "--sequence") == 0) { sequence++; } else if (strcmp(argp, "--showCode") == 0 || strcmp(argp, "--showStatus") == 0) { showCode++; } else if (strcmp(argp, "--show") == 0 || strcmp(argp, "--showHeaders") == 0) { showHeaders++; } else if (strcmp(argp, "--single") == 0 || strcmp(argp, "-s") == 0) { singleStep++; } else if (strcmp(argp, "--threads") == 0 || strcmp(argp, "-t") == 0) { if (nextArg >= argc) { return 0; } else { loadThreads = atoi(argv[++nextArg]); } } else if (strcmp(argp, "--timeout") == 0) { if (nextArg >= argc) { return 0; } else { timeout = atoi(argv[++nextArg]) * 1000; } } else if (strcmp(argp, "--upload") == 0 || strcmp(argp, "-u") == 0) { upload++; } else if (strcmp(argp, "--user") == 0 || strcmp(argp, "--username") == 0) { if (nextArg >= argc) { return 0; } else { username = argv[++nextArg]; } } else if (strcmp(argp, "--verbose") == 0 || strcmp(argp, "-v") == 0) { verbose++; } else if (strcmp(argp, "--workerTheads") == 0 || strcmp(argp, "-w") == 0) { if (nextArg >= argc) { return 0; } else { workers = atoi(argv[++nextArg]); } setWorkers++; } else { return 0; break; } } if (argc == nextArg) { return 0; } argc = argc - nextArg; argv = &argv[nextArg]; target = argv[argc - 1]; argc--; if (argc > 0) { /* * Files present on command line */ fileData = mprCreateList(mpr); for (i = 0; i < argc; i++) { mprAddItem(fileData, argv[i]); } } if (!setWorkers) { workers = loadThreads + 2; } if (method == 0) { if (upload || formData) { method = "POST"; } else if (fileData) { method = "PUT"; } else { method = "GET"; } } return 1; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); //call singelton to register needed type for signals and slots MetaTypeRegister::registerAllTyps(); //dummy main window MainWindow widgetMain; //get ref to display DisplayVideo *myDisplayModul = widgetMain.getRefToDisplay(); //construct the device, witch should be used DeviceCamera *myDevCamHD = new CamMatroxOrionHD(); myDevCamHD->setName(QString("matrox orion hd DVI input")); myDevCamHD->setCamSort(DeviceCamera::CAM_SORT_MATROX_ORION_HD_DVI_INPUT); //construct modul chain //type short has the moduls: source + logger from video ModuleChain *myVideoChain = ModuleChainFactory::instance()->fabricateModuleChain(ModuleChainFactory::TYPE_SHORT,DataStreamTypes::VIDEO,myDevCamHD); //**** what is also existing in the complete doc2 source base ? // ModuleChain *mySensorChain = ModuleChainFactory::instance()->fabricateModuleChain(ModuleChainFactory::TYPE_NORMAL,DataStreamTypes::SENSOR); // ModuleChain *myAudioChain = ModuleChainFactory::instance()->fabricateModuleChain(ModuleChainFactory::TYPE_NORMAL,DataStreamTypes::AUDIO); //append the display from main window bool success =myVideoChain->appendModulToSource(myDisplayModul); if(!success)qWarning()<<"!! error while append modul display to video chain"; //make some output for debug myVideoChain->toString(); //get loggerModul of chain to start capture ModuleLogger *myLoggerModul = myVideoChain->getModuleLogger(); //connect with button from form success = QObject::connect(&widgetMain, SIGNAL(signalStartLoggingClicked()),myLoggerModul, SLOT(startLogging())); if(!success)qWarning("!! error while connect start button"); success = QObject::connect(&widgetMain, SIGNAL(signalStopLoggingClicked()),myLoggerModul, SLOT(stoppLogging())); if(!success)qWarning("!! error while connect stop button"); //example influence more specific modul //cast more down to use set file name if(myLoggerModul->getDataStreamType() == DataStreamTypes::VIDEO) { LoggerVideo *myVideoLogger = (LoggerVideo*) myLoggerModul; //connect main widget and logger modul success = QObject::connect(&widgetMain, SIGNAL(signalFileNameChanged(QString)),myVideoLogger, SLOT(setVideoOutputFileName(QString)),Qt::DirectConnection); if(!success)qWarning("!! error while connect file name line edit field"); //set the standard filename, needed for the first time myVideoLogger->setVideoOutputFileName(QString("test0815.avi"));//why here? @see MainWindow function on_lineEdit_textChanged success = QObject::connect(&widgetMain, SIGNAL(signalSaveNext10Pics()),myVideoLogger, SLOT(saveNext10Pictures()),Qt::DirectConnection); if(!success)qWarning("!! error while connect signalSaveNext10Pics "); }else qWarning("!! error cast ModuleLogger to LoggerVideo modul"); //start the modul chain myVideoChain->startModuleChain(); //call fflush to get all output on stout fflush(stdout); widgetMain.show(); return a.exec(); }