From 3055ac3c5a7a18db21f2adc6a36f68ae0fd708c2 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 06 五月 2022 14:48:58 +0800
Subject: [PATCH] 定制
---
HDL_ON/DAL/DriverLayer/Control.cs | 107 +++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 95 insertions(+), 12 deletions(-)
diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 051b41d..ee6895f 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -26,7 +26,7 @@
public class Control
{
-
+
static Control _control;
public static Control Ins
{
@@ -360,10 +360,11 @@
/// <param name="function"></param>
/// <param name="useRemote">鏄惁鐩存帴浣跨敤杩滅▼鍙戦��</param>
/// <returns></returns>
- public void 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;
+
//濡傛灉鏄帶鍒惰皟鍏夌殑寮�鏃讹紝浜害鍊间笉鑳戒负0
if (commandDictionary.Count > 2)
@@ -404,7 +405,7 @@
upDataObj.objects.Add(asd);
revString = Newtonsoft.Json.JsonConvert.SerializeObject(upDataObj);
UpdataFunctionStatus(revString, null, true);
- return;
+ return true;
}
@@ -493,6 +494,8 @@
}
}
+
+ return true;
}
/// <summary>
/// 鍏ㄥ紑鍏ㄥ叧鍔熻兘
@@ -866,7 +869,7 @@
if (receiveObj.Topic == CommunicationTopic.SearchLoaclGatewayReply || receiveObj.Topic == CommunicationTopic.GatewayBroadcast)
{
-
+
var bodyJObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack>(res[1]);
if (bodyJObj == null)
{
@@ -948,6 +951,7 @@
/// <summary>
/// 鏇存柊璁惧鐘舵��
/// A鍗忚鏁版嵁
+ /// Tag Link鐘舵�佸鐞�
/// </summary>
/// <param name="updateBytes"></param>
public void UpdataFunctionStatus(string revString, byte[] usefulBytes,bool isCloudData = false)
@@ -980,7 +984,6 @@
var localFunction = allLocalFuntion.Find((obj) => obj.sid == updateTemp.sid);
if (localFunction == null)
{
- MainPage.Log("鎵句笉鍒伴煶涔愭挱鏀惧櫒娣�=======" + revString);
continue;
}
MainPage.Log(localFunction.name);
@@ -1063,6 +1066,10 @@
RollingShutterPage.UpdataState(localFunction);
break;
case SPK.CurtainShades:
+ break;
+ case SPK.HvacCac:
+ Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status);
+
break;
case SPK.AcStandard:
case SPK.HvacAC:
@@ -1188,6 +1195,7 @@
case SPK.AirFreshStandard:
case SPK.HvacAirFresh:
case SPK.SensorGas:
+ case SPK.SensorHelp:
//璁惧鐘舵�佹帹閫�
//鐘舵�佹洿鏂�
Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(updateTemp.sid, updateTemp.status);
@@ -1195,7 +1203,7 @@
case SPK.AvMusic:
case SPK.MusicStandard:
//UI.Music.MusicMain.mMusicMain.RefreshView(updateTemp);
- Console.WriteLine("闊充箰鎾斁鍣ㄦ樉绀虹姸鎬�======="+ revString);
+ //Console.WriteLine("闊充箰鎾斁鍣ㄦ樉绀虹姸鎬�======="+ revString);
//wjc
break;
}
@@ -1233,16 +1241,91 @@
}
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);
+ ConfirmUnlocking(doorlock.deviceId, extStr);
}
+ }
+ /// <summary>
+ /// 纭寮�閿�
+ /// </summary>
+ /// <param name="functionId"></param>
+ /// <param name="pwd"></param>
+ public void ConfirmUnlocking(string functionId,string pwd)
+ {
+ Loading loading = new Loading();
+ MainPage.BaseView.AddChidren(loading);
+ loading.BackgroundColor = 0x88000000;
+ loading.LodingBackgroundColor = UI.CSS.CSS_Color.BackgroundColor;
+ loading.Start(Language.StringByID(StringId.PleaseWait));
+ new System.Threading.Thread(() =>
+ {
+ try
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+ d.Add("deviceId", functionId);
+ d.Add("pwd", pwd);
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ var pack = HttpUtil.RequestHttpsPost("/home-wisdom/app/device/door/pwdConfirm", requestJson);
+ if (pack.Code == StateCode.SUCCESS)
+ {
+ Newtonsoft.Json.Linq.JObject pairs = Newtonsoft.Json.Linq.JObject.Parse(pack.Data.ToString());
+ var scrip = pairs.GetValue("scrip");
+
+ d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+ d.Add("deviceId", functionId);
+ d.Add("scrip", scrip);
+ requestJson = HttpUtil.GetSignRequestJson(d);
+ pack = HttpUtil.RequestHttpsPost("/home-wisdom/app/device/door/remoteOpen", requestJson);
+ //if(pack.Code == StateCode.SUCCESS)
+ //{
+ // return true;
+ //}
+ //else
+ //{
+ // return false;
+ //}
+ if (pack.Code != StateCode.SUCCESS) {
+ Application.RunOnMainThread(() => {
+ new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), pack.message);
+ UserInfo.Current.doorPasswordString = "";//
+ UserInfo.Current.LastTimeOpenDoor = DateTime.MinValue;
+ });
+ }
+ }
+ if (pack.Code != StateCode.SUCCESS)
+ {
+ Application.RunOnMainThread(() => {
+ if(string.IsNullOrEmpty(pack.message))
+ {
+ new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip),
+ Language.StringByID(StringId.OperationFailed));
+ }
+ else
+ {
+ new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), pack.message);
+ }
+ });
+ }
+ }
+ catch (Exception ex)
+ {
+
+ }
+ finally
+ {
+ Application.RunOnMainThread(() =>
+ {
+ loading.Hide();
+ loading.RemoveFromParent();
+ });
+ }
+ })
+ { IsBackground = true }.Start();
}
//瀵嗙爜鍐荤粨
//瀵嗙爜楠岃瘉
#endregion
}
-}
\ No newline at end of file
+}
--
Gitblit v1.8.0