forked from qt-creator/qt-creator
Don't block, and be able to terminate remote application.
This commit is contained in:
@@ -411,7 +411,7 @@ RunControl* S60DeviceRunConfigurationRunner::run(QSharedPointer<RunConfiguration
|
|||||||
// ======== S60DeviceRunControl
|
// ======== S60DeviceRunControl
|
||||||
|
|
||||||
S60DeviceRunControl::S60DeviceRunControl(QSharedPointer<RunConfiguration> runConfiguration)
|
S60DeviceRunControl::S60DeviceRunControl(QSharedPointer<RunConfiguration> runConfiguration)
|
||||||
: RunControl(runConfiguration)
|
: RunControl(runConfiguration), m_adapter(0)
|
||||||
{
|
{
|
||||||
m_makesis = new QProcess(this);
|
m_makesis = new QProcess(this);
|
||||||
connect(m_makesis, SIGNAL(readyReadStandardError()),
|
connect(m_makesis, SIGNAL(readyReadStandardError()),
|
||||||
@@ -471,7 +471,7 @@ void S60DeviceRunControl::stop()
|
|||||||
{
|
{
|
||||||
m_makesis->kill();
|
m_makesis->kill();
|
||||||
m_signsis->kill();
|
m_signsis->kill();
|
||||||
//m_adapter->terminate();
|
m_adapter->terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool S60DeviceRunControl::isRunning() const
|
bool S60DeviceRunControl::isRunning() const
|
||||||
@@ -533,7 +533,6 @@ void S60DeviceRunControl::signsisProcessFinished()
|
|||||||
emit finished();
|
emit finished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//TODO
|
|
||||||
m_adapter = new trk::Adapter;
|
m_adapter = new trk::Adapter;
|
||||||
connect(m_adapter, SIGNAL(finished()), this, SLOT(runFinished()));
|
connect(m_adapter, SIGNAL(finished()), this, SLOT(runFinished()));
|
||||||
//TODO com selection, sisx destination and file path user definable
|
//TODO com selection, sisx destination and file path user definable
|
||||||
@@ -549,6 +548,8 @@ void S60DeviceRunControl::signsisProcessFinished()
|
|||||||
|
|
||||||
void S60DeviceRunControl::runFinished()
|
void S60DeviceRunControl::runFinished()
|
||||||
{
|
{
|
||||||
|
m_adapter->deleteLater();
|
||||||
|
m_adapter = 0;
|
||||||
emit addToOutputWindow(this, tr("Finished."));
|
emit addToOutputWindow(this, tr("Finished."));
|
||||||
emit finished();
|
emit finished();
|
||||||
}
|
}
|
||||||
|
@@ -44,6 +44,10 @@ BOOL WINAPI TryReadFile(HANDLE hFile,
|
|||||||
qDebug() << "ClearCommError() failed";
|
qDebug() << "ClearCommError() failed";
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
if (comStat.cbInQue == 0) {
|
||||||
|
*lpNumberOfBytesRead = 0;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
return ReadFile(hFile,
|
return ReadFile(hFile,
|
||||||
lpBuffer,
|
lpBuffer,
|
||||||
qMin(comStat.cbInQue, nNumberOfBytesToRead),
|
qMin(comStat.cbInQue, nNumberOfBytesToRead),
|
||||||
@@ -66,7 +70,6 @@ Adapter::Adapter()
|
|||||||
#endif
|
#endif
|
||||||
m_trkWriteToken = 0;
|
m_trkWriteToken = 0;
|
||||||
m_trkWriteBusy = false;
|
m_trkWriteBusy = false;
|
||||||
startTimer(100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Adapter::~Adapter()
|
Adapter::~Adapter()
|
||||||
@@ -88,6 +91,7 @@ bool Adapter::startServer()
|
|||||||
qDebug("Unable to connect to TRK server");
|
qDebug("Unable to connect to TRK server");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
m_timerId = startTimer(100);
|
||||||
qDebug("Connecting");
|
qDebug("Connecting");
|
||||||
sendTrkInitialPing();
|
sendTrkInitialPing();
|
||||||
sendTrkMessage(TrkConnect); // Connect
|
sendTrkMessage(TrkConnect); // Connect
|
||||||
@@ -197,6 +201,14 @@ void Adapter::waitForTrkFinished(const TrkResult &result)
|
|||||||
sendTrkMessage(TrkPing, CB(handleWaitForFinished));
|
sendTrkMessage(TrkPing, CB(handleWaitForFinished));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Adapter::terminate()
|
||||||
|
{
|
||||||
|
QByteArray ba;
|
||||||
|
appendShort(&ba, 0x0000, TargetByteOrder);
|
||||||
|
appendInt(&ba, m_session.pid, TargetByteOrder);
|
||||||
|
sendTrkMessage(TrkDeleteItem, CB(waitForTrkFinished), ba);
|
||||||
|
}
|
||||||
|
|
||||||
void Adapter::sendTrkAck(byte token)
|
void Adapter::sendTrkAck(byte token)
|
||||||
{
|
{
|
||||||
logMessage(QString("SENDING ACKNOWLEDGEMENT FOR TOKEN %1").arg(int(token)));
|
logMessage(QString("SENDING ACKNOWLEDGEMENT FOR TOKEN %1").arg(int(token)));
|
||||||
@@ -262,6 +274,9 @@ void Adapter::tryTrkRead()
|
|||||||
if (isValidTrkResult(m_trkReadQueue))
|
if (isValidTrkResult(m_trkReadQueue))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (charsRead == 0 && m_trkReadQueue.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
#else // USE_NATIVE
|
#else // USE_NATIVE
|
||||||
if (m_trkDevice->bytesAvailable() == 0 && m_trkReadQueue.isEmpty()) {
|
if (m_trkDevice->bytesAvailable() == 0 && m_trkReadQueue.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@@ -475,6 +490,7 @@ void Adapter::handleCreateProcess(const TrkResult &result)
|
|||||||
void Adapter::handleWaitForFinished(const TrkResult &result)
|
void Adapter::handleWaitForFinished(const TrkResult &result)
|
||||||
{
|
{
|
||||||
logMessage(" FINISHED: " + stringFromArray(result.data));
|
logMessage(" FINISHED: " + stringFromArray(result.data));
|
||||||
|
killTimer(m_timerId);
|
||||||
emit finished();
|
emit finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -64,6 +64,9 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void finished();
|
void finished();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void terminate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
// TRK
|
// TRK
|
||||||
@@ -137,6 +140,7 @@ private:
|
|||||||
// Debuggee state
|
// Debuggee state
|
||||||
Session m_session; // global-ish data (process id, target information)
|
Session m_session; // global-ish data (process id, target information)
|
||||||
|
|
||||||
|
int m_timerId;
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
QString m_copySrcFileName;
|
QString m_copySrcFileName;
|
||||||
QString m_copyDstFileName;
|
QString m_copyDstFileName;
|
||||||
|
Reference in New Issue
Block a user