| | |
| | |
|
| | | /// <summary>
|
| | | /// 设备硬件信息的逻辑
|
| | | /// </summary> |
| | | private static HdlDeviceHardInfoLogic m_Current = null; |
| | | /// </summary>
|
| | | private static HdlDeviceHardInfoLogic m_Current = null;
|
| | | /// <summary>
|
| | | /// 设备硬件信息的逻辑
|
| | | /// </summary> |
| | | /// </summary>
|
| | | public static HdlDeviceHardInfoLogic Current
|
| | | {
|
| | | get
|
| | |
| | | /// <param name="device"></param>
|
| | | private void SetHardFirmwareInfoToDevice(CommonDevice device)
|
| | | {
|
| | | if (HdlDeviceAttributeLogic.Current.IsEsixt("DeviceGetHardFirmwareInfo") == false)
|
| | | if (HdlGatewayReceiveLogic.Current.IsEsixt("DeviceGetHardFirmwareInfo") == false)
|
| | | {
|
| | | //添加事件
|
| | | HdlDeviceAttributeLogic.Current.AddAttributeEvent("DeviceGetHardFirmwareInfo", "DeviceStatusReport", this.SetHardFirmwareInfoByInterfaceResult);
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceGetHardFirmwareInfo", ReceiveComandDiv.A设备属性上报, this.SetHardFirmwareInfoByInterfaceResult);
|
| | | }
|
| | | //发送命令
|
| | | this.SetHardFirmwareInfoComand(device);
|
| | |
| | | public void SetHardFirmwareInfoComand(CommonDevice device)
|
| | | {
|
| | | var jObject = new Newtonsoft.Json.Linq.JObject
|
| | | { |
| | | { "DeviceAddr",device.DeviceAddr }, |
| | | { "Epoint", device.DeviceEpoint }, |
| | | { "Cluster_ID", (int)Cluster_ID.Basic }, |
| | | { "Command", 108 } |
| | | {
|
| | | { "DeviceAddr",device.DeviceAddr },
|
| | | { "Epoint", device.DeviceEpoint },
|
| | | { "Cluster_ID", (int)Cluster_ID.Basic },
|
| | | { "Command", 108 }
|
| | | };
|
| | | var attriBute = new Newtonsoft.Json.Linq.JArray
|
| | | { |
| | | {
|
| | | new Newtonsoft.Json.Linq.JObject
|
| | | { |
| | | {
|
| | | { "AttriButeId", 4}
|
| | | }, |
| | | },
|
| | | new Newtonsoft.Json.Linq.JObject
|
| | | {
|
| | | { "AttriButeId", 5}
|
| | | }, |
| | | },
|
| | | new Newtonsoft.Json.Linq.JObject
|
| | | {
|
| | | { "AttriButeId", 6}
|
| | | }, |
| | | },
|
| | | new Newtonsoft.Json.Linq.JObject
|
| | | {
|
| | | { "AttriButeId", 7}
|
| | | }, |
| | | },
|
| | | new Newtonsoft.Json.Linq.JObject
|
| | | {
|
| | | { "AttriButeId", 13}
|
| | | } |
| | | }
|
| | | };
|
| | | var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } };
|
| | | jObject.Add("Data", data);
|
| | |
| | | }
|
| | |
|
| | | //如果属性变更了
|
| | | if (AttriButeChanged == true && UserCenterResourse.listDeviceAttributePushForm.Count > 0)
|
| | | if (AttriButeChanged == true)
|
| | | {
|
| | | if (device.IsCustomizeImage == false)
|
| | | {
|
| | | //UI重新生成
|
| | | device.IconPath = string.Empty;
|
| | | device.ReSave();
|
| | | }
|
| | | //属性变更推送
|
| | | var list = new List<CommonFormBase>();
|
| | | list.AddRange(UserCenterResourse.listDeviceAttributePushForm);
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | list[i]?.DeviceAttributePush(device);
|
| | | }
|
| | | }
|
| | | return 1;
|