dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
iboardtype.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  * Additional note on redistribution: The copyright and license notices above
29  * must be maintained in each individual source file that is a derivative work
30  * of this source file; otherwise redistribution is prohibited.
31  */
32 #ifndef IBOARDTYPE_H
33 #define IBOARDTYPE_H
34 
35 #include <QObject>
36 #include <QtCore/QStringList>
37 #include <QPixmap>
38 
39 #include "core_global.h"
40 
41 namespace Core {
42 
52 class CORE_EXPORT IBoardType : public QObject
53 {
54  Q_OBJECT
55 
56 public:
62  struct USBInfo
63  {
64  QString serialNumber;
65  QString manufacturer;
66  QString product;
67  int usagePage = 0;
68  int usage = 0;
69  int vendorID = 0;
70  int productID = 0;
71  int bcdDevice = 0;
72 
73  USBInfo(int vendorID, int productID, int bcdDevice)
74  {
75  this->vendorID = vendorID;
76  this->productID = productID;
77  this->bcdDevice = bcdDevice;
78  }
79  };
80 
84  virtual QString shortName() = 0;
85 
89  virtual QString boardDescription() = 0;
90 
100  };
101 
107  virtual bool queryCapabilities(BoardCapabilities capability) = 0;
108 
114  virtual QStringList queryChannelBanks();
115 
121  virtual QVector<QVector<int>> getChannelBanks() { return channelBanks; }
122 
131  virtual QPixmap getBoardPicture() = 0;
132 
137  virtual QString getHwUAVO() = 0;
138 
144  QList<int> getVendorIDs();
145 
147  int getBoardType() { return boardType; }
148 
150  virtual QWidget *getBoardConfiguration(QWidget * /*parent*/ = nullptr, bool /*connected*/ = true)
151  {
152  return NULL;
153  }
154 
155  /***** methods related to configuring specific boards *****/
156 
158  enum InputType {
171  INPUT_TYPE_ANY
172  };
173 
175  ANNUNCIATOR_HEARTBEAT = 1 << 0,
176  ANNUNCIATOR_ALARM = 1 << 1,
177  ANNUNCIATOR_BUZZER = 1 << 2,
178  ANNUNCIATOR_RGB = 1 << 3,
179  ANNUNCIATOR_DAC = 1 << 4,
180  };
181 
183  virtual int minBootLoaderVersion() { return 0; }
184 
186  virtual bool isInputConfigurationSupported(InputType type = INPUT_TYPE_ANY)
187  {
188  Q_UNUSED(type);
189  return false;
190  }
191 
197  virtual bool setInputType(InputType /*type*/) { return false; }
198 
203  virtual InputType getInputType() { return INPUT_TYPE_UNKNOWN; }
204 
209  virtual QString getConnectionDiagram() { return ""; }
210 
216  virtual int queryMaxGyroRate() { return -1; }
217 
227  enum LinkMode { LINK_TELEM, LINK_TELEM_PPM, LINK_PPM };
228 
233  virtual bool isUSBSupported() { return true; }
234 
235  static QString getBoardNameFromID(int id);
236 
237  virtual QStringList getAdcNames() { return QStringList(); }
238 
239  int getBankFromOutputChannel(int channel);
240 
245  QList<USBInfo> firmwareUSBInfo() { return m_firmwareUSBInfo; }
246 
251  QList<USBInfo> bootloaderUSBInfo() { return m_bootloaderUSBInfo; }
252 
258  virtual bool hasAnnunciator(AnnunciatorType annunc) { Q_UNUSED(annunc) return false; }
259 
266  virtual int onBoardRgbLeds() const { return 0; }
267 
268 signals:
269 
270 protected:
271  enum BcdDevice {
272  BCD_DEVICE_BOOTLOADER = 1,
273  BCD_DEVICE_FIRMWARE = 2,
274  BCD_DEVICE_UPGRADER = 3,
275  };
276 
277  void addFirmwareUSBInfo(USBInfo info) { m_firmwareUSBInfo.append(info); }
278  void addBootloaderUSBInfo(USBInfo info) { m_bootloaderUSBInfo.append(info); }
279 
282 
284  qint32 boardType;
285 
287  QVector<QVector<qint32>> channelBanks;
288 };
289 
290 } // namespace Core
291 
292 #endif // IBOARDTYPE_H
virtual int onBoardRgbLeds() const
Number of RGB LEDs located on the board The first n LEDs in the chain will apply to on-board LEDs rat...
Definition: iboardtype.h:266
qint32 boardType
The numerical board type ID.
Definition: iboardtype.h:284
virtual QStringList getAdcNames()
Definition: iboardtype.h:237
virtual QWidget * getBoardConfiguration(QWidget *=nullptr, bool=true)
Return a custom configuration widget, if one is provided.
Definition: iboardtype.h:150
InputType
Types of input to configure for the default port.
Definition: iboardtype.h:158
QList< USBInfo > m_firmwareUSBInfo
Definition: iboardtype.h:280
virtual QVector< QVector< int > > getChannelBanks()
Get banks of output PWM channels banks on the board.
Definition: iboardtype.h:121
QVector< QVector< qint32 > > channelBanks
The channel groups that are driven by timers.
Definition: iboardtype.h:287
virtual QString getConnectionDiagram()
getConnectionDiagram get the connection diagram for this board
Definition: iboardtype.h:209
BoardCapabilities
Types of capabilities boards can support.
Definition: iboardtype.h:92
QList< USBInfo > m_bootloaderUSBInfo
Definition: iboardtype.h:281
QList< USBInfo > bootloaderUSBInfo()
getBootloaderUSBInfo
Definition: iboardtype.h:251
virtual InputType getInputType()
getInputType get the current input type
Definition: iboardtype.h:203
int getBoardType()
Get the board type number.
Definition: iboardtype.h:147
virtual bool hasAnnunciator(AnnunciatorType annunc)
Check if the board has the given type of annunciator.
Definition: iboardtype.h:258
The USBInfo struct.
Definition: iboardtype.h:62
void addFirmwareUSBInfo(USBInfo info)
Definition: iboardtype.h:277
void addBootloaderUSBInfo(USBInfo info)
Definition: iboardtype.h:278
virtual int queryMaxGyroRate()
Query the board for the currently set max rate of the gyro.
Definition: iboardtype.h:216
virtual bool isInputConfigurationSupported(InputType type=INPUT_TYPE_ANY)
Determine if this board supports configuring the receiver.
Definition: iboardtype.h:186
virtual bool isUSBSupported()
Definition: iboardtype.h:233
virtual bool setInputType(InputType)
Configure the board to use an receiver input type on a port number.
Definition: iboardtype.h:197
virtual int minBootLoaderVersion()
Returns the minimum bootloader version required.
Definition: iboardtype.h:183
QList< USBInfo > firmwareUSBInfo()
getFirmwareUSBInfo
Definition: iboardtype.h:245
USBInfo(int vendorID, int productID, int bcdDevice)
Definition: iboardtype.h:73