dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
uavobjectutilmanager.h
Go to the documentation of this file.
1 
14 /*
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful, but
21  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  * for more details.
24  *
25  * You should have received a copy of the GNU General Public License along
26  * with this program; if not, see <http://www.gnu.org/licenses/>
27  */
28 
29 #ifndef UAVOBJECTUTILMANAGER_H
30 #define UAVOBJECTUTILMANAGER_H
31 
32 #include "uavobjectutil_global.h"
33 
36 #include "uavobjects/uavobject.h"
37 #include "objectpersistence.h"
39 #include <coreplugin/iboardtype.h>
40 #include <QtGlobal>
41 #include <QObject>
42 #include <QTimer>
43 #include <QQueue>
44 #include <QComboBox>
45 #include <QDateTime>
46 #include <QErrorMessage>
47 #include <firmwareiapobj.h>
48 
49 class UAVOBJECTUTIL_EXPORT UAVObjectUtilManager : public QObject
50 {
51  Q_OBJECT
52 
53 public:
56 
57  enum metadataSetEnum { ALL_METADATA, SETTINGS_METADATA_ONLY, NONSETTINGS_METADATA_ONLY };
58 
59  int setHomeLocation(double LLA[3], bool save_to_sdcard);
60  int getHomeLocation(bool &set, double LLA[3]);
61 
62  int getGPSPosition(double LLA[3]);
63  int getBoardModel();
64  Core::IBoardType *getBoardType();
65  QByteArray getBoardCPUSerial();
66  quint32 getFirmwareCRC();
67  QByteArray getBoardDescription();
68  bool getBoardDescriptionStruct(deviceDescriptorStruct &device);
69  static bool descriptionToStructure(QByteArray desc, deviceDescriptorStruct &struc);
70  UAVObjectManager *getObjectManager();
71  void saveObjectToFlash(UAVObject *obj);
72  QMap<QString, UAVObject::Metadata> readMetadata(metadataSetEnum metadataReadType);
73  QMap<QString, UAVObject::Metadata> readAllNonSettingsMetadata();
74  bool setMetadata(QMap<QString, UAVObject::Metadata>, metadataSetEnum metadataUpdateType);
75  bool setAllNonSettingsMetadata(QMap<QString, UAVObject::Metadata>);
76  bool resetMetadataToDefaults();
77  int getBoardRevision();
78  QString getFirmwareHash();
79  QString getGcsHash();
80  bool boardConfigured();
81  bool firmwareHashMatchesGcs();
82 
83 protected:
84  FirmwareIAPObj::DataFields getFirmwareIap();
85 signals:
86  void saveCompleted(int objectID, bool status);
87  void completedMetadataWrite(bool);
88 
89 private:
90  QQueue<UAVObject *> queue;
91  enum { IDLE, AWAITING_ACK, AWAITING_COMPLETED } saveState;
92  void saveNextObject();
93  QTimer failureTimer;
95  UAVObjectManager *obm;
96  QMap<UAVDataObject *, UAVObject::Metadata> metadataSendlist;
97  bool metadataSendSuccess;
98 private slots:
99  void objectPersistenceTransactionCompleted(UAVObject *obj, bool success);
100  void objectPersistenceUpdated(UAVObject *obj);
101  void objectPersistenceOperationFailed();
102  void metadataTransactionCompleted(UAVObject *, bool);
103 };
104 
105 #endif
Core plugin system that manages the plugins, their life cycle and their registered objects...
Definition: pluginmanager.h:53
LLA
Definition: OPPlots.m:34