Development Gcs FAQ

peabody124 edited this page Mar 4, 2015 · 3 revisions

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)
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.