From e34270918f2e831048114ecdfcfec3e3cdbb6fd7 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 26 五月 2022 17:42:58 +0800 Subject: [PATCH] Merge branch 'release0123' into wxr0114 --- HDL_ON/DAL/DriverLayer/Control.cs | 77 +++++++++++++++++++++++++++++++++++++- 1 files changed, 75 insertions(+), 2 deletions(-) diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index f14125b..8045608 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -94,7 +94,7 @@ } set { - if (_GatewayOnline_Local != value) + //if (_GatewayOnline_Local != value) { _GatewayOnline_Local = value; if (value) @@ -129,7 +129,7 @@ } set { - if (_GatewayOnline_Cloud != value) + //if (_GatewayOnline_Cloud != value) { _GatewayOnline_Cloud = value; if(GatewayOnline_Local) @@ -655,6 +655,79 @@ } /// <summary> + /// 鍙戦�佽鍙栧懡浠� + /// 鑷姩鍒ゆ柇鏄惁涓篈鍗忚璁惧 + /// </summary> + public void SendReadCommand(List<Function> functions, bool forceRemote = false) + { + List<string> sids = new List<string>(); + foreach (Function function in functions) + { + sids.Add(function.sid); + function.refreshTime = DateTime.Now; + } + if (forceRemote) + { + + var pm = new DAL.Server.HttpServerRequest(); + var pack = pm.RefreshDeviceStatus(sids); + } + else + { + if (Ins.GatewayOnline_Local) + { + + if (DB_ResidenceData.Instance.GatewayType == 0) + { + try + { + var busClient = new Control_Udp(); + foreach (Function function in functions) + { + busClient.ReadBusData(function); + } + + } + catch (Exception ex) + { + MainPage.Log($"鍙戦�佹暟鎹紓甯�: {ex.Message}"); + } + } + else + { + var objects = new List<Dictionary<string, string>>(); + + + foreach (Function function in functions) + { + var readKey = new Dictionary<string, string>(); + readKey.Add("sid", function.sid); + objects.Add(readKey); + } + + + var readDataObj = new AlinkReadFunctionStatusObj() + { + id = Ins.msg_id.ToString(), + objects = objects, + time_stamp = Utlis.GetTimestamp() + }; + var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(readDataObj); + var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ReadStatus, functionControlDataJson); + MainPage.Log($"鏈湴閫氳 鍙戦�丠DL-Link鏁版嵁:{functionControlDataJson}"); + new Control_Udp().SendLocalHdlLinkData(sendBytes, readDataObj.id); + } + } + else + { + var pm = new DAL.Server.HttpServerRequest(); + var pack = pm.RefreshDeviceStatus(sids); + } + } + } + + + /// <summary> /// 瀹夐槻鎺у埗 /// </summary> public void ControlSecurity(SecurityAlarm securityAlarm,string state) -- Gitblit v1.8.0