From ea0b1e8e5f43c5fd0a7d479e25ede3b8cbea464a Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期一, 02 十二月 2024 17:17:19 +0800
Subject: [PATCH] tcp;可视对讲;
---
HDL_ON/Entity/Function/Function.cs | 231 ++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 186 insertions(+), 45 deletions(-)
diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index e8a5b40..edcda72 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -76,7 +76,8 @@
DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 褰撳湴鏃跺尯
return startTime.AddMilliseconds(Convert.ToDouble(time_stamp)).ToString("s");
}
- catch {
+ catch
+ {
return DateTime.MinValue.ToString("s");
}
}
@@ -145,20 +146,34 @@
/// <summary>
/// 璁剧疆灞炴�х姸鎬�
/// </summary>
- /// <param name="key"></param>
- /// <param name="value"></param>
+ /// <param name="setKey"></param>
+ /// <param name="setValues"></param>
/// <returns>淇敼缁撴灉</returns>
- public bool SetAttrState(string key, object value)
+ public bool SetAttrState(string setKey, object setValues)
{
- var attr = attributes.Find((s) => s.key == key);
+ var attr = attributes.Find((s) => s.key == setKey);
if (attr == null)
{
+ switch (setKey)
+ {
+ case FunctionAttributeKey.CoolTemperatrue:
+ case FunctionAttributeKey.HeatTemperatrue:
+ case FunctionAttributeKey.AutoTemperatrue:
+ case FunctionAttributeKey.DehumiTemperatrue:
+ attributes.Add(new FunctionAttributes()
+ {
+ key = setKey,
+ state = setValues.ToString(),
+ curValue = setValues.ToString(),
+ });
+ return true;
+ }
return false;
}
else
{
- attr.state = value.ToString();
- attr.curValue = value.ToString();
+ attr.state = setValues.ToString();
+ attr.curValue = setValues.ToString();
}
return true;
}
@@ -199,12 +214,14 @@
iconPath = "airFreshjinmao";
break;
case SPK.HvacAC:
+ case SPK.HvacAcPanel:
iconPath = "acstandard";
break;
case SPK.HvacFan:
iconPath = "electricalfan";
break;
case SPK.HvacFloorHeat:
+ case SPK.HvacFloorHeatPanel:
iconPath = "floorHeatstandard";
break;
case SPK.ElectricTuyaFan2:
@@ -248,7 +265,6 @@
[Newtonsoft.Json.JsonIgnore]
public Dictionary<string, byte> Fh_Mode_Temp = new Dictionary<string, byte>();
#endregion
-
#region base info
public string sid = "0301011234567801012301230123";
@@ -296,6 +312,11 @@
/// 璁惧spk
/// </summary>
public string spk = "";
+ /// <summary>
+ /// 鎵╁睍淇℃伅
+ /// 瀛楃涓�
+ /// </summary>
+ public string extend = "";
private string _SpkCategory = string.Empty;
/// <summary>
@@ -455,10 +476,11 @@
public bool collect = false;
private bool _online;
- public bool online {
+ public bool online
+ {
get
{
- if (spk == SPK.AirSwitchP3|| spk == SPK.ElectricalTvHisense)
+ if (spk == SPK.AirSwitchP3 || spk == SPK.ElectricalTvHisense)
{
return _online;
}
@@ -522,10 +544,6 @@
#endregion
-
- //public void
-
-
/// <summary>
/// 寤舵椂
/// </summary>
@@ -556,7 +574,7 @@
}
break;
-
+
}
return text;
}
@@ -642,7 +660,8 @@
new System.Threading.Thread(() =>
{
- if (spk == SPK.GroupControl) {
+ if (spk == SPK.GroupControl)
+ {
var groupControl = FunctionList.List.groupControls.Find((obj) => obj.sid == sid);
if (collect)
{
@@ -664,21 +683,18 @@
result = ApiUtlis.Ins.HttpRequest.CancelCollectDevice(deviceId).Code;
}
}
- //鎻愮ず閿欒
if (result != StateCode.SUCCESS)
{
Application.RunOnMainThread(() =>
{
- collect = !collect;
IMessageCommon.Current.ShowErrorInfoAlter(result);
});
- } else
- {
- Application.RunOnMainThread(() =>
- {
- UI.HomePage.RefreshFunctionView();
- });
}
+ Application.RunOnMainThread(() =>
+ {
+ this.SaveFunctionFile();
+ UI.HomePage.RefreshFunctionView();
+ });
})
{ IsBackground = true }.Start();
}
@@ -773,7 +789,7 @@
/// </summary>
public async void UpdataRoomIds()
{
- new System.Threading.Thread( () =>
+ new System.Threading.Thread(() =>
{
var pack = ApiUtlis.Ins.HttpRequest.UpdataDevcieBindRoomInfo(this);
//鐩存帴淇濆瓨鏈湴锛�
@@ -913,12 +929,12 @@
foreach (var attr in list)
{
- if(attr.key == FunctionAttributeKey.ColorfulBegin || attr.key == FunctionAttributeKey.ColorfulEnd || attr.key == FunctionAttributeKey.ColorfulTime)
+ if (attr.key == FunctionAttributeKey.ColorfulBegin || attr.key == FunctionAttributeKey.ColorfulEnd || attr.key == FunctionAttributeKey.ColorfulTime)
{
continue;
}
//绐楀笜鍚屾椂鍙戦�佸紑鍏宠窡鐧惧垎姣斾細鏈夐棶棰橈紝
- if(spk == SPK.CurtainRoller || spk == SPK.CurtainTrietex || spk == SPK.CurtainDream)
+ if (spk == SPK.CurtainRoller || spk == SPK.CurtainTrietex || spk == SPK.CurtainDream)
{
if (attr.key == FunctionAttributeKey.OnOff)
{
@@ -927,7 +943,8 @@
continue;
}
}
- }else if (spk == SPK.GroupControl)
+ }
+ else if (spk == SPK.GroupControl)
{
sFunc.type = "5";
}
@@ -1029,7 +1046,7 @@
}
}
}
- else if(attr.key == "security")
+ else if (attr.key == "security")
{
attr.curValue = "false";
}
@@ -1046,15 +1063,25 @@
{
vv = 26;
}
- sFunc.status.Add(new SceneFunctionStatus() {
+ sFunc.status.Add(new SceneFunctionStatus()
+ {
UintString = attr.unit,
- key = attr.key, value = Convert.ToInt32(vv).ToString(), max = attr.max, min = attr.min }) ;
+ key = attr.key,
+ value = Convert.ToInt32(vv).ToString(),
+ max = attr.max,
+ min = attr.min
+ });
}
else
{
- sFunc.status.Add(new SceneFunctionStatus() {
+ sFunc.status.Add(new SceneFunctionStatus()
+ {
UintString = attr.unit,
- key = attr.key, value = attr.curValue.ToString(), max = attr.max, min = attr.min });
+ key = attr.key,
+ value = attr.curValue.ToString(),
+ max = attr.max,
+ min = attr.min
+ });
}
break;
}
@@ -1272,7 +1299,7 @@
/// <summary>
/// 灞炴�у崟浣�
/// </summary>
- public string unit=string.Empty;
+ public string unit = string.Empty;
}
/// <summary>
@@ -1280,7 +1307,45 @@
/// </summary>
public static class FunctionAttributeKey
{
+ #region 绌鸿皟bus灞炴��
+ /// <summary>
+ /// 鍒跺喎妯″紡娓╁害
+ /// </summary>
+ public const string CoolTemperatrue = "CoolTemperatrue";
+ /// <summary>
+ /// 鍒剁儹妯″紡娓╁害
+ /// </summary>
+ public const string HeatTemperatrue = "HeatTemperatrue";
+ /// <summary>
+ /// 鑷姩妯″紡娓╁害
+ /// </summary>
+ public const string AutoTemperatrue = "AutoTemperatrue";
+ /// <summary>
+ /// 闄ゆ箍妯″紡娓╁害
+ /// </summary>
+ public const string DehumiTemperatrue = "DehumiTemperatrue";
+ #endregion
+
+ #region 绌鸿皟bus灞炴��
+ /// <summary>
+ /// [4]鏅�氾細璁剧疆娓╁害(鎽勬皬0-100锛屽崕姘�32-212)/鍔熺巼鍊�(0-10) (1byte)
+ /// </summary>
+ public const string NormalTemperatrue = "NormalTemperatrue";
+ /// <summary>
+ /// [5]鐧藉ぉ锛氳缃俯搴�(鎽勬皬0-100锛屽崕姘�32-212)/鍔熺巼鍊�(0-10) (1byte)
+ /// </summary>
+ public const string DayTemperatrue = "DayTemperatrue";
+ /// <summary>
+ /// [6]澶滄櫄锛氳缃俯搴�(鎽勬皬0-100锛屽崕姘�32-212)/鍔熺巼鍊�(0-10) (1byte)
+ /// </summary>
+ public const string NightTemperatrue = "NightTemperatrue";
+ /// <summary>
+ /// [7]绂诲紑锛氳缃俯搴�(鎽勬皬0-100锛屽崕姘�32-212)/鍔熺巼鍊�(0-10) (1byte)
+ /// </summary>
+ public const string AwayTemperatrue = "AwayTemperatrue";
#region 涓夌浉绌哄紑灞炴��
+
+
/// <summary>
/// A鐩稿姛鐜�
/// </summary>
@@ -1350,6 +1415,7 @@
/// </summary>
public const string ElectricityC = "electricity_c";
+ #endregion
#endregion
@@ -1707,7 +1773,8 @@
try
{
return Convert.ToByte(loopId, 16);
- } catch
+ }
+ catch
{
return 0;
}
@@ -1721,6 +1788,20 @@
/// </summary>
public static class SPK
{
+ /// <summary>
+ /// 鏈煡SPK
+ /// (鑷畾涔�)
+ /// </summary>
+ public const string NULL = "NULL";
+ /// <summary>
+ /// 鐢垫
+ /// </summary>
+ public const string Elevator = "Elevator";
+ /// <summary>
+ /// 瑗垮ⅷ鍙瀵硅闂ㄥ彛鏈�
+ /// (鑷畾涔�)
+ /// </summary>
+ public const string LinphoneXiMo = "door.gate";
/// <summary>
/// 缇ゆ帶锛堣嚜瀹氫箟锛�
/// </summary>
@@ -1736,7 +1817,7 @@
/// <summary>
/// 澶у崕鎽勫儚澶�
/// </summary>
- //public const string IpCam_Imou = "security.ipcam.imou";
+ public const string IpCam_Imou = "security.ipcam.imou";
/// <summary>
/// 鏈烘鎵�
/// </summary>
@@ -1751,12 +1832,22 @@
/// 瀛愭帶
/// </summary>
public const string AcstSub = "acst.sub";
+ /// <summary>
+ /// 鐑按鍣�
+ /// 閲戣寕
+ /// </summary>
+ public const string WaterHeaterJinmao = "electrical.water_heater.jinmao";
+ /// <summary>
+ /// 閫嗗彉鍣�/鏂拌兘婧�
+ /// 閲戣寕
+ /// </summary>
+ public const string InverterJinmao = "energy.inverter.jinmao";
/// <summary>
/// 闂ㄩ攣
/// </summary>
public const string DoorLock = "security.door";
-
+
/// <summary>
/// 闂ㄩ攣spk鍒楄〃
/// </summary>
@@ -1767,19 +1858,42 @@
list.Add(DoorLock);
return list;
}
-
+
+
+ /// <summary>
+ /// 鐚溂(鏃pk)
+ /// </summary>
+ public const string Peephole = "peephole";
/// <summary>
/// 鐚溂(鏂皊pk 鏆傛椂娌$敤)
/// </summary>
//public const string PeepholeEz = "security.peephole.ez";
/// <summary>
+ /// 钀ょ煶瑙嗛闂ㄩ攣
+ /// </summary>
+ public const string VideoDoorLock = "security.door.ezviz";
+ /// <summary>
+ /// 钀ょ煶鎽勫儚澶�
+ /// </summary>
+ public const string Ev_Ipcam = "security.ipcam.ez";
+ /// <summary>
/// 褰遍煶涓帶
/// </summary>
public const string AvZkAiks = "av.zk.aiks";
-
-
-
+
+ /// <summary>
+ /// 钀ょ煶瑙嗛闂ㄩ攣spk鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ public static List<string> GetVideoDoorLockSPKList()
+ {
+ var list = new List<string>();
+ list.Add(VideoDoorLock);
+ return list;
+ }
+
+
/// <summary>
/// 褰遍煶涓帶spk鍒楄〃
/// </summary>
@@ -1793,7 +1907,17 @@
return list;
}
-
+ /// <summary>
+ /// 钀ょ煶鎽勫儚澶磗pk鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ public static List<string> GetEvIpcamSPKList()
+ {
+ var list = new List<string>();
+ list.Add(Ev_Ipcam);
+ return list;
+ }
+
#region 鐏厜
/// <summary>
/// 锛堝紑鍏崇伅锛�
@@ -1884,6 +2008,10 @@
/// </summary>
public const string HvacAC = "hvac.ac";
/// <summary>
+ /// 闈㈡澘绌鸿皟
+ /// </summary>
+ public const string HvacAcPanel = "hvac.ac_panel";
+ /// <summary>
/// 姣涚粏绠$┖璋�
/// </summaryc
public const string HvacCac = "hvac.cac";
@@ -1897,6 +2025,7 @@
var spkList = new List<string>();
spkList.Add(AcStandard);
spkList.Add(HvacAC);
+ spkList.Add(HvacAcPanel);
spkList.Add(AcIr);
spkList.Add(HvacCac);
return spkList;
@@ -1912,6 +2041,10 @@
/// 鍦版殩
/// </summary>
public const string HvacFloorHeat = "hvac.floorHeat";
+ /// <summary>
+ /// 闈㈡澘鍦版殩
+ /// </summary>
+ public const string HvacFloorHeatPanel = "hvac.floorHeat_panel";
/// <summary>
/// 鍦扮儹spk鍒楄〃
@@ -1921,7 +2054,7 @@
{
var spkList = new List<string>();
spkList.Add(FloorHeatStandard);
- spkList.Add(HvacFloorHeat);
+ spkList.Add(HvacFloorHeat); spkList.Add(HvacFloorHeatPanel);
return spkList;
}
#endregion
@@ -1960,6 +2093,14 @@
#endregion
#region 鑳芥簮
+ /// <summary>
+ /// 閫嗗彉鍣�
+ /// </summary>
+ public const string Inverter = "energy.inverter";
+ /// <summary>
+ /// 涓夌浉閫嗗彉鍣�
+ /// </summary>
+ public const string InverterRst = "energy.inverter_rst";
/// <summary>
/// 鑳芥簮妯″潡
/// </summary>
@@ -2201,7 +2342,7 @@
spkList.Add(SensorEnvironment); spkList.Add(SensorEnvironmentHailin);
spkList.Add(SensorEnvironment2);
spkList.Add(SensorEnvironment3);
-
+
return spkList;
}
@@ -2360,7 +2501,7 @@
/// <summary>
/// HDL鍙瀵硅
/// </summary>
- public const string doorgate="door.gate";
+ public const string doorgate = "door.gate";
#endregion
#region 绗笁鏂箂pk鍒楄〃
--
Gitblit v1.8.0