From fefffbc9451499013b7af2a15fac0ccc3b394364 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 15 四月 2024 16:31:25 +0800
Subject: [PATCH] 去掉Siri先
---
HDL_ON/DAL/DriverLayer/Control.cs | 310 ++++++++++++++++++++++++++++++++++++---------------
1 files changed, 220 insertions(+), 90 deletions(-)
diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 652bc0d..5195709 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.Mqtt;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI;
@@ -83,8 +84,10 @@
/// <summary>
/// 鍒ゆ柇鏄惁鏈湴鍔犲瘑骞朵笖鍔犲瘑key涓嶄负绌�
/// </summary>
- public bool IsLocalEncryptAndGetAesKey {
- get {
+ public bool IsLocalEncryptAndGetAesKey
+ {
+ get
+ {
return IsLocalEncrypt && (!string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.localSecret));
}
}
@@ -122,6 +125,10 @@
HomePage.LoadEvent_CheckLinkStatus();
}
}
+ else
+ {
+ MainPage.Log($"鐘舵�佷竴鑷达紝涓嶆洿鏂版暟鎹�(鏈湴)");
+ }
}
}
bool _GatewayOnline_Cloud = false;
@@ -136,45 +143,64 @@
}
set
{
- if (_GatewayOnline_Cloud != value)
+ try
{
- _GatewayOnline_Cloud = value;
- if(GatewayOnline_Local)
+ if (_GatewayOnline_Cloud != value)
{
- return;
- }
- if (value)
- {
- if (DB_ResidenceData.Instance.HomeGateway == null)
+ _GatewayOnline_Cloud = value;
+ if (GatewayOnline_Local)
{
return;
}
- if (!DB_ResidenceData.Instance.HomeGateway.gatewayStatus)//杩滅▼鎯呭喌涓嬶紝缃戝叧鏈摼鎺ユ湇鍔″櫒涓嶈兘淇敼涓婚〉缃戝叧鐘舵��
+ if (value)
{
+ if (DB_ResidenceData.Instance.HomeGateway == null)
+ {
+ return;
+ }
+ if (!DB_ResidenceData.Instance.HomeGateway.gatewayStatus)//杩滅▼鎯呭喌涓嬶紝缃戝叧鏈摼鎺ユ湇鍔″櫒涓嶈兘淇敼涓婚〉缃戝叧鐘舵��
+ {
+ new System.Threading.Thread(() =>
+ {
+ System.Threading.Thread.Sleep(3000);
+ var pm = new DAL.Server.HttpServerRequest();
+ pm.GetGatewayInfo();
+ })
+ { IsBackground = true }.Start();
+ return;
+ }
+ //淇敼涓婚〉杩炴帴鐘舵��
+ HomePage.LoadEvent_CheckLinkStatus();
+ MainPage.Log($"缃戝叧浜戠鍦ㄧ嚎锛屽埛鏂拌澶囩姸鎬�");
new System.Threading.Thread(() =>
{
- System.Threading.Thread.Sleep(3000);
- var pm = new DAL.Server.HttpServerRequest();
- pm.GetGatewayInfo();
+ int count = 20;
+ while (true)
+ {
+ System.Threading.Thread.Sleep(500);
+ if (MqttClient.isSubscribeSuccess || count<1)
+ {
+ break;
+ }
+ count--;
+ }
+ FunctionList.List.ReadAllFunctionStatus();
})
- { IsBackground = true }.Start();
- return;
+ { IsBackground = true, Priority = System.Threading.ThreadPriority.AboveNormal }.Start();
}
- //淇敼涓婚〉杩炴帴鐘舵��
- HomePage.LoadEvent_CheckLinkStatus();
- MainPage.Log($"缃戝叧浜戠鍦ㄧ嚎锛屽埛鏂拌澶囩姸鎬�");
- new System.Threading.Thread(() =>
+ else
{
- System.Threading.Thread.Sleep(1000);
- FunctionList.List.ReadAllFunctionStatus();
- })
- { IsBackground = true, Priority = System.Threading.ThreadPriority.AboveNormal }.Start();
+ //淇敼涓婚〉杩炴帴鐘舵��
+ HomePage.LoadEvent_CheckLinkStatus();
+ }
}
else
{
- //淇敼涓婚〉杩炴帴鐘舵��
- HomePage.LoadEvent_CheckLinkStatus();
+ MainPage.Log($"鐘舵�佷竴鑷达紝涓嶆洿鏂版暟鎹�(浜戠)");
}
+ }catch(Exception ex)
+ {
+ MainPage.Log($"Set GatewayCloudOnline Error:{ex.Message}");
}
}
}
@@ -235,6 +261,7 @@
/// </summary>
public void OpenTcpClent()
{
+ return;
if (myTcpClient == null)
{
myTcpClient = new Control_TcpClient(reportIp);
@@ -249,7 +276,8 @@
public void SearchLoaclGateway()
{
//2021-01-15 : 浣忓畢娌℃湁缁戝畾缃戝叧鐨勬椂鍊欎笉鐢ㄦ悳绱紝骞朵笖涓嶈兘閾炬帴mqtt
- if(DB_ResidenceData.Instance.HomeGateway == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.HomeGateway.gatewayId))
+ if (DB_ResidenceData.Instance.HomeGateway == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.HomeGateway.gatewayId) ||
+ !UserInfo.Current.IsLogin)
{
return;
}
@@ -268,6 +296,7 @@
}
else if (MainPage.InternetStatus == 2)
{
+ DAL.Mqtt.MqttClient.InitState();
OpenUdp(DB_ResidenceData.Instance.GatewayType == 0 ? 6000 : 8585);
//閲嶇疆鎼滅储缃戝叧鏍囧織
IsSearchLocalGatewaySuccessful = false;
@@ -294,7 +323,6 @@
System.Threading.Thread.Sleep(500);
}
- DAL.Mqtt.MqttClient.InitState();
})
{ IsBackground = true }.Start();
}
@@ -308,9 +336,11 @@
/// </summary>
public void LoginGateway()
{
- if(loginGatewayThread== null)
+ return;//tcp鎺у埗瀛樺湪闂锛屼絾鏄厛涓嶇敤tcp鎺у埗浜嗭紝瑕佺粡杩囨祴璇曞厛 2023-07-29 10:14:32
+ if (loginGatewayThread == null)
{
- loginGatewayThread = new System.Threading.Thread(() => {
+ loginGatewayThread = new System.Threading.Thread(() =>
+ {
while (!Ins.myTcpClient.isConnected)
{
if (Ins.GatewayOnline_Local && myTcpClient.isConnected)
@@ -337,7 +367,8 @@
try
{
loginGatewayThread?.Abort();
- }catch (Exception ex)
+ }
+ catch (Exception ex)
{
MainPage.Log($"閲嶅惎鐧诲綍缃戝叧绾跨▼寮傚父:{ex.Message}");
}
@@ -347,7 +378,7 @@
LoginGateway();
}
}
-
+
}
@@ -357,9 +388,9 @@
public void ControlScene(Scene scene)
{
//浣撻獙妯″紡
- if(MainPage.NoLoginMode)
+ if (MainPage.NoLoginMode)
{
- foreach(var sceneFunction in scene.functions)
+ foreach (var sceneFunction in scene.functions)
{
var revString = "";
var upDataObj = new AlinkFunctionStatusObj();
@@ -406,7 +437,7 @@
/// <param name="function"></param>
/// <param name="useRemote">鏄惁鐩存帴浣跨敤杩滅▼鍙戦��</param>
/// <returns></returns>
- public bool SendWriteCommand(Function function, Dictionary<string, string> commandDictionary, bool useRemote = false,int resend = 3)
+ public bool SendWriteCommand(Function function, Dictionary<string, string> commandDictionary, bool useRemote = false, int resend = 3)
{
function.controlCounter++;
function.refreshTime = DateTime.Now;
@@ -453,7 +484,6 @@
UpdataFunctionStatus(revString, null, true);
return true;
}
-
//MainPage.Log($"鍙戦�佹暟鎹�:{Newtonsoft.Json.JsonConvert.SerializeObject(commandDictionary)}");
@@ -504,8 +534,9 @@
var functionControlDataObj = function.GetGatewayAlinkControlData(commandDictionary);
var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(functionControlDataObj);
var sendBytes = Ins.ConvertSendBodyData(CommunicationTopic.ct.ControlFunctionTopic, functionControlDataJson);
- new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id,resend);
+ new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id, resend);
MainPage.Log($"鏈湴閫氳 鍙戦�丠DL-Link鏁版嵁:{functionControlDataJson}");
+ //Ins.myTcpClient.SendMessage(sendBytes);
}
}
//杩滅▼閫氳
@@ -522,7 +553,7 @@
commandDictionary.Add(FunctionAttributeKey.OnOff, commandDictionary[FunctionAttributeKey.Brightness] == "0" ? "off" : "on");
}
}
- if(function.spk == SPK.LightCCT)
+ if (function.spk == SPK.LightCCT)
{
if (!commandDictionary.ContainsKey(FunctionAttributeKey.CCT))
{
@@ -546,10 +577,10 @@
/// <summary>
/// 鍏ㄥ紑鍏ㄥ叧鍔熻兘
/// </summary>
- public void SwtichFunctions(bool open,List<Function> functions)
+ public void SwtichFunctions(bool open, List<Function> functions)
{
//dome妯″紡鎺у埗
- if(MainPage.NoLoginMode)
+ if (MainPage.NoLoginMode)
{
new System.Threading.Thread(() =>
{
@@ -557,7 +588,7 @@
{
Dictionary<string, string> d1 = new Dictionary<string, string>();
d1.Add(FunctionAttributeKey.OnOff, open ? "on" : "off");
- if (function.spk == SPK.PanelSocket)
+ if (function.spk == SPK.PanelSocket)
{
if (function.attributes.Find((obj) => obj.key == "on_off_usb") != null)
{
@@ -595,6 +626,10 @@
{
foreach (var temp in functions)
{
+ if((temp.trait_on_off.state.ToString() == "on" && open)|| temp.trait_on_off.state.ToString() == "off"&& !open)
+ {
+ continue;
+ }
var apiControlData = temp.GetApiControlData(d);
actionObjs.Add(apiControlData);
count++;
@@ -606,7 +641,10 @@
System.Threading.Thread.Sleep(100);
}
}
- var pack = pm.ControlDevice(actionObjs);
+ if (actionObjs.Count > 0)
+ {
+ var pack = pm.ControlDevice(actionObjs);
+ }
}
}
@@ -623,16 +661,16 @@
{
var pm = new DAL.Server.HttpServerRequest();
var pack = pm.GetDeviceInfoList(functionIds);
- if(pack!= null&& pack.Data!=null)
+ if (pack != null && pack.Data != null)
{
//寰呮祴璇�2021-03-04
var ddd = Newtonsoft.Json.JsonConvert.DeserializeObject<List<AlinkStatusData>>(pack.Data.ToString());
- if(ddd!= null)
+ if (ddd != null)
{
- foreach(var function in ddd)
+ foreach (var function in ddd)
{
var temp = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.deviceId == function.deviceId);
- if(temp!= null)
+ if (temp != null)
{
if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(temp.spk))
{
@@ -648,7 +686,7 @@
/// 鍙戦�佽鍙栧懡浠�
/// 鑷姩鍒ゆ柇鏄惁涓篈鍗忚璁惧
/// </summary>
- public void SendReadCommand(Function function ,bool forceRemote = false)
+ public void SendReadCommand(Function function, bool forceRemote = false)
{
function.refreshTime = DateTime.Now;
if (forceRemote)
@@ -694,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;
+ }
}
}
}
@@ -732,7 +780,7 @@
{
busClient.ReadBusData(function);
}
-
+
}
catch (Exception ex)
{
@@ -776,7 +824,7 @@
/// <summary>
/// 瀹夐槻鎺у埗
/// </summary>
- public void ControlSecurity(SecurityAlarm securityAlarm,string state)
+ public void ControlSecurity(SecurityAlarm securityAlarm, string state)
{
if (!Ins.GatewayOnline_Local)//缃戝叧鏈湴涓嶅湪绾�
{
@@ -832,9 +880,9 @@
},
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);
+ new Control_Udp().SendLocalHdlLinkData(sendBytes, aLinkData.id, 0);
}
}
@@ -928,10 +976,14 @@
/// 杞崲鎺ユ敹鍒扮殑鏁版嵁
/// </summary>
/// <returns></returns>
- public void ConvertReceiveData(byte[] receiveBytes,string ip)
+ public void ConvertReceiveData(byte[] receiveBytes, string ip)
{
+ if (!UserInfo.Current.IsLogin)
+ {
+ return;
+ }
var reString = Encoding.UTF8.GetString(receiveBytes);
- AnalysisReceiveData(reString, receiveBytes,ip);
+ AnalysisReceiveData(reString, receiveBytes, ip);
}
/// <summary>
/// 杞崲鎺ユ敹鍒扮殑鏁版嵁
@@ -939,8 +991,9 @@
/// <param name="receiveString">杞琒tring鍚庣殑鏁版嵁</param>
/// <param name="originalReceiveBytes"鍘熷Bytes鏁版嵁</param>
/// <returns></returns>
- public LocalCommunicationData AnalysisReceiveData(string receiveString, byte[] originalReceiveBytes , string sIp = null)
+ public LocalCommunicationData AnalysisReceiveData(string receiveString, byte[] originalReceiveBytes, string sIp = null)
{
+
LocalCommunicationData receiveObj = new LocalCommunicationData();
@@ -976,7 +1029,7 @@
if (receiveObj.Topic == CommunicationTopic.ct.HeartBeat + "_reply")
{
- Ins.myTcpClient.ClearHeartBeatLog();
+ //Ins.myTcpClient.ClearHeartBeatLog();
MainPage.Log("tcp蹇冭烦鍥炲");
return null;
}
@@ -1072,17 +1125,19 @@
Ins.IsLocalEncrypt = device.isLocalEncrypt;
//MainPage.Log("缃戝叧鏈湴鍔犲瘑鐘舵�侊細" + device.local_encrypt.ToString());
//鐧诲綍缃戝叧Tcp
- OpenTcpClent();
+ //OpenTcpClent();
}
}
else if (receiveObj.Topic == CommunicationTopic.ct.ReadStatus + "_reply" ||
- receiveObj.Topic == CommunicationTopic.ct.ControlFunctionTopic + "_reply" ||
+ receiveObj.Topic == CommunicationTopic.ct.ControlFunctionTopic + "_reply" ||
+ receiveObj.Topic == CommunicationTopic.ct.ControlGroupControlTopic + "_reply" ||
receiveObj.Topic == CommunicationTopic.ct.GatewayUpStatus ||
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"
@@ -1118,7 +1173,8 @@
MainPage.Log($"瀹夐槻灞�鍩熺綉寮傚父锛歿ex.Message}");
}
}
- else if (receiveObj.Topic == $"/user/{GatewayId}/custom/gateway/login_reply") {
+ else if (receiveObj.Topic == $"/user/{GatewayId}/custom/gateway/login_reply")
+ {
var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(receiveObj.BodyDataString);
if (temp.GetValue("objects").ToString().Contains("success"))
{
@@ -1161,7 +1217,7 @@
}
else
{
- if(processedDataList.Count> 50)
+ if (processedDataList.Count > 50)
{
processedDataList.RemoveAt(0);
}
@@ -1170,12 +1226,63 @@
}
+
+ /// <summary>
+ /// 鏇存柊缇ゆ帶璁惧鐘舵��
+ /// A鍗忚鏁版嵁
+ /// </summary>
+ public void UpdataGroupControlStatus(string revString, byte[] usefulBytes, bool isCloudData = false)
+ {
+ var temp = JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString);
+ if (temp != null)
+ {
+ Control_Udp.ReceiveRepeatManager(temp.id, usefulBytes);
+ var allLocalFuntion = FunctionList.List.groupControls;
+ foreach (var updateTemp in temp.objects)
+ {
+ try
+ {
+ var localFunction = allLocalFuntion.Find((obj) => obj.sid == updateTemp.sid);
+ if (localFunction == null)
+ {
+ continue;
+ }
+ MainPage.Log($"鏀跺埌缇ゆ帶鏁版嵁:{revString}");
+ foreach (var attr in updateTemp.status)
+ {
+ localFunction.time_stamp = temp.time_stamp;
+ localFunction.SetAttrState(attr.key, attr.value);
+
+ }
+
+ //鏇存柊鐣岄潰鐘舵��
+ switch (localFunction.spk)
+ {
+ case SPK.ElectricEnergy:
+ EnergyMainPage.UpdataStatus(localFunction);
+ break;
+ }
+
+ HomePage.UpdataFunctionStates(localFunction);
+ RoomPage.UpdataStates(localFunction);
+ FunctionPage.UpdataStates(localFunction);
+ ClassificationPage.UpdataInfo(localFunction);
+
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log($"A鍗忚鏇存柊鐘舵�佸紓甯�:{ex.Message}");
+ }
+ }
+ }
+ }
+
+
/// <summary>
/// 鏇存柊璁惧鐘舵��
/// A鍗忚鏁版嵁
/// </summary>
- /// <param name="updateBytes"></param>
- public void UpdataFunctionStatus(string revString, byte[] usefulBytes,bool isCloudData = false)
+ public void UpdataFunctionStatus(string revString, byte[] usefulBytes, bool isCloudData = false)
{
////test 浜戠杩炴帴鎴愬姛鏃讹紝涓嶉�傜敤鏈湴鏁版嵁鏇存柊
//if (Ins.GatewayOnline_Cloud && !isCloudData)
@@ -1183,7 +1290,7 @@
// return;
//}
- var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString);
+ var temp = JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString);
if (temp != null)
{
Control_Udp.ReceiveRepeatManager(temp.id, usefulBytes);
@@ -1216,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)
@@ -1235,14 +1332,22 @@
// return;
// }
//}
- MainPage.Log($"闊充箰鏀跺埌鏁版嵁:{revString}");
+ MainPage.Log($"鏀跺埌鏁版嵁:{revString}");
foreach (var attr in updateTemp.status)
{
localFunction.time_stamp = temp.time_stamp;
localFunction.SetAttrState(attr.key, attr.value);
- Console.WriteLine("闊充箰鎾斁鍣ㄦ坊鍔犵紦瀛樻暟鎹�=======" + revString);
-
+
}
+ if(localFunction.spk == SPK.AirSwitchP3)
+ {
+ localFunction.online = updateTemp.online;
+ }
+ if (SPK.LightSpkList().Contains(localFunction.spk))
+ {
+ localFunction.updateTime = DateTime.Now;
+ }
+
//鏇存柊鐣岄潰鐘舵��
switch (localFunction.spk)
@@ -1256,10 +1361,14 @@
break;
case SPK.AirSwitch:
AirSwitchPage.UpdataState(localFunction);
- if(localFunction.GetAttribute(FunctionAttributeKey.Power)!=null)//濡傛灉鏄甫鐢甸噺鐨勭┖寮�涔熻鏇存柊鑳芥簮鐣岄潰
+ if (localFunction.GetAttribute(FunctionAttributeKey.Power) != null)//濡傛灉鏄甫鐢甸噺鐨勭┖寮�涔熻鏇存柊鑳芥簮鐣岄潰
{
EnergyMainPage.UpdataStatus(localFunction);
}
+ break;
+ case SPK.AirSwitchP3:
+ AirSwitchP3Page.UpdataState(localFunction);
+ AirSwitchP3SubloopEnergyPage.UpdataStatus(localFunction);
break;
case SPK.ElectricEnergy:
EnergyMainPage.UpdataStatus(localFunction);
@@ -1295,7 +1404,7 @@
CurtainModulePage.UpdataState(localFunction);
break;
case SPK.CurtainDream:
- if(localFunction.GetAttrState(FunctionAttributeKey.Percent) == "0")
+ if (localFunction.GetAttrState(FunctionAttributeKey.Percent) == "0")
{
localFunction.SetAttrState(FunctionAttributeKey.OnOff, "off");
}
@@ -1383,12 +1492,14 @@
FloorHeatingPage.UpdataStates(localFunction);
break;
case SPK.SensorPm25:
+ case SPK.SensorPm10:
case SPK.SensorCO2:
case SPK.SensorTVOC:
case SPK.SensorTemperature:
case SPK.SensorHumidity:
case SPK.SensorHcho:
- if(localFunction.spk == SPK.SensorTemperature)
+ case SPK.SensorLight:
+ if (localFunction.spk == SPK.SensorTemperature)
{
HomePage.LoadEvent_RefreshEnvirIndoorTemp();
}
@@ -1428,7 +1539,6 @@
case SPK.ElectricTuyaWeepRobot2:
case SPK.ElectricTuyaWaterValve:
case SPK.ElectricTuyaWaterValve2:
- case SPK.SensorPir:
case SPK.SensorDoorWindow:
case SPK.SensorSmoke:
case SPK.SensorWater:
@@ -1443,6 +1553,22 @@
//鐘舵�佹洿鏂�
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:
case SPK.SenesorMegahealth2:
case SPK.SensorMmvPose:
@@ -1454,7 +1580,7 @@
switch (tempStatus.state)
{//0绌猴紝1璧帮紝2璺戯紝3鍧愶紝4璺屽�掞紝5绔�
case "0":
- localFunction.lastState = Language.StringByID(StringId.SensorNormalState);
+ localFunction.lastState = Language.StringByID(StringId.wuren);
break;
case "1":
localFunction.lastState = Language.StringByID(StringId.SomeoneIn);
@@ -1490,7 +1616,7 @@
case SPK.AvMusic:
case SPK.MusicStandard:
//UI.Music.MusicMain.mMusicMain.RefreshView(updateTemp);
- Console.WriteLine("闊充箰鎾斁鍣ㄦ樉绀虹姸鎬�======="+ revString);
+ Console.WriteLine("闊充箰鎾斁鍣ㄦ樉绀虹姸鎬�=======" + revString);
//wjc
break;
case SPK.Inverter:
@@ -1503,6 +1629,7 @@
break;
}
+
HomePage.UpdataFunctionStates(localFunction);
RoomPage.UpdataStates(localFunction);
FunctionPage.UpdataStates(localFunction);
@@ -1524,12 +1651,12 @@
/// <summary>
/// //涓�閿紙杩滅▼锛夊紑閿�
/// </summary>
- public void OneKeyUnlocking(Function doorlock,string extStr)
+ 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 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);
@@ -1544,7 +1671,7 @@
/// </summary>
/// <param name="functionId"></param>
/// <param name="pwd"></param>
- public void ConfirmUnlocking(string functionId,string pwd)
+ public void ConfirmUnlocking(string functionId, string pwd)
{
Loading loading = new Loading();
MainPage.BaseView.AddChidren(loading);
@@ -1580,8 +1707,10 @@
//{
// return false;
//}
- if (pack.Code != StateCode.SUCCESS) {
- Application.RunOnMainThread(() => {
+ if (pack.Code != StateCode.SUCCESS)
+ {
+ Application.RunOnMainThread(() =>
+ {
new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), pack.message);
UserInfo.Current.doorPasswordString = "";//
UserInfo.Current.LastTimeOpenDoor = DateTime.MinValue;
@@ -1590,8 +1719,9 @@
}
if (pack.Code != StateCode.SUCCESS)
{
- Application.RunOnMainThread(() => {
- if(string.IsNullOrEmpty(pack.message))
+ Application.RunOnMainThread(() =>
+ {
+ if (string.IsNullOrEmpty(pack.message))
{
new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip),
Language.StringByID(StringId.OperationFailed));
--
Gitblit v1.8.0