Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / ground / gcs / src / plugins / antennatrack / antennatrackgadgetconfiguration.h
blobf4819e1e3151dce8667ab1bffc5a6920dbb81c25
1 /**
2 ******************************************************************************
4 * @file AntennaTracgadgetconfiguration.h
5 * @author Sami Korhonen & the OpenPilot team Copyright (C) 2010.
6 * @addtogroup GCSPlugins GCS Plugins
7 * @{
8 * @addtogroup AntennaTrackGadgetPlugin Antenna Track Gadget Plugin
9 * @{
10 * @brief A gadget that communicates with antenna tracker 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 ANTENNATRACKGADGETCONFIGURATION_H
29 #define ANTENNATRACKGADGETCONFIGURATION_H
31 #include <coreplugin/iuavgadgetconfiguration.h>
33 #include <QtSerialPort/QSerialPort>
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 AntennaTrackGadgetConfiguration : public IUAVGadgetConfiguration {
50 Q_OBJECT
51 public:
52 explicit AntennaTrackGadgetConfiguration(QString classId, QSettings &settings, QObject *parent = 0);
53 explicit AntennaTrackGadgetConfiguration(const AntennaTrackGadgetConfiguration &obj);
55 IUAVGadgetConfiguration *clone() const;
56 void saveConfig(QSettings &settings) const;
58 void setConnectionMode(QString mode)
60 m_connectionMode = mode;
62 QString connectionMode()
64 return m_connectionMode;
66 // set port configuration functions
67 void setSpeed(QSerialPort::BaudRate speed)
69 m_defaultSpeed = speed;
71 void setDataBits(QSerialPort::DataBits databits)
73 m_defaultDataBits = databits;
75 void setFlow(QSerialPort::FlowControl flow)
77 m_defaultFlow = flow;
79 void setParity(QSerialPort::Parity parity)
81 m_defaultParity = parity;
83 void setStopBits(QSerialPort::StopBits stopbits)
85 m_defaultStopBits = stopbits;
87 void setPort(QString port)
89 m_defaultPort = port;
91 void setTimeOut(long timeout)
93 m_defaultTimeOut = timeout;
96 // get port configuration functions
97 QString port()
99 return m_defaultPort;
101 QSerialPort::BaudRate speed()
103 return m_defaultSpeed;
105 QSerialPort::FlowControl flow()
107 return m_defaultFlow;
109 QSerialPort::DataBits dataBits()
111 return m_defaultDataBits;
113 QSerialPort::StopBits stopBits()
115 return m_defaultStopBits;
117 QSerialPort::Parity parity()
119 return m_defaultParity;
121 long timeOut()
123 return m_defaultTimeOut;
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 // ANTENNATRACKGADGETCONFIGURATION_H