2013-04-05 22:46:56 +02:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file gpsdisplaygadgetconfiguration.h
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @addtogroup GCSPlugins GCS Plugins
|
|
|
|
* @{
|
|
|
|
* @addtogroup GPSGadgetPlugin GPS Gadget Plugin
|
|
|
|
* @{
|
2013-05-19 16:37:30 +02:00
|
|
|
* @brief A gadget that displays GPS status and enables basic configuration
|
2013-04-05 22:46:56 +02:00
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GPSDISPLAYGADGETCONFIGURATION_H
|
|
|
|
#define GPSDISPLAYGADGETCONFIGURATION_H
|
|
|
|
|
|
|
|
#include <coreplugin/iuavgadgetconfiguration.h>
|
2013-09-15 23:06:25 +02:00
|
|
|
#include <QtSerialPort/QSerialPort>
|
|
|
|
#include <QtSerialPort/QSerialPortInfo>
|
2013-04-05 22:46:56 +02:00
|
|
|
|
|
|
|
using namespace Core;
|
|
|
|
|
2013-09-15 23:06:25 +02:00
|
|
|
/**
|
|
|
|
* structure to contain port settings
|
|
|
|
*/
|
|
|
|
struct PortSettings {
|
|
|
|
QSerialPort::BaudRate BaudRate;
|
|
|
|
QSerialPort::DataBits DataBits;
|
|
|
|
QSerialPort::Parity Parity;
|
|
|
|
QSerialPort::StopBits StopBits;
|
|
|
|
QSerialPort::FlowControl FlowControl;
|
|
|
|
long Timeout_Millisec;
|
|
|
|
};
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
class GpsDisplayGadgetConfiguration : public IUAVGadgetConfiguration {
|
2013-04-05 22:46:56 +02:00
|
|
|
Q_OBJECT
|
2013-05-19 16:37:30 +02:00
|
|
|
public:
|
|
|
|
explicit GpsDisplayGadgetConfiguration(QString classId, QSettings *qSettings = 0, QObject *parent = 0);
|
2013-04-05 22:46:56 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
void setConnectionMode(QString mode)
|
|
|
|
{
|
|
|
|
m_connectionMode = mode;
|
|
|
|
}
|
|
|
|
QString connectionMode()
|
|
|
|
{
|
|
|
|
return m_connectionMode;
|
|
|
|
}
|
2013-04-05 22:46:56 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// set port configuration functions
|
2013-09-15 23:06:25 +02:00
|
|
|
void setSpeed(QSerialPort::BaudRate speed)
|
2013-05-19 16:37:30 +02:00
|
|
|
{
|
|
|
|
m_defaultSpeed = speed;
|
|
|
|
}
|
2013-09-15 23:06:25 +02:00
|
|
|
void setDataBits(QSerialPort::DataBits databits)
|
2013-05-19 16:37:30 +02:00
|
|
|
{
|
|
|
|
m_defaultDataBits = databits;
|
|
|
|
}
|
2013-09-15 23:06:25 +02:00
|
|
|
void setFlow(QSerialPort::FlowControl flow)
|
2013-05-19 16:37:30 +02:00
|
|
|
{
|
|
|
|
m_defaultFlow = flow;
|
|
|
|
}
|
2013-09-15 23:06:25 +02:00
|
|
|
void setParity(QSerialPort::Parity parity)
|
2013-05-19 16:37:30 +02:00
|
|
|
{
|
|
|
|
m_defaultParity = parity;
|
|
|
|
}
|
2013-09-15 23:06:25 +02:00
|
|
|
void setStopBits(QSerialPort::StopBits stopbits)
|
2013-05-19 16:37:30 +02:00
|
|
|
{
|
|
|
|
m_defaultStopBits = stopbits;
|
|
|
|
}
|
|
|
|
void setPort(QString port)
|
|
|
|
{
|
|
|
|
m_defaultPort = port;
|
|
|
|
}
|
|
|
|
void setTimeOut(long timeout)
|
|
|
|
{
|
|
|
|
m_defaultTimeOut = timeout;
|
|
|
|
}
|
2013-04-05 22:46:56 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
// get port configuration functions
|
|
|
|
QString port()
|
|
|
|
{
|
|
|
|
return m_defaultPort;
|
|
|
|
}
|
2013-09-15 23:06:25 +02:00
|
|
|
QSerialPort::BaudRate speed()
|
2013-05-19 16:37:30 +02:00
|
|
|
{
|
|
|
|
return m_defaultSpeed;
|
|
|
|
}
|
2013-09-15 23:06:25 +02:00
|
|
|
QSerialPort::FlowControl flow()
|
2013-05-19 16:37:30 +02:00
|
|
|
{
|
|
|
|
return m_defaultFlow;
|
|
|
|
}
|
2013-09-15 23:06:25 +02:00
|
|
|
QSerialPort::DataBits dataBits()
|
2013-05-19 16:37:30 +02:00
|
|
|
{
|
|
|
|
return m_defaultDataBits;
|
|
|
|
}
|
2013-09-15 23:06:25 +02:00
|
|
|
QSerialPort::StopBits stopBits()
|
2013-05-19 16:37:30 +02:00
|
|
|
{
|
|
|
|
return m_defaultStopBits;
|
|
|
|
}
|
2013-09-15 23:06:25 +02:00
|
|
|
QSerialPort::Parity parity()
|
2013-05-19 16:37:30 +02:00
|
|
|
{
|
|
|
|
return m_defaultParity;
|
|
|
|
}
|
|
|
|
long timeOut()
|
|
|
|
{
|
|
|
|
return m_defaultTimeOut;
|
|
|
|
}
|
2013-04-05 22:46:56 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
void saveConfig(QSettings *settings) const;
|
|
|
|
IUAVGadgetConfiguration *clone();
|
2013-04-05 22:46:56 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
private:
|
|
|
|
QString m_connectionMode;
|
|
|
|
QString m_defaultPort;
|
2013-09-15 23:06:25 +02:00
|
|
|
QSerialPort::BaudRate m_defaultSpeed;
|
|
|
|
QSerialPort::DataBits m_defaultDataBits;
|
|
|
|
QSerialPort::FlowControl m_defaultFlow;
|
|
|
|
QSerialPort::Parity m_defaultParity;
|
|
|
|
QSerialPort::StopBits m_defaultStopBits;
|
2013-05-19 16:37:30 +02:00
|
|
|
long m_defaultTimeOut;
|
2013-04-05 22:46:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GPSDISPLAYGADGETCONFIGURATION_H
|