From 46a177eb1acf7ce91af7fe9ff57af87228de938d Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 17 十月 2023 10:03:24 +0800
Subject: [PATCH] IOS库更新

---
 HDL_ON/DAL/DriverLayer/Control.cs |   52 +++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index c95823d..ca48600 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -732,8 +732,18 @@
                 }
                 else
                 {
-                    var pm = new DAL.Server.HttpServerRequest();
-                    var pack = pm.RefreshDeviceStatus(new List<string>() { function.deviceId });
+                    var pm = new HttpServerRequest();
+                    try
+                    {
+                        pm.RefreshDeviceStatus(new List<string>() { function.deviceId });
+                    }catch(Exception ex)
+                    {
+                        MainPage.Log($"杩滅▼璇诲彇璁惧鐘舵�佸紓甯�:{ex.Message}");
+                    }
+                    finally
+                    {
+                        pm = null;
+                    }
                 }
             }
         }
@@ -870,7 +880,7 @@
                         },
                     time_stamp = Utlis.GetTimestamp()
                 };
-                var aLinkJson = Newtonsoft.Json.JsonConvert.SerializeObject(aLinkData);
+                var aLinkJson = JsonConvert.SerializeObject(aLinkData);
                 var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlScene, aLinkJson);
                 new Control_Udp().SendLocalHdlLinkData(sendBytes, aLinkData.id, 0);
             }
@@ -1127,6 +1137,7 @@
                     receiveObj.Topic.Contains(CommunicationTopic.ct.GatewayUpSortTopic))
                 {
                     //TODO 鏆傛椂涓嶄紶姝g‘鐨勬暟鎹笂鍘伙紝濡傛灉鍚庨潰瑕佷紭鍖栧墠闈㈣繖浜涗唬鐮�
+                    //Console.WriteLine($"{receiveObj.Topic}\r\n{receiveObj.BodyDataString}");
                     UpdataFunctionStatus(receiveObj.BodyDataString, null);
                 }
                 else if (receiveObj.Topic == CommunicationTopic.ct.ControlSeurity + "_reply"
@@ -1236,7 +1247,7 @@
                         {
                             continue;
                         }
-                        MainPage.Log($"鏀跺埌鏁版嵁:{revString}");
+                        MainPage.Log($"鏀跺埌缇ゆ帶鏁版嵁:{revString}");
                         foreach (var attr in updateTemp.status)
                         {
                             localFunction.time_stamp = temp.time_stamp;
@@ -1312,16 +1323,6 @@
                         }
                         MainPage.Log(localFunction.name);
 
-                        if (Ins.GatewayOnline_Local && isCloudData)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�
-                        {
-                            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)
@@ -1342,6 +1343,11 @@
                         {
                             localFunction.online = updateTemp.online;
                         }
+                        if (SPK.LightSpkList().Contains(localFunction.spk))
+                        {
+                            localFunction.updateTime = DateTime.Now;
+                        }
+                       
 
                         //鏇存柊鐣岄潰鐘舵��
                         switch (localFunction.spk)
@@ -1531,7 +1537,6 @@
                             case SPK.ElectricTuyaWeepRobot2:
                             case SPK.ElectricTuyaWaterValve:
                             case SPK.ElectricTuyaWaterValve2:
-                            case SPK.SensorPir:
                             case SPK.SensorDoorWindow:
                             case SPK.SensorSmoke:
                             case SPK.SensorWater:
@@ -1544,6 +1549,22 @@
                             case SPK.MechanicalArm:
                                 //璁惧鐘舵�佹帹閫�
                                 //鐘舵�佹洿鏂�
+                                Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status);
+                                break;
+                            case SPK.SensorPir:
+                            case SPK.SensorPirHold:
+                                var tempPirStatus = localFunction.attributes.Find((sta) => sta.key == "people_status");
+                                if (tempPirStatus != null)
+                                {
+                                    if(tempPirStatus.state == "true")
+                                    {
+                                        localFunction.lastState = Language.StringByID(StringId.Someone);
+                                    }
+                                    else
+                                    {
+                                        localFunction.lastState = Language.StringByID(StringId.wuren);
+                                    }
+                                }
                                 Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status);
                                 break;
                             case SPK.SenesorMegahealth:
@@ -1606,6 +1627,7 @@
                                 break;
                         }
 
+                        
                         HomePage.UpdataFunctionStates(localFunction);
                         RoomPage.UpdataStates(localFunction);
                         FunctionPage.UpdataStates(localFunction);

--
Gitblit v1.8.0