From fa6bcb2e9907772480f99205f36ec2a1ce735a22 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 09 一月 2020 14:11:07 +0800 Subject: [PATCH] 合并代码 --- ZigbeeApp/Shared/Phone/UserView/UserPage.cs | 79 +++++++++++++++++++++++++++++++++++++-- 1 files changed, 75 insertions(+), 4 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs index 6185329..1e83ef9 100755 --- a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs @@ -147,7 +147,7 @@ var ac = (AC)myDevice; ac.DeviceStatusReport = common.DeviceStatusReport; var attriButeList = ac.DeviceStatusReport.AttriBute; - foreach(var attList in attriButeList) + foreach (var attList in attriButeList) { //姝ゅ睘鎬ц〃鏄庡鍐呭綋鍓嶇殑娓╁害 * 100锛屽疄闄呮俯搴︿负鈥淟ocalTemperature / 100鈥濓紝鍗曚綅锛氣剝 var curTemp = (attList.AttriButeData / 100 < ACControlBase.Temperature_High && attList.AttriButeData / 100 > ACControlBase.Temperature_Low) ? attList.AttriButeData / 100 : ACControlBase.Temperature_Default; @@ -193,7 +193,7 @@ var ac = (AC)myDevice; var attriButeList = common.DeviceStatusReport.AttriBute; ac.DeviceStatusReport = common.DeviceStatusReport; - foreach(var attList in attriButeList) + foreach (var attList in attriButeList) { switch (attList.AttributeId) { @@ -248,6 +248,62 @@ myDevice.LastDateTime = DateTime.Now; } break; + + case DeviceType.TemperatureSensor: + //娓╁害 + if (common.DeviceStatusReport.CluterID == 1026) + { + var tempera = (TemperatureSensor)myDevice; + foreach (var data in common.DeviceStatusReport.AttriBute) + { + if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue) + { + if (data.AttriButeData == 0) + { + tempera.Temperatrue = 0; + } + else if (data.AttriButeData > 32767) + { + //璐熸暟(鐗规畩澶勭悊) + string strValue = (data.AttriButeData - 65536).ToString(); + //灏忔暟鐐归渶瑕佷竴浣� + strValue = strValue.Substring(0, strValue.Length - 1); + tempera.Temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + } + else + { + //灏忔暟鐐归渶瑕佷竴浣� + string strValue = data.AttriButeData.ToString(); + strValue = strValue.Substring(0, strValue.Length - 1); + tempera.Temperatrue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + } + } + } + } + //婀垮害 + if (common.DeviceStatusReport.CluterID == 1029) + { + var tempera = (TemperatureSensor)myDevice; + foreach (var data in common.DeviceStatusReport.AttriBute) + { + if (data.AttributeId == (int)ZigBee.Device.AttriButeId.MeasuredValue) + { + if (data.AttriButeData == 0) + { + tempera.Humidity = 0; + } + else + { + //灏忔暟鐐归渶瑕佷竴浣�(婀垮害娌℃湁璐熸暟) + string strValue = data.AttriButeData.ToString(); + strValue = strValue.Substring(0, strValue.Length - 1); + tempera.Humidity = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + tempera.LastDateTime = DateTime.Now; + } + } + } + } + break; } } catch (Exception ex) @@ -261,6 +317,21 @@ myDevice.IsOnline = common.IsOnline; //璁板綍鍥炲鏃堕棿 myDevice.LastDateTime = DateTime.Now; + } + else if (typeTag == "IASInfoReport") + { + try + { + switch (myDevice.Type) + { + case DeviceType.IASZone: + var iAS = (IASZone)myDevice; + iAS.iASInfo = (common as IASZone).iASInfo; + iAS.LastDateTime = DateTime.Now; + break; + } + } + catch { } } } /// <summary> @@ -304,9 +375,9 @@ { BackgroundColor = Shared.Common.ZigbeeColor.Current.MainColor; ZbGateway.StatusList.Add(this); - Shared.Application.LocationAction += (lat, lon) => + Shared.Application.LocationAction += (lon, lat) => { - AccountLogic.Instance.ReceiveAppLatAndLon(lat.ToString(), lon.ToString()); + AccountLogic.Instance.ReceiveAppLatAndLon(lon.ToString(), lat.ToString()); }; } -- Gitblit v1.8.0