From f14dcfd967404e197e7ec995ca8d6f2b090d3b7d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 11 九月 2020 09:16:59 +0800
Subject: [PATCH] 优化多功能面板:绑定温湿度传感器目标,和设备列表回路显示。优化数据矫正功能温湿度度不设置的情况。优化门锁时间设置最后一天和最后最后一个月的时间显示等 细节
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs | 91 ++++++++++++++++++++++++++++++++-------------
1 files changed, 65 insertions(+), 26 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
index 2ea4709..095850c 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDevicePanelLogic.cs
@@ -118,7 +118,7 @@
//濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
if (Common.Config.Instance.Home.IsVirtually == true)
{
- return ModelData.DeviceModelDataLogic.Current.GetPanelColorInfo(device, keyNum);
+ return TemplateData.TemplateDeviceDataLogic.Current.GetPanelColorInfo(device, keyNum);
}
//鍙戦�佹暟鎹� keyNum杞负16杩涘埗 鑼冨洿锛�01~10
var passData = "0504040101" + Convert.ToString((int)keyNum, 16).ToUpper().PadLeft(2, '0');
@@ -215,7 +215,7 @@
//濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
if (Common.Config.Instance.Home.IsVirtually == true)
{
- return ModelData.DeviceModelDataLogic.Current.SetPanelColorInfo(device, keyColorData, keyNumStatus, "ZbDataPassthrough");
+ return TemplateData.TemplateDeviceDataLogic.Current.SetPanelColorInfo(device, keyColorData, keyNumStatus, null);
}
//鑾峰彇閰嶇疆鎸夐敭鎸囩ず鐏鑹茬殑鍛戒护瀛楃
var sendData = this.GetPanelColorCommandText(device.DeviceAddr, keyColorData, keyNumStatus);
@@ -228,6 +228,10 @@
var tempD = new CommonDevice.ResponseData();
tempD.command = data[12].ToString() + data[13].ToString() + data[10].ToString() + data[11].ToString();
tempD.status = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16);
+
+ //娣诲姞缂撳瓨
+ TemplateData.TemplateDeviceDataLogic.Current.SetPanelColorInfo(device, keyColorData, keyNumStatus, result.JsonData[0]);
+
return new CommonDevice.ResponseAllData { responseData = tempD };
}
@@ -386,7 +390,7 @@
//濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
if (Common.Config.Instance.Home.IsVirtually == true)
{
- return ModelData.DeviceModelDataLogic.Current.GetDeviceLightSettion(device);
+ return TemplateData.TemplateDeviceDataLogic.Current.GetDeviceLightSettion(device);
}
//鑾峰彇鍙戦�佺殑鍛戒护瀛楃
var passData = "050604010101";
@@ -422,7 +426,7 @@
//濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
if (Common.Config.Instance.Home.IsVirtually == true)
{
- return ModelData.DeviceModelDataLogic.Current.SetDeviceLightSettion(device, directionsLevel, backlightLevel, "ZbDataPassthrough");
+ return TemplateData.TemplateDeviceDataLogic.Current.SetDeviceLightSettion(device, directionsLevel, backlightLevel, null);
}
//鑾峰彇淇敼闈㈡澘鐨勪寒搴﹁皟鑺傜殑鍛戒护瀛楃
var sendData = this.GetPanelLevelCommadText(device.DeviceAddr, directionsLevel, backlightLevel);
@@ -456,7 +460,7 @@
}
//淇敼缂撳瓨
- ModelData.DeviceModelDataLogic.Current.SetDeviceLightSettion(device, directionsLevel, backlightLevel, "ZbDataPassthrough");
+ TemplateData.TemplateDeviceDataLogic.Current.SetDeviceLightSettion(device, directionsLevel, backlightLevel, result.JsonData[0]);
return true;
}
@@ -600,6 +604,48 @@
}
#endregion
+ #region 鈻� 鏍℃娓╁害___________________________
+ /// <summary>
+ /// 鏍℃娓╁害
+ /// </summary>
+ /// <param name="device">璁惧瀵硅薄</param>
+ /// <param name="correctValue">鏍℃娓╁害鍊�</param>
+ /// <param name="direction">琛ュ伩鏂瑰悜0涓嶈ˉ鍋� 1锛氭鍚戯紱2锛氬弽鍚�</param>
+ /// <param name="type">0 娓╁害 锛�1 婀垮害</param>
+ /// <returns></returns>
+ public async Task<bool> CorrectTemperature(CommonDevice device, double correctValue, int direction = 0, int type = 0)
+ {
+ //鍊熺敤瀹冪殑鍑絫
+ var panel = new Panel();
+ panel.DeviceAddr = device.DeviceAddr;
+ panel.DeviceEpoint = 200;
+ panel.CurrentGateWayId = device.CurrentGateWayId;
+
+ var result = await panel.CorrectTemperature(correctValue, direction, type);
+ panel = null;
+
+ //鍏遍�氶敊璇娴�
+ string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
+ if (error != null)
+ {
+ this.ShowErrorMsg(error);
+ return false;
+ }
+
+ if (result == null || result.responseData == null)
+ {
+ //鐭娓╁害澶辫触
+ string msg = Language.StringByID(R.MyInternationalizationString.DataCorrectionFailed);
+ //鎷兼帴涓娿�愮綉鍏冲洖澶嶈秴鏃躲�戠殑Msg
+ msg = UserCenterLogic.CombineGatewayTimeOutMsg(msg, result);
+
+ this.ShowTipMsg(msg);
+ return false;
+ }
+ return true;
+ }
+ #endregion
+
#region 鈻� 鑺傝兘妯″紡___________________________
/// <summary>
/// 鑾峰彇璁惧鑺傝兘妯″紡鐨勯厤缃姸鎬�(ui鍙妭鑳芥ā寮�)
@@ -611,7 +657,7 @@
//濡傛灉褰撳墠浣忓畢鏄櫄鎷熶綇瀹�
if (Common.Config.Instance.Home.IsVirtually == true)
{
- return ModelData.DeviceModelDataLogic.Current.GetDeviceEnergyConservationMode(device);
+ return TemplateData.TemplateDeviceDataLogic.Current.GetDeviceEnergyConservationMode(device);
}
//鍙戦�佸懡浠�
string passData = "050804010101";
@@ -677,7 +723,7 @@
//濡傛灉褰撳墠鏄櫄鎷熶綇瀹�
if (Common.Config.Instance.Home.IsVirtually == true)
{
- return ModelData.DeviceModelDataLogic.Current.SetDeviceEnergyConservationMode(device, modeEnable, modeTime, level, "ZbDataPassthrough");
+ return TemplateData.TemplateDeviceDataLogic.Current.SetDeviceEnergyConservationMode(device, modeEnable, modeTime, level, null);
}
//鑾峰彇璁剧疆璁惧鐨勮妭鑳芥ā寮忕殑鍛戒护瀛楃
var sendData = this.GetDeviceEnergyConservationModeCommandText(device.DeviceAddr, modeEnable, modeTime, level);
@@ -707,7 +753,7 @@
}
//淇敼缂撳瓨
- ModelData.DeviceModelDataLogic.Current.SetDeviceEnergyConservationMode(device, modeEnable, modeTime, level, "ZbDataPassthrough");
+ TemplateData.TemplateDeviceDataLogic.Current.SetDeviceEnergyConservationMode(device, modeEnable, modeTime, level, result.JsonData[0]);
return true;
}
@@ -810,16 +856,9 @@
/// </summary>
/// <param name="panel">骞叉帴鐐瑰璞�</param>
/// <returns></returns>
- public async Task<List<CommonDevice.AttributeDataObj>> GetDryContactConfigureInfo(CommonDevice device)
+ public List<CommonDevice.AttributeDataObj> GetDryContactConfigureInfo(CommonDevice device)
{
- //鍊熺敤瀹冪殑鍑芥暟
- var panel = new Panel();
- panel.DeviceAddr = device.DeviceAddr;
- panel.DeviceEpoint = device.DeviceEpoint;
- panel.CurrentGateWayId = device.CurrentGateWayId;
-
- var result = HdlDeviceBindLogic.Current.ReadPanelConfigureInfoAsync(panel);
- panel = null;
+ var result = HdlDeviceBindLogic.Current.ReadPanelConfigureInfoAsync(device);
//鍏遍�氶敊璇娴�
string error = HdlCheckLogic.Current.CheckCommonErrorCode(result);
@@ -1055,7 +1094,7 @@
//濡傛灉鏄櫄鎷熶綇瀹�
if (Common.Config.Instance.Home.IsVirtually == true)
{
- return ModelData.DeviceModelDataLogic.Current.GetPanelVibrationInfo(device);
+ return TemplateData.TemplateDeviceDataLogic.Current.GetPanelVibrationInfo(device);
}
//鍙戦�佹暟鎹�
var jObject = new Newtonsoft.Json.Linq.JObject { { "DeviceAddr", device.DeviceAddr }, { "Epoint", 200 }, { "Cluster_ID", 64513 }, { "Command", 0 } };
@@ -1090,7 +1129,7 @@
//濡傛灉鏄櫄鎷熶綇瀹�
if (Common.Config.Instance.Home.IsVirtually == true)
{
- return ModelData.DeviceModelDataLogic.Current.SetPanelVibrationInfo(device, datainfo, "ClientDataPassthrough");
+ return TemplateData.TemplateDeviceDataLogic.Current.SetPanelVibrationInfo(device, datainfo, null);
}
//鑾峰彇缂栬緫闈㈡澘闇囧姩鍔熻兘鐨勫懡浠ゅ瓧绗�
var sendData = this.GetPanelVibrationCommandText(device.DeviceAddr, datainfo);
@@ -1103,6 +1142,9 @@
this.ShowTipMsg(errorMsg);
return false;
}
+ //娣诲姞缂撳瓨
+ TemplateData.TemplateDeviceDataLogic.Current.SetPanelVibrationInfo(device, datainfo, result.JsonData[0]);
+
return true;
}
@@ -1256,10 +1298,7 @@
/// </summary>
private void SaveDryContactFunctionToLocaltion()
{
- var file = Newtonsoft.Json.JsonConvert.SerializeObject(dicDryContactFunction);
-
- var bytes = System.Text.Encoding.UTF8.GetBytes(file);
- Common.Global.WriteFileByBytesByHomeId(DirNameResourse.DryContactFunctionFile, bytes);
+ HdlFileLogic.Current.SaveFileContent(DirNameResourse.DryContactFunctionFile, dicDryContactFunction);
}
/// <summary>
@@ -1267,12 +1306,12 @@
/// </summary>
private void LoadDryContactFunctionFromLocaltion()
{
- if (Common.Global.IsExistsByHomeId(DirNameResourse.DryContactFunctionFile) == false)
+ this.dicDryContactFunction = new Dictionary<string, DryContactFunctionInfo>();
+ byte[] filebyte = HdlFileLogic.Current.ReadFileByteContent(DirNameResourse.DryContactFunctionFile);
+ if (filebyte == null)
{
return;
}
-
- byte[] filebyte = Common.Global.ReadFileByHomeId(DirNameResourse.DryContactFunctionFile);
string strvalue = System.Text.Encoding.UTF8.GetString(filebyte);
this.dicDryContactFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, DryContactFunctionInfo>>(strvalue);
}
--
Gitblit v1.8.0