From c7df85937f73fb347ee0b19e9c052d2d00a6df6c Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期五, 18 九月 2020 13:58:19 +0800
Subject: [PATCH] 新版本

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs |   68 ++++++++++++++++++++++++++++------
 1 files changed, 56 insertions(+), 12 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
index 603dce4..468e4bc 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
@@ -118,7 +118,8 @@
             //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
             if (Common.Config.Instance.Home.IsVirtually == true)
             {
-                return TemplateData.TemplateDeviceDataLogic.Current.GetPanelColorInfo(device, keyNum);
+                //杩欓噷鐗规畩,杩欓噷鏄寜鍥炶矾鍒嗙殑
+                return TemplateData.TemplateDeviceDataLogic.Current.GetPanelColorInfo(device.DeviceAddr, device.DeviceEpoint, keyNum);
             }
             //鍙戦�佹暟鎹� keyNum杞负16杩涘埗 鑼冨洿锛�01~10
             var passData = "0504040101" + Convert.ToString((int)keyNum, 16).ToUpper().PadLeft(2, '0');
@@ -215,7 +216,8 @@
             //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
             if (Common.Config.Instance.Home.IsVirtually == true)
             {
-                return TemplateData.TemplateDeviceDataLogic.Current.SetPanelColorInfo(device, keyColorData, keyNumStatus, null);
+                //杩欎釜涔熸槸鐗规畩,鎸夊洖璺潵鍒�
+                return TemplateData.TemplateDeviceDataLogic.Current.SetPanelColorInfo(device.DeviceAddr, device.DeviceEpoint, keyColorData, keyNumStatus, null);
             }
             //鑾峰彇閰嶇疆鎸夐敭鎸囩ず鐏鑹茬殑鍛戒护瀛楃
             var sendData = this.GetPanelColorCommandText(device.DeviceAddr, keyColorData, keyNumStatus);
@@ -230,7 +232,7 @@
             tempD.status = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16);
 
             //娣诲姞缂撳瓨
-            TemplateData.TemplateDeviceDataLogic.Current.SetPanelColorInfo(device, keyColorData, keyNumStatus, result.JsonData[0]);
+            TemplateData.TemplateDeviceDataLogic.Current.SetPanelColorInfo(device.DeviceAddr, device.DeviceEpoint, keyColorData, keyNumStatus, result.JsonData[0]);
 
             return new CommonDevice.ResponseAllData { responseData = tempD };
         }
@@ -390,7 +392,7 @@
             //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
             if (Common.Config.Instance.Home.IsVirtually == true)
             {
-                return TemplateData.TemplateDeviceDataLogic.Current.GetDeviceLightSettion(device);
+                return TemplateData.TemplateDeviceDataLogic.Current.GetDeviceLightSettion(device.DeviceAddr, 200);
             }
             //鑾峰彇鍙戦�佺殑鍛戒护瀛楃
             var passData = "050604010101";
@@ -426,7 +428,7 @@
             //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
             if (Common.Config.Instance.Home.IsVirtually == true)
             {
-                return TemplateData.TemplateDeviceDataLogic.Current.SetDeviceLightSettion(device, directionsLevel, backlightLevel, null);
+                return TemplateData.TemplateDeviceDataLogic.Current.SetDeviceLightSettion(device.DeviceAddr, 200, directionsLevel, backlightLevel, null);
             }
             //鑾峰彇淇敼闈㈡澘鐨勪寒搴﹁皟鑺傜殑鍛戒护瀛楃
             var sendData = this.GetPanelLevelCommadText(device.DeviceAddr, directionsLevel, backlightLevel);
@@ -460,7 +462,7 @@
             }
 
             //淇敼缂撳瓨
-            TemplateData.TemplateDeviceDataLogic.Current.SetDeviceLightSettion(device, directionsLevel, backlightLevel, result.JsonData[0]);
+            TemplateData.TemplateDeviceDataLogic.Current.SetDeviceLightSettion(device.DeviceAddr, 200, directionsLevel, backlightLevel, result.JsonData[0]);
 
             return true;
         }
@@ -604,6 +606,48 @@
         }
         #endregion
 
+        #region 鈻� 鏍℃娓╁害___________________________ 
+        /// <summary>
+        /// 鏍℃娓╁害
+        /// </summary>
+        /// <param name="device">璁惧瀵硅薄</param>
+        /// <param name="correctValue">鏍℃娓╁害鍊�</param>
+        /// <param name="direction">琛ュ伩鏂瑰悜0涓嶈ˉ鍋� 1锛氭鍚戯紱2锛氬弽鍚�</param>
+        /// <param name="type">0 娓╁害  锛�1 婀垮害</param>
+        /// <returns></returns>  
+        public async Task<bool> CorrectTemperature(CommonDevice device, double correctValue, int direction = 0, int type = 0)
+        {
+            //鍊熺敤瀹冪殑鍑絫
+            var panel = new Panel();
+            panel.DeviceAddr = device.DeviceAddr;
+            panel.DeviceEpoint = 200;
+            panel.CurrentGateWayId = device.CurrentGateWayId;
+
+            var result = await panel.CorrectTemperature(correctValue, direction, type);
+            panel = null;
+
+            //鍏遍�氶敊璇娴�
+            string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
+            if (error != null)
+            {
+                this.ShowErrorMsg(error);
+                return false;
+            }
+
+            if (result == null || result.responseData == null)
+            {
+                //鐭娓╁害澶辫触
+                string msg = Language.StringByID(R.MyInternationalizationString.DataCorrectionFailed);
+                //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+                msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+                this.ShowTipMsg(msg);
+                return false;
+            }
+            return true;
+        }
+        #endregion 
+
         #region 鈻� 鑺傝兘妯″紡___________________________
         /// <summary>
         /// 鑾峰彇璁惧鑺傝兘妯″紡鐨勯厤缃姸鎬�(ui鍙妭鑳芥ā寮�)
@@ -615,7 +659,7 @@
             //濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹�
             if (Common.Config.Instance.Home.IsVirtually == true)
             {
-                return TemplateData.TemplateDeviceDataLogic.Current.GetDeviceEnergyConservationMode(device);
+                return TemplateData.TemplateDeviceDataLogic.Current.GetDeviceEnergyConservationMode(device.DeviceAddr, 200);
             }
             //鍙戦�佸懡浠�
             string passData = "050804010101";
@@ -681,7 +725,7 @@
             //濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
             if (Common.Config.Instance.Home.IsVirtually == true)
             {
-                return TemplateData.TemplateDeviceDataLogic.Current.SetDeviceEnergyConservationMode(device, modeEnable, modeTime, level, null);
+                return TemplateData.TemplateDeviceDataLogic.Current.SetDeviceEnergyConservationMode(device.DeviceAddr, 200, modeEnable, modeTime, level, null);
             }
             //鑾峰彇璁剧疆璁惧鐨勮妭鑳芥ā寮忕殑鍛戒护瀛楃
             var sendData = this.GetDeviceEnergyConservationModeCommandText(device.DeviceAddr, modeEnable, modeTime, level);
@@ -711,7 +755,7 @@
             }
 
             //淇敼缂撳瓨
-            TemplateData.TemplateDeviceDataLogic.Current.SetDeviceEnergyConservationMode(device, modeEnable, modeTime, level, result.JsonData[0]);
+            TemplateData.TemplateDeviceDataLogic.Current.SetDeviceEnergyConservationMode(device.DeviceAddr, 200, modeEnable, modeTime, level, result.JsonData[0]);
 
             return true;
         }
@@ -1052,7 +1096,7 @@
             //濡傛灉鏄櫄鎷熶綇瀹�
             if (Common.Config.Instance.Home.IsVirtually == true)
             {
-                return TemplateData.TemplateDeviceDataLogic.Current.GetPanelVibrationInfo(device);
+                return TemplateData.TemplateDeviceDataLogic.Current.GetPanelVibrationInfo(device.DeviceAddr, 200);
             }
             //鍙戦�佹暟鎹�
             var jObject = new Newtonsoft.Json.Linq.JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
@@ -1087,7 +1131,7 @@
             //濡傛灉鏄櫄鎷熶綇瀹�
             if (Common.Config.Instance.Home.IsVirtually == true)
             {
-                return TemplateData.TemplateDeviceDataLogic.Current.SetPanelVibrationInfo(device, datainfo, null);
+                return TemplateData.TemplateDeviceDataLogic.Current.SetPanelVibrationInfo(device.DeviceAddr, 200, datainfo, null);
             }
             //鑾峰彇缂栬緫闈㈡澘闇囧姩鍔熻兘鐨勫懡浠ゅ瓧绗�
             var sendData = this.GetPanelVibrationCommandText(device.DeviceAddr, datainfo);
@@ -1101,7 +1145,7 @@
                 return false;
             }
             //娣诲姞缂撳瓨
-            TemplateData.TemplateDeviceDataLogic.Current.SetPanelVibrationInfo(device, datainfo, result.JsonData[0]);
+            TemplateData.TemplateDeviceDataLogic.Current.SetPanelVibrationInfo(device.DeviceAddr, 200, datainfo, result.JsonData[0]);
 
             return true;
         }

--
Gitblit v1.8.0