added http server

master
Boernsman 2019-11-10 21:15:28 +01:00
parent 253dbecc11
commit 94635a8977
3 changed files with 4 additions and 5 deletions

View File

@ -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);

View File

@ -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<QTcpSocket*>(sender());
if (socket->canReadLine()) {
QByteArray data = socket->readLine();
QStringList tokens = QString(data).split(QRegExp("[ \r\n][ \r\n]*"));

View File

@ -39,7 +39,7 @@ class HttpSimpleServer : public QTcpServer
Q_OBJECT
public:
HttpSimpleServer(QObject* parent = nullptr);
~HttpSimpleServer();
~HttpSimpleServer() override;
void incomingConnection(qintptr socket) override;
signals: