dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
devicedescriptorstruct.cpp
Go to the documentation of this file.
1 
12 /*
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  * for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  */
26 
27 #include "devicedescriptorstruct.h"
28 #include "uavobjectutilmanager.h"
29 #include <QList>
30 #include <QString>
31 #include <QDebug>
32 
34 {
35 }
36 
38 {
39  return ((boardType << 8) | boardRevision);
40 }
41 
44 {
45  ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
46  if (pm == NULL)
47  return "Unknown";
48 
49  QList<Core::IBoardType *> boards = pm->getObjects<Core::IBoardType>();
50  foreach (Core::IBoardType *board, boards) {
51  if (board->getBoardType() == (id >> 8))
52  return board->shortName();
53  }
54 
55  return "Unknown";
56 }
57 
59 {
60  qDebug() << "Getting board picture";
61  ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
62  if (pm == NULL)
63  return QPixmap();
64 
65  QList<Core::IBoardType *> boards = pm->getObjects<Core::IBoardType>();
66  foreach (Core::IBoardType *board, boards) {
67  if (board->getBoardType() == (id >> 8)) {
68  qDebug() << "Found board. " << board->getBoardPicture().isNull();
69  return board->getBoardPicture();
70  }
71  }
72 
73  qDebug() << "Not found";
74  return QPixmap();
75 }
Core plugin system that manages the plugins, their life cycle and their registered objects...
Definition: pluginmanager.h:53
static QPixmap idToBoardPicture(quint16 id)
int getBoardType()
Get the board type number.
Definition: iboardtype.h:147
static QString idToBoardName(quint16 id)
Get the name for a board via the plugin system.
virtual QPixmap getBoardPicture()=0
getBoardPicture
virtual QString shortName()=0