Development Gcs FAQ

peabody124 edited this page Mar 4, 2015 · 3 revisions
Clone this wiki locally

How do I access a UAVObject?

The UAVObjectManager maintains the data for all the objects and you query it from this. An example of this would be the following:

#include "uavobjectmanager.h"
#include "flightstatus.h"

And then in the code:

// get handle to the object manager via the general plugin manager
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();

// this gets a data structure with the data
FlightStatus* flightStatus = FlightStatus::GetInstance(objManager);
FlightStatus::DataFields flightStatusData = flightStatus->getData();
// do something to it if you want to modify. flight status is a bad example here because
// it is only readonly from the GCS side
flightStatus->setData(&flightStatusData);

Note that your plugin pro (or dependencies.pri) file must have

include(../../plugins/uavobjects/uavobjects.pri)