From 72be4f06a683de33ddd563c8447c39f7f17e5b7d Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 06 一月 2020 13:03:50 +0800
Subject: [PATCH] 合并代码

---
 ZigbeeApp/Shared/Phone/UserView/UserPage.cs |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs
index 90511ff..1e83ef9 100755
--- a/ZigbeeApp/Shared/Phone/UserView/UserPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/UserPage.cs
@@ -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)

--
Gitblit v1.8.0