| | |
| | | { |
| | | try |
| | | { |
| | | var mMes = Encoding.UTF8.GetString(e.ApplicationMessage.Payload); |
| | | Newtonsoft.Json.Linq.JObject pairs = Newtonsoft.Json.Linq.JObject.Parse(mMes); |
| | | var pairSid = pairs.GetValue("sid").ToString(); |
| | | var pairOnline = pairs.GetValue("online"); |
| | | if (!string.IsNullOrEmpty(pairSid.ToString())) |
| | | { |
| | | var function_online = FunctionList.List.Functions.Find((obj) => obj.sid == pairSid); |
| | | if (function_online != null){ |
| | | function_online.online2d = (bool)pairOnline; |
| | | HomePage.LoadEvent_RefreshDevcieOnline(function_online); |
| | | FunctionPage.UpdataOnline(function_online); |
| | | RoomPage.UpdataOnline(function_online); |
| | | } |
| | | } |
| | | //var mMes = Encoding.UTF8.GetString(e.ApplicationMessage.Payload); |
| | | //Newtonsoft.Json.Linq.JObject pairs = Newtonsoft.Json.Linq.JObject.Parse(mMes); |
| | | //var pairSid = pairs.GetValue("sid").ToString(); |
| | | //var pairOnline = pairs.GetValue("online"); |
| | | //if (!string.IsNullOrEmpty(pairSid.ToString())) |
| | | //{ |
| | | // var function_online = FunctionList.List.Functions.Find((obj) => obj.sid == pairSid); |
| | | // if (function_online != null){ |
| | | // function_online.online = (bool)pairOnline; |
| | | // HomePage.LoadEvent_RefreshDevcieOnline(function_online); |
| | | // FunctionPage.UpdataOnline(function_online); |
| | | // RoomPage.UpdataOnline(function_online); |
| | | // } |
| | | //} |
| | | |
| | | } |
| | | catch(Exception ex) |
| | |
| | | } |
| | | #endregion |
| | | //A网关设备状态-包含涂鸦设备 |
| | | //Tag 网络状态解析 |
| | | else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/property/send") |
| | | { |
| | | var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); |
| | | var revString = Encoding.UTF8.GetString(bytes); |
| | | MainPage.Log($"mqtt 状态更新:{revString}"); |
| | | Control.Ins.UpdataFunctionStatus(revString, null, true); |
| | | //Control.Ins.MsgInfoList.Add($"mqtt 状态更新:{revString}"); |
| | | |
| | | //Control.Ins.MsgInfoList.Add(revString + "\r\n"); |
| | | } |
| | | //一端口数据解析 |
| | |
| | | //创建AES解密器对象 |
| | | var cTransform = rm.CreateDecryptor(); |
| | | |
| | | byte[] reData = null; |
| | | //使用AES将密文流转成明文的字节数组 |
| | | return cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); |
| | | try |
| | | { |
| | | reData = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine(ex.Message); |
| | | } |
| | | return reData; |
| | | } |
| | | #endregion |
| | | |