From 330e3ae4cdd1e9facb14b6ea2b3e609166c04fd3 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 12 一月 2021 16:00:27 +0800 Subject: [PATCH] 2021-1-12-1 --- HDL_ON/Entity/Function/Function.cs | 179 +++++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 135 insertions(+), 44 deletions(-) diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 26c6ff3..7b241c6 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -35,25 +35,25 @@ #region base info /// <summary> - /// HDL缁熶竴鍗忚鏍煎紡锛�14bytes - /// 涓句緥锛� 鏉ユ簮 鍘傚晢浠g爜 閫氳鏂瑰紡 浜у搧鏃堕棿鎴� 浜у搧绫诲埆 鐗╂ā鍨嬬被 閫氶亾鍙� 澶у皬绫诲埆 + /// HDL缁熶竴鍗忚鏍煎紡锛�14bytes + /// 涓句緥锛� 鏉ユ簮 鍘傚晢浠g爜 閫氳鏂瑰紡 浜у搧鏃堕棿鎴� 浜у搧绫诲埆 鐗╂ā鍨嬬被 閫氶亾鍙� 澶у皬绫诲埆 /// 1byte 1byte 1byte 4byte 1byte 2byte 2byte 2byte - /// 鏉ユ簮锛�00 榛樿鍘熺敓鎬佺郴缁熸暟鎹� 銆�01 缃戝叧鎴栬�呭叾浠朅璁惧銆�02 璋冭瘯杞欢銆�03 APP搴旂敤绋嬪簭銆�04 绗笁鏂圭綉鍏虫垨鑰呭钩鍙� - /// 鍘傚晢浠g爜锛�01 HDL + /// 鏉ユ簮锛�00 榛樿鍘熺敓鎬佺郴缁熸暟鎹� 銆�01 缃戝叧鎴栬�呭叾浠朅璁惧銆�02 璋冭瘯杞欢銆�03 APP搴旂敤绋嬪簭銆�04 绗笁鏂圭綉鍏虫垨鑰呭钩鍙� + /// 鍘傚晢浠g爜锛�01 HDL /// 閫氳鏂瑰紡锛�01 HDL Bus銆�02 Zigbee銆�03 KNX銆�04 Z-Wave - /// 浜у搧鏃堕棿鎴筹細4bytes 浠�2020骞�1鏈�1鏃ョ畻鍑虹殑鏃堕棿鎴�0.1s涓哄崟浣� - /// 浜у搧绫诲埆锛�01 璋冨厜鍣ㄣ��02 缁х數鍣ㄣ��03 骞叉帴鐐规ā鍧椼��04 浼犳劅鍣ㄣ��05 闈㈡澘 - /// 鐗╂ā鍨嬬被鍨嬶細 - /// 01 寮�鍏崇被锛�01 寮�鍏炽��02 鎻掑骇銆�03 - /// 02 鐓ф槑锛� 01 寮�鍏炽��02 璋冨厜銆�03 鑹叉俯銆�04 LED - /// 03 閬槼锛� 01 绐楀笜鐢垫満銆�02 鐧惧彾绐椼��03 寮�鍚堝笜銆�04 鍗峰笜 + /// 浜у搧鏃堕棿鎴筹細4bytes 浠�2020骞�1鏈�1鏃ョ畻鍑虹殑鏃堕棿鎴�0.1s涓哄崟浣� + /// 浜у搧绫诲埆锛�01 璋冨厜鍣ㄣ��02 缁х數鍣ㄣ��03 骞叉帴鐐规ā鍧椼��04 浼犳劅鍣ㄣ��05 闈㈡澘 + /// 鐗╂ā鍨嬬被鍨嬶細 + /// 01 寮�鍏崇被锛�01 寮�鍏炽��02 鎻掑骇銆�03 + /// 02 鐓ф槑锛� 01 寮�鍏炽��02 璋冨厜銆�03 鑹叉俯銆�04 LED + /// 03 閬槼锛� 01 绐楀笜鐢垫満銆�02 鐧惧彾绐椼��03 寮�鍚堝笜銆�04 鍗峰笜 /// 04 鎭掓俯鍣細01 绌鸿皟銆�02 鍦版殩銆�03 姣涚粏绌鸿皟 /// 05 鏂伴 /// 06 褰遍煶 /// 07 闊充箰 /// 08 鑳芥簮 /// 09 瀹夐槻 - /// 澶х被鍒� 1bytes 锛堥鐣欙級 + /// 澶х被鍒� 1bytes 锛堥鐣欙級 /// 灏忕被鍒� 1byte 锛堥鐣欙級 /// </summary> public string sid = "0301011234567801012301230123"; @@ -70,39 +70,82 @@ /// 璁惧spk /// </summary> public string spk = ""; - /// <summary> - /// 鍔熻兘绫诲埆 - /// 濡傦細绌鸿皟绫汇�佺伅鍏夌被銆佺獥甯樼被 - /// </summary> - public FunctionCategory functionCategory - { - get - { - try - { - var _functionCategoryString = sid.Substring(16, 2); - var _functionCategory = Convert.ToInt32(_functionCategoryString, 16); - return (FunctionCategory)Enum.ToObject(typeof(FunctionCategory), _functionCategory); - } - catch (Exception ex) - { - MainPage.Log($"get FunctionCategory error : {ex.Message}"); - return FunctionCategory.UnKown; - } - } - } + ///// <summary> + ///// 鍔熻兘绫诲埆 + ///// 濡傦細绌鸿皟绫汇�佺伅鍏夌被銆佺獥甯樼被 + ///// </summary> + //public FunctionCategory Spk_Prefix + //{ + // get + // { + // try + // { + // var _functionCategoryString = sid.Substring(16, 2); + // var _functionCategory = Convert.ToInt32(_functionCategoryString, 16); + // return (FunctionCategory)Enum.ToObject(typeof(FunctionCategory), _functionCategory); + // } + // catch (Exception ex) + // { + // MainPage.Log($"get FunctionCategory error : {ex.Message}"); + // return FunctionCategory.UnKown; + // } + // } + //} + ///// <summary> ///// 鍔熻兘绫诲瀷 ///// </summary> - public FunctionType functionType + //public FunctionType spk + //{ + // get + // { + // var _functionTypeString = sid.Substring(16, 4); + // return (FunctionType)Enum.ToObject(typeof(FunctionType), Convert.ToInt32(_functionTypeString, 16)); + // } + //} + + string spk_Prefix; + /// <summary> + /// spk鍓嶇紑 + /// 澶х被 + /// 鍔熻兘绫诲埆 + /// 濡傦細绌鸿皟绫汇�佺伅鍏夌被銆佺獥甯樼被 + /// </summary> + public string Spk_Prefix { get { - var _functionTypeString = sid.Substring(16, 4); - return (FunctionType)Enum.ToObject(typeof(FunctionType), Convert.ToInt32(_functionTypeString, 16)); - + if (string.IsNullOrEmpty(spk_Prefix)) + { + spk_Prefix = spk.Split(".")[0]; + } + return spk_Prefix; } } + string spk_Suffix; + ///// <summary> + ///// spk鍚庣紑 + ///// 灏忕被 + ///// 鍔熻兘绫诲瀷 + ///// </summary> + //public string spk + //{ + // get + // { + // if (string.IsNullOrEmpty(spk_Suffix)) + // { + // try + // { + // spk_Suffix = spk.Split(".")[1]; + // } + // catch + // { + // spk_Suffix = ""; + // } + // } + // return spk_Suffix; + // } + //} /// <summary> /// A鍗忚鍔熻兘鐨勭壒鎬� @@ -299,7 +342,7 @@ } roomNameList += findRoom.floorName +"-"+ findRoom.roomName; } - if (roomNameList == "" && functionType == FunctionType.Scene) + if (roomNameList == "" ) { roomNameList = Language.StringByID(StringId.WholeZone); } @@ -780,11 +823,11 @@ public const string SensorPir = "sensor.pir"; /// <summary> /// 锛堥棬绐椾紶鎰熷櫒锛� - /// </summary> + /// </summary> public const string SensorDoorWindow = "sensor.doorwindow"; /// <summary> /// 锛圥M2.5浼犳劅鍣級 - /// </summary> + /// </summary> public const string SensorPm25 = "sensor.pm25"; /// <summary> /// co2浼犳劅鍣� @@ -800,20 +843,68 @@ public const string SensorHumidity = "sensor.humidity"; /// <summary> /// 锛堝共鎺ョ偣锛� - /// </summary> - public const string DryContact = "dryContact.standard"; + /// </summary> + public const string DryContact = "dryContact.standard"; /// <summary> /// 瀹剁數銆佹彃搴� /// </summary> - public const string ElectricSocket = "electrical.socket"; + public const string ElectricSocket = "electrical.socket"; /// <summary> /// 瀹剁數銆佺數瑙� /// </summary> - public const string ElectricTV = "electrical.tv"; + public const string ElectricTV = "electrical.tv"; /// <summary> /// 瀹剁數銆侀鎵� /// </summary> public const string ElectricFan = "electrical.fan"; + } -} \ No newline at end of file + + /// <summary> + /// 鍔熻兘绫诲埆 + /// </summary> + public static class FunctionCategory + { + /// <summary> + ///锛堢伅锛� + /// </summary> + public const string Light = "light"; + /// <summary> + /// 锛堢獥甯橈級 + /// </summary> + public const string Curtain = "curtain"; + /// <summary> + /// 锛堢┖璋冿級 + /// </summary> + public const string AC = "ac"; + /// <summary> + /// 锛堝湴鐑級 + /// </summary> + public const string FloorHeat = "floorHeat"; + /// <summary> + /// 锛堟柊椋庯級 + /// </summary> + public const string AirFresh = "airFresh"; + /// <summary> + /// 锛堥煶涔愶級 + /// </summary> + public const string Music = "music"; + /// <summary> + /// 锛堜紶鎰熷櫒锛� + /// </summary> + public const string Sensor = "sensor"; + /// <summary> + /// 锛堝共鎺ョ偣锛� + /// </summary> + public const string DryContact = "dryContact"; + /// <summary> + /// 瀹剁數 + /// </summary> + public const string Electric = "electrical"; + + //Music = 0x09, + } + + +} -- Gitblit v1.8.0