diff --git a/plugins/MosaicCamera/src/CMakeLists.txt b/plugins/MosaicCamera/src/CMakeLists.txt index 29f1bd78f896e..4b6479042bde5 100644 --- a/plugins/MosaicCamera/src/CMakeLists.txt +++ b/plugins/MosaicCamera/src/CMakeLists.txt @@ -4,8 +4,6 @@ LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/src) SET(MosaicCamera_SRCS MosaicCamera.hpp MosaicCamera.cpp - MosaicTcpServer.hpp - MosaicTcpServer.cpp gui/MosaicCameraDialog.hpp gui/MosaicCameraDialog.cpp ) @@ -28,7 +26,6 @@ SET(MosaicCamera_Qt_Libraries Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets - Qt${QT_VERSION_MAJOR}::Network ) ADD_LIBRARY(MosaicCamera-static STATIC ${MosaicCamera_SRCS} ${MosaicCamera_RES_CXX} ${MosaicCamera_UIS_H}) diff --git a/plugins/MosaicCamera/src/MosaicCamera.cpp b/plugins/MosaicCamera/src/MosaicCamera.cpp index b8f91a0096fd9..2f08ffd487e79 100644 --- a/plugins/MosaicCamera/src/MosaicCamera.cpp +++ b/plugins/MosaicCamera/src/MosaicCamera.cpp @@ -24,7 +24,6 @@ #include "StelModuleMgr.hpp" #include "MosaicCamera.hpp" #include "MosaicCameraDialog.hpp" -#include "MosaicTcpServer.hpp" #include "StelUtils.hpp" #include "StelPainter.hpp" #include "CustomObject.hpp" @@ -66,7 +65,6 @@ MosaicCamera::MosaicCamera() { setObjectName("MosaicCamera"); configDialog = new MosaicCameraDialog(); - tcpServer = new MosaicTcpServer(); conf = StelApp::getInstance().getSettings(); } @@ -76,7 +74,6 @@ MosaicCamera::MosaicCamera() MosaicCamera::~MosaicCamera() { delete configDialog; - delete tcpServer; } void MosaicCamera::loadSettings() @@ -129,10 +126,6 @@ void MosaicCamera::init() initializeUserData(); - qDebug() << "[MosaicCamera] Starting TCP server"; - tcpServer->startServer(5772); - connect(tcpServer, &MosaicTcpServer::newValuesReceived, this, &MosaicCamera::updateMosaic); - qDebug() << "[MosaicCamera] Loading built-in cameras"; loadBuiltInCameras(); diff --git a/plugins/MosaicCamera/src/MosaicCamera.hpp b/plugins/MosaicCamera/src/MosaicCamera.hpp index 1498fbc850a71..cbe61aa4b94d9 100644 --- a/plugins/MosaicCamera/src/MosaicCamera.hpp +++ b/plugins/MosaicCamera/src/MosaicCamera.hpp @@ -19,7 +19,6 @@ #ifndef MOSAICCAMERA_HPP #define MOSAICCAMERA_HPP -#include "MosaicTcpServer.hpp" #include "StelModule.hpp" #include "StelPluginInterface.hpp" #include @@ -109,7 +108,6 @@ public slots: void copyResourcesToUserDirectory(); MosaicCameraDialog* configDialog; - MosaicTcpServer* tcpServer; }; class MosaicCameraStelPluginInterface : public QObject, public StelPluginInterface diff --git a/plugins/MosaicCamera/src/MosaicTcpServer.cpp b/plugins/MosaicCamera/src/MosaicTcpServer.cpp deleted file mode 100644 index 1ee947ad0a6c0..0000000000000 --- a/plugins/MosaicCamera/src/MosaicTcpServer.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "MosaicTcpServer.hpp" -#include -#include - -MosaicTcpServer::MosaicTcpServer(QObject *parent) : QTcpServer(parent) -{ - connect(this, &MosaicTcpServer::newConnection, this, &MosaicTcpServer::onNewConnection); -} - -void MosaicTcpServer::startServer(quint16 port) -{ - if (!this->listen(QHostAddress::Any, port)) { - qDebug() << "[MosaicCamera] Server failed to start: " << this->errorString(); - } else { - qDebug() << "[MosaicCamera] Server started on port" << port; - } -} - -void MosaicTcpServer::onNewConnection() -{ - QTcpSocket *client = this->nextPendingConnection(); - connect(client, &QTcpSocket::readyRead, this, [this, client]() { - processClientData(client); - }); - - connect(client, &QTcpSocket::disconnected, client, &QTcpSocket::deleteLater); -} - -void MosaicTcpServer::processClientData(QTcpSocket *client) -{ - QByteArray data = client->readAll(); - QString message(data); - - QStringList params = message.split(' '); - if (params.size() == 4) { - bool ok1, ok2, ok3; - QString name = params[0]; - double ra = params[1].toDouble(&ok1); - double dec = params[2].toDouble(&ok2); - double rot = params[3].toDouble(&ok3); - - if (ok1 && ok2 && ok3) { - emit newValuesReceived(name, ra, dec, rot); - } - } -} diff --git a/plugins/MosaicCamera/src/MosaicTcpServer.hpp b/plugins/MosaicCamera/src/MosaicTcpServer.hpp deleted file mode 100644 index 3bf7fc39db861..0000000000000 --- a/plugins/MosaicCamera/src/MosaicTcpServer.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef MOSAICTCPSERVER_HPP -#define MOSAICTCPSERVER_HPP - -#include -#include - -class MosaicTcpServer : public QTcpServer -{ - Q_OBJECT - -public: - explicit MosaicTcpServer(QObject *parent = nullptr); - void startServer(quint16 port); - -signals: - void newValuesReceived(QString name, double ra, double dec, double rot); - -private slots: - void onNewConnection(); - -private: - void processClientData(QTcpSocket *client); -}; - -#endif // MOSAICTCPSERVER_HPP