Exemplo n.º 1
0
void SerialPortHandler::createSerialPortCommunicator()
{
    try{
        this->serial = new LagTestSerialPortComm( this->port, 115200, this->tm, this->clock_storage, this->adc_storage );

        // Setup period query for arduino clock
        this->timer = new QTimer(this);
        connect(timer, SIGNAL(timeout()), serial, SLOT(sendClockRequest()));
        timer->setInterval(requestPeriod);

        this->thread = new QThread();
        serial->moveToThread(thread);
        connect(thread, SIGNAL(started()), serial, SLOT(startCommunication()));
        connect(serial, SIGNAL(finished()), this, SLOT(onThreadQuit()));
        connect(serial, SIGNAL(finished()), serial, SLOT(deleteLater()));

        //Forward signals
        connect(serial, SIGNAL(sendDebugMsg(QString)), this, SIGNAL(sendDebugMsg(QString)) );
        connect(serial, SIGNAL(sendErrorMsg(QString)), this, SIGNAL(sendErrorMsg(QString)) );
        connect(serial, SIGNAL(sendFirmwareVersion(int)), this, SIGNAL(sendFirmwareVersion(int)) );
        connect(serial, SIGNAL(sendArduinoTimeout()), this, SIGNAL(sendArduinoTimeout()) );
        connect(serial, SIGNAL(sendArduinoDetectionFailed()), this, SIGNAL(sendArduinoDetectionFailed()) );

        //This is not working, dont know why, cant get signal through to the slot
//        connect(this, SIGNAL(sendVersionCheck()), serial, SLOT(doVersionCheck()) );
//        connect(this, SIGNAL(sendVersionCheck()), serial, SLOT(doSomethingElse()) );
//        connect(this, SIGNAL(sendVersionCheck()), qApp, SLOT(aboutQt()));

    } catch (exception &e){
        //qCritical("Connecting to the lagtest serial board failed!");
        this->sendErrorMsg("Connecting to the lagtest serial board failed!");
        throw e;
    }
}
Exemplo n.º 2
0
void MyProcess::on_finished(int exitCode, QProcess::ExitStatus exitStatus) {
	// Checking exingStatus is not reliable under Windows where if the
	// process was terminated with TerminateProcess() from another
	// application its value is still NormalExit
	//
	// Checking exit code for a failing command is unreliable too, as
	// exmple 'git status' returns 1 also without errors.
	//
	// On Windows exit code seems reliable in case of a command wrapped
	// in Window shell interpreter.
	//
	// So to detect a failing command we check also if stderr is not empty.
	QString errorDesc(readAllStandardError());

	isErrorExit =   (exitStatus != QProcess::NormalExit)
	             || (exitCode != 0 && isWinShell)
	             || !errorDesc.isEmpty()
	             ||  canceling;

	if (!canceling) { // no more noise after cancel

		if (receiver)
			emit eof();

		if (isErrorExit)
			sendErrorMsg(false, errorDesc);
	}
	busy = false;
	if (async)
		deleteLater();
}
Exemplo n.º 3
0
bool MyProcess::launchMe(SCRef runCmd, SCRef buf) {
	arguments = splitArgList(runCmd);
	if (arguments.isEmpty())
		return false;

	setWorkingDirectory(workDir);
	if (!QGit::startProcess(this, arguments, buf, &isWinShell)) {
		sendErrorMsg(true);
		return false;
	}
	return true;
}