1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

OP-1481 fixed telemetry multi-threading issue: was not possible to create and request an uavo instance in one go

This commit is contained in:
Philippe Renon 2014-09-16 08:42:36 +02:00
parent c49497f2e0
commit a045b10472

View File

@ -48,10 +48,12 @@ Telemetry::Telemetry(UAVTalk *utalk, UAVObjectManager *objMngr) : objMngr(objMng
}
// Listen to new object creations
connect(objMngr, SIGNAL(newObject(UAVObject *)), this, SLOT(newObject(UAVObject *)));
connect(objMngr, SIGNAL(newInstance(UAVObject *)), this, SLOT(newInstance(UAVObject *)));
// connection must be direct, if not, it is not possible to create and send (or request) an object in one go
connect(objMngr, SIGNAL(newObject(UAVObject *)), this, SLOT(newObject(UAVObject *)), Qt::DirectConnection);
connect(objMngr, SIGNAL(newInstance(UAVObject *)), this, SLOT(newInstance(UAVObject *)), Qt::DirectConnection);
// Listen to transaction completions
// these slots will be executed in the telemetry thread
// TODO should send a status (SUCCESS, FAILED, TIMEOUT)
connect(utalk, SIGNAL(transactionCompleted(UAVObject *, bool)), this, SLOT(transactionCompleted(UAVObject *, bool)));
@ -568,6 +570,10 @@ void Telemetry::newObject(UAVObject *obj)
{
QMutexLocker locker(mutex);
#ifdef VERBOSE_TELEMETRY
qDebug() << "Telemetry - new object" << obj->toStringBrief();
#endif
registerObject(obj);
}
@ -575,6 +581,10 @@ void Telemetry::newInstance(UAVObject *obj)
{
QMutexLocker locker(mutex);
#ifdef VERBOSE_TELEMETRY
qDebug() << "Telemetry - new object instance" << obj->toStringBrief();
#endif
registerObject(obj);
}