From 2029e64ec0491f7e511dc15bffaf821bfbabe2de Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 20 七月 2020 14:10:22 +0800
Subject: [PATCH] 上传一个很特别的新版本
---
ZigbeeApp/Shared/Common/Device.cs | 743 ++++++++++++++++++++++++++++----------------------------
1 files changed, 373 insertions(+), 370 deletions(-)
diff --git a/ZigbeeApp/Shared/Common/Device.cs b/ZigbeeApp/Shared/Common/Device.cs
old mode 100755
new mode 100644
index 1435f45..7f12108
--- a/ZigbeeApp/Shared/Common/Device.cs
+++ b/ZigbeeApp/Shared/Common/Device.cs
@@ -58,17 +58,9 @@
}
/// <summary>
- /// R鏂囦欢閲岄潰璁惧妯″潡ID鐨勭炕璇戝悕瀛楃殑鍓嶇紑
+ /// 璁惧鐨勬ā鍧桰D鐨勬灇涓� keys:妯″潡ID (Axxx浠h〃鏄涓夋柟璁惧)
/// </summary>
- public const string deviceModelIdName = "uDeviceModelId";
- /// <summary>
- /// R鏂囦欢閲岄潰鎵�鏈夎澶囧悕瀛楃殑ID
- /// </summary>
- public Dictionary<string, int> dicDeviceAllNameID = null;
- /// <summary>
- /// 璁惧鐨勬ā鍧桰D鐨勬灇涓�(keys:妯″潡ID value:璁惧鍏蜂綋绫诲瀷鍊�-璁惧鎵�灞炵被鍨嬪��(鑷畾涔夌殑鍊�,鍢�,鍙涓嶉噸澶嶅氨鍙互)
- /// </summary>
- private Dictionary<string, string> dicDeviceModelIdEnum = null;
+ private Dictionary<string, DeviceNameContent> dicDeviceModelIdEnum = null;
/// <summary>
/// 闇�瑕佽浆鎹㈢殑璁惧鐨勬ā鍧桰D(keys:鏃фā鍧桰D,value:鏂版ā鍧桰D)
/// </summary>
@@ -105,9 +97,9 @@
{
this.dicAllDevice.Clear();
this.dicDeviceEpoint.Clear();
-
- //鍒濆鍖朢鏂囦欢閲岄潰璁惧榛樿鍚嶅瓧鐨処D
- this.InitDeviceDefultNameIDList();
+
+ //鍒濆鍖栬澶囨灇涓�
+ this.InitDeviceModelIdEnum();
//鑾峰彇鏈湴鍏ㄩ儴鐨勮澶囨枃浠�
List<string> listFile = this.GetAllDeviceFile();
@@ -217,12 +209,13 @@
/// <para>-1:寮傚父 1:姝e父 2:璁惧淇℃伅缂烘崯</para>
/// </summary>
/// <param name="zbGateway">缃戝叧瀵硅薄</param>
- public int SetDeviceToMemmoryByGateway(ZbGateway zbGateway)
+ /// <param name="useLocalConnect">鏄惁寮哄埗浣跨敤鏈湴杩炴帴鍙戦��</param>
+ public int SetDeviceToMemmoryByGateway(ZbGateway zbGateway, bool useLocalConnect)
{
//浠庣綉鍏宠幏鍙栧叏閮ㄧ殑璁惧
int statu = 0;
List<CommonDevice> listDevice = new List<CommonDevice>();
- List<CommonDevice> list = this.GetDeviceListFromGateway(zbGateway, ref statu, true);
+ List<CommonDevice> list = this.GetDeviceListFromGateway(zbGateway, ref statu, useLocalConnect);
if (list == null)
{
return -1;
@@ -344,6 +337,8 @@
var tempDevice = this.dicOTADevice[mainKeys];
//灏咲eviceInfo鐨勫睘鎬ц缃埌涓诲睘鎬т腑
this.SetDeviceInfoToMain(tempDevice, device);
+ //鍒锋柊璁惧鍔熻兘绫诲瀷(杩欎釜涓滆タ闇�瑕佺嫭绔嬪嚭鏉�)
+ this.RefreshDeviceFunctionType(tempDevice, device, false);
device = tempDevice;
}
@@ -365,6 +360,8 @@
var tempDevice = this.dicAllDevice[mainKeys];
//灏咲eviceInfo鐨勫睘鎬ц缃埌涓诲睘鎬т腑
this.SetDeviceInfoToMain(tempDevice, device);
+ //鍒锋柊璁惧鍔熻兘绫诲瀷(杩欎釜涓滆タ闇�瑕佺嫭绔嬪嚭鏉�)
+ this.RefreshDeviceFunctionType(tempDevice, device, false);
device = tempDevice;
}
else
@@ -822,8 +819,6 @@
return true;
}
#endregion
-
-
#region 鈻� 娴嬭瘯璁惧___________________________
@@ -1341,13 +1336,14 @@
//鍏朵粬鐨勫共鎺ョ偣鍙共鎺ョ偣
else
{
- return Language.StringByID(R.MyInternationalizationString.uDeviceBelongId16) + epointNo;
+ var infoContent = this.GetDeviceModelIdNameInfo("A419");
+ return infoContent != null ? infoContent.A瀹樻柟鍚嶅瓧 : string.Empty;
}
}
else if (device.Type == DeviceType.FreshAirHumiditySensor)
{
//鏂伴闈㈡澘/绠�绾﹀鍔熻兘/绠�绾︾幆澧冮潰鏉挎箍搴︿紶鎰熷櫒
- return Language.StringByID(deviceInfoType.DefultNameId) + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
+ return deviceInfoType.DeviceDefultName + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
}
else if (device.Type == DeviceType.TemperatureSensor)
{
@@ -1356,16 +1352,16 @@
|| deviceInfoType.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
{
//鏂伴闈㈡澘/绠�绾﹀鍔熻兘/绠�绾︾幆澧冮潰鏉� 娓╁害浼犳劅鍣�
- return Language.StringByID(deviceInfoType.DefultNameId) + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
+ return deviceInfoType.DeviceDefultName + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
}
else if (deviceInfoType.BeloneType == DeviceBeloneType.A鎸夐敭闈㈡澘)
{
//闈㈡澘鐨勬俯搴︽帰澶村彨 闈㈡澘鍚嶅瓧+娓╁害
- return Language.StringByID(deviceInfoType.DefultNameId) + Language.StringByID(R.MyInternationalizationString.uTemperature);
+ return deviceInfoType.DeviceDefultName + Language.StringByID(R.MyInternationalizationString.uTemperature);
}
}
//鍏朵粬鎯呭喌,浣跨敤瀹冪殑榛樿鍚嶇О
- return Language.StringByID(deviceInfoType.DefultNameId) + epointNo;
+ return deviceInfoType.DeviceDefultName + epointNo;
}
/// <summary>
@@ -1388,7 +1384,7 @@
//鑾峰彇璁惧绫诲瀷
var deviceInfoType = this.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
- return Language.StringByID(deviceInfoType.DefultNameId);
+ return deviceInfoType.DeviceDefultName;
}
/// <summary>
@@ -1431,32 +1427,6 @@
public string GetSimpleEpointName(CommonDevice device)
{
return device.DeviceEpointName;
- }
-
- /// <summary>
- /// 鍒濆鍖朢鏂囦欢閲岄潰璁惧榛樿鍚嶅瓧鐨処D
- /// </summary>
- private void InitDeviceDefultNameIDList()
- {
- if (this.dicDeviceAllNameID != null)
- {
- return;
- }
- this.dicDeviceAllNameID = new Dictionary<string, int>();
- Type type = typeof(R.MyInternationalizationString);
-
- var PropertyList = type.GetFields();
- foreach (var item in PropertyList)
- {
- if (item.Name.StartsWith(deviceModelIdName) == true
- || item.Name.StartsWith("uDeviceBelongId") == true)
- {
- this.dicDeviceAllNameID[item.Name] = Convert.ToInt32(item.GetValue(null));
- }
- }
-
- //鍒濆鍖栬澶囨灇涓�
- this.InitDeviceModelIdEnum();
}
#endregion
@@ -1776,7 +1746,7 @@
//鑾峰彇鑷畾涔夎澶囩被鍨�
var myInfoType = this.GetMyDeviceEnumInfo(listDevice);
//鑾峰彇璁惧绫诲瀷鐨勭炕璇戝悕瀛�
- string strName = Language.StringByID(myInfoType.ObjectTypeNameId);
+ string strName = myInfoType.ObjectTypeName;
if (strName == string.Empty)
{
//鍔犱竴灞備繚闄�,鏈煡璁惧
@@ -1838,32 +1808,25 @@
return null;
}
- string[] strValue = this.dicDeviceModelIdEnum[modelKeys].Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries);
- int ConcreteValue = Convert.ToInt32(strValue[0]);
- int BeloneValue = Convert.ToInt32(strValue[1]);
+ var nameContent = this.dicDeviceModelIdEnum[modelKeys];
//璁剧疆璁惧鐨勩�愯澶囨墍灞炵被鍨嬨��
- info.BeloneType = (DeviceBeloneType)BeloneValue;
- if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + BeloneValue) == true)
- {
- //璁惧鎵�灞炵被鍨嬬殑缈昏瘧鍚嶅瓧
- info.BeloneTextId = dicDeviceAllNameID["uDeviceBelongId" + BeloneValue];
- }
+ info.BeloneType = (DeviceBeloneType)nameContent.BeloneTypeValue;
+ info.BeloneText = nameContent.A鎵�灞炲悕瀛�;
//璁惧鍏蜂綋绫诲瀷
- info.ConcreteType = (DeviceConcreteType)ConcreteValue;
- if (info.ConcreteType.ToString() == ConcreteValue.ToString())
+ info.ConcreteType = (DeviceConcreteType)nameContent.ConcreteTypeValue;
+ if (info.ConcreteType.ToString() == nameContent.ConcreteTypeValue.ToString())
{
info.ConcreteType = DeviceConcreteType.UnKownDevice;
}
- string keyName = deviceModelIdName + ConcreteValue;
- if (this.dicDeviceAllNameID.ContainsKey(keyName) == true)
- {
- //璁惧鐨勫畼鏂瑰悕绉�
- info.ConcreteTextId = this.dicDeviceAllNameID[keyName];
- }
+ //璁惧鐨勫畼鏂瑰悕绉�
+ info.ConcreteText = nameContent.A瀹樻柟鍚嶅瓧;
//璁惧鐨勭被鍨嬬炕璇戝悕绉�
- info.ObjectTypeNameId = Convert.ToInt32(strValue[2]);
+ info.ObjectTypeName = nameContent.A绫诲瀷鍚嶅瓧;
+
+ //璁惧榛樿鍚嶅瓧
+ info.DeviceDefultName = nameContent.A澶囨敞鍚嶅瓧;
return info;
}
@@ -1884,33 +1847,21 @@
|| info.BeloneType == DeviceBeloneType.A褰╃伅)
{
//褰掍负鐏厜
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId15;
- info.BeloneType = DeviceBeloneType.A鐏厜;
info.ConcreteType = DeviceConcreteType.Light;
- info.ObjectTypeNameId = 60007;//璋冨厜妯″潡
-
- int value = (int)info.BeloneType;
- if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + value) == true)
- {
- //璁惧鎵�灞炵被鍨嬬殑缈昏瘧鍚嶅瓧
- info.BeloneTextId = dicDeviceAllNameID["uDeviceBelongId" + value];
- }
+ info.ConcreteText = this.dicDeviceModelIdEnum["A418"].A瀹樻柟鍚嶅瓧;
+ info.BeloneType = DeviceBeloneType.A鐏厜;
+ info.BeloneText = this.dicDeviceModelIdEnum["A418"].A瀹樻柟鍚嶅瓧;
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A418"].A绫诲瀷鍚嶅瓧;//璋冨厜妯″潡
}
else if (info.BeloneType == DeviceBeloneType.A浼犳劅鍣�
|| device.Type == DeviceType.TemperatureSensor)
{
//浼犳劅鍣ㄥ悎骞�
- info.BeloneType = DeviceBeloneType.A浼犳劅鍣�;
info.ConcreteType = DeviceConcreteType.Sensor;
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId1200;
- info.ObjectTypeNameId = 60000;//浼犳劅鍣�
-
- int value = (int)info.BeloneType;
- if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + value) == true)
- {
- //璁惧鎵�灞炵被鍨嬬殑缈昏瘧鍚嶅瓧
- info.BeloneTextId = dicDeviceAllNameID["uDeviceBelongId" + value];
- }
+ info.ConcreteText = this.dicDeviceModelIdEnum["A402"].A瀹樻柟鍚嶅瓧;
+ info.BeloneType = DeviceBeloneType.A浼犳劅鍣�;
+ info.BeloneText = this.dicDeviceModelIdEnum["A402"].A瀹樻柟鍚嶅瓧;
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A402"].A绫诲瀷鍚嶅瓧;//浼犳劅鍣�
}
return info;
@@ -1938,50 +1889,50 @@
{
if (listdevice.Count > 1)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId200;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A401"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A鎸夐敭闈㈡澘;
info.ConcreteType = DeviceConcreteType.ButtonPanel;
}
else
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId16;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A419"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A骞叉帴鐐�;
info.ConcreteType = DeviceConcreteType.DryContact;
}
- info.ObjectTypeNameId = 60003;//鏅鸿兘闈㈡澘
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A401"].A绫诲瀷鍚嶅瓧;//鏅鸿兘闈㈡澘
}
//3鍖呭惈绐楀笜鐨勮瘽,褰撶獥甯樺鐞�
else if (dicType.ContainsKey(DeviceType.WindowCoveringDevice) == true)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId100;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A400"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A绐楀笜;
info.ConcreteType = DeviceConcreteType.Curtain;
- info.ObjectTypeNameId = 60002;//閬槼妯″潡
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A400"].A绫诲瀷鍚嶅瓧;//閬槼妯″潡
}
//4绌烘皵寮�鍏�
else if (dicType.ContainsKey(DeviceType.AirSwitch) == true)
{
//榛樿鍊�
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId4100;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A408"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A寮�鍏�;
info.ConcreteType = DeviceConcreteType.AirSwitch;
- info.ObjectTypeNameId = 60001;//寮�鍏虫ā鍧�
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A408"].A绫诲瀷鍚嶅瓧;//寮�鍏虫ā鍧�
if (dicType[DeviceType.AirSwitch].DfunctionType == DeviceFunctionType.A寮�鍏�)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId13;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A416"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A寮�鍏�;
info.ConcreteType = DeviceConcreteType.Switch;
}
else if (dicType[DeviceType.AirSwitch].DfunctionType == DeviceFunctionType.A鎻掑骇)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId14;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A417"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A鎻掑骇;
info.ConcreteType = DeviceConcreteType.Socket1;
}
else if (dicType[DeviceType.AirSwitch].DfunctionType == DeviceFunctionType.A鐏厜)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId15;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A418"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A鐏厜;
info.ConcreteType = DeviceConcreteType.Light;
}
@@ -1990,26 +1941,26 @@
else if (dicType.ContainsKey(DeviceType.OnOffOutput) == true)
{
//榛樿鍊�
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId2300;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A403"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A缁х數鍣�;
info.ConcreteType = DeviceConcreteType.Relay;
- info.ObjectTypeNameId = 60001;//寮�鍏虫ā鍧�
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A403"].A绫诲瀷鍚嶅瓧;//寮�鍏虫ā鍧�
if (dicType[DeviceType.OnOffOutput].DfunctionType == DeviceFunctionType.A寮�鍏�)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId13;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A416"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A寮�鍏�;
info.ConcreteType = DeviceConcreteType.Switch;
}
else if (dicType[DeviceType.OnOffOutput].DfunctionType == DeviceFunctionType.A鎻掑骇)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId14;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A417"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A鎻掑骇;
info.ConcreteType = DeviceConcreteType.Socket1;
}
else if (dicType[DeviceType.OnOffOutput].DfunctionType == DeviceFunctionType.A鐏厜)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId15;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A418"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A鐏厜;
info.ConcreteType = DeviceConcreteType.Light;
}
@@ -2017,58 +1968,58 @@
//6璋冨厜鍣�
else if (dicType.ContainsKey(DeviceType.DimmableLight) == true)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId2500;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A404"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A璋冨厜鍣�;
info.ConcreteType = DeviceConcreteType.DimmableLight;
- info.ObjectTypeNameId = 60007;//璋冨厜妯″潡
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A404"].A绫诲瀷鍚嶅瓧;//璋冨厜妯″潡
}
//7褰╃伅
else if (dicType.ContainsKey(DeviceType.ColorDimmableLight) == true)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId9;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A410"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A褰╃伅;
info.ConcreteType = DeviceConcreteType.ColorLight;
- info.ObjectTypeNameId = 60007;//璋冨厜妯″潡
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A410"].A绫诲瀷鍚嶅瓧;//璋冨厜妯″潡
}
//8绌鸿皟
else if (dicType.ContainsKey(DeviceType.Thermostat) == true)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId3600;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A406"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A绌鸿皟;
info.ConcreteType = DeviceConcreteType.AirConditioner;
- info.ObjectTypeNameId = 60009;//绌鸿皟妯″潡
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A406"].A绫诲瀷鍚嶅瓧;//绌鸿皟妯″潡
}
//9涓户鍣�
else if (dicType.ContainsKey(DeviceType.Repeater) == true)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId3900;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A407"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A涓户鍣�;
info.ConcreteType = DeviceConcreteType.Repeater;
- info.ObjectTypeNameId = 60006;//绯荤粺璁惧
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A407"].A绫诲瀷鍚嶅瓧;//绯荤粺璁惧
}
//10杞崲鍣�
else if (dicType.ContainsKey(DeviceType.Transverter) == true)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId4200;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A409"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A杞崲鍣�;
info.ConcreteType = DeviceConcreteType.Converter;
- info.ObjectTypeNameId = 60008;//杞崲鍣�
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A409"].A绫诲瀷鍚嶅瓧;//杞崲鍣�
}
//11鏅鸿兘闂ㄩ攣
else if (dicType.ContainsKey(DeviceType.DoorLock) == true)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId2800;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A405"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A鏅鸿兘闂ㄩ攣;
info.ConcreteType = DeviceConcreteType.IntelligentLocks;
- info.ObjectTypeNameId = 60010;//鏅鸿兘闂ㄩ攣
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A405"].A绫诲瀷鍚嶅瓧;//鏅鸿兘闂ㄩ攣
}
//12鍖呭惈浼犳劅鍣ㄧ殑璇�,褰撲紶鎰熷櫒澶勭悊
else if (dicType.ContainsKey(DeviceType.IASZone) == true)
{
info.BeloneType = DeviceBeloneType.A浼犳劅鍣�;
info.ConcreteType = DeviceConcreteType.Sensor;
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId1200;
- info.ObjectTypeNameId = 60000;//浼犳劅鍣�
+ info.ConcreteText = this.dicDeviceModelIdEnum["A402"].A瀹樻柟鍚嶅瓧;
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A402"].A绫诲瀷鍚嶅瓧;//浼犳劅鍣�
//璁剧疆浼犳劅鍣ㄥ叿浣撶殑绫诲瀷
this.SetSensorDeviceSpecificType(ref info, listdevice);
}
@@ -2099,56 +2050,53 @@
{
//璁剧疆浼犳劅鍣ㄥ叿浣撶殑绫诲瀷
info.BeloneType = DeviceBeloneType.A娓╂箍搴︿紶鎰熷櫒;
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId10;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A411"].A瀹樻柟鍚嶅瓧;
info.ConcreteType = DeviceConcreteType.Sensor_TemperatureHumidity;
}
else if (temperatrue == true && humidity == false)
{
//璁剧疆浼犳劅鍣ㄥ叿浣撶殑绫诲瀷
info.BeloneType = DeviceBeloneType.A娓╁害浼犳劅鍣�;
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId11;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A412"].A瀹樻柟鍚嶅瓧;
info.ConcreteType = DeviceConcreteType.Sensor_Temperature;
}
else if (temperatrue == false && humidity == true)
{
//璁剧疆浼犳劅鍣ㄥ叿浣撶殑绫诲瀷
info.BeloneType = DeviceBeloneType.A婀垮害浼犳劅鍣�;
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceBelongId12;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A413"].A瀹樻柟鍚嶅瓧;
info.ConcreteType = DeviceConcreteType.Sensor_Humidity;
}
- info.ObjectTypeNameId = 60000;//浼犳劅鍣�
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A411"].A绫诲瀷鍚嶅瓧;//浼犳劅鍣�
}
//14鏂伴璁惧
else if (dicType.ContainsKey(DeviceType.FreshAir) == true)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId2310;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A414"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A鏂伴;
info.ConcreteType = DeviceConcreteType.Relay_FangyueFreshAirModul;
- info.ObjectTypeNameId = 60011;//鏂伴
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A414"].A绫诲瀷鍚嶅瓧;//鏂伴
}
//15 PM2.5浼犳劅鍣ㄨ澶�
else if (dicType.ContainsKey(DeviceType.PMSensor) == true)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1307;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A415"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.APM2鐐�5绌烘皵璐ㄩ噺浼犳劅鍣�;
info.ConcreteType = DeviceConcreteType.Sensor_PMTwoPointFive;
- info.ObjectTypeNameId = 60000;//浼犳劅鍣�
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A415"].A绫诲瀷鍚嶅瓧;//浼犳劅鍣�
}
//16鑹叉俯鐏�
else if (dicType.ContainsKey(DeviceType.ColorTemperatureLight) == true)
{
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId20000;
+ info.ConcreteText = this.dicDeviceModelIdEnum["A420"].A瀹樻柟鍚嶅瓧;
info.BeloneType = DeviceBeloneType.A褰╃伅;
info.ConcreteType = DeviceConcreteType.ColorLight_Temperature;
- info.ObjectTypeNameId = 60007;//璋冨厜妯″潡
+ info.ObjectTypeName = this.dicDeviceModelIdEnum["A420"].A绫诲瀷鍚嶅瓧;//璋冨厜妯″潡
}
- int value = (int)info.BeloneType;
- if (dicDeviceAllNameID.ContainsKey("uDeviceBelongId" + value) == true)
- {
- //璁惧鎵�灞炵被鍨嬬殑缈昏瘧鍚嶅瓧
- info.BeloneTextId = dicDeviceAllNameID["uDeviceBelongId" + value];
- }
+ //璁惧鎵�灞炵被鍨嬬殑缈昏瘧鍚嶅瓧
+ info.BeloneText = info.ConcreteText;
+ info.DeviceDefultName = info.ConcreteText;
return info;
}
@@ -2174,49 +2122,49 @@
{
//杩愬姩浼犳劅鍣�
info.ConcreteType = DeviceConcreteType.Sensor_Motion;
- info.ConcreteTextId = R.MyInternationalizationString.uMotionSensor;
+ info.ConcreteText = Language.StringByID(R.MyInternationalizationString.uMotionSensor);
}
else if (iasZone.IasDeviceType == 40)
{
//鐑熼浘浼犳劅鍣�
info.ConcreteType = DeviceConcreteType.Sensor_Fire;
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1302;
+ info.ConcreteText = Language.StringByID(R.MyInternationalizationString.uSensorFire);
}
else if (iasZone.IasDeviceType == 42)
{
//姘翠镜浼犳劅鍣�
info.ConcreteType = DeviceConcreteType.Sensor_Water;
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1304;
+ info.ConcreteText = Language.StringByID(R.MyInternationalizationString.uSensorWater);
}
else if (iasZone.IasDeviceType == 43)
{
//鐕冩皵浼犳劅鍣�
info.ConcreteType = DeviceConcreteType.Sensor_CarbonMonoxide;
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1300;
+ info.ConcreteText = Language.StringByID(R.MyInternationalizationString.uSensorCarbonMonoxide);
}
else if (iasZone.IasDeviceType == 44)
{
//绱ф�ユ寜閽�
info.ConcreteType = DeviceConcreteType.Sensor_EmergencyButton;
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1305;
+ info.ConcreteText = Language.StringByID(R.MyInternationalizationString.uSensorEmergencyButton);
}
else if (iasZone.IasDeviceType == 277)
{
//閽ュ寵鎵�
info.ConcreteType = DeviceConcreteType.Sensor_Keyfob;
- info.ConcreteTextId = R.MyInternationalizationString.uKeyfob;
+ info.ConcreteText = Language.StringByID(R.MyInternationalizationString.uKeyfob);
}
else if (iasZone.IasDeviceType == 21 || iasZone.IasDeviceType == 22)
{
//闂ㄧ獥浼犳劅鍣�
info.ConcreteType = DeviceConcreteType.Sensor_DoorWindow;
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1301;
+ info.ConcreteText = Language.StringByID(R.MyInternationalizationString.uSensorDoorWindow);
}
else if (iasZone.IasDeviceType == 541)
{
//鐞冨瀷绉诲姩浼犳劅鍣�
info.ConcreteType = DeviceConcreteType.Sensor_SphericalMotion;
- info.ConcreteTextId = R.MyInternationalizationString.uDeviceModelId1205;
+ info.ConcreteText = this.dicDeviceModelIdEnum["MSPIRB-ZB.10"].A瀹樻柟鍚嶅瓧;
}
}
@@ -2474,9 +2422,15 @@
/// 浠庣紦瀛樺彉閲忔娴嬭澶囨槸鍚﹀湪绾�
/// </summary>
/// <param name="i_device"></param>
+ /// <param name="checkAll">鏄惁妫�娴嬪叏閮ㄥ洖璺�</param>
/// <returns></returns>
- public bool CheckDeviceIsOnline(CommonDevice i_device)
+ public bool CheckDeviceIsOnline(CommonDevice i_device, bool checkAll = true)
{
+ if (checkAll == false)
+ {
+ //涓嶆娴嬪叏閮ㄥ洖璺�
+ return i_device.IsOnline == 1 || i_device.IsOnline == 2;
+ }
var listDevice = this.GetDevicesByMac(i_device.DeviceAddr, false);
foreach (var device in listDevice)
{
@@ -2601,6 +2555,20 @@
}
/// <summary>
+ /// 鑾峰彇妯″潡ID鎵�鎸囧悜鐨勫悇绉嶅悕瀛椾俊鎭�
+ /// </summary>
+ /// <param name="strKey"></param>
+ /// <returns></returns>
+ public DeviceNameContent GetDeviceModelIdNameInfo(string strKey)
+ {
+ if (this.dicDeviceModelIdEnum.ContainsKey(strKey) == false)
+ {
+ return null;
+ }
+ return this.dicDeviceModelIdEnum[strKey];
+ }
+
+ /// <summary>
/// 闄勫姞璁惧鐨勭増鏈唬鍙�(杩斿洖Ver.XXX)
/// </summary>
/// <param name="versionValue">鐗堟湰鍙�</param>
@@ -2631,7 +2599,7 @@
/// <param name="msg"></param>
private void ShowErrorMsg(string msg)
{
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
var contr = new ShowMsgControl(ShowMsgType.Error, msg);
contr.Show();
@@ -2644,7 +2612,7 @@
/// <param name="msg"></param>
private void ShowTipMsg(string msg)
{
- Application.RunOnMainThread(() =>
+ HdlThreadLogic.Current.RunMain(() =>
{
var contr = new ShowMsgControl(ShowMsgType.Tip, msg);
contr.Show();
@@ -2663,22 +2631,11 @@
/// </summary>
/// <param name="zbGateway">缃戝叧瀵硅薄</param>
/// <param name="statu">鐘舵��-> -1:寮傚父,浼氳繑鍥瀗ull, 1锛氭病鏈夊紓甯�, 2:鏁版嵁鎺ユ敹涓嶅叏</param>
- /// <param name="ignoreTime">鏄惁鏃犺鏃堕棿(姝ゅ彉閲忔槸缁欒幏鍙栧湪绾跨姸鎬佺敤鐨�),true:姣忔璋冪敤閮藉幓缃戝叧鑾峰彇,false:3鍒嗛挓鍐呰繑鍥炵殑鏄湰鍦扮殑璁惧</param>
+ /// <param name="useLocalConnect">鏄惁浣跨敤鏈湴杩炴帴鍙戦��</param>
/// <param name="mode">鏄惁鏄剧ず閿欒</param>
/// <returns></returns>
- public List<CommonDevice> GetDeviceListFromGateway(ZbGateway zbGateway, ref int statu, bool ignoreTime, ShowErrorMode mode = ShowErrorMode.YES)
+ public List<CommonDevice> GetDeviceListFromGateway(ZbGateway zbGateway, ref int statu, bool useLocalConnect, ShowErrorMode mode = ShowErrorMode.YES)
{
- if (ignoreTime == false)
- {
- if ((DateTime.Now - zbGateway.LastDateTime).TotalMilliseconds < 3 * 60 * 1000)
- {
- //涓嶆棤瑙嗘椂闂�,杩斿洖鏈湴璁惧鍒楄〃
- statu = 1;
- return this.GetDeviceByGatewayID(zbGateway.GwId);
- }
- }
- zbGateway.LastDateTime = DateTime.Now;
-
//濡傛灉鍒囨崲鍒颁簡鍒殑鐣岄潰锛屽垯涓嶆樉绀洪敊璇俊鎭�
string nowFormId = UserCenterResourse.NowActionFormID;
@@ -2694,6 +2651,8 @@
statu = -1;
return null;
}
+ //闇�瑕佸彉鏇村姛鑳界被鍨嬬殑鍥炶矾
+ var listFucDevice = new List<CommonDevice>();
//鏄惁杈炬垚涓柇鐨勬椂鏈�
bool canBreak = false;
@@ -2752,6 +2711,11 @@
{
//鍒锋柊灞炴��
this.SetDeviceInfoToMain(localDevice, device);
+ if (this.RefreshDeviceFunctionType(localDevice, device, false) == true)
+ {
+ //闇�瑕佸彂閫佸姛鑳界被鍨嬬粰缃戝叧
+ listFucDevice.Add(localDevice);
+ }
}
}
}
@@ -2775,7 +2739,15 @@
try
{
var jObject = new Newtonsoft.Json.Linq.JObject { { "Cluster_ID", 0 }, { "Command", 93 } };
- realWay.Send("GetDeviceInfo", jObject.ToString());
+ if (useLocalConnect == false)
+ {
+ realWay.Send("GetDeviceInfo", jObject.ToString());
+ }
+ else
+ {
+ //寮哄埗浣跨敤鏈湴杩炴帴
+ realWay.SendLocation("GetDeviceInfo", Encoding.UTF8.GetBytes(jObject.ToString()));
+ }
}
catch { canBreak = true; }
@@ -2819,6 +2791,19 @@
{
statu = 1;
}
+ if (listFucDevice.Count > 0)
+ {
+ //濡傛灉瀛樺湪闇�瑕佸彉鏇寸殑鍔熻兘绫诲瀷
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ for (int i = 0; i < listFucDevice.Count; i++)
+ {
+ this.SendDeviceFunctionTypeToGateway(listFucDevice[i], listFucDevice[i].DfunctionType);
+ System.Threading.Thread.Sleep(100);
+ }
+ });
+ }
+
return listDevice;
}
@@ -2827,7 +2812,7 @@
#region 鈻� 鍒涘缓鏂拌澶囧璞$浉鍏砡________________
/// <summary>
- /// 鏍规嵁璁惧绫诲瀷鍒涘缓璁惧瀵硅薄鐨勫疄渚�
+ /// 鏍规嵁璁惧绫诲瀷鍒涘缓璁惧瀵硅薄鐨勫疄渚�(鏁版嵁鍦―eviceInfo涓�)
/// </summary>
/// <param name="deviceType">璁惧绫诲瀷</param>
/// <param name="jobject">涓婚Data</param>
@@ -2850,15 +2835,10 @@
{
return null;
}
- this.SetMacName(device, string.Empty);
- this.SetEpointName(device, string.Empty);
//璁剧疆璁惧涓婚敭绫�
this.SetNewDeviceMainKeys(device, jobject);
device.CurrentGateWayId = gwId;
-
- //灏咲eviceInfo鐨勫睘鎬ц缃埌涓诲睘鎬т腑
- this.SetDeviceInfoToMain(device, device);
return device;
}
@@ -2900,6 +2880,11 @@
mainDevice.SerialNumber = device.DeviceInfo.ProductCode;
//璁惧鍔熻兘绫诲瀷
mainDevice.DfunctionType = (DeviceFunctionType)device.DeviceInfo.FunctionType;
+ if (mainDevice.DfunctionType == DeviceFunctionType.A涓嶆寚瀹�)
+ {
+ //寮忔牱鍙樻洿:鍔熻兘绫诲瀷涓嶅厑璁搁�夋嫨涓虹┖ 缃戝叧榛樿鐨凢unctionType涓�0
+ mainDevice.DfunctionType = DeviceFunctionType.A鏈畾涔�;
+ }
mainDevice.InClusterList.Clear();
mainDevice.InClusterList.AddRange(device.DeviceInfo.InClusterList);
@@ -2921,104 +2906,6 @@
((TemperatureSensor)mainDevice).SensorDiv = 1;
}
}
- }
- //濡傛灉鏄皟鍏夊櫒
- else if (mainDevice.Type == DeviceType.DimmableLight)
- {
- mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
- if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜)
- {
- //璋冨厜鍣ㄥ浐瀹氱伅鍏�
- this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A鐏厜);
- }
- if (mainDevice.IsCustomizeImage == false)
- {
- mainDevice.IconPath = "Device/Light.png";
- }
- }
- //濡傛灉鏄壊娓╃伅
- else if (mainDevice.Type == DeviceType.ColorTemperatureLight)
- {
- mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
- if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜)
- {
- //鑹叉俯鐏浐瀹氱伅鍏�
- this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A鐏厜);
- }
- if (mainDevice.IsCustomizeImage == false)
- {
- mainDevice.IconPath = "Device/ColorLightTemperature.png";
- }
- }
- //濡傛灉鏄笁璺户鐢靛櫒鐨勫洖璺殑璇�,榛樿涓虹伅鍏�
- else if (mainDevice.Type == DeviceType.OnOffOutput)
- {
- //2020.05.13鍙樻洿:缁х數鍣ㄩ兘榛樿涓虹伅鍏�
- if (mainDevice.DfunctionType == DeviceFunctionType.A鏈畾涔�)
- {
- mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
- if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜)
- {
- //缁х數鍣ㄩ粯璁や负鐏厜
- this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A鐏厜);
- }
- }
- //鏍规嵁鍔熻兘绫诲瀷,閲嶆柊璁剧疆璁惧鍥炶矾鍥炬爣
- this.ResetIconPathByDeviceFunctionType(mainDevice);
- }
- //濡傛灉鏄┖姘斿紑鍏崇殑璇�
- else if (mainDevice.Type == DeviceType.AirSwitch)
- {
- //绌烘皵寮�鍏抽粯璁や负寮�鍏�
- if (mainDevice.DfunctionType == DeviceFunctionType.A鏈畾涔�)
- {
- mainDevice.DfunctionType = DeviceFunctionType.A寮�鍏�;
- if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A寮�鍏�)
- {
- //绌烘皵寮�鍏抽粯璁や负寮�鍏�
- this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A寮�鍏�);
- }
- }
- //鏍规嵁鍔熻兘绫诲瀷,閲嶆柊璁剧疆璁惧鍥炶矾鍥炬爣
- this.ResetIconPathByDeviceFunctionType(mainDevice);
- }
- //濡傛灉鏄僵鐏殑璇�
- else if (mainDevice.Type == DeviceType.ColorDimmableLight)
- {
- mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
- if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜)
- {
- //褰╃伅榛樿涓哄紑鍏�
- this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A鐏厜);
- }
- if (mainDevice.IsCustomizeImage == false)
- {
- mainDevice.IconPath = "Device/ColorLight.png";
- }
- }
- }
-
- /// <summary>
- /// 鏍规嵁鍔熻兘绫诲瀷,閲嶆柊璁剧疆璁惧鍥炶矾鍥炬爣
- /// </summary>
- /// <param name="device"></param>
- private void ResetIconPathByDeviceFunctionType(CommonDevice device)
- {
- if (device.IsCustomizeImage == true)
- {
- return;
- }
- if (device.DfunctionType == DeviceFunctionType.A寮�鍏�)
- {
- device.IconPath = "Device/Switch.png";
- }
- else if (device.DfunctionType == DeviceFunctionType.A鎻掑骇)
- {
- device.IconPath = "Device/Socket1.png";
- }
- else
- {
- device.IconPath = "Device/Light.png";
}
}
@@ -3075,6 +2962,139 @@
#endregion
+ #region 鈻� 鍒锋柊璁惧鍔熻兘绫诲瀷___________________
+
+ /// <summary>
+ /// 鍒锋柊璁惧鐨勫姛鑳界被鍨�,濡傛灉杩斿洖true,浠h〃闇�瑕佸彟澶栬皟鐢ㄣ�怱endDeviceFunctionTypeToGateway銆戝嚱鏁�,sendFucType涓簍rue鏃惰嚜鍔ㄨ皟鐢�
+ /// </summary>
+ /// <param name="mainDevice">涓昏澶囧璞�</param>
+ /// <param name="device">璁剧疆婧愯澶囧璞�</param>
+ /// <param name="sendFucType">褰撻渶瑕佸彉鏇存椂,鏄惁鍙戦�佸姛鑳界被鍨嬪埌缃戝叧(姝ゅ彉閲忕粰鑾峰彇璁惧鍒楄〃鏈夌壒娈婂惈涔�)</param>
+ public bool RefreshDeviceFunctionType(CommonDevice mainDevice, CommonDevice device, bool sendFucType)
+ {
+ //濡傛灉鏄皟鍏夊櫒
+ if (mainDevice.Type == DeviceType.DimmableLight)
+ {
+ if (mainDevice.IsCustomizeImage == false)
+ {
+ mainDevice.IconPath = "Device/Light.png";
+ }
+ mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
+ if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜)
+ {
+ //璋冨厜鍣ㄥ浐瀹氱伅鍏�
+ if (sendFucType == true)
+ {
+ this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A鐏厜);
+ }
+ return true;
+ }
+ }
+ //濡傛灉鏄壊娓╃伅
+ else if (mainDevice.Type == DeviceType.ColorTemperatureLight)
+ {
+ if (mainDevice.IsCustomizeImage == false)
+ {
+ mainDevice.IconPath = "Device/ColorLightTemperature.png";
+ }
+ mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
+ if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜)
+ {
+ //鑹叉俯鐏浐瀹氱伅鍏�
+ if (sendFucType == true)
+ {
+ this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A鐏厜);
+ }
+ return true;
+ }
+ }
+ //濡傛灉鏄笁璺户鐢靛櫒鐨勫洖璺殑璇�,榛樿涓虹伅鍏�
+ else if (mainDevice.Type == DeviceType.OnOffOutput)
+ {
+ //鏍规嵁鍔熻兘绫诲瀷,閲嶆柊璁剧疆璁惧鍥炶矾鍥炬爣
+ this.ResetIconPathByDeviceFunctionType(mainDevice);
+ //2020.05.13鍙樻洿:缁х數鍣ㄩ兘榛樿涓虹伅鍏�
+ if (mainDevice.DfunctionType == DeviceFunctionType.A鏈畾涔�)
+ {
+ mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
+ if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜)
+ {
+ //缁х數鍣ㄩ粯璁や负鐏厜
+ if (sendFucType == true)
+ {
+ this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A鐏厜);
+ }
+ return true;
+ }
+ }
+ }
+ //濡傛灉鏄┖姘斿紑鍏崇殑璇�
+ else if (mainDevice.Type == DeviceType.AirSwitch)
+ {
+ //鏍规嵁鍔熻兘绫诲瀷,閲嶆柊璁剧疆璁惧鍥炶矾鍥炬爣
+ this.ResetIconPathByDeviceFunctionType(mainDevice);
+ //绌烘皵寮�鍏抽粯璁や负寮�鍏�
+ if (mainDevice.DfunctionType == DeviceFunctionType.A鏈畾涔�)
+ {
+ mainDevice.DfunctionType = DeviceFunctionType.A寮�鍏�;
+ if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A寮�鍏�)
+ {
+ //绌烘皵寮�鍏抽粯璁や负寮�鍏�
+ if (sendFucType == true)
+ {
+ this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A寮�鍏�);
+ }
+ return true;
+ }
+ }
+ }
+ //濡傛灉鏄僵鐏殑璇�
+ else if (mainDevice.Type == DeviceType.ColorDimmableLight)
+ {
+ if (mainDevice.IsCustomizeImage == false)
+ {
+ mainDevice.IconPath = "Device/ColorLight.png";
+ }
+ mainDevice.DfunctionType = DeviceFunctionType.A鐏厜;
+ if (device.DeviceInfo.FunctionType != (int)DeviceFunctionType.A鐏厜)
+ {
+ //褰╃伅榛樿涓哄紑鍏�
+ if (sendFucType == true)
+ {
+ this.SendDeviceFunctionTypeToGateway(mainDevice, DeviceFunctionType.A寮�鍏�);
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// 鏍规嵁鍔熻兘绫诲瀷,閲嶆柊璁剧疆璁惧鍥炶矾鍥炬爣
+ /// </summary>
+ /// <param name="device"></param>
+ private void ResetIconPathByDeviceFunctionType(CommonDevice device)
+ {
+ if (device.IsCustomizeImage == true)
+ {
+ return;
+ }
+ if (device.DfunctionType == DeviceFunctionType.A寮�鍏�)
+ {
+ device.IconPath = "Device/Switch.png";
+ }
+ else if (device.DfunctionType == DeviceFunctionType.A鎻掑骇)
+ {
+ device.IconPath = "Device/Socket1.png";
+ }
+ else
+ {
+ device.IconPath = "Device/Light.png";
+ }
+ }
+
+ #endregion
+
//----------------------------------鍒嗗壊绾�(璁惧妯″潡ID)---------------------------------------------
#region 鈻� 鑷畾涔夎澶囨ā鍧桰D___________________
@@ -3084,108 +3104,49 @@
/// </summary>
private void InitDeviceModelIdEnum()
{
+ //*********************************************************************
+ //鏂拌澶囨坊鍔犳柟娉曪細
+ //1銆佸湪鏈�涓嬮潰娣诲姞 DeviceConcreteType 锛岀劧鍚庢槸 DeviceBeloneType
+ //2銆佷互璁惧鐨勫叿浣撶被鍨嬩负鍚嶅瓧DeviceConcreteType(鍘绘帀銆�-銆�)娣诲姞璁惧鐨勩�愭墍灞炲浘鐗囥�戯紝銆愮湡瀹炵墿鐞嗗浘鐗囥�戙�傚洖璺浘鐗囬渶瑕佺壒娈婂鐞�
+ //3銆佸鏋滈渶瑕佸叡鏈夊浘鐗�,鍒欏湪杩欎釜鍑芥暟鐨勬渶搴曚笅娣诲姞
+ //4銆佹樉绀虹殑妯″潡ID闇�瑕佷氦鎹㈢殑璇�,鍒欏湪杩欎釜鍑芥暟鐨勬渶搴曚笅娣诲姞
+ //*********************************************************************
+
if (this.dicDeviceModelIdEnum != null)
{
return;
}
- this.dicDeviceModelIdEnum = new Dictionary<string, string>();
+ this.dicDeviceModelIdEnum = new Dictionary<string, DeviceNameContent>();
- //*********************************************************************
- //鏂拌澶囨坊鍔犳柟娉曪細
- //1銆佸湪杩欓噷濉啓涓婃ā鍧桰D锛岀劧鍚庢槸 DeviceConcreteType 锛岀劧鍚庢槸 DeviceBeloneType , 鐒跺悗鏄� 璁惧绫诲瀷鐨勭炕璇慖D
- //2銆佺劧鍚庡湪鏈�涓嬮潰鐨勩�愯嚜瀹氫箟璁惧绫诲瀷銆戞姌鍙犳爮閲屾坊鍔犮�愯澶囩殑鍏蜂綋绫诲瀷銆戯紝銆愯澶囩殑鎵�灞炵被鍨嬨��
- //3銆佷互璁惧鐨勫叿浣撶被鍨嬩负鍚嶅瓧(鍘绘帀銆�-銆�)娣诲姞璁惧鐨勩�愭墍灞炲浘鐗囥�戯紝銆愮湡瀹炵墿鐞嗗浘鐗囥�戙�傚洖璺浘鐗囬渶瑕佺壒娈婂鐞�
- //4銆佹坊鍔燫鏂囦欢(uDeviceModelId),娣诲姞Language鏂囦欢
- //5銆佸鏋滈渶瑕佸叡鏈夊浘鐗�,鍒欏湪杩欎釜鍑芥暟鐨勬渶搴曚笅娣诲姞
- //*********************************************************************
-
- //鍓嶈█锛氬洜涓簔igbeehome鐨勮澶囨嫢鏈夊洓绉嶅悕瀛楋細
- //1銆佽澶囧畼鏂瑰悕绉� ----瀹冪敱DeviceConcreteType鐨勬暟鍊兼墍鍐冲畾(涓汉涓績涓撶敤)
- //2銆佽澶囧叆缃戝悗鐨勯粯璁ゅ悕绉� ----瀹冧笉闇�瑕佸湪浠g爜閲岄潰瀹氫箟,瀹冪洿鎺ュ湪Language鏂囦欢閲岄潰瀹氫箟
- // 鑼冨洿锛�50000寮�濮�,瀹冪殑瑙勫垯鏄疍eviceConcreteType瀵瑰簲鐨凴鏂囦欢閲岄潰鐨処D鐨勬暟鍊�+20000,
- //3銆佽澶囨墍灞炲悕绉� ----瀹冩湁DeviceBeloneType鐨勬暟鍊兼墍鍐冲畾
- //4銆佽澶囩被鍨嬪悕绉� ----瀹冪敱銆愯澶囩被鍨嬬殑缈昏瘧ID銆戞墍鍐冲畾,杩欎釜鍊兼槸涓汉涓績涓撶敤,
- // 瀹冩槸Language鏂囦欢閲岄潰鐨� 60000涔嬪悗鐨勯偅浜涘��
-
- //瀹氫箟瑙勫垯锛氭ā鍧桰D(宸茬炕璇�) = 璁惧鍏蜂綋绫诲瀷鍊� - 璁惧鎵�灞炵被鍨嬪�� - 璁惧绫诲瀷鐨勭炕璇慖D
- //璁惧鍏蜂綋绫诲瀷鍊硷細DeviceConcreteType(鍦ㄨ繖涓枃浠舵渶涓嬮潰杩涜瀹氫箟)
- //璁惧鎵�灞炵被鍨嬪��: DeviceBeloneType(鑷畾涔夌殑鍊�,鍢�,鍙涓嶉噸澶嶅氨鍙互,鍦ㄨ繖涓枃浠舵渶涓嬮潰杩涜瀹氫箟)
- //璁惧绫诲瀷鐨勭炕璇慖D:杩欎釜鍊兼槸涓汉涓績涓撶敤,瀹冩槸Language鏂囦欢閲岄潰鐨� 60000涔嬪悗鐨勯偅浜涘��
-
- //=========鈽呪槄寮�鍚堝笜绫�(100-199)鈽呪槄=========
- this.dicDeviceModelIdEnum["MWM65B-ZB.20"] = "100-100-60002";//鏅鸿兘寮�鍚堝笜鐢垫満
- this.dicDeviceModelIdEnum["MVSM35B-ZB.20"] = "101-100-60002";//鏅鸿兘绠$姸鐢垫満
-
- //=========鈽呪槄鎸夐敭闈㈡澘绫�(200-1199)鈽呪槄=========
- this.dicDeviceModelIdEnum["MPT4/R4-ZB.18"] = "200-200-60003";//4鎸夐敭瑙︽懜闈㈡澘(甯�4璺户鐢靛櫒搴曞骇)
- this.dicDeviceModelIdEnum["MPT3/R3-ZB.18"] = "201-200-60003";//3鎸夐敭瑙︽懜闈㈡澘
- this.dicDeviceModelIdEnum["MPT2/R2-ZB.18"] = "202-200-60003";//2鎸夐敭瑙︽懜闈㈡澘
- this.dicDeviceModelIdEnum["MPT1/R1-ZB.18"] = "203-200-60003";//12鎸夐敭瑙︽懜闈㈡澘
- this.dicDeviceModelIdEnum["MPT4-ZB.18"] = "210-200-60003";//4鎸夐敭瑙︽懜闈㈡澘(鍙甫鐢垫簮搴曞骇)
- this.dicDeviceModelIdEnum["MPT4R4L/S-ZB.18"] = "220-200-60003";//绠�绾�4鎸夐敭闈㈡澘
- this.dicDeviceModelIdEnum["MPT3R3L/S-ZB.18"] = "221-200-60003";//绠�绾�3鎸夐敭闈㈡澘
- this.dicDeviceModelIdEnum["MPT2R2L/S-ZB.18"] = "222-200-60003";//绠�绾�2鎸夐敭闈㈡澘
- this.dicDeviceModelIdEnum["MPT4SC/S-ZB.18"] = "224-200-60003";//绠�绾�4鎸夐敭鍦烘櫙闈㈡澘
- this.dicDeviceModelIdEnum["MPT2W/S-ZB.18"] = "226-200-60003";//绠�绾�2璺獥甯橀潰鏉�
- this.dicDeviceModelIdEnum["MP2B/TILE-ZB.18"] = "240-200-60003";//鏂规偊鍗曞紑鍙屾帶闈㈡澘
- this.dicDeviceModelIdEnum["MP4B/TILE-ZB.18"] = "241-200-60003";//鏂规偊鍙屽紑鍥涙帶闈㈡澘
- this.dicDeviceModelIdEnum["MP8B/TILE-ZB.18"] = "242-200-60003";//鏂规偊鍥涘紑鍏帶闈㈡澘
- this.dicDeviceModelIdEnum["MPFA/TILE-ZB.18"] = "250-200-60003";//鏂规偊鏂伴闈㈡澘
- this.dicDeviceModelIdEnum["MPTE3/TILE-ZB.18"] = "253-200-60003";//鏂规偊鐜闈㈡澘
- this.dicDeviceModelIdEnum["MP2W/TILE-ZB.18"] = "256-200-60003";//绐楀笜闈㈡澘
- this.dicDeviceModelIdEnum["MPTL4C/S-ZB.18"] = "212-200-60003";//绠�绾﹀鍔熻兘闈㈡澘
- this.dicDeviceModelIdEnum["MPTE3/S-ZB.18"] = "230-200-60003";//绠�绾︾幆澧冮潰鏉�
-
-
- //=========鈽呪槄PIR浼犳劅鍣ㄧ被(1200-1299)鈽呪槄=========
- this.dicDeviceModelIdEnum["MSPIR01-ZB.10"] = "1200-1200-60000";//pir浼犳劅鍣�220
- this.dicDeviceModelIdEnum["MSPIRB-ZB.10"] = "1205-1200-60000";//鐞冨瀷绉诲姩浼犳劅鍣�
-
- //=========鈽呪槄瀹夐槻绫讳紶鎰熷櫒绫�(1300-2299)鈽呪槄=========
- //杩欓噷鏄害涔愬厠鐨�
- this.dicDeviceModelIdEnum["MULTI-GASE--EA07"] = "1300-1200-60000";//鐕冩皵浼犳劅鍣�
- this.dicDeviceModelIdEnum["MULTI-MECI--EA01"] = "1301-1200-60000";//闂ㄧ獥纾佷紶鎰熷櫒
- this.dicDeviceModelIdEnum["MULTI-FIRE--EA05"] = "1302-1200-60000";//鐑熼浘浼犳劅鍣�
- this.dicDeviceModelIdEnum["MULTI-MOTI--EA04"] = "1303-1200-60000";//绾㈠浼犳劅鍣�
- this.dicDeviceModelIdEnum["MULTI-WATE--EA02"] = "1304-1200-60000";//姘存蹈浼犳劅鍣�
- this.dicDeviceModelIdEnum["MULTI-BURO--EA06"] = "1305-1200-60000";//绱ф�ユ寜閿�
- //杩欓噷鏄渤涓滅殑
- this.dicDeviceModelIdEnum["MSG01/M-ZB.10"] = "1300-1200-60000";//鐕冩皵浼犳劅鍣�
- this.dicDeviceModelIdEnum["MSDC01/M-ZB.10"] = "1301-1200-60000";//闂ㄧ獥纾佷紶鎰熷櫒
- this.dicDeviceModelIdEnum["MSS01/M-ZB.10"] = "1302-1200-60000";//鐑熼浘浼犳劅鍣�
- 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/M-ZB.10"] = "1306-1200-60000";//鍚搁《鐕冩皵浼犳劅鍣�
-
- //PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� 銆愯璁惧灞炰簬绗笁鏂硅澶囷紝娌℃湁闀滃儚ID銆�
- this.dicDeviceModelIdEnum["MSPM25/M-ZB.10"] = "1307-1200-60000";//PM2.5绌烘皵璐ㄩ噺浼犳劅鍣�
-
- //=========鈽呪槄缁х數鍣ㄧ被(2300-2499)鈽呪槄=========
- this.dicDeviceModelIdEnum["MPR0310-ZB.10"] = "2300-2300-60001";//3璺户鐢靛櫒灏忔ā鍧�
- this.dicDeviceModelIdEnum["MFA01-ZB.10"] = "2310-2300-60011";//鏂规偊鏂伴灏忔ā鍧�
-
- //=========鈽呪槄璋冨厜鍣ㄧ被(2500-2799)鈽呪槄=========
- this.dicDeviceModelIdEnum["MPD0101-ZB.10"] = "2500-2500-60007";//1璺皟鍏夊櫒灏忔ā鍧�
-
- //=========鈽呪槄鏅鸿兘闂ㄩ攣绫�(2800-????)鈽呪槄=========
- this.dicDeviceModelIdEnum["H06C"] = "2800-2800-60010";//鏅鸿兘闂ㄩ攣(H06C)
- this.dicDeviceModelIdEnum["S-one"] = "2802-2800-60010";//鏅鸿兘闂ㄩ攣(S-one)
-
- //=========鈽呪槄绌鸿皟绫�(3600-3899)鈽呪槄=========
- this.dicDeviceModelIdEnum["MAC/GW-ZB.10"] = "3600-3600-60009";//zigbee绌鸿皟缃戝叧妯″潡
-
- //=========鈽呪槄涓户鍣ㄧ被(3900-3999)鈽呪槄=========
- this.dicDeviceModelIdEnum["MSR-ZB.10"] = "3900-3900-60006"; //zigbee涓户鍣�
-
- //=========鈽呪槄绌烘皵寮�鍏崇被(4100-4199)鈽呪槄=========
- this.dicDeviceModelIdEnum["MBCI01-ZB.10"] = "4100-4100-60001";//zigbee寰柇浜戞帶鍒跺櫒
-
- //=========鈽呪槄杞崲鍣ㄧ被(4200-4699)鈽呪槄=========
- this.dicDeviceModelIdEnum["MBUS/GW-ZB.10"] = "4200-4200-60008";//zigbee杞琤uspro鍗忚杞崲鍣�
- this.dicDeviceModelIdEnum["M485/GW-ZB.10"] = "4201-4200-60008";//zigbee杞�485鍗忚杞崲鍣�
-
-
+ var listText = this.GetDeviceNameFileContent();
+ foreach (var dataText in listText)
+ {
+ if (dataText == string.Empty || dataText.StartsWith(";") == true)
+ {
+ //杩欐槸娉ㄩ噴
+ continue;
+ }
+ string[] strArry1 = dataText.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries);
+ if (strArry1.Length != 2)
+ {
+ //闈炴硶璁剧疆
+ continue;
+ }
+ string[] strArry2 = strArry1[1].Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
+ if (strArry2.Length < 6)
+ {
+ //闈炴硶璁剧疆
+ continue;
+ }
+ var content = new DeviceNameContent();
+ content.ConcreteTypeValue = Convert.ToInt32(strArry2[0].Trim());
+ content.A瀹樻柟鍚嶅瓧 = strArry2[1].Trim();
+ content.A澶囨敞鍚嶅瓧 = strArry2[2].Trim();
+ content.BeloneTypeValue= Convert.ToInt32(strArry2[3].Trim());
+ content.A鎵�灞炲悕瀛� = strArry2[4].Trim();
+ content.A绫诲瀷鍚嶅瓧 = strArry2[5].Trim();
+ this.dicDeviceModelIdEnum[strArry1[0].Trim()] = content;
+ }
//鉁┾湬鉁┾湬鉁╅渶瑕佷氦鎹㈢殑妯″潡ID鉁┾湬鉁┾湬鉁�
this.dicDeviceModelIdChanged = new Dictionary<string, string>();
@@ -3196,8 +3157,6 @@
this.dicDeviceModelIdChanged["MULTI-MOTI--EA04"] = "MSPIR01/M-ZB.10";//绾㈠浼犳劅鍣�
this.dicDeviceModelIdChanged["MULTI-WATE--EA02"] = "MSW01/M-ZB.10";//姘存蹈浼犳劅鍣�
this.dicDeviceModelIdChanged["MULTI-BURO--EA06"] = "MBU01/M-ZB.10";//绱ф�ユ寜閿�
-
-
//鉁┾湬鉁┾湬鉁╅渶瑕佸叡鏈夌殑鍥剧墖瀵硅薄鉁┾湬鉁┾湬鉁�
//涓よ�呴兘鏄疍eviceConcreteType
@@ -3210,19 +3169,64 @@
this.dicPictrueShard["Relay_FangyueFreshAirModul"] = "Relay_ThreeLoad";//鏂规偊鏂伴灏忔ā鍧楀浘鐗� 娌跨敤 3璺户鐢靛櫒鐨勫浘鏍�
}
- #endregion
+ /// <summary>
+ /// 鑾峰彇璁惧鍚嶅瓧鏂囦欢鐨勫唴瀹�
+ /// </summary>
+ /// <returns></returns>
+ private List<string> GetDeviceNameFileContent()
+ {
+ System.IO.StreamReader streamReader = null;
+ var listText = new List<string>();
+ try
+ {
+#if iOS
+ string textFile = Foundation.NSBundle.MainBundle.PathForResource("DeviceName.ini", null);
+ streamReader = new System.IO.StreamReader(textFile, Encoding.UTF8);
+ string text;
+ while ((text = streamReader.ReadLine()) != null)
+ {
+ listText.Add(text.Trim());
+ }
+ return listText;
+#endif
+#if Android
+ var stream = Application.Activity.Assets.Open("DeviceName.ini");
+ streamReader = new System.IO.StreamReader(stream, Encoding.UTF8);
+ string text;
+ while ((text = streamReader.ReadLine()) != null)
+ {
+ listText.Add(text.Trim());
+ }
+ stream.Close();
+ return listText;
+#endif
+ }
+ catch
+ {
+ return listText;
+ }
+ finally
+ {
+ try
+ {
+ streamReader?.Close();
+ }
+ catch
+ {
+ }
+ }
+ }
+
+#endregion
}
- #region 鈻� 鑷畾涔夎澶囩被鍨媉________________________
+#region 鈻� 鑷畾涔夎澶囩被鍨媉________________________
/// <summary>
- /// <para>浠呴檺搴曞眰浣跨敤锛氳澶囩殑鍏蜂綋銆愯澶囩被鍨嬨��,鑷畾涔変笌妯″潡id鍏宠仈鐨勬灇涓�(鍊间负LocalDevice閲岄潰dicDeviceModelIdEnum鎵�鎸囧畾鐨凞eviceConcreteType鍊�)</para>
- /// <para>鍙橀噺鍚嶅彲浠ヤ綔涓恒�愯澶囩被鍨嬨�戝浘鐗�,杩欎釜鍊兼槸鐬庡啓鐨�,娌′粈涔堢壒娈婃剰涔�</para>
+ /// <para>璁惧鐨勫叿浣撱�愯澶囩被鍨嬨��,鍙橀噺鍚嶅彲浠ヤ綔涓恒�愯澶囩被鍨嬨�戝浘鐗�,杩欎釜鍊兼槸鐬庡啓鐨�,娌′粈涔堢壒娈婃剰涔�</para>
/// </summary>
public enum DeviceConcreteType
{
- //瀹氫箟瑙勫垯锛氥�愯澶囩被鍨嬨�戝浘鐗囧悕瀛�=LocalDevice閲岄潰dicDeviceModelIdEnum鎵�鎸囧畾鐨凞eviceConcreteType鍊�
-
/// <summary>
/// 鏈煡璁惧
/// </summary>
@@ -3501,8 +3505,7 @@
}
/// <summary>
- /// <para>浠呴檺搴曞眰浣跨敤锛氳澶囨墍灞炵殑銆愯澶囩绫汇��,鑷畾涔変笌妯″潡id鍏宠仈鐨勬灇涓�(鍊间负LocalDevice閲岄潰dicDeviceModelIdEnum鎵�鎸囧畾鐨凞eviceBeloneType鍊�)</para>
- /// <para>杩欎釜鍊兼槸鐬庡啓鐨�,娌′粈涔堢壒娈婃剰涔�</para>
+ /// <para>璁惧鎵�灞炴灇涓�,杩欎釜鍊兼槸鐬庡啓鐨�,娌′粈涔堢壒娈婃剰涔�</para>
/// </summary>
public enum DeviceBeloneType
{
@@ -3592,5 +3595,5 @@
A骞叉帴鐐� = 16,
}
- #endregion
+#endregion
}
--
Gitblit v1.8.0