LP-56 - Better txpid option namings, fix tabs-spaces, tooltips. headers, variable...
[librepilot.git] / ground / openpilotgcs / src / plugins / gpsdisplay / gpsdisplaygadgetconfiguration.h
bloba78669ef8fc3e64737e134410bac407d8274c5e1
1 /**
2 ******************************************************************************
4 * @file gpsdisplaygadgetconfiguration.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * @addtogroup GCSPlugins GCS Plugins
7 * @{
8 * @addtogroup GPSGadgetPlugin GPS Gadget Plugin
9 * @{
10 * @brief A gadget that displays GPS status and enables basic configuration
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 GPSDISPLAYGADGETCONFIGURATION_H
29 #define GPSDISPLAYGADGETCONFIGURATION_H
31 #include <coreplugin/iuavgadgetconfiguration.h>
32 #include <QtSerialPort/QSerialPort>
33 #include <QtSerialPort/QSerialPortInfo>
35 using namespace Core;
37 /**
38 * structure to contain port settings
40 struct PortSettings {
41 QSerialPort::BaudRate BaudRate;
42 QSerialPort::DataBits DataBits;
43 QSerialPort::Parity Parity;
44 QSerialPort::StopBits StopBits;
45 QSerialPort::FlowControl FlowControl;
46 long Timeout_Millisec;
49 class GpsDisplayGadgetConfiguration : public IUAVGadgetConfiguration {
50 Q_OBJECT
51 public:
52 explicit GpsDisplayGadgetConfiguration(QString classId, QSettings *qSettings = 0, QObject *parent = 0);
54 void setConnectionMode(QString mode)
56 m_connectionMode = mode;
58 QString connectionMode()
60 return m_connectionMode;
63 // set port configuration functions
64 void setSpeed(QSerialPort::BaudRate speed)
66 m_defaultSpeed = speed;
68 void setDataBits(QSerialPort::DataBits databits)
70 m_defaultDataBits = databits;
72 void setFlow(QSerialPort::FlowControl flow)
74 m_defaultFlow = flow;
76 void setParity(QSerialPort::Parity parity)
78 m_defaultParity = parity;
80 void setStopBits(QSerialPort::StopBits stopbits)
82 m_defaultStopBits = stopbits;
84 void setPort(QString port)
86 m_defaultPort = port;
88 void setTimeOut(long timeout)
90 m_defaultTimeOut = timeout;
93 // get port configuration functions
94 QString port()
96 return m_defaultPort;
98 QSerialPort::BaudRate speed()
100 return m_defaultSpeed;
102 QSerialPort::FlowControl flow()
104 return m_defaultFlow;
106 QSerialPort::DataBits dataBits()
108 return m_defaultDataBits;
110 QSerialPort::StopBits stopBits()
112 return m_defaultStopBits;
114 QSerialPort::Parity parity()
116 return m_defaultParity;
118 long timeOut()
120 return m_defaultTimeOut;
123 void saveConfig(QSettings *settings) const;
124 IUAVGadgetConfiguration *clone();
126 private:
127 QString m_connectionMode;
128 QString m_defaultPort;
129 QSerialPort::BaudRate m_defaultSpeed;
130 QSerialPort::DataBits m_defaultDataBits;
131 QSerialPort::FlowControl m_defaultFlow;
132 QSerialPort::Parity m_defaultParity;
133 QSerialPort::StopBits m_defaultStopBits;
134 long m_defaultTimeOut;
137 #endif // GPSDISPLAYGADGETCONFIGURATION_H