From 18dcc85b17b351cf7948e22908d5128231aea2e0 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期二, 29 十月 2019 14:32:12 +0800
Subject: [PATCH] 2019-10-29-2
---
ZigbeeApp/Shared/Phone/Device/Logic/Send.cs | 57 +++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 39 insertions(+), 18 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
old mode 100755
new mode 100644
index 348124f..8b0238f
--- a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
@@ -14,7 +14,7 @@
/// 鑾峰彇LogicId鐨勬柟娉�
/// </summary>
/// <returns>The logic identifier.</returns>
- public static async System.Threading.Tasks.Task<List<int>> GetLogicId()
+ public static async System.Threading.Tasks.Task<List<int>> GetLogicId(int LogicType)
{
return await System.Threading.Tasks.Task.Run(async () =>
{
@@ -53,6 +53,8 @@
mainGateWay.GwResDataAction += action;
var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 2004 } };
+ var jObjectdata1 = new JObject { { "LogicType", LogicType } };
+ jObject.Add("Data", jObjectdata1);
mainGateWay?.Send("Logic/GetLogicList", jObject.ToString());
//await System.Threading.Tasks.Task.Run(async () =>
//{
@@ -74,7 +76,7 @@
/// 鑾峰彇Logic鐨勬柟娉�
/// </summary>
/// <returns>The logic identifier.</returns>
- public static async System.Threading.Tasks.Task<Common.Logic> GetLogic(int LogicId)
+ public static async System.Threading.Tasks.Task<Common.Logic> GetLogic(int LogicId,int LogicType)
{
return await System.Threading.Tasks.Task.Run(async () =>
{
@@ -149,7 +151,8 @@
{
var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 2002 } };
var data = new JObject {
- { "LogicId",LogicId}
+ { "LogicId",LogicId},
+ { "LogicType",LogicType}
};
jObject.Add("Data", data);
ZbGateway.MainGateWay?.Send("Logic/GetLogicInfo", jObject.ToString());
@@ -449,13 +452,26 @@
}
}
var accounts = new JArray();
- foreach (var dictionary in logic.Accounts) {
+ foreach (var dictionary in logic.Accounts)
+ {
var Type = int.Parse(dictionary["Type"]);
switch (Type)
{
- case 1: {
+ case 1:
+ {
///
- } break;
+ if (logic.LogicType == 1)
+ {
+ var accounts1 = new JObject
+ {
+ ["Type"] = int.Parse(dictionary["Type"]),
+ ["Account"] = dictionary["Account"],
+
+ };
+ accounts.Add(accounts1);
+ }
+ }
+ break;
case 7:
{
var location = new JObject
@@ -478,6 +494,7 @@
{ "IsEnable", logic.IsEnable} ,
{ "LogicName", logic.LogicName},
{ "Relationship",logic.Relationship} ,
+ { "LogicType",logic.LogicType} ,
{ "LogicCustomPushText",logic.LogicCustomPushText} ,
{ "TimeAttribute", timeAttribute} ,
{ "Conditions", conditions },
@@ -566,13 +583,13 @@
/// 鑾峰彇Logic鍒楄〃鐨勬柟娉�
/// </summary>
/// <returns>The logic identifier.</returns>
- public static async System.Threading.Tasks.Task<List<Common.Logic>> ReadList(int sum)
+ public static async System.Threading.Tasks.Task<List<Common.Logic>> ReadList(int sum,int LogicType)
{
return await System.Threading.Tasks.Task.Run(async () =>
{
var listLogic = new List<Common.Logic>();
- bool @bool = false;
+ // bool @bool = false;
Action<string, string> action = (topic, data) =>
{
var gatewayID = topic.Split('/')[0];
@@ -590,9 +607,11 @@
logic.LogicId = int.Parse(Logicifon["LogicId"].ToString());
logic.IsEnable = int.Parse(Logicifon["IsEnable"].ToString());
logic.LogicName = Logicifon["LogicName"].ToString();
- logic.Relationship = int.Parse(Logicifon["Relationship"].ToString());
+ logic.LogicType = int.Parse(Logicifon["LogicType"].ToString());
+ logic.Relationship = int.Parse(Logicifon["Relationship"].ToString());
logic.TimeAttribute = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.TimeAttributeObj>(Logicifon["TimeAttribute"].ToString());
logic.Conditions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(Logicifon["Conditions"].ToString());
+ logic.Accounts = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(Logicifon["Accounts"].ToString());
List<Dictionary<string, object>> listactions = new List<Dictionary<string, object>>();
listactions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(Logicifon["Actions"].ToString());
@@ -639,10 +658,10 @@
}
}
- if (topic == $"{gatewayID}/Logic/AllLogicNum_Respon")
- {
- @bool = true;
- }
+ //if (topic == $"{gatewayID}/Logic/AllLogicNum_Respon")
+ //{
+ // @bool = true;
+ //}
};
var mainGateWay = ZbGateway.MainGateWay;
if (mainGateWay == null)
@@ -654,6 +673,8 @@
try
{
var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 2015 } };
+ var jObjectdata = new JObject { { "LogicType", LogicType } };
+ jObject.Add("Data", jObjectdata);
ZbGateway.MainGateWay?.Send("Logic/GetAllLogicListInfo", jObject.ToString());
}
catch { }
@@ -661,14 +682,14 @@
while ((DateTime.Now - dateTime).TotalMilliseconds < 8 * 1000)
{
await System.Threading.Tasks.Task.Delay(100);
- //if (sum == listLogic.Count)
- //{
- // break;
- //}
- if (@bool)
+ if (sum == listLogic.Count)
{
break;
}
+ //if (@bool)
+ //{
+ // break;
+ //}
}
ZbGateway.MainGateWay.GwResDataAction -= action;
return listLogic;
--
Gitblit v1.8.0