From fe1e04654d55516fe65728857862a6b5b5d1b3be Mon Sep 17 00:00:00 2001
From: chenqiyang <1406175257@qq.com>
Date: 星期二, 17 五月 2022 17:10:17 +0800
Subject: [PATCH] 更新全视通dll(去掉访客管理的密码使用次数)
---
HDL_ON/DAL/DriverLayer/Control.cs | 144 ++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 132 insertions(+), 12 deletions(-)
diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 33ea1fa..f14125b 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
{
@@ -359,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)
@@ -403,7 +405,7 @@
upDataObj.objects.Add(asd);
revString = Newtonsoft.Json.JsonConvert.SerializeObject(upDataObj);
UpdataFunctionStatus(revString, null, true);
- return;
+ return true;
}
@@ -492,6 +494,8 @@
}
}
+
+ return true;
}
/// <summary>
/// 鍏ㄥ紑鍏ㄥ叧鍔熻兘
@@ -503,11 +507,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 +772,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;
@@ -835,7 +846,7 @@
var revString = Encoding.UTF8.GetString(receiveBytes);
receiveObj.BodyDataString = revString;
MainPage.Log($"灞�鍩熺綉淇℃伅: 瑙e瘑鍚庯細" + receiveObj.BodyDataString);
- //if(receiveObj.Topic.EndsWith("/thing/property/up"))
+ //if (receiveObj.Topic.EndsWith("/thing/property/up"))
//{
// MsgInfoList.Add(revString + "\r\n");
//}
@@ -858,7 +869,7 @@
if (receiveObj.Topic == CommunicationTopic.SearchLoaclGatewayReply || receiveObj.Topic == CommunicationTopic.GatewayBroadcast)
{
-
+
var bodyJObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack>(res[1]);
if (bodyJObj == null)
{
@@ -974,6 +985,8 @@
{
continue;
}
+ MainPage.Log(localFunction.name);
+
if (Ins.GatewayOnline_Local && isCloudData)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�
{
if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk) && !SPK.MusicSpkList().Contains( localFunction.spk))
@@ -998,7 +1011,8 @@
{
localFunction.time_stamp = temp.time_stamp;
localFunction.SetAttrState(attr.key, attr.value);
-
+ //Console.WriteLine("闊充箰鎾斁鍣ㄦ坊鍔犵紦瀛樻暟鎹�=======" + revString);
+
}
//鏇存柊鐣岄潰鐘舵��
@@ -1154,6 +1168,7 @@
case SPK.ElectricSocket:
case SPK.PanelSocket:
SocketPage.UpdataState(localFunction);
+ SocketPage_InstantaneousValue.UpdataView(localFunction);
break;
case SPK.ElectricTV:
break;
@@ -1182,7 +1197,7 @@
case SPK.AvMusic:
case SPK.MusicStandard:
//UI.Music.MusicMain.mMusicMain.RefreshView(updateTemp);
- Console.WriteLine("闊充箰鎾斁鍣ㄦ樉绀虹姸鎬�======="+ revString);
+ //Console.WriteLine("闊充箰鎾斁鍣ㄦ樉绀虹姸鎬�======="+ revString);
//wjc
break;
}
@@ -1201,5 +1216,110 @@
}
}
+
+
+ #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
+ {
+ 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