2 ******************************************************************************
4 * @file uavobjectmanager.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * @see The GNU Public License (GPL) Version 3
7 * @addtogroup GCSPlugins GCS Plugins
9 * @addtogroup UAVObjectsPlugin UAVObjects Plugin
11 * @brief The UAVUObjects GCS plugin
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #ifndef UAVOBJECTMANAGER_H
29 #define UAVOBJECTMANAGER_H
31 #include "uavobjects_global.h"
32 #include "uavobject.h"
33 #include "uavdataobject.h"
34 #include "uavmetaobject.h"
37 #include <QMutexLocker>
38 #include <QJsonObject>
40 class UAVOBJECTS_EXPORT UAVObjectManager
: public QObject
{
44 enum JSON_EXPORT_OPTION
{ JSON_EXPORT_ALL
, JSON_EXPORT_METADATA
, JSON_EXPORT_SETTINGS
, JSON_EXPORT_DATA
};
48 bool registerObject(UAVDataObject
*obj
);
49 QList
< QList
<UAVObject
*> > getObjects();
50 QList
< QList
<UAVDataObject
*> > getDataObjects();
51 QList
< QList
<UAVMetaObject
*> > getMetaObjects();
52 UAVObject
*getObject(const QString
& name
, quint32 instId
= 0);
53 UAVObject
*getObject(quint32 objId
, quint32 instId
= 0);
54 QList
<UAVObject
*> getObjectInstances(const QString
& name
);
55 QList
<UAVObject
*> getObjectInstances(quint32 objId
);
56 qint32
getNumInstances(const QString
& name
);
57 qint32
getNumInstances(quint32 objId
);
59 void toJson(QJsonObject
&jsonObject
, JSON_EXPORT_OPTION what
= JSON_EXPORT_ALL
);
60 void toJson(QJsonObject
&jsonObject
, const QList
<QString
> &objectsToExport
);
61 void toJson(QJsonObject
&jsonObject
, const QList
<UAVObject
*> &objectsToExport
);
62 void fromJson(const QJsonObject
&jsonObject
, QList
<UAVObject
*> *updatedObjects
= NULL
);
65 void newObject(UAVObject
*obj
);
66 void newInstance(UAVObject
*obj
);
69 static const quint32 MAX_INSTANCES
= 1000;
71 QList
< QList
<UAVObject
*> > objects
;
74 void addObject(UAVObject
*obj
);
75 UAVObject
*getObject(const QString
*name
, quint32 objId
, quint32 instId
);
76 QList
<UAVObject
*> getObjectInstances(const QString
*name
, quint32 objId
);
77 qint32
getNumInstances(const QString
*name
, quint32 objId
);
81 #endif // UAVOBJECTMANAGER_H