From e0c7b6da754b12e0468203d972fed4591464a205 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 02 三月 2021 13:21:38 +0800
Subject: [PATCH] 2021-03-02 1.提交
---
HDL_ON/Entity/Function/Function.cs | 288 +++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 248 insertions(+), 40 deletions(-)
diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index 58b7d98..59a077a 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,23 @@
/// attri
/// </summary>
public List<FunctionAttributes> attributes = new List<FunctionAttributes>();
+ /// <summary>
+ /// 鍔熻兘鐘舵�佸垪琛�
+ /// </summary>
+ public List<AttributesStatus> status = new List<AttributesStatus>();
+ /// <summary>
+ /// 鑾峰彇鐘舵�佸��
+ /// </summary>
+ /// <returns></returns>
+ public string GetStatusValus(string key)
+ {
+ var d = status.Find((obj) => obj.key == key);
+ if(d==null)
+ {
+ return null;
+ }
+ return d.value;
+ }
/// <summary>
/// 鎴块棿ID鍒楄〃
@@ -178,16 +238,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 +355,7 @@
}
roomNameList += findRoom.floorName +"-"+ findRoom.roomName;
}
- if (roomNameList == "" && functionType == FunctionType.Scene)
+ if (roomNameList == "" )
{
roomNameList = Language.StringByID(StringId.WholeZone);
}
@@ -481,7 +537,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 +559,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 +585,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 +616,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,13 +666,26 @@
/// 褰撳墠鍊�
/// </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>
/// 鍔熻兘灞炴�ч敭鍚嶅垪琛�
/// </summary>
public static class FunctionAttributeKey
{
+ public const string _null = "";
/// <summary>
/// 寮�鍏�
/// </summary>
@@ -665,6 +734,17 @@
/// value
/// </summary>
public const string Value = "value";
+ /// <summary>
+ /// 鐘舵��,浼犳劅鍣�
+ /// </summary>
+ public const string Status = "status";
+
+ #region tuya
+ /// <summary>
+ /// 娑傞甫姘撮榾寮�鍚椂闂�
+ /// </summary>
+ public const string TuyaWaterTime = "countdown_1";
+ #endregion
}
/// <summary>
/// 璁惧鍔熻兘oid
@@ -798,10 +878,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 +919,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