diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp index ec5c86054c24ac4bd6174c50f5c9a32002f98582..583a041b9f7dc98151ec17f7d585e2786ace8276 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp @@ -581,6 +581,7 @@ void S60DeviceRunControl::signsisProcessFinished() connect(m_adapter, SIGNAL(installingStarted()), this, SLOT(printInstallingNotice())); connect(m_adapter, SIGNAL(startingApplication()), this, SLOT(printStartingNotice())); connect(m_adapter, SIGNAL(applicationRunning(uint)), this, SLOT(printRunNotice(uint))); + connect(m_adapter, SIGNAL(applicationOutputReceived(QString)), this, SLOT(printApplicationOutput(QString))); //TODO sisx destination and file path user definable m_adapter->setTrkServerName(m_serialPortName); @@ -620,6 +621,11 @@ void S60DeviceRunControl::printRunNotice(uint pid) emit addToOutputWindow(this, tr("Application running with pid %1.").arg(pid)); } +void S60DeviceRunControl::printApplicationOutput(const QString &output) +{ + emit addToOutputWindowInline(this, output); +} + void S60DeviceRunControl::runFinished() { m_adapter->deleteLater(); diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h index 7ce79705f592f3491a5f10a51b15511ad8b8a09e..048594352dbe392889b153105169a5851485ad67 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h @@ -160,6 +160,7 @@ private slots: void printInstallingNotice(); void printStartingNotice(); void printRunNotice(uint pid); + void printApplicationOutput(const QString &output); void runFinished(); private: diff --git a/tests/manual/trk/launcher.cpp b/tests/manual/trk/launcher.cpp index f1796da7075f13b84cbd5a1ff1546e31ef6080a6..2d23e8d6fb7fe2e1a81bac6377fe47839b08f649 100644 --- a/tests/manual/trk/launcher.cpp +++ b/tests/manual/trk/launcher.cpp @@ -272,7 +272,8 @@ void Adapter::tryTrkRead() if (isValidTrkResult(m_trkReadQueue)) break; } - if (charsRead == 0 && m_trkReadQueue.isEmpty()) { + if (!isValidTrkResult(m_trkReadQueue)) { + logMessage("Partial message: " + stringFromArray(m_trkReadQueue)); return; } #else // USE_NATIVE @@ -285,15 +286,7 @@ void Adapter::tryTrkRead() #endif // USE_NATIVE logMessage("READ: " + stringFromArray(m_trkReadQueue)); - if (m_trkReadQueue.size() < 9) { - logMessage("ERROR READBUFFER INVALID (1): " - + stringFromArray(m_trkReadQueue)); - m_trkReadQueue.clear(); - return; - } - - while (!m_trkReadQueue.isEmpty()) - handleResult(extractResult(&m_trkReadQueue)); + handleResult(extractResult(&m_trkReadQueue)); m_trkWriteBusy = false; } @@ -303,6 +296,11 @@ void Adapter::handleResult(const TrkResult &result) { QByteArray prefix = "READ BUF: "; QByteArray str = result.toString().toUtf8(); + if (result.isDebugOutput) { // handle application output + logMessage("APPLICATION OUTPUT: " + result.data); + emit applicationOutputReceived(result.data); + return; + } switch (result.code) { case TrkNotifyAck: { // ACK //logMessage(prefix + "ACK: " + str); diff --git a/tests/manual/trk/launcher.h b/tests/manual/trk/launcher.h index 42b46a7ad63adafb0fbe4753c9a449451a8cc2e2..7412123afb12b5d66d11f937b44f763e2155fc75 100644 --- a/tests/manual/trk/launcher.h +++ b/tests/manual/trk/launcher.h @@ -67,6 +67,7 @@ signals: void startingApplication(); void applicationRunning(uint pid); void finished(); + void applicationOutputReceived(const QString &output); public slots: void terminate(); diff --git a/tests/manual/trk/trkutils.cpp b/tests/manual/trk/trkutils.cpp index 067687975d1940047ce3c033eda89616fe979552..5b6ea12ce6075f4e29fe92ddebd2258675d8a6d4 100644 --- a/tests/manual/trk/trkutils.cpp +++ b/tests/manual/trk/trkutils.cpp @@ -84,25 +84,15 @@ QByteArray frameMessage(byte command, byte token, const QByteArray &data) otherwise returns the length of the result data */ ushort isValidTrkResult(const QByteArray &buffer) { - if (buffer.length() < 9) + if (buffer.length() < 4) return 0; - if (buffer.at(0) != 0x01 || byte(buffer.at(1)) != 0x90) { + if (buffer.at(0) != 0x01 || byte(buffer.at(1)) != 0x90) return 0; - } ushort len = extractShort(buffer.data() + 2); - //logMessage(" READ BUF: " << stringFromArray(*buffer)); if (buffer.size() < len + 4) { return 0; } - - if (byte(buffer.at(4)) != 0x7e) { - return 0; - } - - if (byte(buffer.at(4 + len - 1)) != 0x7e) { - return 0; - } return len; } @@ -112,6 +102,13 @@ TrkResult extractResult(QByteArray *buffer) ushort len = isValidTrkResult(*buffer); if (!len) return result; + // handle receiving application output, which is not a regular command + if (buffer->at(4) != 0x7e) { + result.isDebugOutput = true; + result.data = buffer->mid(4, len); + *buffer = buffer->mid(4 + len); + return result; + } // FIXME: what happens if the length contains 0xfe? // Assume for now that it passes unencoded! QByteArray data = decode7d(buffer->mid(5, len - 2)); diff --git a/tests/manual/trk/trkutils.h b/tests/manual/trk/trkutils.h index 652ef4fe50fb1389b965eea0d9c7358c16c8e14b..f5bcd68e05f093e466a4751fb53cc270e2034d40 100644 --- a/tests/manual/trk/trkutils.h +++ b/tests/manual/trk/trkutils.h @@ -171,7 +171,7 @@ struct Breakpoint struct TrkResult { - TrkResult() { code = token = 0; } + TrkResult() { code = token = 0; isDebugOutput = false; } QString toString() const; // 0 for no error. int errorCode() const; @@ -180,6 +180,7 @@ struct TrkResult byte token; QByteArray data; QVariant cookie; + bool isDebugOutput; }; // returns a QByteArray containing 0x01 0x90 <len> 0x7e encoded7d(ba) 0x7e