From d3a9358843b9539017debde289fb38e4fdf26938 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期二, 23 三月 2021 09:18:48 +0800
Subject: [PATCH] 增加新风bus命令

---
 HDL_ON/DAL/DriverLayer/Packet.cs |   49 ++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/Packet.cs b/HDL_ON/DAL/DriverLayer/Packet.cs
index b99f6dd..5f0b9f5 100644
--- a/HDL_ON/DAL/DriverLayer/Packet.cs
+++ b/HDL_ON/DAL/DriverLayer/Packet.cs
@@ -315,7 +315,7 @@
                             if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
                             {
                                 function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[1].ToString());
-                                function.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[2].ToString());
+                                function.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[2].ToString());
                                 function.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off";
                                 acFunction.SetMode(receiveBytes[9],function);
                                 acFunction.SetFan(receiveBytes[10],function);
@@ -446,7 +446,7 @@
                                 {
                                     indoorTemp = receiveBytes[9];
                                 }
-                                function.SetAttrState(FunctionAttributeKey.IndoorTemp, indoorTemp);
+                                function.SetAttrState(FunctionAttributeKey.RoomTemp, indoorTemp);
 
                                 function.lastState += " " + function.GetAttrState(FunctionAttributeKey.Mode) + new FloorHeating().GetTempUnitString(function);
                                 RoomPage.UpdataStates(function);
@@ -621,7 +621,7 @@
                         {
                             if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0])
                             {
-                                ac.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[1].ToString());
+                                ac.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[1].ToString());
                                 FunctionPage.UpdataStates(ac);
                             }
                         }
@@ -636,6 +636,45 @@
                             Control.Ins.IsSearchLocalGatewaySuccessful = true;
                             Control.Ins.GatewayOnline_Local = true;
                             DAL.Mqtt.MqttClient.DisConnectRemote();//鏂紑mqtt
+                        }
+                        break;
+                    case Command.FreshAirControlACK_JinMao:
+                    case Command.FreshAirReadACK_JinMao:
+                        var airFresh = FunctionList.List.GetAirFreshList().Find((obj) => obj.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]);
+                        if (airFresh != null)
+                        {
+                            /// 3	寮�鍏�	0-鍏虫満锛�1-寮�鏈�
+                            /// 4	杩愯妯″紡	1-閫氶锛�2-鍔犳箍 humidification/fan
+                            /// 5	鑺傝兘鑸掗�傞�夋嫨	1-鑸掗�傦紝2-鑺傝兘 true/false
+                            /// 6	椋庨�熸。浣�	0-鑷姩锛�1-1妗o紝2-2妗o紝3-3妗�  level_1/level_2/level_3/auto
+                            /// 7	婀垮害璁惧畾	%
+                            /// 8	瀹ゅ唴娓╁害鍊�	鈩�
+                            /// 9	瀹ゅ唴婀垮害鍊�	鈩�
+                            /// 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");
+                            switch (receiveBytes[5])
+                            {
+                                case 0:
+                                    airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "auto");
+                                    break;
+                                case 1:
+                                    airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "level_1");
+                                    break;
+                                case 2:
+                                    airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "level_2");
+                                    break;
+                                case 3:
+                                    airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "level_3");
+                                    break;
+                            }
+                            airFresh.SetAttrState(FunctionAttributeKey.Humidity, receiveBytes[6].ToString());
+                            airFresh.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[7].ToString());
+                            airFresh.SetAttrState(FunctionAttributeKey.IndoorHumidity, receiveBytes[8].ToString());
+                            airFresh.SetAttrState(FunctionAttributeKey.FilterRemain, receiveBytes[9].ToString());
+                            airFresh.SetAttrState(FunctionAttributeKey.FilterTimeout, receiveBytes[10] == 1 ? "true" : "false");
                         }
                         break;
                 }
@@ -672,6 +711,10 @@
                 switch (command)
                 {
                     case Command.SetSingleLightACK:
+                    case Command.FreshAirReadACK:
+                    case Command.FreshAirControlACK:
+                    case Command.FreshAirReadACK_JinMao:
+                    case Command.FreshAirControlACK_JinMao:
                         receiveFlag += string.Format("{0}", usefulBytes[0]);
                         break;
                     case Command.SetLogicLoopColorACK:

--
Gitblit v1.8.0