黄学彪
2020-01-17 4b378188ce972df432b23d9cb73babb6cc0679c6
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs
@@ -47,9 +47,9 @@
        /// <param name="clusterId">镞ID</param>
        /// <param name="attributeId">属性ID</param>
        /// <param name="attributeDataType">数据类型</param>
        /// <param name="attributeData">需要写入的数据</param>
        /// <param name="attributeData">需要写入的数据(数值或者字符串)</param>
        /// <returns></returns>
        public async System.Threading.Tasks.Task<CommonDevice.SetWritableValueResponAllData> WriteDeviceAttribute(CommonDevice device, int clusterId, int attributeId, int attributeDataType, string attributeData)
        public async System.Threading.Tasks.Task<CommonDevice.SetWritableValueResponAllData> WriteDeviceAttribute(CommonDevice device, int clusterId, int attributeId, int attributeDataType, object attributeData)
        {
            var MyGateway = device.Gateway;
            if (MyGateway == null)
@@ -93,7 +93,15 @@
            try
            {
                var jObject = new Newtonsoft.Json.Linq.JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", device.DeviceEpoint }, { "Cluster_ID", clusterId }, { "Command", 120 } };
                var data = new Newtonsoft.Json.Linq.JObject { { "Undivided", 0 }, { "AttributeId", attributeId }, { "AttributeDataType", attributeDataType }, { "AttributeData", attributeData } };
                Newtonsoft.Json.Linq.JObject data = null;
                if (attributeData is int)
                {
                    data = new Newtonsoft.Json.Linq.JObject { { "Undivided", 0 }, { "AttributeId", attributeId }, { "AttributeDataType", attributeDataType }, { "AttributeData", Convert.ToInt32(attributeData) } };
                }
                else
                {
                    data = new Newtonsoft.Json.Linq.JObject { { "Undivided", 0 }, { "AttributeId", attributeId }, { "AttributeDataType", attributeDataType }, { "AttributeData", attributeData.ToString() } };
                }
                jObject.Add("Data", data);
                MyGateway.Send("SetWritableValue", jObject.ToString());
            }