From b4ee7bafc83d9b0b5b7d3cc7c369bd39f796eba5 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 10 六月 2022 09:17:29 +0800 Subject: [PATCH] 代码备份 --- HDL-ON_Android/Properties/AndroidManifest.xml | 2 HDL-ON_Android/Assets/Phone/FunctionIcon/FloorHeating/EconomicIcon.png | 0 HDL_ON/DAL/DriverLayer/Control_Udp.cs | 1 HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs | 3 HDL_ON/DAL/Mqtt/MqttClient.cs | 7 HDL_ON/Entity/Function/FloorHeating.cs | 20 ++++ HDL-ON_Android/HDL-ON_Android.csproj | 2 HDL_ON/DAL/Server/HttpUtil.cs | 4 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 2 HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs | 34 ++++++ HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/FhControlPage.cs | 162 ++++++++++++++++++++++++++++++++ HDL_ON/DAL/DriverLayer/Packet.cs | 1 HDL_ON/DAL/DriverLayer/Control.cs | 6 HDL-ON_Android/Assets/Phone/FunctionIcon/FloorHeating/EconomicIconGray.png | 0 SiriIntents/Server/HttpUtil.cs | 4 15 files changed, 231 insertions(+), 17 deletions(-) diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/FloorHeating/EconomicIcon.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/FloorHeating/EconomicIcon.png new file mode 100644 index 0000000..0848837 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/FloorHeating/EconomicIcon.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/FloorHeating/EconomicIconGray.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/FloorHeating/EconomicIconGray.png new file mode 100644 index 0000000..74300b8 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/FloorHeating/EconomicIconGray.png Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index d236f95..37a7888 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -243,6 +243,8 @@ <AndroidAsset Include="Assets\Phone\FunctionIcon\Panel\PanelHelpNormalBgIcon.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\screenpanel.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Panel\PanelEnviBg.png" /> + <AndroidAsset Include="Assets\Phone\FunctionIcon\FloorHeating\EconomicIcon.png" /> + <AndroidAsset Include="Assets\Phone\FunctionIcon\FloorHeating\EconomicIconGray.png" /> </ItemGroup> <ItemGroup> <AndroidResource Include="Resources\values\colors.xml" /> diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index 5227491..3bcb874 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:versionName="1.5.6" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202206011"> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.5.6" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202206082"> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" /> <!--鍙嬬洘--> <!--<uses-sdk android:minSdkVersion="8"></uses-sdk>--> diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 5672c7a..c5cd85e 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -280,7 +280,8 @@ } if (DB_ResidenceData.Instance.GatewayType == 0) { - new Control_Udp().ControlBytesSend(Command.ReadGateway, 255, 255, new byte[] { (byte)new Random().Next(255), (byte)new Random().Next(255) }); + new Control_Udp().ControlBytesSend(Command.ReadGateway, 255, 255, + new byte[] { (byte)new Random().Next(255), (byte)new Random().Next(255) }); } else if (DB_ResidenceData.Instance.GatewayType == 1) { @@ -1051,9 +1052,6 @@ } } } - - - var localFunction = allLocalFuntion.Find((obj) => obj.sid == updateTemp.sid); if (localFunction == null) diff --git a/HDL_ON/DAL/DriverLayer/Control_Udp.cs b/HDL_ON/DAL/DriverLayer/Control_Udp.cs index 6991ad8..e6eba3b 100644 --- a/HDL_ON/DAL/DriverLayer/Control_Udp.cs +++ b/HDL_ON/DAL/DriverLayer/Control_Udp.cs @@ -162,7 +162,6 @@ /// <summary> /// 鎺у埗bus鍦烘櫙 - /// todo /// </summary> public void ControlBusScenes(Scene scene) { diff --git a/HDL_ON/DAL/DriverLayer/Packet.cs b/HDL_ON/DAL/DriverLayer/Packet.cs index 3e07ff2..19e93d7 100644 --- a/HDL_ON/DAL/DriverLayer/Packet.cs +++ b/HDL_ON/DAL/DriverLayer/Packet.cs @@ -111,7 +111,6 @@ /// <summary> /// 鏁版嵁鍖呭鐞� - /// ps:鐢眂ommonpage杞Щ杩囨潵锛岃繕闇�瑕佽浆绉诲悎閫傜殑浣嶇疆绠$悊 /// </summary> /// <param name="subnetID"></param> /// <param name="deviceID"></param> diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index 882cf3b..f5abbf2 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -483,7 +483,8 @@ { try { - var securityBytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, DB_ResidenceData.Instance.HomeGateway.aesKey); + var securityBytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, + DB_ResidenceData.Instance.HomeGateway.aesKey); var securityString = Encoding.UTF8.GetString(securityBytes); var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<SecurityStatusObj>(securityString); MainPage.Log($"瀹夐槻鐘舵�佸彉鍖栵細{securityString}"); @@ -519,7 +520,6 @@ MainPage.Log($"mqtt 鐘舵�佹洿鏂�:{revString}"); Control.Ins.UpdataFunctionStatus(revString, null, true); //Control.Ins.MsgInfoList.Add($"mqtt 鐘舵�佹洿鏂�:{revString}"); - //Control.Ins.MsgInfoList.Add(revString + "\r\n"); } //涓�绔彛鏁版嵁瑙f瀽 @@ -532,7 +532,8 @@ if (!string.IsNullOrEmpty(DB_ResidenceData.Instance.HomeGateway.aesKey)) { - packet.Bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, DB_ResidenceData.Instance.HomeGateway.aesKey); + packet.Bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, + DB_ResidenceData.Instance.HomeGateway.aesKey); } else { diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index 82b6dd0..ce16936 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -17,8 +17,8 @@ /// 鍥哄畾鍩熷悕,姝e紡鐜 /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> - public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm /// <summary> /// RegionMark /// </summary> diff --git a/HDL_ON/Entity/Function/FloorHeating.cs b/HDL_ON/Entity/Function/FloorHeating.cs index 30ef6c0..1eb0352 100644 --- a/HDL_ON/Entity/Function/FloorHeating.cs +++ b/HDL_ON/Entity/Function/FloorHeating.cs @@ -150,6 +150,26 @@ /// </summary> public byte timeFlag = 0; + public string GetWrokModeIconPath(string value, bool lighting = true) + { + var imagePath = "FunctionIcon/AC/HeatingIcon.png"; + + switch (value) + { + case "heat": + imagePath = lighting ? "FunctionIcon/AC/HeatingIcon.png" : "FunctionIcon/AC/HeatingIconGray.png"; + break; + case "cool": + imagePath = lighting ? "FunctionIcon/AC/CoolIcon.png" : "FunctionIcon/AC/CoolIconGray.png"; + break; + case "economic": + imagePath = lighting ? "FunctionIcon/FloorHeating/EconomicIcon.png" : "FunctionIcon/FloorHeating/EconomicIconGray.png"; + break; + } + + return imagePath; + } + /// <summary> /// 鑾峰彇妯″紡鐨刬con璺緞 /// <param name="lightingIcon">鑾峰彇鐨勫浘鏍囩被鍨嬶紝榛樿鏄偣浜�</param> diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs index d863ed5..c988fc3 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs @@ -630,7 +630,7 @@ functionTypeList.Add(SPK.ElectricSocket); functionTypeList.Add(SPK.HvacCac); functionTypeList.Add(SPK.SensorHelp); - + functionTypeList.Add(SPK.DoorLock); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/FhControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/FhControlPage.cs index b05b80e..100e277 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/FhControlPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/FhControlPage.cs @@ -36,6 +36,11 @@ /// </summary> Button btnMode; /// <summary> + /// 宸ヤ綔妯″紡鎸夐挳 + /// </summary> + Button btnWrokMode; + + /// <summary> /// 寮�鍏虫寜閽� /// </summary> Button btnSwitch; @@ -172,6 +177,25 @@ }; FrameWhiteCentet1.AddChidren(btnPlus); + if (device.GetAttribute("mode_work") != null) + { + btnWrokMode = new Button() + { + X = Application.GetRealWidth(60), + Y = Application.GetRealHeight(334), + Width = Application.GetRealWidth(30), + Height = Application.GetRealWidth(30), + UnSelectedImagePath = fhTemp.GetWrokModeIconPath(device.GetAttrState("mode_work")), + }; + FrameWhiteCentet1.AddChidren(btnWrokMode); + if (device.GetAttribute("mode_work").value.Count > 1) + { + btnMode.MouseUpEventHandler = (sender, e) => + { + LoadDiv_ChangeModeView(); + }; + } + } if (device.GetAttribute(FunctionAttributeKey.Mode) != null) { btnMode = new Button() @@ -208,6 +232,135 @@ LoadEvent_AcStatesChange(); } + + + /// <summary> + /// 鍔犺浇淇敼妯″紡鍖哄煙 + /// </summary> + void LoadDiv_ChangeWorkModeView() + { + Dialog dialog = new Dialog(); + + FrameLayout dialogView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + dialog.AddChidren(dialogView); + + FrameLayout modeChangeView; + modeChangeView = new FrameLayout() + { + X = Application.GetRealWidth(30), + Y = Application.GetRealHeight(128), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(287), + BackgroundImagePath = "FunctionIcon/AC/DivBg1.png", + }; + dialogView.AddChidren(modeChangeView); + + Button btnTitle; + btnTitle = new Button() + { + X = Application.GetRealWidth(8 + 16), + Y = Application.GetRealHeight(8), + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(44), + TextID = StringId.ChooseMode, + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.EmphasisFontSize_Secondary, + }; + modeChangeView.AddChidren(btnTitle); + + Button btnLine = new Button() + { + X = btnTitle.X, + Y = btnTitle.Bottom, + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.BackgroundColor, + }; + modeChangeView.AddChidren(btnLine); + + var modeList = device.GetAttribute(FunctionAttributeKey.WorkMode).value; + foreach (var m in modeList) + { + Button btnModeIcon = new Button() + { + X = btnTitle.X, + Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 10 + 8), + Width = Application.GetRealWidth(24), + Height = Application.GetRealWidth(24), + IsSelected = device.GetAttrState(FunctionAttributeKey.WorkMode) == m, + }; + modeChangeView.AddChidren(btnModeIcon); + + Button btnModeText = new Button() + { + X = Application.GetRealWidth(12) + btnModeIcon.Right, + Y = Application.GetRealHeight(44 * (modeList.IndexOf(m) + 1) + 8), + Height = Application.GetRealHeight(44), + Width = Application.GetRealWidth(90), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + IsSelected = device.GetAttrState(FunctionAttributeKey.Mode) == m, + TextSize = CSS_FontSize.TextFontSize, + }; + modeChangeView.AddChidren(btnModeText); + + btnModeIcon.UnSelectedImagePath = fhTemp.GetModeIconPath(m, false); + btnModeIcon.SelectedImagePath = fhTemp.GetModeIconPath(m); + btnModeText.Text = fhTemp.GetModeAttrText(m); + + if (modeList.IndexOf(m) < modeList.Count - 1) + { + modeChangeView.AddChidren(new Button() + { + X = btnTitle.X, + Y = btnModeText.Bottom, + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.BackgroundColor, + }); + } + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + dialog.Close(); + }; + EventHandler<MouseEventArgs> eventHandler1 = (sender, e) => + { + //if (!device.online) + //{ + // new Tip() + // { + // CloseTime = 1, + // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), + // Direction = AMPopTipDirection.None, + // }.Show(MainPage.BaseView); + //} + btnModeIcon.IsSelected = btnModeText.IsSelected = true; + device.SetAttrState(FunctionAttributeKey.WorkMode, m); + btnMode.UnSelectedImagePath = fhTemp.GetWrokModeIconPath(m); + System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + btnMode.UnSelectedImagePath = btnModeIcon.UnSelectedImagePath; + d.Add(FunctionAttributeKey.WorkMode, m); + Control.Ins.SendWriteCommand(device, d); + dialog.Close(); + + }; + btnModeIcon.MouseUpEventHandler = eventHandler1; + btnModeText.MouseUpEventHandler = eventHandler1; + dialogView.MouseUpEventHandler = eventHandler; + + } + + dialogView.MouseUpEventHandler = (sender, e) => { + dialog.Close(); + }; + dialog.Show(); + } + /// <summary> /// 鍔犺浇淇敼妯″紡鍖哄煙 @@ -525,6 +678,15 @@ arcBar.IsClickable = false; arcBar.IsOffline = true; } + + if(btnWrokMode!=null){ + var dd = device.GetAttrState("mode_work"); + if (dd != "0") + { + btnWrokMode.UnSelectedImagePath = fhTemp.GetWrokModeIconPath(dd); + } + } + }); } diff --git a/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs index 1e56bf0..23b4816 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPageBLL.cs @@ -1,5 +1,7 @@ 锘縰sing System; using System.Collections.Generic; +using HDL_ON.Common; +using HDL_ON.DAL.Server; using Shared; namespace HDL_ON.UI @@ -79,7 +81,37 @@ function.roomIds.Remove(room.roomId); //room.RemoveRoomFunction(function); } - function.UpdataRoomIds(); + //function.UpdataRoomIds(); + + new System.Threading.Thread(() => + { + try + { + var pack = ApiUtlis.Ins.HttpRequest.UpdataDevcieBindRoomInfo(function); + //鐩存帴淇濆瓨鏈湴锛� + function.SaveFunctionFile(); + if (pack.Code == StateCode.SUCCESS) + { + if (UI.RoomPage.bodyView != null) + { + Application.RunOnMainThread(() => + { + UI.RoomPage.bodyView.ReLoadPage(); + }); + } + } + else + { + IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); + } + } + catch (Exception ex){ + MainPage.Log("鎴块棿缁戝畾璁惧寮傚父" + ex.Message); + } + }) + { IsBackground = true }.Start(); + + if (function.roomIds.Count == Entity.SpatialInfo.CurrentSpatial.RoomList.Count) { btnChooseAll.IsSelected = true; diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs index 86d183f..410e738 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RelayPageBLL.cs @@ -1,4 +1,5 @@ 锘縰sing System; +using System.Collections.Generic; using HDL_ON.Entity; using Shared; @@ -76,7 +77,7 @@ new System.Threading.Thread(() => { function.trait_on_off.curValue = btnSwitchIcon.IsSelected ? "on" : "off"; - System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); + Dictionary<string, string> d = new Dictionary<string, string>(); d.Add("on_off", function.trait_on_off.curValue.ToString()); DriverLayer.Control.Ins.SendWriteCommand(function, d); }) diff --git a/SiriIntents/Server/HttpUtil.cs b/SiriIntents/Server/HttpUtil.cs index f61de04..56a78a0 100644 --- a/SiriIntents/Server/HttpUtil.cs +++ b/SiriIntents/Server/HttpUtil.cs @@ -16,8 +16,8 @@ /// 鍥哄畾鍩熷悕,姝e紡鐜 /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> - public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm /// <summary> /// RegionMark /// </summary> -- Gitblit v1.8.0