| | |
| | | /// </summary> |
| | | public void OpenTcpClent() |
| | | { |
| | | return; |
| | | if (myTcpClient == null) |
| | | { |
| | | myTcpClient = new Control_TcpClient(reportIp); |
| | |
| | | /// </summary> |
| | | public void LoginGateway() |
| | | { |
| | | return;//tcp控制存在问题,但是先不用tcp控制了,要经过测试先 2023-07-29 10:14:32 |
| | | if (loginGatewayThread == null) |
| | | { |
| | | loginGatewayThread = new System.Threading.Thread(() => |
| | |
| | | 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(); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 更新设备状态 |
| | | /// 更新群控设备状态 |
| | | /// A协议数据 |
| | | /// </summary> |
| | | public void UpdataGroupControlStatus(string revString, byte[] usefulBytes, bool isCloudData = false) |
| | |
| | | // return; |
| | | //} |
| | | |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString); |
| | | var temp = JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString); |
| | | if (temp != null) |
| | | { |
| | | Control_Udp.ReceiveRepeatManager(temp.id, usefulBytes); |
| | |
| | | { |
| | | localFunction.time_stamp = temp.time_stamp; |
| | | localFunction.SetAttrState(attr.key, attr.value); |
| | | |
| | | |
| | | } |
| | | if(localFunction.spk == SPK.AirSwitchP3) |
| | | { |
| | | localFunction.online = updateTemp.online; |
| | | } |
| | | |
| | | //更新界面状态 |
| | |
| | | EnergyMainPage.UpdataStatus(localFunction); |
| | | } |
| | | break; |
| | | case SPK.AirSwitchP3: |
| | | AirSwitchP3Page.UpdataState(localFunction); |
| | | AirSwitchP3SubloopEnergyPage.UpdataStatus(localFunction); |
| | | break; |
| | | case SPK.ElectricEnergy: |
| | | EnergyMainPage.UpdataStatus(localFunction); |
| | | break; |