Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
d680a7dd
Commit
d680a7dd
authored
Aug 04, 2009
by
con
Browse files
Handle application output that comes over TRK.
parent
05d55ad9
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
View file @
d680a7dd
...
...
@@ -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
();
...
...
src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h
View file @
d680a7dd
...
...
@@ -160,6 +160,7 @@ private slots:
void
printInstallingNotice
();
void
printStartingNotice
();
void
printRunNotice
(
uint
pid
);
void
printApplicationOutput
(
const
QString
&
output
);
void
runFinished
();
private:
...
...
tests/manual/trk/launcher.cpp
View file @
d680a7dd
...
...
@@ -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);
...
...
tests/manual/trk/launcher.h
View file @
d680a7dd
...
...
@@ -67,6 +67,7 @@ signals:
void
startingApplication
();
void
applicationRunning
(
uint
pid
);
void
finished
();
void
applicationOutputReceived
(
const
QString
&
output
);
public
slots
:
void
terminate
();
...
...
tests/manual/trk/trkutils.cpp
View file @
d680a7dd
...
...
@@ -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
));
...
...
tests/manual/trk/trkutils.h
View file @
d680a7dd
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment