2 ******************************************************************************
4 * @file uploadergadgetconfiguration.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * @addtogroup GCSPlugins GCS Plugins
8 * @addtogroup YModemUploader YModem Serial Uploader Plugin
10 * @brief The YModem protocol serial uploader plugin
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
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 UPLOADERGADGETCONFIGURATION_H
29 #define UPLOADERGADGETCONFIGURATION_H
31 #include "uploader_global.h"
33 #include <coreplugin/iuavgadgetconfiguration.h>
35 #include <QtSerialPort/QSerialPort>
40 * structure to contain port settings
43 QSerialPort::BaudRate BaudRate
;
44 QSerialPort::DataBits DataBits
;
45 QSerialPort::Parity Parity
;
46 QSerialPort::StopBits StopBits
;
47 QSerialPort::FlowControl FlowControl
;
48 long Timeout_Millisec
;
51 class UPLOADER_EXPORT UploaderGadgetConfiguration
: public IUAVGadgetConfiguration
{
54 explicit UploaderGadgetConfiguration(QString classId
, QSettings
&settings
, QObject
*parent
= 0);
55 explicit UploaderGadgetConfiguration(const UploaderGadgetConfiguration
&obj
);
57 IUAVGadgetConfiguration
*clone() const;
58 void saveConfig(QSettings
&settings
) const;
60 // set port configuration functions
61 void setSpeed(QSerialPort::BaudRate speed
)
63 m_defaultSpeed
= speed
;
65 void setDataBits(QSerialPort::DataBits databits
)
67 m_defaultDataBits
= databits
;
69 void setFlow(QSerialPort::FlowControl flow
)
73 void setParity(QSerialPort::Parity parity
)
75 m_defaultParity
= parity
;
77 void setStopBits(QSerialPort::StopBits stopbits
)
79 m_defaultStopBits
= stopbits
;
81 void setPort(QString port
)
85 void setTimeOut(long timeout
)
87 m_defaultTimeOut
= timeout
;
90 // get port configuration functions
95 QSerialPort::BaudRate
speed()
97 return m_defaultSpeed
;
99 QSerialPort::FlowControl
flow()
101 return m_defaultFlow
;
103 QSerialPort::DataBits
dataBits()
105 return m_defaultDataBits
;
107 QSerialPort::StopBits
stopBits()
109 return m_defaultStopBits
;
111 QSerialPort::Parity
parity()
113 return m_defaultParity
;
117 return m_defaultTimeOut
;
121 QString m_defaultPort
;
122 QSerialPort::BaudRate m_defaultSpeed
;
123 QSerialPort::DataBits m_defaultDataBits
;
124 QSerialPort::FlowControl m_defaultFlow
;
125 QSerialPort::Parity m_defaultParity
;
126 QSerialPort::StopBits m_defaultStopBits
;
127 long m_defaultTimeOut
;
130 #endif // UPLOADERGADGETCONFIGURATION_H