From 66c72ee19b9e3543537621b8dd25685c9b5c03c4 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 02 八月 2022 14:05:30 +0800 Subject: [PATCH] RGB色盘优化,第三方平台对接功能 --- HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs | 65 ++++++ HDL-ON_Android/Assets/Language.ini | 4 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs | 2 HDL_ON/Entity/Integratedbrand/IntegratedBrand.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs | 16 + HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_SupportSpkListPage.cs | 26 ++ HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs | 13 + HDL_ON/DAL/Mqtt/MqttClient.cs | 90 ++++++-- HDL_ON/HDL_ON.projitems | 1 HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandListPage.cs | 56 ++--- HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs | 22 ++ HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs | 151 +++++++++++--- HDL-ON_iOS/Resources/Language.ini | 4 HDL_ON/DAL/Server/NewAPI.cs | 4 HDL_ON/Entity/Function/Function.cs | 25 ++ HDL_ON/DAL/Server/HttpUtil.cs | 4 HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/iot_BindTipPage.cs | 30 ++ HDL_ON/DAL/Server/HttpServerRequest.cs | 16 + HDL_ON/DAL/DriverLayer/Control.cs | 6 SiriIntents/Server/HttpUtil.cs | 4 20 files changed, 418 insertions(+), 123 deletions(-) diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index 18e26c5..3de2aa2 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -1600,7 +1600,7 @@ 408=纭娣诲姞 409=鍔熻兘鍝佺墝 -410=浣犲綋鍓嶈繕鏈坊鍔犱换浣曞钩鍙拌澶� +410=娌℃湁鎮ㄧ殑璁惧 411=鍏朵粬骞冲彴璁惧鍧囩敱绗笁鏂规湇鍔″晢鎻愪緵鏀寔 412=娣诲姞 413=鎺у埗鍣ㄦ湭寮�鍚� @@ -1621,7 +1621,7 @@ 428=璐熺瀛愭椂闂� 429=灏忔椂 430=鍒嗛挓 -431=浣犲綋鍓嶈繕涓烘坊鍔犱换浣曞钩鍙拌澶� +431=鎮ㄥ綋鍓嶈繕鏈坊鍔犱换浣曞钩鍙拌澶� 432=鍏朵粬骞冲彴璁惧鍧囩敱绗笁鏂规湇鍔″晢鎻愪緵鏀寔 433=姘撮榾 434=瀹氭椂寮�鍏� diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index c4deb26..bfc05e6 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -1598,7 +1598,7 @@ 408=纭娣诲姞 409=鍔熻兘鍝佺墝 -410=浣犲綋鍓嶈繕鏈坊鍔犱换浣曞钩鍙拌澶� +410=娌℃湁鎮ㄧ殑璁惧 411=鍏朵粬骞冲彴璁惧鍧囩敱绗笁鏂规湇鍔″晢鎻愪緵鏀寔 412=娣诲姞 413=鎺у埗鍣ㄦ湭寮�鍚� @@ -1619,7 +1619,7 @@ 428=璐熺瀛愭椂闂� 429=灏忔椂 430=鍒嗛挓 -431=浣犲綋鍓嶈繕涓烘坊鍔犱换浣曞钩鍙拌澶� +431=鎮ㄥ綋鍓嶈繕鏈坊鍔犱换浣曞钩鍙拌澶� 432=鍏朵粬骞冲彴璁惧鍧囩敱绗笁鏂规湇鍔″晢鎻愪緵鏀寔 433=姘撮榾 434=瀹氭椂寮�鍏� diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index e93e6a7..9e2364b 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -1032,6 +1032,12 @@ /// <param name="updateBytes"></param> public void UpdataFunctionStatus(string revString, byte[] usefulBytes,bool isCloudData = false) { + ////test 浜戠杩炴帴鎴愬姛鏃讹紝涓嶉�傜敤鏈湴鏁版嵁鏇存柊 + //if (Ins.GatewayOnline_Cloud && !isCloudData) + //{ + // return; + //} + var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString); if (temp != null) { diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs index b0c260f..ea5e472 100644 --- a/HDL_ON/DAL/Mqtt/MqttClient.cs +++ b/HDL_ON/DAL/Mqtt/MqttClient.cs @@ -205,6 +205,7 @@ QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce }; + #region 鏁版嵁鏇存柊鎺ㄩ�佷富棰� //appHomeRefresh锛氫綇瀹呮暟鎹埛鏂伴�氱煡--鏉ㄦ稕 var appHomeRefresh = new MqttTopicFilter() @@ -273,6 +274,49 @@ } } } + + /// <summary> + /// 璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉 + /// </summary> + /// <returns></returns> + public static async Task<bool> SubscribeAsync3tyIotbind() + { + var topicFilter = new MqttTopicFilter() + { + Topic = $"/user/{UserInfo.Current.ID}/app/third/bind/send", + QualityOfServiceLevel = MQTTnet.Protocol.MqttQualityOfServiceLevel.AtMostOnce + }; + var result = await RemoteMqttClient.SubscribeAsync(topicFilter); + if (result.Items[0].ResultCode == MQTTnet.Client.Subscribing.MqttClientSubscribeResultCode.GrantedQoS0) + { + Utlis.WriteLine("璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉鎴愬姛锛�"); + return true; + } + return false; + } + /// <summary> + /// 鍙栨秷璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉 + /// </summary> + /// <returns></returns> + public static async Task<bool> UnsubscribeAsync3tyIotbind() + { + string[] strs = new string[] { + $"/user/{UserInfo.Current.ID}/app/third/bind/send" + }; + + var result = await RemoteMqttClient.UnsubscribeAsync(strs); + + if (result.Items[0].ReasonCode == MQTTnet.Client.Unsubscribing.MqttClientUnsubscribeResultCode.Success) + { + Utlis.WriteLine("鍙栨秷璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉鎴愬姛锛�"); + return true; + } + return false; + } + /// <summary> + /// 缁戝畾绗笁鏂瑰钩鍙版帴鏀跺洖璋冧簨浠� + /// </summary> + public static Action Bind3tyIotAction; /// <summary> /// 鍚姩杩滅▼Mqtt @@ -352,8 +396,14 @@ //鏂版尋涓嬬嚎涓婚鏂规 鏀跺埌鎸や笅绾夸富棰� ReceiveNotifySqueezeAsync(mMes); } + //缁戝畾绗笁鏂瑰钩鍙扮粨鏋滈�氱煡 + else if(topic == $"/user/{UserInfo.Current.ID}/app/third/bind/send") + { + var revString = Encoding.UTF8.GetString(e.ApplicationMessage.Payload); + Bind3tyIotAction?.Invoke(); + } //璁惧鍦ㄧ嚎绂荤嚎鐘舵�佹帹閫� - else if(topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/son/session/online") + else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/son/session/online") { try { @@ -373,7 +423,7 @@ //} } - catch(Exception ex) + catch (Exception ex) { } @@ -504,7 +554,8 @@ } HomePage.LoadEvent_RefreshSecurityStatus(); } - }catch(Exception ex) + } + catch (Exception ex) { MainPage.Log($"瀹夐槻杩滅▼淇℃伅寮傚父:{ex.Message}"); } @@ -516,29 +567,16 @@ else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/property/send") { - if (Control.Ins.GatewayOnline_Local)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞� - { - if (FunctionList.List.OtherBrandFunction.Count == 0) - { - MainPage.Log($"A鍗忚鏇存柊鐘舵��:鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�..."); - return; - } - else - { - var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); - var revString = Encoding.UTF8.GetString(bytes); - MainPage.Log($"mqtt 鐘舵�佹洿鏂�:{revString}"); - Control.Ins.UpdataFunctionStatus(revString, null, true); - //Control.Ins.MsgInfoList.Add($"mqtt 鐘舵�佹洿鏂�:{revString}"); - //Control.Ins.MsgInfoList.Add(revString + "\r\n"); - //if (FunctionList.List.OtherBrandFunction.Find((obj) => obj.sid == updateTemp.sid) == null) - //{ - // return; - //} - } - } - - + var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); + var revString = Encoding.UTF8.GetString(bytes); + MainPage.Log($"mqtt 鐘舵�佹洿鏂�:{revString}"); + Control.Ins.UpdataFunctionStatus(revString, null, true); + //Control.Ins.MsgInfoList.Add($"mqtt 鐘舵�佹洿鏂�:{revString}"); + //Control.Ins.MsgInfoList.Add(revString + "\r\n"); + //if (FunctionList.List.OtherBrandFunction.Find((obj) => obj.sid == updateTemp.sid) == null) + //{ + // return; + //} } //涓�绔彛鏁版嵁瑙f瀽 else diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index 02d3aaf..3a6d450 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -2664,16 +2664,30 @@ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyIotFunction, requestJson); return pack; } + /// <summary> + /// 鑾峰彇绗笁鏂瑰钩鍙版敮鎸佺殑璁惧绫诲瀷鍒楄〃 + /// </summary> + /// <returns></returns> + public ResponsePackNew Get3tyIotSupportSpkList(string companyId) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("companyId", companyId); + var requestJson = HttpUtil.GetSignRequestJson(d); + + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyIotFunction, requestJson); + return pack; + } /// <summary> /// 璁剧疆绗笁鏂硅澶囩粦瀹氱殑浣忓畢 /// </summary> /// <returns></returns> - public ResponsePackNew Set3tyIotFunctionToHouse(string deviceId,string homeId) + public ResponsePackNew Set3tyIotFunctionToHouse(string deviceId,string homeId, string companyId) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("deviceId", deviceId); d.Add("homeId", homeId); + d.Add("companyId", companyId); var requestJson = HttpUtil.GetSignRequestJson(d); var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Setting3tyIotFunctionToHouse, requestJson); diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index fef52b7..015e50c 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -18,8 +18,8 @@ /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> - public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm /// <summary> /// RegionMark /// </summary> diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs index e153373..bf216a1 100644 --- a/HDL_ON/DAL/Server/NewAPI.cs +++ b/HDL_ON/DAL/Server/NewAPI.cs @@ -620,7 +620,7 @@ /// <summary> /// 鑾峰彇绗笁鏂筰ot骞冲彴璁惧鍔熻兘鍒楄〃 /// </summary> - public const string Api_Post_Get3tyIotFunction = "/home-wisdom/app/open/discoveryDevice"; + public const string Api_Post_Get3tyIotFunction = "/home-wisdom/app/open/extDeviceList"; /// <summary> /// 閰嶇疆绗笁鏂筰ot骞冲彴璁惧鍔熻兘鍒颁綇瀹� /// </summary> @@ -628,7 +628,7 @@ /// <summary> /// 瑙g粦绗笁鏂筰ot骞冲彴璐﹀彿 /// </summary> - public const string Api_Post_Unbound3tyIotAccount = "/open-platform/tripartite/userUnbind"; + public const string Api_Post_Unbound3tyIotAccount = "/smart-open/open-platform/tripartite/userUnbind"; #region 鈻� -- 绾㈠瀹濇帴鍙__________________________ /// <summary> diff --git a/HDL_ON/Entity/Function/Function.cs b/HDL_ON/Entity/Function/Function.cs index 1482e07..ba20bf1 100644 --- a/HDL_ON/Entity/Function/Function.cs +++ b/HDL_ON/Entity/Function/Function.cs @@ -243,7 +243,30 @@ /// <summary> /// 澶囨敞 /// </summary> - public string name; + public string name = ""; + /// <summary> + /// 璁惧缁戝畾鐨刪omeId + /// </summary> + private string _homeId = ""; + public string homeId + { + get + { + if (string.IsNullOrEmpty(_homeId)) + { + return DB_ResidenceData.Instance.CurrentRegion.id; + } + else + { + return _homeId; + } + } + set + { + _homeId = value; + } + } + /// <summary> /// 璁惧ID /// 浜戠璐熻矗鐢熸垚 diff --git a/HDL_ON/Entity/Integratedbrand/IntegratedBrand.cs b/HDL_ON/Entity/Integratedbrand/IntegratedBrand.cs index a430895..7ba544a 100644 --- a/HDL_ON/Entity/Integratedbrand/IntegratedBrand.cs +++ b/HDL_ON/Entity/Integratedbrand/IntegratedBrand.cs @@ -87,6 +87,8 @@ /// 鍏徃id /// </summary> public string companyId; + + public string clientId; } /// <summary> diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index a40633a..6002a93 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -511,6 +511,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\iot_BindTipPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\Iot_BrandFunctionListPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\Iot_AuthorizedPage.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\Iot_SupportSpkListPage.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> diff --git a/HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs b/HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs index 63457e1..19ea6e0 100644 --- a/HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs +++ b/HDL_ON/UI/UI0-Public/Widget/WebViewDialog.cs @@ -19,6 +19,9 @@ /// </summary> public WebView mWebView; + private Action closeAction; + + /// <summary> /// WebViewDialog /// </summary> @@ -26,6 +29,14 @@ { bodyView = new FrameLayout(); } + public WebViewDialog(Action action) + { + closeAction = action; + bodyView = new FrameLayout(); + } + + + /// <summary> /// 鍔犺浇椤甸潰 @@ -34,7 +45,7 @@ { bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; this.AddChidren(bodyView); - new TopViewDiv(this, bodyView, titleStr).LoadTopView(); + new TopViewDiv(this, bodyView, titleStr).LoadTopView(closeAction); //WebView mWebView = new WebView() { diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs index 366aa1d..e3c0244 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_AuthorizedPage.cs @@ -11,11 +11,74 @@ IntegratedBrand_Iot brand_Iot; - public Iot_AuthorizedPage(IntegratedBrand_Iot brand) + Action boudedAction; + + public Iot_AuthorizedPage(IntegratedBrand_Iot brand,Action action) { brand_Iot = brand; + boudedAction = action; } + + + public void LoadView() + { + string url = brand_Iot.authorizationUrl + $"?companyId={brand_Iot.companyId}&openUId={UserInfo.Current.ID}&client_id={brand_Iot.clientId}"; + var dd = new WebViewDialog(()=> { + UnsubscribeAsync3tyIotbind(); + }); + dd.LoadPage("", url); + DAL.Mqtt.MqttClient.Bind3tyIotAction = () => { + UnsubscribeAsync3tyIotbind(); + Application.RunOnMainThread(() => + { + http.Search3tyIotDevice(brand_Iot.companyId); + boudedAction?.Invoke(); + dd.Close(); + }); + }; + SubscribeAsync3tyIotbind(); + } + + /// <summary> + /// 璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉 + /// </summary> + private void SubscribeAsync3tyIotbind() + { + new System.Threading.Thread(async () => + { + try + { + var result = await DAL.Mqtt.MqttClient.SubscribeAsync3tyIotbind(); + } + catch { } + finally + { + + } + }) + { IsBackground = true }.Start(); + } + + /// <summary> + /// 鍙栨秷璁㈤槄缁戝畾绗笁鏂筰ot璐﹀彿缁撴灉 + /// </summary> + private void UnsubscribeAsync3tyIotbind() + { + new System.Threading.Thread(async () => + { + try + { + var result = await DAL.Mqtt.MqttClient.UnsubscribeAsync3tyIotbind(); + } + catch { } + finally + { + + } + }) + { IsBackground = true }.Start(); + } /// <summary> /// 鎼滅储绗笁鏂硅澶� /// </summary> diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs index 986a5d1..56c39d1 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandFunctionListPage.cs @@ -8,8 +8,10 @@ { public class Iot_BrandFunctionListPage :FrameLayout { - FrameLayout bodyView; + + FrameLayout contentView; + IntegratedBrand_Iot brand_Iot; @@ -36,7 +38,7 @@ page.LoadPage(brand_Iot); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; - new TopViewDiv(bodyView, "鍝佺墝鍚嶇О").LoadTopView_3tyIot(action); + new TopViewDiv(bodyView, brand_Iot.brandName).LoadTopView_3tyIot(action); bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; @@ -65,16 +67,43 @@ }; bodyView.AddChidren(btnTipText); - var contentView = new VerticalRefreshLayout() + contentView = new FrameLayout() { Y = Application.GetRealHeight(150), Height = Application.GetRealHeight(573), }; bodyView.AddChidren(contentView); - LoadDeviceFunctionControlZone(contentView); - + var waitPage = new Loading(); + contentView.AddChidren(waitPage); + waitPage.Start(""); + new System.Threading.Thread(() => + { + try + { + var pack = http.Get3tyIotDeviceFunctionList(brand_Iot.companyId); + if (pack != null) + { + if (pack.Code == StateCode.SUCCESS) + { + var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Function>>(pack.Data.ToString()); + Application.RunOnMainThread(() => + { + LoadDeviceFunctionControlZone(list); + }); + } + } + } + catch { } + finally + { + Application.RunOnMainThread(() => { + waitPage.Hide(); + waitPage.RemoveFromParent(); + }); + } + }) { IsBackground = true }.Start(); } @@ -82,26 +111,32 @@ /// <summary> /// 鍔犺浇璁惧鍔熻兘鏄剧ず鍖哄煙 /// </summary> - void LoadDeviceFunctionControlZone(VerticalRefreshLayout deviceFunctionView) + void LoadDeviceFunctionControlZone(List<Function> list) { + contentView.RemoveAll(); + + if (list.Count == 0) + { + NotListTipView(); + return; + } + + VerticalScrolViewLayout deviceFunctionView = new VerticalScrolViewLayout(); + contentView.AddChidren(deviceFunctionView); + #region ContextView var rowView = new FrameLayout(); try { int index = 0; - var list = new List<Function>(); - list.Add(new Function - { - spk = SPK.AcStandard, - name = "绌鸿皟" - }); - list.Add(new Function - { - spk = SPK.LightDimming, - name = "鐏厜" - }); + foreach (var function in list) { + if(function.homeId != DB_ResidenceData.Instance.CurrentRegion.id && function.homeId != "0") + { + continue; + } + if (index % 2 == 0) { rowView = new FrameLayout() @@ -143,24 +178,14 @@ var view = new FrameLayout(); deviceFunctionView.AddChidren(view); - var btnNoCollectionBg = new Button() - { - Y = Application.GetRealHeight(20), - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(180), - Height = Application.GetRealWidth(180), - Text = "娌℃湁浠讳綍璁惧" - }; - view.AddChidren(btnNoCollectionBg); - var btnNoCollectionTip = new Button() { Height = Application.GetRealHeight(42), - Y = btnNoCollectionBg.Bottom, + Y = Application.GetRealHeight(100), TextAlignment = TextAlignment.Center, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - TextID = StringId.TipNoFunctionCollcetion, + Text = "娌℃湁浠讳綍璁惧" }; view.AddChidren(btnNoCollectionTip); } @@ -215,20 +240,25 @@ function.collect = !function.collect; if (function.collect) { - btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = true; - var pack = http.Set3tyIotFunctionToHouse(function.deviceId, DB_ResidenceData.Instance.CurrentRegion.id); + var pack = http.Set3tyIotFunctionToHouse(function.deviceId, DB_ResidenceData.Instance.CurrentRegion.id,brand_Iot.companyId); if (pack != null) { - + if(pack.Code == StateCode.SUCCESS) + { + btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = true; + } } } else { btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = false; - var pack = http.Set3tyIotFunctionToHouse(function.deviceId, "0"); + var pack = http.Set3tyIotFunctionToHouse(function.deviceId, "0", brand_Iot.companyId); if (pack != null) { - + if (pack.Code == StateCode.SUCCESS) + { + btnName.IsSelected = btnIcon.IsSelected = btnBg.IsSelected = false; + } } } @@ -242,6 +272,59 @@ } + void NotListTipView() + { + contentView.RemoveAll(); + var btnTip = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(88), + Width = Application.GetRealWidth(180), + Height = Application.GetRealWidth(180), + UnSelectedImagePath = "TipNot.png", + }; + contentView.AddChidren(btnTip); + + var btnTipText = new Button() + { + Y = Application.GetRealHeight(252), + Height = Application.GetRealHeight(52), + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.Center, + TextID = StringId.TipNotThirdPartyDevice, + }; + contentView.AddChidren(btnTipText); + + var btnAdd = new Button() + { + Y = Application.GetRealHeight(400), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(220), + Height = Application.GetRealWidth(44), + BackgroundColor = CSS_Color.MainColor, + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainBackgroundColor, + TextSize = CSS_FontSize.SubheadingFontSize, + IsBold = true, + Radius = (uint)Application.GetRealWidth(22), + BorderColor = 0x00000000, + BorderWidth = 0, + Text = "鏌ョ湅璁惧鏀寔鑼冨洿" + }; + contentView.AddChidren(btnAdd); + btnAdd.MouseUpEventHandler = (sender, e) => + { + //var page = new AddThirdPartyBrandListpage(brandList); + //MainPage.BasePageView.AddChidren(page); + //page.LoadPage(); + //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + + + } + HttpServerRequest http = new HttpServerRequest(); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandListPage.cs index f1091a7..32531d7 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandListPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_BrandListPage.cs @@ -14,7 +14,7 @@ { FrameLayout bodyView; - VerticalRefreshLayout contentView; + VerticalScrolViewLayout contentView;//VerticalRefreshLayout List<IntegratedBrand_Iot> brandList; @@ -56,7 +56,7 @@ }; bodyView.AddChidren(btnTipText); - contentView = new VerticalRefreshLayout() + contentView = new VerticalScrolViewLayout() { Y = Application.GetRealHeight(150), Height = Application.GetRealHeight(573), @@ -68,14 +68,11 @@ GetBindList(); - contentView.BeginHeaderRefreshingAction = () => - { - contentView.EndHeaderRefreshing(); - GetBindList(); - }; - - LoadRow(); - + //contentView.BeginHeaderRefreshingAction = () => + //{ + // contentView.EndHeaderRefreshing(); + // GetBindList(); + //}; } /// <summary> @@ -130,14 +127,12 @@ void LoadRow() { contentView.RemoveAll(); - bool isFrist = true; - - brandList.Add(new IntegratedBrand_Iot - { - authBrandNameCn = "Test Hdl", - authBrandNameEn = "Test Hdl", - hasAuthorization = false - }); + //brandList.Add(new IntegratedBrand_Iot + //{ + // authBrandNameCn = "Test Hdl", + // authBrandNameEn = "Test Hdl", + // hasAuthorization = false + //}); foreach (var brand in brandList) { @@ -149,22 +144,15 @@ }; contentView.AddChidren(row); - //if (isFrist) - //{ - // isFrist = false; - //} - //else + Button btnLine = new Button() { - Button btnLine = new Button() - { - Y = Application.GetRealWidth(86), - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(343), - Height = 1, - BackgroundColor = CSS_Color.DividingLineColor, - }; - row.AddChidren(btnLine); - } + Y = Application.GetRealWidth(86), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = 1, + BackgroundColor = CSS_Color.DividingLineColor, + }; + row.AddChidren(btnLine); ImageView btnIcon = new ImageView() { @@ -209,7 +197,7 @@ }; row.AddChidren(btnName); //涓嬭浇绗笁鏂瑰搧鐗宨con - //ImageUtlis.Current.Load3tyBrandIconImages(brand.brandName, brand.authrBandIconUrl, btnIcon); + ImageUtlis.Current.Load3tyBrandIconImages(brand.brandName, brand.authrBandIconUrl, btnIcon); btnName.MouseUpEventHandler = (sender, e) => { if (brand.hasAuthorization) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_SupportSpkListPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_SupportSpkListPage.cs new file mode 100644 index 0000000..eadaa43 --- /dev/null +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/Iot_SupportSpkListPage.cs @@ -0,0 +1,26 @@ +锘縰sing System; +using HDL_ON.Entity; +using Shared; + +namespace HDL_ON.UI +{ + /// <summary> + /// 鏀寔鐨勭涓夋柟骞冲彴璁惧鍒楄〃鐣岄潰 + /// </summary> + public class Iot_SupportSpkListPage : FrameLayout + { + private FrameLayout bodyView; + + IntegratedBrand_Iot brand_Iot; + + public Iot_SupportSpkListPage() + { + bodyView = this; + } + + public void LoadPage() + { + + } + } +} \ No newline at end of file diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/iot_BindTipPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/iot_BindTipPage.cs index 668e511..601da76 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/iot_BindTipPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/iot_BindTipPage.cs @@ -139,14 +139,23 @@ { btnComfirm.MouseUpEventHandler = (sender, e) => { - brand_Iot.hasAuthorization = true; - boundAction?.Invoke(); - this.RemoveFromParent(); - var page = new Iot_BrandFunctionListPage(brand_Iot); - page.unboundAction = unboundAction; - MainPage.BasePageView.AddChidren(page); - page.LoadPage(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + + Action action = () => { + brand_Iot.hasAuthorization = true; + boundAction?.Invoke(); + this.RemoveFromParent(); + var page = new Iot_BrandFunctionListPage(brand_Iot); + page.unboundAction = unboundAction; + MainPage.BasePageView.AddChidren(page); + page.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + var page = new Iot_AuthorizedPage(brand_Iot,action); + page.LoadView(); + + + }; } else @@ -239,6 +248,11 @@ }); } } + else + { + dialog.Close(); + new Alert("", "鎿嶄綔澶辫触", "").Show(); + } } catch { } finally diff --git a/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs index 9455d9a..495e602 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs @@ -174,20 +174,28 @@ echartsView.AddChidren(myEchartsView_Pie); Dictionary<string, string> list = new Dictionary<string, string>(); + + int count = 0; foreach(var ene in energyList) { + if (count > 10) + { + break; + } double tt = 0; double.TryParse(ene.GetAttrState(FunctionAttributeKey.TotalElectricity), out tt); tt *= 100;//涔樹互100锛屽皬浜�1鏃犳硶鍔犺浇echart tt = Math.Round(tt, 2); - if (list.ContainsKey(ene.name)) + string key = ene.name; + if (list.ContainsKey(key)) { - list.Add(ene.name + "1", tt.ToString()); + list.Add(ene.name + DateTime.Now.ToLongTimeString(), tt.ToString()); } else { list.Add(ene.name, tt.ToString()); } + count++; } myEchartsView_Pie.ShowWithOption(new EchartsOption_Pie().InitDateJson(list)); @@ -219,6 +227,10 @@ int index = 0; foreach (var energy in energyList) { + if (index > 10) + { + break; + } EnergyRow(energy, energyListView, index); index++; new System.Threading.Thread(() => @@ -562,8 +574,14 @@ double totalValue = 0; double realtimeValue = 0; Dictionary<string, string> list = new Dictionary<string, string>();//楗煎浘鏁版嵁 + int count = 0; foreach (var ene in bodyView.energyList) { + if (count > 10) + { + break; + } + count++; double power = 0.00; double.TryParse(ene.GetAttrState(FunctionAttributeKey.TotalElectricity), out power); power = Math.Round(power, 2); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs index 8c6bab8..556e3e1 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPage.cs @@ -157,6 +157,7 @@ framePickerBack.Y = btnFromFoorAndRoom.Bottom + Application.GetRealHeight(1); framePickerBack.Width = Application.GetMinRealAverage(216); framePickerBack.Height = Application.GetMinRealAverage(216); + //framePickerBack.BackgroundColor = 0xFFFF0000; controlView.AddChidren(framePickerBack); colorPicker = new ColorPicker() @@ -177,10 +178,17 @@ //}; //鐧界偣鎺т欢 - this.btnWhiteRound = new Button(); - btnWhiteRound.Width = Application.GetRealWidth(24); - btnWhiteRound.Height = Application.GetRealWidth(24); - btnWhiteRound.UnSelectedImagePath = "FunctionIcon/Light/ColorWheelTip.png"; + var diameter = Application.GetRealWidth(12); + this.btnWhiteRound = new Button() + { + Width = diameter, + Height = diameter, + Radius = (uint)Application.GetRealWidth(6), + BorderWidth = (uint)Application.GetRealWidth(1), + BorderColor = CSS_Color.MainBackgroundColor, + Enable = false, + }; + //btnWhiteRound.UnSelectedImagePath = "FunctionIcon/Light/ColorWheelTip.png"; btnWhiteRound.Visible = false; framePickerBack.AddChidren(btnWhiteRound); diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs index b45f539..8dbdfa5 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Light/RGBPageBLL.cs @@ -104,7 +104,7 @@ //褰撳墠鐐瑰嚮鐨勩�愮偣銆戞槸鍚︽纭� bool pointIsRight = false; //鍦嗙殑鍗婂緞(鑰冭檻杈圭晫,闇�瑕佽缃畠鐨勫崐寰勬瘮杈冨皬涓�鐐�) - int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12); + int circleR = colorPicker.Width / 2 - Application.GetRealWidth(2); colorPicker.ColorChaged += (sender2, e2) => { if (function.trait_on_off.curValue.ToString() == "off" || pointIsRight == false) diff --git a/SiriIntents/Server/HttpUtil.cs b/SiriIntents/Server/HttpUtil.cs index f61de04..56a78a0 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";//mmmm + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm /// <summary> /// RegionMark /// </summary> -- Gitblit v1.8.0