From 1a0a7f736c6d2e7129e7591d40bed67ec7c0f09a Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期五, 05 二月 2021 10:47:42 +0800 Subject: [PATCH] 2021-02-05 1.编译冲突修改 --- HDL_ON/Entity/Function/Function.cs | 263 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 223 insertions(+), 40 deletions(-) diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 58b7d98..772be78 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -1,4 +1,4 @@ -using System; +锘縰sing System; using System.Collections.Generic; using HDL_ON.Common; using HDL_ON.DAL.Server; @@ -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鍗忚鍔熻兘鐨勭壒鎬� @@ -110,6 +153,10 @@ /// attri /// </summary> public List<FunctionAttributes> attributes = new List<FunctionAttributes>(); + /// <summary> + /// 鍔熻兘鐘舵�佸垪琛� + /// </summary> + public List<AttributesStatus> status = new List<AttributesStatus>(); /// <summary> /// 鎴块棿ID鍒楄〃 @@ -178,16 +225,12 @@ _trait_on_off.curValue = "off"; } } - if(_trait_on_off.curValue.ToString() != "on"&& _trait_on_off.curValue.ToString() != "off") + if(_trait_on_off.curValue.ToString() != "on"&& _trait_on_off.curValue.ToString() != "off" && _trait_on_off.curValue.ToString() != "stop") { _trait_on_off.curValue = "off"; } return _trait_on_off; } - //set - //{ - // _trait_on_off = value; - //} } /// <summary> @@ -299,7 +342,7 @@ } roomNameList += findRoom.floorName +"-"+ findRoom.roomName; } - if (roomNameList == "" && functionType == FunctionType.Scene) + if (roomNameList == "" ) { roomNameList = Language.StringByID(StringId.WholeZone); } @@ -481,7 +524,7 @@ acd.sid = sid; foreach (var dic in commandDictionary) { - var aca = new AlinkControlAttributes(); + var aca = new AttributesStatus(); aca.key = dic.Key; aca.value = dic.Value; acd.status.Add(aca); @@ -503,7 +546,7 @@ aaao.bus = this.bus; foreach (var kv in keyValues) { - aaao.attributes.Add(new AlinkControlAttributes() + aaao.attributes.Add(new AttributesStatus() { key = kv.Key, value = kv.Value, @@ -529,7 +572,7 @@ /// </summary> public string spk = ""; - public List<AlinkControlAttributes> attributes = new List<AlinkControlAttributes>(); + public List<AttributesStatus> attributes = new List<AttributesStatus>(); //[Newtonsoft.Json.JsonIgnore] public BusData bus = new BusData(); } @@ -560,12 +603,12 @@ public class AlinkControlData { public string sid = ""; - public List<AlinkControlAttributes> status = new List<AlinkControlAttributes>(); + public List<AttributesStatus> status = new List<AttributesStatus>(); } /// <summary> /// a鍗忚鎺у埗鍔ㄤ綔鏁版嵁 /// </summary> - public class AlinkControlAttributes + public class AttributesStatus { /// <summary> /// 灞炴�у悕 @@ -610,7 +653,19 @@ /// 褰撳墠鍊� /// </summary> public object curValue = new object(); - + ///// <summary> + ///// curValue鐨勭炕璇戝��,鏈�鍧忕殑缁撴灉涔熷彧浼氳繑鍥瀞tring.Empty + ///// </summary> + //public string realValue + //{ + // get + // { + // var myValue = curValue.ToString(); + // //娌欓洉瀹氫箟鐨刼bject绫诲瀷 + // if (myValue.Contains("{") == true) { return string.Empty; } + // return myValue; + // } + //} } /// <summary> /// 鍔熻兘灞炴�ч敭鍚嶅垪琛� @@ -798,10 +853,36 @@ /// 婀垮害浼犳劅鍣� /// </summary> public const string SensorHumidity = "sensor.humidity"; + + /// <summary> + /// 鐑熼浘浼犳劅鍣� + /// </summary> + public const string SensorSmoke = "sensor.smoke"; + /// <summary> + /// 姘存蹈浼犳劅鍣� + /// </summary> + public const string SensorWater = "sensor.water"; + /// <summary> + /// 鐕冩皵浼犳劅鍣� + /// </summary> + public const string SensorGas= "sensor.gas"; + /// <summary> + /// 绾㈠鐝婃爮浼犳劅鍣� + /// </summary> + public const string SensorShanLan = "sensor.shanlan"; + /// <summary> + /// 绾㈠瀵瑰皠浼犳劅鍣� + /// </summary> + public const string SensorDuiShe = "sensor.duishe"; + /// <summary> + /// 瓒呭0娉紶鎰熷櫒 + /// </summary> + public const string SensoruUtrasonic = "sensor.ultrasonic"; + /// <summary> /// 锛堝共鎺ョ偣锛� /// </summary> - public const string DryContact = "dryContact.standard"; + public const string SensorDryContact = "sensor.dryContact"; /// <summary> /// 瀹剁數銆佹彃搴� /// </summary> @@ -813,7 +894,109 @@ /// <summary> /// 瀹剁數銆侀鎵� /// </summary> - public const string ElectricFan = "electrical.fan"; + public const string ElectricFan = "electrical.fan"; + /// <summary> + /// 瀹剁數銆佹秱楦︾┖姘斿噣鍖栧櫒 + /// </summary> + public const string ElectricTuyaAirCleaner = "electrical.Q1RsefNf91tIXyyQ"; + /// <summary> + /// 瀹剁數銆佹秱楦︾數椋庢墖 + /// </summary> + public const string ElectricTuyaFan = "electrical.tyqborgovyzytytz"; + /// <summary> + /// 瀹剁數銆佹秱楦︽壂鍦版満鍣ㄤ汉 + /// </summary> + public const string ElectricTuyaWeepRobot = "electrical.ai6HtccKFIw3dxo3"; + /// <summary> + /// 瀹剁數銆佹秱楦︽按闃� + /// </summary> + public const string ElectricTuyaWaterValve = "electrical.koiGhMKwLf2ZP81g"; + + + /// <summary> + /// 鑾峰彇绗笁鏂硅澶噑pk + /// </summary> + /// <returns></returns> + public static List<string> Get3tySpk(BrandType brandType) + { + var list = new List<string>(); + + switch (brandType) + { + case BrandType.All3tyBrand: + case BrandType.Tuya: + list.Add(ElectricTuyaAirCleaner); + list.Add(ElectricTuyaFan); + list.Add(ElectricTuyaWaterValve); + list.Add(ElectricTuyaWeepRobot); + break; + } + return list; + } + + /// <summary> + /// 绗笁鏂瑰搧鐗屽垪琛� + /// </summary> + public enum BrandType + { + All = 0, + Hdl = 1, + Tuya = 2, + + + All3tyBrand = 999, + } + + } + + /// <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