From e747e6d8524e3146bb48dc304a713f309966b1c6 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期二, 19 五月 2020 13:10:03 +0800 Subject: [PATCH] 新版本 --- ZigbeeApp/Shared/Phone/ZigBee/Device/Rollershade.cs | 177 ----------------------------------------------------------- 1 files changed, 0 insertions(+), 177 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/Rollershade.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/Rollershade.cs index 7a88bfd..c716216 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/Rollershade.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/Rollershade.cs @@ -243,183 +243,6 @@ Gateway?.Send("DeviceControl", jObject.ToString()); } - #region 璁剧疆寮�鍚堝笜鐢垫満鏂瑰悜. - /// <summary> - /// 璁剧疆寮�鍚堝笜鐢垫満鏂瑰悜 - /// <para>isDirectionReversed (false:鐢垫満鏂瑰悜姝e悜锛泃rue:鐢垫満鏂瑰悜鍙嶅悜锛�)</para> . - /// </summary> - public async System.Threading.Tasks.Task<SetWritableValueResponAllData> SetCurtainDirectionAsync(bool isDirectionReversed) - { - if (Gateway == null) - { - return null; - } - return await System.Threading.Tasks.Task.Run(async () => - { - SetWritableValueResponAllData d = null; - Action<string, string> action = (topic, message) => - { - var gatewayID = topic.Split('/')[0]; - var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); - - if (topic == gatewayID + "/" + "Error_Respon") - { - var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); - - if (temp == null) - { - d = new SetWritableValueResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" }; - } - else - { - d = new SetWritableValueResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; - } - } - - if (topic == gatewayID + "/" + "SetWritableValue_Respon") - { - var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetWritableValueResponData>(jobject["Data"].ToString()); - - if (tempData == null) - { - d = new SetWritableValueResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" }; - } - else - { - d = new SetWritableValueResponAllData { setWritableValueResponData = tempData }; - System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}"); - } - } - }; - Gateway.Actions += action; - System.Console.WriteLine("SetWritableValue_Actions 鍚姩" + "_" + System.DateTime.Now.ToString()); - - try - { - int attributeData = 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); - Gateway.Send("SetWritableValue", jObject.ToString()); - } - catch { } - - var dateTime = DateTime.Now; - while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) - { - await System.Threading.Tasks.Task.Delay(10); - if (d != null) - { - break; - } - } - if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) - { - d = new SetWritableValueResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" }; - } - Gateway.Actions -= action; - System.Console.WriteLine("SetWritableValue_Actions 閫�鍑�" + System.DateTime.Now.ToString()); - - return d; - }); - } - #endregion - - #region 璁剧疆寮�鍚堝笜缁存姢妯″紡 - /// <summary> - /// 璁剧疆寮�鍚堝笜缁存姢妯″紡 - /// <para>isMotorMaintenance (fasle:鐢垫満杩愯浆姝e父锛泃rue:鐢垫満鍦ㄧ淮淇ā寮忎笅杩愯锛�)</para> - /// </summary> - public async System.Threading.Tasks.Task<SetWritableValueResponAllData> SetCurtianMaintenanceAsync(bool isMotorMaintenance) - { - if (Gateway == null) - { - return null; - } - return await System.Threading.Tasks.Task.Run(async () => - { - SetWritableValueResponAllData d = null; - Action<string, string> action = (topic, message) => - { - var gatewayID = topic.Split('/')[0]; - var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); - - if (topic == gatewayID + "/" + "Error_Respon") - { - var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<CommonDevice.ErrorResponData>(jobject["Data"].ToString()); - - if (temp == null) - { - d = new SetWritableValueResponAllData { errorMessageBase = "缃戝叧閿欒鍥炲锛屼笖鏁版嵁鏄┖" }; - } - else - { - d = new SetWritableValueResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; - } - } - - if (topic == gatewayID + "/" + "SetWritableValue_Respon") - { - var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<SetWritableValueResponData>(jobject["Data"].ToString()); - - if (tempData == null) - { - d = new SetWritableValueResponAllData { errorMessageBase = "缃戝叧杩斿洖鐨勬暟鎹负绌�" }; - } - else - { - d = new SetWritableValueResponAllData { setWritableValueResponData = tempData }; - System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}"); - } - } - }; - Gateway.Actions += action; - System.Console.WriteLine("SetWritableValue_Actions 鍚姩" + "_" + System.DateTime.Now.ToString()); - - try - { - int attributeData = 0; - int bit2 = 0; - - if (isMotorMaintenance) - { - bit2 = 1; - } - 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); - Gateway.Send("SetWritableValue", jObject.ToString()); - } - catch { } - - var dateTime = DateTime.Now; - while ((DateTime.Now - dateTime).TotalMilliseconds < WaitReceiveDataTime) - { - await System.Threading.Tasks.Task.Delay(10); - if (d != null) - { - break; - } - } - if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) - { - d = new SetWritableValueResponAllData { errorMessageBase = " 鍥炲瓒呮椂锛岃閲嶆柊鎿嶄綔" }; - } - Gateway.Actions -= action; - System.Console.WriteLine("SetWritableValue_Actions 閫�鍑�" + System.DateTime.Now.ToString()); - - return d; - }); - } - #endregion - #region 璁剧疆寮�鍚堝笜闄愪綅鍙傛暟. /// <summary> /// 璁剧疆寮�鍚堝笜涓婁笅闄愪綅 -- Gitblit v1.8.0