CODA: Fixed problem with CODA not responding at first communication attempt

This commit is contained in:
Pawel Polanski
2011-03-16 10:03:52 +01:00
parent 8a1fc04216
commit 3e75e77fe4
4 changed files with 28 additions and 16 deletions

View File

@@ -186,6 +186,7 @@ void CodaRunControl::slotSerialPong(const QString &message)
{
if (debug > 1)
qDebug() << "CODA serial pong:" << message;
handleConnected();
}
void CodaRunControl::slotCodaEvent(const CodaEvent &event)
@@ -194,13 +195,9 @@ void CodaRunControl::slotCodaEvent(const CodaEvent &event)
qDebug() << "CODA event:" << "Type:" << event.type() << "Message:" << event.toString();
switch (event.type()) {
case CodaEvent::LocatorHello: { // Commands accepted now
m_state = StateConnected;
appendMessage(tr("Connected."), NormalMessageFormat);
setProgress(maxProgress()*0.80);
initCommunication();
}
break;
case CodaEvent::LocatorHello:
handleConnected();
break;
case CodaEvent::RunControlContextRemoved:
handleContextRemoved(event);
break;
@@ -230,6 +227,16 @@ void CodaRunControl::initCommunication()
m_codaDevice->sendLoggingAddListenerCommand(CodaCallback(this, &CodaRunControl::handleAddListener));
}
void CodaRunControl::handleConnected()
{
if (m_state >= StateConnected)
return;
m_state = StateConnected;
appendMessage(tr("Connected."), NormalMessageFormat);
setProgress(maxProgress()*0.80);
initCommunication();
}
void CodaRunControl::handleContextRemoved(const CodaEvent &event)
{
const QVector<QByteArray> removedItems