From 23532fa8ad34c89b6d24b01eaef6475fd0aad898 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 15 四月 2020 18:08:24 +0800
Subject: [PATCH] ???????
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs
index 3cccd94..a650b64 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceAttributeLogic.cs
@@ -47,9 +47,9 @@
/// <param name="clusterId">闀濱D</param>
/// <param name="attributeId">灞炴�D</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());
}
--
Gitblit v1.8.0