From 94635a8977d08ba1fef4650444e4a09da7a927a0 Mon Sep 17 00:00:00 2001 From: Boernsman Date: Sun, 10 Nov 2019 21:15:28 +0100 Subject: [PATCH] added http server --- httpcommander/devicepluginhttpcommander.cpp | 5 ++--- httpcommander/httpsimpleserver.cpp | 2 +- httpcommander/httpsimpleserver.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/httpcommander/devicepluginhttpcommander.cpp b/httpcommander/devicepluginhttpcommander.cpp index 42cc15e4..0b4ff8e2 100644 --- a/httpcommander/devicepluginhttpcommander.cpp +++ b/httpcommander/devicepluginhttpcommander.cpp @@ -72,9 +72,8 @@ void DevicePluginHttpCommander::setupDevice(DeviceSetupInfo *info) if (device->deviceClassId() == httpServerDeviceClassId) { //TODO create a simple server - HttpSimpleServer *httpSimpleServer = new HttpSimpleServer(device, this); - httpSimpleServer-> - m_httpSimpleServer.insert(httpSimpleServer); + HttpSimpleServer *httpSimpleServer = new HttpSimpleServer(this); + m_httpSimpleServer.insert(device, httpSimpleServer); return info->finish(Device::DeviceErrorNoError); } info->finish(Device::DeviceErrorNoError); diff --git a/httpcommander/httpsimpleserver.cpp b/httpcommander/httpsimpleserver.cpp index c56562cb..4ad0d338 100644 --- a/httpcommander/httpsimpleserver.cpp +++ b/httpcommander/httpsimpleserver.cpp @@ -61,7 +61,7 @@ void HttpSimpleServer::readClient() // This slot is called when the client sent data to the server. The // server looks if it was a get request and sends a very simple HTML // document back. - QTcpSocket* socket = (QTcpSocket*)sender(); + QTcpSocket* socket = static_cast(sender()); if (socket->canReadLine()) { QByteArray data = socket->readLine(); QStringList tokens = QString(data).split(QRegExp("[ \r\n][ \r\n]*")); diff --git a/httpcommander/httpsimpleserver.h b/httpcommander/httpsimpleserver.h index c3c0b04c..393037cb 100644 --- a/httpcommander/httpsimpleserver.h +++ b/httpcommander/httpsimpleserver.h @@ -39,7 +39,7 @@ class HttpSimpleServer : public QTcpServer Q_OBJECT public: HttpSimpleServer(QObject* parent = nullptr); - ~HttpSimpleServer(); + ~HttpSimpleServer() override; void incomingConnection(qintptr socket) override; signals: