LP-106 Setup Wizard refresh : Add dual servo setup (dual aileron or
[librepilot.git] / ground / gcs / src / plugins / uavobjectutil / uavobjectutilmanager.h
blobe8279e93ee1b220b934ec99e8107b0952530abed
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 "objectpersistence.h"
38 #include "devicedescriptorstruct.h"
39 #include <QtGlobal>
40 #include <QObject>
41 #include <QTimer>
42 #include <QMutex>
43 #include <QQueue>
44 #include <QComboBox>
45 #include <QDateTime>
46 #include <firmwareiapobj.h>
48 class UAVOBJECTUTIL_EXPORT UAVObjectUtilManager : public QObject {
49 Q_OBJECT
51 public:
52 UAVObjectUtilManager();
53 ~UAVObjectUtilManager();
55 int setHomeLocation(double LLA[3], bool save_to_sdcard);
56 int getHomeLocation(bool &set, double LLA[3]);
58 int getGPSPositionSensor(double LLA[3]);
60 int getBoardModel();
61 int getBootloaderRevision();
62 QByteArray getBoardCPUSerial();
63 quint32 getFirmwareCRC();
64 QByteArray getBoardDescription();
65 QString getBoardDescriptionString();
66 deviceDescriptorStruct getBoardDescriptionStruct();
67 static bool descriptionToStructure(QByteArray desc, deviceDescriptorStruct & struc);
68 UAVObjectManager *getObjectManager();
69 void saveObjectToSD(UAVObject *obj);
70 protected:
71 FirmwareIAPObj::DataFields getFirmwareIap();
73 signals:
74 void saveCompleted(int objectID, bool status);
76 private:
77 QMutex *mutex;
78 QQueue<UAVObject *> queue;
79 enum { IDLE, AWAITING_ACK, AWAITING_COMPLETED } saveState;
80 void saveNextObject();
81 QTimer failureTimer;
83 ExtensionSystem::PluginManager *pm;
84 UAVObjectManager *obm;
85 UAVObjectUtilManager *obum;
87 private slots:
88 // void transactionCompleted(UAVObject *obj, bool success);
89 void objectPersistenceTransactionCompleted(UAVObject *obj, bool success);
90 void objectPersistenceUpdated(UAVObject *obj);
91 void objectPersistenceOperationFailed();
95 #endif // ifndef UAVOBJECTUTILMANAGER_H