From c1d681f496f2e1c53f88472d803e3c95fab521af Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期四, 29 七月 2021 09:46:16 +0800
Subject: [PATCH] 萤石测试通过
---
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 86 ++++++++++++++++++++++++++++--------------
1 files changed, 57 insertions(+), 29 deletions(-)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index eb9d557..443542a 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -8,6 +8,22 @@
public class LogicMethod
{
+
+ private static LogicMethod logicMethod = null;
+
+ public static LogicMethod CurrLogicMethod
+ {
+ get
+ {
+ if (logicMethod == null)
+ {
+ return new LogicMethod();
+ }
+ return logicMethod;
+ }
+
+ }
+
/// <summary>
/// 琛ㄧず鏄潯浠�
/// </summary>
@@ -19,15 +35,15 @@
/// <summary>
/// 绉婚櫎鎵�鏈�"Logic"鐣岄潰
/// </summary>
- public static void RemoveAllView()
+ public void RemoveAllView()
{
MainPage.BasePageView.RemoveViewByTag("Logic");
}
-
+
/// <summary> Converts an array of bytes into a formatted string of hex digits (ex: E4 CA B2)</summary>
/// <param name="data"> The array of bytes to be translated into a string of hex digits. </param>
/// <returns> Returns a well formatted string of hex digits with spacing. </returns>
- static string byteArrayToHexString(byte[] data)
+ public string byteArrayToHexString(byte[] data)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach (byte b in data)
@@ -46,7 +62,7 @@
* @param i 涓�涓猧nt鏁板瓧
* @return byte[]
*/
- public static byte[] int2ByteArray(int i)
+ public byte[] int2ByteArray(int i)
{
byte[] result = new byte[4];
result[0] = (byte)((i >> 24) & 0xFF);
@@ -59,7 +75,7 @@
/// 鑾峰彇鏃堕棿鎴�
/// </summary>
/// <returns></returns>
- static int getTimeStamp()
+ public int getTimeStamp()
{
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
return (int)ts.TotalSeconds;
@@ -67,7 +83,7 @@
/// <summary>
/// 鐢熸垚閫昏緫sid鏂规硶
/// </summary>
- public static string NewSid()
+ public string NewSid()
{
string logicId = "";
try
@@ -111,7 +127,7 @@
/// <param name="dic">Dictionary绫�</param>
/// <param name="key">鍋�</param>
/// <param name="value">鍊�</param>
- public static void dictionary(Dictionary<string, string> dic, string key, string value)
+ public void dictionary(Dictionary<string, string> dic, string key, string value)
{
if (dic.ContainsKey(key)) //鍒ゆ柇鏄惁瀛樺湪閿��
{
@@ -125,7 +141,7 @@
/// 鑾峰彇缃戝叧鎴块棿鍒楄〃
/// </summary>
/// <returns></returns>
- public static List<HDL_ON.Entity.Room> GetGatewayRoomList()
+ public List<HDL_ON.Entity.Room> GetGatewayRoomList()
{
return HDL_ON.Entity.SpatialInfo.CurrentSpatial.RoomList;
}
@@ -133,7 +149,7 @@
/// 鑾峰彇缃戝叧鎴块棿鍒楄〃
/// </summary>
/// <returns></returns>
- public static List<HDL_ON.Entity.Room> GetGatewayRoomList(string name)
+ public List<HDL_ON.Entity.Room> GetGatewayRoomList(string name)
{
List<Entity.Room> roomList = new List<Entity.Room>();
Entity.Room room1 = new Entity.Room();
@@ -158,7 +174,7 @@
/// 鑾峰彇缃戝叧璁惧鍒楄〃
/// </summary>
/// <returns></returns>
- public static List<HDL_ON.Entity.Function> GetGatewayDeviceList()
+ public List<HDL_ON.Entity.Function> GetGatewayDeviceList()
{
return Entity.FunctionList.List.GetDeviceFunctionList();
}
@@ -166,7 +182,7 @@
/// 鑾峰彇缃戝叧鍦烘櫙鍒楄〃
/// </summary>
/// <returns></returns>
- public static List<HDL_ON.Entity.Scene> GetSceneList()
+ public List<HDL_ON.Entity.Scene> GetSceneList()
{
return HDL_ON.Entity.FunctionList.List.scenes;
}
@@ -175,7 +191,7 @@
/// </summary>
/// <param name="room">褰撳墠鎴块棿</param>
/// <returns></returns>
- public static List<HDL_ON.Entity.Function> GetRoomDevice(HDL_ON.Entity.Room room)
+ public List<HDL_ON.Entity.Function> GetRoomDevice(HDL_ON.Entity.Room room)
{
List<HDL_ON.Entity.Function> deviceLists = new List<Entity.Function>();
List<HDL_ON.Entity.Function> lists = GetGatewayDeviceList();
@@ -205,7 +221,7 @@
/// </summary>
/// <param name="sid">璁惧鍞竴鏍囪瘑</param>
/// <returns></returns>
- public static HDL_ON.Entity.Function GetDevice(string sid)
+ public HDL_ON.Entity.Function GetDevice(string sid)
{
HDL_ON.Entity.Function device = new Entity.Function() { name = "Unknown" };
List<HDL_ON.Entity.Function> deviceLists = GetGatewayDeviceList();
@@ -226,7 +242,7 @@
/// </summary>
/// <param name="sid">鍦烘櫙鍞竴鏍囪瘑</param>
/// <returns></returns>
- public static HDL_ON.Entity.Scene GetSecne(string sid)
+ public HDL_ON.Entity.Scene GetSecne(string sid)
{
HDL_ON.Entity.Scene scene = new Entity.Scene() { name = "Unknown" };
List<HDL_ON.Entity.Scene> sceneLists = GetSceneList();
@@ -246,7 +262,7 @@
/// </summary>
/// <param name="device">璁惧</param>
/// <returns></returns>
- public static string GetGetRoomName(HDL_ON.Entity.Function device)
+ public string GetGetRoomName(HDL_ON.Entity.Function device)
{
string roomName = "";
List<HDL_ON.Entity.Room> roomLists = GetGatewayRoomList();
@@ -268,7 +284,7 @@
/// </summary>
/// <param name="functionType">璁惧绫诲瀷</param>
/// <returns></returns>
- public static string GetIconPath(string functionType)
+ public string GetIconPath(string functionType)
{
string strPath = "";
switch (functionType)
@@ -307,7 +323,9 @@
case SPK.SensorDuiShe:
case SPK.SensorPir:
case SPK.SensorDoorWindow:
- case SPK.SensoruUtrasonic:
+ case SPK.SensorUtrasonic:
+ case SPK.SenesorMegahealth:
+ case SPK.SensorEnvironment:
{
strPath = "LogicIcon/sensor.png";
}
@@ -321,7 +339,7 @@
/// </summary>
/// <param name="deviceList">璁惧鍒楄〃</param>
/// <returns></returns>
- public static List<string> GetDeviceTypeList(List<HDL_ON.Entity.Function> deviceList)
+ public List<string> GetDeviceTypeList(List<HDL_ON.Entity.Function> deviceList)
{
List<string> deviceStrTypeList = new List<string>();
deviceStrTypeList.Clear();
@@ -364,7 +382,9 @@
|| device.spk == SPK.SensorDuiShe
|| device.spk == SPK.SensorPir
|| device.spk == SPK.SensorDoorWindow
- || device.spk == SPK.SensoruUtrasonic
+ || device.spk == SPK.SensorUtrasonic
+ || device.spk == SPK.SenesorMegahealth
+ || device.spk == SPK.SensorEnvironment
);
if (sensor != null)
{
@@ -378,7 +398,7 @@
/// </summary>
/// <param name="deviceType">璁惧绫诲瀷(鐏厜绫伙紝绐楀笜绫汇��)</param>
/// <returns></returns>
- public static List<string> GetDeviceTypeFunctionList(string deviceType)
+ public List<string> GetDeviceTypeFunctionList(string deviceType)
{
List<string> functionTypeList = new List<string>();
if (deviceType == Language.StringByID(StringId.Lights))
@@ -413,8 +433,11 @@
functionTypeList.Add(SPK.SensorDuiShe);
functionTypeList.Add(SPK.SensorPir);
functionTypeList.Add(SPK.SensorDoorWindow);
- functionTypeList.Add(SPK.SensoruUtrasonic);
-
+ functionTypeList.Add(SPK.SensorUtrasonic);
+ functionTypeList.Add(SPK.SenesorMegahealth);
+ functionTypeList.Add(SPK.SensorEnvironment);
+
+
}
return functionTypeList;
@@ -423,7 +446,7 @@
/// 鏉′欢/鐩爣鏀寔璁惧
/// </summary>
/// <returns></returns>
- public static List<string> GetSupportEquipment(string if_type)
+ public List<string> GetSupportEquipment(string if_type)
{
List<string> deviceTypeList = new List<string>();
switch (if_type)
@@ -448,7 +471,10 @@
deviceTypeList.Add(SPK.SensorDuiShe);
deviceTypeList.Add(SPK.SensorPir);
deviceTypeList.Add(SPK.SensorDoorWindow);
- deviceTypeList.Add(SPK.SensoruUtrasonic);
+ deviceTypeList.Add(SPK.SensorUtrasonic);
+ deviceTypeList.Add(SPK.SenesorMegahealth);
+ deviceTypeList.Add(SPK.SensorEnvironment);
+
}
break;
case target_if:
@@ -475,7 +501,7 @@
/// <param name="functionType">婧愭暟鎹垪琛�1</param>
/// <param name="deviceList">婧愭暟鎹垪琛�2</param>
/// <returns></returns>
- public static List<Entity.Function> GetShowDeviceList(List<string> functionType, List<HDL_ON.Entity.Function> deviceList)
+ public List<Entity.Function> GetShowDeviceList(List<string> functionType, List<HDL_ON.Entity.Function> deviceList)
{
List<HDL_ON.Entity.Function> devList = new List<Entity.Function>();
for (int i = 0; i < deviceList.Count; i++)
@@ -497,7 +523,7 @@
/// <param name="room">褰撳墠鎴块棿</param>
/// <param name="str">鍒ゆ柇绗︼紙琛ㄧず=杈撳叆璁惧鍜岃緭鍑鸿澶囷級</param>
/// <returns></returns>
- public static List<Entity.Function> GetFunctionDeviceList(Entity.Room room, string str)
+ public List<Entity.Function> GetFunctionDeviceList(Entity.Room room, string str)
{
List<string> functionTypeList = GetSupportEquipment(str);
//杩斿洖鎴块棿璁惧鍒楄〃
@@ -509,7 +535,7 @@
/// <summary>
/// 缃戝叧ID(鑾峰彇鍢変箰缃戝叧ID)
/// </summary>
- public static string GatewayId
+ public string GatewayId
{
get
{
@@ -523,7 +549,7 @@
/// <summary>
/// 浣忓畢ID
/// </summary>
- public static string HomeId
+ public string HomeId
{
get
{
@@ -533,12 +559,14 @@
/// <summary>
/// 鏄惁涓哄叾浠栦富鐢ㄦ埛鍒嗕韩杩囨潵鐨勪綇瀹�
/// </summary>
- public static bool IsOthreShare
+ public bool IsOthreShare
{
get
{
return Entity.DB_ResidenceData.Instance.CurrentRegion.isOtherShare;
}
}
+
+
}
}
--
Gitblit v1.8.0