commit ded3fef90c86d7333d7c3538a9e37318eb7e4746 Author: Teademia <2408387759@qq.com> Date: Sun Nov 5 15:44:01 2023 +0800 创建工程 diff --git a/loT/httpsender.cpp b/loT/httpsender.cpp new file mode 100644 index 0000000..dfa71fb --- /dev/null +++ b/loT/httpsender.cpp @@ -0,0 +1,24 @@ +#include "httpsender.h" + +HttpSender::HttpSender(QObject *parent) + : QObject{parent} +{ + Manager=new QNetworkAccessManager; + + +} + +/****************************************************************************** + * Copyright 2020-xxxx xxx Co., Ltd. + * All right reserved. See COPYRIGHT for detailed Information. + *zh'g + * @brief 在HttpSender这个类中,用Sender向指定的Http地址发送Post,Get请求 + * + * @author Teademia + * @date 2023/11/02 + * @history 1.0 + *****************************************************************************/ +void HttpSender::Send(QString AccessToken) +{ + +} diff --git a/loT/httpsender.h b/loT/httpsender.h new file mode 100644 index 0000000..201833e --- /dev/null +++ b/loT/httpsender.h @@ -0,0 +1,38 @@ +#ifndef HTTPSENDER_H +#define HTTPSENDER_H + +#include +#include +#include +#include +#include +#include +#include +#include + + + +class HttpSender : public QObject +{ + Q_OBJECT +public: + explicit HttpSender(QObject *parent = nullptr); + + void Send(QString AccessToken); + +private: + + QNetworkReply * Rpl; + QNetworkAccessManager * Manager; + QNetworkRequest Rst; + + + QJsonDocument JSD; + QJsonObject JSO; + + QString AcessToken; +signals: + +}; + +#endif // HTTPSENDER_H diff --git a/loT/loT.pro b/loT/loT.pro new file mode 100644 index 0000000..410b4b7 --- /dev/null +++ b/loT/loT.pro @@ -0,0 +1,21 @@ +QT = core gui network + +CONFIG += c++17 cmdline + +# You can make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + httpsender.cpp \ + main.cpp \ + udpsender.cpp + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +HEADERS += \ + httpsender.h \ + udpsender.h diff --git a/loT/loT.pro.user b/loT/loT.pro.user new file mode 100644 index 0000000..3039155 --- /dev/null +++ b/loT/loT.pro.user @@ -0,0 +1,261 @@ + + + + + + EnvironmentId + {706fde59-1f6f-4587-ab55-a6cfcd222b29} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + false + true + false + 0 + true + true + 0 + 8 + true + false + 1 + true + true + true + *.md, *.MD, Makefile + false + true + true + + + + ProjectExplorer.Project.PluginSettings + + + true + false + true + true + true + true + + + 0 + true + + true + true + Builtin.DefaultTidyAndClazy + 8 + true + + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop Qt 5.9.0 MinGW 32bit + Desktop Qt 5.9.0 MinGW 32bit + qt.59.win32_mingw53_kit + 0 + 0 + 0 + + 0 + D:\LOT\build-loT-Desktop_Qt_5_9_0_MinGW_32bit-Debug + D:/LOT/build-loT-Desktop_Qt_5_9_0_MinGW_32bit-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + D:\LOT\build-loT-Desktop_Qt_5_9_0_MinGW_32bit-Release + D:/LOT/build-loT-Desktop_Qt_5_9_0_MinGW_32bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + 0 + D:\LOT\build-loT-Desktop_Qt_5_9_0_MinGW_32bit-Profile + D:/LOT/build-loT-Desktop_Qt_5_9_0_MinGW_32bit-Profile + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + 3 + + + 0 + 部署 + 部署 + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + false + Qt4ProjectManager.Qt4RunConfiguration:D:/LOT/loT/loT.pro + D:/LOT/loT/loT.pro + true + true + true + D:/LOT/build-loT-Desktop_Qt_5_9_0_MinGW_32bit-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/loT/main.cpp b/loT/main.cpp new file mode 100644 index 0000000..ea205a6 --- /dev/null +++ b/loT/main.cpp @@ -0,0 +1,11 @@ +#include +#include"udpsender.h" + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + udpSender * newUDPSender=new udpSender(); + return a.exec(); +} + + diff --git a/loT/udpsender.cpp b/loT/udpsender.cpp new file mode 100644 index 0000000..7f3d496 --- /dev/null +++ b/loT/udpsender.cpp @@ -0,0 +1,22 @@ +#include "udpsender.h" + +udpSender::udpSender(QObject *parent) + : QObject{parent} +{ + UdpSocket=new QUdpSocket(); + + QString hostName=QHostInfo::localHostName(); + qDebug()< addList=hostInfo.addresses(); + + foreach (QHostAddress aHost,addList) + { + if(QAbstractSocket::IPv4Protocol==aHost.protocol()) + { + localIP=aHost.toString(); + qDebug()< +#include +#include + + +class udpSender : public QObject +{ + Q_OBJECT +public: + explicit udpSender(QObject *parent = nullptr); +private: + QUdpSocket * UdpSocket; +signals: + +}; + +#endif // UDPSENDER_H