From 9ca2281d589fbd4b35177d1846974f17d12095ae Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期四, 16 四月 2020 15:12:02 +0800
Subject: [PATCH] 2020-04-16 1.更新
---
Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs | 34 ++++++++++++++++++++++------------
1 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs b/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs
index 91d2ce6..3d6bd2c 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/CommonPage.cs
@@ -103,7 +103,7 @@
foreach (var bin in usefullBytes) {
pushBytesString += bin + ",";
}
- Console.WriteLine (pushBytesString);
+ Utlis.WriteLine (pushBytesString);
#endif
if (DeviceList.Find ((l) => { return l.SubnetID == subnetID && l.DeviceID == deviceID; }) != null) {
return;
@@ -122,7 +122,7 @@
continue;
}
DeviceType deviceType_wireless = (DeviceType)(usefullBytes [i] * 256 + usefullBytes [i + 1]);
- Console.WriteLine (deviceType_wireless.ToString ());
+ Utlis.WriteLine (deviceType_wireless.ToString ());
if (noRemake || MyEncodingGB2312.GetString (usefullBytes, 2, 20).Trim ('\0') == "") {
byte [] ddd = CommonPage.MyEncodingGB2312.GetBytes (deviceType_wireless.ToString () + "-" + subnetID.ToString () + "-" + deviceID.ToString ());
byte [] newddd = new byte [20];
@@ -256,7 +256,8 @@
}
break;
case Command.SetSingleLightACK:
- Console.WriteLine ("Command.SetSingleLightACK");
+ //Utlis.WriteLine ($"Command.SetSingleLightACK: subnetID:{subnetID} deviceID:{deviceID} 鍥炶矾锛歿usefullBytes [0]}");
+ //Utlis.WriteLine ("Command.SetSingleLightACK");
foreach (var room in Room.Lists) {
var common = room.DeviceList.Find ((obj) => obj.CommonLoopID == subnetID.ToString () + "_" + deviceID.ToString () + "_" + usefullBytes [0].ToString ());
if (common != null) {
@@ -279,7 +280,14 @@
hadBeUpdate = false;
(common as LightDimming).CurrentBrightness = usefullBytes [2];
} else if (common.Type == DeviceType.FanModule) {
+ //if ((common as FanModule).Switch == usefullBytes [2]) {
+ // hadBeUpdate = false;
+ //}
(common as FanModule).Switch = usefullBytes [2];
+ if (usefullBytes [2] != 0)
+ (common as FanModule).WindSpeed = usefullBytes [2];
+
+ //(common as FanModule).Switch = usefullBytes [2];
} else if (common.Type == DeviceType.LightMixSwitch) {
if ((common as LightMixSwitch).CurrentBrightness == usefullBytes [2])
hadBeUpdate = false;
@@ -312,6 +320,7 @@
if (!string.IsNullOrEmpty (room.Name))
UserDeviceToLight.UpdateBrighingCount (updateFlag);
if (hadBeUpdate) {
+
UserRoom.UpdataDeviceStatus (common);
UserLightPage.UpdateStatus (updateFlag, usefullBytes [2]);
UserDeviceToLight.UpdateStatus (updateFlag, usefullBytes [2]);
@@ -704,7 +713,7 @@
case "DISPMODE":
if (7 <= backResult [1].Length) {
music.playMode = int.Parse (backResult [1].Substring (6, 1));
- System.Console.WriteLine ("DISPMODE=====" + music.playMode);
+ Utlis.WriteLine ("DISPMODE=====" + music.playMode);
}
break;
}
@@ -1199,7 +1208,7 @@
continue;
}
deviceType = (DeviceType)(usefullBytes [iReadDeviceModulACK] * 256 + usefullBytes [iReadDeviceModulACK + 1]);
- Console.WriteLine (deviceType.ToString ());
+ Utlis.WriteLine (deviceType.ToString ());
string devcieTempName = MyEncodingGB2312.GetString (usefullBytes, 2, 20).Trim ('\0');
if (notHasRemake || MyEncodingGB2312.GetString (usefullBytes, 2, 20).Trim ('\0') == "") {
devcieTempName = deviceType.ToString ().Replace (DeviceType.Sensor.ToString (), "") + "-" + deviceID.ToString ();
@@ -1583,7 +1592,7 @@
wirelessPanelButtonKey.Name = MyEncodingGB2312.GetString (usefullBytes, 3, 20).Trim ('\0');
wirelessPanelButtonKey.Mode = usefullBytes [23];
ButtonBkeyModelList.Add (wirelessPanelButtonKey.Mode);
- System.Console.WriteLine ("璇诲彇闈㈡澘鎸夐敭锛氬洖璺彿锛�" + wirelessPanelButtonKey.LoopID + " 妯″紡锛�" + wirelessPanelButtonKey.Mode);
+ Utlis.WriteLine ("璇诲彇闈㈡澘鎸夐敭锛氬洖璺彿锛�" + wirelessPanelButtonKey.LoopID + " 妯″紡锛�" + wirelessPanelButtonKey.Mode);
IO.FileUtils.SaveEquipmentMessage (wirelessPanelButtonKey, wirelessPanelButtonKey.LoopID.ToString ());
#endregion
break;
@@ -2060,7 +2069,7 @@
//01 01 59(+30) 02 0D 03 64 00 01
break;
case Command.AssignedAddressACK:
- Console.WriteLine (usefullBytes [0].ToString ());
+ Utlis.WriteLine (usefullBytes [0].ToString ());
if (usefullBytes [0] == 3) {
dt = DateTime.Now;
} else if (usefullBytes [0] == 4) {
@@ -2068,24 +2077,24 @@
}
break;
case Command.Remote3thACK:
- Console.WriteLine (usefullBytes [0]);
+ Utlis.WriteLine (usefullBytes [0]);
break;
case Command.DownloadInfraredACK:
string loopID_IM = usefullBytes [0] < 10 ? "0" + usefullBytes [0].ToString () : usefullBytes [0].ToString ();
if ((InfraredType)usefullBytes [2] != InfraredType.AC) {
if ((InfraredType)usefullBytes [2] == InfraredType.NULL) {
- Console.WriteLine ("NULL-------------");
+ Utlis.WriteLine ("NULL-------------");
}
string filePath = "Equipment_InfraredMode_" + subnetID + "_" + deviceID + "_" + loopID_IM;
InfraredMode im = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (filePath)));
im.InfraredType = (InfraredType)usefullBytes [2];
- Console.WriteLine (im.InfraredType.ToString () + "------------------------------------------------------");
+ Utlis.WriteLine (im.InfraredType.ToString () + "------------------------------------------------------");
IO.FileUtils.SaveEquipmentMessage (im, im.LoopID.ToString ());
}
break;
}
} catch (Exception ex) {
- Console.WriteLine ("Packet_ReceiveEvent锛�" + ex.ToString ());
+ Utlis.WriteLine ("Packet_ReceiveEvent锛�" + ex.ToString ());
}
}
@@ -2165,6 +2174,7 @@
IO.FileUtils.WriteFileByBytes (Scene.GlobalSceneFilePath, CommonPage.MyEncodingUTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (sceneFileList)));
}
}
+ //Utlis.WriteLine ("鎺ユ敹"+path);
FileUtils.WriteFileByInputStream (path, inputStream);
Common common = Newtonsoft.Json.JsonConvert.DeserializeObject<Common> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (path)));
if (common.DeviceTextID == R.MyInternationalizationString.ElectricalControl) {
@@ -2176,7 +2186,7 @@
outputStream.Flush ();
}
} catch (Exception ex) {
- Console.WriteLine ("httpListener_EventHandler" + ex.ToString ());
+ Utlis.WriteLine ("httpListener_EventHandler" + ex.ToString ());
}
}
--
Gitblit v1.8.0