From 9c16d3614d9b88c637f967518a329f239fcd3aaf Mon Sep 17 00:00:00 2001
From: lss <316519258@qq.com>
Date: 星期五, 12 六月 2020 09:22:04 +0800
Subject: [PATCH] 2020.06.12
---
ZigbeeApp/Shared/Common/Device.cs | 87 ++++++++++++++++++++++++++++---------------
1 files changed, 56 insertions(+), 31 deletions(-)
diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs
index 3bc9e9e..e3891f6 100755
--- a/ZigbeeApp/Shared/Common/Device.cs
+++ b/ZigbeeApp/Shared/Common/Device.cs
@@ -123,12 +123,6 @@
if (device == null || device.CurrentGateWayId == null)
{
-#if DEBUG
- //璋冩煡,涓轰粈涔堝畠浼氭妸鍏ㄩ儴璁惧鍒犳帀锛�
- string file1 = UserCenterLogic.CombinePath(file);
- string file2 = UserCenterLogic.CombinePath("Back_" + file);
- System.IO.File.Copy(file1, file2, true);
-#endif
//澶辨晥鐨勬枃浠讹紝娌℃湁缃戝叧id鐨勯兘鍒犻櫎鎺�
Global.DeleteFilebyHomeId(file);
continue;
@@ -143,12 +137,6 @@
}
else
{
-#if DEBUG
- //璋冩煡,涓轰粈涔堝畠浼氭妸鍏ㄩ儴璁惧鍒犳帀锛�
- string file1 = UserCenterLogic.CombinePath(file);
- string file2 = UserCenterLogic.CombinePath("Back_" + file);
- System.IO.File.Copy(file1, file2, true);
-#endif
//濡傛灉鏄富浜�,鎴栬�呯鐞嗗憳,閭d箞杩欎釜鏂囦欢鏄潪娉曠殑,鐩存帴鍒犻櫎
Global.DeleteFilebyHomeId(file);
continue;
@@ -211,7 +199,7 @@
var listGateway = HdlGatewayLogic.Current.GetAllLocalGateway();
foreach (var gateway in listGateway)
{
- string gwId = HdlGatewayLogic.Current.GetGatewayId(gateway);
+ string gwId = gateway.GwId;
if (listId.Contains(gwId) == false)
{
//杩欎釜缃戝叧瀵逛簬褰撳墠杩欎釜鎴愬憳鏉ヨ鏄潪娉曠殑
@@ -242,7 +230,7 @@
listDevice.AddRange(list);
//鑾峰彇杩欎釜缃戝叧鐨勬湰鍦版墍鏈夎澶�
- string gwID = HdlGatewayLogic.Current.GetGatewayId(zbGateway);
+ string gwID = zbGateway.GwId;
List<CommonDevice> listLocalDevices = this.GetDeviceByGatewayID(gwID);
//鑾峰彇ota璁惧
foreach (var ota in this.dicOTADevice.Values)
@@ -1182,7 +1170,9 @@
}
if (device.Type == DeviceType.OnOffOutput
- || device.Type == DeviceType.DimmableLight || device.Type == DeviceType.ColorDimmableLight)
+ || device.Type == DeviceType.DimmableLight
+ || device.Type == DeviceType.ColorDimmableLight
+ || device.Type == DeviceType.ColorTemperatureLight)
{
//缁х數鍣�,鎺夊厜鍣ㄩ兘鍙洖璺�
return Language.StringByID(R.MyInternationalizationString.uDeviceCircuit) + epointNo;
@@ -1246,6 +1236,11 @@
if (string.IsNullOrEmpty(dName) == false)
{
return dName;
+ }
+ if (this.IsMiniLight(device) == true)
+ {
+ //Mini澶滅伅
+ return Language.StringByID(R.MyInternationalizationString.uMiniNightLight);
}
//鑾峰彇璁惧绫诲瀷
@@ -1996,6 +1991,14 @@
info.ConcreteType = DeviceConcreteType.Sensor_PMTwoPointFive;
info.ObjectTypeNameId = 60000;//浼犳劅鍣�
}
+ //16鑹叉俯鐏�
+ else if (dicType.ContainsKey(DeviceType.ColorTemperatureLight) == true)
+ {
+ info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId20000;
+ info.BeloneType = DeviceBeloneType.A褰╃伅;
+ info.ConcreteType = DeviceConcreteType.ColorLight_Temperature;
+ info.ObjectTypeNameId = 60007;//璋冨厜妯″潡
+ }
int value = (int)info.BeloneType;
if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + value) == true)
@@ -2380,7 +2383,8 @@
if (i_device.Type == DeviceType.OnOffOutput || i_device.Type == DeviceType.AirSwitch)
{
//2020.03.23杩藉姞寮忔牱:鏈寚瀹氱被鍨嬬殑缁х數鍣�,涓嶆樉绀�
- if (i_device.DfunctionType == DeviceFunctionType.A鏈畾涔�)
+ if (i_device.DfunctionType == DeviceFunctionType.A鏈畾涔�
+ || i_device.DfunctionType == DeviceFunctionType.A涓嶆寚瀹�)
{
return false;
}
@@ -2402,6 +2406,11 @@
{
return false;
}
+ }
+ else if (i_device.Type == DeviceType.FreshAirHumiditySensor)
+ {
+ //鏂伴鐨勬箍搴︿紶鎰熷櫒涓嶆樉绀�
+ return false;
}
return true;
}
@@ -2470,16 +2479,22 @@
/// <returns></returns>
public string AppendVersion(int versionValue)
{
+ //10101 3涓猙yte 鏄剧ず涓猴細ver.1.01.01
+ //涓棿閭d釜byte涓哄鏁版椂锛屼唬琛ㄦ槸娴嬭瘯鐗堟湰,鍦ㄦ樉绀烘渶鏂扮増鏈椂,涓嶉渶瑕佹樉绀猴紝浣嗘槸鍦ㄥ巻鍙茬増鏈偅閲屽彲浠ユ樉绀�
+ //涓棿閭d釜byte涓哄伓鏁版椂, 浠h〃鏄寮忕増鏈�
+
//鐩存帴鏄�10杩涘埗
- string txt10 = Convert.ToString(versionValue).PadLeft(4, '0');
- //杩欎釜鏄皬鏁扮偣鍓嶉潰鐨勫��
- int value1 = Convert.ToInt32(txt10.Substring(0, txt10.Length - 2));
- //杩欎釜鏄皬鏁扮偣鍚庨潰鐨勫��
- int value2 = Convert.ToInt32(txt10.Substring(txt10.Length - 2, 2));
+ string txt10 = Convert.ToString(versionValue).PadLeft(6, '0');
+ //杩欎釜鏄涓�浣�
+ int value1 = Convert.ToInt32(txt10.Substring(0, 2));
+ //杩欎釜鏄浜屼綅
+ string value2 = txt10.Substring(2, 2);
+ //杩欎釜鏄涓変綅
+ string value3 = txt10.Substring(4, 2);
//Ver.
string ver = Language.StringByID(R.MyInternationalizationString.uVersionAbbreviation);
- return ver + value1 + "." + value2.ToString().PadLeft(2, '0');
+ return ver + value1 + "." + value2 + "." + value3;
}
/// <summary>
@@ -2531,7 +2546,7 @@
{
//涓嶆棤瑙嗘椂闂�,杩斿洖鏈湴璁惧鍒楄〃
statu = 1;
- return this.GetDeviceByGatewayID(HdlGatewayLogic.Current.GetGatewayId(zbGateway));
+ return this.GetDeviceByGatewayID(zbGateway.GwId);
}
}
zbGateway.LastDateTime = DateTime.Now;
@@ -2555,7 +2570,7 @@
//鏄惁杈炬垚涓柇鐨勬椂鏈�
bool canBreak = false;
//缃戝叧ID
- string gatewayID = HdlGatewayLogic.Current.GetGatewayId(zbGateway);
+ string gatewayID = zbGateway.GwId;
//瓒呮椂鏃堕棿
int TimeOut = 0;
//璁惧鎬绘暟
@@ -2692,7 +2707,7 @@
/// <returns></returns>
private CommonDevice NewDeviceObjectByDeviceId(DeviceType deviceType, Newtonsoft.Json.Linq.JObject jobject, ZbGateway zbGateway)
{
- string gwId = HdlGatewayLogic.Current.GetGatewayId(zbGateway);
+ string gwId = zbGateway.GwId;
//鏍规嵁璁惧绫诲瀷鍒涘缓璁惧瀵硅薄鐨勫疄渚�
CommonDevice device = this.NewDeviceObjectByDeviceId(deviceType);
@@ -2784,11 +2799,15 @@
if (mainDevice.IsCustomizeImage == false)
{
mainDevice.IconPath = "Device/Light.png";
- if (this.IsMiniLight(mainDevice) == true)
- {
- //mini澶滅伅
- mainDevice.IconPath = "Device/MiniNightLight.png";
- }
+ }
+ }
+ //濡傛灉鏄壊娓╃伅
+ else if (mainDevice.Type == DeviceType.ColorTemperatureLight)
+ {
+ mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
+ if (mainDevice.IsCustomizeImage == false)
+ {
+ mainDevice.IconPath = "Device/ColorLightTemperature.png";
}
}
//濡傛灉鏄笁璺户鐢靛櫒鐨勫洖璺殑璇�,榛樿涓虹伅鍏�
@@ -2856,6 +2875,7 @@
else if (deviceType == DeviceType.TemperatureSensor) { device = new TemperatureSensor(); }
else if (deviceType == DeviceType.PMSensor) { device = new PMSensor(); }
else if (deviceType == DeviceType.FreshAirHumiditySensor) { device = new HumiditySensor(); }
+ else if (deviceType == DeviceType.ColorTemperatureLight) { device = new ColorTemperatureLight(); }
else if (deviceType == DeviceType.OtaDevice || deviceType == DeviceType.OtaPanelDevice) { device = new OTADevice(); }
else { return null; }
@@ -2960,7 +2980,7 @@
this.dicDeviceModelIdEnum["MSPIR01/M-ZB.10"] = "1303-1200-60000";//绾㈠浼犳劅鍣�
this.dicDeviceModelIdEnum["MSW01/M-ZB.10"] = "1304-1200-60000";//姘存蹈浼犳劅鍣�
this.dicDeviceModelIdEnum["MBU01/M-ZB.10"] = "1305-1200-60000";//绱ф�ユ寜閿�
- this.dicDeviceModelIdEnum["MGCD01/ZB.10"] = "1306-1200-60000";//鍚搁《鐕冩皵浼犳劅鍣�
+ this.dicDeviceModelIdEnum["MGCD01/M-ZB.10"] = "1306-1200-60000";//鍚搁《鐕冩皵浼犳劅鍣�
//PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 銆愯璁惧灞炰簬绗笁鏂硅澶囷紝娌℃湁闀滃儚ID銆�
this.dicDeviceModelIdEnum["MSPM25/M-ZB.10"] = "1307-1200-60000";//PM2.5绌烘皵璐ㄩ噺浼犳劅鍣�
@@ -3123,6 +3143,7 @@
/// 绠�绾︾幆澧冮潰鏉�
/// </summary>
ButtonPanel_SimpleEnvironment = 230,
+
//=========鈽呪槄PIR浼犳劅鍣ㄧ被(1200-1299)鈽呪槄=========
/// <summary>
/// 浼犳劅鍣�
@@ -3231,6 +3252,10 @@
/// 褰╃伅
/// </summary>
ColorLight = -10,
+ /// <summary>
+ /// 鑹叉俯鐏�(瀹冪殑闀滃儚ID鏈畾,鏆傚畾20000)
+ /// </summary>
+ ColorLight_Temperature = 20000,
//=========鈽呪槄绌鸿皟(3600-3899)鈽呪槄=========
/// <summary>
--
Gitblit v1.8.0