From 8cd7b0fd1c53fc35a9817de31ab5d90f7dc7814b Mon Sep 17 00:00:00 2001 From: tzy <hxb@hdlchina.com.cn> Date: 星期一, 29 三月 2021 16:59:43 +0800 Subject: [PATCH] 上传一个版本 --- HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/airFreshjinmao_blue.png | 0 HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs | 4 + HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs | 63 ++++++++++----- HDL_ON/DAL/DriverLayer/Control_Udp.cs | 48 +++++++---- DLL/Android/Shared.Droid.JLCountryCode.dll | 0 HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/airFreshjinmao_white.png | 0 HDL_ON/UI/UI0-Stan/Logic/HdlFormLogic.cs | 29 +++++++ HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/airFreshjinmao.png | 0 HDL_ON/UI/UI2/2-Classification/FunctionPage.cs | 4 + HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs | 7 + HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs | 1 HDL_ON/DAL/DriverLayer/Packet.cs | 8 + HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs | 24 ----- 13 files changed, 124 insertions(+), 64 deletions(-) diff --git a/DLL/Android/Shared.Droid.JLCountryCode.dll b/DLL/Android/Shared.Droid.JLCountryCode.dll old mode 100755 new mode 100644 Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/airFreshjinmao_blue.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/airFreshjinmao_blue.png new file mode 100644 index 0000000..60153b5 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/airFreshjinmao_blue.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/airFreshjinmao_white.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/airFreshjinmao_white.png new file mode 100644 index 0000000..0c3b90b --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/HomeIcon/airFreshjinmao_white.png Binary files differ diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/airFreshjinmao.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/airFreshjinmao.png new file mode 100644 index 0000000..b82b93d --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/Icon/airFreshjinmao.png Binary files differ diff --git a/HDL_ON/DAL/DriverLayer/Control_Udp.cs b/HDL_ON/DAL/DriverLayer/Control_Udp.cs index 05b0c56..a87374e 100644 --- a/HDL_ON/DAL/DriverLayer/Control_Udp.cs +++ b/HDL_ON/DAL/DriverLayer/Control_Udp.cs @@ -699,46 +699,60 @@ case SPK.AirFreshJinmao: //1 鏂伴缂栧彿 1~200 //2 绫诲瀷 绗笁鏂圭被鍨� 0锛氶噾鑼傛柊椋� + //3 寮�鍏� 0 - 鍏虫満锛�1 - 寮�鏈� + byte switchValue = 0; + if (commandDictionary.ContainsKey(FunctionAttributeKey.OnOff) == true + && commandDictionary[FunctionAttributeKey.OnOff] == "on") + { + switchValue = 1; + } + //4 杩愯妯″紡 1 - 閫氶锛�2 - 鍔犳箍 byte airFreshMode = 1; - if (function.GetAttrState(FunctionAttributeKey.Mode) == "fan") + if (commandDictionary.ContainsKey(FunctionAttributeKey.Mode) == true + && commandDictionary[FunctionAttributeKey.Mode] == "fan") { airFreshMode = 2; } //5 鑺傝兘鑸掗�傞�夋嫨 1 - 鑸掗�傦紝2 - 鑺傝兘 byte airFreshEnergy = 1; - if( function.GetAttrState(FunctionAttributeKey.Energy)=="true") + if (commandDictionary.ContainsKey(FunctionAttributeKey.Energy) == true + && commandDictionary[FunctionAttributeKey.Energy] == "true") { airFreshEnergy = 2; } //6 椋庨�熸。浣� 0 - 鑷姩锛�1 - 1妗o紝2 - 2妗o紝3 - 3妗� byte airFreshFan = 0; - switch(function.GetAttrState(FunctionAttributeKey.FanSpeed)) + if (commandDictionary.ContainsKey(FunctionAttributeKey.FanSpeed) == true) { - case "auto": - airFreshFan = 0; - break; - case "level_1": - airFreshFan = 1; - break; - case "level_2": - airFreshFan = 2; - break; - case "level_3": - airFreshFan = 3; - break; + switch (commandDictionary[FunctionAttributeKey.FanSpeed]) + { + case "auto": + airFreshFan = 0; + break; + case "level_1": + airFreshFan = 1; + break; + case "level_2": + airFreshFan = 2; + break; + case "level_3": + airFreshFan = 3; + break; + } } + //7 婀垮害璁惧畾 % //8 瀹ゅ唴娓╁害鍊� 鈩� //9 瀹ゅ唴婀垮害鍊� 鈩� //10 杩囨护缃戝墿浣� % //11 杩囨护缃戜娇鐢ㄨ秴鏃� 1 瓒呮椂 0 鏃� ControlBytesSend(Command.FreshAirControl_JinMao, subnetId, deviceId, new byte[] { - function.bus.LoopId,0, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0 , + function.bus.LoopId,0, switchValue , airFreshMode,airFreshEnergy, airFreshFan, - Convert.ToByte( function.GetAttrState(FunctionAttributeKey.Humidity)), + Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Humidity)), 0,0,0,0 //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.IndoorTemp)), //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.IndoorHumidity)), diff --git a/HDL_ON/DAL/DriverLayer/Packet.cs b/HDL_ON/DAL/DriverLayer/Packet.cs index ad530d3..e67231e 100644 --- a/HDL_ON/DAL/DriverLayer/Packet.cs +++ b/HDL_ON/DAL/DriverLayer/Packet.cs @@ -97,7 +97,7 @@ { ddd += bb + ","; } - MainPage.Log(ddd); + MainPage.Log(((int)command) + " : " + ddd); #endif //澶勭悊鏄惁瑕侀噸鍙戞暟鎹� ManagerReceive(subnetID, deviceID, command, usefulBytes); @@ -666,8 +666,8 @@ /// 10 杩囨护缃戝墿浣� % /// 11 杩囨护缃戜娇鐢ㄨ秴鏃� 1 瓒呮椂 0 鏃� true/false airFresh.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] == 0 ? "off" : "on"); - airFresh.SetAttrState(FunctionAttributeKey.Mode, receiveBytes[3] == 1 ? "humidification" : "fan"); - airFresh.SetAttrState(FunctionAttributeKey.Energy, receiveBytes[4] == 1 ? "true" : "false"); + airFresh.SetAttrState(FunctionAttributeKey.Mode, receiveBytes[3] == 1 ? "fan" : "humidification"); + airFresh.SetAttrState(FunctionAttributeKey.Energy, receiveBytes[4] == 1 ? "false" : "true"); switch (receiveBytes[5]) { case 0: @@ -688,6 +688,8 @@ airFresh.SetAttrState(FunctionAttributeKey.IndoorHumidity, receiveBytes[8].ToString()); airFresh.SetAttrState(FunctionAttributeKey.FilterRemain, receiveBytes[9].ToString()); airFresh.SetAttrState(FunctionAttributeKey.FilterTimeout, receiveBytes[10] == 1 ? "true" : "false"); + //璁惧鐘舵�佹帹閫� + Stan.HdlFormLogic.Current.DeviceStatuPush(airFresh, true); } break; } diff --git a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs index f8dae98..3a84846 100644 --- a/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs +++ b/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs @@ -142,6 +142,10 @@ case SPK.IrLearn: var irLearinPage = new IrLearnPage(); irLearinPage.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); + break; + case SPK.AirFreshJinmao: + var airFresh1 = new AirFreshControlPage(); + airFresh1.AddForm(function, btnCollectionIcon, btnName, btnFromFloor); break; } }; diff --git a/HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs b/HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs index fca8398..8ae3705 100644 --- a/HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs +++ b/HDL_ON/UI/UI0-Stan/Logic/HdlDeviceStatuPushLogic.cs @@ -44,28 +44,8 @@ if (localDevice != null) { foreach (var attr in updateData) - { - //var localAttr2 = localDevice.attributes.Find((obj) => obj.key == attr.key); - //if (localAttr2 == null) - //{ - // //鏈韩瀹冨氨娌℃湁杩欎釜灞炴��,鍒欎笉澶勭悊 - // continue; - //} - ////鏇存敼灞炴�у�� - //localAttr2.curValue = attr.value; - - //var localAttr = localDevice.status.Find((obj) => obj.key == attr.key); - //if (localAttr == null) - //{ - // //status鏄綋鍓嶈澶囦笂鎶ヨ繃鐨勫睘鎬ф墠浼氬瓨鍦�,涔熷氨鏄畠鐨勪釜鏁版湁鍙兘鍜宎ttributes涓嶄竴鑷� - // localAttr = new AttributesStatus() { key = attr.key, value = attr.value }; - // localDevice.status.Add(localAttr); - //} - ////鏇存敼灞炴�у�� - //localAttr.value = attr.value; - - localDevice.SetAttrState(attr.key, attr.value); - + { + localDevice.SetAttrState(attr.key, attr.value); } //鍏ㄩ儴鐣岄潰鎺ㄩ�� HdlFormLogic.Current.DeviceStatuPush(localDevice); diff --git a/HDL_ON/UI/UI0-Stan/Logic/HdlFormLogic.cs b/HDL_ON/UI/UI0-Stan/Logic/HdlFormLogic.cs index 5d9902c..8b74ab9 100644 --- a/HDL_ON/UI/UI0-Stan/Logic/HdlFormLogic.cs +++ b/HDL_ON/UI/UI0-Stan/Logic/HdlFormLogic.cs @@ -147,7 +147,8 @@ /// 璁惧鐘舵�佹洿鏂版帹閫� /// </summary> /// <param name="i_LocalDevice">鏈湴璁惧瀵硅薄</param> - public void DeviceStatuPush(Entity.Function i_LocalDevice) + /// <param name="refreshCardContr">鏄惁鍒锋柊涓婚〉,鍒嗙被,鎴块棿绛夌瓑鐨勮澶囧崱鐗囩殑鐘舵��,榛樿涓嶅埛鏂�(姝ゅ彉閲忕洰鍓嶆槸缁檅us鎺ユ敹閭i噷浣跨敤鐨�)</param> + public void DeviceStatuPush(Entity.Function i_LocalDevice, bool refreshCardContr = false) { HdlThreadLogic.Current.RunMain(() => { @@ -155,11 +156,37 @@ { this.ListActionForm[i]?.DeviceStatuPush(i_LocalDevice); } + if (refreshCardContr == true) + { + //鍒锋柊涓婚〉,鍒嗙被,鎴块棿绛夌瓑鐨勮澶囧崱鐗囩姸鎬� + this.RefreshAllDeviceCardControl(i_LocalDevice); + } + }, ShowErrorMode.NO); } #endregion + #region 鈻� 鎵嬪姩鍒锋柊鍚勮澶囧崱鐗嘷________________ + + /// <summary> + /// 鎵嬪姩鍒锋柊涓婚〉,鍒嗙被,鎴块棿绛夌瓑鐨勮澶囧崱鐗囩姸鎬� + /// </summary> + /// <param name="i_device">闇�瑕佸埛鏂扮殑璁惧瀵硅薄</param> + public void RefreshAllDeviceCardControl(Entity.Function i_device) + { + //鍒锋柊涓婚〉 + UI.HomePage.UpdataFunctionStates(i_device); + //鍒锋柊鍒嗙被 + UI.ClassificationPage.UpdataInfo(i_device); + //鍒锋柊鎴块棿 + UI.RoomPage.UpdataStates(i_device); + //鍒锋柊鍔熻兘 + UI.FunctionPage.UpdataStates(i_device); + } + + #endregion + #region 鈻� 涓�鑸柟娉昣__________________________ /// <summary> diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs index b86e4c5..1506eb4 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificaitionPublicBLL.cs @@ -59,6 +59,7 @@ case FunctionCategory.AC: case FunctionCategory.FloorHeat: case FunctionCategory.Electric: + case FunctionCategory.AirFresh: #region 鎸夐挳鐘舵�佹洿鏂� if (cTag == updataFunction.sid + "_Switch") { diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs index d6371a6..d480411 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs @@ -51,6 +51,10 @@ case SPK.ClothesHanger: vv = ShowFunction.Electric; break; + case SPK.AirFreshJinmao: + case SPK.AirFreshStandard: + vv = ShowFunction.FreshAir; + break; } UpdataFunctionOnCount(vv, function.spk); UpdataCloseAllButton(function); @@ -118,6 +122,9 @@ case ShowFunction.Electric: btnText = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); break; + case ShowFunction.FreshAir: + btnText = FunctionList.List.GetAirFreshList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count.ToString(); + break; } if (btn.Tag.ToString() == functionCategory + "_onCount") { diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs index 1536bbb..47a64cc 100644 --- a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs @@ -108,6 +108,10 @@ else if (titleId == StringId.Sensor) { functionList.AddRange(FunctionList.List.GetArmSensorList()); + } + else if (titleId == StringId.FreshAir) + { + functionList.AddRange(FunctionList.List.GetAirFreshList()); } functionList.OrderByDescending(o => o.controlCounter).ToList(); diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs index 9a6c5c9..4cf8131 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AirFreshControlPage.cs @@ -291,7 +291,7 @@ { frameBack.Close(); //鍙戦�佽妭鑳藉懡浠� - this.SendOtherComand(this.btnMode1, "energy", "true"); + this.SendOtherComand(this.btnMode1, FunctionAttributeKey.Energy, "true"); }); //鑸掗�� @@ -300,7 +300,7 @@ { frameBack.Close(); //鍙戦�佽垝閫傚懡浠� - this.SendOtherComand(this.btnMode1, "energy", "false"); + this.SendOtherComand(this.btnMode1, FunctionAttributeKey.Energy, "false"); }); } @@ -338,7 +338,7 @@ { frameBack.Close(); //鍙戦�侀�氶鍛戒护 - this.SendOtherComand(this.btnMode2, "mode", "fan"); + this.SendOtherComand(this.btnMode2, FunctionAttributeKey.Mode, "fan"); }); //鍔犳箍 @@ -347,7 +347,7 @@ { frameBack.Close(); //鍙戦�佸姞婀垮懡浠� - this.SendOtherComand(this.btnMode2, "mode", "humidification"); + this.SendOtherComand(this.btnMode2, FunctionAttributeKey.Mode, "humidification"); }); } @@ -385,7 +385,7 @@ { frameBack.Close(); //鍙戦�佹。浣嶅懡浠� - this.SendOtherComand(this.btnFan, "fan", "level_1"); + this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "level_1"); }); //2妗� @@ -394,7 +394,7 @@ { frameBack.Close(); //鍙戦�佹。浣嶅懡浠� - this.SendOtherComand(this.btnFan, "fan", "level_2"); + this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "level_2"); }); //3妗� @@ -403,7 +403,7 @@ { frameBack.Close(); //鍙戦�佹。浣嶅懡浠� - this.SendOtherComand(this.btnFan, "fan", "level_3"); + this.SendOtherComand(this.btnFan, FunctionAttributeKey.FanSpeed, "level_3"); }); } @@ -532,9 +532,10 @@ HdlThreadLogic.Current.RunThread(() => { - var dic = new Dictionary<string, string>(); - dic.Add(comadKey, comadValue); - Control.Ins.SendWriteCommand(this.device, dic, true); + //鑾峰彇鍙戦�佸懡浠ょ殑鏍锋澘(bus鍗忚鏄渶瑕佷竴娆℃�ф妸鍏ㄩ儴鍛戒护涓�璧峰彂閫佺殑) + var dic = this.GetSendComandSample(); + dic[comadKey] = comadValue; + Control.Ins.SendWriteCommand(this.device, dic); HdlThreadLogic.Current.RunMain(() => { btnIcon.CanClick = true; @@ -552,14 +553,34 @@ string statu = this.btnSwitch.IsSelected == true ? "off" : "on"; HdlThreadLogic.Current.RunThread(() => { - var dic = new Dictionary<string, string>(); - dic.Add(FunctionAttributeKey.OnOff, statu); - Control.Ins.SendWriteCommand(this.device, dic, true); + //鑾峰彇鍙戦�佸懡浠ょ殑鏍锋澘(bus鍗忚鏄渶瑕佷竴娆℃�ф妸鍏ㄩ儴鍛戒护涓�璧峰彂閫佺殑) + var dic = this.GetSendComandSample(); + dic[FunctionAttributeKey.OnOff] = statu; + Control.Ins.SendWriteCommand(this.device, dic); HdlThreadLogic.Current.RunMain(() => { this.btnSwitch.CanClick = true; }); }); + } + + /// <summary> + /// 鑾峰彇鍙戦�佸懡浠ょ殑鏍锋澘(bus鍗忚鏄渶瑕佷竴娆℃�ф妸鍏ㄩ儴鍛戒护涓�璧峰彂閫佺殑) + /// </summary> + /// <returns></returns> + private Dictionary<string, string> GetSendComandSample() + { + var dic = new Dictionary<string, string>(); + //寮�鍏� + dic[FunctionAttributeKey.OnOff] = this.airFreshData.Open == true ? "on" : "off"; + //妯″紡 + dic[FunctionAttributeKey.Mode] = this.airFreshData.Mode; + //鑺傝兘 + dic[FunctionAttributeKey.Energy] = this.airFreshData.Energy; + //椋庨�� + dic[FunctionAttributeKey.FanSpeed] = this.airFreshData.Fan ; + + return dic; } #endregion @@ -575,15 +596,15 @@ { var data = i_LocalDevice.attributes[i]; //寮�鍏� - if (data.key == "on_off") { this.airFreshData.Open = data.state == "on"; } + if (data.key == FunctionAttributeKey.OnOff) { this.airFreshData.Open = data.state == "on"; } //妯″紡 - else if (data.key == "mode") { this.airFreshData.Mode = data.state; } + else if (data.key == FunctionAttributeKey.Mode) { this.airFreshData.Mode = data.state; } //鑺傝兘 - else if (data.key == "energy") { this.airFreshData.Energy = data.state; } + else if (data.key == FunctionAttributeKey.Energy) { this.airFreshData.Energy = data.state; } //椋庨�� - else if (data.key == "fan") { this.airFreshData.Fan = data.state; } + else if (data.key == FunctionAttributeKey.FanSpeed) { this.airFreshData.Fan = data.state; } //婀垮害 - else if (data.key == "humidity") + else if (data.key == FunctionAttributeKey.Humidity) { if (data.state != string.Empty) { @@ -591,7 +612,7 @@ } } //瀹ゅ唴娓╁害 - else if (data.key == "indoor_temp") + else if (data.key == FunctionAttributeKey.IndoorTemp) { if (data.state != string.Empty) { @@ -599,7 +620,7 @@ } } //瀹ゅ唴婀垮害 - else if (data.key == "indoor_humidity") + else if (data.key == FunctionAttributeKey.IndoorHumidity) { if (data.state != string.Empty) { @@ -607,7 +628,7 @@ } } //杩囨护缃戝墿浣欓噺 - else if (data.key == "filter_remain") + else if (data.key == FunctionAttributeKey.FilterRemain) { if (data.state != string.Empty) { -- Gitblit v1.8.0