added http server
parent
253dbecc11
commit
94635a8977
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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]*"));
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class HttpSimpleServer : public QTcpServer
|
|||
Q_OBJECT
|
||||
public:
|
||||
HttpSimpleServer(QObject* parent = nullptr);
|
||||
~HttpSimpleServer();
|
||||
~HttpSimpleServer() override;
|
||||
void incomingConnection(qintptr socket) override;
|
||||
|
||||
signals:
|
||||
|
|
|
|||
Loading…
Reference in New Issue