From 351bdda734832d821a9764b0cde8be5d83c4ec50 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期四, 01 十二月 2022 09:56:25 +0800 Subject: [PATCH] 2022年12月01日09:56:23 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs index 2396186..facd31c 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlGatewayReceiveLogic.cs @@ -252,11 +252,14 @@ } var tempList = Common.LocalDevice.Current.GetDevicesByMac(report.DeviceAddr, false); - var res = Common.LocalDevice.Current.GetMyDeviceEnumInfo(tempList); - if (res.ConcreteType == Common.DeviceConcreteType.Airer) + if (tempList.Count > 0) { - //鏅捐。鏋剁壒娈婂鐞嗭紝鏈湴鍙瓨浜嗙鐐�1锛屽叾浣�2锝�5绔偣閮戒笉瀛� - deviceEpoint = 1; + var res = Common.LocalDevice.Current.GetMyDeviceEnumInfo(tempList); + if (res.ConcreteType == Common.DeviceConcreteType.Airer) + { + //鏅捐。鏋剁壒娈婂鐞嗭紝鏈湴鍙瓨浜嗙鐐�1锛屽叾浣�2锝�5绔偣閮戒笉瀛� + deviceEpoint = 1; + } } //澶勭悊缃戝叧涓婃姤鐨勬暟鎹�,鐒跺悗鍙樻洿鏈湴缂撳瓨 var locadevice = Common.LocalDevice.Current.GetDevice(deviceAddr, deviceEpoint); @@ -642,7 +645,7 @@ //灏忔暟鐐归渶瑕佷竴浣� string strValue = Convert.ToInt16(receiptData, 16).ToString(); strValue = strValue.Substring(0, strValue.Length - 1); - temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + temperatrue = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); } //鏃犵鍙�(涓嶄細鍑虹幇璐熸暟) else if (attData.AttriButeDataType == 32 || attData.AttriButeDataType == 33) @@ -654,14 +657,14 @@ string strValue = (shortData - 65536).ToString(); //灏忔暟鐐归渶瑕佷竴浣� strValue = strValue.Substring(0, strValue.Length - 1); - temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + temperatrue = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); } else { //灏忔暟鐐归渶瑕佷竴浣� string strValue = shortData.ToString(); strValue = strValue.Substring(0, strValue.Length - 1); - temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + temperatrue = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); } } @@ -706,7 +709,7 @@ //灏忔暟鐐归渶瑕佷竴浣� string strValue = Convert.ToInt16(receiptData, 16).ToString(); strValue = strValue.Substring(0, strValue.Length - 1); - humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + humidity = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); } //鏃犵鍙�(涓嶄細鍑虹幇璐熸暟) else if (attData.AttriButeDataType == 32 || attData.AttriButeDataType == 33) @@ -714,7 +717,7 @@ //灏忔暟鐐归渶瑕佷竴浣� 婀垮害涓嶄細鍑虹幇璐熸暟 string strValue = Convert.ToUInt16(receiptData, 16).ToString(); strValue = strValue.Substring(0, strValue.Length - 1); - humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + humidity = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); } //婀垮害浼犳劅鍣� if (locadevice is TemperatureSensor) -- Gitblit v1.8.0