| | |
| | | //已经接收到状态
|
| | | locadevice.HadReadDeviceStatu = true;
|
| | |
|
| | | if (locadevice is LightBase)
|
| | | {
|
| | | //当接收到亮度值时,默认打开
|
| | | ((LightBase)locadevice).OnOffStatus = 1;
|
| | | }
|
| | | //if (locadevice is LightBase)
|
| | | //{
|
| | | // //当接收到亮度值时,默认打开
|
| | | // ((LightBase)locadevice).OnOffStatus = 1;
|
| | | //}
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | |
|
| | | #region ■ 设备基础信息
|
| | |
|
| | | else if (report.DeviceStatusReport.CluterID == 0)
|
| | | {
|
| | | var listLocalDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceAddr, false);
|
| | | //属性都是一样的
|
| | | foreach (var myDevice in listLocalDevice)
|
| | | {
|
| | | //属性是否改变
|
| | | bool attriButeChanged = false;
|
| | | foreach (var data in report.DeviceStatusReport.AttriBute)
|
| | | {
|
| | | //生产商名字
|
| | | if (data.AttributeId == 4 && data.AttriButeDataHex.Length > 2)
|
| | | {
|
| | | if (data.AttriButeDataHex.Length > 2)
|
| | | {
|
| | | var value = UserCenterLogic.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2));
|
| | | if (myDevice.ManufacturerName != value)
|
| | | {
|
| | | //属性变更了
|
| | | attriButeChanged = true;
|
| | | }
|
| | | myDevice.ManufacturerName = value;
|
| | | }
|
| | | }
|
| | | //型号码(也叫模块ID)
|
| | | if (data.AttributeId == 5)
|
| | | {
|
| | | if (data.AttriButeDataHex.Length > 2)
|
| | | {
|
| | | var value = UserCenterLogic.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2));
|
| | | if (myDevice.ModelIdentifier != value)
|
| | | {
|
| | | //属性变更了
|
| | | attriButeChanged = true;
|
| | | }
|
| | | myDevice.ModelIdentifier = value;
|
| | | }
|
| | | }
|
| | | //生产日期
|
| | | if (data.AttributeId == 6)
|
| | | {
|
| | | if (data.AttriButeDataHex.Length > 2)
|
| | | {
|
| | | var value = UserCenterLogic.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2));
|
| | | if (myDevice.ProductionDate != value)
|
| | | {
|
| | | //属性变更了
|
| | | attriButeChanged = true;
|
| | | }
|
| | | myDevice.ProductionDate = value;
|
| | | }
|
| | | }
|
| | | //电源
|
| | | if (data.AttributeId == 7)
|
| | | {
|
| | | myDevice.PowerSource = data.AttriButeData;
|
| | | }
|
| | | //序列号
|
| | | if (data.AttributeId == 13)
|
| | | {
|
| | | if (data.AttriButeDataHex.Length > 2)
|
| | | {
|
| | | string value;
|
| | | if (Common.LocalDevice.Current.IsHdlDevice(myDevice) == false)
|
| | | {
|
| | | //第三方设备
|
| | | value = data.AttriButeDataHex.Substring(2);
|
| | | }
|
| | | else
|
| | | {
|
| | | //河东设备
|
| | | value = UserCenterLogic.TranslateHexadecimalIntoText(data.AttriButeDataHex.Substring(2));
|
| | | }
|
| | | if (myDevice.SerialNumber != value)
|
| | | {
|
| | | //属性变更了
|
| | | attriButeChanged = true;
|
| | | }
|
| | | myDevice.SerialNumber = value;
|
| | | }
|
| | | }
|
| | | }
|
| | | //如果属性变更了
|
| | | if (attriButeChanged == true && myDevice.IsCustomizeImage == false)
|
| | | {
|
| | | //UI重新生成
|
| | | myDevice.IconPath = string.Empty;
|
| | | myDevice.ReSave();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | else if (deviceEpoint == 200)
|
| | | {
|
| | | var localOta = Common.LocalDevice.Current.GetOTADevice(deviceAddr);
|
| | | if (localOta != null)
|
| | | {
|
| | | #region ■ 固件版本
|
| | | //固件版本
|
| | | if (report.DeviceStatusReport.CluterID == (int)Cluster_ID.Ota)
|
| | | {
|
| | | foreach (var data in report.DeviceStatusReport.AttriBute)
|
| | | {
|
| | | //镜像版本
|
| | | if (data.AttributeId == (int)AttriButeId.ImgVersion)
|
| | | {
|
| | | localOta.ImgVersion = data.AttriButeData;
|
| | | }
|
| | | //硬件版本
|
| | | if (data.AttributeId == (int)AttriButeId.mgHWversion)
|
| | | {
|
| | | localOta.HwVersion = data.AttriButeData;
|
| | | }
|
| | | //镜像ID
|
| | | if (data.AttributeId == (int)AttriButeId.ImgTypeId)
|
| | | {
|
| | | localOta.ImgTypeId = data.AttriButeData;
|
| | | }
|
| | | }
|
| | | localOta.ReSave();
|
| | | }
|
| | | #endregion
|
| | | }
|
| | | }
|
| | | this.DeviceReportPush(report, ReceiveComandDiv.A设备属性上报);
|
| | | }
|
| | |
|