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 |   75 +++++++++++++++++++++++++++++++++----
 1 files changed, 67 insertions(+), 8 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 28ef74e..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
         {
@@ -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;
@@ -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,19 +982,34 @@
                         {
                             continue;
                         }
+                        MainPage.Log(localFunction.name);
+
                         if (Ins.GatewayOnline_Local && isCloudData)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�
                         {
-                            if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk))
+                            if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk) && !SPK.MusicSpkList().Contains( localFunction.spk))
                             {
                                 //MainPage.Log($"A鍗忚鏇存柊鐘舵��:鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�........");
+
                                 return;
                             }
                         }
+
+                        //if (SPK.MusicSpkList().Contains(localFunction.spk))
+                        //{
+                        //    if (updateTemp.status.Count < 3)
+                        //    {
+                        //        ///鏄煶涔愬姛鑳界殑
+                        //        ///涓婃姤灞炴�у皯3鏉′笉鍋氬鐞�
+                        //        return;
+                        //    }
+                        //}
                         //MainPage.Log($"A鍗忚鏇存柊鐘舵��:{revString}");
                         foreach (var attr in updateTemp.status)
                         {
                             localFunction.time_stamp = temp.time_stamp;
                             localFunction.SetAttrState(attr.key, attr.value);
+                            //Console.WriteLine("闊充箰鎾斁鍣ㄦ坊鍔犵紦瀛樻暟鎹�=======" + revString);
+
                         }
 
                         //鏇存柊鐣岄潰鐘舵��
@@ -1168,6 +1191,12 @@
                                 //鐘舵�佹洿鏂�
                                 Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status);
                                 break;
+                            case SPK.AvMusic:
+                            case SPK.MusicStandard:
+                                //UI.Music.MusicMain.mMusicMain.RefreshView(updateTemp);
+                                //Console.WriteLine("闊充箰鎾斁鍣ㄦ樉绀虹姸鎬�======="+ revString);
+                                //wjc
+                                break;
                         }
 
                         HomePage.UpdataFunctionStates(localFunction);
@@ -1184,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