From 07b0239f824ddb5a0cadf93f20ff6247f72baca2 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期三, 19 一月 2022 11:32:03 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/wxr0114' into wjc --- HDL_ON/DAL/DriverLayer/Control.cs | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 50 insertions(+), 8 deletions(-) diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 24300c5..17cc7b5 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -1,6 +1,7 @@ 锘縰sing System; using System.Collections.Generic; using System.Text; +using HDL_ON.DAL.Server; using HDL_ON.Entity; using HDL_ON.UI; using Shared; @@ -25,7 +26,7 @@ public class Control { - + static Control _control; public static Control Ins { @@ -503,11 +504,18 @@ { new System.Threading.Thread(() => { - foreach (var temp in functions) + foreach (var function in functions) { Dictionary<string, string> d1 = new Dictionary<string, string>(); d1.Add(FunctionAttributeKey.OnOff, open ? "on" : "off"); - SendWriteCommand(temp, d1); + if (function.spk == SPK.PanelSocket) + { + if (function.attributes.Find((obj) => obj.key == "on_off_usb") != null) + { + d1.Add("on_off_usb", function.trait_on_off.curValue.ToString()); + } + } + SendWriteCommand(function, d1); System.Threading.Thread.Sleep(100); } }) @@ -761,8 +769,8 @@ topicAndLengthBytes.CopyTo(sendDataBytes, 0); bodyBytes.CopyTo(sendDataBytes, topicAndLengthBytes.Length); - //var sendDataString = Encoding.UTF8.GetString(sendDataBytes); - //MainPage.Log($"杞崲HDL-Link鏁版嵁\r\n{sendDataString}\r\n"); + var sendDataString = Encoding.UTF8.GetString(sendDataBytes); + MainPage.Log($"杞崲HDL-Link鏁版嵁\r\n{sendDataString}\r\n"); //*************************************************************** return sendDataBytes; @@ -835,7 +843,7 @@ var revString = Encoding.UTF8.GetString(receiveBytes); receiveObj.BodyDataString = revString; MainPage.Log($"灞�鍩熺綉淇℃伅: 瑙e瘑鍚庯細" + receiveObj.BodyDataString); - //if(receiveObj.Topic.EndsWith("/thing/property/up")) + //if (receiveObj.Topic.EndsWith("/thing/property/up")) //{ // MsgInfoList.Add(revString + "\r\n"); //} @@ -858,7 +866,7 @@ if (receiveObj.Topic == CommunicationTopic.SearchLoaclGatewayReply || receiveObj.Topic == CommunicationTopic.GatewayBroadcast) { - + var bodyJObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack>(res[1]); if (bodyJObj == null) { @@ -974,6 +982,8 @@ { continue; } + MainPage.Log(localFunction.name); + if (Ins.GatewayOnline_Local && isCloudData)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞� { if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk) && !SPK.MusicSpkList().Contains( localFunction.spk)) @@ -998,6 +1008,7 @@ { localFunction.time_stamp = temp.time_stamp; localFunction.SetAttrState(attr.key, attr.value); + //Console.WriteLine("闊充箰鎾斁鍣ㄦ坊鍔犵紦瀛樻暟鎹�=======" + revString); } @@ -1154,6 +1165,7 @@ case SPK.ElectricSocket: case SPK.PanelSocket: SocketPage.UpdataState(localFunction); + SocketPage_InstantaneousValue.UpdataView(localFunction); break; case SPK.ElectricTV: break; @@ -1201,5 +1213,35 @@ } } + + + #region 闂ㄩ攣 + + /// <summary> + /// //涓�閿紙杩滅▼锛夊紑閿� + /// </summary> + public void OneKeyUnlocking(Function doorlock,string extStr) + { + if (Ins.GatewayOnline_Local) + { + Dictionary<string, string> dic = new Dictionary<string, string>(); + var functionControlDataObj = doorlock.GetGatewayAlinkDoorlockData(UserInfo.Current.ID,extStr); + var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(functionControlDataObj); + var sendBytes = Ins.ConvertSendBodyData($"/base/{Control.Ins.GatewayId}/thing/service/doorRemoteOpen/down", functionControlDataJson); + new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id, 0); + } + else + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); + d.Add("deviceId", doorlock.deviceId); + var requestJson = HttpUtil.GetSignRequestJson(d); + HttpUtil.RequestHttpsPost("/home-wisdom/app/device/door/remoteOpen", requestJson); + } + } + //瀵嗙爜鍐荤粨 + //瀵嗙爜楠岃瘉 + + #endregion } -} \ No newline at end of file +} -- Gitblit v1.8.0