| | |
| | | /// </summary> |
| | | public void OpenTcpClent() |
| | | { |
| | | return; |
| | | if (myTcpClient == null) |
| | | { |
| | | myTcpClient = new Control_TcpClient(reportIp); |
| | |
| | | var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlFunctionTopic, functionControlDataJson); |
| | | new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id, resend); |
| | | MainPage.Log($"本地通讯 发送HDL-Link数据:{functionControlDataJson}"); |
| | | Ins.myTcpClient.SendMessage(sendBytes); |
| | | //Ins.myTcpClient.SendMessage(sendBytes); |
| | | } |
| | | } |
| | | //远程通讯 |
| | |
| | | { |
| | | foreach (var temp in functions) |
| | | { |
| | | if((temp.trait_on_off.state.ToString() == "on" && open)|| temp.trait_on_off.state.ToString() == "off"&& !open) |
| | | { |
| | | continue; |
| | | } |
| | | var apiControlData = temp.GetApiControlData(d); |
| | | actionObjs.Add(apiControlData); |
| | | count++; |
| | |
| | | System.Threading.Thread.Sleep(100); |
| | | } |
| | | } |
| | | var pack = pm.ControlDevice(actionObjs); |
| | | if (actionObjs.Count > 0) |
| | | { |
| | | var pack = pm.ControlDevice(actionObjs); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | }, |
| | | time_stamp = Utlis.GetTimestamp() |
| | | }; |
| | | var aLinkJson = Newtonsoft.Json.JsonConvert.SerializeObject(aLinkData); |
| | | var aLinkJson = JsonConvert.SerializeObject(aLinkData); |
| | | var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlScene, aLinkJson); |
| | | new Control_Udp().SendLocalHdlLinkData(sendBytes, aLinkData.id, 0); |
| | | } |
| | |
| | | |
| | | if (receiveObj.Topic == CommunicationTopic.ct.HeartBeat + "_reply") |
| | | { |
| | | Ins.myTcpClient.ClearHeartBeatLog(); |
| | | //Ins.myTcpClient.ClearHeartBeatLog(); |
| | | MainPage.Log("tcp心跳回复"); |
| | | return null; |
| | | } |
| | |
| | | Ins.IsLocalEncrypt = device.isLocalEncrypt; |
| | | //MainPage.Log("网关本地加密状态:" + device.local_encrypt.ToString()); |
| | | //登录网关Tcp |
| | | OpenTcpClent(); |
| | | //OpenTcpClent(); |
| | | |
| | | |
| | | } |