mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
LP-419 config: apply camel case to IPConnection classes
This commit is contained in:
parent
bba67f27d6
commit
2c14920ab0
@ -3,7 +3,7 @@ TARGET = IPconnection
|
||||
|
||||
QT += network widgets
|
||||
|
||||
DEFINES += IPconnection_LIBRARY
|
||||
DEFINES += IPCONNECTION_LIBRARY
|
||||
|
||||
include(../../plugin.pri)
|
||||
include(ipconnection_dependencies.pri)
|
||||
|
@ -8,7 +8,7 @@
|
||||
* @{
|
||||
* @addtogroup IPConnPlugin IP Telemetry Plugin
|
||||
* @{
|
||||
* @brief IP Connection Plugin impliment telemetry over TCP/IP and UDP/IP
|
||||
* @brief IP Connection Plugin implements telemetry over TCP/IP and UDP/IP
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -31,10 +31,10 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(IPconnection_LIBRARY)
|
||||
# define IPconnection_EXPORT Q_DECL_EXPORT
|
||||
#if defined(IPCONNECTION_LIBRARY)
|
||||
# define IPCONNECTION_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define IPconnection_EXPORT Q_DECL_IMPORT
|
||||
# define IPCONNECTION_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif // IPCONNECTION_GLOBAL_H
|
||||
|
@ -9,12 +9,9 @@ class IPConnection : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
IPConnection(IPconnectionConnection *connection);
|
||||
// virtual ~IPConnection();
|
||||
IPConnection(IPConnectionConnection *connection);
|
||||
|
||||
public slots:
|
||||
|
||||
void onOpenDevice(QString HostName, int Port, bool UseTCP);
|
||||
void onCloseDevice(QAbstractSocket *ipSocket);
|
||||
};
|
||||
|
@ -8,7 +8,7 @@
|
||||
* @{
|
||||
* @addtogroup IPConnPlugin IP Telemetry Plugin
|
||||
* @{
|
||||
* @brief IP Connection Plugin impliment telemetry over TCP/IP and UDP/IP
|
||||
* @brief IP Connection Plugin implements telemetry over TCP/IP and UDP/IP
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
IPconnectionConfiguration::IPconnectionConfiguration(QString classId, QSettings &settings, QObject *parent) :
|
||||
IPConnectionConfiguration::IPConnectionConfiguration(QString classId, QSettings &settings, QObject *parent) :
|
||||
IUAVGadgetConfiguration(classId, parent)
|
||||
{
|
||||
m_hostName = settings.value("HostName", "").toString();
|
||||
@ -38,7 +38,7 @@ IPconnectionConfiguration::IPconnectionConfiguration(QString classId, QSettings
|
||||
m_useTCP = settings.value("UseTCP", true).toInt();
|
||||
}
|
||||
|
||||
IPconnectionConfiguration::IPconnectionConfiguration(const IPconnectionConfiguration &obj) :
|
||||
IPConnectionConfiguration::IPConnectionConfiguration(const IPConnectionConfiguration &obj) :
|
||||
IUAVGadgetConfiguration(obj.classId(), obj.parent())
|
||||
{
|
||||
m_hostName = obj.m_hostName;
|
||||
@ -46,19 +46,19 @@ IPconnectionConfiguration::IPconnectionConfiguration(const IPconnectionConfigura
|
||||
m_useTCP = obj.m_useTCP;
|
||||
}
|
||||
|
||||
IPconnectionConfiguration::~IPconnectionConfiguration()
|
||||
IPConnectionConfiguration::~IPConnectionConfiguration()
|
||||
{}
|
||||
|
||||
IUAVGadgetConfiguration *IPconnectionConfiguration::clone() const
|
||||
IUAVGadgetConfiguration *IPConnectionConfiguration::clone() const
|
||||
{
|
||||
return new IPconnectionConfiguration(*this);
|
||||
return new IPConnectionConfiguration(*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a configuration.
|
||||
*
|
||||
*/
|
||||
void IPconnectionConfiguration::saveConfig(QSettings &settings) const
|
||||
void IPConnectionConfiguration::saveConfig(QSettings &settings) const
|
||||
{
|
||||
settings.setValue("HostName", m_hostName);
|
||||
settings.setValue("Port", m_port);
|
||||
|
@ -8,7 +8,7 @@
|
||||
* @{
|
||||
* @addtogroup IPConnPlugin IP Telemetry Plugin
|
||||
* @{
|
||||
* @brief IP Connection Plugin impliment telemetry over TCP/IP and UDP/IP
|
||||
* @brief IP Connection Plugin implements telemetry over TCP/IP and UDP/IP
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -35,16 +35,16 @@
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class IPconnectionConfiguration : public IUAVGadgetConfiguration {
|
||||
class IPConnectionConfiguration : public IUAVGadgetConfiguration {
|
||||
Q_OBJECT Q_PROPERTY(QString HostName READ hostName WRITE setHostName)
|
||||
Q_PROPERTY(int Port READ port WRITE setPort)
|
||||
Q_PROPERTY(int UseTCP READ useTCP WRITE setUseTCP)
|
||||
|
||||
public:
|
||||
explicit IPconnectionConfiguration(QString classId, QSettings &settings, QObject *parent = 0);
|
||||
explicit IPconnectionConfiguration(const IPconnectionConfiguration &obj);
|
||||
explicit IPConnectionConfiguration(QString classId, QSettings &settings, QObject *parent = 0);
|
||||
explicit IPConnectionConfiguration(const IPConnectionConfiguration &obj);
|
||||
|
||||
virtual ~IPconnectionConfiguration();
|
||||
virtual ~IPConnectionConfiguration();
|
||||
|
||||
IUAVGadgetConfiguration *clone() const;
|
||||
void saveConfig(QSettings &settings) const;
|
||||
|
@ -8,7 +8,7 @@
|
||||
* @{
|
||||
* @addtogroup IPConnPlugin IP Telemetry Plugin
|
||||
* @{
|
||||
* @brief IP Connection Plugin impliment telemetry over TCP/IP and UDP/IP
|
||||
* @brief IP Connection Plugin implements telemetry over TCP/IP and UDP/IP
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -32,14 +32,14 @@
|
||||
|
||||
#include "ipconnectionconfiguration.h"
|
||||
|
||||
IPconnectionOptionsPage::IPconnectionOptionsPage(IPconnectionConfiguration *config, QObject *parent) :
|
||||
IOptionsPage(parent), m_config(config), m_page(0)
|
||||
IPConnectionOptionsPage::IPConnectionOptionsPage(IPConnectionConfiguration *config, QObject *parent) :
|
||||
IOptionsPage(parent), m_page(0), m_config(config)
|
||||
{}
|
||||
|
||||
IPconnectionOptionsPage::~IPconnectionOptionsPage()
|
||||
IPConnectionOptionsPage::~IPConnectionOptionsPage()
|
||||
{}
|
||||
|
||||
QWidget *IPconnectionOptionsPage::createPage(QWidget *parent)
|
||||
QWidget *IPConnectionOptionsPage::createPage(QWidget *parent)
|
||||
{
|
||||
m_page = new Ui::IPconnectionOptionsPage();
|
||||
QWidget *w = new QWidget(parent);
|
||||
@ -53,7 +53,7 @@ QWidget *IPconnectionOptionsPage::createPage(QWidget *parent)
|
||||
return w;
|
||||
}
|
||||
|
||||
void IPconnectionOptionsPage::apply()
|
||||
void IPConnectionOptionsPage::apply()
|
||||
{
|
||||
m_config->setPort(m_page->Port->value());
|
||||
m_config->setHostName(m_page->HostName->text());
|
||||
@ -64,7 +64,7 @@ void IPconnectionOptionsPage::apply()
|
||||
emit availableDevChanged();
|
||||
}
|
||||
|
||||
void IPconnectionOptionsPage::finish()
|
||||
void IPConnectionOptionsPage::finish()
|
||||
{
|
||||
delete m_page;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
* @{
|
||||
* @addtogroup IPConnPlugin IP Telemetry Plugin
|
||||
* @{
|
||||
* @brief IP Connection Plugin impliment telemetry over TCP/IP and UDP/IP
|
||||
* @brief IP Connection Plugin implements telemetry over TCP/IP and UDP/IP
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include "coreplugin/dialogs/ioptionspage.h"
|
||||
|
||||
class IPconnectionConfiguration;
|
||||
class IPConnectionConfiguration;
|
||||
|
||||
namespace Ui {
|
||||
class IPconnectionOptionsPage;
|
||||
@ -39,11 +39,11 @@ class IPconnectionOptionsPage;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
class IPconnectionOptionsPage : public IOptionsPage {
|
||||
class IPConnectionOptionsPage : public IOptionsPage {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit IPconnectionOptionsPage(IPconnectionConfiguration *config, QObject *parent = 0);
|
||||
virtual ~IPconnectionOptionsPage();
|
||||
explicit IPConnectionOptionsPage(IPConnectionConfiguration *config, QObject *parent = 0);
|
||||
virtual ~IPConnectionOptionsPage();
|
||||
|
||||
QString id() const
|
||||
{
|
||||
@ -70,8 +70,8 @@ signals:
|
||||
void availableDevChanged();
|
||||
|
||||
private:
|
||||
IPconnectionConfiguration *m_config;
|
||||
Ui::IPconnectionOptionsPage *m_page;
|
||||
IPConnectionConfiguration *m_config;
|
||||
};
|
||||
|
||||
#endif // IPCONNECTIONOPTIONSPAGE_H
|
||||
|
@ -8,7 +8,7 @@
|
||||
* @{
|
||||
* @addtogroup IPConnPlugin IP Telemetry Plugin
|
||||
* @{
|
||||
* @brief IP Connection Plugin impliment telemetry over TCP/IP and UDP/IP
|
||||
* @brief IP Connection Plugin implements telemetry over TCP/IP and UDP/IP
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -30,13 +30,12 @@
|
||||
|
||||
#include "ipconnectionplugin.h"
|
||||
|
||||
#include "ipconnection_internal.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include "ipconnection_internal.h"
|
||||
#include <coreplugin/threadmanager.h>
|
||||
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QMainWindow>
|
||||
#include <QMessageBox>
|
||||
#include <QtNetwork/QAbstractSocket>
|
||||
@ -44,10 +43,9 @@
|
||||
#include <QtNetwork/QUdpSocket>
|
||||
#include <QWaitCondition>
|
||||
#include <QMutex>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
// Communication between IPconnectionConnection::OpenDevice() and IPConnection::onOpenDevice()
|
||||
// Communication between IPConnectionConnection::OpenDevice() and IPConnection::onOpenDevice()
|
||||
QString errorMsg;
|
||||
QWaitCondition openDeviceWait;
|
||||
QWaitCondition closeDeviceWait;
|
||||
@ -55,7 +53,7 @@ QWaitCondition closeDeviceWait;
|
||||
QMutex ipConMutex;
|
||||
QAbstractSocket *ret;
|
||||
|
||||
IPConnection::IPConnection(IPconnectionConnection *connection) : QObject()
|
||||
IPConnection::IPConnection(IPConnectionConnection *connection) : QObject()
|
||||
{
|
||||
moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread());
|
||||
|
||||
@ -118,11 +116,11 @@ void IPConnection::onCloseDevice(QAbstractSocket *ipSocket)
|
||||
|
||||
IPConnection *connection = 0;
|
||||
|
||||
IPconnectionConnection::IPconnectionConnection(IPconnectionConfiguration *config) : m_config(config)
|
||||
IPConnectionConnection::IPConnectionConnection(IPConnectionConfiguration *config) : m_config(config)
|
||||
{
|
||||
m_ipSocket = NULL;
|
||||
|
||||
m_optionsPage = new IPconnectionOptionsPage(m_config, this);
|
||||
m_optionsPage = new IPConnectionOptionsPage(m_config, this);
|
||||
|
||||
if (!connection) {
|
||||
connection = new IPConnection(this);
|
||||
@ -134,7 +132,7 @@ IPconnectionConnection::IPconnectionConnection(IPconnectionConfiguration *config
|
||||
QObject::connect(m_optionsPage, SIGNAL(availableDevChanged()), this, SLOT(onEnumerationChanged()));
|
||||
}
|
||||
|
||||
IPconnectionConnection::~IPconnectionConnection()
|
||||
IPConnectionConnection::~IPConnectionConnection()
|
||||
{
|
||||
// clean up out resources...
|
||||
if (m_ipSocket) {
|
||||
@ -148,12 +146,12 @@ IPconnectionConnection::~IPconnectionConnection()
|
||||
}
|
||||
}
|
||||
|
||||
void IPconnectionConnection::onEnumerationChanged()
|
||||
void IPConnectionConnection::onEnumerationChanged()
|
||||
{
|
||||
emit availableDevChanged(this);
|
||||
}
|
||||
|
||||
QList <Core::IConnection::device> IPconnectionConnection::availableDevices()
|
||||
QList <Core::IConnection::device> IPConnectionConnection::availableDevices()
|
||||
{
|
||||
QList <Core::IConnection::device> list;
|
||||
device d;
|
||||
@ -169,7 +167,7 @@ QList <Core::IConnection::device> IPconnectionConnection::availableDevices()
|
||||
return list;
|
||||
}
|
||||
|
||||
QIODevice *IPconnectionConnection::openDevice(const QString &)
|
||||
QIODevice *IPConnectionConnection::openDevice(const QString &)
|
||||
{
|
||||
QString hostName;
|
||||
int port;
|
||||
@ -202,7 +200,7 @@ QIODevice *IPconnectionConnection::openDevice(const QString &)
|
||||
return m_ipSocket;
|
||||
}
|
||||
|
||||
void IPconnectionConnection::closeDevice(const QString &)
|
||||
void IPConnectionConnection::closeDevice(const QString &)
|
||||
{
|
||||
if (m_ipSocket) {
|
||||
ipConMutex.lock();
|
||||
@ -214,12 +212,12 @@ void IPconnectionConnection::closeDevice(const QString &)
|
||||
}
|
||||
|
||||
|
||||
QString IPconnectionConnection::connectionName()
|
||||
QString IPConnectionConnection::connectionName()
|
||||
{
|
||||
return QString("Network telemetry port");
|
||||
}
|
||||
|
||||
QString IPconnectionConnection::shortName()
|
||||
QString IPConnectionConnection::shortName()
|
||||
{
|
||||
if (m_config->useTCP()) {
|
||||
return QString("TCP");
|
||||
@ -229,25 +227,24 @@ QString IPconnectionConnection::shortName()
|
||||
}
|
||||
|
||||
|
||||
IPconnectionPlugin::IPconnectionPlugin() : m_connection(0), m_config(0)
|
||||
IPConnectionPlugin::IPConnectionPlugin() : m_connection(0), m_config(0)
|
||||
{}
|
||||
|
||||
IPconnectionPlugin::~IPconnectionPlugin()
|
||||
IPConnectionPlugin::~IPConnectionPlugin()
|
||||
{
|
||||
// manually remove the options page object
|
||||
removeObject(m_connection->optionsPage());
|
||||
}
|
||||
|
||||
bool IPconnectionPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||
bool IPConnectionPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||
{
|
||||
Q_UNUSED(arguments);
|
||||
Q_UNUSED(errorString);
|
||||
|
||||
qDebug() << "*** INIT";
|
||||
|
||||
Core::ICore::instance()->readSettings(this);
|
||||
|
||||
m_connection = new IPconnectionConnection(m_config);
|
||||
m_connection = new IPConnectionConnection(m_config);
|
||||
|
||||
// must manage this registration of child object ourselves
|
||||
// if we use an autorelease here it causes the GCS to crash
|
||||
// as it is deleting objects as the app closes...
|
||||
@ -255,26 +252,26 @@ bool IPconnectionPlugin::initialize(const QStringList &arguments, QString *error
|
||||
|
||||
// FIXME this is really a contrived way to save the settings...
|
||||
// needs to be done centrally from
|
||||
QObject::connect(m_connection, &IPconnectionConnection::availableDevChanged,
|
||||
QObject::connect(m_connection, &IPConnectionConnection::availableDevChanged,
|
||||
[this]() { Core::ICore::instance()->saveSettings(this); }
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void IPconnectionPlugin::extensionsInitialized()
|
||||
void IPConnectionPlugin::extensionsInitialized()
|
||||
{
|
||||
addAutoReleasedObject(m_connection);
|
||||
}
|
||||
|
||||
void IPconnectionPlugin::readConfig(QSettings &settings, Core::UAVConfigInfo *configInfo)
|
||||
void IPConnectionPlugin::readConfig(QSettings &settings, Core::UAVConfigInfo *configInfo)
|
||||
{
|
||||
Q_UNUSED(configInfo);
|
||||
|
||||
m_config = new IPconnectionConfiguration("IPConnection", settings, this);
|
||||
m_config = new IPConnectionConfiguration("IPConnection", settings, this);
|
||||
}
|
||||
|
||||
void IPconnectionPlugin::saveConfig(QSettings &settings, Core::UAVConfigInfo *configInfo) const
|
||||
void IPConnectionPlugin::saveConfig(QSettings &settings, Core::UAVConfigInfo *configInfo) const
|
||||
{
|
||||
Q_UNUSED(configInfo);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
* @{
|
||||
* @addtogroup IPConnPlugin IP Telemetry Plugin
|
||||
* @{
|
||||
* @brief IP Connection Plugin impliment telemetry over TCP/IP and UDP/IP
|
||||
* @brief IP Connection Plugin implements telemetry over TCP/IP and UDP/IP
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -48,12 +48,12 @@ class IConnection;
|
||||
* Plugin will add a instance of this class to the pool,
|
||||
* so the connection manager can use it.
|
||||
*/
|
||||
class IPconnection_EXPORT IPconnectionConnection : public Core::IConnection {
|
||||
class IPCONNECTION_EXPORT IPConnectionConnection : public Core::IConnection {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IPconnectionConnection(IPconnectionConfiguration *config);
|
||||
virtual ~IPconnectionConnection();
|
||||
IPConnectionConnection(IPConnectionConfiguration *config);
|
||||
virtual ~IPConnectionConnection();
|
||||
|
||||
virtual QList <Core::IConnection::device> availableDevices();
|
||||
virtual QIODevice *openDevice(const QString &deviceName);
|
||||
@ -62,7 +62,7 @@ public:
|
||||
virtual QString connectionName();
|
||||
virtual QString shortName();
|
||||
|
||||
IPconnectionOptionsPage *optionsPage() const
|
||||
IPConnectionOptionsPage *optionsPage() const
|
||||
{
|
||||
return m_optionsPage;
|
||||
}
|
||||
@ -79,26 +79,27 @@ signals:
|
||||
private:
|
||||
QAbstractSocket *m_ipSocket;
|
||||
// FIXME m_config and m_optionsPage belong in IPConnectionPlugin
|
||||
IPconnectionConfiguration *m_config;
|
||||
IPconnectionOptionsPage *m_optionsPage;
|
||||
IPConnectionConfiguration *m_config;
|
||||
IPConnectionOptionsPage *m_optionsPage;
|
||||
};
|
||||
|
||||
class IPconnection_EXPORT IPconnectionPlugin : public Core::IConfigurablePlugin {
|
||||
class IPCONNECTION_EXPORT IPConnectionPlugin : public Core::IConfigurablePlugin {
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "OpenPilot.IPconnection")
|
||||
Q_PLUGIN_METADATA(IID "OpenPilot.IPConnection")
|
||||
|
||||
public:
|
||||
IPconnectionPlugin();
|
||||
~IPconnectionPlugin();
|
||||
IPConnectionPlugin();
|
||||
~IPConnectionPlugin();
|
||||
|
||||
virtual bool initialize(const QStringList &arguments, QString *error_message);
|
||||
virtual void extensionsInitialized();
|
||||
|
||||
void readConfig(QSettings &settings, Core::UAVConfigInfo *configInfo);
|
||||
void saveConfig(QSettings &settings, Core::UAVConfigInfo *configInfo) const;
|
||||
|
||||
private:
|
||||
IPconnectionConnection *m_connection;
|
||||
IPconnectionConfiguration *m_config;
|
||||
IPConnectionConnection *m_connection;
|
||||
IPConnectionConfiguration *m_config;
|
||||
};
|
||||
|
||||
#endif // IPCONNECTIONPLUGIN_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user