Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / ground / gcs / src / plugins / uavobjectutil / uavobjectutilmanager.h
blob8878b8a07867800632017d769fc096e9803f4d02
1 /**
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
8 * @{
9 * @addtogroup UAVObjectsPlugin UAVObjects Plugin
10 * @{
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
22 * for more details.
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
29 #ifndef UAVOBJECTUTILMANAGER_H
30 #define UAVOBJECTUTILMANAGER_H
32 #include "uavobjectutil_global.h"
34 #include "extensionsystem/pluginmanager.h"
35 #include "uavobjectmanager.h"
36 #include "uavobject.h"
37 #include "devicedescriptorstruct.h"
39 #include "objectpersistence.h"
40 #include "firmwareiapobj.h"
42 #include <QtGlobal>
43 #include <QObject>
44 #include <QTimer>
45 #include <QMutex>
46 #include <QQueue>
47 #include <QDateTime>
49 class UAVOBJECTUTIL_EXPORT UAVObjectUtilManager : public QObject {
50 Q_OBJECT
52 public:
53 UAVObjectUtilManager();
54 ~UAVObjectUtilManager();
56 int setHomeLocation(double LLA[3], bool set);
57 int getHomeLocation(bool &set, double LLA[3]);
59 int getGPSPositionSensor(double LLA[3]);
61 int getBoardModel();
62 int getBootloaderRevision();
63 QByteArray getBoardCPUSerial();
64 quint32 getFirmwareCRC();
65 QByteArray getBoardDescription();
66 QString getBoardDescriptionString();
67 deviceDescriptorStruct getBoardDescriptionStruct();
68 static bool descriptionToStructure(QByteArray desc, deviceDescriptorStruct & struc);
69 UAVObjectManager *getObjectManager();
70 void saveObjectToSD(UAVObject *obj);
71 protected:
72 FirmwareIAPObj::DataFields getFirmwareIap();
74 signals:
75 void saveCompleted(int objectID, bool status);
77 private:
78 QMutex *mutex;
79 QQueue<UAVObject *> queue;
80 enum { IDLE, AWAITING_ACK, AWAITING_COMPLETED } saveState;
81 void saveNextObject();
82 QTimer failureTimer;
84 ExtensionSystem::PluginManager *pm;
85 UAVObjectManager *obm;
86 UAVObjectUtilManager *obum;
88 private slots:
89 // void transactionCompleted(UAVObject *obj, bool success);
90 void objectPersistenceTransactionCompleted(UAVObject *obj, bool success);
91 void objectPersistenceUpdated(UAVObject *obj);
92 void objectPersistenceOperationFailed();
96 #endif // ifndef UAVOBJECTUTILMANAGER_H