| | |
| | | using ZigBee.Device; |
| | | using Shared.Phone.Device.AC; |
| | | using System.Text; |
| | | using Shared.Phone.Device.Account; |
| | | |
| | | using Shared.Phone.Device.Account;
|
| | |
|
| | | namespace Shared.Phone.UserView |
| | | { |
| | | /// <summary> |
| | |
| | | if (common.DeviceStatusReport.AttriBute == null || common.DeviceStatusReport.AttriBute.Count == 0) |
| | | { |
| | | return; |
| | | }
|
| | | } |
| | | switch (myDevice.Type)
|
| | | {
|
| | | case DeviceType.OnOffOutput:
|
| | |
| | | ac.currentSystemMode = attList.AttriButeData; |
| | | ac.LastDateTime = DateTime.Now; |
| | | break; |
| | | case 4099: |
| | | var value = Convert.ToString(attList.AttriButeData, 2).PadLeft(16, '0'); |
| | | var modeStr = value.Substring(value.Length - 5, 5); |
| | | for (int j = 0; j < modeStr.Length; j++) |
| | | { |
| | | ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0; |
| | | } |
| | | break; |
| | | case 4097: |
| | | ac.CleanStatu = attList.AttriButeData == 42; |
| | | break; |
| | |
| | | myDevice.IsOnline = 1;
|
| | | 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;
|
| | | } |
| | | } |