Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / ground / gcs / src / plugins / setupwizard / setupwizard.h
blob0e8226457bf9b29d4fb426dcd5f009d3feb68cbf
1 /**
2 ******************************************************************************
4 * @file setupwizard.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
6 * @addtogroup GCSPlugins GCS Plugins
7 * @{
8 * @addtogroup Setup Wizard Plugin
9 * @{
10 * @brief A Wizards to make the initial setup easy for everyone.
11 *****************************************************************************/
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.
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.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #ifndef SETUPWIZARD_H
29 #define SETUPWIZARD_H
31 #include <QWizard>
32 #include "biascalibrationutil.h"
33 #include <coreplugin/icore.h>
34 #include <coreplugin/connectionmanager.h>
35 #include "vehicleconfigurationsource.h"
36 #include "vehicleconfigurationhelper.h"
38 class SetupWizard : public QWizard, public VehicleConfigurationSource {
39 Q_OBJECT
41 public:
42 SetupWizard(QWidget *parent = 0);
43 ~SetupWizard();
44 int nextId() const;
46 void setControllerType(SetupWizard::CONTROLLER_TYPE type)
48 m_controllerType = type;
50 SetupWizard::CONTROLLER_TYPE getControllerType() const
52 return m_controllerType;
55 void setVehicleType(SetupWizard::VEHICLE_TYPE type)
57 m_vehicleType = type;
59 SetupWizard::VEHICLE_TYPE getVehicleType() const
61 return m_vehicleType;
64 void setVehicleSubType(SetupWizard::VEHICLE_SUB_TYPE type)
66 m_vehicleSubType = type;
68 SetupWizard::VEHICLE_SUB_TYPE getVehicleSubType() const
70 return m_vehicleSubType;
73 void setInputType(SetupWizard::INPUT_TYPE type)
75 m_inputType = type;
77 SetupWizard::INPUT_TYPE getInputType() const
79 return m_inputType;
82 void setEscType(SetupWizard::ESC_TYPE type)
84 m_escType = type;
86 SetupWizard::ESC_TYPE getEscType() const
88 return m_escType;
91 void setServoType(SetupWizard::SERVO_TYPE type)
93 m_servoType = type;
95 SetupWizard::SERVO_TYPE getServoType() const
97 return m_servoType;
100 void setAirspeedType(SetupWizard::AIRSPEED_TYPE setting)
102 m_airspeedType = setting;
104 SetupWizard::AIRSPEED_TYPE getAirspeedType() const
106 return m_airspeedType;
110 void setGpsType(SetupWizard::GPS_TYPE setting)
112 m_gpsType = setting;
114 SetupWizard::GPS_TYPE getGpsType() const
116 return m_gpsType;
119 void setRadioSetting(SetupWizard::RADIO_SETTING setting)
121 m_radioSetting = setting;
123 SetupWizard::RADIO_SETTING getRadioSetting() const
125 return m_radioSetting;
128 void setVehicleTemplate(QJsonObject *templ)
130 m_vehicleTemplate = templ;
132 QJsonObject *getVehicleTemplate() const
134 return m_vehicleTemplate;
137 void setLevellingBias(accelGyroBias bias)
139 m_calibrationBias = bias; m_calibrationPerformed = true;
141 bool isCalibrationPerformed() const
143 return m_calibrationPerformed;
145 accelGyroBias getCalibrationBias() const
147 return m_calibrationBias;
150 void setActuatorSettings(QList<actuatorChannelSettings> actuatorSettings)
152 m_actuatorSettings = actuatorSettings;
154 bool isMotorCalibrationPerformed() const
156 return m_motorCalibrationPerformed;
158 QList<actuatorChannelSettings> getActuatorSettings() const
160 return m_actuatorSettings;
163 void setRestartNeeded(bool needed)
165 m_restartNeeded = needed;
167 bool isRestartNeeded() const
169 return m_restartNeeded;
172 QString getSummaryText();
174 Core::ConnectionManager *getConnectionManager()
176 if (!m_connectionManager) {
177 m_connectionManager = Core::ICore::instance()->connectionManager();
178 Q_ASSERT(m_connectionManager);
180 return m_connectionManager;
182 void reboot() const;
184 private slots:
185 void customBackClicked();
186 void pageChanged(int currId);
187 private:
188 enum { PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING,
189 PAGE_AIRSPEED, PAGE_GPS, PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_ESC, PAGE_SERVO,
190 PAGE_BIAS_CALIBRATION, PAGE_ESC_CALIBRATION, PAGE_REVO_CALIBRATION, PAGE_OUTPUT_CALIBRATION,
191 PAGE_SAVE, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, PAGE_AIRFRAME_INITIAL_TUNING,
192 PAGE_REBOOT, PAGE_END, PAGE_UPDATE };
193 void createPages();
194 bool saveHardwareSettings() const;
195 bool canAutoUpdate() const;
197 CONTROLLER_TYPE m_controllerType;
198 VEHICLE_TYPE m_vehicleType;
199 VEHICLE_SUB_TYPE m_vehicleSubType;
200 INPUT_TYPE m_inputType;
201 ESC_TYPE m_escType;
202 SERVO_TYPE m_servoType;
203 AIRSPEED_TYPE m_airspeedType;
204 GPS_TYPE m_gpsType;
205 RADIO_SETTING m_radioSetting;
207 QJsonObject *m_vehicleTemplate;
209 bool m_calibrationPerformed;
210 accelGyroBias m_calibrationBias;
212 bool m_motorCalibrationPerformed;
213 QList<actuatorChannelSettings> m_actuatorSettings;
215 bool m_restartNeeded;
217 bool m_back;
219 Core::ConnectionManager *m_connectionManager;
222 #endif // SETUPWIZARD_H