dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
gcscontrolgadgetconfiguration.h
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 #ifndef GCSCONTROLGADGETCONFIGURATION_H
28 #define GCSCONTROLGADGETCONFIGURATION_H
29 
31 #include <QtNetwork/QHostAddress>
32 
33 typedef struct
34 {
35  int ActionID;
37  double Amount;
39 
40 typedef struct
41 {
42  int port;
43  QHostAddress address;
45 
46 using namespace Core;
47 
49 {
50  Q_OBJECT
51 public:
52  explicit GCSControlGadgetConfiguration(QString classId, QSettings *qSettings = nullptr,
53  QObject *parent = nullptr);
54 
55  void setControlsMode(int mode) { controlsMode = mode; }
56  void setRPYTchannels(int roll, int pitch, int yaw, int throttle);
57  int getControlsMode() { return controlsMode; }
58  QList<int> getChannelsMapping();
59  QList<bool> getChannelsReverse();
60 
61  buttonSettingsStruct getbuttonSettings(int i) { return buttonSettings[i]; }
62  void setbuttonSettingsAction(int i, int ActionID)
63  {
64  buttonSettings[i].ActionID = ActionID;
65  return;
66  }
67  void setbuttonSettingsFunction(int i, int FunctionID)
68  {
69  buttonSettings[i].FunctionID = FunctionID;
70  return;
71  }
72  void setbuttonSettingsAmount(int i, double Amount)
73  {
74  buttonSettings[i].Amount = Amount;
75  return;
76  }
77  void setChannelReverse(int i, bool Reverse)
78  {
79  channelReverse[i] = Reverse;
80  return;
81  }
82 
83  bool getGcsReceiverMode();
84  void setGcsReceiverMode(bool enable);
85 
86  void saveConfig(QSettings *settings) const;
88 
89 private:
91  bool gcsReceiverMode;
92 
94  int controlsMode;
95 
96  // Joystick mappings for roll/pitch/yaw/throttle:
97  int rollChannel;
98  int pitchChannel;
99  int yawChannel;
100  int throttleChannel;
101  buttonSettingsStruct buttonSettings[8];
102  bool channelReverse[8];
103 };
104 
105 #endif // GCSCONTROLGADGETCONFIGURATION_H
buttonSettingsStruct getbuttonSettings(int i)
void setChannelReverse(int i, bool Reverse)
void setbuttonSettingsFunction(int i, int FunctionID)
for i
Definition: OPPlots.m:140
void setbuttonSettingsAction(int i, int ActionID)
void setbuttonSettingsAmount(int i, double Amount)
UAVDataObject * clone(quint32 instID)