From 3fb8de2ea7085a309ef892b4bf5901addde2bfc2 Mon Sep 17 00:00:00 2001 From: jfmartel Date: Fri, 27 Dec 2024 12:59:20 -0500 Subject: [PATCH] Tests serveur HTTP --- MasterCtrl.pro | 2 +- Sources/HttpServer/HttpServer.cpp | 72 ++++++++++++++++++++++++++++++- Sources/MasterCtrl.h | 2 +- ui_LoraSettingsGui.h | 11 +++-- 4 files changed, 80 insertions(+), 7 deletions(-) diff --git a/MasterCtrl.pro b/MasterCtrl.pro index 7914c42..ca3107a 100644 --- a/MasterCtrl.pro +++ b/MasterCtrl.pro @@ -1,6 +1,6 @@ #QT += Network #QT += gui declarative network -QT += gui network serialport mqtt +QT += gui network serialport mqtt websockets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets #CONFIG += console diff --git a/Sources/HttpServer/HttpServer.cpp b/Sources/HttpServer/HttpServer.cpp index acf2bc8..bf4f225 100644 --- a/Sources/HttpServer/HttpServer.cpp +++ b/Sources/HttpServer/HttpServer.cpp @@ -6,11 +6,79 @@ CHttpServer::CHttpServer() mHttpServer = new QHttpServer; mHttpServer->route("/", []() { - qDebug("Test"); - return "Ja Mon CB!!!!"; + +// return " \ +// \ +// \ +// Page Title\ +// \ +// \ +// \ +//

This is a Heading

\ +//

This is a paragraph.

\ +// \ +// \ +// "; + +// return " \ +// \ +// \ +// \ +//

My First JavaScript

\ +// \ +// \ +// \ +//

\ +// \ +// \ +// "; + + + return "\ + \ + \ + \ +

SVG rect Element

\ + \ + \ + \ + Sorry, your browser does not support inline SVG. \ + \ + \ + \ + "; + + + + }); + mHttpServer->route("/test", []() + { + + + return " \ + \ + \ + Page Title\ + \ + \ + \ +

This is a Heading

\ +

This is a paragraph.

\ + \ + \ + "; + + + + + + + }); const auto port = mHttpServer->listen(QHostAddress::Any,8080); diff --git a/Sources/MasterCtrl.h b/Sources/MasterCtrl.h index ee7cc30..a965c37 100644 --- a/Sources/MasterCtrl.h +++ b/Sources/MasterCtrl.h @@ -47,7 +47,7 @@ public: CLoraModuleInterface *mChaletLoraModuleInterface; // CAppIconWidget mAppWidget; - // CHttpServer mHttpServer; + CHttpServer mHttpServer; CIspindelDevice *mIspindelDevice; diff --git a/ui_LoraSettingsGui.h b/ui_LoraSettingsGui.h index 13df6eb..dddc3aa 100644 --- a/ui_LoraSettingsGui.h +++ b/ui_LoraSettingsGui.h @@ -34,6 +34,7 @@ public: QCheckBox *mUseLoraIFCheckBx; QSpinBox *mLoraChannelSpinBx; QLabel *label_4; + QCheckBox *checkBox; void setupUi(QWidget *CLoraSettingsGui) { @@ -48,7 +49,7 @@ public: label->setFont(font); groupBox = new QGroupBox(CLoraSettingsGui); groupBox->setObjectName(QString::fromUtf8("groupBox")); - groupBox->setGeometry(QRect(50, 120, 221, 191)); + groupBox->setGeometry(QRect(110, 170, 221, 191)); label_2 = new QLabel(groupBox); label_2->setObjectName(QString::fromUtf8("label_2")); label_2->setGeometry(QRect(10, 40, 71, 16)); @@ -89,9 +90,12 @@ public: mLoraChannelSpinBx->setMinimum(1); mLoraChannelSpinBx->setMaximum(65535); mLoraChannelSpinBx->setValue(6); - label_4 = new QLabel(CLoraSettingsGui); + label_4 = new QLabel(groupBox); label_4->setObjectName(QString::fromUtf8("label_4")); - label_4->setGeometry(QRect(270, 110, 71, 16)); + label_4->setGeometry(QRect(200, 30, 71, 16)); + checkBox = new QCheckBox(CLoraSettingsGui); + checkBox->setObjectName(QString::fromUtf8("checkBox")); + checkBox->setGeometry(QRect(70, 60, 281, 20)); retranslateUi(CLoraSettingsGui); @@ -121,6 +125,7 @@ public: "Chaloupe = 8", nullptr)); mUseLoraIFCheckBx->setText(QCoreApplication::translate("CLoraSettingsGui", "Use LoraInterface (restart needed)", nullptr)); label_4->setText(QCoreApplication::translate("CLoraSettingsGui", "4", nullptr)); + checkBox->setText(QCoreApplication::translate("CLoraSettingsGui", "Use LTE interface (restart needed)", nullptr)); } // retranslateUi };