From 62d77d3bb8e7215d9da9ecf6f5aeda0b69f805f8 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期二, 08 十二月 2020 18:57:15 +0800 Subject: [PATCH] 20201208 --- HDL_ON/Entity/Function/Function.cs | 49 +++++++++++++++++++++++++++++++++++++------------ 1 files changed, 37 insertions(+), 12 deletions(-) diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 2a722a1..9376caf 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -31,7 +31,6 @@ { } - #region base info /// <summary> /// HDL缁熶竴鍗忚鏍煎紡锛�14bytes @@ -115,6 +114,15 @@ /// 璇ュ姛鑳芥坊鍔犲埌鍒版埧闂村垪琛� /// </summary> public List<string> roomIds = new List<string>(); + /// <summary> + /// 缁戝畾鎴块棿 + /// </summary> + public void BindRoom(string roomId) + { + roomIds.Add(roomId); + var pm = new DAL.Server.HttpServerRequest(); + pm.BindDeviceToRoom(deviceId, roomId); + } /// <summary> /// bus鍗忚鏁版嵁鏍煎紡 @@ -284,11 +292,29 @@ /// <summary> /// 淇濆瓨鍔熻兘鏁版嵁 /// </summary> - public void SaveFunctionData() + public void SaveFunctionData(bool upSevser) { - var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); - FileUtils.WriteFileByBytes(savePath, ssd); - MainPage.Log($"Save FunctionData {this.functionType} : {this.sid}"); + if (upSevser) + { + var pm = new DAL.Server.HttpServerRequest(); + var pack = pm.UpdataDevcieInfo(this); + if (pack.Code == DAL.Server.StateCode.SUCCESS) + { + var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); + FileUtils.WriteFileByBytes(savePath, ssd); + MainPage.Log($"Save FunctionData {this.functionType} : {this.sid}"); + } + else + { + Utlis.ShowTip(Language.StringByID(StringId.EditFunctionInfoFail) + "Code:" + pack.Code); + } + } + else + { + var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); + FileUtils.WriteFileByBytes(savePath, ssd); + MainPage.Log($"Save FunctionData {this.functionType} : {this.sid}"); + } } /// <summary> @@ -313,9 +339,9 @@ /// <summary> /// 鑾峰彇鏈湴鎺у埗鏁版嵁 /// </summary> - public GatewayAlinkControlObj GetGatewayAlinkControlData(Dictionary<string, string> commandDictionary) + public AlinkFunctionStatusObj GetGatewayAlinkControlData(Dictionary<string, string> commandDictionary) { - var sendDataObj = new GatewayAlinkControlObj(); + var sendDataObj = new AlinkFunctionStatusObj(); sendDataObj.id = Control.Ins.msg_id.ToString(); sendDataObj.time_stamp = Control.Ins.Get_TimeStamp(); @@ -377,10 +403,9 @@ } /// <summary> - /// 鏈湴鎺у埗 /// A鍗忚鎺у埗鏁版嵁鐨勫璞� /// </summary> - public class GatewayAlinkControlObj + public class AlinkFunctionStatusObj { public List<AlinkControlData> objects = new List<AlinkControlData>(); @@ -391,7 +416,7 @@ /// 鏈湴鐘舵�佽鍙� /// A鍗忚鐘舵�佽鍙栨牸寮忓璞� /// </summary> - public class GatewayAlinkReadObj + public class AlinkReadFunctionStatusObj { public string id = "0"; public List<Dictionary<string, string>> objects = new List<Dictionary<string, string>>(); @@ -439,11 +464,11 @@ /// <summary> /// 鏈�澶у�� /// </summary> - public int max; + public int max=100; /// <summary> /// 鏈�灏忓�� /// </summary> - public int min; + public int min=0; /// <summary> /// 鏁版嵁绫诲瀷 /// </summary> -- Gitblit v1.8.0