From 273bd8b4fb918a4303207215b2b8369fbc275000 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 08 十二月 2020 18:58:44 +0800
Subject: [PATCH] Merge branch 'CJL-NEW'
---
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 294 +++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 249 insertions(+), 45 deletions(-)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index 6f1dfe2..1dbe612 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -7,8 +7,21 @@
public class LogicMethod
{
+ /// <summary>
+ /// 琛ㄧず鏄潯浠�
+ /// </summary>
public const string condition_if = "鏉′欢";
+ /// <summary>
+ /// 琛ㄧず鏄洰鏍�
+ /// </summary>
public const string target_if = "鐩爣";
+ /// <summary>
+ /// 绉婚櫎鎵�鏈�"Logic"鐣岄潰
+ /// </summary>
+ public static void RemoveAllView()
+ {
+ MainPage.BasePageView.RemoveViewByTag("Logic");
+ }
/// <summary>
/// 鐢熸垚閫昏緫sid鏂规硶
/// </summary>
@@ -60,6 +73,54 @@
}
return logicId;
}
+
+ /// <summary>
+ /// 鐢熸垚閫昏緫sid鏂规硶
+ /// </summary>
+ //public static string NewSid()
+ //{
+ // String sLogicid = "";
+ // try
+ // {
+ // String sOidBeginsWith = "000101";//鍘傚晢 + 閫氳鏂瑰紡
+ // //鐢熸垚4涓猙yte鏃堕棿鎴�
+ // DateTime dt = DateTime.Now;
+ // long sTimeSp = GateWay.ConvertDateTimeLong(dt);
+ // string sTimeSpan = "";
+ // GateWay.ConvertIntToByteArray(sTimeSp, ref sTimeSpan);
+ // if (sTimeSpan.Length != 8) return sLogicid;
+ // //闂撮殧10姣 閿欏紑鏃堕棿鎴�
+ // HDLUDP.TimeBetwnNext(10);
+ // sLogicid = sOidBeginsWith + sTimeSpan;
+ // //1501 鐗╂ā鍨嬩负鑷姩鍖栵紝 0001 琛ㄧず 1 鍙疯嚜鍔ㄥ寲鍔熻兘
+ // sLogicid += "15";
+ // sLogicid += "1501";
+ // //鑷姩鍖栧彿鑷
+ // int iTopSceneId = 1;
+ // if (myGateway.LogicResponse != null)
+ // {
+ // if (myGateway.LogicResponse.objects != null)
+ // {
+ // for (int i = 0; i < myGateway.LogicResponse.objects.Count; i++)
+ // {
+ // string ccc = myGateway.LogicResponse.objects[i].sid.Substring(myGateway.LogicResponse.objects[i].sid.Length - 8, 4);
+ // int iThisSceneId = Convert.ToInt16(myGateway.LogicResponse.objects[i].sid.Substring(myGateway.LogicResponse.objects[i].sid.Length - 8, 4), 16);
+ // if (iThisSceneId >= iTopSceneId)
+ // iTopSceneId = iThisSceneId + 1;
+ // }
+ // }
+ // }
+ // sLogicid += iTopSceneId.ToString("X4");//鍦烘櫙鍙� 涓や釜byte
+ // //澶х被灏忕被娌℃湁鐢ㄥ埌 鍥哄畾涓�0
+ // sLogicid += "0000";
+ // return sLogicid;
+ // }
+ // catch
+ // {
+ // return sLogicid;
+ // }
+ //}
+
/// <summary>
/// 灏佽Dictionary瀵硅薄
/// </summary>
@@ -80,9 +141,9 @@
/// 鑾峰彇缃戝叧鎴块棿鍒楄〃
/// </summary>
/// <returns></returns>
- public static List<HDL_ON.Entity.Room> GetGatewayRoomListG()
+ public static List<HDL_ON.Entity.Room> GetGatewayRoomList()
{
- return HDL_ON.Entity.DB_ResidenceData.rooms;
+ return HDL_ON.Entity.DB_ResidenceData.residenceData.Rooms;
}
/// <summary>
/// 鑾峰彇缃戝叧鎴块棿鍒楄〃
@@ -93,10 +154,10 @@
List<Entity.Room> roomList = new List<Entity.Room>();
Entity.Room room1 = new Entity.Room();
- room1.name = name;//榛樿涓�涓埧闂村悕涓�:鍏ㄩ儴鍖哄煙
- room1.sid = "鍏ㄩ儴鍖哄煙";//榛樿sid鐢ㄨ瘑鍒鎴块棿
+ room1.roomName = name;//榛樿涓�涓埧闂村悕涓�:鍏ㄩ儴鍖哄煙
+ room1.uid = "鍏ㄩ儴鍖哄煙";//榛樿sid鐢ㄨ瘑鍒鎴块棿
roomList.Add(room1);//榛樿娣诲姞鍒版埧闂村垪琛ㄩ噷
- var roomLists = GetGatewayRoomListG();
+ var roomLists = GetGatewayRoomList();
foreach (var room in roomLists)
{
roomList.Add(room);
@@ -110,8 +171,89 @@
/// <returns></returns>
public static List<HDL_ON.Entity.Function> GetGatewayDeviceList()
{
+ List<HDL_ON.Entity.Function> list = new List<Entity.Function>();
+ for (int i=0;i<10;i++) {
+ HDL_ON.Entity.Function function = new Entity.Function();
+ switch (i) {
+ case 0: {
+ function.sid = "1234560001212121020182";
+ function.name ="鐏厜";
+ list.Add(function);
+ }
+ break;
+ case 1: {
+
+ function.sid = "1234560001212121030182";
+ function.name = "绐楀笜";
+ list.Add(function);
+ } break;
+ case 2: {
+ function.sid = "1234560001212121040182";
+ function.name = "绌鸿皟";
+ list.Add(function);
+ } break;
+ case 3:
+ {
+ function.sid = "1234560001212121010282";
+ function.name = "RGBW";
+ list.Add(function);
+ }
+ break;
+ case 4:
+ {
- return HDL_ON.Entity.DB_ResidenceData.functionList.GetAllFunction();
+ function.sid = "1234560001212121010382";
+ function.name = "CCT鐏�";
+ list.Add(function);
+ }
+ break;
+ case 5:
+ {
+ function.sid = "1234560001212121010482";
+ function.name = "寮�鍚堝笜";
+ list.Add(function);
+ }
+ break;
+ case 6:
+ {
+ function.sid = "1234560001212121010582";
+ function.name = "鍗峰笜";
+ list.Add(function);
+ }
+ break;
+ case 7:
+ {
+ function.sid = "1234560001212121040282";
+ function.name = "鍦扮儹";
+ list.Add(function);
+ }
+ break;
+ case 8:
+ {
+ function.sid = "1234560001212121020282";
+ function.name = "璋冨叧";
+ list.Add(function);
+ }
+ break;
+ case 9:
+ {
+ function.sid = "1234560001212121020482";
+ function.name = "RGB";
+ list.Add(function);
+ }
+ break;
+ }
+ }
+ return list;
+ //return HDL_ON.Entity.DB_ResidenceData.functionList.GetAllFunction();
+ }
+ /// <summary>
+ /// 鑾峰彇缃戝叧鍦烘櫙鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ public static List<HDL_ON.Entity.Scene> GetSceneList()
+ {
+ return HDL_ON.Entity.DB_ResidenceData.functionList.scenes;
}
/// <summary>
/// 鑾峰彇鎴块棿鐨勮澶囧垪琛�
@@ -124,11 +266,11 @@
List<HDL_ON.Entity.Function> lists = GetGatewayDeviceList();
foreach (var dev in lists)
{
- if (dev.roomIdList.Find((id) => id == room.sid) != null)
+ if (dev.roomIds.Find((id) => id == room.uid) != null)
{
deviceLists.Add(dev);
}
- if (room.sid == "鍏ㄩ儴鍖哄煙")
+ if (room.uid == "鍏ㄩ儴鍖哄煙")
{
//鎴块棿鍚嶄负鍏ㄩ儴鍖哄煙鏃讹紝鏄剧ず缃戝叧鍏ㄩ儴璁惧
deviceLists = lists;
@@ -156,6 +298,26 @@
}
return device;
}
+
+ /// <summary>
+ /// 鑾峰彇褰撲釜鍦烘櫙
+ /// </summary>
+ /// <param name="sid">鍦烘櫙鍞竴鏍囪瘑</param>
+ /// <returns></returns>
+ public static HDL_ON.Entity.Scene GetSecne(string sid)
+ {
+ HDL_ON.Entity.Scene scene = new Entity.Scene() { name = "Unknown", sid = "鍦烘櫙涓嶅瓨鍦�" };
+ List<HDL_ON.Entity.Scene> sceneLists = GetSceneList();
+ foreach (var sce in sceneLists)
+ {
+ if (sce.sid == sid)
+ {
+ scene = sce;
+ break;
+ }
+ }
+ return scene;
+ }
/// <summary>
/// 鑾峰彇鎴块棿鍚�(鍗虫槸=鍖哄煙鍚嶇О)
/// </summary>
@@ -164,14 +326,14 @@
public static string GetGetRoomName(HDL_ON.Entity.Function device)
{
string roomName = "";
- List<HDL_ON.Entity.Room> roomLists = GetGatewayRoomListG();
+ List<HDL_ON.Entity.Room> roomLists = GetGatewayRoomList();
- foreach (var dev in device.roomIdList)
+ foreach (var dev in device.roomIds)
{
- var room = roomLists.Find((c) => c.sid == dev);
+ var room = roomLists.Find((c) => c.uid == dev);
if (room != null)
{
- roomName += room.floorName + "." + room.name + ",";
+ roomName += room.floorName + "." + room.roomName + ",";
}
}
@@ -188,8 +350,29 @@
switch (functionType)
{
case FunctionType.Relay:
+ case FunctionType.RGB:
+ case FunctionType.RGBW:
+ case FunctionType.CCT:
+ case FunctionType.Dimmer:
{
strPath = "LogicIcon/lightloguc.png";
+ }
+ break;
+ case FunctionType.Curtain:
+ case FunctionType.RollerCurtain:
+ case FunctionType.TrietexCurtain:
+ {
+ strPath = "LogicIcon/curtainlogic.png";
+ }
+ break;
+ case FunctionType.AC:
+ {
+ strPath = "LogicIcon/airconditionerlogic.png";
+ }
+ break;
+ case FunctionType.FloorHeating:
+ {
+ strPath = "LogicIcon/heatlogic.png";
}
break;
@@ -205,13 +388,13 @@
{
List<string> deviceStrTypeList = new List<string>();
deviceStrTypeList.Clear();
- var lightjosn = deviceList.Find((device) => device.functionType == FunctionType.Relay || device.functionType == FunctionType.Dimmer);
+ var lightjosn = deviceList.Find((device) => device.functionType == FunctionType.Relay || device.functionType == FunctionType.Dimmer|| device.functionType == FunctionType.CCT || device.functionType == FunctionType.RGB|| device.functionType == FunctionType.RGBW);
if (lightjosn != null)
{
deviceStrTypeList.Add(Language.StringByID(StringId.Lights));
}
- var curtainjosn = deviceList.Find((device) => device.functionType ==FunctionType.Curtain);
+ var curtainjosn = deviceList.Find((device) => device.functionType ==FunctionType.Curtain|| device.functionType == FunctionType.TrietexCurtain|| device.functionType == FunctionType.RollerCurtain);
if (curtainjosn != null)
{
deviceStrTypeList.Add(Language.StringByID(StringId.Curtain));
@@ -221,6 +404,11 @@
if (ac != null)
{
deviceStrTypeList.Add(Language.StringByID(StringId.AC));
+ }
+ var floorHeating = deviceList.Find((device) => device.functionType == FunctionType.FloorHeating);
+ if (ac != null)
+ {
+ deviceStrTypeList.Add(Language.StringByID(StringId.FloorHeating));
}
return deviceStrTypeList;
@@ -237,33 +425,65 @@
{
functionTypeList.Add(FunctionType.Relay);
functionTypeList.Add(FunctionType.Dimmer);
+ functionTypeList.Add(FunctionType.RGB);
+ functionTypeList.Add(FunctionType.RGBW);
+ functionTypeList.Add(FunctionType.CCT);
}
else if (deviceType == Language.StringByID(StringId.Curtain))
{
functionTypeList.Add(FunctionType.Curtain);
+ functionTypeList.Add(FunctionType.RollerCurtain);
+ functionTypeList.Add(FunctionType.TrietexCurtain);
+ }
+ else if (deviceType == Language.StringByID(StringId.AC))
+ {
+ functionTypeList.Add(FunctionType.AC);
+ }
+ else if (deviceType == Language.StringByID(StringId.FloorHeating))
+ {
+ functionTypeList.Add(FunctionType.FloorHeating);
}
return functionTypeList;
}
/// <summary>
- /// 鏉′欢鏀寔璁惧
+ /// 鏉′欢/鐩爣鏀寔璁惧
/// </summary>
/// <returns></returns>
- public static List<FunctionType> GetConditionFunctionTypeDevice()
+ public static List<FunctionType> GetSupportEquipment(string if_type)
{
List<FunctionType> deviceTypeList = new List<FunctionType>();
- deviceTypeList.Add(FunctionType.Relay);
+ switch (if_type) {
+ case condition_if: {
+ deviceTypeList.Add(FunctionType.Relay);
+ deviceTypeList.Add(FunctionType.RGB);
+ deviceTypeList.Add(FunctionType.RGBW);
+ deviceTypeList.Add(FunctionType.Dimmer);
+ deviceTypeList.Add(FunctionType.CCT);
+ deviceTypeList.Add(FunctionType.Curtain);
+ deviceTypeList.Add(FunctionType.RollerCurtain);
+ deviceTypeList.Add(FunctionType.TrietexCurtain);
+ deviceTypeList.Add(FunctionType.AC);
+ deviceTypeList.Add(FunctionType.FloorHeating);
+ }
+ break;
+ case target_if:
+ {
+ deviceTypeList.Add(FunctionType.Relay);
+ deviceTypeList.Add(FunctionType.RGB);
+ deviceTypeList.Add(FunctionType.RGBW);
+ deviceTypeList.Add(FunctionType.Dimmer);
+ deviceTypeList.Add(FunctionType.CCT);
+ deviceTypeList.Add(FunctionType.Curtain);
+ deviceTypeList.Add(FunctionType.RollerCurtain);
+ deviceTypeList.Add(FunctionType.TrietexCurtain);
+ deviceTypeList.Add(FunctionType.AC);
+ deviceTypeList.Add(FunctionType.FloorHeating);
+ }
+ break;
+ }
return deviceTypeList;
}
- /// <summary>
- /// 鐩爣鏀寔璁惧
- /// </summary>
- /// <returns></returns>
- public static List<FunctionType> GetTargetFunctionTypeDevice()
- {
- List<FunctionType> deviceTypeList = new List<FunctionType>();
- return deviceTypeList;
- }
/// <summary>
/// 鏄剧ず鐨勮澶囧垪琛�
/// </summary>
@@ -283,36 +503,20 @@
}
return devList;
}
-
/// <summary>
/// 杩斿洖鏈�缁堟敮鎸佹樉绀哄嚭鏉ョ殑璁惧鍒楄〃
/// </summary>
/// <param name="room">褰撳墠鎴块棿</param>
/// <param name="str">鍒ゆ柇绗︼紙琛ㄧず=杈撳叆璁惧鍜岃緭鍑鸿澶囷級</param>
/// <returns></returns>
- public static List<Entity.Function> GetFunctionDeviceList(Entity.Room room,string str)
+ public static List<Entity.Function> GetFunctionDeviceList(Entity.Room room, string str)
{
- List<FunctionType> functionTypeList=new List<FunctionType>();
- switch (str) {
- case condition_if: {
- //杩斿洖鏉′欢鏀寔璁惧鍒楄〃
- functionTypeList = GetConditionFunctionTypeDevice();
- }
- break;
- case target_if:
- {
- //杩斿洖鐩爣鏀寔璁惧鍒楄〃
- functionTypeList = GetTargetFunctionTypeDevice();
- }
- break;
- }
+ List<FunctionType> functionTypeList = GetSupportEquipment(str);
//杩斿洖鎴块棿璁惧鍒楄〃
var roomDeviceList = GetRoomDevice(room);
//杩斿洖鏈�缁堟敮鎸佹樉绀哄嚭鏉ョ殑璁惧鍒楄〃
- var list= GetShowDeviceList(functionTypeList, roomDeviceList);
+ var list = GetShowDeviceList(functionTypeList, roomDeviceList);
return list;
}
-
-
}
}
--
Gitblit v1.8.0