From abf4a98837e43e542701c60b7ec6a088cd5236da Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期一, 22 二月 2021 09:10:35 +0800 Subject: [PATCH] 20210222 --- HDL_ON/DAL/DriverLayer/Control.cs | 49 ++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 44 insertions(+), 5 deletions(-) diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index f134d15..20d2fa3 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -207,9 +207,9 @@ } else if (MainPage.InternetStatus == 1) { - if (!Ins.IsRemote) + //if (!Ins.IsRemote) { - Ins.IsRemote = true; + //Ins.IsRemote = true; DAL.Mqtt.MqttClient.InitState(); } } @@ -310,6 +310,17 @@ MainPage.Log($"鍙戦�佹暟鎹�:{Newtonsoft.Json.JsonConvert.SerializeObject(commandDictionary)}"); + ///绗笁鏂规秱楦﹁澶囩粺涓�浣跨敤杩滅▼鎺у埗 + switch(function.spk) + { + case SPK.ElectricTuyaAirCleaner: + case SPK.ElectricTuyaFan: + case SPK.ElectricTuyaWaterValve: + case SPK.ElectricTuyaWeepRobot: + useRemote = true; + break; + } + //杩滅▼閫氳 if (Ins.IsRemote || useRemote == true) { @@ -342,7 +353,7 @@ var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(functionControlDataObj); var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlFunctionTopic, functionControlDataJson); new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id); - MainPage.Log($"鍙戦�丠DL-Link鏁版嵁:{functionControlDataJson}"); + MainPage.Log($"鏈湴閫氳 鍙戦�丠DL-Link鏁版嵁:{functionControlDataJson}"); } } } @@ -380,6 +391,34 @@ { var pm = new DAL.Server.HttpServerRequest(); var pack = pm.RefreshDeviceStatus(functionIds); + } + /// <summary> + /// 璇诲彇鍔熻兘璇︾粏鏁版嵁 + /// </summary> + /// <param name="functionIds"></param> + public void ReadFunctionsInfo(List<string> functionIds) + { + var pm = new DAL.Server.HttpServerRequest(); + var pack = pm.GetDeviceInfoList(functionIds); + if(pack!= null&& pack.Data!=null) + { + var ddd = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Function>>(pack.Data.ToString()); + if(ddd!= null) + { + foreach(var function in ddd) + { + var temp = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.deviceId == function.deviceId); + if(temp!= null) + { + temp = function; + if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(temp.spk)) + { + Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(temp.sid, temp.status); + } + } + } + } + } } /// <summary> @@ -423,7 +462,7 @@ }; var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(readDataObj); var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ReadStatus, functionControlDataJson); - MainPage.Log($"鍙戦�丠DL-Link鏁版嵁:{functionControlDataJson}"); + MainPage.Log($"鏈湴閫氳 鍙戦�丠DL-Link鏁版嵁:{functionControlDataJson}"); new Control_Udp().SendLocalHdlLinkData(sendBytes, readDataObj.id); } } @@ -882,7 +921,7 @@ case SPK.ElectricTuyaWeepRobot: case SPK.ElectricTuyaWaterValve: //璁惧鐘舵�佹帹閫� - var myDevice = Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp); + var myDevice = Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid,updateTemp.status); if (myDevice != null) { localObj = myDevice; -- Gitblit v1.8.0