| | |
| | | } |
| | | set |
| | | { |
| | | if (_GatewayOnline_Local != value) |
| | | //if (_GatewayOnline_Local != value) |
| | | { |
| | | _GatewayOnline_Local = value; |
| | | if (value) |
| | |
| | | } |
| | | set |
| | | { |
| | | if (_GatewayOnline_Cloud != value) |
| | | //if (_GatewayOnline_Cloud != value) |
| | | { |
| | | _GatewayOnline_Cloud = value; |
| | | if(GatewayOnline_Local) |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送读取命令 |
| | | /// 自动判断是否为A协议设备 |
| | | /// </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($"本地通讯 发送HDL-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) |