From 404cdc88627f942df7944af04ee05b9d527752d6 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 30 九月 2019 13:22:40 +0800
Subject: [PATCH] 合并了徐梅的按键面板绑定
---
ZigbeeApp/Shared/Phone/ZigBee/Device/Rollershade.cs | 60 ++++++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 42 insertions(+), 18 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/Rollershade.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/Rollershade.cs
index 7c6d30a..70007db 100755
--- a/ZigbeeApp/Shared/Phone/ZigBee/Device/Rollershade.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/Rollershade.cs
@@ -16,7 +16,7 @@
/// WcdType=4锛氬紑鍚堝笜
/// WcdType=0锛氬嵎甯�
/// </summary>
- public int WcdType = 0;
+ public int WcdType = -1;
/// <summary>
///绐楀笜褰撳墠楂樺害锛屽崟浣嶏細cm.
@@ -44,7 +44,7 @@
// return 0;
// }
//}
-
+
/// <summary>
/// 绐楀笜鍏ㄥ紑鎵�鍦ㄧ殑瑙掑害锛屽崟浣嶏細0.1掳
/// </summary>
@@ -91,6 +91,30 @@
public void ReadWcdType()
{
ReadAttri(Device.Cluster_ID.WindowCovering, AttriButeId.WindowCoveringType);
+ }
+
+ /// <summary>
+ /// 璇诲彇褰撳墠绐楀笜妯″紡
+ /// </summary>
+ /// <param name="commonDevice"></param>
+ /// <param name="action"></param>
+ public static void ReadWcdTypeAction(CommonDevice commonDevice, Action action)
+ {
+ new System.Threading.Thread(() =>
+ {
+ (commonDevice as Rollershade).ReadWcdType();
+ var dateTime = DateTime.Now;
+ while ((DateTime.Now - dateTime).TotalSeconds < 10)
+ {
+ System.Threading.Thread.Sleep(100);
+ if ((commonDevice as Rollershade).WcdType != -1)
+ {
+ break;
+ }
+ }
+ action?.Invoke();
+ })
+ { IsBackground = true }.Start();
}
/// <summary>
@@ -209,7 +233,7 @@
var data = new JObject {
{ "Value", value }
};
- jObject.Add("Data", data);
+ jObject.Add("Data", data);
Gateway?.Send("DeviceControl", jObject.ToString());
}
@@ -231,7 +255,7 @@
var data = new JObject {
{ "Value", value }
};
- jObject.Add("Data", data);
+ jObject.Add("Data", data);
Gateway?.Send("DeviceControl", jObject.ToString());
}
@@ -253,7 +277,7 @@
var data = new JObject {
{ "Value", value }
};
- jObject.Add("Data", data);
+ jObject.Add("Data", data);
Gateway?.Send("DeviceControl", jObject.ToString());
}
@@ -276,7 +300,7 @@
var data = new JObject {
{ "Value", value }
};
- jObject.Add("Data", data);
+ jObject.Add("Data", data);
Gateway?.Send("DeviceControl", jObject.ToString());
}
@@ -336,15 +360,15 @@
try
{
int attributeData = 0;
- int bit0 = 0;
+ int bit0 = 0;
if (isDirectionReversed)
{
bit0 = 1;
- }
+ }
attributeData = bit0 * 1;
var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 258 }, { "Command", 120 } };
var data = new JObject { { "Undivided", 0 }, { "AttributeId", 23 }, { "AttributeDataType", 24 }, { "AttributeData", attributeData } };
- jObject.Add("Data", data);
+ jObject.Add("Data", data);
Gateway.Send("SetWritableValue", jObject.ToString());
}
catch { }
@@ -425,9 +449,9 @@
try
{
- int attributeData = 0;
- int bit2 = 0;
-
+ int attributeData = 0;
+ int bit2 = 0;
+
if (isMotorMaintenance)
{
bit2 = 1;
@@ -435,7 +459,7 @@
attributeData = bit2 * 4;
var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 258 }, { "Command", 120 } };
var data = new JObject { { "Undivided", 0 }, { "AttributeId", 23 }, { "AttributeDataType", 24 }, { "AttributeData", attributeData } };
- jObject.Add("Data", data);
+ jObject.Add("Data", data);
Gateway.Send("SetWritableValue", jObject.ToString());
}
catch { }
@@ -527,7 +551,7 @@
}
var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 258 }, { "Command", 120 } };
var data = new JObject { { "Undivided", 0 }, { "AttributeId", 0xea01 }, { "AttributeDataType", 32 }, { "AttributeData", tempLimit } };
- jObject.Add("Data", data);
+ jObject.Add("Data", data);
Gateway.Send("SetWritableValue", jObject.ToString());
}
catch { }
@@ -622,11 +646,11 @@
System.Console.WriteLine("SetWritableValue_Actions 鍚姩" + "_" + System.DateTime.Now.ToString());
try
- {
-
+ {
+
var jObject = new JObject { { "DeviceAddr", DeviceAddr }, { "Epoint", DeviceEpoint }, { "Cluster_ID", 258 }, { "Command", 120 } };
var data = new JObject { { "Undivided", 0 }, { "AttributeId", 0xea02 }, { "AttributeDataType", 32 }, { "AttributeData", 1 } };
- jObject.Add("Data", data);
+ jObject.Add("Data", data);
Gateway.Send("SetWritableValue", jObject.ToString());
}
catch { }
@@ -773,7 +797,7 @@
/// </summary>
DownLimit = 0x08,
- }
+ }
#endregion
}
}
--
Gitblit v1.8.0