From 8df24b0a3dfd5b6f39c5393ef24eab25b70ab858 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 11 九月 2020 13:18:33 +0800 Subject: [PATCH] 202009111 --- HDL-ON_Android/Properties/AndroidManifest.xml | 2 HDL_ON/Entity/FunctionList.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs | 2 HDL_ON/DriverLayer/CommonPage.cs | 217 ++------------- HDL_ON/Entity/Function/Function.cs | 495 +++++++++++++++++----------------- HDL_ON/UI/UI0-Public/PublicAssmebly.cs | 12 HDL_ON/Entity/Function/AC.cs | 4 HDL_ON/DriverLayer/Control.cs | 5 HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs | 2 HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs | 1 HDL_ON/UI/UI2/2-Classification/FunctionPageBLL.cs | 15 - .vs/HDL_APP_Project/xs/UserPrefs.xml | 60 --- HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs | 3 HDL_ON/DriverLayer/Control_Bus.cs | 5 14 files changed, 304 insertions(+), 521 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index 61a32d2..e21e2d9 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,53 +1,20 @@ 锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.61286FD1-B849-4457-AA51-F3CD79A395F6" /> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/Entity/Function/Function.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/Entity/FunctionList.cs"> <Files> - <File FileName="HDL_ON/DriverLayer/Control.cs" Line="107" Column="61" /> - <File FileName="HDL_ON/Entity/Enumerative/Command.cs" Line="1561" Column="21" /> - <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs" Line="160" Column="38" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs" Line="392" Column="2" /> - <File FileName="HDL_ON/Entity/AProtocolEntity.cs" Line="10" Column="30" /> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/AC/ACPageBLL.cs" Line="91" Column="35" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/SceneEditPage.cs" Line="466" Column="60" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/SetSceneFunctionInfoPage.cs" Line="150" Column="45" /> - <File FileName="HDL_ON/Entity/Function/Function.cs" Line="157" Column="32" /> + <File FileName="HDL_ON/DriverLayer/CommonPage.cs" Line="169" Column="67" /> + <File FileName="HDL_ON/Entity/Function/Light.cs" Line="91" Column="14" /> + <File FileName="HDL_ON/Entity/Function/AC.cs" Line="303" Column="17" /> + <File FileName="HDL_ON/Entity/Function/Curtain.cs" Line="26" Column="27" /> + <File FileName="HDL_ON/DAL/Net/TcpListener.cs" Line="215" Column="53" /> + <File FileName="HDL_ON/UI/UI0-Public/UpdataTcpResidenceDataDialog.cs" Line="47" Column="64" /> + <File FileName="HDL_ON/Entity/FunctionList.cs" Line="172" Column="44" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> - <Node name="HDL_ON" expanded="True"> - <Node name="DAL" expanded="True"> - <Node name="Net" expanded="True" /> - <Node name="Server" expanded="True" /> - </Node> - <Node name="DriverLayer" expanded="True" /> - <Node name="Entity" expanded="True"> - <Node name="Enumerative" expanded="True" /> - <Node name="Function" expanded="True"> - <Node name="Function.cs" selected="True" /> - </Node> - </Node> - <Node name="UI" expanded="True"> - <Node name="UI0-Public" expanded="True" /> - <Node name="UI1-Login" expanded="True" /> - <Node name="UI2" expanded="True"> - <Node name="1-HomePage" expanded="True" /> - <Node name="2-Classification" expanded="True" /> - <Node name="3-Intelligence" expanded="True" /> - <Node name="FuntionControlView" expanded="True"> - <Node name="AC" expanded="True" /> - <Node name="Curtain" expanded="True" /> - <Node name="Electrical" expanded="True" /> - <Node name="Light" expanded="True" /> - <Node name="Music" expanded="True"> - <Node name="View" expanded="True" /> - </Node> - </Node> - </Node> - </Node> - </Node> - <Node name="HDL-ON_Android" expanded="True" /> + <Node name="HDL-ON_Android" selected="True" /> </Node> </State> </Pad> @@ -64,20 +31,15 @@ <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> <String>Shared.IOS/Shared.IOS.csproj</String> </DisabledProjects> - <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> - <MonoDevelop.Ide.ItemProperties.HDL-ON__Android AndroidDesignerPreferredTheme="AppTheme" AndroidDesignerPreferredDevice="Nexus 4" PreferredExecutionTarget="Android.364c4b3158493098" /> + <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" /> + <MonoDevelop.Ide.ItemProperties.HDL-ON__Android AndroidDesignerPreferredTheme="AppTheme" AndroidDesignerPreferredDevice="Nexus 4" PreferredExecutionTarget="Android.SelectDevice" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore> <Breakpoint file="/Users/nigel/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs" line="115" column="1" /> - <Breakpoint file="/Users/nigel/Desktop/HDL_APP_Project/HDL_ON/DriverLayer/CommonPage.cs" relfile="HDL_ON/DriverLayer/CommonPage.cs" line="395" column="1" /> <Breakpoint file="/Users/nigel/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs" line="351" column="1" /> <Breakpoint file="/Users/nigel/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/FoolHeating/FloorHeatingPage.cs" line="311" column="1" /> - <Breakpoint file="/Users/nigel/Desktop/HDL_APP_Project/HDL_ON/DriverLayer/CommonPage.cs" relfile="HDL_ON/DriverLayer/CommonPage.cs" line="414" column="1" /> <Breakpoint file="/Users/nigel/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditPageBLL.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditPageBLL.cs" line="76" column="1" /> <Breakpoint file="/Users/nigel/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/SetSceneLocationPage.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/SetSceneLocationPage.cs" line="38" column="1" /> - <Breakpoint file="/Users/nigel/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs" line="384" column="1" /> - <Breakpoint file="/Users/nigel/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/SetSceneFunctionInfoPage.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/SetSceneFunctionInfoPage.cs" line="504" column="1" /> - <Breakpoint file="/Users/nigel/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/SetSceneFunctionInfoPage.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/SetSceneFunctionInfoPage.cs" line="144" column="1" /> </BreakpointStore> </MonoDevelop.Ide.DebuggingService.Breakpoints> <MultiItemStartupConfigurations /> diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index ba1db52..1fd4632 100644 --- a/HDL-ON_Android/Properties/AndroidManifest.xml +++ b/HDL-ON_Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ 锘�<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202009094" android:versionName="1.0.1.202009094" package="com.hdl.onpro"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202009111" android:versionName="1.0.1.202009111" package="com.hdl.onpro"> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26" /> <!-- 瀹氫綅鏉冮檺--> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> diff --git a/HDL_ON/DriverLayer/CommonPage.cs b/HDL_ON/DriverLayer/CommonPage.cs index da2744c..92167dd 100644 --- a/HDL_ON/DriverLayer/CommonPage.cs +++ b/HDL_ON/DriverLayer/CommonPage.cs @@ -1,10 +1,8 @@ 锘縰sing System; +using System.Collections.Generic; using System.Text; -using HDL_ON.DAL.Net; using HDL_ON.Entity; using HDL_ON.UI; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using Shared; using Shared.Net; @@ -13,8 +11,6 @@ public static class CommonPage { public static Action RefreshAir; - public static string FindGatewayChilrenIPAddress = new NetWiFi().BroadcastIpAddress.ToString(); - private static string ip = "0.0.0.0"; public static System.Net.IPEndPoint EndPoint { get @@ -28,16 +24,6 @@ //闃叉寮傚父瀵艰嚧绋嬪簭閫�鍑� return new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 6000); } - } - } - - - public static System.Net.IPEndPoint GetGatewayIP_EndPoint - { - get - { - //闃叉寮傚父瀵艰嚧绋嬪簭閫�鍑� - return new System.Net.IPEndPoint(System.Net.IPAddress.Parse("224.0.168.188"), 6688); } } @@ -65,30 +51,6 @@ } } } - //public static bool isHttpListenerStart; - //public static DateTime dt; - //public static byte currentSubnetID = 0; - //public static void InitHttpListener() - //{ - // if (isHttpListenerStart) - // { - // return; - // } - // Console.WriteLine("Init Http Listener !"); - // HttpListener.Start(new NetWiFi().IpAddress, 6002); - // HttpListener.EventHandler -= httpListener_EventHandler; - // HttpListener.EventHandler += httpListener_EventHandler; - // isHttpListenerStart = true; - //} - //public static void CloseHttpListener() - //{ - // //isHttpListenerStart = false; - // //return; - // if (!isHttpListenerStart) - // return; - // HttpListener.Close(); - // isHttpListenerStart = false; - //} /// <summary> /// 鍒濆鍖栧鐞唖ocket鎺ユ敹鐨勬暟鎹� /// </summary> @@ -117,65 +79,54 @@ switch (command) { case Command.SetSingleLightACK: - foreach (var light in DB_ResidenceData.functionList.lights) + var queryList = new List<Function>(); + queryList.AddRange(DB_ResidenceData.functionList.electricals); + queryList.AddRange(DB_ResidenceData.functionList.lights); + foreach (var updataObj in queryList) { - if (light.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) + if (updataObj.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) { - if (light.functionType != FunctionType.RGB) + if (updataObj.functionType != FunctionType.RGB) { - light.trait_on_off.value = receiveBytes[2] == 0 ? "off" : "on"; - if (light.trait_on_off.value.ToString() == "on") + var newState = receiveBytes[2] == 0 ? "off" : "on"; + if (updataObj.trait_on_off.value.ToString() == newState) { - light.brightness = receiveBytes[2]; - light.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%"; + //鐘舵�佷竴鏍凤紝涓嶇敤鍐嶅埛鏂伴〉闈� + break; } - HomePage.UpdataFunctionStates(light); - RoomPage.UpdataStates(light); - FunctionPage.UpdataStates(light); - ClassificationPage.UpdataInfo(light); - switch (light.functionType) + if (updataObj.trait_on_off.value.ToString() == "on") + { + if (updataObj.functionType == FunctionType.Fan) + { + (updataObj as Fan).openLevel = receiveBytes[2]; + updataObj.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2]; + } + else + { + (updataObj as Light).brightness = receiveBytes[2]; + updataObj.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[2] + "%"; + } + } + HomePage.UpdataFunctionStates(updataObj); + RoomPage.UpdataStates(updataObj); + FunctionPage.UpdataStates(updataObj); + ClassificationPage.UpdataInfo(updataObj); + switch (updataObj.functionType) { case FunctionType.Relay: - RelayPage.UpdataState(light); + RelayPage.UpdataState(updataObj as Light); break; case FunctionType.Dimmer: - DimmerPage.UpdataStates(light); + DimmerPage.UpdataStates(updataObj as Light); break; - } - } - } - } - - foreach (var e in DB_ResidenceData.functionList.electricals) - { - if (e.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) - { - if (e.functionType == FunctionType.Fan) - { - var fan = e as Fan; - fan.trait_on_off.value = receiveBytes[2] == 0 ? "off" : "on"; - if (fan.trait_on_off.value == "on") - { - fan.openLevel = receiveBytes[2]; - fan.lastState = Language.StringByID(StringId.Level) + " : " + receiveBytes[2]; - } - HomePage.UpdataFunctionStates(fan); - RoomPage.UpdataStates(fan); - FunctionPage.UpdataStates(fan); - ClassificationPage.UpdataInfo(fan); - switch (fan.functionType) - { case FunctionType.Fan: - FanPage.UpdataState(fan); - break; - case FunctionType.Socket: - + FanPage.UpdataState(updataObj as Fan); break; } + break; } } } - break; case Command.ReadLightAllLoopBrightnessACK: for (int i = 0; i < receiveBytes[0]; i++) @@ -455,7 +406,6 @@ case Command.ReadDeviceLoopInfoACK: FunctionType dt = (FunctionType)(11 * 256 + receiveBytes[1]); string tag = receiveBytes[1] + "_" + subnetID + "_" + deviceID + "_" + receiveBytes[2]; - foreach (var sensor in DB_ResidenceData.functionList.sensorsEnvironmentalScience) { if (sensor.bus_Data != null) @@ -567,39 +517,6 @@ HomePage.UpdataFunctionStates(ac); ClassificationPage.UpdataInfo(ac); ACPage.UpdataStates(ac); - //else if (common.Type == DeviceType.FoolHeatPanel) - { - //switch (receiveBytes[0]) - //{ - // case 20:// - // fh.Status = receiveBytes[1]; - // break; - // case 21: - // fh.TemperatureType = receiveBytes[1]; - // if (receiveBytes[1] == 5) - // { - // if (fh.Timer == 0)//鏃堕棿妯″紡鐨勬椂闂存鏍囧織 (0锛氱櫧澶╋紝1锛氬鏅�) (1byte) //20110112鍔犳椂闂存鏍囧織 - // Control.ControlBytesSend(Command.ReadInstructionPanelKey, fh.SubnetID, fh.DeviceID, new byte[] { 26, 2, fh.LoopID }, SendCount.Zero); - // else - // Control.ControlBytesSend(Command.ReadInstructionPanelKey, fh.SubnetID, fh.DeviceID, new byte[] { 27, 3, fh.LoopID }, SendCount.Zero); - // } - // else - // Control.ControlBytesSend(Command.ReadInstructionPanelKey, fh.SubnetID, fh.DeviceID, new byte[] { (byte)(receiveBytes[1] + 24), fh.LoopID }, SendCount.Zero); - // break; - // case 25: - // fh.NormalTemperature = receiveBytes[1]; - // break; - // case 26: - // fh.DayTemperature = receiveBytes[1]; - // break; - // case 27: - // fh.NightTemperature = receiveBytes[1]; - // break; - // case 28: - // fh.AwayTemperature = receiveBytes[1]; - // break; - //} - } } } break; @@ -612,12 +529,6 @@ ac.indoorTemp = receiveBytes[1]; FunctionPage.UpdataStates(ac); } - //else if (common.Type == DeviceType.FoolHeatPanel) - // { - // var tempFH22 = common as FoolHeatPanel; - // tempFH22.IndoorTemperature = receiveBytes[1]; - // UserFHPage.UpdateIndoorTemp(tempFH22.CommonLoopID, receiveBytes[1]); - // } } break; } @@ -641,67 +552,5 @@ } return s;// } - /* 2020-09-01寮冪敤锛屼娇鐢╰cp鎺ユ敹鏁版嵁 - static void httpListener_EventHandler(System.Collections.Specialized.NameValueCollection nameValueCollection, System.IO.Stream outputStream, System.IO.Stream inputStream) - { - try - { - if (nameValueCollection["Command"] != null && nameValueCollection["Command"].StartsWith("Get")) - { - string tempFileName = nameValueCollection["Command"].Replace("Get", ""); - if ("AllFiles" == tempFileName) - { - byte[] bytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(FileUtils.ReadFiles())); - outputStream.Write(bytes, 0, bytes.Length); - outputStream.Flush(); - } - else - { - byte[] bytes; - if (!FileUtils.Exists(tempFileName)) - { - bytes = Encoding.UTF8.GetBytes("鏂囦欢鍚嶄笉瀛樺湪锛�"); - outputStream.Write(bytes, 0, bytes.Length); - outputStream.Flush(); - return; - } - System.IO.FileStream fs = new System.IO.FileStream(Application.RootPath + tempFileName, System.IO.FileMode.Open); - bytes = new byte[fs.Length]; - fs.Read(bytes, 0, bytes.Length); - fs.Close(); - outputStream.Write(bytes, 0, bytes.Length); - outputStream.Flush(); - } - } - else if (nameValueCollection["Command"].StartsWith("Upload")) - { - string path = Application.RootPath + nameValueCollection["Command"].Replace("Upload", ""); - string dePath = nameValueCollection["Command"].Replace("Upload", ""); - FileUtils.WriteFileByInputStream(path, inputStream); - var reString = CommonPage.MyEncodingUTF8.GetString(FileUtils.ReadFile(path)); - var common = JsonConvert.DeserializeObject<AProtocolEntity>(reString); - //Console.WriteLine(common.ToString()); - if(dePath == "FunctionList") - { - foreach(var obj in common.objects) - { - DB_ResidenceData.functionList.AddFunction(obj); - } - DB_ResidenceData.functionList.GetAllFunction(); - } - } - else - { - byte[] bytes = System.Text.Encoding.UTF8.GetBytes("璇锋眰鍛戒护鏃犳晥锛�"); - outputStream.Write(bytes, 0, bytes.Length); - outputStream.Flush(); - } - } - catch (Exception ex) - { - MainPage.Log("httpListener_EventHandler" + ex.ToString()); - } - } - */ } } \ No newline at end of file diff --git a/HDL_ON/DriverLayer/Control.cs b/HDL_ON/DriverLayer/Control.cs index 6f71392..ed96608 100644 --- a/HDL_ON/DriverLayer/Control.cs +++ b/HDL_ON/DriverLayer/Control.cs @@ -219,7 +219,6 @@ var deviceId = function.bus_Data.DeviceID; var loopId = function.bus_Data.LoopID; - switch (function.functionCategory) { case FunctionCategory.Light: @@ -501,7 +500,7 @@ { case FunctionType.Fan: var fan = function as Fan; - ControlBytesSend(Command.SetSingleLightACK, subnetId, deviceId, new byte[] { fan.bus_Data.LoopID }); + ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { fan.bus_Data.LoopID }); break; } break; @@ -510,7 +509,7 @@ { case FunctionType.Socket: var s = function as SwitchSocket; - ControlBytesSend(Command.SetSingleLightACK, subnetId, deviceId, new byte[] { s.bus_Data.LoopID }); + ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { s.bus_Data.LoopID }); break; } break; diff --git a/HDL_ON/DriverLayer/Control_Bus.cs b/HDL_ON/DriverLayer/Control_Bus.cs index 5d5dc30..b73abd8 100644 --- a/HDL_ON/DriverLayer/Control_Bus.cs +++ b/HDL_ON/DriverLayer/Control_Bus.cs @@ -1,14 +1,11 @@ 锘縰sing System; using System.Collections.Generic; -using System.Net.Sockets; using System.Text; using HDL_ON.DAL; using HDL_ON.DAL.Net; using HDL_ON.Entity; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Shared; -using Shared.Net; namespace HDL_ON { @@ -816,7 +813,7 @@ var sendJob = new JObject {{ "command", "search" } }; var SearchGateway = JsonConvert.SerializeObject(sendJob); var SearchGatewayPayload = Encoding.ASCII.GetBytes(SearchGateway); - Packet = new Packet(SearchGatewayPayload, CommonPage.GetGatewayIP_EndPoint); + Packet = new Packet(SearchGatewayPayload, new System.Net.IPEndPoint(System.Net.IPAddress.Parse("224.0.168.188"), 6688)); System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(managerSendCount)); thread.IsBackground = true; thread.Start(Packet); diff --git a/HDL_ON/Entity/Function/AC.cs b/HDL_ON/Entity/Function/AC.cs index 83eda9e..952b8b2 100644 --- a/HDL_ON/Entity/Function/AC.cs +++ b/HDL_ON/Entity/Function/AC.cs @@ -1,8 +1,5 @@ 锘縰sing System; -using System.Collections; using System.Collections.Generic; -using Newtonsoft.Json.Linq; -using Shared; namespace HDL_ON.Entity { @@ -257,7 +254,6 @@ return _trait_temp; } } - Trait _trait_swting; [Newtonsoft.Json.JsonIgnore] diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 924ddcc..053e45b 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -1,12 +1,253 @@ 锘縰sing System; using System.Collections.Generic; -using System.Linq; -using Newtonsoft.Json.Linq; -using HDL_ON; using Shared; namespace HDL_ON.Entity { + /// <summary> + /// 鍔熻兘绫昏兘婊¤冻鏁版嵁浣跨敤瑕佹眰锛屽瓙绫诲彧鏄负浜嗘柟渚夸娇鐢ㄥ睘鎬� + /// </summary> + public class Function + { + public Function() + { + } + /// <summary> + /// 鏁版嵁瀛樺偍鏂囦欢鍚� + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public string savePath + { + get + { + return "FunctionData_" + sid; + } + } + + #region base info + /// <summary> + /// HDL缁熶竴鍗忚鏍煎紡锛�14bytes + /// 涓句緥锛� 鏉ユ簮 鍘傚晢浠g爜 閫氳鏂瑰紡 浜у搧鏃堕棿鎴� 浜у搧绫诲埆 鐗╂ā鍨嬬被 閫氶亾鍙� 澶у皬绫诲埆 + // 1byte 1byte 1byte 4byte 1byte 2byte 2byte 2byte + /// 鏉ユ簮锛�00 榛樿鍘熺敓鎬佺郴缁熸暟鎹� 銆�01 缃戝叧鎴栬�呭叾浠朅璁惧銆�02 璋冭瘯杞欢銆�03 APP搴旂敤绋嬪簭銆�04 绗笁鏂圭綉鍏虫垨鑰呭钩鍙� + /// 鍘傚晢浠g爜锛�01 HDL + /// 閫氳鏂瑰紡锛�01 HDL Bus銆�02 Zigbee銆�03 KNX銆�04 Z-Wave + /// 浜у搧鏃堕棿鎴筹細4bytes 浠�2020骞�1鏈�1鏃ョ畻鍑虹殑鏃堕棿鎴�0.1s涓哄崟浣� + /// 浜у搧绫诲埆锛�01 璋冨厜鍣ㄣ��02 缁х數鍣ㄣ��03 骞叉帴鐐规ā鍧椼��04 浼犳劅鍣ㄣ��05 闈㈡澘 + /// 鐗╂ā鍨嬬被鍨嬶細 + /// 01 寮�鍏崇被锛�01 寮�鍏炽��02 鎻掑骇銆�03 + /// 02 鐓ф槑锛� 01 寮�鍏炽��02 璋冨厜銆�03 鑹叉俯銆�04 LED + /// 03 閬槼锛� 01 绐楀笜鐢垫満銆�02 鐧惧彾绐椼��03 寮�鍚堝笜銆�04 鍗峰笜 + /// 04 鎭掓俯鍣細01 绌鸿皟銆�02 鍦版殩銆�03 姣涚粏绌鸿皟 + /// 05 鏂伴 + /// 06 褰遍煶 + /// 07 闊充箰 + /// 08 鑳芥簮 + /// 09 瀹夐槻 + /// 澶х被鍒� 1bytes 锛堥鐣欙級 + /// 灏忕被鍒� 1byte 锛堥鐣欙級 + /// </summary> + public string sid = "0301011234567801012301230123"; + + /// <summary> + /// A鍗忚鍔熻兘鐨勭壒鎬� + /// 濡傦細鏄疉C鍔熻兘锛氱壒鎬э細on_off,mode,fan,temperature + /// attri + /// </summary> + public List<Trait> function = new List<Trait>(); + + /// <summary> + /// 鎴块棿ID鍒楄〃 + /// 璇ュ姛鑳芥坊鍔犲埌鍒版埧闂村垪琛� + /// </summary> + public List<string> roomIdList = new List<string>(); + + /// <summary> + /// bus鍗忚鏁版嵁鏍煎紡 + /// 浣跨敤A鍗忚鎺у埗鏃讹紝鏀瑰睘鎬т负绌� + /// </summary> + public BusData bus_Data; + /// <summary> + /// 寤舵椂 + /// </summary> + public int delay = 0; + /// <summary> + /// 寤舵椂鏄剧ず鐨勬枃鏈� + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public string delayText + { + get + { + string text = ""; + switch (delay) + { + case 0: + text = Language.StringByID(StringId.NoDelay); + break; + case 30: + text = "30s"; + break; + case 60: + text = "1min"; + break; + case 120: + text = "2min"; + break; + case 300: + text = "5min"; + break; + } + return text; + } + } + #endregion + + /// <summary> + /// 鍔熻兘绫诲埆 + /// 濡傦細绌鸿皟绫汇�佺伅鍏夌被銆佺獥甯樼被 + /// </summary> + public FunctionCategory functionCategory + { + get + { + try + { + var _functionCategoryString = sid.Substring(16, 2); + var _functionCategory = Convert.ToInt32(_functionCategoryString, 16); + return (FunctionCategory)Enum.ToObject(typeof(FunctionCategory), _functionCategory); + } + catch (Exception ex) + { + MainPage.Log($"get FunctionCategory error : {ex.Message}"); + return FunctionCategory.UnKown; + } + } + } + + public FunctionType functionType + { + get + { + var _functionTypeString = sid.Substring(16, 4); + return (FunctionType)Enum.ToObject(typeof(FunctionType), Convert.ToInt32(_functionTypeString, 16)); + } + } + + /// <summary> + /// 澶囨敞 + /// </summary> + public string name; + + /// <summary> + /// 鏈�鍚庢帶鍒剁殑涓�娆$姸鎬� + /// </summary> + [Newtonsoft.Json.JsonIgnore] + public string lastState = ""; + + Trait _trait_on_off; + [Newtonsoft.Json.JsonIgnore] + public Trait trait_on_off + { + get + { + if (_trait_on_off == null) + { + _trait_on_off = function.Find((obj) => obj.name == "on_off"); + //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� + if (_trait_on_off == null) + { + _trait_on_off = new Trait() + { + name = "on_off", + value_key = new List<string> { "on", "off" }, + max = 1, + min = 0, + }; + } + _trait_on_off.value = "on"; + } + return _trait_on_off; + } + //set + //{ + // _trait_on_off = value; + //} + } + + /// <summary> + /// 鏄惁鏀惰棌 + /// </summary> + public bool collection = false; + + /// <summary> + /// 浣跨敤娆℃暟 + /// </summary> + public double usageCount = 0; + /// <summary> + /// 浣跨敤棰戠巼 + /// </summary> + public double usageFrequency { + get + { + return usageCount / 7; + } + } + /// <summary> + /// 鍥哄畾鐨勫簭鍙� + /// </summary> + public int fixedSerialNumber = int.MaxValue; + + public string GetBusId () + { + string busId = ""; + if (bus_Data != null) + { + busId = bus_Data.SubnetID + "_" + bus_Data.DeviceID + "_" + bus_Data.LoopID; + } + return busId; + } + + /// <summary> + /// 鑾峰彇璁惧娣诲姞鍒版埧闂寸殑鎴块棿鍚嶇О + /// </summary> + /// <returns></returns> + public string GetRoomListName() + { + string roomNameList = ""; + foreach(var roomId in roomIdList) + { + var findRoom = DB_ResidenceData.rooms.Find(obj => obj.sid == roomId); + if (findRoom == null) + continue; + if(roomNameList != "") + { + roomNameList += ","; + } + roomNameList += findRoom.floorName + findRoom.name; + } + if (roomNameList == "" && functionType == FunctionType.Scene) + { + roomNameList = Language.StringByID(StringId.WholeHouseScene); + } + return roomNameList; + } + /// <summary> + /// 淇濆瓨鍔熻兘鏁版嵁 + /// </summary> + public void SaveFunctionData() + { + var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); + FileUtils.WriteFileByBytes("FunctionData_" + this.sid, ssd); + MainPage.Log($"Save FunctionData {this.functionType} : {this.sid}"); + } + + /// <summary> + /// 鏇存柊鏃堕棿 + /// </summary> + public DateTime refreshTime = DateTime.MinValue; + } + /// <summary> /// 鍔熻兘灞炴�� /// 灞炴�у瓧娈佃В鏋愶細attri :灞炴�у唴瀹癸紝value 灞炴�х殑鍊硷紝max 鏈�澶у�� min 鏈�灏忓�� @@ -22,7 +263,8 @@ /// 灞炴�х殑鍊煎垪琛� /// </summary> [Newtonsoft.Json.JsonIgnore] - public List<string> value_key { + public List<string> value_key + { get { return _value_key; @@ -62,12 +304,12 @@ { get { - if(!string.IsNullOrEmpty( _uintString)) + if (!string.IsNullOrEmpty(_uintString)) { return _uintString; } var us = ""; - switch(name) + switch (name) { case "temperature": us = "掳C"; @@ -327,245 +569,4 @@ public string channels; } - - public class Function - { - public Function() - { - } - /// <summary> - /// 鏁版嵁瀛樺偍鏂囦欢鍚� - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public string savePath - { - get - { - return "FunctionData_" + sid; - } - } - - #region base info - /// <summary> - /// HDL缁熶竴鍗忚鏍煎紡锛�14bytes - /// 涓句緥锛� 鏉ユ簮 鍘傚晢浠g爜 閫氳鏂瑰紡 浜у搧鏃堕棿鎴� 浜у搧绫诲埆 鐗╂ā鍨嬬被 閫氶亾鍙� 澶у皬绫诲埆 - // 1byte 1byte 1byte 4byte 1byte 2byte 2byte 2byte - /// 鏉ユ簮锛�00 榛樿鍘熺敓鎬佺郴缁熸暟鎹� 銆�01 缃戝叧鎴栬�呭叾浠朅璁惧銆�02 璋冭瘯杞欢銆�03 APP搴旂敤绋嬪簭銆�04 绗笁鏂圭綉鍏虫垨鑰呭钩鍙� - /// 鍘傚晢浠g爜锛�01 HDL - /// 閫氳鏂瑰紡锛�01 HDL Bus銆�02 Zigbee銆�03 KNX銆�04 Z-Wave - /// 浜у搧鏃堕棿鎴筹細4bytes 浠�2020骞�1鏈�1鏃ョ畻鍑虹殑鏃堕棿鎴�0.1s涓哄崟浣� - /// 浜у搧绫诲埆锛�01 璋冨厜鍣ㄣ��02 缁х數鍣ㄣ��03 骞叉帴鐐规ā鍧椼��04 浼犳劅鍣ㄣ��05 闈㈡澘 - /// 鐗╂ā鍨嬬被鍨嬶細 - /// 01 寮�鍏崇被锛�01 寮�鍏炽��02 鎻掑骇銆�03 - /// 02 鐓ф槑锛� 01 寮�鍏炽��02 璋冨厜銆�03 鑹叉俯銆�04 LED - /// 03 閬槼锛� 01 绐楀笜鐢垫満銆�02 鐧惧彾绐椼��03 寮�鍚堝笜銆�04 鍗峰笜 - /// 04 鎭掓俯鍣細01 绌鸿皟銆�02 鍦版殩銆�03 姣涚粏绌鸿皟 - /// 05 鏂伴 - /// 06 褰遍煶 - /// 07 闊充箰 - /// 08 鑳芥簮 - /// 09 瀹夐槻 - /// 澶х被鍒� 1bytes 锛堥鐣欙級 - /// 灏忕被鍒� 1byte 锛堥鐣欙級 - /// </summary> - public string sid = "0301011234567801012301230123"; - - /// <summary> - /// A鍗忚鍔熻兘鐨勭壒鎬� - /// 濡傦細鏄疉C鍔熻兘锛氱壒鎬э細on_off,mode,fan,temperature - /// attri - /// </summary> - public List<Trait> function = new List<Trait>(); - - /// <summary> - /// 鎴块棿ID鍒楄〃 - /// 璇ュ姛鑳芥坊鍔犲埌鍒版埧闂村垪琛� - /// </summary> - public List<string> roomIdList = new List<string>(); - - /// <summary> - /// bus鍗忚鏁版嵁鏍煎紡 - /// 浣跨敤A鍗忚鎺у埗鏃讹紝鏀瑰睘鎬т负绌� - /// </summary> - public BusData bus_Data; - /// <summary> - /// 寤舵椂 - /// </summary> - public int delay = 0; - /// <summary> - /// 寤舵椂鏄剧ず鐨勬枃鏈� - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public string delayText - { - get - { - string text = ""; - switch (delay) - { - case 0: - text = Language.StringByID(StringId.NoDelay); - break; - case 30: - text = "30s"; - break; - case 60: - text = "1min"; - break; - case 120: - text = "2min"; - break; - case 300: - text = "5min"; - break; - } - return text; - } - } - #endregion - - /// <summary> - /// 鍔熻兘绫诲埆 - /// 濡傦細绌鸿皟绫汇�佺伅鍏夌被銆佺獥甯樼被 - /// </summary> - public FunctionCategory functionCategory - { - get - { - try - { - var _functionCategoryString = sid.Substring(16, 2); - var _functionCategory = Convert.ToInt32(_functionCategoryString, 16); - return (FunctionCategory)Enum.ToObject(typeof(FunctionCategory), _functionCategory); - } - catch (Exception ex) - { - MainPage.Log($"get FunctionCategory error : {ex.Message}"); - return FunctionCategory.UnKown; - } - } - } - - public FunctionType functionType - { - get - { - var _functionTypeString = sid.Substring(16, 4); - return (FunctionType)Enum.ToObject(typeof(FunctionType), Convert.ToInt32(_functionTypeString, 16)); - } - } - - /// <summary> - /// 澶囨敞 - /// </summary> - public string name; - - /// <summary> - /// 鏈�鍚庢帶鍒剁殑涓�娆$姸鎬� - /// </summary> - [Newtonsoft.Json.JsonIgnore] - public string lastState = ""; - - Trait _trait_on_off; - [Newtonsoft.Json.JsonIgnore] - public Trait trait_on_off - { - get - { - if (_trait_on_off == null) - { - _trait_on_off = function.Find((obj) => obj.name == "on_off"); - //鎵句笉鍒板睘鎬ч渶瑕佸0鏄庝竴涓紝闃叉鎶ラ敊闂�� - if (_trait_on_off == null) - { - _trait_on_off = new Trait() - { - name = "on_off", - value_key = new List<string> { "on", "off" }, - max = 1, - min = 0, - }; - } - _trait_on_off.value = "on"; - } - return _trait_on_off; - } - //set - //{ - // _trait_on_off = value; - //} - } - - /// <summary> - /// 鏄惁鏀惰棌 - /// </summary> - public bool collection = false; - - /// <summary> - /// 浣跨敤娆℃暟 - /// </summary> - public double usageCount = 0; - /// <summary> - /// 浣跨敤棰戠巼 - /// </summary> - public double usageFrequency { - get - { - return usageCount / 7; - } - } - /// <summary> - /// 鍥哄畾鐨勫簭鍙� - /// </summary> - public int fixedSerialNumber = int.MaxValue; - - public string GetBusId () - { - string busId = ""; - if (bus_Data != null) - { - busId = bus_Data.SubnetID + "_" + bus_Data.DeviceID + "_" + bus_Data.LoopID; - } - return busId; - } - - /// <summary> - /// 鑾峰彇璁惧娣诲姞鍒版埧闂寸殑鎴块棿鍚嶇О - /// </summary> - /// <returns></returns> - public string GetRoomListName() - { - string roomNameList = ""; - foreach(var roomId in roomIdList) - { - var findRoom = DB_ResidenceData.rooms.Find(obj => obj.sid == roomId); - if (findRoom == null) - continue; - if(roomNameList != "") - { - roomNameList += ","; - } - roomNameList += findRoom.floorName + findRoom.name; - } - if (roomNameList == "" && functionType == FunctionType.Scene) - { - roomNameList = Language.StringByID(StringId.WholeHouseScene); - } - return roomNameList; - } - /// <summary> - /// 淇濆瓨鍔熻兘鏁版嵁 - /// </summary> - public void SaveFunctionData() - { - var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); - FileUtils.WriteFileByBytes("FunctionData_" + this.sid, ssd); - MainPage.Log($"Save FunctionData {this.functionType} : {this.sid}"); - } - - /// <summary> - /// 鏇存柊鏃堕棿 - /// </summary> - public DateTime refreshTime = DateTime.MinValue; - } } diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index c2fafac..74a3890 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -168,6 +168,8 @@ sidObj2.SaveFunctionData(); break; case FunctionType.Curtain: + case FunctionType.RollingShutter: + case FunctionType.MotorCurtain: var sidObj3 = Newtonsoft.Json.JsonConvert.DeserializeObject<Curtain>(Newtonsoft.Json.JsonConvert.SerializeObject(sidObj0)); DB_ResidenceData.functionList.curtains.Add(sidObj3 ); sidObj3.SaveFunctionData(); diff --git a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs index d5a779c..0b0a36d 100644 --- a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs +++ b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs @@ -276,22 +276,12 @@ }; contentView.AddChidren(btnCancel); - //Button btnBottomLine = new Button() - //{ - // X = btnCancel.Right, - // Y = btnLine.Bottom, - // Height = Application.GetRealHeight(43), - // Width = Application.GetRealWidth(1), - // BackgroundColor = CSS_Color.DividingLineColor, - //}; - //contentView.AddChidren(btnBottomLine); - Button btnConfirm = new Button() { X = btnCancel.Right, Y = btnLine.Y, Width = Application.GetRealWidth(135), - Height = Application.GetRealHeight(43 + 1), + Height = Application.GetRealHeight(45), TextAlignment = TextAlignment.Center, //TextColor = CSS_Color.TextualColor, TextSize = CSS_FontSize.SubheadingFontSize, diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs index e1f0b03..e024ef2 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs @@ -35,7 +35,6 @@ return; } } - //if(updataFunction.roomIdList.Contains(Room)) for (int i = 0; i < scrolView.ChildrenCount; i++) { if (scrolView.GetChildren(i).Tag == null || scrolView.GetChildren(i).Tag.ToString() == "") diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs index 5631d77..1df2ad4 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs @@ -10,6 +10,8 @@ { /// <summary> /// 鏇存柊鐣岄潰淇℃伅 + /// 鏇存柊鍔熻兘鎵撳紑鏁伴噺 + /// 鏇存柊鍏ㄥ叧鍔熻兘鐘舵�� /// </summary> /// <param name="function"></param> public static void UpdataInfo(Function function) diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionPageBLL.cs b/HDL_ON/UI/UI2/2-Classification/FunctionPageBLL.cs index a9e2f76..3cbb80b 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionPageBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionPageBLL.cs @@ -5,26 +5,13 @@ public partial class FunctionPage { /// <summary> - /// 鏇存柊鍔熻兘鐘舵�� + /// 鏇存柊鍔熻兘鍒楄〃鐣岄潰鍔熻兘鐘舵�� /// </summary> /// <param name="function"></param> public static void UpdataStates(Function function) { new ClassificaitionPublicBLL().UpdataStates(function, bodyView, functionListView); - UpdataOnCount(function.functionType); } - static void UpdataOnCount(FunctionType functionType) - { - switch(functionType) - { - case FunctionType.AC: - - break; - case FunctionType.Curtain: - - break; - } - } } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs index b33d810..80caa4f 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs @@ -25,7 +25,7 @@ /// </summary> void LoadEvent_Option() { - btnOption.MouseUpEventHandler += (sender, e) => + btnOption.MouseUpEventHandler = (sender, e) => { if (btnOption.TextID == StringId.Save) { @@ -58,6 +58,7 @@ } } DB_ResidenceData.rooms.Add(room); + room.SaveRoomData(); backAction(); this.RemoveFromParent(); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs index df8ab1c..f7cc34d 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs @@ -158,7 +158,6 @@ TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, Text = light.brightness + "%", - BackgroundColor = 0xFF000FFF }; controlView.AddChidren(btnBrightnessText); @@ -232,7 +231,6 @@ UnSelectedImagePath = "Public/PowerClose.png", SelectedImagePath = "Public/PowerOpen.png", IsSelected = light.trait_on_off.value.ToString() == "on", - //Tag = }; controlView.AddChidren(btnSwitch); -- Gitblit v1.8.0