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/Scene.cs | 203 -------------------------------------------------- 1 files changed, 1 insertions(+), 202 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Device/Scene.cs b/ZigbeeApp/Shared/Phone/ZigBee/Device/Scene.cs index ad523d5..baa735d 100755 --- a/ZigbeeApp/Shared/Phone/ZigBee/Device/Scene.cs +++ b/ZigbeeApp/Shared/Phone/ZigBee/Device/Scene.cs @@ -330,7 +330,7 @@ /// 鑾峰彇鎵�鏈夊満鏅殑鎵�鏈変俊鎭� /// </summary> [System.Serializable] - public class GetSceneAllInfo:CommonDevice + public class GetSceneAllInfo { /// <summary> ///鍦烘櫙鎬绘暟 @@ -412,59 +412,6 @@ public int MemberNumber; } - #endregion - - #region 鑾峰彇鍦烘櫙鍒楄〃 - ///<summary > - ///鑾峰彇鍦烘櫙鍒楄〃 - ///</summary> - public static async System.Threading.Tasks.Task<List<GetSceneAllInfo>> GetSceneListAsync() - { - return await System.Threading.Tasks.Task.Run(async () => { - var dateTime = DateTime.Now; - GetSceneAllData d = null; - var mainGateway = ZbGateway.MainGateWay; - if (mainGateway == null) - { - d = new GetSceneAllData { errorMessageBase = "褰撳墠娌℃湁涓荤綉鍏�" }; - return null; - } - - var listScene = new List<GetSceneAllInfo>(); - Action<string, string> action = (topic, message) => - { - var gatewayID = topic.Split('/')[0]; - var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); - - if (topic == gatewayID + "/" + "Scene/GetAllInfo_Respon") - { - dateTime = DateTime.Now; - var sceneGetAllInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<GetSceneAllInfo>(jobject["Data"].ToString()); - listScene.Add(sceneGetAllInfo); - - System.Console.WriteLine($"UI鏀跺埌閫氱煡鍚庣殑涓婚_{ topic}"); - } - }; - mainGateway.Actions += action; - System.Console.WriteLine("Scene/GetAllInfo_Actions 鍚姩" + System.DateTime.Now.ToString()); - try - { - var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 807 } }; - mainGateway.Send(("Scene/GetAllInfo"),System.Text.Encoding.UTF8.GetBytes(jObject.ToString())); - } - catch { } - - while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) - { - await System.Threading.Tasks.Task.Delay(10); - } - - mainGateway.Actions -= action; - System.Console.WriteLine("Scene/GetAllInfo_Actions 閫�鍑�" + System.DateTime.Now.ToString()); - - return listScene; - }); - } #endregion #region 鍙兘鑾峰彇鍦烘櫙淇℃伅锛屾病鏈夊満鏅腑鐨勮澶囦俊鎭� @@ -1815,153 +1762,5 @@ public int ScenesId; } - - //public static string SceneFilePath = "SceneFile"; - - //static Scene() - //{ - // if (null == Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(Encoding.UTF8.GetString(Shared.IO.FileUtils.ReadFile(SceneFilePath)))) - // { - // //鍒濆鍖栧満鏅垪琛� - // Shared.IO.FileUtils.WriteFileByBytes(SceneFilePath, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(new List<string>()))); - // } - //} - - ///// <summary> - ///// 淇濆瓨褰撳墠鍦烘櫙 - ///// </summary> - ///// <param name="scenceFilePath">Scence file path.</param> - //public void Save(string scenceFilePath) - //{ - // Shared.IO.FileUtils.WriteFileByBytes(scenceFilePath, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); - //} - - /// <summary> - /// 鏍规嵁鍦烘櫙璺緞鎭㈠鍦烘櫙瀵硅薄 - /// </summary> - /// <returns>The by file path.</returns> - /// <param name="sceneFilePath">Room file path.</param> - //public static Scene GetSceneByFilePath(string sceneFilePath) - //{ - // try - // { - // return Newtonsoft.Json.JsonConvert.DeserializeObject<Scene>(System.Text.Encoding.UTF8.GetString(Shared.IO.FileUtils.ReadFile(sceneFilePath))); - // } - // catch - // { - // return new Scene(); - // } - //} - - /// <summary> - /// 鍦烘櫙鏍囪瘑 - /// </summary> - //public bool SceneLabel = false; - - /// <summary> - /// 鎺у埗鐩爣鐨勬枃浠惰矾寰�,鏍煎紡濡傦細RoomScene_+DeviceID_Mac_Epoint - /// </summary> - //public readonly List<string> DeviceFilePathList = new List<string>(); - - /// <summary> - /// 鍦烘櫙鐨勮儗鏅浘 - /// </summary> - //public string BackgroundImagePath = "Scene/s1.png"; - - /// <summary> - /// 鍦烘櫙涓殑璁惧鍒楄〃 - /// </summary> - //[Newtonsoft.Json.JsonIgnore] - //public List<Scene> sceneDeviceList = new List<Scene>(); - - //[Newtonsoft.Json.JsonIgnore] - //public List<Scene> LocalSceneList = new List<Scene>(); - - //public SceneId SceneID; - - ///<summary > - /// 浠庣綉鍏崇殑鍦烘櫙涓Щ闄よ澶� - /// </summary> - //public static void SceneRemoveMember1(ZigBee.Device.ZbGateway gateway, int ScenesId, string DeviceAddr, int Epoint) - //{ - // var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 802 } }; - // var DeviceList = new JArray - // { - // new JObject { - // { "Type", 0}, - // { "DeviceAddr",DeviceAddr}, - // { "Epoint",Epoint} - // } - // }; - // var data = new JObject { - // {"ScenesId",ScenesId}, - // { "DeviceList", DeviceList } - // }; - // jobject.Add("Data", data); - // gateway.Send(("Scene/RemoveMember"), Common.SecuritySet.Encryption((jobject.ToString()))); - - //} - - ///<summary > - /// 鍒犻櫎鍦烘櫙 - /// </summary> - //public static void SceneRemove1(ZigBee.Device.ZbGateway gateway, int scenesId) - //{ - // var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 803 } }; - // var data = new JObject { { "ScenesId", scenesId } }; - // jobject.Add("Data", data); - // gateway.Send(("Scene/Remove"), Common.SecuritySet.Encryption((jobject.ToString()))); - //} - - ///<summary > - /// 淇敼鍦烘櫙鍚嶇О - /// </summary> - //public static void SceneRename1(ZigBee.Device.ZbGateway gateway, int scenesId, string scenesName) - //{ - // var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 804 } }; - // var data = new JObject { { "ScenesId", scenesId }, { "ScenesName", scenesName } }; - // jobject.Add("Data", data); - // gateway.Send(("Scene/Rename"), Common.SecuritySet.Encryption((jobject.ToString()))); - //} - - ///<summary > - /// 鑾峰彇缃戝叧涓満鏅俊鎭� - /// </summary> - //public static void SceneGetInfo1(ZigBee.Device.ZbGateway gateway) - //{ - // var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 805 } }; - // gateway.Send(("Scene/GetInfo"), Common.SecuritySet.Encryption((jobject.ToString()))); - //} - - ///<summary > - ///鑾峰彇缃戝叧涓満鏅殑璁惧鍒楄〃 - /// </summary> - //public static void SceneGetDeviceList1(ZigBee.Device.ZbGateway gateway, int ScenesId) - //{ - // var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 806 } }; - // var data = new JObject { { "ScenesId", ScenesId } }; - // jobject.Add("Data", data); - // gateway.Send(("Scene/GetDeviceList"), Common.SecuritySet.Encryption((jobject.ToString()))); - //} - - ///<summary > - /// 鑾峰彇鎵�鏈夊満鏅俊鎭紙鍖呮嫭鍦烘櫙璁惧鍒楄〃锛� - /// </summary> - //public static void SceneGetAllInfo1(ZigBee.Device.ZbGateway gateway) - //{ - // var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 807 } }; - // gateway.Send(("Scene/GetAllInfo"), Common.SecuritySet.Encryption((jobject.ToString()))); - //} - - ///<summary > - ///璋冪敤鍦烘櫙 - /// </summary> - //public static void SceneOpen1(ZigBee.Device.ZbGateway gateway, int ScenesId) - //{ - // var jobject = new JObject { { "Cluster_ID", 0 }, { "Command", 808 } }; - // var data = new JObject { { "ScenesId", ScenesId } }; - // jobject.Add("Data", data); - // gateway.Send(("Scene/Open"), Common.SecuritySet.Encryption((jobject.ToString()))); - //} } } -- Gitblit v1.8.0