added http server
parent
253dbecc11
commit
94635a8977
|
|
@ -72,9 +72,8 @@ void DevicePluginHttpCommander::setupDevice(DeviceSetupInfo *info)
|
||||||
|
|
||||||
if (device->deviceClassId() == httpServerDeviceClassId) {
|
if (device->deviceClassId() == httpServerDeviceClassId) {
|
||||||
//TODO create a simple server
|
//TODO create a simple server
|
||||||
HttpSimpleServer *httpSimpleServer = new HttpSimpleServer(device, this);
|
HttpSimpleServer *httpSimpleServer = new HttpSimpleServer(this);
|
||||||
httpSimpleServer->
|
m_httpSimpleServer.insert(device, httpSimpleServer);
|
||||||
m_httpSimpleServer.insert(httpSimpleServer);
|
|
||||||
return info->finish(Device::DeviceErrorNoError);
|
return info->finish(Device::DeviceErrorNoError);
|
||||||
}
|
}
|
||||||
info->finish(Device::DeviceErrorNoError);
|
info->finish(Device::DeviceErrorNoError);
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ void HttpSimpleServer::readClient()
|
||||||
// This slot is called when the client sent data to the server. The
|
// 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
|
// server looks if it was a get request and sends a very simple HTML
|
||||||
// document back.
|
// document back.
|
||||||
QTcpSocket* socket = (QTcpSocket*)sender();
|
QTcpSocket* socket = static_cast<QTcpSocket*>(sender());
|
||||||
if (socket->canReadLine()) {
|
if (socket->canReadLine()) {
|
||||||
QByteArray data = socket->readLine();
|
QByteArray data = socket->readLine();
|
||||||
QStringList tokens = QString(data).split(QRegExp("[ \r\n][ \r\n]*"));
|
QStringList tokens = QString(data).split(QRegExp("[ \r\n][ \r\n]*"));
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class HttpSimpleServer : public QTcpServer
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
HttpSimpleServer(QObject* parent = nullptr);
|
HttpSimpleServer(QObject* parent = nullptr);
|
||||||
~HttpSimpleServer();
|
~HttpSimpleServer() override;
|
||||||
void incomingConnection(qintptr socket) override;
|
void incomingConnection(qintptr socket) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue