| | |
| | | using System; |
| | | using MQTTnet.Client; |
| | | using System.Threading.Tasks; |
| | | using Shared; |
| | | using System.Text; |
| | | using System.Security.Cryptography; |
| | | using System.IO; |
| | | using HDL_ON.DAL; |
| | | using HDL_ON.UI; |
| | | using MQTTnet; |
| | | using HDL_ON.DAL.Server; |
| | | |
| | | namespace HDL_ON.DAL.Net |
| | | { |
| | |
| | | /// <summary> |
| | | /// 启动远程Mqtt |
| | | /// </summary> |
| | | public static async System.Threading.Tasks.Task StartCloudMqtt() |
| | | public static async Task StartCloudMqtt() |
| | | { |
| | | /* |
| | | try |
| | |
| | | MainPage.Log("Remote mqtt get Region MAC : " + UserConfig.Instance.CurrentRegion.RegionID); |
| | | var requestJson3 = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj3); |
| | | var revertObj3 = HttpServerRequest.RequestHttps("GatewayByRegionList", requestJson3, true); |
| | | if (revertObj3.StateCode == "SUCCESS") |
| | | if (revertObj3.DB_ResidenceData.residenceData.residecenInfo |
| | | { |
| | | var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GatewayRes>>(revertObj3.ResponseData.ToString()); |
| | | var gatewayList = responseDataObj; |
| | |
| | | /// <param name="message">附加数据包</param> |
| | | /// <param name="optionType">操作类型:0=网关控制;1=订阅网关数据;2=订阅网关上线数据</param> |
| | | /// <returns></returns> |
| | | public static async System.Threading.Tasks.Task MqttRemoteSend(byte[] message, int optionType = 0) |
| | | public static async Task MqttRemoteSend(byte[] message, int optionType = 0) |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | return; |
| | | } |
| | | var topicName = @"/" + MainPage.LoginUser.AccountString.ToLower() + @"/" + UserConfig.Instance.GatewayMAC.Replace(".", "") + @"/" + currentGuid; |
| | | var topicName = "";//@"/" + MainPage.LoginUser.AccountString.ToLower() + @"/" + currentGuid;//+ @"/" + UserConfig.Instance.CurrentRegion.MAC.Replace(".", "") |
| | | switch (optionType) |
| | | { |
| | | case 0: |