| | |
| | | {
|
| | | DebugPrintLog($" 本地连接成功_网关IP:{brokerName}_网关是否加:{IsEncry}_当前密码:{Password}");
|
| | | IsRemote = false;
|
| | | //Log写入(调试用)
|
| | | if (Shared.Phone.UserCenter.UserCenterResourse.HideOption.WriteSendAndReceveDataToFile == 1)
|
| | | {
|
| | | Shared.Phone.UserCenter.HdlLogLogic.Current.WriteLog(2, "本地连接成功");
|
| | | }
|
| | | }); |
| | | }
|
| | |
|
| | |
| | | }
|
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | {
|
| | | //Log写入(调试用)
|
| | | if (Shared.Phone.UserCenter.UserCenterResourse.HideOption.WriteSendAndReceveDataToFile == 1)
|
| | | {
|
| | | Shared.Phone.UserCenter.HdlLogLogic.Current.WriteLog(2, "本地连接异常:\r\n" + ex.Message);
|
| | | } |
| | | DebugPrintLog($"局域网通讯连接出异常:{ex.Message}"); |
| | | } |
| | | finally |
| | |
| | | MainAccountId = Config.Instance.Home.MainUserDistributedMark,
|
| | | SharedHid = Config.Instance.Home.Id
|
| | | };
|
| | |
|
| | | var listNotShow = new List<string>() { "NotSetAgain" };
|
| | | var resultData = await Shared.Phone.UserCenter.UserCenterLogic.GetByteResponseDataByRequestHttps("App/GetSharedHomeApiControl", false, pra, listNotShow);
|
| | | var resultData = Shared.Phone.UserCenter.UserCenterLogic.GetByteResponseDataByRequestHttps("App/GetSharedHomeApiControl", false, pra);
|
| | | if (resultData == null)
|
| | | {
|
| | | return;
|
| | |
| | | pra2.ReqDto.LoginAccessToken = loginToken; |
| | | var bytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(pra2)); |
| | | |
| | | var result = await CommonPage.Instance.DoRequestZigbeeHttpsInterface("https://global.hdlcontrol.com/HangZhouHdlCloudApi/App/GetSingleHomeGatewayPagger", bytes, loginToken);
|
| | | var result = CommonPage.Instance.DoRequestZigbeeHttpsInterface("https://global.hdlcontrol.com/HangZhouHdlCloudApi/App/GetSingleHomeGatewayPagger", bytes, loginToken);
|
| | | if (result != null)
|
| | | {
|
| | | var jobject = Newtonsoft.Json.Linq.JObject.Parse(Encoding.UTF8.GetString(result));
|
| | |
| | | ["PublishPayloadJsonStr"] = "1"
|
| | | };
|
| | | var bytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(jsonData));
|
| | | result = await CommonPage.Instance.DoRequestZigbeeHttpsInterface("https://global.hdlcontrol.com/HangZhouHdlCloudApi/EmqMqtt/GetConnMqttInfo", bytes, Config.Instance.Token);
|
| | | result = CommonPage.Instance.DoRequestZigbeeHttpsInterface("https://global.hdlcontrol.com/HangZhouHdlCloudApi/EmqMqtt/GetConnMqttInfo", bytes, Config.Instance.Token);
|
| | | } |
| | | else
|
| | | {
|
| | |
| | | ["PublishPayloadJsonStr"] = "1"
|
| | | };
|
| | | var bytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(jsonData));
|
| | | result = await CommonPage.Instance.DoRequestZigbeeHttpsInterface("https://global.hdlcontrol.com/HangZhouHdlCloudApi/EmqMqtt/ShareMemberConnMqttInfo", bytes, Config.Instance.Token);
|
| | | result = CommonPage.Instance.DoRequestZigbeeHttpsInterface("https://global.hdlcontrol.com/HangZhouHdlCloudApi/EmqMqtt/ShareMemberConnMqttInfo", bytes, Config.Instance.Token);
|
| | | } |
| | | if (result != null) |
| | | { |
| | |
| | | if (Shared.Common.Config.Instance.HomeId == "") |
| | | { |
| | | return; |
| | | }
|
| | |
|
| | | //Log写入(调试用)
|
| | | if (Shared.Phone.UserCenter.UserCenterResourse.HideOption.WriteSendAndReceveDataToFile == 1)
|
| | | {
|
| | | string text = "远程发送:";
|
| | | if (IsRemote == false) { text = "本地发送:"; }
|
| | | text += topic + "\r\n";
|
| | | text += Encoding.UTF8.GetString(message) + "\r\n";
|
| | | Shared.Phone.UserCenter.HdlLogLogic.Current.WriteLog(2, text);
|
| | | } |
| | | |
| | | if (IsRemote) |
| | |
| | | {
|
| | | DebugPrintLog($"局域网——二次发送到网关的主题:{topic}_发送到网关的数据:{System.Text.Encoding.UTF8.GetString(message)}_是否加密:{IsEncry}");
|
| | | await localMqttClient.PublishAsync(new MqttApplicationMessage { Topic = topic, Payload = message, QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.ExactlyOnce, Retain = retain });
|
| | | }
|
| | | //Log写入(调试用)
|
| | | if (Shared.Phone.UserCenter.UserCenterResourse.HideOption.WriteSendAndReceveDataToFile == 1)
|
| | | {
|
| | | Shared.Phone.UserCenter.HdlLogLogic.Current.WriteLog(2, "本地连接异常断开");
|
| | | } |
| | | }
|
| | | }
|
| | |
| | | attrId = topic.Split('/')[5]; |
| | | }
|
| | |
|
| | | //Log写入(调试用)
|
| | | if (Shared.Phone.UserCenter.UserCenterResourse.HideOption.WriteSendAndReceveDataToFile == 1)
|
| | | {
|
| | | string text = "网关回复:" + topic + "\r\n";
|
| | | text += message + "\r\n";
|
| | | Shared.Phone.UserCenter.HdlLogLogic.Current.WriteLog(2, text);
|
| | | }
|
| | |
|
| | | //全局接收网关推送的的逻辑(为了执行速度,尽可能的别加耗时的操作)
|
| | | Shared.Phone.UserCenter.HdlGatewayReceiveLogic.Current.GatewayOverallMsgReceive(gatewayID, topic, reportStatus, message); |
| | | |