diff --git a/ground/gcs/src/plugins/ipconnection/ipconnection.pro b/ground/gcs/src/plugins/ipconnection/ipconnection.pro index 4dbc3047c..184963831 100644 --- a/ground/gcs/src/plugins/ipconnection/ipconnection.pro +++ b/ground/gcs/src/plugins/ipconnection/ipconnection.pro @@ -3,7 +3,7 @@ TARGET = IPconnection QT += network widgets -DEFINES += IPconnection_LIBRARY +DEFINES += IPCONNECTION_LIBRARY include(../../plugin.pri) include(ipconnection_dependencies.pri) diff --git a/ground/gcs/src/plugins/ipconnection/ipconnection_global.h b/ground/gcs/src/plugins/ipconnection/ipconnection_global.h index 9fdbb78a9..15770bf3a 100644 --- a/ground/gcs/src/plugins/ipconnection/ipconnection_global.h +++ b/ground/gcs/src/plugins/ipconnection/ipconnection_global.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 @@ -31,10 +31,10 @@ #include -#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 diff --git a/ground/gcs/src/plugins/ipconnection/ipconnection_internal.h b/ground/gcs/src/plugins/ipconnection/ipconnection_internal.h index b7c2f3992..3f7b3958d 100644 --- a/ground/gcs/src/plugins/ipconnection/ipconnection_internal.h +++ b/ground/gcs/src/plugins/ipconnection/ipconnection_internal.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); }; diff --git a/ground/gcs/src/plugins/ipconnection/ipconnectionconfiguration.cpp b/ground/gcs/src/plugins/ipconnection/ipconnectionconfiguration.cpp index 4a65fe3e7..e5b9deddb 100644 --- a/ground/gcs/src/plugins/ipconnection/ipconnectionconfiguration.cpp +++ b/ground/gcs/src/plugins/ipconnection/ipconnectionconfiguration.cpp @@ -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 -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); diff --git a/ground/gcs/src/plugins/ipconnection/ipconnectionconfiguration.h b/ground/gcs/src/plugins/ipconnection/ipconnectionconfiguration.h index 634a35f1b..7893d69f1 100644 --- a/ground/gcs/src/plugins/ipconnection/ipconnectionconfiguration.h +++ b/ground/gcs/src/plugins/ipconnection/ipconnectionconfiguration.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 @@ -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; diff --git a/ground/gcs/src/plugins/ipconnection/ipconnectionoptionspage.cpp b/ground/gcs/src/plugins/ipconnection/ipconnectionoptionspage.cpp index 89c58e9d8..47558cd6d 100644 --- a/ground/gcs/src/plugins/ipconnection/ipconnectionoptionspage.cpp +++ b/ground/gcs/src/plugins/ipconnection/ipconnectionoptionspage.cpp @@ -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; } diff --git a/ground/gcs/src/plugins/ipconnection/ipconnectionoptionspage.h b/ground/gcs/src/plugins/ipconnection/ipconnectionoptionspage.h index 72b10a25a..7ce18ad0d 100644 --- a/ground/gcs/src/plugins/ipconnection/ipconnectionoptionspage.h +++ b/ground/gcs/src/plugins/ipconnection/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 @@ -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 diff --git a/ground/gcs/src/plugins/ipconnection/ipconnectionplugin.cpp b/ground/gcs/src/plugins/ipconnection/ipconnectionplugin.cpp index d50446b32..57a827d13 100644 --- a/ground/gcs/src/plugins/ipconnection/ipconnectionplugin.cpp +++ b/ground/gcs/src/plugins/ipconnection/ipconnectionplugin.cpp @@ -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 #include -#include "ipconnection_internal.h" #include -#include #include #include #include @@ -44,10 +43,9 @@ #include #include #include - #include -// 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 IPconnectionConnection::availableDevices() +QList IPConnectionConnection::availableDevices() { QList list; device d; @@ -169,7 +167,7 @@ QList 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); diff --git a/ground/gcs/src/plugins/ipconnection/ipconnectionplugin.h b/ground/gcs/src/plugins/ipconnection/ipconnectionplugin.h index c44214ba2..344f5dfba 100644 --- a/ground/gcs/src/plugins/ipconnection/ipconnectionplugin.h +++ b/ground/gcs/src/plugins/ipconnection/ipconnectionplugin.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 @@ -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 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