From 1877d455d7a8fbb0d05d75ed5a341b8e3579acbd Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期四, 02 四月 2026 16:23:47 +0800
Subject: [PATCH] 新服务器
---
SmartHome/UI/SimpleControl/CommonPage.cs | 48 ++++++++++--------------------------------------
1 files changed, 10 insertions(+), 38 deletions(-)
diff --git a/SmartHome/UI/SimpleControl/CommonPage.cs b/SmartHome/UI/SimpleControl/CommonPage.cs
index eb54f2d..cbdf35d 100644
--- a/SmartHome/UI/SimpleControl/CommonPage.cs
+++ b/SmartHome/UI/SimpleControl/CommonPage.cs
@@ -10,13 +10,8 @@
{
public static class CommonPage
{
- //public static AirQuality AirQuality;
- //public static Action RefreshAir;
public static bool IsRemote = false;
- //public static bool FindGateway = false;
- public static bool FindGatewayChilren = false;
public static string FindGatewayChilrenIPAddress = new Net.NetWiFi ().BroadcastIpAddress.ToString ();
- public static bool LocalPhoneFindDevice = false;
public static int searchTotal = 0;
public static int newDevice = 0;
private static string ip= "115.29.251.24";
@@ -81,17 +76,17 @@
36865,9600,19600,
1099,1163,3501,3502,3503,3504,3505,3506,
3508,3509,3516,3517,3521,3527,3528,3530,3532,3533,3534,3536,3538,
- 3539,3541,3543,3550,3559,3600,3601,3605,4599,4601,4602,
+ 3539,3541,3543,3550,3559,3600,3601,3605,4601,4602,
30001,63479,65282,65532,65534,
};
- static void Packet_ReceiveEvent (byte subnetID, byte deviceID, Command command, byte [] usefullBytes,int deviceTypeNumber)
+ static void Packet_ReceiveEvent (byte subnetID, byte deviceID, Command command, byte [] usefullBytes,int deviceTypeNumber, System.Net.IPEndPoint remoteIp)
{
try {
List<byte> ButtonBkeyModelList = new List<byte> ();
switch (command) {
case Command.ReadRemarkACK:
- if(supportList.Contains(deviceTypeNumber)) {
+ if (supportList.Contains (deviceTypeNumber)) {
lock (GateWayList) {
if (GateWayList.Find ((l) => { return l.SubnetID == subnetID && l.DeviceID == deviceID; }) != null) {
return;
@@ -103,38 +98,10 @@
gatewayBase.DeviceID = deviceID;
gatewayBase.Type = deviceType;
gatewayBase.Name = MyEncodingGB2312.GetString (usefullBytes, 0, 20).Trim ('\0');//=============
+ var name = Encoding.Default.GetString (usefullBytes, 0, 20).Trim ('\0');
GateWayList.Add (gatewayBase);
- }
- }
- break;
- //璇诲彇缃戝叧璁惧鍥炲
- case Command.ReadGatewayACK:
- if (usefullBytes [0] != RandomHigh | usefullBytes [1] != RandomLow) {
- return;
- }
- lock (GateWayList) {
- if (GateWayList.Find ((l) => { return l.SubnetID == subnetID && l.DeviceID == deviceID; }) != null) {
- return;
- }
- DeviceType deviceType = (DeviceType)(usefullBytes [2] * 256 + usefullBytes [3]);
- if (usefullBytes [2] == 254 && usefullBytes [3] < 8) {
- GatewayBase gatewayBase = new GatewayBase ();
- gatewayBase.DeviceTypeNumber = deviceTypeNumber;
- gatewayBase.SubnetID = subnetID;
- gatewayBase.DeviceID = deviceID; gatewayBase.Type = deviceType;
- gatewayBase.LoopID = usefullBytes [4];
- gatewayBase.MAC = byteToHex16 (usefullBytes [5]) + "." + byteToHex16 (usefullBytes [6]) + "." + byteToHex16 (usefullBytes [7]) + "." + byteToHex16 (usefullBytes [8]) + "." + byteToHex16 (usefullBytes [9]) + "." + byteToHex16 (usefullBytes [10]) + "." + byteToHex16 (usefullBytes [11]) + "." + byteToHex16 (usefullBytes [12]);
- gatewayBase.Name = MyEncodingGB2312.GetString (usefullBytes, 13, 20).Trim ('\0');//=============
- gatewayBase.IPAddress = usefullBytes [33] + "." + usefullBytes [34] + "." + usefullBytes [35] + "." + usefullBytes [36];
- gatewayBase.RouteIPAddress = usefullBytes [37] + "." + usefullBytes [38] + "." + usefullBytes [39] + "." + usefullBytes [40];
- gatewayBase.IPMAC = usefullBytes [41] + "." + usefullBytes [42] + "." + usefullBytes [43] + "." + usefullBytes [44] + "." + usefullBytes [45] + "." + usefullBytes [46];
- gatewayBase.SubnetMask = usefullBytes [47] + "." + usefullBytes [48] + "." + usefullBytes [49] + "." + usefullBytes [50];
- gatewayBase.DHCP = usefullBytes [51] == 0 ? false : true;
- GateWayList.Add (gatewayBase);
- if (gatewayBase.Name == "") {
- gatewayBase.Name = gatewayBase.CommonLoopID.ToString ();
- }
+ Console.WriteLine ($"name:{gatewayBase.Name}++{deviceTypeNumber}");
}
}
break;
@@ -187,5 +154,10 @@
/// </summary>
public static List<GatewayBase> GateWayList = new List<GatewayBase> ();
+
+ public static List<GatewayBase> GateWayList_NewServer = new List<GatewayBase> ();
+
+
+
}
}
\ No newline at end of file
--
Gitblit v1.8.0