| | |
| | | } |
| | | |
| | | 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); |
| | |
| | | //小数点需要一位 |
| | | 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) |
| | |
| | | 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, ".")); |
| | | } |
| | | } |
| | | |
| | |
| | | //小数点需要一位 |
| | | 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) |
| | |
| | | //小数点需要一位 湿度不会出现负数 |
| | | 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) |