From 60c59ea2ed4ee11a9989fdd4ce0ddace6efe452e Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 04 四月 2023 14:35:46 +0800
Subject: [PATCH] 群控备份
---
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs | 136 +++++++++++---
HDL_ON/Common/ApiUtlis.cs | 29 +++
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs | 64 ++++++
HDL_ON/DAL/Mqtt/MqttClient.cs | 20 ++
HDL_ON/Entity/FunctionList.cs | 6
HDL_ON/Entity/Function/Function.cs | 23 ++
HDL_ON/UI/UI2/2-Classification/FunctionPage.cs | 3
HDL_ON/DAL/Server/HttpUtil.cs | 6
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs | 98 ++++++++++
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs | 1
HDL_ON/DAL/Server/HttpServerRequest.cs | 34 +++
HDL_ON/DAL/DriverLayer/Control.cs | 53 +++++
HDL_ON/DAL/DriverLayer/Control_TcpClient.cs | 5
SiriIntents/Server/HttpUtil.cs | 4
14 files changed, 423 insertions(+), 59 deletions(-)
diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index 1e28e4d..893a034 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -345,6 +345,35 @@
complateDevice = true;
MainPage.Log($"============璁惧============瀹屾垚" + FunctionList.List.Functions.Count);
}
+
+
+#if DEBUG
+ DB_ResidenceData.Instance.CurrentRegion.isSupportGroupControl = true;
+#endif
+ if (DB_ResidenceData.Instance.CurrentRegion.isSupportGroupControl)
+ {
+ var pack = Ins.HttpRequest.GetGroupControlList();
+ if (pack != null)
+ {
+ if (pack.Code == StateCode.SUCCESS)
+ {
+ try
+ {
+ FunctionList.List.groupControls = JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString());
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log($"璇诲彇缁勬帶鍒楄〃澶辫触:{ex.Message}");
+ }
+ }
+ else
+ {
+ IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+ }
+ }
+ }
+
+
//})
//{ IsBackground = true }.Start();
diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 29e90a2..eeb2431 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -1175,11 +1175,62 @@
}
+
/// <summary>
/// 鏇存柊璁惧鐘舵��
/// A鍗忚鏁版嵁
/// </summary>
- /// <param name="updateBytes"></param>
+ public void UpdataGroupControlStatus(string revString, byte[] usefulBytes, bool isCloudData = false)
+ {
+ var temp = JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString);
+ if (temp != null)
+ {
+ Control_Udp.ReceiveRepeatManager(temp.id, usefulBytes);
+ var allLocalFuntion = FunctionList.List.groupControls;
+ foreach (var updateTemp in temp.objects)
+ {
+ try
+ {
+ var localFunction = allLocalFuntion.Find((obj) => obj.sid == updateTemp.sid);
+ if (localFunction == null)
+ {
+ continue;
+ }
+ MainPage.Log($"鏀跺埌鏁版嵁:{revString}");
+ foreach (var attr in updateTemp.status)
+ {
+ localFunction.time_stamp = temp.time_stamp;
+ localFunction.SetAttrState(attr.key, attr.value);
+
+ }
+
+ //鏇存柊鐣岄潰鐘舵��
+ switch (localFunction.spk)
+ {
+ case SPK.ElectricEnergy:
+ EnergyMainPage.UpdataStatus(localFunction);
+ break;
+ }
+
+ HomePage.UpdataFunctionStates(localFunction);
+ RoomPage.UpdataStates(localFunction);
+ FunctionPage.UpdataStates(localFunction);
+ ClassificationPage.UpdataInfo(localFunction);
+
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log($"A鍗忚鏇存柊鐘舵�佸紓甯�:{ex.Message}");
+ }
+ }
+ }
+ }
+
+
+ /// <summary>
+ /// 鏇存柊璁惧鐘舵��
+ /// A鍗忚鏁版嵁
+ /// </summary>
public void UpdataFunctionStatus(string revString, byte[] usefulBytes, bool isCloudData = false)
{
////test 浜戠杩炴帴鎴愬姛鏃讹紝涓嶉�傜敤鏈湴鏁版嵁鏇存柊
diff --git a/HDL_ON/DAL/DriverLayer/Control_TcpClient.cs b/HDL_ON/DAL/DriverLayer/Control_TcpClient.cs
index c90eac3..251f039 100644
--- a/HDL_ON/DAL/DriverLayer/Control_TcpClient.cs
+++ b/HDL_ON/DAL/DriverLayer/Control_TcpClient.cs
@@ -295,7 +295,10 @@
}
finally
{
- heartBeatThread = null;
+ if (heartBeatThread != null)
+ {
+ heartBeatThread = null;
+ }
HeartBeat();
}
}
diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index 94ae641..7aead41 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -204,6 +204,12 @@
Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/irCodeStudyDone/up",
QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
};
+ //App璁㈤槄缇ゆ帶鐘舵�佷富棰�
+ var groupControlStatus = new MqttTopicFilter()
+ {
+ Topic = $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/device/group/control/property/send",
+ QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce
+ };
#region 鏁版嵁鏇存柊鎺ㄩ�佷富棰�
@@ -262,6 +268,11 @@
topicFilterPush2, topicAlinkStatus ,mqttkeyChange,
deviceOnlinePush,
securityStatusChange});
+ //璁㈤槄缇ゆ帶鐘舵��
+ if (DB_ResidenceData.Instance.CurrentRegion.isSupportGroupControl)
+ {
+ await RemoteMqttClient.SubscribeAsync(groupControlStatus);
+ }
if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0)
{
isSubscribeSuccess = true;
@@ -563,11 +574,18 @@
}
}
#endregion
+ //缇ゆ帶鐘舵��
+ else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/device/group/control/property/send")
+ {
+ var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
+ var revString = Encoding.UTF8.GetString(bytes);
+ MainPage.Log($"mqtt 缇ゆ帶鐘舵�佹洿鏂�:{revString}");
+ Control.Ins.UpdataGroupControlStatus(revString, null, true);
+ }
//A缃戝叧璁惧鐘舵��-鍖呭惈娑傞甫璁惧
//Tag 缃戠粶鐘舵�佽В鏋�
else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/property/send")
{
-
var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
var revString = Encoding.UTF8.GetString(bytes);
MainPage.Log($"mqtt 鐘舵�佹洿鏂�:{revString}");
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index 449da8d..0ae1596 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -3203,7 +3203,22 @@
var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGroupControlListByHome, requestJson);
return pack;
}
-
+ /// <summary>
+ /// 鑾峰彇缇ゆ帶璇︽儏
+ /// </summary>
+ public ResponsePackNew GetGroupControInfo(String userDeviceGroupControlIds)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+ var ids = new List<string>()
+ {
+ userDeviceGroupControlIds,
+ };
+ d.Add("userDeviceGroupControlIds", ids);
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGroupControlInfos, requestJson);
+ return pack;
+ }
/// <summary>
/// 娣诲姞缇ゆ帶鍒楄〃
@@ -3217,7 +3232,22 @@
d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
d.Add("infos", groupControls);
var requestJson = HttpUtil.GetSignRequestJson(d);
- var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGroupControlListByHome, requestJson);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddGroupControl, requestJson);
+ return pack;
+ }
+
+ /// <summary>
+ /// 缂栬緫缇ゆ帶鍒楄〃
+ /// </summary>
+ /// <param name="spk"></param>
+ /// <returns></returns>
+ public ResponsePackNew EditGroupControl(List<GroupControl> groupControls)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+ d.Add("infos", groupControls);
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddGroupControl, requestJson);
return pack;
}
diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs
index aa884c3..0d07a76 100644
--- a/HDL_ON/DAL/Server/HttpUtil.cs
+++ b/HDL_ON/DAL/Server/HttpUtil.cs
@@ -18,8 +18,8 @@
/// 鍥哄畾鍩熷悕,姝e紡鐜
/// 鍏叡鍩熷悕灏辫繎瑙f瀽
/// </summary>
- public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
- //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
+ //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+ public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
const string APP_KEY = "HDL-HOME-APP-TEST";
const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
//public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm
@@ -238,7 +238,7 @@
}
else
{
- HDL_ON.Utlis.WriteLine($"鎺ュ彛寮傚父:{requestFullUrl} \r\n"+response.ErrorMessage);
+ HDL_ON.Utlis.WriteLine($"鎺ュ彛寮傚父:{requestFullUrl} \r\n"+response.Content);
return new ResponsePackNew() { Code = StateCode.NETWORK_ERROR };
}
diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs
index af35197..99332a5 100644
--- a/HDL_ON/Entity/Function/Function.cs
+++ b/HDL_ON/Entity/Function/Function.cs
@@ -561,13 +561,24 @@
new System.Threading.Thread(() =>
{
- if (collect)
- {
- result = ApiUtlis.Ins.HttpRequest.CollectDevice(deviceId).Code;
+ if (spk == SPK.GroupControl) {
+ if (collect)
+ {
+ }
+ else
+ {
+ }
}
else
{
- result = ApiUtlis.Ins.HttpRequest.CancelCollectDevice(deviceId).Code;
+ if (collect)
+ {
+ result = ApiUtlis.Ins.HttpRequest.CollectDevice(deviceId).Code;
+ }
+ else
+ {
+ result = ApiUtlis.Ins.HttpRequest.CancelCollectDevice(deviceId).Code;
+ }
}
//鎻愮ず閿欒
if (result != StateCode.SUCCESS)
@@ -1356,6 +1367,10 @@
public static class SPK
{
/// <summary>
+ /// 缇ゆ帶锛堣嚜瀹氫箟锛�
+ /// </summary>
+ public const string GroupControl = "GroupControl";
+ /// <summary>
/// 閫氱敤寮�鍏�
/// </summary>
public const string OtherCommon = "other.common";
diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index 2f075d3..aecf05a 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -56,6 +56,12 @@
/// </summary>
public List<Function> Functions = new List<Function>();
/// <summary>
+ /// 缇ゆ帶鍒楄〃
+ /// </summary>
+ public List<GroupControl> groupControls = new List<GroupControl>();
+
+
+ /// <summary>
/// 鏈烘鑷傚垪琛�
/// </summary>
/// <returns></returns>
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
index 74b7a31..d304f4b 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
@@ -142,6 +142,9 @@
if (titleId == StringId.Lights)
{
functionList.AddRange(FunctionList.List.GetLightList());
+ functionList.AddRange(FunctionList.List.groupControls);
+
+
var lightScene = FunctionList.List.scenes.FindAll((obj) => obj.sceneType == SceneType.LightScene);
foreach (var scene in lightScene)
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs
index 2d893bc..c507931 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddGroupControlPage.cs
@@ -51,19 +51,30 @@
/// 鍥炶皟鍒锋柊
/// </summary>
Action backActon;
-
+ /// <summary>
+ /// 鏄惁鏂板缇ゆ帶
+ /// </summary>
+ bool isAdd = true;
GroupControl groupControl;
+ GroupControlType groupControlType = new GroupControlType();
-
- public AddGroupControlPage(List<Function> functions, GroupControl groupControl, Action action)
+ public AddGroupControlPage(GroupControl groupControl, Action action)
{
bodyView = this;
- groupControlLightList = functions;
+ if(groupControl == null)
+ {
+ this.groupControl = new GroupControl();
+ }
+ else
+ {
+ isAdd = false;
+ this.groupControl = groupControl;
+ }
+ groupControlLightList = new List<Function>();
backActon = action;
lightList = FunctionList.List.GetLightList();
- this.groupControl = groupControl;
}
public void LoadPage()
@@ -105,6 +116,7 @@
TextSize = CSS_FontSize.TextFontSize,
TextAlignment = TextAlignment.CenterRight,
TextColor = CSS_Color.TextualColor,
+ PlaceholderTextColor = CSS_Color.PromptingColor1,
};
groupNameView.AddChidren(etGroupName);
@@ -173,8 +185,8 @@
view.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
};
- btnLocationInfoRight.MouseUpEventHandler = eventHandler;
- btnLocationValues.MouseUpEventHandler = eventHandler;
+ btnLocationInfoRight.MouseUpEventHandler = eventHandler;
+ btnLocationValues.MouseUpEventHandler = eventHandler;
//locationMagtView.AddChidren(
@@ -327,6 +339,8 @@
try
{
var http = new HttpServerRequest();
+ groupControl.type = groupControlType.type;
+ groupControl.sid = groupControl.NewGroupControlSid();
var pack = http.AddGroupControl(new List<GroupControl>() { groupControl });
if (pack != null)
{
@@ -352,6 +366,71 @@
//鍔犺浇鍔熻兘绛涢�夌粍浠�
LoadDialog_ChangeFloor();
+
+
+ new Thread(() => {
+ var http = new HttpServerRequest();
+ if (isAdd)
+ {
+ var pack = http.GetGroupControlTypes("light.switch");
+ if (pack != null)
+ {
+ if (pack.Code == StateCode.SUCCESS)
+ {
+ try
+ {
+
+ var groupControlTypes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControlType>>(pack.Data.ToString());
+ if (groupControlTypes != null && groupControlTypes.Count > 0)
+ {
+ groupControlType = groupControlTypes[0];
+ }
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log($"璇诲彇缁勬帶绫诲瀷澶辫触:{ex.Message}");
+ }
+ }
+ else
+ {
+ IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+ }
+ }
+ }
+ else
+ {
+ var pack = http.GetGroupControInfo(groupControl.userDeviceGroupControlId);
+ if (pack != null)
+ {
+ if (pack.Code == StateCode.SUCCESS)
+ {
+ try
+ {
+
+ var groupControlTemps = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString());
+ if (groupControlTemps != null && groupControlTemps.Count > 0)
+ {
+ groupControl = groupControlTemps[0];
+ }
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log($"璇诲彇缁勬帶淇℃伅澶辫触:{ex.Message}");
+ }
+ }
+ else
+ {
+ IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
+ }
+ }
+ }
+ }) { IsBackground = true }.Start();
+
+ if (!isAdd)
+ {
+ etGroupName.Text = groupControl.name;
+ btnLocationValues.Text = groupControl.GetRoomListName();
+ }
}
/// <summary>
@@ -392,7 +471,6 @@
var functionDiv = new LightRow(function)
{
Gravity = Gravity.CenterHorizontal,
- //Width = Application.GetRealWidth(343),
Height = Application.GetRealHeight(62),
BorderColor = 0x00FFFFFF,
BorderWidth = 1,
@@ -419,6 +497,10 @@
btnConfrim.IsSelected = false;
}
};
+ if (groupControl.sids.Find((obj) => obj.sid == function.sid) != null)
+ {
+ groupControlLightList.Add(function);
+ }
functionDiv.LoadDiv(groupControlLightList, setAction);
functionListView.AddChidren(functionDiv);
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs
index 770551c..5805d72 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs
@@ -24,7 +24,7 @@
(s,c)=>{
try
{
- var page = new AddGroupControlPage(new System.Collections.Generic.List<Function>(),new GroupControl(),
+ var page = new AddGroupControlPage(null,
()=> {
});
@@ -54,7 +54,10 @@
try
{
var groupControlList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString());
- LoadGroupControlView(groupControlList);
+ Application.RunOnMainThread(() =>
+ {
+ LoadGroupControlView(groupControlList);
+ });
}
catch (Exception ex)
{
@@ -66,7 +69,6 @@
IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
}
}
-
}) { IsBackground = true }.Start();
#region
@@ -81,7 +83,31 @@
private void LoadGroupControlView(List<GroupControl> list)
{
- if(list.Count == 0)
+#if DEBUG
+ if (list.Count == 0)
+ {
+ list.Add(new GroupControl()
+ {
+ name = "缁勫悎璋冨厜1",
+ roomIds = new List<string> { Room.CurrentSpatial.RoomList[0].roomId },
+ sid = "00000000000000001",
+ type = "light",
+ uids = new List<string>() { Room.CurrentSpatial.RoomList[0].uid },
+ });
+
+ list.Add(new GroupControl()
+ {
+ name = "缁勫悎璋冨厜2",
+ roomIds = new List<string> { Room.CurrentSpatial.RoomList[0].roomId },
+ sid = "00000000000000002",
+ type = "light",
+ uids = new List<string>() { Room.CurrentSpatial.RoomList[0].uid },
+ });
+ }
+
+#endif
+
+ if (list.Count == 0)
{
}
@@ -89,7 +115,7 @@
{
contentView.RemoveAll();
- foreach (var function in list)
+ foreach (var groupControl in list)
{
var functionRow = new FrameLayout()
{
@@ -97,6 +123,16 @@
BackgroundColor = CSS_Color.MainBackgroundColor,
};
contentView.AddChidren(functionRow);
+
+ var btnRight = new Button()
+ {
+ X = Application.GetRealWidth(339),
+ Gravity = Gravity.CenterVertical,
+ Width = Application.GetMinRealAverage(16),
+ Height = Application.GetMinRealAverage(16),
+ UnSelectedImagePath = "Public/Right.png",
+ };
+ functionRow.AddChidren(btnRight);
var btnFunctionName = new Button()
{
@@ -107,7 +143,7 @@
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.SubheadingFontSize,
TextColor = CSS_Color.FirstLevelTitleColor,
- Text = function.name,
+ Text = groupControl.name,
};
functionRow.AddChidren(btnFunctionName);
@@ -120,7 +156,7 @@
TextAlignment = TextAlignment.CenterLeft,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
TextColor = CSS_Color.PromptingColor1,
- Text = function.GetRoomListName(),
+ Text = groupControl.GetRoomListName(),
};
functionRow.AddChidren(btnFunctionLocationInfo);
@@ -136,6 +172,20 @@
BackgroundColor = CSS_Color.DividingLineColor,
});
+ EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
+ var page = new AddGroupControlPage(groupControl,
+ () => {
+
+ });
+ MainPage.BasePageView.AddChidren(page);
+ page.LoadPage();
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ };
+ functionRow.MouseUpEventHandler = eventHandler;
+ btnRight.MouseUpEventHandler = eventHandler;
+ btnFunctionName.MouseUpEventHandler = eventHandler;
+ btnFunctionLocationInfo.MouseUpEventHandler = eventHandler;
+
}
}
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs
index 28dea93..e58062f 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/GroupControl.cs
@@ -4,19 +4,74 @@
namespace HDL_ON.Entity
{
- public class GroupControl
+ public class GroupControl : Function
{
public GroupControl()
{
+ spk = "GroupControl";
}
+ /// <summary>
+ /// 缇ゆ帶ID
+ /// </summary>
+ public string userDeviceGroupControlId = string.Empty;
/// <summary>
/// 缇ゆ帶sid
/// </summary>
- public string sid = string.Empty;
+ //public string sid = string.Empty;
+ /// <summary>
+ /// 鐢熸垚缇ゆ帶sid
+ /// </summary>
+ public string NewGroupControlSid()
+ {
+ string sceneId = "";
+ try
+ {
+ string sOidBeginsWith = "000101";//鍘傚晢 + 閫氳鏂瑰紡
+ DateTime dt = DateTime.Now;
+ DateTime startTime = TimeZoneInfo.ConvertTimeToUtc(new DateTime(2020, 1, 1));
+ long m = (long)((dt - startTime).TotalMilliseconds / 10);
+ string sTimeSpan = "00000000";
+
+ byte[] arry = new byte[4];
+ arry[0] = (byte)(m & 0xFF);
+ arry[1] = (byte)((m & 0xFF00) >> 8);
+ arry[2] = (byte)((m & 0xFF0000) >> 16);
+ arry[3] = (byte)((m >> 24) & 0xFF);
+ sTimeSpan = arry[0].ToString("X2") + arry[1].ToString("X2") + arry[2].ToString("X2") + arry[3].ToString("X2");
+
+
+ if (sTimeSpan.Length >= 8)
+ {
+ sTimeSpan = sTimeSpan.Substring(0, 8);
+ }
+ else
+ {
+ sTimeSpan = Guid.NewGuid().ToString().Substring(0, 8);
+ //sTimeSpan = "00000000";
+ }
+
+ sceneId = sOidBeginsWith + sTimeSpan;
+
+ sceneId += "AA";
+ sceneId += "AA01";
+ int maxId = 1;
+
+ Random random = new Random(Guid.NewGuid().GetHashCode());
+ maxId = random.Next(10);
+
+ sceneId += (maxId + 1).ToString("X4");
+ sceneId += "0000";
+ }
+ catch
+ {
+ return sceneId;
+ }
+ return sceneId;
+ }
/// <summary>
/// 缇ゆ帶鍚嶇О
/// </summary>
- public string name = string.Empty;
+ //public string name = string.Empty;
/// <summary>
/// 缇ゆ帶绫诲瀷
/// </summary>
@@ -25,7 +80,7 @@
/// 鎴块棿uid
/// </summary>
public List<String> uids = new List<string>();
- public List<String> roomIds = new List<string>();
+ //public List<String> roomIds = new List<string>();
/// <summary>
/// 缇ゆ帶鍔熻兘sid閰嶇疆
/// </summary>
@@ -33,32 +88,32 @@
- /// <summary>
- /// 鑾峰彇璁惧娣诲姞鍒版埧闂寸殑鎴块棿鍚嶇О
- /// </summary>
- /// <returns></returns>
- public string GetRoomListName()
- {
- string roomNameList = "";
- foreach (var roomId in roomIds)
- {
- var findRoom = SpatialInfo.CurrentSpatial.RoomList.Find(obj => obj.roomId == roomId);
- if (findRoom == null)
- {
- continue;
- }
- if (roomNameList != "")
- {
- roomNameList += ",";
- }
- roomNameList += findRoom.floorName + "-" + findRoom.roomName;
- }
- if (roomNameList == "")
- {
- roomNameList = Language.StringByID(StringId.WholeZone);
- }
- return roomNameList;
- }
+ ///// <summary>
+ ///// 鑾峰彇璁惧娣诲姞鍒版埧闂寸殑鎴块棿鍚嶇О
+ ///// </summary>
+ ///// <returns></returns>
+ //public string GetRoomListName()
+ //{
+ // string roomNameList = "";
+ // foreach (var roomId in roomIds)
+ // {
+ // var findRoom = SpatialInfo.CurrentSpatial.RoomList.Find(obj => obj.roomId == roomId);
+ // if (findRoom == null)
+ // {
+ // continue;
+ // }
+ // if (roomNameList != "")
+ // {
+ // roomNameList += ",";
+ // }
+ // roomNameList += findRoom.floorName + "-" + findRoom.roomName;
+ // }
+ // if (roomNameList == "")
+ // {
+ // roomNameList = Language.StringByID(StringId.WholeZone);
+ // }
+ // return roomNameList;
+ //}
}
public class GroupControlFunction
@@ -72,5 +127,26 @@
/// </summary>
public string spk = string.Empty;
}
+
+
+ public class GroupControlType
+ {
+ /// <summary>
+ /// 绫诲瀷
+ /// </summary>
+ public string type = string.Empty;
+ /// <summary>
+ /// 绫诲瀷鍚嶇О
+ /// </summary>
+ public string typeName = string.Empty;
+ /// <summary>
+ /// 缇ゆ帶鏀寔鐨剆pk
+ /// </summary>
+ public List<string> spks = new List<string>();
+ /// <summary>
+ /// 缇ゆ帶鏀寔鐨剆pk灞炴��
+ /// </summary>
+ public List<string> spkAttrs = new List<string>();
+ }
}
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
index 4ca2bdf..f09d43a 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
@@ -164,6 +164,7 @@
bodyView = this;
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
}
+
public void LoadView()
{
#region 涓汉淇℃伅
diff --git a/SiriIntents/Server/HttpUtil.cs b/SiriIntents/Server/HttpUtil.cs
index 8d4483c..dc7aca0 100644
--- a/SiriIntents/Server/HttpUtil.cs
+++ b/SiriIntents/Server/HttpUtil.cs
@@ -16,8 +16,8 @@
/// 鍥哄畾鍩熷悕,姝e紡鐜
/// 鍏叡鍩熷悕灏辫繎瑙f瀽
/// </summary>
- public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
- //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
+ //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+ public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
const string APP_KEY = "HDL-HOME-APP-TEST";
const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
//public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm
--
Gitblit v1.8.0