From 45ed233d79d9847e7c7e238b17e390ec8b0bb294 Mon Sep 17 00:00:00 2001
From: "DESKTOP-B25GA9E\\W35" <1733709035@qq.com>
Date: Thu, 2 Mar 2023 14:30:21 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=8F=92=E4=BB=B6=E5=BC=95?=
=?UTF-8?q?=E7=94=A8=E6=95=B4=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Assets/MsgTransmitTools/DataClass.meta | 8 +++
.../DataClass/BluetoothGateway.cs | 49 ++++++++++++++++++
.../DataClass/BluetoothGateway.cs.meta | 11 ++++
.../HttpServer/HttpServerModel.cs | 17 ++++--
.../HttpServer/HttpServerView.cs | 1 +
Assets/Plugin.meta | 8 +++
Assets/{JsonIOTools => Plugin}/LitJson.dll | Bin
.../{JsonIOTools => Plugin}/LitJson.dll.meta | 0
8 files changed, 90 insertions(+), 4 deletions(-)
create mode 100644 Assets/MsgTransmitTools/DataClass.meta
create mode 100644 Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs
create mode 100644 Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs.meta
create mode 100644 Assets/Plugin.meta
rename Assets/{JsonIOTools => Plugin}/LitJson.dll (100%)
rename Assets/{JsonIOTools => Plugin}/LitJson.dll.meta (100%)
diff --git a/Assets/MsgTransmitTools/DataClass.meta b/Assets/MsgTransmitTools/DataClass.meta
new file mode 100644
index 0000000..60e5c23
--- /dev/null
+++ b/Assets/MsgTransmitTools/DataClass.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: cdc27ec2fd28d2c43ba1eeb65b7e16b1
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs b/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs
new file mode 100644
index 0000000..7b2866f
--- /dev/null
+++ b/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs
@@ -0,0 +1,49 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using LitJson;
+
+namespace JXSoft {
+ public class BluetoothGateway:IResponse
+ {
+ ///
+ ///
+ ///
+ public int v { get; set; }
+ ///
+ ///
+ ///
+ public int mid { get; set; }
+ ///
+ ///
+ ///
+ public int time { get; set; }
+ ///
+ /// 用时
+ ///
+ public string ip { get; set; }
+ ///
+ /// 地址
+ ///
+ public string mac { get; set; }
+ ///
+ /// 设备信息
+ ///
+ public List> devices { get; set; }
+
+ public string toProtocolData()
+ {
+ return "";
+ }
+
+ public bool trySetData(string protocolData)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public string getException()
+ {
+ throw new System.NotImplementedException();
+ }
+ }
+}
diff --git a/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs.meta b/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs.meta
new file mode 100644
index 0000000..3611951
--- /dev/null
+++ b/Assets/MsgTransmitTools/DataClass/BluetoothGateway.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 13a2cca89eba62b4190e83ab540a781f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs b/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs
index 5fbe77d..d5061d5 100644
--- a/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs
+++ b/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerModel.cs
@@ -27,6 +27,11 @@ namespace JXSoft {
return 0;
}
}
+ public enum ServerState
+ {
+ Close = 0,
+ Open = 1
+ }
public class HttpServerUtility:IUtility
{
@@ -40,6 +45,7 @@ namespace JXSoft {
public Thread reciveT;
+ #region OpenServer
public bool startServer(string[] prefixes) {
if (httpServer == null || !httpServer.IsListening) {
if (!HttpListener.IsSupported)
@@ -68,25 +74,27 @@ namespace JXSoft {
}
return false;
}
-
public void startServer(string prefix) {
string[] prefixes = {prefix};
startServer(prefixes);
}
-
public void startServer()
{
string[] prefixes = { address };
startServer(prefixes);
}
+ #endregion
+ #region CloseServer
public void closeServer() {
if (httpServer.IsListening) {
reciveT.Abort();
httpServer.Close();
}
}
+ #endregion
+ #region MessageReceive
public void RecciveMsg()
{
string msg = "";
@@ -120,7 +128,7 @@ namespace JXSoft {
}
#endregion
- #region 返回消息
+ #region 返回应答
HttpListenerResponse response = context.Response;
// Construct a response.
byte[] buffer = Encoding.UTF8.GetBytes(" " + "success" + "");
@@ -144,7 +152,7 @@ namespace JXSoft {
}
///
- /// 线程接收到消息后
+ /// Update调用,主线程信息提取
///
/// 接收到的消息
public string getReceivedValue()
@@ -159,5 +167,6 @@ namespace JXSoft {
return "";
}
}
+ #endregion
}
}
\ No newline at end of file
diff --git a/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerView.cs b/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerView.cs
index 1a2668a..6903f98 100644
--- a/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerView.cs
+++ b/Assets/MsgTransmitTools/ExtendLinkModel/HttpServer/HttpServerView.cs
@@ -5,6 +5,7 @@ using System.IO;
using System.Net;
using System.Text;
using UnityEngine;
+using QFrameworkCP;
namespace JXSoft {
public class HttpServerView : MonoBehaviour
diff --git a/Assets/Plugin.meta b/Assets/Plugin.meta
new file mode 100644
index 0000000..ce6fe4f
--- /dev/null
+++ b/Assets/Plugin.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c29f7b7272f37b648a299662bc951a33
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/JsonIOTools/LitJson.dll b/Assets/Plugin/LitJson.dll
similarity index 100%
rename from Assets/JsonIOTools/LitJson.dll
rename to Assets/Plugin/LitJson.dll
diff --git a/Assets/JsonIOTools/LitJson.dll.meta b/Assets/Plugin/LitJson.dll.meta
similarity index 100%
rename from Assets/JsonIOTools/LitJson.dll.meta
rename to Assets/Plugin/LitJson.dll.meta