diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2010-05-11 12:34:37 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2010-05-11 12:37:01 (GMT) |
commit | fffb09adfd07eef5d2f296374b507032eec06cad (patch) | |
tree | fda6192ad0556c9e282919807a9ba6000237ad44 /tools/runonphone/symbianutils/trkutils.cpp | |
parent | 05399347ed467693d45009c6ba659746ea492231 (diff) | |
download | Qt-fffb09adfd07eef5d2f296374b507032eec06cad.zip Qt-fffb09adfd07eef5d2f296374b507032eec06cad.tar.gz Qt-fffb09adfd07eef5d2f296374b507032eec06cad.tar.bz2 |
Symbian/trk: Fix debugging output for the N8.
1. Fix hanging behaviour when we receive a message on the wrong mux in
framed mode
2. Treat messages on the trace mux (0102) as debug output
3. Separate timestamp from text in trace messages
Reviewed-by: Friedemann Kleint
Diffstat (limited to 'tools/runonphone/symbianutils/trkutils.cpp')
-rw-r--r-- | tools/runonphone/symbianutils/trkutils.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/tools/runonphone/symbianutils/trkutils.cpp b/tools/runonphone/symbianutils/trkutils.cpp index 9b43c96..60e391e 100644 --- a/tools/runonphone/symbianutils/trkutils.cpp +++ b/tools/runonphone/symbianutils/trkutils.cpp @@ -276,14 +276,13 @@ QByteArray frameMessage(byte command, byte token, const QByteArray &data, bool s /* returns 0 if array doesn't represent a result, otherwise returns the length of the result data */ -ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame) +ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame, ushort& mux) { if (serialFrame) { // Serial protocol with length info if (buffer.length() < 4) return 0; - if (buffer.at(0) != 0x01 || byte(buffer.at(1)) != 0x90) - return 0; + mux = extractShort(buffer.data()); const ushort len = extractShort(buffer.data() + 2); return (buffer.size() >= len + 4) ? len : ushort(0); } @@ -292,6 +291,7 @@ ushort isValidTrkResult(const QByteArray &buffer, bool serialFrame) const int firstDelimiterPos = buffer.indexOf(delimiter); // Regular message delimited by 0x7e..0x7e if (firstDelimiterPos == 0) { + mux = MuxTrk; const int endPos = buffer.indexOf(delimiter, firstDelimiterPos + 1); return endPos != -1 ? endPos + 1 - firstDelimiterPos : 0; } @@ -304,7 +304,7 @@ bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *result, QByt result->clear(); if(rawData) rawData->clear(); - const ushort len = isValidTrkResult(*buffer, serialFrame); + const ushort len = isValidTrkResult(*buffer, serialFrame, result->multiplex); if (!len) return false; // handle receiving application output, which is not a regular command @@ -312,7 +312,6 @@ bool extractResult(QByteArray *buffer, bool serialFrame, TrkResult *result, QByt if (buffer->at(delimiterPos) != 0x7e) { result->isDebugOutput = true; result->data = buffer->mid(delimiterPos, len); - result->data.replace("\r\n", "\n"); *buffer->remove(0, delimiterPos + len); return true; } @@ -353,6 +352,19 @@ SYMBIANUTILS_EXPORT uint extractInt(const char *data) return res; } +SYMBIANUTILS_EXPORT quint64 extractInt64(const char *data) +{ + quint64 res = byte(data[0]); + res <<= 8; res += byte(data[1]); + res <<= 8; res += byte(data[2]); + res <<= 8; res += byte(data[3]); + res <<= 8; res += byte(data[4]); + res <<= 8; res += byte(data[5]); + res <<= 8; res += byte(data[6]); + res <<= 8; res += byte(data[7]); + return res; +} + SYMBIANUTILS_EXPORT QString quoteUnprintableLatin1(const QByteArray &ba) { QString res; |