/** * Constructor */ Telemetry::Telemetry(UAVTalk* utalk, UAVObjectManager* objMngr) { this->utalk = utalk; this->objMngr = objMngr; mutex = new QMutex(QMutex::Recursive); // Process all objects in the list QList< QList<UAVObject*> > objs = objMngr->getObjects(); for (int objidx = 0; objidx < objs.length(); ++objidx) { registerObject(objs[objidx][0]); // we only need to register one instance per object type } // Listen to new object creations connect(objMngr, SIGNAL(newObject(UAVObject*)), this, SLOT(newObject(UAVObject*))); connect(objMngr, SIGNAL(newInstance(UAVObject*)), this, SLOT(newInstance(UAVObject*))); // Listen to transaction completions connect(utalk, SIGNAL(transactionCompleted(UAVObject*)), this, SLOT(transactionCompleted(UAVObject*))); // Get GCS stats object gcsStatsObj = GCSTelemetryStats::GetInstance(objMngr); // Setup transaction timer transPending = false; transTimer = new QTimer(this); transTimer->stop(); connect(transTimer, SIGNAL(timeout()), this, SLOT(transactionTimeout())); // Setup and start the periodic timer timeToNextUpdateMs = 0; updateTimer = new QTimer(this); connect(updateTimer, SIGNAL(timeout()), this, SLOT(processPeriodicUpdates())); updateTimer->start(1000); // Setup and start the stats timer txErrors = 0; txRetries = 0; }
/** * Constructor */ Telemetry::Telemetry(UAVTalk *utalk, UAVObjectManager *objMngr) : objMngr(objMngr), utalk(utalk) { mutex = new QMutex(QMutex::Recursive); // Register all objects in the list QList< QList<UAVObject *> > objs = objMngr->getObjects(); for (int objidx = 0; objidx < objs.length(); ++objidx) { // we only need to register one instance per object type registerObject(objs[objidx][0]); } // Listen to new object creations connect(objMngr, SIGNAL(newObject(UAVObject *)), this, SLOT(newObject(UAVObject *))); connect(objMngr, SIGNAL(newInstance(UAVObject *)), this, SLOT(newInstance(UAVObject *))); // Listen to transaction completions // TODO should send a status (SUCCESS, FAILED, TIMEOUT) connect(utalk, SIGNAL(transactionCompleted(UAVObject *, bool)), this, SLOT(transactionCompleted(UAVObject *, bool))); // Get GCS stats object gcsStatsObj = GCSTelemetryStats::GetInstance(objMngr); // Setup and start the periodic timer timeToNextUpdateMs = 0; updateTimer = new QTimer(this); connect(updateTimer, SIGNAL(timeout()), this, SLOT(processPeriodicUpdates())); updateTimer->start(1000); // Setup and start the stats timer txErrors = 0; txRetries = 0; }