From b3f565b6c588e3eb64d3c1f00dc9f8d272e8d2d0 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期三, 02 三月 2022 11:48:40 +0800
Subject: [PATCH] 2022-3-2-01

---
 HDL_ON/DAL/DriverLayer/Control.cs |   48 ++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 277b20b..98bc02e 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
         {
@@ -768,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;
@@ -865,7 +866,7 @@
 
                 if (receiveObj.Topic == CommunicationTopic.SearchLoaclGatewayReply || receiveObj.Topic == CommunicationTopic.GatewayBroadcast)
                 {
-                   
+
                     var bodyJObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack>(res[1]);
                     if (bodyJObj == null)
                     {
@@ -979,9 +980,10 @@
                         var localFunction = allLocalFuntion.Find((obj) => obj.sid == updateTemp.sid);
                         if (localFunction == null)
                         {
-                            Console.WriteLine("鎵句笉鍒伴煶涔愭挱鏀惧櫒娣�=======" + revString);
                             continue;
                         }
+                        MainPage.Log(localFunction.name);
+
                         if (Ins.GatewayOnline_Local && isCloudData)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�
                         {
                             if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk) && !SPK.MusicSpkList().Contains( localFunction.spk))
@@ -1006,7 +1008,7 @@
                         {
                             localFunction.time_stamp = temp.time_stamp;
                             localFunction.SetAttrState(attr.key, attr.value);
-                            Console.WriteLine("闊充箰鎾斁鍣ㄦ坊鍔犵紦瀛樻暟鎹�=======" + revString);
+                            //Console.WriteLine("闊充箰鎾斁鍣ㄦ坊鍔犵紦瀛樻暟鎹�=======" + revString);
 
                         }
 
@@ -1192,7 +1194,7 @@
                             case SPK.AvMusic:
                             case SPK.MusicStandard:
                                 //UI.Music.MusicMain.mMusicMain.RefreshView(updateTemp);
-                                Console.WriteLine("闊充箰鎾斁鍣ㄦ樉绀虹姸鎬�======="+ revString);
+                                //Console.WriteLine("闊充箰鎾斁鍣ㄦ樉绀虹姸鎬�======="+ revString);
                                 //wjc
                                 break;
                         }
@@ -1211,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