From dd7e4794fd611de967c6322dd0bb7ffda41c2f7b Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 29 十一月 2021 16:32:55 +0800 Subject: [PATCH] 增加了安防相关功能 --- SiriIntents/Server/IMessageCommon.cs | 151 + SiriIntents/SiriIntents.csproj | 19 SiriKit/SiriKit.csproj | 4 HDL-ON_Android/Assets/Language.ini | 3 HDL-ON_iOS/HDL-ON_iOS.csproj | 10 HDL_ON/Entity/Function/SecurityAlarm.cs | 63 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs | 72 SiriIntentsUI/IntentViewController.cs | 25 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs | 194 + HDL-ON_iOS/AppDelegate.cs | 43 HDL_ON/HDL_ON.projitems | 1 SiriIntentsUI/MainInterface.storyboard | 17 HDL-ON_iOS/Resources/Language.ini | 3 SiriIntents/HDLRunSceneIntentHandlder.cs | 107 + SiriIntentsUI/Entitlements.plist | 2 HDL_ON/Common/HDLCommon.cs | 7 SiriIntents/Server/HttpServerRequest.cs | 101 + SiriIntents/packages.config | 5 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferingResidencePage.cs | 10 SiriIntents/IntentHandler.cs | 170 .vs/HDL_APP_Project/xs/UserPrefs.xml | 60 SiriIntentsUI/SiriIntentsUI.csproj | 11 HDL_ON/UI/UI1-Login/LoginPage.cs | 6 SiriIntents/Server/NewApiRes.cs | 1510 ++++++++++++++++ HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs | 127 SiriIntents/Server/HttpUtil.cs | 412 ++++ SiriKit/Data/SceneDateManager.cs | 94 SiriIntents/Server/NewAPI.cs | 756 ++++++++ HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs | 229 ++ SiriKit/Data/NSUserDefaultsHelper.cs | 8 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs | 7 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs | 5 HDL_ON/UI/UI1-Login/LoginPageBLL.cs | 5 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs | 196 ++ HDL-ON_iOS/Other/SkipControl.cs | 15 /dev/null | 93 - HDL_ON/DAL/Server/HttpUtil.cs | 5 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs | 11 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs | 8 SiriIntentsUI/IntentViewController.designer.cs | 9 HDL_ON/Common/R.cs | 4 HDL_ON/DAL/Server/HttpServerRequest.cs | 132 SiriKit/Data/DataManager.cs | 330 +- HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs | 342 ++- 44 files changed, 4,518 insertions(+), 864 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index 6aac51d..1c65ebd 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -3,23 +3,62 @@ <MonoDevelop.MacDev.AppleDevelopmentTeam /> </MonoDevelop.Ide.ItemProperties.SiriIntentUI> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.6242be7109c740c6cb8999a8904b6e0ea8d45192" /> - <MonoDevelop.Ide.Workbench ActiveDocument="SiriKit/SiriScene.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs"> <Files> - <File FileName="SiriKit/HDLRunSceneIntentHandlder.cs" Line="13" Column="29" /> - <File FileName="HDL_ON/DAL/Server/HttpServerRequest.cs" /> - <File FileName="HDL_ON/Entity/Function/SecurityAlarm.cs" /> - <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" /> - <File FileName="SiriKit/Data/SceneDateManager.cs" /> - <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" /> - <File FileName="SiriKit/Support/NSUserActivityHelper.cs" Line="11" Column="13" /> - <File FileName="SiriKit/SiriScene.cs" Line="8" Column="23" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs" Line="9" Column="40" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs" Line="51" Column="35" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs" Line="112" Column="75" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs" Line="282" Column="55" /> + <File FileName="HDL_ON/UI/UI0-Public/PublicAssmebly.cs" Line="593" Column="55" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs" Line="192" Column="15" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/InputPushText.cs" Line="83" Column="24" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs" Line="85" Column="66" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs" Line="458" Column="45" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs" Line="213" Column="55" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmDeploymentSettingPage.cs" Line="1" Column="1" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs" Line="465" Column="12" /> + <File FileName="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs" Line="433" Column="17" /> + <File FileName="HDL_ON/Entity/Function/SecurityAlarm.cs" Line="138" Column="29" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> + <Node name="HDL_ON" expanded="True"> + <Node name="Common" expanded="True"> + <Node name="Utlis" expanded="True" /> + </Node> + <Node name="Entity" expanded="True"> + <Node name="Function" expanded="True" /> + </Node> + <Node name="UI" expanded="True"> + <Node name="UI0-Public" expanded="True" /> + <Node name="UI2" expanded="True"> + <Node name="2-Classification" expanded="True" /> + <Node name="3-Intelligence" expanded="True"> + <Node name="Automation" expanded="True" /> + <Node name="Scene" expanded="True" /> + </Node> + <Node name="FuntionControlView" expanded="True"> + <Node name="ArmCenter" expanded="True"> + <Node name="PushConfigPage.cs" selected="True" /> + </Node> + </Node> + </Node> + </Node> + </Node> + <Node name="HDL-ON_Android" expanded="True"> + <Node name="Assets" expanded="True" /> + </Node> + <Node name="HDL-ON_iOS" expanded="True"> + <Node name="Resources" expanded="True" /> + </Node> + <Node name="SiriIntents" expanded="True" /> + <Node name="SiriIntentsUI" expanded="True"> + <Node name="IntentViewController.cs" expanded="True" /> + </Node> <Node name="SiriKit" expanded="True"> - <Node name="SiriScene.cs" selected="True" /> + <Node name="Base.lproj" expanded="True" /> </Node> </Node> </State> @@ -47,6 +86,7 @@ <BreakpointStore> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HdlSiriKit/SkipControl.cs" relfile="HdlSiriKit/SkipControl.cs" line="28" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HdlSiriKit/SkipControl.cs" relfile="HdlSiriKit/SkipControl.cs" line="14" column="1" /> + <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs" line="366" column="1" /> </BreakpointStore> </MonoDevelop.Ide.DebuggingService.Breakpoints> <MultiItemStartupConfigurations /> diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index df14822..0bed10a 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -500,6 +500,7 @@ 512=Message push is not enabled, please go to settings. 513=Please enter the pairing code 514=Gateway location information is not configured +515=Add Security 1000=Room Humidity 1001=V-chip @@ -1620,7 +1621,7 @@ 512=娑堟伅鎺ㄩ�佹湭寮�鍚紝璇峰墠寰�璁剧疆銆� 513=璇疯緭鍏ラ厤瀵圭爜 514=鏈厤缃綉鍏充綅缃俊鎭� - +515=娣诲姞瀹夐槻 1000=瀹ゅ唴婀垮害 1001=绔ラ攣 diff --git a/HDL-ON_iOS/AppDelegate.cs b/HDL-ON_iOS/AppDelegate.cs index 4568b86..db00116 100644 --- a/HDL-ON_iOS/AppDelegate.cs +++ b/HDL-ON_iOS/AppDelegate.cs @@ -10,7 +10,6 @@ using HDL_ON.UI; using HDL_ON.DAL.Server; using Intents; -using Other.Siri; namespace SharedMethod { @@ -450,48 +449,6 @@ HDL_ON.DriverLayer.Control.Ins.SearchLoaclGateway(); } - - - - public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) - { - var intent = userActivity.GetInteraction()?.Intent as HDLSceneSiri.HDLRunSceneIntent; - if (!(intent is null)) - { - HandleIntent(intent); - return true; - } - else if (userActivity.ActivityType == NSUserActivityHelper.ViewMenuActivityType) - { - HandleUserActivity(); - return true; - } - return false; - } - - void HandleIntent(HDLSceneSiri.HDLRunSceneIntent intent) - { - var handler = new SiriKit.HDLRunSceneIntentHandlder(); - handler.HandleRunScene(intent, (response) => { - if (response.Code != HDLSceneSiri.HDLRunSceneIntentResponseCode.Success) - { - Console.WriteLine("Siri鎵ц澶辫触銆�"); - } - }); - } - - void HandleUserActivity() - { - //var rootViewController = Window?.RootViewController as UINavigationController; - //var orderHistoryViewController = rootViewController?.ViewControllers?.FirstOrDefault() as OrderHistoryTableViewController; - //if (orderHistoryViewController is null) - //{ - // Console.WriteLine("Failed to access OrderHistoryTableViewController."); - // return; - //} - //var segue = OrderHistoryTableViewController.SegueIdentifiers.SoupMenu; - //orderHistoryViewController.PerformSegue(segue, null); - } } diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index 78772e7..941ee2a 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -56,7 +56,7 @@ <MtouchLink>SdkOnly</MtouchLink> <MtouchExtraArgs>-gcc_flags="-dead_strip -ObjC"</MtouchExtraArgs> <MtouchEnableSGenConc>false</MtouchEnableSGenConc> -<CodesignProvision>OnPro211116-1</CodesignProvision> +<CodesignProvision>OnPro211125-1-Dev</CodesignProvision> <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> @@ -117,19 +117,19 @@ <Version>13.0.1</Version> </PackageReference> <PackageReference Include="MQTTnet"> - <Version>3.0.16</Version> + <Version>3.1.0</Version> </PackageReference> <PackageReference Include="Microsoft.AppCenter.Analytics"> - <Version>4.3.0</Version> + <Version>4.4.0</Version> </PackageReference> <PackageReference Include="Microsoft.AppCenter.Crashes"> - <Version>4.3.0</Version> + <Version>4.4.0</Version> </PackageReference> <PackageReference Include="ZXing.Net.Mobile"> <Version>2.4.1</Version> </PackageReference> <PackageReference Include="RestSharp"> - <Version>106.12.0</Version> + <Version>106.13.0</Version> </PackageReference> <PackageReference Include="Xamarin.iOS.Bugly"> <Version>1.0.4</Version> diff --git a/HDL-ON_iOS/Other/SkipControl.cs b/HDL-ON_iOS/Other/SkipControl.cs index 59928ac..f320b4d 100644 --- a/HDL-ON_iOS/Other/SkipControl.cs +++ b/HDL-ON_iOS/Other/SkipControl.cs @@ -21,6 +21,8 @@ //HDL_ON_iOS.AppDelegate.rootViewController.PushViewController(user, true); + var sDM = new SiriKit.SceneDateManager(); + Console.WriteLine($"IsLogin:{sDM.IsLgoin};accessToken:{sDM.AccessToken};refreshToken:{sDM.RefreshToken};RegionUrl:{sDM.RegionUrl};HomeId:{sDM.HomeId}"); NSMutableArray list = new NSMutableArray(); foreach (var localScene in HDL_ON.Entity.FunctionList.List.scenes) @@ -38,13 +40,14 @@ HDL_ON_iOS.AppDelegate.rootViewController.PushViewController(vc, true); } - public void SetData(bool isLogin, string accessToken, string refreshToken, string regionUrl) + public void SetData(bool isLogin, string accessToken, string refreshToken, string regionUrl, string homeId) { - var sDM = new Other.Siri.SceneDateManager(); - sDM.SetIsLoginValue(isLogin); - sDM.SetAccessTokenValue(accessToken); - sDM.SetRefreshTokenValue(refreshToken); - sDM.SetRegionUrlValue(regionUrl); + var sDM = new SiriKit.SceneDateManager(); + sDM.IsLgoin = isLogin; + sDM.AccessToken = accessToken; + sDM.RefreshToken = refreshToken; + sDM.RegionUrl = regionUrl; + sDM.HomeId = homeId; } } } diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini index df14822..0bed10a 100644 --- a/HDL-ON_iOS/Resources/Language.ini +++ b/HDL-ON_iOS/Resources/Language.ini @@ -500,6 +500,7 @@ 512=Message push is not enabled, please go to settings. 513=Please enter the pairing code 514=Gateway location information is not configured +515=Add Security 1000=Room Humidity 1001=V-chip @@ -1620,7 +1621,7 @@ 512=娑堟伅鎺ㄩ�佹湭寮�鍚紝璇峰墠寰�璁剧疆銆� 513=璇疯緭鍏ラ厤瀵圭爜 514=鏈厤缃綉鍏充綅缃俊鎭� - +515=娣诲姞瀹夐槻 1000=瀹ゅ唴婀垮害 1001=绔ラ攣 diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs index 6502c89..0d45ee0 100644 --- a/HDL_ON/Common/HDLCommon.cs +++ b/HDL_ON/Common/HDLCommon.cs @@ -428,7 +428,7 @@ HDLLinphone.Current.LogoutAllAccount(); #if __IOS__ //5.娓呯┖Siri鍏变韩鏁版嵁淇℃伅 - new Other.SkipControl().SetData(false, "", "", ""); + new Other.SkipControl().SetData(false, "", "", "",""); #endif } catch (Exception ex) @@ -487,6 +487,11 @@ } MainPage.CurPageIndex = 9999; MainPage.UserBasePage.ChooseCollection(); +#if __IOS__ + var sdm = new SiriKit.SceneDateManager(); + sdm.RegionUrl = DB_ResidenceData.Instance.CurrentRegion.regionUrl; + sdm.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; +#endif } } //Dialog diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index b4a8bf3..17011cb 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -6,6 +6,10 @@ { /// <summary> + /// 娣诲姞瀹夐槻 + /// </summary> + public const int AddSecurity = 515; + /// <summary> /// 鏈厤缃綉鍏冲湴鍧�淇℃伅 /// </summary> public const int GatewayLocationInformationIsNotConfigured = 514; diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index 9b3d424..2414895 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -45,13 +45,13 @@ /// <param name="deviceId">璁惧ID</param> /// <param name="deviceKey">鍔熻兘鏌ヨ绫诲瀷锛歱m25</param> /// <returns></returns> - public ResponsePackNew GetSensorHistory(string qType, string deviceId,string deviceKey) + public ResponsePackNew GetSensorHistory(string qType, string deviceId, string deviceKey) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("type", qType); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); - d.Add("deviceId", deviceId ); - d.Add("key", deviceKey ); + d.Add("deviceId", deviceId); + d.Add("key", deviceKey); var requestJson = HttpUtil.GetSignRequestJson(d); return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson); @@ -63,7 +63,7 @@ /// <param name="pageSize">椤甸潰澶у皬</param> /// <param name="pageNo">椤靛彿</param> /// <returns></returns> - public ResponsePackNew GetArmSensorHistory( string deviceId,string pageSize, string pageNo) + public ResponsePackNew GetArmSensorHistory(string deviceId, string pageSize, string pageNo) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); @@ -78,7 +78,7 @@ /// 璇诲彇鏈�杩戜竴涓湀鐨勬暟鎹� /// </summary> /// <returns></returns> - public ResponsePackNew GetLastMonthHistory(string deviceId,string key) + public ResponsePackNew GetLastMonthHistory(string deviceId, string key) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); @@ -146,6 +146,12 @@ UserInfo.Current.RefreshToken = revertData.refreshToken; UserInfo.Current.LastTime = DateTime.Now; UserInfo.Current.SaveUserInfo(); + +#if __IOS__ + var sdm = new SiriKit.SceneDateManager(); + sdm.AccessToken = UserInfo.Current.LoginTokenString; + sdm.RefreshToken = UserInfo.Current.RefreshToken; +#endif } return revertObj.Code; } @@ -234,7 +240,19 @@ account = account, loginPwd = password }); - return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson); + var pack = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson); + if (pack != null) + { + if (pack.Code == StateCode.SUCCESS) + { + +#if __IOS__ + var sdm = new SiriKit.SceneDateManager(); + sdm.IsLgoin = true; +#endif + } + } + return pack; } /// <summary> @@ -251,7 +269,19 @@ verifyCode = vCode, grantType = "verify" }); - return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson); + var pack = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson); + if (pack != null) + { + if (pack.Code == StateCode.SUCCESS) + { + +#if __IOS__ + var sdm = new SiriKit.SceneDateManager(); + sdm.IsLgoin = true; +#endif + } + } + return pack; } /// <summary> @@ -264,7 +294,7 @@ /// <returns></returns> public ResponsePackNew ValidataCodeAndRegister(string account, string password, string code, bool isPhone = false) { - var requestObj = new RegisterObj() { loginPwd = password, verifyCode = code};//, memberName = account + var requestObj = new RegisterObj() { loginPwd = password, verifyCode = code };//, memberName = account if (isPhone) { requestObj.memberPhone = account; @@ -345,7 +375,7 @@ UserInfo.Current.userEmailInfo = info.memberEmail; UserInfo.Current.userMobileInfo = info.memberPhone; UserInfo.Current.userName = info.memberName; - + if (!string.IsNullOrEmpty(info.memberPhonePrefix)) { UserInfo.Current.areaCode = info.memberPhonePrefix; @@ -482,7 +512,7 @@ /// <summary> /// 鑾峰彇浣忓畢鍒楄〃 /// </summary> - public string GetHomePager(HomeTypeEnum homeType = HomeTypeEnum.ALL,string homeId = "") + public string GetHomePager(HomeTypeEnum homeType = HomeTypeEnum.ALL, string homeId = "") { var requestJson = HttpUtil.GetSignRequestJson(new GetHomeListObj() { homeType = homeType.ToString() }); var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Gethomepager, requestJson); @@ -510,7 +540,7 @@ } } } - if(UserInfo.Current.regionList.Count== 0) + if (UserInfo.Current.regionList.Count == 0) { return "null"; } @@ -553,6 +583,12 @@ GetHomeGatewayList(); } } + +#if __IOS__ + var sdm = new SiriKit.SceneDateManager(); + sdm.RegionUrl = DB_ResidenceData.Instance.CurrentRegion.regionUrl; + sdm.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; +#endif } } @@ -598,10 +634,6 @@ var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_GetGatewayList, requestJson); if (revertObj.Code == StateCode.SUCCESS) { -#if __IOS__ - //鍒锋柊siri瑕佺敤鐨勬暟鎹� - new Other.SkipControl().SetData(true, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, DB_ResidenceData.Instance.CurrentRegion.regionUrl); -#endif var mHomeGatewayRes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HomeGatewayInfo>>(revertObj.Data.ToString()); if (nowhomeId == DB_ResidenceData.Instance.CurrentRegion.id) { @@ -789,7 +821,7 @@ return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Share_GetList, requestJson); } - + #endregion ///// <summary> @@ -938,7 +970,7 @@ Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("debugPerm", debugPerm); - var jsonString = HttpUtil.GetSignRequestJson(d,d); + var jsonString = HttpUtil.GetSignRequestJson(d, d); var pack = HttpUtil.RequestHttpsPost(NewAPI.API_Post_Home_UpdateDebugPerm, jsonString); return pack; } @@ -997,7 +1029,8 @@ isProduce = false; #endif - if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) { + if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) + { Utlis.WriteLine("PushDeviceToken 涓虹┖"); return false; } @@ -1008,7 +1041,7 @@ deviceName = OnAppConfig.Instance.PhoneName, deviceType = deviceType, produce = isProduce, - + }; mAddpushinfoObj.languageType = Utlis.GetPostLanguageType(); @@ -1031,11 +1064,11 @@ OnAppConfig.Instance.PushId = pushId; OnAppConfig.Instance.SaveConfig(); Utlis.WriteLine("PushId: " + pushId); - + return true; } } - + } else { @@ -1119,10 +1152,11 @@ if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false; try { - var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj() { + var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj() + { pushId = OnAppConfig.Instance.PushId }); - + var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_DeleteToken, requestJson); if (revertObj.Code == StateCode.SUCCESS) { @@ -1307,9 +1341,9 @@ -#endregion + #endregion -#region 鑾峰彇澶╂皵閮ㄥ垎 + #region 鑾峰彇澶╂皵閮ㄥ垎 /// <summary> /// 鑾峰彇鎸囧畾缁忕含搴︾殑鍩庡競淇℃伅澶╂皵淇℃伅 /// </summary> @@ -1430,10 +1464,10 @@ //} -#endregion + #endregion -#region 澶囦唤閮ㄥ垎 + #region 澶囦唤閮ㄥ垎 ///// <summary> ///// 鑾峰彇浣忓畢澶囦唤鍒楄〃 ///// </summary> @@ -1904,10 +1938,10 @@ } */ -#endregion + #endregion -#region Kaede --璁惧鍔熻兘鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�� + #region Kaede --璁惧鍔熻兘鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�� /// <summary> /// 鑾峰彇璁惧鍒楄〃 /// </summary> @@ -1951,14 +1985,14 @@ /// <param name="productPlatform"></param> /// <param name="productBrand"></param> /// <returns></returns> - public ResponsePackNew Get3TyBrandDeviceList(string productPlatform,string productBrand) + public ResponsePackNew Get3TyBrandDeviceList(string productPlatform, string productBrand) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("categoryType", 1); d.Add("productPlatform", productPlatform); d.Add("productBrand", productBrand); d.Add("networkConfig", true); - + var requestJson = HttpUtil.GetSignRequestJson(d); return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyBrandDevcieList, requestJson); } @@ -1968,7 +2002,7 @@ /// <param name="productPlatform"></param> /// <param name="productBrand"></param> /// <returns></returns> - public ResponsePackNew IndependentRegister3TyDevcie(string spk,string extDevId,string deviceName,string pairCode = "") + public ResponsePackNew IndependentRegister3TyDevcie(string spk, string extDevId, string deviceName, string pairCode = "") { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); @@ -2078,7 +2112,7 @@ /// <summary> /// 璁惧缁戝畾鎴块棿 /// </summary> - public ResponsePackNew BindDeviceToRoom(List<string> deviceIds,List<string> roomIds) + public ResponsePackNew BindDeviceToRoom(List<string> deviceIds, List<string> roomIds) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); @@ -2121,7 +2155,7 @@ { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); - d.Add("deviceIds",new List<string>() { deviceId }); + d.Add("deviceIds", new List<string>() { deviceId }); var requestJson = HttpUtil.GetSignRequestJson(d); return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CollectDevice, requestJson); @@ -2139,9 +2173,9 @@ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectDevice, requestJson); } -#endregion + #endregion -#region Kaede --鍦烘櫙鍔熻兘-------------------------- + #region Kaede --鍦烘櫙鍔熻兘-------------------------- /// <summary> /// 鑾峰彇鍦烘櫙鍒楄〃 /// 鎴块棿ID鍙┖锛岄粯璁ゆ煡璇綇瀹呬笅鎵�鏈夋埧闂� @@ -2168,7 +2202,7 @@ public ResponsePackNew GetSceneInfo(string seceneId) { Dictionary<string, object> d = new Dictionary<string, object>(); - d.Add("userSceneIds",new List<string>() { seceneId }); + d.Add("userSceneIds", new List<string>() { seceneId }); var requestJson = HttpUtil.GetSignRequestJson(d); return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneInfo, requestJson); @@ -2273,9 +2307,9 @@ var requestJson = HttpUtil.GetSignRequestJson(d); return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectScene, requestJson).Code; } -#endregion + #endregion -#region Kaede --鎴块棿鍔熻兘-------------------------- + #region Kaede --鎴块棿鍔熻兘-------------------------- /// <summary> /// 鑾峰彇鎴块棿鍒楄〃 /// </summary> @@ -2292,7 +2326,7 @@ d.Add("pageSize", "1000"); var requestJson = HttpUtil.GetSignRequestJson(d); var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetRoomList, requestJson); - + return pack; } /// <summary> @@ -2350,10 +2384,10 @@ return pack; } -#endregion + #endregion -#region Kaede -- 瀹夐槻鎺ュ彛____________________________ + #region Kaede -- 瀹夐槻鎺ュ彛____________________________ /// <summary> /// 鑾峰彇瀹夐槻鍒楄〃 /// </summary> @@ -2493,7 +2527,7 @@ /// <summary> /// 鏌ヨ瀹夐槻鎵�鏈夎褰� /// </summary> - public ResponsePackNew GetSecurityLogList(string pageSize,string pageNo) + public ResponsePackNew GetSecurityLogList(string pageSize, string pageNo) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); @@ -2517,10 +2551,10 @@ return pack; } -#endregion + #endregion -#region Kaede --绗笁鏂瑰搧鐗屽姛鑳�-------------------------- + #region Kaede --绗笁鏂瑰搧鐗屽姛鑳�-------------------------- /// <summary> /// 鑾峰彇绗笁鏂瑰搧鐗屽垪琛� /// </summary> @@ -2545,9 +2579,9 @@ return pack; } -#endregion + #endregion -#region 鈻� 钀ょ煶浜慡DK鐩稿叧鎺ュ彛_________________________ + #region 鈻� 钀ょ煶浜慡DK鐩稿叧鎺ュ彛_________________________ /// <summary> /// 娌充笢鑾峰彇钀ょ煶浜戝瓙璐﹀彿token鐨勬帴鍙� /// 2021-07-07 鏂版柟妗堟帴鍙h皟鏁村鎺� @@ -2573,7 +2607,7 @@ Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); var requestJson = HttpUtil.GetSignRequestJson(d); - var pack = HttpUtil.RequestHttpsPostFroHome( NewAPI.API_POST_FL_Check, requestJson); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_FL_Check, requestJson); return pack; } #endregion @@ -2735,7 +2769,7 @@ public ResponsePackNew FaceSetting(string imageBytes) { Dictionary<string, object> d = new Dictionary<string, object>(); - d.Add("userFace", @"data:image/jpg;base64,"+imageBytes); + d.Add("userFace", @"data:image/jpg;base64," + imageBytes); d.Add("houseId", DB_ResidenceData.Instance.CurrentRegion.id); //MainPage.Log(imageBytes); diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index cf4a06a..6c692b6 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -299,6 +299,11 @@ UserInfo.Current.LastTime = DateTime.Now; UserInfo.Current.SaveUserInfo(); return true; +#if __IOS__ + var sdm = new SiriKit.SceneDateManager(); + sdm.AccessToken = UserInfo.Current.LoginTokenString; + sdm.RefreshToken = UserInfo.Current.RefreshToken; +#endif } return false; } diff --git a/HDL_ON/Entity/Function/SecurityAlarm.cs b/HDL_ON/Entity/Function/SecurityAlarm.cs index 6260cba..a460369 100644 --- a/HDL_ON/Entity/Function/SecurityAlarm.cs +++ b/HDL_ON/Entity/Function/SecurityAlarm.cs @@ -13,11 +13,7 @@ { public SecurityAlarm() { - pushConfigs.Add(new SecurityPushConfig() - { - pushMethod = "APP", - pushTarget = new List<string>() { UserInfo.Current.ID } - }); + } /// <summary> @@ -35,7 +31,7 @@ /// <summary> /// 瀹夐槻寤舵椂 /// </summary> - public string delay; + public string delay ="0"; /// <summary> /// 鐘舵�� /// 甯冮槻:enable @@ -94,6 +90,17 @@ var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); FileUtlis.Files.WriteFileByBytes(savePath, ssd); } + /// <summary> + /// 鍒锋柊鏈湴鏁版嵁 + /// </summary> + /// <returns></returns> + public SecurityAlarm RefeshData() + { + var dataBytes = FileUtlis.Files.ReadFile(savePath); + var dataString = System.Text.Encoding.UTF8.GetString(dataBytes); + var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<SecurityAlarm>(dataString); + return temp; + } /// <summary> /// 淇濆瓨瀹夐槻淇℃伅 @@ -101,8 +108,22 @@ public string SaveInfo() { HttpServerRequest hsr = new HttpServerRequest(); - this.noticeConfig.enable = true; - this.noticeConfig.noticeContent = Language.StringByID(StringId.SecurityAlarmTipString).Replace("{0}", name); + if (string.IsNullOrEmpty(this.noticeConfig.noticeContent)) + { + this.noticeConfig.noticeContent = Language.StringByID(StringId.SecurityAlarmTipString).Replace("{0}", name); + } + if (this.noticeConfig.enable) + { + if (this.pushConfigs.Count == 0) + { + pushConfigs.Add(new SecurityPushConfig() + { + pushMethod = "APP", + pushTarget = new List<string>() { UserInfo.Current.ID } + }); + } + } + if (string.IsNullOrEmpty(sid)) { NewSid(); @@ -260,16 +281,16 @@ public List<SecurityInputCondition> condition = new List<SecurityInputCondition>(); /// <summary> - /// 鍒ゆ柇鏉′欢 - /// </summary> - public string comparator = "="; - - /// <summary> /// 鍔犲叆杈撳叆鏉′欢 /// 鏈湴鍒ゆ柇浣跨敤 /// </summary> - [Newtonsoft.Json.JsonIgnore] - public bool addCondition = false; + //[Newtonsoft.Json.JsonIgnore] + //public bool addCondition = false; + + /// <summary> + /// 鍒ゆ柇鏉′欢 + /// </summary> + public string comparator = "="; [Newtonsoft.Json.JsonIgnore] Function _function = null; @@ -459,12 +480,18 @@ /// </summary> public List<SecurityOutputStatus> status = new List<SecurityOutputStatus>(); + /// <summary> /// 鍔犲叆杈撳叆鏉′欢 /// 鏈湴鍒ゆ柇浣跨敤 /// </summary> + //[Newtonsoft.Json.JsonIgnore] + //public bool addCondition = false; + [Newtonsoft.Json.JsonIgnore] - public bool addCondition = false; + public string name = ""; + [Newtonsoft.Json.JsonIgnore] + public string RoomName = ""; [Newtonsoft.Json.JsonIgnore] Function _function = null; @@ -515,7 +542,7 @@ } }else if(target_type == "1") { - + text = Language.StringByID(StringId.Open); } return text; @@ -539,7 +566,7 @@ /// <summary> /// 鏄惁寮�鍚�氱煡 /// </summary> - public bool enable; + public bool enable = true; /// <summary> /// 閫氱煡鍐呭 /// </summary> diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index 4830611..e0fb1e8 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -486,6 +486,7 @@ <Compile Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\HDLLinphone.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\A_EnvironmentalDataCenter.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\2-Classification\SceneControlZone.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\ArmCenter\PushConfigPage.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs index 9938df1..d1720bf 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -231,9 +231,9 @@ //etAccount.Text = "15217626103";//鏄嗘槑閲戣寕椤圭洰 //etAccount.Text = "18598273624"; //etAccount.Text = "tf@smarttech.com.ua"; - etAccount.Text = "18814122445";//钁f辰鏂� 澶╂渤鍔炲叕瀹� - //etAccount.Text = "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568 - etAccount.Text = "18402017839";//wjc + //etAccount.Text = "18814122445";//钁f辰鏂� 澶╂渤鍔炲叕瀹� + etAccount.Text = "18824864143";//"464027401@qq.com"; //"2791308028@qq.com";//13697499568 + //etAccount.Text = "18402017839";//wjc //etAccount.Text = "13430286286";//cwc //etAccount.Text = "13709260805"; //etAccount.Text = "support5@hdlchina.com.cn"; diff --git a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs index 81e6d77..7b9c9c7 100644 --- a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs +++ b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs @@ -726,6 +726,11 @@ //UserInfo.Current.CurrentRegion.RegionID = ""; UserInfo.Current.SaveUserInfo(); MainPage.Log("鐧诲綍鎴愬姛銆�"); +#if __IOS__ + var sdm = new SiriKit.SceneDateManager(); + sdm.AccessToken = UserInfo.Current.LoginTokenString; + sdm.RefreshToken = UserInfo.Current.RefreshToken; +#endif result = true; //鑾峰彇鐢ㄦ埛淇℃伅 diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs index 85a312b..19b5abb 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs @@ -65,16 +65,21 @@ /// View鐨勬柟娉� /// </summary> /// <returns></returns> - public FrameLayout FLayoutView() + public FrameLayout FLayoutView(bool hadLine = true) { btnText.TextAlignment = TextAlignment.CenterLeft; btnNextIcon.Gravity = Gravity.CenterVertical; frameLayout.AddChidren(btnText); frameLayout.AddChidren(btnNextIcon); - btnLine.Y = frameLayout.Height - 1; - frameLayout.AddChidren(btnLine); + if (hadLine) + { + btnLine.Y = frameLayout.Height - 1; + frameLayout.AddChidren(btnLine); + } frameLayout.AddChidren(btnClick); return frameLayout; } + + } } diff --git a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs index b5ec1d8..10d2b81 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs @@ -15,6 +15,13 @@ /// </summary> PageLayout contentPageView; Button btnAutomationTitle; + + #region 瀹夐槻鍖哄煙 + FrameLayout securityView; + Button btnSecurityTitle; + #endregion + + #region 鍦烘櫙鍖哄煙 FrameLayout scenePageView; /// <summary> @@ -76,51 +83,139 @@ //鍒ゆ柇鏄惁闇�瑕侀殣钘忚嚜鍔ㄥ寲 if (HideAutoPage) { - btnSceneTilte = new Button() + if (DB_ResidenceData.Instance.GatewayType == 1)//缃戝叧闇�瑕佸姞杞藉畨闃�--2021-11-28 19:56:53 鍒樻檽杈夊皢瀹夐槻鏀惧叆鏀圭晫闈� { - Y = Application.GetRealHeight(30), - //Width = Application.GetRealWidth(170), - Height = Application.GetRealHeight(25), - TextAlignment = TextAlignment.Center, - TextSize = CSS_FontSize.HeadlineFontSize, - TextColor = CSS_Color.PromptingColor1, - SelectedTextColor = CSS_Color.MainColor, - TextID = StringId.Scenes, - IsSelected = true - }; - topView.AddChidren(btnSceneTilte); - btnAutomationTitle = new Button(); + btnSceneTilte = new Button() + { + Y = Application.GetRealHeight(30), + Width = Application.GetRealWidth(170), + Height = Application.GetRealHeight(25), + TextAlignment = TextAlignment.CenterRight, + TextSize = CSS_FontSize.HeadlineFontSize, + TextColor = CSS_Color.PromptingColor1, + SelectedTextColor = CSS_Color.MainColor, + TextID = StringId.Scenes, + IsSelected = true + }; + topView.AddChidren(btnSceneTilte); + + btnSecurityTitle = new Button() + { + X = Application.GetRealWidth(209), + Y = Application.GetRealHeight(30), + Width = Application.GetRealWidth(170), + Height = Application.GetRealHeight(25), + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + SelectedTextColor = CSS_Color.MainColor, + TextID = StringId.SecurityCenter, + }; + topView.AddChidren(btnSecurityTitle); + btnAutomationTitle = new Button(); + } + else + { + + btnSceneTilte = new Button() + { + Y = Application.GetRealHeight(30), + //Width = Application.GetRealWidth(170), + Height = Application.GetRealHeight(25), + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.HeadlineFontSize, + TextColor = CSS_Color.PromptingColor1, + SelectedTextColor = CSS_Color.MainColor, + TextID = StringId.Scenes, + IsSelected = true + }; + topView.AddChidren(btnSceneTilte); + btnAutomationTitle = new Button(); + + } } else { - - btnSceneTilte = new Button() + if (DB_ResidenceData.Instance.GatewayType == 1)//缃戝叧闇�瑕佸姞杞藉畨闃�--2021-11-28 19:56:53 鍒樻檽杈夊皢瀹夐槻鏀惧叆鏀圭晫闈� { - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(170), - Height = Application.GetRealHeight(25), - TextAlignment = TextAlignment.CenterRight, - TextSize = CSS_FontSize.HeadlineFontSize, - TextColor = CSS_Color.PromptingColor1, - SelectedTextColor = CSS_Color.MainColor, - TextID = StringId.Scenes, - IsSelected = true - }; - topView.AddChidren(btnSceneTilte); + btnAutomationTitle = new Button() + { + Y = Application.GetRealHeight(30), + Gravity = Gravity.CenterHorizontal, + Height = Application.GetRealHeight(25), + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + SelectedTextColor = CSS_Color.MainColor, + TextID = StringId.Automation, + IsSelected = false + }; + topView.AddChidren(btnAutomationTitle); + btnAutomationTitle.Width = btnAutomationTitle.GetTextWidth() + Application.GetRealWidth(40); - btnAutomationTitle = new Button() + var otherWidth = (Application.GetRealWidth(375) - btnAutomationTitle.Width) / 2; + btnAutomationTitle.X = otherWidth; + + + btnSceneTilte = new Button() + { + Y = Application.GetRealHeight(30), + Width = otherWidth, + Height = Application.GetRealHeight(25), + TextAlignment = TextAlignment.CenterRight, + TextSize = CSS_FontSize.HeadlineFontSize, + TextColor = CSS_Color.PromptingColor1, + SelectedTextColor = CSS_Color.MainColor, + TextID = StringId.Scenes, + IsSelected =true + }; + topView.AddChidren(btnSceneTilte); + + + btnSecurityTitle = new Button() + { + X = btnAutomationTitle.Right, + Y = Application.GetRealHeight(30), + Width = otherWidth, + Height = Application.GetRealHeight(25), + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + SelectedTextColor = CSS_Color.MainColor, + TextID = StringId.SecurityCenter, + }; + topView.AddChidren(btnSecurityTitle); + } + else { - X = Application.GetRealWidth(209), - Y = Application.GetRealHeight(30), - Width = Application.GetRealWidth(170), - Height = Application.GetRealHeight(25), - TextAlignment = TextAlignment.CenterLeft, - TextSize = CSS_FontSize.TextFontSize, - TextColor = CSS_Color.PromptingColor1, - SelectedTextColor = CSS_Color.MainColor, - TextID = StringId.Automation, - }; - topView.AddChidren(btnAutomationTitle); + btnSceneTilte = new Button() + { + Y = Application.GetRealHeight(30), + Width = Application.GetRealWidth(170), + Height = Application.GetRealHeight(25), + TextAlignment = TextAlignment.CenterRight, + TextSize = CSS_FontSize.HeadlineFontSize, + TextColor = CSS_Color.PromptingColor1, + SelectedTextColor = CSS_Color.MainColor, + TextID = StringId.Scenes, + IsSelected = true + }; + topView.AddChidren(btnSceneTilte); + + btnAutomationTitle = new Button() + { + X = Application.GetRealWidth(209), + Y = Application.GetRealHeight(30), + Width = Application.GetRealWidth(170), + Height = Application.GetRealHeight(25), + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.PromptingColor1, + SelectedTextColor = CSS_Color.MainColor, + TextID = StringId.Automation, + }; + topView.AddChidren(btnAutomationTitle); + } } var btnAddIconBg = new Button() { @@ -155,9 +250,28 @@ { LoadAutomationPageView(); } + LoadSecurityPageView(); LoadEventList(); } + + #region 瀹夐槻甯冮槻 + /// <summary> + /// 鍔犺浇瀹夐槻鐣岄潰 + /// </summary> + void LoadSecurityPageView() + { + securityView = new FrameLayout(); + contentPageView.AddChidren(securityView); + + var page = new ArmCenterPage(); + securityView.AddChidren(page); + page.LoadPage(false); + } + + + #endregion + #region 鍦烘櫙閮ㄥ垎 /// <summary> /// 鍔犺浇鍦烘櫙鍒楄〃鐣岄潰 @@ -321,7 +435,6 @@ /// <summary> /// 鍔犺浇鍦烘櫙鎺у埗鍗$墖 /// </summary> - //FrameLayout LoadSceneFunctionDiv(FrameLayout view, Scene scene) FrameLayout LoadSceneFunctionDiv(int functionView_X, Scene scene) { var view = new FrameLayout() @@ -482,8 +595,23 @@ { contentPageView.PageChange = (sender, e) => { - if (contentPageView.PageIndex == 0) + if (contentPageView.PageIndex == 2) { + btnSecurityTitle.IsSelected = true; + btnSecurityTitle.TextSize = CSS_FontSize.HeadlineFontSize; + btnSecurityTitle.IsBold = true; + btnSceneTilte.IsSelected = false; + btnSceneTilte.TextSize = CSS_FontSize.TextFontSize; + btnSceneTilte.IsBold = false; + btnAutomationTitle.IsSelected = false; + btnAutomationTitle.TextSize = CSS_FontSize.TextFontSize; + btnAutomationTitle.IsBold = false; + } + else if (contentPageView.PageIndex == 0) + { + btnSecurityTitle.IsSelected = false; + btnSecurityTitle.TextSize = CSS_FontSize.TextFontSize; + btnSecurityTitle.IsBold = false; btnSceneTilte.IsSelected = true; btnSceneTilte.TextSize = CSS_FontSize.HeadlineFontSize; btnSceneTilte.IsBold = true; @@ -493,6 +621,9 @@ } else { + btnSecurityTitle.IsSelected = false; + btnSecurityTitle.TextSize = CSS_FontSize.TextFontSize; + btnSecurityTitle.IsBold = false; btnAutomationTitle.IsSelected = true; btnAutomationTitle.TextSize = CSS_FontSize.HeadlineFontSize; btnAutomationTitle.IsBold = true; @@ -508,6 +639,8 @@ { return; } + btnSecurityTitle.IsSelected = false; + btnSecurityTitle.TextSize = CSS_FontSize.TextFontSize; btnSceneTilte.IsSelected = true; btnSceneTilte.TextSize = CSS_FontSize.HeadlineFontSize; btnAutomationTitle.IsSelected = false; @@ -520,12 +653,26 @@ { return; } + btnSecurityTitle.IsSelected = false; + btnSecurityTitle.TextSize = CSS_FontSize.TextFontSize; btnAutomationTitle.IsSelected = true; btnAutomationTitle.TextSize = CSS_FontSize.HeadlineFontSize; btnSceneTilte.IsSelected = false; btnSceneTilte.TextSize = CSS_FontSize.TextFontSize; contentPageView.PageIndex = 1; - + }; + btnSecurityTitle.MouseUpEventHandler = (sender, e) => { + if(btnSecurityTitle.IsSelected ) + { + return; + } + btnSecurityTitle.IsSelected = true; + btnSecurityTitle.TextSize = CSS_FontSize.HeadlineFontSize; + btnAutomationTitle.IsSelected = false; + btnAutomationTitle.TextSize = CSS_FontSize.TextFontSize; + btnSceneTilte.IsSelected = false; + btnSceneTilte.TextSize = CSS_FontSize.TextFontSize; + contentPageView.PageIndex = 2; }; } #endregion diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs index 67f47d5..ddeb9d9 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs @@ -284,11 +284,6 @@ btnSceneDelayInfo.Text = scene.GetDelayText(); scene.EditScene(); }; - Dictionary<string, string> items = new Dictionary<string, string>(); - items.Add("30", "30s"); - items.Add("60", "1min"); - items.Add("120", "2min"); - items.Add("300", "5min"); new PublicAssmebly().SetSceneDelayDialog(action,scene.delay); }; @@ -484,7 +479,7 @@ }; row.AddChidren(btnFunctionDelayInfo); - if (Convert.ToInt32( scenefunction.delay) > 0) + if (!string.IsNullOrEmpty(scenefunction.delay) && Convert.ToInt32( scenefunction.delay) > 0) { btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText(); } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs index 52d41b6..95475ac 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs @@ -795,12 +795,13 @@ contentView.AddChidren(supportView); - + int supportViewCellCount = 1; #region 鏅鸿兘闊崇 if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare) { + supportViewCellCount++; //supportView 鍔犻珮 鏄剧ず3琛� 3*44 - supportView.Height = Application.GetRealWidth(2*44); + supportView.Height = Application.GetRealWidth(supportViewCellCount * 44); FrameLayout smartSpeakerView = new FrameLayout() { @@ -858,8 +859,9 @@ #if __IOS__ //if (Application.PhoneType >= 12) { + supportViewCellCount++; //supportView 鍔犻珮 鏄剧ず3琛� 3*44 - supportView.Height = Application.GetRealWidth(3 * 44); + supportView.Height = Application.GetRealWidth(supportViewCellCount * 44); FrameLayout siriView = new FrameLayout() { diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs index 15277a4..910b0dd 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs @@ -251,6 +251,11 @@ DB_ResidenceData.Instance.EixtAccount(); //鍒锋柊浣忓畢鏁版嵁 Common.ApiUtlis.Ins.DownloadData(); +#if __IOS__ + var sdm = new SiriKit.SceneDateManager(); + sdm.RegionUrl = DB_ResidenceData.Instance.CurrentRegion.regionUrl; + sdm.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; +#endif } #endregion diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferingResidencePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferingResidencePage.cs index 20484cb..8418b27 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferingResidencePage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferingResidencePage.cs @@ -3,6 +3,7 @@ using HDL_ON.UI.CSS; using HDL_ON.Stan; using System.Collections.Generic; +using HDL_ON.Entity; namespace HDL_ON.UI { @@ -228,8 +229,8 @@ } else { - Entity.DB_ResidenceData.Instance.CurrentRegion = UserInfo.Current.regionList[0]; - Entity.DB_ResidenceData.Instance.SaveResidenceData(); + DB_ResidenceData.Instance.CurrentRegion = UserInfo.Current.regionList[0]; + DB_ResidenceData.Instance.SaveResidenceData(); //鍒锋柊浣忓畢鏁版嵁 Common.ApiUtlis.Ins.DownloadData(); @@ -241,6 +242,11 @@ MainPage.CurPageIndex = 1; userPage.ChoosePersonalCenter(); } +#if __IOS__ + var sdm = new SiriKit.SceneDateManager(); + sdm.RegionUrl = DB_ResidenceData.Instance.CurrentRegion.regionUrl; + sdm.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; +#endif } } }; diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs index 91f18dc..a872383 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs @@ -26,6 +26,16 @@ SecurityAlarm securityAlarm; Action refreshAction; + /// <summary> + /// 瀹夐槻杈撳嚭-涓存椂 + /// </summary> + List<SecurityOutput> tempOutput = new List<SecurityOutput>(); + /// <summary> + /// 瀹夐槻杈撳叆-涓存椂 + /// </summary> + List<SecurityInput> tempInput = new List<SecurityInput>(); + + public AddAlarmDeploymentPage(SecurityAlarm alarm, Action action) { bodyView = this; @@ -33,10 +43,8 @@ refreshAction = action; } - public void LoadPage() + public void LoadPage(string title = "") { - new TopViewDiv(bodyView, Language.StringByID(StringId.Setting)).LoadTopView(); - bodyView.BackgroundColor = CSS_Color.BackgroundColor; contentView = new VerticalScrolViewLayout() @@ -46,95 +54,202 @@ }; bodyView.AddChidren(contentView); - #region 甯冮槻淇℃伅 - var deploymentTitleRow = new FrameLayout() + if (string.IsNullOrEmpty(title)) { - Height = Application.GetRealHeight(44), + new TopViewDiv(bodyView, Language.StringByID(StringId.AddSecurity)).LoadTopView(); + #region 甯冮槻淇℃伅 + var deploymentTitleRow = new FrameLayout() + { + Height = Application.GetRealHeight(44), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + contentView.AddChidren(deploymentTitleRow); + + var btnDeploymentTitle = new Button() + { + X = Application.GetRealWidth(16), + TextColor = CSS_Color.MainColor, + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.DeploymentInformation, + IsBold = true, + }; + deploymentTitleRow.AddChidren(btnDeploymentTitle); + + deploymentTitleRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); + + #region 甯冮槻鍚嶇О + var deploymentNameRow = new FrameLayout() + { + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + contentView.AddChidren(deploymentNameRow); + + var btnDeploymentNameTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(72), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Name, + }; + deploymentNameRow.AddChidren(btnDeploymentNameTitle); + btnDeploymentNameTitle.Text += ":"; + + var btnDeploymentName = new Button() + { + X = Application.GetRealWidth(88), + Width = Application.GetRealWidth(230), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.TextFontSize, + Text = securityAlarm.name + }; + deploymentNameRow.AddChidren(btnDeploymentName); + deploymentNameRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); + + LoadEvent_EditSecurityAlarmName(btnDeploymentName); + #endregion + + #region 瑙﹀彂寤舵椂 + var delayedRow = new FrameLayout() + { + Height = Application.GetRealHeight(50), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + contentView.AddChidren(delayedRow); + + var btnDelayedTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(72), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.TriggerDelay, + }; + delayedRow.AddChidren(btnDelayedTitle); + btnDelayedTitle.Text += ":"; + + var btnDelayedText = new Button() + { + X = Application.GetRealWidth(88), + Width = Application.GetRealWidth(330), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.TextualColor, + TextSize = CSS_FontSize.TextFontSize, + Text = securityAlarm.delay + "s" + }; + delayedRow.AddChidren(btnDelayedText); + btnDelayedText.MouseUpEventHandler = (sender, e) => + { + Action<string> action = (obj) => + { + securityAlarm.delay = obj; + btnDelayedText.Text = securityAlarm.delay + "s"; + }; + new PublicAssmebly().SetSceneDelayDialog(action, securityAlarm.delay); + }; + + var btnDelayedRight = new Button() + { + X = Application.GetRealWidth(343), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "Public/RightIcon.png", + }; + delayedRow.AddChidren(btnDelayedRight); + + + delayedRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); + #endregion + + #endregion + + contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8), BackgroundColor = CSS_Color.BackgroundColor }); + } + else + { + new TopViewDiv(bodyView, title).LoadTopView(); + } + + //甯冮槻鍔熻兘 + iniDefenseView(); + + //鍛婅鐩爣 + iniAlarmView(); + + #region 鎵ц鎺ㄩ�� + ///涓婁笅闂撮殧12鍍忕礌 + contentView.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); + ///鎵ц鎺ㄩ�乮ew + FrameLayout pushView = new FrameLayout() + { + Height = Application.GetRealHeight(50), BackgroundColor = CSS_Color.MainBackgroundColor, }; - contentView.AddChidren(deploymentTitleRow); + contentView.AddChidren(pushView); - var btnDeploymentTitle = new Button() + + var btnPushTitle = new Button() { X = Application.GetRealWidth(16), - TextColor = CSS_Color.MainColor, + TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, - TextSize = CSS_FontSize.SubheadingFontSize, - TextID = StringId.DeploymentInformation, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.push, IsBold = true, }; - deploymentTitleRow.AddChidren(btnDeploymentTitle); + pushView.AddChidren(btnPushTitle); - deploymentTitleRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); - - #region 甯冮槻鍚嶇О - var deploymentNameRow = new FrameLayout() + var btnSwitchPush = new Button() { - Height = Application.GetRealHeight(50), - BackgroundColor = CSS_Color.MainBackgroundColor, + Width = Application.GetRealWidth(36), + Height = Application.GetRealWidth(36), + X = Application.GetRealWidth(323), + UnSelectedImagePath = "LogicIcon/off.png", + SelectedImagePath = "LogicIcon/on.png", + Gravity = Gravity.CenterVertical, }; - contentView.AddChidren(deploymentNameRow); + pushView.AddChidren(btnSwitchPush); - var btnDeploymentNameTitle = new Button() + + ///鏄惁瑕佹帹閫佺偣鍑讳簨浠� + btnSwitchPush.MouseUpEventHandler += (sender, e) => { - X = Application.GetRealWidth(16), - Width = Application.GetRealWidth(72), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.TextFontSize, - TextID = StringId.Name, + //璐﹀彿鍒楄〃涓虹┖榛樿鎺ㄩ�佸綋鍓嶈处鍙� + if (securityAlarm.pushConfigs.Count == 0) + { + //鍒濆鍖栧璞� + var pushConfigs = new SecurityPushConfig(); + //榛樿娣诲姞鎺ㄩ�佸綋鍓嶈处鍙� + pushConfigs.pushTarget.Add(UserInfo.Current.ID); + securityAlarm.pushConfigs.Add(pushConfigs); + } + btnSwitchPush.IsSelected = !btnSwitchPush.IsSelected; + if (btnSwitchPush.IsSelected) + { + securityAlarm.noticeConfig.enable = true; + } + else + { + securityAlarm.noticeConfig.enable = false; + } }; - deploymentNameRow.AddChidren(btnDeploymentNameTitle); - btnDeploymentNameTitle.Text += ":"; - - var btnDeploymentName = new Button() - { - X = Application.GetRealWidth(88), - Width = Application.GetRealWidth(230), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.TextualColor, - TextSize = CSS_FontSize.TextFontSize, - Text = securityAlarm.name - }; - deploymentNameRow.AddChidren(btnDeploymentName); - deploymentNameRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); - - LoadEvent_EditSecurityAlarmName(btnDeploymentName); + pushView.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); #endregion - - /* - #region 瑙﹀彂寤舵椂 - var delayedRow = new FrameLayout() + #region 鍙戦�侀�氱煡 + ///鍙戦�侀�氱煡View + var pushMsgView = new FrameLayout() { Height = Application.GetRealHeight(50), BackgroundColor = CSS_Color.MainBackgroundColor, }; - contentView.AddChidren(delayedRow); - - var btnDelayedTitle = new Button() - { - X = Application.GetRealWidth(16), - Width = Application.GetRealWidth(72), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.TextFontSize, - TextID = StringId.TriggerDelay, - }; - delayedRow.AddChidren(btnDelayedTitle); - btnDelayedTitle.Text += ":"; - - var btnDelayedText = new Button() - { - X = Application.GetRealWidth(88), - Width = Application.GetRealWidth(230), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.TextualColor, - TextSize = CSS_FontSize.TextFontSize, - Text = securityAlarm.name - }; - delayedRow.AddChidren(btnDelayedText); - - var btnDelayedRight = new Button() + contentView.AddChidren(pushMsgView); + var btnPushMsgRight = new Button() { X = Application.GetRealWidth(343), Gravity = Gravity.CenterVertical, @@ -142,22 +257,37 @@ Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/RightIcon.png", }; - delayedRow.AddChidren(btnDelayedRight); + pushMsgView.AddChidren(btnPushMsgRight); - //delayedRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); - #endregion - */ + + + var btnPushMsgTitle = new Button() + { + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(372), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.fasongtongzhi, + IsBold = true, + }; + pushMsgView.AddChidren(btnPushMsgTitle); + + btnPushMsgTitle.MouseUpEventHandler = (sender, e) => { + var inputPushText = new PushConfigPage(); + MainPage.BasePageView.AddChidren(inputPushText); + inputPushText.Show(securityAlarm); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + ///涓婁笅闂撮殧62鍍忕礌 + contentView.AddChidren(new FrameLayout { Height = Application.GetRealHeight(40) }); + #endregion - contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8), BackgroundColor = CSS_Color.BackgroundColor }); - //甯冮槻鍔熻兘 - iniDefenseView(); -#if DEBUG - //鍛婅鐩爣 - iniAlarmView(); -#endif + #region 搴曢儴鍖哄煙 var bottomView = new FrameLayout() @@ -209,17 +339,22 @@ tip.Show(MainPage.BaseView); return; } - //if (securityAlarm.output.Count == 0) - //{ - // var tip = new Tip() - // { - // Text = "璇烽�夋嫨鍛婅鐩爣", - // CloseTime = 3, - // Direction = AMPopTipDirection.None - // }; - // tip.Show(MainPage.BaseView); - // return; - //} + if (securityAlarm.output.Count == 0) + { + var tipText = "璇烽�夋嫨鍛婅鐩爣"; + if(Language.CurrentLanguage !="Chinese") + { + tipText = "Please select the alarm target"; + } + var tip = new Tip() + { + Text = tipText, + CloseTime = 3, + Direction = AMPopTipDirection.None + }; + tip.Show(MainPage.BaseView); + return; + } var waitPage = new Loading(); waitPage.Start(); @@ -227,6 +362,7 @@ { try { + var code = securityAlarm.SaveInfo(); if (code == StateCode.SUCCESS) { @@ -276,6 +412,8 @@ BackgroundColor = CSS_Color.MainBackgroundColor, }; contentView.AddChidren(deploymentFunctionRow); + deploymentFunctionRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); + var btnFunctionTitle = new Button() { @@ -339,12 +477,9 @@ { inputTargetView.AddChidren(new InputRow(target.GetFunction().name, target.GetFunction().GetRoomListName(), target.StateText())); } + inputTargetView.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); } inputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.input.Count); - //if (outputTargetView != null) - //{ - // contentView.AddChidren(outputTargetView); - //} } else { @@ -381,6 +516,7 @@ BackgroundColor = CSS_Color.MainBackgroundColor, }; contentView.AddChidren(outputRow); + outputRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); var btnOutputRowTitle = new Button() { @@ -420,9 +556,11 @@ outputTargetView = new VerticalScrolViewLayout() { ScrollEnabled = false, + Height =0, }; contentView.AddChidren(outputTargetView); + outputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.output.Count); iniAlarmListView(); #endregion @@ -440,7 +578,11 @@ { foreach (var outTarget in securityAlarm.output) { - outputTargetView.AddChidren(new OutputRow(outTarget.GetFunction().name, outTarget.GetFunction().GetRoomListName(), "鎵撳紑")); + if (outTarget.GetFunction() != null) + { + outputTargetView.AddChidren(new OutputRow(outTarget.GetFunction().name, outTarget.GetFunction().GetRoomListName(), outTarget.StateText())); + } + outputTargetView.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); } outputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.output.Count); } @@ -456,6 +598,7 @@ IsMoreLines = true, BackgroundColor = CSS_Color.MainBackgroundColor, }); + outputTargetView.Height = Application.GetRealHeight(68); } } @@ -480,7 +623,6 @@ }.Show(bodyView); return; } - btnDeploymentName.Text = securityAlarm.name = str; diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs index 167b453..3558ece 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs @@ -14,13 +14,11 @@ Action<SecurityAlarm> refreshAction; - SecurityAlarm securityAlarm; - List<SecurityInput> inputList = new List<SecurityInput>(); - - public AddInputPage(SecurityAlarm alarm,Action<SecurityAlarm> action) + SecurityAlarm alarm; + public AddInputPage(SecurityAlarm inAlarm,Action<SecurityAlarm> action) { bodyView = this; - securityAlarm = alarm; + alarm = inAlarm; refreshAction = action; } @@ -65,14 +63,17 @@ Text = DB_ResidenceData.Instance.CurFloor.roomName, }; showdFunctionTypeRow.AddChidren(btnFloor); - btnFloor.MouseUpEventHandler += (sender, e) => + btnFloor.MouseUpEventHandler = (sender, e) => { string nowSelectId = null; - var listAllFun = FunctionList.List.GetArmSensorList(); + var list = FunctionList.List.GetArmSensorList(); +#if DEBUG + list.AddRange(FunctionList.List.GetLightList()); +#endif //鏄剧ず涓嬫媺鐣岄潰 var form = new FloorRoomSelectPopupView(); - form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) => + form.ShowDeviceFunctionView(btnFloor, list, (selectId, listFun) => { nowSelectId = selectId; //閲嶆柊鍒锋柊璁惧鍒楄〃 @@ -92,8 +93,12 @@ bodyView.AddChidren(functionListView); + var listAllFun = FunctionList.List.GetArmSensorList(); +#if DEBUG + listAllFun.AddRange(FunctionList.List.GetLightList()); +#endif - LoadFunctionListRow(FunctionList.List.GetArmSensorList()); + LoadFunctionListRow(listAllFun); @@ -122,16 +127,8 @@ bottomView.AddChidren(btnConfrim); btnConfrim.MouseUpEventHandler = (sender, e) => { - securityAlarm.input = new List<SecurityInput>(); - foreach (var input in inputList) - { - if (input.addCondition) - { - securityAlarm.input.Add(input); - } - } this.RemoveFromParent(); - refreshAction?.Invoke(securityAlarm); + refreshAction?.Invoke(alarm); }; @@ -151,13 +148,10 @@ functions = FunctionList.List.GetArmSensorList(); } -#if DEBUG - functions.AddRange(FunctionList.List.GetLightList()); -#endif foreach (var function in functions) { - var input = securityAlarm.input.Find((obj) => obj.sid == function.sid); + var input = alarm.input.Find((obj) => obj.sid == function.sid); if (input == null) { input = new SecurityInput(); @@ -188,32 +182,32 @@ break; } input.condition = new List<SecurityInputCondition>() - { - new SecurityInputCondition() { - key = inKey, - value = inValue, - } - }; + new SecurityInputCondition() + { + key = inKey, + value = inValue, + } + }; if (function.spk == SPK.LightSwitch || function.spk == SPK.LightRGB || function.spk == SPK.LightDimming) { input.condition = new List<SecurityInputCondition>() - { - new SecurityInputCondition() { - key = FunctionAttributeKey.OnOff, - value = "off", - } - }; + new SecurityInputCondition() + { + key = FunctionAttributeKey.OnOff, + value = "off", + } + }; } } - else - { - input.addCondition = true; - } - inputList.Add(input); + //else + //{ + // //input.addCondition = true; + // alarm.input.Add(input); + //} FrameLayout functionRow = new FrameLayout() { @@ -268,37 +262,53 @@ }; functionRow.AddChidren(btnChooseIcon); - btnChooseIcon.MouseUpEventHandler = (sender, e) => { + btnChooseIcon.MouseUpEventHandler = (sender, e) => + { btnChooseIcon.IsSelected = !btnChooseIcon.IsSelected; - if(btnChooseIcon.IsSelected) + var tempLocal = alarm.input.Find((obj) => + obj.sid == input.sid + ); + if (btnChooseIcon.IsSelected) { - input.addCondition = true; - //if (input.condition.Count==0) - //{ - // ShowStateDialog(input, btnState,btnChooseIcon,function.spk); - //} + //input.addCondition = true; + if (tempLocal == null) + alarm.input.Add(input); } else { - input.addCondition = false; + //input.addCondition = false; + if (tempLocal != null) + { + alarm.input.Remove(input); + } } }; btnState.MouseUpEventHandler = (sender, e) => { - //ShowStateDialog(input, btnState, btnChooseIcon, function.spk); btnChooseIcon.IsSelected = !btnChooseIcon.IsSelected; + var tempLocal = alarm.input.Find((obj) => + obj.sid == input.sid + ); if (btnChooseIcon.IsSelected) { - input.addCondition = true; + //input.addCondition = true; + if (tempLocal == null) + alarm.input.Add(input); } else { - input.addCondition = false; + //input.addCondition = false; + if (tempLocal != null) + { + alarm.input.Remove(input); + } } }; - - if (input.addCondition) + var localInput = alarm.input.Find((obj) => + obj.sid == input.sid + ); + if (localInput!=null) { btnChooseIcon.IsSelected = true; btnState.Text = input.StateText(); @@ -414,8 +424,12 @@ } + var localInput = alarm.input.Find((obj) => + obj.sid == input.sid + ); + if (localInput == null) + alarm.input.Add(input); - input.addCondition = true; if (btnChoose != null) { btnChoose.IsSelected = true; @@ -448,7 +462,12 @@ } - input.addCondition = true; + var localInput = alarm.input.Find((obj) => + obj.sid == input.sid + ); + if (localInput == null) + alarm.input.Add(input); + if (btnChoose != null) { btnChoose.IsSelected = true; diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs index 9aac9de..5647415 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs @@ -29,17 +29,19 @@ VerticalScrolViewLayout functionListView; - SecurityAlarm securityAlarm; Action<SecurityAlarm> refreshAction; - List<SecurityOutput> outputList = new List<SecurityOutput>(); + /// <summary> + /// 鏈湴鍔熻兘杞崲鐨勮緭鍑哄垪琛紙鐏厜銆佸満鏅級 + /// </summary> + List<SecurityOutput> allocatedList = new List<SecurityOutput>(); - List<Function> allocatedList = new List<Function>(); + SecurityAlarm alarm; - public AddOutputPage(SecurityAlarm function, Action<SecurityAlarm> action) + public AddOutputPage(SecurityAlarm inOutput ,Action<SecurityAlarm> action) { bodyView = this; - securityAlarm = function; refreshAction = action; + alarm = inOutput; } @@ -83,6 +85,7 @@ Text = DB_ResidenceData.Instance.CurFloor.roomName, }; showdFunctionTypeRow.AddChidren(btnFloor); + LoadDialog_ChangeFloor(); #endregion @@ -95,31 +98,9 @@ bodyView.AddChidren(functionListView); + SetData(); - - - - foreach (var function in FunctionList.List.Functions) - { - if (!MainPage.SceneSupportFunctionList.Contains(function.spk)) - { - continue; - } - if (function == null) - { - continue; - } - function.roomIds.Remove(null); - allocatedList.Add(function); - } - - LoadFunctionListRow(null); - - - - - - + LoadFunctionListRow(); var bottomView = new FrameLayout() { @@ -146,51 +127,97 @@ bottomView.AddChidren(btnConfrim); btnConfrim.MouseUpEventHandler = (sender, e) => { - securityAlarm.output = new List<SecurityOutput>(); - foreach (var output in outputList) - { - if (output.addCondition) - { - securityAlarm.output.Add(output); - } - } this.RemoveFromParent(); - refreshAction?.Invoke(securityAlarm); + refreshAction?.Invoke(alarm); }; - - - - - } + /// <summary> + /// 閰嶇疆鏁版嵁 + /// </summary> + void SetData(string roomId="") + { + allocatedList.Clear(); + foreach (var function in FunctionList.List.GetLightList()) + { + if (function == null) + { + continue; + } + if (!string.IsNullOrEmpty(roomId) && roomId == "ALLSELECT") + { + if (!function.roomIds.Contains(roomId)) + { + continue; + } + } + function.roomIds.Remove(null); + var tempStatus = new List<SecurityOutputStatus>(); + tempStatus.Add(new SecurityOutputStatus() { key = FunctionAttributeKey.OnOff, value = "on" }); + allocatedList.Add(new SecurityOutput + { + target_type = "0", + sid = function.sid, + status = tempStatus, + name = function.name, + RoomName = function.GetRoomListName(), + }); + } + + + foreach (var scene in FunctionList.List.scenes) + { + if (scene == null) + { + continue; + } + if (!string.IsNullOrEmpty(roomId)) + { + if (!scene.roomIds.Contains(roomId)) + { + continue; + } + } + scene.roomIds.Remove(null); + var tempStatus = new List<SecurityOutputStatus>(); + tempStatus.Add(new SecurityOutputStatus() { key = "value", value = "0" }); + allocatedList.Add(new SecurityOutput + { + target_type = "1", + sid = scene.sid, + status = tempStatus, + name = scene.name, + RoomName = scene.GetRoomListName(), + }); + } + + } // <summary> /// 鏄剧ず鍔熻兘Row /// </summary> - void LoadFunctionListRow(List<Function> functions) + void LoadFunctionListRow() { functionListView.RemoveAll(); - if (functions == null) + foreach (var function in allocatedList) { - functions = allocatedList; - } - foreach (var function in functions) - { - var output = securityAlarm.output.Find((obj) => obj.sid == function.sid); + var output = alarm.output.Find((obj) => obj.sid == function.sid); if (output == null) { - output = new SecurityOutput(); + output = new SecurityOutput() { status = new List<SecurityOutputStatus> { new SecurityOutputStatus { + key = FunctionAttributeKey.OnOff, + value = "on" + } } }; + output.sid = function.sid; } - else - { - output.addCondition = true; - } - outputList.Add(output); + //else + //{ + // output.addCondition = true; + //} FrameLayout functionRow = new FrameLayout() { @@ -217,7 +244,7 @@ Y = Application.GetRealHeight(24), Width = Application.GetRealWidth(200), Height = Application.GetRealHeight(41), - Text = function.GetRoomListName(), + Text = function.RoomName, TextAlignment = TextAlignment.CenterLeft, TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, @@ -247,17 +274,22 @@ btnChooseIcon.MouseUpEventHandler = (sender, e) => { btnChooseIcon.IsSelected = !btnChooseIcon.IsSelected; + var tempLocal = alarm.input.Find((obj) => + obj.sid == output.sid + ); if (btnChooseIcon.IsSelected) { - output.addCondition = true; - if (output.status.Count == 0) - { - ShowStateDialog(output, btnState,btnChooseIcon); - } + //input.addCondition = true; + if (tempLocal == null) + alarm.output.Add(output); } else { - output.addCondition = false; + //input.addCondition = false; + if (tempLocal != null) + { + alarm.output.Remove(output); + } } }; btnState.MouseUpEventHandler = (sender, e) => @@ -265,8 +297,9 @@ ShowStateDialog(output, btnState, btnChooseIcon); }; + var localOutput = alarm.output.Find((obj) => obj.sid == output.sid); - if (output.addCondition) + if (localOutput!=null) { btnChooseIcon.IsSelected = true; btnState.Text = output.StateText(); @@ -284,7 +317,6 @@ } } - private void ShowStateDialog(SecurityOutput output, Button btnState, Button btnChoose = null) @@ -320,12 +352,12 @@ { Height = Application.GetRealHeight(44), TextAlignment = TextAlignment.Center, - TextColor = CSS_Color.MainColor, + SelectedTextColor = CSS_Color.MainColor, + TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.SubheadingFontSize, - TextID = StringId.On + TextID = StringId.On, }; optinView.AddChidren(btnOpen); - optinView.AddChidren(new Button() { Height = 1, @@ -336,11 +368,17 @@ { Height = Application.GetRealHeight(44), TextAlignment = TextAlignment.Center, + SelectedTextColor = CSS_Color.MainColor, TextColor = CSS_Color.PromptingColor1, TextID = StringId.OFF, TextSize = CSS_FontSize.SubheadingFontSize, }; optinView.AddChidren(btnClose); + if (output.status.Count > 0) + { + btnOpen.IsSelected = output.status[0].value.ToLower() == "on"; + btnClose.IsSelected = !btnOpen.IsSelected; + } Button btnCancel = new Button() @@ -369,8 +407,10 @@ value = "on", } }; - output.addCondition = true; - if (btnChoose != null) + var localInput = alarm.output.Find((obj) => + obj.sid == output.sid + ); + if (localInput == null) { btnChoose.IsSelected = true; } @@ -388,8 +428,10 @@ value = "off", } }; - output.addCondition = true; - if (btnChoose != null) + var localInput = alarm.output.Find((obj) => + obj.sid == output.sid + ); + if (localInput == null) { btnChoose.IsSelected = true; } @@ -420,18 +462,18 @@ void LoadDialog_ChangeFloor() { string nowSelectId = null; - btnFloor.MouseUpEventHandler += (sender, e) => + btnFloor.MouseUpEventHandler = (sender, e) => { var listAllFun = new List<Function>(); - listAllFun.AddRange(allocatedList); + //listAllFun.AddRange(allocatedList); //鏄剧ず涓嬫媺鐣岄潰 var form = new FloorRoomSelectPopupView(); form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) => { - nowSelectId = selectId; + SetData(selectId); //閲嶆柊鍒锋柊璁惧鍒楄〃 - this.LoadFunctionListRow(listFun); + this.LoadFunctionListRow(); }, nowSelectId); }; } diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs index 03fb2c6..6f549d2 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs @@ -58,17 +58,18 @@ bodyView = this; } - public void LoadPage() + public void LoadPage(bool addNav = true) { Action skipAction = () => { }; - - new TopViewDiv(bodyView, Language.StringByID(StringId.SecurityCenter)).LoadTopView_ArmCenter(skipAction); - + if (addNav) + { + new TopViewDiv(bodyView, Language.StringByID(StringId.SecurityCenter)).LoadTopView_ArmCenter(skipAction); + } VerticalScrolViewLayout contentView = new VerticalScrolViewLayout() { - Y = Application.GetRealHeight(64), + Y = addNav? Application.GetRealHeight(64):0, Height = Application.GetRealHeight(667 - 64), BackgroundColor = CSS_Color.MainBackgroundColor, ScrollEnabled = false, @@ -194,6 +195,8 @@ Height = Application.GetRealHeight(20), }); + + #region 鍥哄畾甯冮槻鍖哄煙 /* var fixedDeploymentView = new FrameLayout() @@ -239,11 +242,26 @@ Width = Application.GetRealWidth(24), }); - #endregion //鐏惧鎶ヨ var disasterAlarmView = new FixedArmView("FunctionIcon/ArmCenter/DisasterAlarmIcon.png", Language.StringByID(StringId.DisasterDefense), Language.StringByID(StringId.Defense24Hour)); + EventHandler<MouseEventArgs> disasterAlarmViewClick = (sender, e) => { + var disasterAlarm = FunctionList.List.securities.Find((obj) => obj.type == "all_day"); + if (disasterAlarm == null) + { + disasterAlarm = new SecurityAlarm() { name = "alldaydefense", type = "all_day" }; + } + else + { + disasterAlarm = disasterAlarm.RefeshData(); + } + var addDefensePage = new AddAlarmDeploymentPage(disasterAlarm, null); + MainPage.BasePageView.AddChidren(addDefensePage); + addDefensePage.LoadPage(Language.StringByID(StringId.DisasterDefense)); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + disasterAlarmView.SetClick(disasterAlarmViewClick); fixedDeploymentTypeView.AddChidren(disasterAlarmView); fixedDeploymentTypeView.AddChidren(new Button() @@ -253,6 +271,22 @@ //闃茬洍鎶ヨ var burglarAlarmView = new FixedArmView("FunctionIcon/ArmCenter/BurglarAlarmIcon.png", Language.StringByID(StringId.BurglarAlarm), Language.StringByID(StringId.AlarmMute)); + EventHandler<MouseEventArgs> burglarAlarmViewClick = (sender, e) => { + var burglarAlarm = FunctionList.List.securities.Find((obj) => obj.type == "mute"); + if (burglarAlarm == null) + { + burglarAlarm = new SecurityAlarm() { name = "mutedefense", type = "mute" }; + } + else + { + burglarAlarm = burglarAlarm.RefeshData(); + } + var addDefensePage = new AddAlarmDeploymentPage(burglarAlarm, null); + MainPage.BasePageView.AddChidren(addDefensePage); + addDefensePage.LoadPage(Language.StringByID(StringId.BurglarAlarm)); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + disasterAlarmView.SetClick(disasterAlarmViewClick); fixedDeploymentTypeView.AddChidren(burglarAlarmView); */ #endregion @@ -323,12 +357,12 @@ customDeploymentView.AddChidren(view); EventHandler<MouseEventArgs> event1 = (sender, e) => { - Action refreshAction = () => + Action addDefenseRefreshAction = () => { iniCustomDeploymentView(); }; - var addDefensePage = new AddAlarmDeploymentPage(new SecurityAlarm(), refreshAction); + var addDefensePage = new AddAlarmDeploymentPage(new SecurityAlarm(), addDefenseRefreshAction); MainPage.BasePageView.AddChidren(addDefensePage); addDefensePage.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -424,6 +458,8 @@ { iniCustomDeploymentView(); }; + + alarm = alarm.RefeshData(); var armSetPage = new AddAlarmDeploymentPage(alarm,refreshAction); MainPage.BasePageView.AddChidren(armSetPage); armSetPage.LoadPage(); @@ -572,6 +608,10 @@ /// </summary> public class FixedArmView : FrameLayout { + Button btnIcon; + Button btnTitle; + Button btnTitleTip; + /// <summary> /// 鍥哄畾甯冮槻鎺т欢 /// </summary> @@ -586,7 +626,7 @@ this.BorderColor = CSS_Color.MainColor; this.BorderWidth = 1; - var btnIcon = new Button() + btnIcon = new Button() { X = Application.GetRealWidth(15), Width = Application.GetRealWidth(24), @@ -596,7 +636,7 @@ }; this.AddChidren(btnIcon); - var btnTitle = new Button() + btnTitle = new Button() { X = Application.GetRealWidth(55), Width = Application.GetRealWidth(89), @@ -609,7 +649,7 @@ }; this.AddChidren(btnTitle); - var btnTitleTip = new Button() + btnTitleTip = new Button() { X = Application.GetRealWidth(55), Y = Application.GetRealHeight(23), @@ -619,10 +659,20 @@ TextColor = CSS_Color.PromptingColor1, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, Text = titleTip, + IsMoreLines = true, }; this.AddChidren(btnTitleTip); } + + /// <summary> + /// 璁剧疆鐐瑰嚮浜嬩欢 + /// </summary> + /// <param name="handler"></param> + public void SetClick(EventHandler<MouseEventArgs> handler) + { + btnTitleTip.MouseUpEventHandler = btnIcon.MouseUpEventHandler = handler; + } } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs new file mode 100644 index 0000000..cbcb003 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs @@ -0,0 +1,196 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.UI.UI2.Intelligence.Automation; +using Shared; + +namespace HDL_ON.UI +{ + public class PushConfigPage : FrameLayout + { + FrameLayout bodyView; + + public PushConfigPage() + { + bodyView = this; + } + public void Show(Entity.SecurityAlarm alarm) + { + + new TopViewDiv(bodyView, Language.StringByID(StringId.fasongtongzhi)).LoadTopView(); + + this.BackgroundColor = CSS.CSS_Color.BackgroundColor; + + var viewLayout = new FrameLayout() + { + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(527), + }; + bodyView.AddChidren(viewLayout); + + #region 閫氱煡鍐呭 + UI2.Intelligence.Automation.LogicView.AddOutputInputTextView addInputTextView = new UI2.Intelligence.Automation.LogicView.AddOutputInputTextView(); + addInputTextView.btnIf.TextID = StringId.tongzhineirong; + viewLayout.AddChidren(addInputTextView.FLayoutView(46, 12)); + ///杈撳叆鎺ㄩ�佹枃鏈� + EditTextView textBox = new EditTextView//EditText + { + Y = Application.GetRealHeight(42), + X = Application.GetRealWidth(16), + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(152), + TextAlignment = TextAlignment.TopLeft, + Radius = (uint)Application.GetRealHeight(12), + Text = alarm.noticeConfig.noticeContent, + TextSize = UI2.Intelligence.Automation.LogicView.TextSize.text14, + TextColor = CSS.CSS_Color.textColor, + PlaceholderText = Language.StringByID(StringId.xianzhichangdu),//"(100瀛椾互鍐�)", + PlaceholderTextColor = CSS.CSS_Color.textCancelColor, + BackgroundColor = CSS.CSS_Color.textWhiteColor, + + }; + viewLayout.AddChidren(textBox); + textBox.TextChangeEventHandler += (sender, e) => + { + var leng = e.Length; + if (leng > 100) + { + textBox.Text = e.Substring(0, 100); +#if __Android__ + textBox.SetSelectionEnd(); +#endif + + } + + }; + #endregion + #region App鎺ㄩ�� + UI2.Intelligence.Automation.LogicView.LogicTypeTitleView appPush = new UI2.Intelligence.Automation.LogicView.LogicTypeTitleView(); + appPush.frameLayout.Y = Application.GetRealHeight(206); + appPush.frameLayout.Radius = (uint)Application.GetRealHeight(12); + appPush.btnText.TextID = StringId.apptuisong; + appPush.btnText.X = Application.GetRealWidth(12); + viewLayout.AddChidren(appPush.FLayoutView(false)); + //瀹氫箟涓�涓眬閮ㄨ处鍙峰垪琛ㄧ敤鏉ヨ褰曢�変腑鏁版嵁; + List<string> selectedAccountList = new List<string>(); + appPush.btnClick.MouseUpEventHandler += (sender, e) => + { + var userList = new List<HDL_ON.Entity.ResidenceMemberInfo>(); + Loading loading = new Loading(); + this.AddChidren(loading); + loading.Start(); + new System.Threading.Thread(() => + { + try + { + userList = Send.GetResidenceMemberAccount(); + + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + userList.Add(new Entity.ResidenceMemberInfo { childAccountId = UserInfo.Current.ID, childAccountPhone = UserInfo.Current.userMobileInfo, childAccountEmail = UserInfo.Current.userEmailInfo }); + //浣忓畢瀛愯处鍙峰垪琛� + List<string> accountList = new List<string>(); + //涔嬪墠鐘舵�佸垪琛� + List<string> stateList = new List<string>(); + for (int i = 0; i < userList.Count; i++) + { + var user = userList[i]; + accountList.Add(user.Account); + } + + if (alarm.pushConfigs.Count > 0) + { + var list = alarm.pushConfigs[0].pushTarget; + for (int i = 0; i < userList.Count; i++) + { + + var user = userList[i]; + if (list.Contains(user.childAccountId)) + { + stateList.Add(user.Account); + } + + } + + + } + + PublicInterface view = new PublicInterface(); + view.FrameOrVvList(this, accountList, stateList, StringId.zhanghaoxuanze + , (list) => + { + //娓呯┖鏃ф暟鎹垪琛� + selectedAccountList.Clear(); + for (int i = 0; i < userList.Count; i++) + { + var user = userList[i]; + if (list.Contains(user.Account)) + { + selectedAccountList.Add(user.childAccountId); + } + } + + }); + }); + } + }) + { IsBackground = true }.Start(); + }; + + #endregion + #region 纭 + UI2.Intelligence.Automation.LogicView.SaveView saveView = new UI2.Intelligence.Automation.LogicView.SaveView(); + saveView.btnSave.TextID = StringId.queren; + saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + this.AddChidren(saveView.FLayoutView()); + + + saveView.btnClick.MouseUpEventHandler += (e, sen) => + { + alarm.noticeConfig.noticeContent = textBox.Text.Trim(); + if (selectedAccountList.Count > 0) + { + alarm.pushConfigs.Clear();//娓呯┖鏃ф暟鎹垪琛� + alarm.pushConfigs.Add(new Entity.SecurityPushConfig { pushTarget = selectedAccountList }); + } + //璐﹀彿鍒楄〃涓虹┖榛樿鎺ㄩ�佸綋鍓嶈处鍙� + if (alarm.pushConfigs.Count == 0) + { + //鍒濆鍖栧璞� + Entity.SecurityPushConfig pushConfigs = new Entity.SecurityPushConfig(); + //榛樿娣诲姞鎺ㄩ�佸綋鍓嶈处鍙� + pushConfigs.pushTarget.Add(UserInfo.Current.ID); + alarm.pushConfigs.Add(pushConfigs); + } + this.RemoveFromParent(); + }; + #endregion + + } + + /// <summary> + /// 鎵嬫満璐﹀彿涓哄厛锛屾墜鏈鸿处鍙蜂负绌猴紝鍏舵鍒伴偖绠辫处鍙� + /// </summary> + private string Account + { + get + { + ///鎵嬫満璐﹀彿涓哄厛锛屾墜鏈鸿处鍙蜂负绌猴紝鍏舵鍒伴偖绠辫处鍙�; + if (!string.IsNullOrEmpty(UserInfo.Current.userMobileInfo)) + { + //榛樿鎺ㄩ�佸綋鍓嶆墜鏈鸿处鍙� + return UserInfo.Current.userMobileInfo; + } + else + { + //榛樿鎺ㄩ�佸綋鍓嶉偖绠辫处鍙� + return UserInfo.Current.userEmailInfo; + } + } + } + } +} diff --git a/SiriIntents/HDLRunSceneIntentHandlder.cs b/SiriIntents/HDLRunSceneIntentHandlder.cs new file mode 100644 index 0000000..99f94ee --- /dev/null +++ b/SiriIntents/HDLRunSceneIntentHandlder.cs @@ -0,0 +1,107 @@ +锘縰sing System; +using Foundation; +using HDLSceneSiri; +using ObjCRuntime; +using UIKit; +//using HdlSiri; + +namespace SiriIntents +{ + public class HDLRunSceneIntentHandlder : HDLRunSceneIntentHandling + { + public override void ConfirmHDLRunScene (HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion) + { + if (UIDevice.CurrentDevice.CheckSystemVersion(12, 0)) + { + if (Server.HttpServerRequest.Ins.DataManager.IsLgoin) + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.InProgress, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "璇风瓑寰�..."; + } + else + { + rsp.SuccessMessage = "Please wait..."; + } + completion(rsp); + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Failure, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "璐﹀彿鏈櫥褰�"; + } + else + { + rsp.SuccessMessage = "Not logged in to the app"; + } + completion(rsp); + } + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.ContinueInApp, null); + rsp.SuccessMessage = "Ok"; + completion(rsp); + } + } + + public override void HandleHDLRunScene(HDLRunSceneIntent intent,Action<HDLRunSceneIntentResponse> completion) + { + if (UIDevice.CurrentDevice.CheckSystemVersion(12, 0)) + { + if (Server.HttpServerRequest.Ins.DataManager.IsLgoin) + { + var result = Server.HttpServerRequest.Ins.ExecuteScene(intent.SceneId); + if (result == "0") + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Success, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "鎵ц鎴愬姛"; + } + else + { + rsp.SuccessMessage = "Successful execution"; + } + completion(rsp); + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Failure, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "鎵ц澶辫触"; + } + else + { + rsp.SuccessMessage = "Execution failed"; + } + completion(rsp); + } + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Failure, null); + if (NSLocale.PreferredLanguages[0].Contains("zh-")) + { + rsp.SuccessMessage = "璐﹀彿鏈櫥褰�"; + } + else + { + rsp.SuccessMessage = "Not logged in to the app"; + } + completion(rsp); + } + } + else + { + var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.ContinueInApp, null); + rsp.SuccessMessage = "Ok"; + completion(rsp); + } + } + } +} diff --git a/SiriIntents/IntentHandler.cs b/SiriIntents/IntentHandler.cs index 8837700..89cbeed 100644 --- a/SiriIntents/IntentHandler.cs +++ b/SiriIntents/IntentHandler.cs @@ -16,7 +16,7 @@ // "<myApp> John saying hello" // "Search for messages in <myApp>" [Register("IntentHandler")] - public class IntentHandler : INExtension, IINSendMessageIntentHandling, IINSearchForMessagesIntentHandling, IINSetMessageAttributeIntentHandling + public class IntentHandler : INExtension//, IINSendMessageIntentHandling, IINSearchForMessagesIntentHandling, IINSetMessageAttributeIntentHandling { protected IntentHandler(IntPtr handle) : base(handle) { @@ -28,107 +28,107 @@ // This is the default implementation. If you want different objects to handle different intents, // you can override this and return the handler you want for that particular intent. - //if (intent is HDLRunSceneIntent) - //{ - // return new SiriKit.HDLRunSceneIntentHandlder(); - //} + if (intent is HDLRunSceneIntent) + { + return new HDLRunSceneIntentHandlder(); + } return this; } - // Implement resolution methods to provide additional information about your intent (optional). - [Export("resolveRecipientsForSearchForMessages:withCompletion:")] - public void ResolveRecipients(INSendMessageIntent intent, Action<INPersonResolutionResult[]> completion) - { - var recipients = intent.Recipients; - // If no recipients were provided we'll need to prompt for a value. - if (recipients.Length == 0) - { - completion(new INPersonResolutionResult[] { INPersonResolutionResult.NeedsValue }); - return; - } + //// Implement resolution methods to provide additional information about your intent (optional). + //[Export("resolveRecipientsForSearchForMessages:withCompletion:")] + //public void ResolveRecipients(INSendMessageIntent intent, Action<INPersonResolutionResult[]> completion) + //{ + // var recipients = intent.Recipients; + // // If no recipients were provided we'll need to prompt for a value. + // if (recipients.Length == 0) + // { + // completion(new INPersonResolutionResult[] { INPersonResolutionResult.NeedsValue }); + // return; + // } - var resolutionResults = new List<INPersonResolutionResult>(); + // var resolutionResults = new List<INPersonResolutionResult>(); - foreach (var recipient in recipients) - { - var matchingContacts = new INPerson[] { recipient }; // Implement your contact matching logic here to create an array of matching contacts - if (matchingContacts.Length > 1) - { - // We need Siri's help to ask user to pick one from the matches. - resolutionResults.Add(INPersonResolutionResult.GetDisambiguation(matchingContacts)); - } - else if (matchingContacts.Length == 1) - { - // We have exactly one matching contact - resolutionResults.Add(INPersonResolutionResult.GetSuccess(recipient)); - } - else - { - // We have no contacts matching the description provided - resolutionResults.Add(INPersonResolutionResult.Unsupported); - } - } + // foreach (var recipient in recipients) + // { + // var matchingContacts = new INPerson[] { recipient }; // Implement your contact matching logic here to create an array of matching contacts + // if (matchingContacts.Length > 1) + // { + // // We need Siri's help to ask user to pick one from the matches. + // resolutionResults.Add(INPersonResolutionResult.GetDisambiguation(matchingContacts)); + // } + // else if (matchingContacts.Length == 1) + // { + // // We have exactly one matching contact + // resolutionResults.Add(INPersonResolutionResult.GetSuccess(recipient)); + // } + // else + // { + // // We have no contacts matching the description provided + // resolutionResults.Add(INPersonResolutionResult.Unsupported); + // } + // } - completion(resolutionResults.ToArray()); - } + // completion(resolutionResults.ToArray()); + //} - [Export("resolveContentForSendMessage:withCompletion:")] - public void ResolveContent(INSendMessageIntent intent, Action<INStringResolutionResult> completion) - { - var text = intent.Content; - if (!string.IsNullOrEmpty(text)) - completion(INStringResolutionResult.GetSuccess(text)); - else - completion(INStringResolutionResult.NeedsValue); - } + //[Export("resolveContentForSendMessage:withCompletion:")] + //public void ResolveContent(INSendMessageIntent intent, Action<INStringResolutionResult> completion) + //{ + // var text = intent.Content; + // if (!string.IsNullOrEmpty(text)) + // completion(INStringResolutionResult.GetSuccess(text)); + // else + // completion(INStringResolutionResult.NeedsValue); + //} - // Once resolution is completed, perform validation on the intent and provide confirmation (optional). - [Export("confirmSendMessage:completion:")] - public void ConfirmSendMessage(INSendMessageIntent intent, Action<INSendMessageIntentResponse> completion) - { - // Verify user is authenticated and your app is ready to send a message. + //// Once resolution is completed, perform validation on the intent and provide confirmation (optional). + //[Export("confirmSendMessage:completion:")] + //public void ConfirmSendMessage(INSendMessageIntent intent, Action<INSendMessageIntentResponse> completion) + //{ + // // Verify user is authenticated and your app is ready to send a message. - var userActivity = new NSUserActivity("INSendMessageIntent"); - var response = new INSendMessageIntentResponse(INSendMessageIntentResponseCode.Ready, userActivity); - completion(response); - } + // var userActivity = new NSUserActivity("INSendMessageIntent"); + // var response = new INSendMessageIntentResponse(INSendMessageIntentResponseCode.Ready, userActivity); + // completion(response); + //} - // Handle the completed intent (required). - public void HandleSendMessage(INSendMessageIntent intent, Action<INSendMessageIntentResponse> completion) - { - // Implement your application logic to send a message here. + //// Handle the completed intent (required). + //public void HandleSendMessage(INSendMessageIntent intent, Action<INSendMessageIntentResponse> completion) + //{ + // // Implement your application logic to send a message here. - var userActivity = new NSUserActivity("INSendMessageIntent"); - var response = new INSendMessageIntentResponse(INSendMessageIntentResponseCode.Success, userActivity); - completion(response); - } + // var userActivity = new NSUserActivity("INSendMessageIntent"); + // var response = new INSendMessageIntentResponse(INSendMessageIntentResponseCode.Success, userActivity); + // completion(response); + //} - // Implement handlers for each intent you wish to handle. - // As an example for messages, you may wish to add HandleSearchForMessages and HandleSetMessageAttribute. + //// Implement handlers for each intent you wish to handle. + //// As an example for messages, you may wish to add HandleSearchForMessages and HandleSetMessageAttribute. - public void HandleSearchForMessages(INSearchForMessagesIntent intent, Action<INSearchForMessagesIntentResponse> completion) - { - // Implement your application logic to find a message that matches the information in the intent. + //public void HandleSearchForMessages(INSearchForMessagesIntent intent, Action<INSearchForMessagesIntentResponse> completion) + //{ + // // Implement your application logic to find a message that matches the information in the intent. - var userActivity = new NSUserActivity("INSearchForMessagesIntent"); - var response = new INSearchForMessagesIntentResponse(INSearchForMessagesIntentResponseCode.Success, userActivity); + // var userActivity = new NSUserActivity("INSearchForMessagesIntent"); + // var response = new INSearchForMessagesIntentResponse(INSearchForMessagesIntentResponseCode.Success, userActivity); - // Initialize with found message's attributes - var sender = new INPerson(new INPersonHandle("sarah@example.com", INPersonHandleType.EmailAddress), null, "Sarah", null, null, null); - var recipient = new INPerson(new INPersonHandle("+1-415-555-5555", INPersonHandleType.PhoneNumber), null, "John", null, null, null); - var message = new INMessage("identifier", "I am so excited about SiriKit!", NSDate.Now, sender, new INPerson[] { recipient }); - response.Messages = new INMessage[] { message }; - completion(response); - } + // // Initialize with found message's attributes + // var sender = new INPerson(new INPersonHandle("sarah@example.com", INPersonHandleType.EmailAddress), null, "Sarah", null, null, null); + // var recipient = new INPerson(new INPersonHandle("+1-415-555-5555", INPersonHandleType.PhoneNumber), null, "John", null, null, null); + // var message = new INMessage("identifier", "I am so excited about SiriKit!", NSDate.Now, sender, new INPerson[] { recipient }); + // response.Messages = new INMessage[] { message }; + // completion(response); + //} - public void HandleSetMessageAttribute(INSetMessageAttributeIntent intent, Action<INSetMessageAttributeIntentResponse> completion) - { - // Implement your application logic to set the message attribute here. + //public void HandleSetMessageAttribute(INSetMessageAttributeIntent intent, Action<INSetMessageAttributeIntentResponse> completion) + //{ + // // Implement your application logic to set the message attribute here. - var userActivity = new NSUserActivity("INSetMessageAttributeIntent"); - var response = new INSetMessageAttributeIntentResponse(INSetMessageAttributeIntentResponseCode.Success, userActivity); - completion(response); - } + // var userActivity = new NSUserActivity("INSetMessageAttributeIntent"); + // var response = new INSetMessageAttributeIntentResponse(INSetMessageAttributeIntentResponseCode.Success, userActivity); + // completion(response); + //} } } diff --git a/SiriIntents/Server/HttpServerRequest.cs b/SiriIntents/Server/HttpServerRequest.cs new file mode 100644 index 0000000..fcb96b2 --- /dev/null +++ b/SiriIntents/Server/HttpServerRequest.cs @@ -0,0 +1,101 @@ +锘縰sing System.Collections.Generic; +using SiriKit; + +namespace SiriIntents.Server +{ + public class HttpServerRequest + { + static HttpServerRequest _httpServerRequest; + public static HttpServerRequest Ins { + get + { + if(_httpServerRequest == null) + { + _httpServerRequest = new HttpServerRequest(); + } + return _httpServerRequest; + } + } + SceneDateManager _dateManager; + public SceneDateManager DataManager { + get + { + if(_dateManager== null) + { + _dateManager = new SceneDateManager(); + } + return _dateManager; + } + } + + #region 鈻� 閫氱敤璇锋眰鎺ュ彛_______________________ + /// <summary> + /// 鏍规鐢ㄦ埛璐﹀彿鑾峰彇娉ㄥ唽鍖哄煙 鍏嶇櫥褰� // 妫�娴嬭处鍙锋槸鍚︽敞鍐屼篃鐢ㄨ繖涓帴鍙� + /// </summary> + /// <param name="account"></param> + /// <returns></returns> + public ResponsePackNew GetRegionByAccount(string account) + { + var requestJson = HttpUtil.GetSignRequestJson(new RegionByAccountObj() { account = account }); + return HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetRegionByAccount, requestJson, HttpUtil.GlobalRequestHttpsHost); + } + + /// <summary> + /// 鍒锋柊Token + /// </summary> + /// <returns></returns> + public string RefreshToken() + { + var requestJson = HttpUtil.GetSignRequestJson(new RefreshTokenObj() + { + refreshToken = DataManager.RefreshToken, + }); + var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson); + if (revertObj.Code == StateCode.SUCCESS) + { + var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(revertObj.Data.ToString()); + DataManager.RefreshToken = revertData.refreshToken; + DataManager.AccessToken = revertData.headerPrefix + revertData.accessToken; + } + return revertObj.Code; + } + + #endregion + + + + /// <summary> + /// 鎵ц鍦烘櫙 + /// </summary> + /// <returns></returns> + public string ExecuteScene(string userSceneId) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DataManager.HomeId); + d.Add("userSceneIds", new List<string>() { userSceneId }); + + var requestJson = HttpUtil.GetSignRequestJson(d); + return HttpUtil.RequestHttpsPostFroHome( + NewAPI.Api_Post_ExecuteSecne, requestJson).Code; + } + + + + + /// <summary> + /// 璁剧疆瀹夐槻闃插尯鐘舵�� + /// </summary> + public ResponsePackNew SetSecurityStatus(List<object> securityStates) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DataManager.HomeId); + d.Add("securitys", securityStates); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome( + NewAPI.Api_Post_Security_StatusSet, requestJson); + return pack; + } + + + } +} \ No newline at end of file diff --git a/SiriIntents/Server/HttpUtil.cs b/SiriIntents/Server/HttpUtil.cs new file mode 100644 index 0000000..56a78a0 --- /dev/null +++ b/SiriIntents/Server/HttpUtil.cs @@ -0,0 +1,412 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Security.Cryptography; +using System.Text; +using RestSharp; + +namespace SiriIntents.Server +{ + public class HttpUtil + { + + #region **********鍏ㄥ眬甯搁噺********** + /// <summary> + /// 鍥哄畾鍩熷悕,姝e紡鐜 + /// 鍏叡鍩熷悕灏辫繎瑙f瀽 + /// </summary> + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm + /// <summary> + /// RegionMark + /// </summary> + public const string RegionMark = "HDL"; + /// <summary> + /// 璇锋眰瓒呮椂鏃堕棿 + /// </summary> + public const int TIME_OUT = 15; + /// <summary> + /// 鐗规畩鎺ュ彛璇锋眰瓒呮椂鏃堕棿 + /// </summary> + public const int TIME_OUT_LONG = 20; + /////// <summary> + /////// Bearer 鏆傛椂璁句负绌猴紝浠庣櫥闄嗘垚鍔熺殑杩斿洖鐨刪eaderPrefix鍙傛暟鍔ㄦ�佽幏鍙� + /////// </summary> + //public const string TOKEN_BEARER = "Bearer "; + + #endregion + + #region **********缃戠粶璇锋眰灏佽********** + + + /// <summary> + /// POST璇锋眰鏂规硶 body鍙傛暟 + /// 閽堝浣忓畢鐩稿叧鎺ュ彛灏佽 + /// 璋冪敤浣忓畢褰撳墠鎵�鍦ㄥ尯鍩熷煙鍚� + /// 濡傛灉鏄垎浜綇瀹咃紝浣跨敤涓讳汉鐨則oken杩涜鐩稿叧鎿嶄綔 + /// </summary> + /// <param name="apiPath"></param> + /// <param name="bodyParameterJson"></param> + /// <param name="mTimeout"></param> + /// <returns></returns> + public static ResponsePackNew RequestHttpsPostFroHome(string apiPath, string bodyParameterJson, int mTimeout = TIME_OUT) + { + string urlHead = HttpServerRequest.Ins.DataManager.RegionUrl; + //var replaceToken = ""; + //if (DB_ResidenceData.residenceData.residecenInfo.IsOthreShare) + //{ + // replaceToken = DB_ResidenceData.residenceData.MasterToken; + //} + return RequestHttps(Method.POST, apiPath, bodyParameterJson, null, null, urlHead, "", mTimeout); + } + + /// <summary> + /// POST璇锋眰鏂规硶 body鍙傛暟 + /// </summary> + /// <param name="apiPath"></param> + /// <param name="bodyParameterJson"></param> + /// <param name="urlHead"></param> + /// <param name="needErrorTip"></param> + /// <param name="replaceToken"></param> + /// <param name="mTimeout"></param> + /// <returns></returns> + public static ResponsePackNew RequestHttpsPost(string apiPath, string bodyParameterJson, string urlHead = "", string replaceToken = "", int mTimeout = TIME_OUT) + { + return RequestHttps(Method.POST, apiPath, bodyParameterJson, null, null, urlHead, replaceToken, mTimeout); + } + + /// <summary> + /// POST璇锋眰鏂规硶 queryDictionary + /// </summary> + /// <param name="apiPath"></param> + /// <param name="queryDictionary"></param> + /// <param name="urlHead"></param> + /// <param name="needErrorTip"></param> + /// <param name="replaceToken"></param> + /// <param name="mTimeout"></param> + /// <returns></returns> + public static ResponsePackNew RequestHttpsPost(string apiPath, Dictionary<string, object> queryDictionary, string urlHead = "", string replaceToken = "", int mTimeout = TIME_OUT) + { + return RequestHttps(Method.POST, apiPath, null, queryDictionary, null, urlHead, replaceToken, mTimeout); + } + + /// <summary> + /// 閫氱敤 璇锋眰鏈嶅姟鍣ㄦ柟娉� + /// </summary> + /// <param name="method"></param> + /// <param name="apiPath"></param> + /// <param name="bodyParameterJson"></param> + /// <param name="queryDictionary"></param> + /// <param name="urlSegmentDictionary"></param> + /// <param name="urlHead"></param> + /// <param name="replaceToken"></param> + /// <param name="mTimeout"></param> + /// <returns></returns> + static ResponsePackNew RequestHttpsBase(Method method, string apiPath, string bodyParameterJson = null, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = TIME_OUT) + { + //Dome妯″紡鐧诲綍 + + #region HttpWebRequest + try + { + + string requestFullUrl = urlHead + apiPath; + + + RestClient client = new RestClient(requestFullUrl); + + RestRequest request = new RestRequest(method); + request.Timeout = mTimeout * 1000; + request.AddHeader("content-type", "application/json"); + + request.AddHeader("Authorization", HttpServerRequest.Ins.DataManager.AccessToken); + + if (bodyParameterJson != null) + { + request.AddParameter("application/json", bodyParameterJson, ParameterType.RequestBody); + } + + if (queryDictionary != null) + { + foreach (var data in queryDictionary) + { + request.AddQueryParameter(data.Key, data.Value.ToString()); + } + } + + if (urlSegmentDictionary != null) + { + foreach (var data in urlSegmentDictionary) + { + request.AddUrlSegment(data.Key, data.Value.ToString()); + } + } + + IRestResponse response = client.Execute(request); + if (response.StatusCode == HttpStatusCode.OK) + { + try + { + ResponsePackNew revertObj = new ResponsePackNew() { }; + revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePackNew>(response.Content); + //*****涓�浜涘垽绌哄鐞�***************** + if (revertObj.Code == null) + { + revertObj.Code = StateCode.DATA_EXCEPTION; + } + + if (revertObj.Data == null) + { + revertObj.Data = ""; + } + //*****涓�浜涘垽绌哄鐞�***************** + + return revertObj; + } + catch (Exception ex) + { + return new ResponsePackNew() { Code = StateCode.DATA_EXCEPTION }; + } + } + else + { + return new ResponsePackNew() { Code = StateCode.NETWORK_ERROR }; + } + + } + catch (Exception ex) + { + return new ResponsePackNew() { Code = StateCode.NETWORK_ERROR }; + } + + #endregion + + } + + /// <summary> + /// 閫氱敤 璇锋眰鏈嶅姟鍣ㄦ柟娉� + /// 澧炲姞token杩囨湡澶勭悊 + /// </summary> + /// <param name="method"></param> + /// <param name="apiPath"></param> + /// <param name="bodyParameterJson"></param> + /// <param name="queryDictionary"></param> + /// <param name="urlSegmentDictionary"></param> + /// <param name="urlHead"></param> + /// <param name="replaceToken"></param> + /// <param name="mTimeout"></param> + /// <returns></returns> + public static ResponsePackNew RequestHttps(Method method, string apiPath, string bodyParameterJson = null, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = TIME_OUT) + { + var responsePackNew = RequestHttpsBase(method, apiPath, bodyParameterJson, queryDictionary, urlSegmentDictionary, urlHead, replaceToken, mTimeout); + //*****************Token杩囨湡澶勭悊***************** + if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) + { + //鍒锋柊Token + if (RefreshToken()) { + return RequestHttpsBase(method, apiPath, bodyParameterJson, queryDictionary, urlSegmentDictionary, urlHead, replaceToken, mTimeout); + } + else + { + return responsePackNew; + } + } + //*****************Token杩囨湡澶勭悊***************** + return responsePackNew; + } + + + /// <summary> + /// 鍒锋柊 Token + /// </summary> + /// <returns></returns> + static bool RefreshToken() + { + try + { + var requestJson = GetSignRequestJson(new RefreshTokenObj() + { + refreshToken = HttpServerRequest.Ins.DataManager.RefreshToken, + }); + var revertObj = RequestHttpsBase(Method.POST, NewAPI.API_POST_Login, requestJson); + if (revertObj.Code == StateCode.SUCCESS) + { + var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(revertObj.Data.ToString()); + HttpServerRequest.Ins.DataManager.AccessToken = revertData.headerPrefix + revertData.accessToken; + HttpServerRequest.Ins.DataManager.RefreshToken = revertData.refreshToken; + return true; + } + return false; + } + catch + { + return false; + } + } + + + + #endregion + + #region **********绛惧悕鏍¢獙********** + /// <summary> + /// + /// </summary> + const string APP_KEY = "HDL-HOME-APP-TEST"; + /// <summary> + /// + /// </summary> + const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; + + /// <summary> + /// 鑾峰彇褰撳墠鏃堕棿鎴冲�� + /// </summary> + /// <returns></returns> + static string GetTimestamp() + { + System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 褰撳湴鏃跺尯 + return ((long)(DateTime.Now - startTime).TotalMilliseconds).ToString(); // 鐩稿樊绉掓暟 + //return ((long)(DateTime.Now - startTime).TotalSeconds).ToString(); // 鐩稿樊绉掓暟 + } + + /// <summary> + /// + /// </summary> + /// <param name="signstr"></param> + /// <returns></returns> + static string SignMD5Encrypt(string s) + { + byte[] sign = MD5.Create().ComputeHash(UTF8Encoding.UTF8.GetBytes(s)); + string signstr = string.Empty; + foreach (byte item in sign) + { + signstr += item.ToString("X2"); + } + return signstr.ToLower(); + } + /// <summary> + /// 鍒ゆ柇褰撳墠鍊兼槸鍚﹂渶瑕佸弬涓庣鍚嶏紝淇濇寔璺熶簯绔竴鑷� + /// 绌哄瓧绗︿覆涓嶅弬涓� + /// 鏁扮粍,闆嗗悎,瀵硅薄涓嶅弬涓� + /// </summary> + /// <param name="valueStr"></param> + /// <returns></returns> + static bool IfValueNeedSign(string valueStr) + { + if (string.IsNullOrEmpty(valueStr) || valueStr.StartsWith("{") || valueStr.StartsWith("[")) + { + return false; + } + return true; + } + /// <summary> + /// 2020-11-02 + /// 鍩虹鏈嶅姟鐨勬帴鍙i兘瑕佹牎楠宻ign + /// 璁$畻sign绛惧悕 + /// </summary> + /// <returns></returns> + public static string GetSignRequestJson(object requestObj,Dictionary<string,object> paramDictionary = null) + { + try + { + //1. 灏唌odel瀹炰綋杞负Dictionary<string, object> + if (paramDictionary == null) + { + paramDictionary = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(Newtonsoft.Json.JsonConvert.SerializeObject(requestObj)); + } + //2. 璁$畻sign + if (paramDictionary != null) + { + paramDictionary.Add("appKey", APP_KEY); + paramDictionary.Add("timestamp", GetTimestamp()); + //2.1 瀛楀吀鍗囧簭 + paramDictionary = paramDictionary.OrderBy(o => o.Key).ToDictionary(o => o.Key, p => p.Value); + //2.2 鎷兼帴鎸塙RL閿�煎 + string str = string.Empty; + foreach (KeyValuePair<string, object> item in paramDictionary) + { + //Value涓簄ull涓嶅弬鍔犳牎楠� + if (item.Value != null) + { + //Value.ToString()涓簄ull鎴栬��""涔熶笉鍙傚姞鏍¢獙 + //if (!string.IsNullOrEmpty(item.Value.ToString()) && (item.Value is string || item.Value.GetType().IsValueType)) + //{ + //妫�娴嬪綋鍓嶅弬鏁版槸鍚﹂渶瑕佸弬涓庢牎楠� + if (IfValueNeedSign(item.Value.ToString())) + { + //濡傛灉鏄痓ool绫诲瀷锛岃杞皬鍐� + if (item.Value is bool) + { + str += item.Key + "=" + item.Value.ToString().ToLower() + "&"; + } + else + { + str += item.Key + "=" + item.Value.ToString() + "&"; + } + } + } + } + + //2.3 鎷兼帴SECRET_KEY + str = str.Substring(0, str.Length - 1) + SECRET_KEY; + //2.4 MD5杞崲+杞皬鍐� + var signstr = SignMD5Encrypt(str); + paramDictionary.Add("sign", signstr); + var signResult = Newtonsoft.Json.JsonConvert.SerializeObject(paramDictionary); + return signResult; + } + else + { + return ""; + } + } + catch + { + return ""; + } + } + + #endregion + } + + /// <summary> + /// 鍝嶅簲鍙傛暟 + /// </summary> + [Serializable] + public class ResponsePackNew + { + /// <summary> + /// 鍝嶅簲鐘舵�佺爜 + /// </summary> + public string Code; + + /// <summary> + /// 鍝嶅簲鍐呭 + /// </summary> + public object Data; + + /// <summary> + /// 鍝嶅簲閿欒淇℃伅 + /// </summary> + public string message = ""; + + /// <summary> + /// 杩欎釜鏄姹傞敊璇椂鐨勬墿灞曟暟鎹�,浠ュ悗鎵�鏈夌殑闄勫甫鎵╁睍鏁版嵁閮戒細鏀惧湪杩欓噷闈㈠姩鎬佺淮鎶� + /// </summary> + public object extra; + + ///// <summary> + ///// isSuccess + ///// </summary> + //public bool isSuccess; + + ///// <summary> + ///// timestamp + ///// </summary> + //public string timestamp; + + + } + +} diff --git a/SiriIntents/Server/IMessageCommon.cs b/SiriIntents/Server/IMessageCommon.cs new file mode 100644 index 0000000..7a5f5dc --- /dev/null +++ b/SiriIntents/Server/IMessageCommon.cs @@ -0,0 +1,151 @@ +锘縰sing System; +using System.Collections.Generic; + +namespace SiriIntents.Server +{ + /// <summary> + /// 鎺ュ彛绫荤殑杩斿洖淇℃伅 + /// </summary> + public class IMessageCommon + { + + /// <summary> + /// 鎺ュ彛绫荤殑杩斿洖淇℃伅 + /// </summary> + private static IMessageCommon m_Current = null; + /// <summary> + /// 鎺ュ彛绫荤殑杩斿洖淇℃伅 + /// </summary> + public static IMessageCommon Current + { + get + { + if (m_Current == null) + { + m_Current = new IMessageCommon(); + } + return m_Current; + } + } + + /// <summary> + /// 鏄惁鍦ㄨ幏鍙杢oken + /// </summary> + public bool isGetingToken; + + /// <summary> + /// 鏃犺閿欒(璁块棶浜戠鏃讹紝姝ゆ搷浣滃皢涓嶄細寮瑰嚭閿欒) + /// </summary> + public bool IgnoreError = false; + + ///// <summary> + ///// 鍏ㄩ儴淇℃伅 + ///// </summary> + //private Dictionary<string, Dictionary<string, int>> dicMsg = null; + + /// <summary> + /// 閫氱敤閿欒鐮� + /// </summary> + private Dictionary<string, int> stateCodeDic = null; + + + /// <summary> + /// 鏍规嵁鎺ュ彛鐨勭姸鎬佺爜锛岀炕璇戣繑鍥炰俊鎭� + /// </summary> + /// <param name="requestName">鎺ュ彛</param> + /// <param name="revertObj">浜戠杩斿洖鐨勬暟鎹�</param> + /// <param name="pra">璇锋眰鍙傛暟</param> + /// <returns></returns> + public string GetMsgByRequestName(string statuCode) + { + if (IgnoreError == true) + { + //鏃犺閿欒 + return null; + } + + //鍏遍�氱爜 + if (stateCodeDic.ContainsKey(statuCode) == true) + { + return "-1";// Language.StringByID(stateCodeDic[statuCode]); + } + + //if (dicMsg.ContainsKey(requestName) == true && dicMsg[requestName].ContainsKey(statuCode) == true) + //{ + // //鍦ㄥ唽鐨凪sg + // return Language.StringByID(dicMsg[requestName][statuCode]); + //} + + return "-1";//Language.StringByID(StringId.FailedRequestServer) + "\n(" + statuCode + ")"; + } + + + /// <summary> + /// StartRefreshToken + /// </summary> + public void StartRefreshToken() + { + if (isGetingToken) return; + + new System.Threading.Thread(() => + { + isGetingToken = true; + + try + { + var success = new HttpServerRequest().RefreshToken(); + } + catch + { + } + finally + { + isGetingToken = false; + } + }) + { IsBackground = true }.Start(); + + } + } + + /// <summary> + /// 甯哥敤鐘舵�佺爜绠$悊 + /// </summary> + public class StateCode + { + /// <summary> + /// 缃戠粶璇锋眰寮傚父 + /// APP鑷畾涔夐敊璇爜 + /// </summary> + public const string NETWORK_ERROR = "-1"; + /// <summary> + /// 鏁版嵁瑙f瀽閿欒 + /// APP鑷畾涔夐敊璇爜 + /// </summary> + public const string DATA_EXCEPTION = "-2"; + /// <summary> + /// 璇锋眰鎴愬姛鐨勭姸鎬佺爜 + /// </summary> + public const string SUCCESS = "0"; + /// <summary> + /// 楠岃瘉鐮佹牎楠屽け璐� + /// </summary> + public const string VERIFICATION_CODE_WRONG = "14"; + /// <summary> + /// 浼氳瘽瓒呮椂锛岃鏇存柊token + /// </summary> + public const string TOKEN_EXPIRED = "10001"; + /// <summary> + /// 璐﹀彿涓嶅瓨鍦ㄧ殑閿欒鐮� + /// </summary> + public const string ACCOUNT_NOT_EXIST = "10010"; + /// <summary> + /// 鐧诲綍閿佸畾锛屽瘑鐮侀敊璇鏁拌繃澶� + /// 瀵嗙爜杈撳叆閿欒瓒呰繃10娆★紝璇�30鍒嗛挓鍚庨噸璇�! + /// </summary> + public const string AccountLoginLock = "10019"; + + + + } +} diff --git a/SiriIntents/Server/NewAPI.cs b/SiriIntents/Server/NewAPI.cs new file mode 100644 index 0000000..209b433 --- /dev/null +++ b/SiriIntents/Server/NewAPI.cs @@ -0,0 +1,756 @@ +锘縰sing System; + +namespace SiriIntents.Server +{ + public class NewAPI + { + //#region 鏂板井鏈嶅姟鎺ュ彛 + //*********************************************** + //娉ㄦ剰锛氬拰浣忓畢鐩稿叧鐨勬帴鍙h璇锋眰浣忓畢鎵�鍦ㄥ尯鍩熺殑鍩熷悕 regionUrl + //*********************************************** + #region 鈻� RegionCluster -- 鍏ㄧ悆鍖哄煙鍒楄〃___________________________ + /// <summary> + /// 鏍规鐢ㄦ埛璐﹀彿鑾峰彇娉ㄥ唽鍖哄煙 鍏嶇櫥褰� // 妫�娴嬭处鍙锋槸鍚︽敞鍐屼篃鐢ㄨ繖涓帴鍙� + /// </summary> + public const string API_POST_GetRegionByAccount = "/smart-footstone/region/regionByAccount"; + /// <summary> + /// 鑾峰彇鍏ㄧ悆鍖哄煙鍒楄〃 鍏嶇櫥褰� + /// </summary> + public const string API_POST_GlobalRegionList = "/smart-footstone/region/globalRegionList"; + #endregion + + #region 鈻� AcCluster -- 鐧诲綍鍜屾敞鍐岄儴鍒哶__________________________ + /// <summary> + /// 甯愬彿鐧诲綍 + /// </summary> + public const string API_POST_Login = "/smart-footstone/member/oauth/login"; + /// <summary> + /// 杈撳叆楠岃瘉鐮佹敞鍐� + /// </summary> + public const string API_POST_Member_Register = "/smart-footstone/member/oauth/register"; + /// <summary> + /// 鐢ㄦ埛鎵惧洖瀵嗙爜 + /// </summary> + public const string API_POST_Member_ForgetPwd = "/smart-footstone/member/oauth/forgetPwd"; + /// <summary> + /// 淇敼瀵嗙爜 + /// </summary> + public const string API_POST_Update_Pwd = "/smart-footstone/member/memberInfo/updatePwd"; + /// <summary> + /// 鍙戦�侀獙璇佺爜 + /// </summary> + public const string API_POST_Verification_Send = "/smart-footstone/verification/message/send"; + /// <summary> + /// 楠岃瘉娑堟伅楠岃瘉鐮� + /// </summary> + public const string API_POST_Verification_Check = "/smart-footstone/verification/message/check"; + #region 鐢ㄦ埛淇℃伅銆佸ご鍍忋�佺粦瀹氳璇�(鎵嬫満/閭) + /// <summary> + /// 鑾峰彇涓汉淇℃伅 + /// </summary> + public const string API_POST_Member_GetMemberInfo = "/smart-footstone/member/memberInfo/getMemberInfo"; + /// <summary> + /// 鏇存柊涓汉淇℃伅 + /// </summary> + public const string API_POST_Member_UpdateMemberInfo = "/smart-footstone/member/memberInfo/updateMemberInfo"; + /// <summary> + /// 鏍规嵁璐﹀彿鑾峰彇涓汉淇℃伅 + /// </summary> + public const string API_POST_Member_GetMemberInfoByAccount = "/smart-footstone/member/memberInfo/getMemberInfoByAccount"; + ///// <summary> + ///// 涓婁紶澶村儚 + ///// </summary> + //public const string API_POST_Head_Upload = "/home-wisdom/app/head/portrait/upload"; + ///// <summary> + ///// 涓嬭浇澶村儚 + ///// </summary> + //public const string API_POST_Head_Down = "/home-wisdom/app/head/portrait/down"; + ///// <summary> + ///// 鏍规嵁璐﹀彿涓嬭浇澶村儚 + ///// </summary> + //public const string API_POST_Head_DownWithAccount = "/home-wisdom/app/head/portrait/downWithAccount"; + /// <summary> + /// 缁戝畾璁よ瘉(鎵嬫満/閭) + /// </summary> + public const string API_POST_Member_BindWithAccount = "/smart-footstone/member/memberInfo/bindWithAccount"; + /// <summary> + /// 瑙g粦璁よ瘉(鎵嬫満/閭) + /// </summary> + public const string API_POST_Member_UnbindWithAccount = "/smart-footstone/member/memberInfo/unbindWithAccount"; + #endregion + + /// <summary> + /// 鏌ヨ鍔熻兘浠嬬粛鍒楄〃 + /// </summary> + public const string API_POST_FunctionIntroductionList = "/home-wisdom/app/functionIntroduction/list"; + #endregion + + #region 鈻� HomeCluster -- 浣忓畢绠$悊鎺ュ彛___________________________ + + /// <summary> + /// 缁戝畾浣忓畢 + /// </summary> + public const string Api_Post_BindlingResidence = "/app/home/deliver"; + /// <summary> + /// 鑾峰彇浣忓畢鍒嗛〉 + /// </summary> + public const string API_POST_Gethomepager = "/home-wisdom/app/home/list"; + /// <summary> + /// 鍒犻櫎浣忓畢 + /// </summary> + public const string API_POST_Home_Delete = "/home-wisdom/app/home/delete"; + /// <summary> + /// 鏇存柊浣忓畢 + /// </summary> + public const string API_POST_Home_UpdateHome = "/home-wisdom/app/home/update"; + /// <summary> + /// 浣忓畢杩佺Щ + /// </summary> + public const string API_POST_Home_Transfer = "/home-wisdom/app/home/transfer"; + /// <summary> + /// 鏇存敼浣忓畢鏉冮檺 + /// </summary> + public const string API_Post_Home_UpdateDebugPerm = "/home-wisdom/app/home/updateDebugPerm"; + /// <summary> + /// 杩囨埛 + /// </summary> + public const string API_Post_TransferResidence = "/home-wisdom/app/home/transfer"; + /// <summary> + /// 绠$悊鍛樻潈闄愯縼绉� + /// </summary> + public const string API_Post_AdminAuthorityMigration = "/home-wisdom/app/home/ownerConvert"; + + #endregion + + #region 鈻� 瀛愯处鍙� -- 娣诲姞浣忓畢鎴愬憳___________________________ + /// <summary> + /// 娣诲姞瀛愯处鎴� + /// </summary> + public const string API_POST_Child_Add = "/home-wisdom/app/child/account/add"; + /// <summary> + /// 鍒犻櫎瀛愯处鎴� + /// </summary> + public const string API_POST_Child_Delete = "/home-wisdom/app/child/account/delete"; + /// <summary> + /// 鏍规嵁浣忓畢 id 鏌ヨ鎵�鏈夌殑瀛愯处鎴� + /// </summary> + public const string API_POST_Child_FindAll = "/home-wisdom/app/child/account/findAll"; + /// <summary> + /// 鏇存柊杩滅▼鎺у埗 + /// </summary> + public const string API_POST_Child_Update = "/home-wisdom/app/child/account/update"; + /// <summary> + /// 瀛愯处鍙风鐞嗗憳鑾峰彇涓昏处鍙锋巿鏉僒oken + /// </summary> + public const string API_POST_Child_GetMasterToken = "/home-wisdom/app/child/account/masterToken/get"; + ///// <summary> + ///// 涓嬭浇瀛愯处鍙峰ご鍍� + ///// </summary> + //public const string API_POST_Child_DownloadHeadImage = "/home-wisdom/app/child/account/getHeadPortrait"; + /// <summary> + /// 涓嬭浇璐﹀彿澶村儚 + /// </summary> + public const string API_POST_DownloadHeadImage = "/home-wisdom/app/head/portrait/downWithAccount"; + + #region 鏁版嵁鍒嗕韩 + /// <summary> + /// 鍒嗕韩鎸囧畾鏂囦欢缁欐寚瀹氭垚鍛� + /// </summary> + public const string API_POST_Home_Share_Add = "/home-wisdom/app/home/share/add"; + /// <summary> + /// 鏌ヨ鎸囧畾鎴愬憳鐨勬墍鏈夊垎浜枃浠� + /// </summary> + public const string API_POST_Home_Share_FindAll = "/home-wisdom/app/home/share/findAll"; + /// <summary> + /// 涓嬭浇鎸囧畾鐨勫垎浜枃浠� + /// </summary> + public const string API_POST_Home_Share_DownOne = "/home-wisdom/app/home/share/downOne"; + /// <summary> + /// 鍒犻櫎鎸囧畾鐨勫垎浜枃浠� + /// </summary> + public const string API_POST_Home_Share_Delete = "/home-wisdom/app/home/share/delete"; + + #endregion + + #endregion + + #region 鈻� GatewayCluster -- 缃戝叧___________________________ + ///// <summary> + ///// 缁戝畾缃戝叧鍒颁綇瀹� + ///// </summary> + //public const string API_POST_BindGateway = "/home-wisdom/app/gateway/bindGateway"; + /// <summary> + /// 鑾峰彇浣忓畢缃戝叧鍒嗛〉 + /// </summary> + public const string API_POST_GetGatewayList = "/home-wisdom/app/gateway/getGatewayList"; + /// <summary> + /// 鑾峰彇缃戝叧淇℃伅 + /// </summary> + public const string Api_Post_GetGatewayInfo = "/home-wisdom/app/gateway/info"; + ///// <summary> + ///// 瑙g粦缁戠綉鍏冲埌浣忓畢 + ///// </summary> + public const string API_POST_UntieGateway = "/home-wisdom/app/gateway/untieGateway"; + + #endregion + + #region 鈻� GatewayCenterCluster -- 缃戝叧涓績鏈嶅姟鍣╛__________________________ + ///// <summary> + ///// 缃戝叧鐧诲綍 + ///// </summary> + //public const string API_POST_GatewayLogin = "/GatewayCenterCluster/V1/gatewayLogin"; + + #endregion + + #region 鈻� ClientCenterCluster -- 瀹㈡埛绔腑蹇冩湇鍔″櫒___________________________ + /// <summary> + /// 鑾峰彇杩滅▼杩炴帴 + /// </summary> + public const string API_POST_GetMqttRemoteInfo = "/home-wisdom/app/mqtt/getRemoteInfo"; + #endregion + + #region 鈻� HomebackupCluster -- 浣忓畢澶囦唤寰湇鍔__________________________ + ///// <summary> + ///// 鍒涘缓鏂囦欢澶� + ///// </summary> + //public const string API_POST_Folder_Create = "/home-wisdom/app/backup/folder/create"; + + ///// <summary> + ///// 鍒犻櫎鏂囦欢澶� + ///// </summary> + //public const string API_POST_Folder_Delete = "/home-wisdom/app/backup/folder/delete"; + + ///// <summary> + ///// 鏌ユ壘鎵�鏈夋枃浠跺す + ///// </summary> + //public const string API_POST_Folder_FindAll = "/home-wisdom/app/backup/folder/findAll"; + + ///// <summary> + ///// 鏇存柊鏂囦欢澶� + ///// </summary> + //public const string API_POST_Folder_Update = "/home-wisdom/app/backup/folder/update"; + + ///// <summary> + ///// 涓婁紶鏂囦欢 + ///// </summary> + //public const string API_POST_File_Create = "/home-wisdom/app/backup/file/create"; + + /////// <summary> + /////// 鍒犻櫎鏂囦欢 + /////// </summary> + ////public const string API_DELETE_File_Delete = "/HomebackupCluster/V1/file/delete"; + + ///// <summary> + ///// 涓嬭浇澶囦唤鏂囦欢 + ///// </summary> + //public const string API_POST_File_Down = "/home-wisdom/app/backup/file/downOne"; + + ///// <summary> + ///// 鏌ヨ涓�涓枃浠跺す鎵�鏈夋枃浠跺悕 + ///// </summary> + //public const string API_POST_File_FindAll = "/home-wisdom/app/backup/file/findAll"; + + #endregion + + #region 鈻� Speaker -- 璇煶鎺у埗鏈嶅姟___________________________ + /// <summary> + /// 鑾峰彇宸叉巿鏉冪殑闊崇鍒楄〃 + /// </summary> + public const string API_POST_Speaker_List_Get = "/smart-footstone/app/token/list"; + /// <summary> + /// 缂栬緫闊崇鎺堟潈澶囨敞 + /// </summary> + public const string API_POST_Speaker_Remark_Update = "/smart-footstone/app/token/update"; + /// <summary> + /// 瑙g粦闊崇 + /// </summary> + public const string API_POST_Speaker_Unbind = "/smart-footstone/app/token/delete"; + /// <summary> + /// 鑾峰彇闊崇鍒嗛厤鐨勮澶囧拰鍦烘櫙鍒楄〃 + /// </summary> + public const string API_POST_Speaker_DeviceList_Get = "/home-wisdom/app/tokenRelation/list"; + /// <summary> + /// 鏇存柊闊崇鎺у埗鐨勮澶囧拰鍦烘櫙鐩爣 + /// </summary> + public const string API_POST_Speaker_DeviceList_Update = "/home-wisdom/app/tokenRelation/save"; + #endregion + + #region 鈻� PushSerivce -- 鎺ㄩ�佹湇鍔℃帴鍙__________________________ + + /// <summary> + /// 娉ㄥ唽鎺ㄩ�佹帴鍙� + /// 鎵归噺鎺ㄩ�佺粦瀹氬灞呯ぞ鍖烘帴鍙� + /// 2021-09-09 瀵规帴鏂版帴鍙f敮鎸佺墿涓氬叕鍛婃帹閫� + /// communityCodes 涓嶄紶 榛樿鎵�鏈変綇瀹呮垨鑰呭皬鍖洪兘鏀跺埌鎺ㄩ�� + /// </summary> + public const string API_POST_PushSerivce_AddToken = "/smart-footstone/app/push-information/addPushToken"; + /// <summary> + /// 娉ㄩ攢鎺ㄩ�佹帴鍙� + /// 鎵归噺瑙g粦瀹跺眳绀惧尯 + /// 2021-09-09 瀵规帴鏂版帴鍙f敮鎸佺墿涓氬叕鍛婃帹閫� + /// </summary> + public const string API_POST_PushSerivce_DeleteToken = "/smart-footstone/app/push-information/unBindPushToken"; + ///// <summary> + ///// 娣诲姞鎺ㄩ�乀oken + ///// </summary> + //public const string API_POST_PushSerivce_AddToken = "/smart-footstone/app/push-information/add"; + ///// <summary> + ///// 鍒犻櫎鎺ㄩ�乀oken + ///// </summary> + //public const string API_POST_PushSerivce_DeleteToken = "/smart-footstone/app/push-information/delete"; + ///// <summary> + /////// 鑾峰彇鎺ㄩ�佹秷鎭褰� + /////// </summary> + //public const string API_POST_PushSerivce_Getpushmessagelist = "/smart-footstone/app/message/list"; + /// <summary> + /// 鑾峰彇鎺ㄩ�佹秷鎭褰� 鍒嗛〉 + /// </summary> + public const string API_POST_PushSerivce_Getpushmessagelist_Paging = "/smart-footstone/app/message/page"; + /// <summary> + /// 娓呯┖鎺ㄩ�佺殑娑堟伅璁板綍 + /// </summary> + public const string API_POST_PushSerivce_Clearmessagelist = "/smart-footstone/app/message/clear"; + /// <summary> + /// 鏍囪娑堟伅宸茶 + /// </summary> + public const string API_POST_PushSerivce_Markread = "/smart-footstone/app/message/read"; + /// <summary> + /// 鏍囪娑堟伅鍏ㄩ儴宸茶 + /// </summary> + public const string API_POST_PushSerivce_ALLMarkread = "/smart-footstone/app/message/read_all"; + /// <summary> + /// 閫氳繃涓婚敭id鍒犻櫎涓�鏉℃帹閫佽褰� + /// </summary> + public const string API_POST_PushSerivce_Deletepushinfo = "/smart-footstone/app/message/delete_by_id"; + /// <summary> + /// 鑾峰彇鐗╀笟鍏憡璇︽儏 + /// </summary> + public const string API_POST_PushSerivce_GetNoticeInfo = "/community-footstone/app/notice/info"; + + #endregion + + #region 鈻� -- 妫�娴嬫洿鏂版帴鍙__________________________ + /// <summary> + /// 妫�娴嬫洿鏂�,鏄惁闇�瑕佸己鍒舵洿鏂� + /// </summary> + public const string API_POST_CheckAppVersion = "/smart-footstone/app/appVersion/check"; + ///// <summary> + ///// 鏌ヨAPP鏈�鏂扮増鏈� + ///// </summary> + //public const string API_POST_GetAppVersion = "/smart-footstone/app/getAppVersion"; + #endregion + + + + #region 鈻� -- 鎴块棿鍦烘櫙鑳屾櫙鍥剧墖涓婁紶涓嬭浇鎺ュ彛___________________________ + /// <summary> + /// 涓婁紶鍥剧墖 + /// </summary> + public const string API_POST_UploadImage = "/home-wisdom/app/images/upload_image"; + /// <summary> + /// 鏌ヨ鍥剧墖璺緞 + /// </summary> + public const string API_POST_GetImageUrl = "/home-wisdom/app/images/get_image_url"; + #endregion + + + #region Kaede -- 璁惧鎺ュ彛____________________________ + /// <summary> + /// 鑾峰彇璁惧鍒楄〃 + /// </summary> + public const string Api_Post_GetDevcieList = "/home-wisdom/app/device/list"; + /// <summary> + /// 鑾峰彇绗笁鏂瑰搧鐗岃澶囧垪琛� + /// </summary> + public const string Api_Post_Get3tyBrandDevcieList = "/home-wisdom/app/product/list"; + /// <summary> + /// 娉ㄥ唽绗笁鏂硅澶� + /// </summary> + public const string Api_Post_IndependentRegister3TyDevcie = "/home-wisdom/app/device/independentRegister"; + /// <summary> + /// 鑾峰彇璁惧璇︽儏 + /// </summary> + public const string Api_Post_GetDevcieInfoList = "/home-wisdom/app/device/info"; + + /// <summary> + /// 鍒锋柊璁惧鐘� + /// </summary> + public const string Api_Post_RefreshDeviceStatus = "/home-wisdom/app/device/status/refresh"; + /// <summary> + /// 璁惧鎺у埗 + /// </summary> + public const string Api_Post_ControlDevice = "/home-wisdom/app/device/control"; + /// <summary> + /// 缂栬緫璁惧淇℃伅 + /// </summary> + public const string Api_Post_EditDevice = "/home-wisdom/app/device/edit"; + /// <summary> + /// 璁惧缁戝畾鎴块棿 + /// </summary> + public const string Api_Post_BindDeviceToRoom = "/home-wisdom/app/device/bindRoom"; + /// <summary> + /// 璁惧瑙g粦鎴块棿 + /// </summary> + public const string Api_Post_UnbindDeviceToRoom = "/home-wisdom/app/device/unbindRoom"; + /// <summary> + /// 璁惧鍚嶇О淇敼 + /// </summary> + public const string Api_Post_EditDeviceName = "/home-wisdom/app/device/rename"; + /// <summary> + /// 鏀惰棌璁惧 + /// </summary> + public const string Api_Post_CollectDevice = "/home-wisdom/app/device/collect"; + /// <summary> + /// 鍙栨秷鏀惰棌璁惧 + /// </summary> + public const string Api_Post_CancelCollectDevice = "/home-wisdom/app/device/cancelCollect"; + /// <summary> + /// 鑾峰彇鐜浼犳劅鍣ㄥ巻鍙叉暟鎹� 灏忔椂/鍛�/鏈堢粺璁℃暟鎹� + /// </summary> + public const string Api_Post_EnvironmentalSensorHistoricalData = "/home-wisdom/app/statistics/device/hourWeekMonth"; + /// <summary> + /// 鑾峰彇瀹夐槻浼犳劅鍣ㄥ巻鍙叉暟鎹� + /// </summary> + public const string Api_Post_ArmSensorHistoricalData = "/home-wisdom/app/device/message"; + /// <summary> + /// 璇诲彇鏈�杩戜竴涓湀鐨勬暟鎹� + /// </summary> + public const string Api_Post_SensorLastMonthHistoricalData = "/home-wisdom/app/statistics/device/monthDiff"; + #endregion + + #region Kaede -- 鍦烘櫙鎺ュ彛____________________________ + /// <summary> + /// 鑾峰彇鍦烘櫙鍒楄〃 + /// </summary> + public const string Api_Post_GetSecneList = "/home-wisdom/app/scene/list"; + /// <summary> + /// 鑾峰彇鍦烘櫙璇︽儏 + /// </summary> + public const string Api_Post_GetSecneInfo = "/home-wisdom/app/scene/info"; + /// <summary> + /// 娣诲姞鍦烘櫙 + /// </summary> + public const string Api_Post_AddSecne = "/home-wisdom/app/scene/add"; + /// <summary> + /// 缂栬緫鍦烘櫙 + /// </summary> + public const string Api_Post_EditSecne = "/home-wisdom/app/scene/update"; + /// <summary> + /// 鍒犻櫎鍦烘櫙 + /// </summary> + public const string Api_Post_DeleteSecne = "/home-wisdom/app/scene/delete"; + /// <summary> + /// 鎵ц鍦烘櫙 + /// </summary> + public const string Api_Post_ExecuteSecne = "/home-wisdom/app/scene/execute"; + /// <summary> + /// 鏀惰棌鍦烘櫙 + /// </summary> + public const string Api_Post_CollectScene = "/home-wisdom/app/scene/collect"; + /// <summary> + /// 鍙栨秷鏀惰棌鍦烘櫙 + /// </summary> + public const string Api_Post_CancelCollectScene = "/home-wisdom/app/scene/cancelCollect"; + #endregion + + #region Kaede -- 鎴块棿鎺ュ彛____________________________ + /// <summary> + /// 鑾峰彇璁惧鍒楄〃 + /// </summary> + public const string Api_Post_GetRoomList = "/home-wisdom/app/room/list"; + /// <summary> + /// 娣诲姞鎴块棿 + /// </summary> + public const string Api_Post_AddRoom = "/home-wisdom/app/room/add"; + /// <summary> + /// 鍒犻櫎鎴块棿 + /// </summary> + public const string Api_Post_DelRoom = "/home-wisdom/app/room/delete"; + /// <summary> + /// 淇敼鎴块棿 + /// </summary> + public const string Api_Post_UpdateRoom = "/home-wisdom/app/room/update"; + + #endregion + + #region Kaede -- 瀹夐槻鎺ュ彛____________________________ + /// <summary> + /// 鑾峰彇瀹夐槻鍒楄〃 + /// </summary> + public const string Api_Post_Security_List = "/home-wisdom/app/security/list"; + /// <summary> + /// 鑾峰彇瀹夐槻璇︽儏 + /// </summary> + public const string Api_Post_Security_Info = "/home-wisdom/app/security/info"; + /// <summary> + /// 娣诲姞瀹夐槻 + /// </summary> + public const string Api_Post_Security_Add = "/home-wisdom/app/security/add"; + /// <summary> + /// 缂栬緫瀹夐槻 + /// </summary> + public const string Api_Post_Security_Edit = "/home-wisdom/app/security/edit"; + /// <summary> + /// 鍒犻櫎瀹夐槻 + /// </summary> + public const string Api_Post_Security_Delete = "/home-wisdom/app/security/delete"; + /// <summary> + /// 璇诲彇瀹夐槻闃插尯鐘舵�� + /// </summary> + public const string Api_Post_Security_StatusRead = "/home-wisdom/app/security/statusRead"; + /// <summary> + /// 璁剧疆瀹夐槻闃插尯鐘舵�� + /// </summary> + public const string Api_Post_Security_StatusSet = "/home-wisdom/app/security/statusSet"; + /// <summary> + /// 瀹夐槻bypass璁剧疆 + /// </summary> + public const string Api_Post_Security_BypassSet = "/home-wisdom/app/security/bypassSet"; + /// <summary> + /// 瀹夐槻bypass璇诲彇 + /// </summary> + public const string Api_Post_Security_BypassRead = "/home-wisdom/app/security/bypassRead"; + /// <summary> + /// 鏌ヨ瀹夐槻鎵�鏈夎褰� + /// </summary> + public const string Api_Post_Security_ListSecurityLog = "/home-wisdom/app/security/listSecurityLog"; + /// <summary> + /// 鏌ヨ瀹夐槻鎶ヨ璁板綍 + /// </summary> + public const string Api_Post_Security_ListAlarmLog = "/home-wisdom/app/security/listAlarmLog"; + + #endregion + + + #region 鈻� -- 鎴块棿銆佽澶囥�佸満鏅垎浜玙__________________________ + /// <summary> + /// 娣诲姞鍒嗕韩 + /// </summary> + public const string API_POST_Share_Add = "/home-wisdom/app/share/add"; + /// <summary> + /// 鍒犻櫎鍒嗕韩 + /// </summary> + public const string API_POST_Share_Delete = "/home-wisdom/app/share/delete"; + /// <summary> + /// 鑾峰彇鍒嗕韩 + /// </summary> + public const string API_POST_Share_GetList = "/home-wisdom/app/share/list"; + #endregion + + + #region 鈻� -- 鑷姩鍖栨帴鍙__________________________ + /// <summary> + /// 鑾峰彇鑷姩鍖栧垪琛� + /// </summary> + public const string API_POST_Logic_List = "/home-wisdom/app/logic/list"; + /// <summary> + ///鑾峰彇鑷姩鍖栬鎯� + /// </summary> + public const string API_POST_Logic_Info = "/home-wisdom/app/logic/info"; + /// <summary> + /// 娣诲姞鑷姩鍖� + /// </summary> + public const string API_POST_Logic_Add = "/home-wisdom/app/logic/add"; + /// <summary> + /// 缂栬緫鑷姩鍖� + /// </summary> + public const string API_POST_Logic_Update = "/home-wisdom/app/logic/update"; + /// <summary> + /// 鍒犻櫎鑷姩鍖� + /// </summary> + public const string API_POST_Logic_Delete = "/home-wisdom/app/logic/delete"; + /// <summary> + /// 鍚敤绂佺敤鑷姩鍖� + /// </summary> + public const string API_POST_Logic_Enable = "/home-wisdom/app/logic/enable"; + #endregion + + #region -- 绗笁鏂硅澶囩浉鍏虫帴鍙__________________________ + /// <summary> + /// 鑾峰彇娣诲姞杩囩殑鍝佺墝鍒楄〃 + /// </summary> + public const string Api_Post_GetBindBrandList = "/home-wisdom/app/product/brand/bindList"; + /// <summary> + /// 鑾峰彇鍝佺墝鍒楄〃 + /// </summary> + public const string Api_Post_GetBrandList = "/home-wisdom/app/product/brand/list"; + + #region 鈻� -- 绾㈠瀹濇帴鍙__________________________ + /// <summary> + /// 绾㈠瀹濊澶囧畾浣� + /// </summary> + public const string API_POST_Ir_DeviceFind = "/home-wisdom/app/device/ir/deviceFind"; + /// <summary> + /// 绾㈠瀹濅笅鐨勯仴鎺у櫒鍒楄〃 + /// </summary> + public const string API_POST_Ir_List = ":/home-wisdom/app/device/ir/list"; + /// <summary> + /// 閬ユ帶鍣ㄧ孩澶栫爜瀛︿範 + /// </summary> + public const string API_POST_Ir_CodeStudy = "/home-wisdom/app/device/ir/codeStudy"; + /// <summary> + ///绾㈠瀹濈孩澶栫爜搴撹瘯鐮� + /// </summary> + public const string API_POST_Ir_CodeTest = "/home-wisdom/app/device/ir/codeTest"; + /// <summary> + /// 绾㈠瀹濋仴鎺у櫒娣诲姞 + /// </summary> + public const string API_POST_Ir_Add = "/home-wisdom/app/device/ir/add"; + /// <summary> + /// 閬ユ帶鍣ㄨ嚜瀛︽寜閿垹闄� + /// </summary> + public const string API_POST_Ir_CodeRemove = "/home-wisdom/app/device/ir/codeRemove"; + /// <summary> + /// 鑾峰彇璁惧璇︽儏閫氳繃(spk,sid) + /// </summary> + public const string Api_Post_GetinfoBySid = "/home-wisdom/app/device/infoBySid"; + /// <summary> + /// 绾㈠瀹�/閬ユ帶鍣ㄥ垹闄� + /// </summary> + public const string API_POST_Ir_DeviceDel = "/home-wisdom/app/device/remove"; + /// <summary> + /// 淇敼璁惧鍚嶇О + /// </summary> + public const string API_POST_Ir_DeviceRename = "/home-wisdom/app/device/rename"; + + #endregion + + #endregion + + + #region 鈻� -- 钀ょ煶SDK鐩稿叧鎺ュ彛___________________________ + /// <summary> + /// 娌充笢鑾峰彇钀ょ煶浜戝瓙璐﹀彿token鐨勬帴鍙� + /// </summary> + public const string API_POST_EZ_GetChildToken = "/home-wisdom/platform/yingshi/child/token"; + + + #endregion + + #region 鈻� -- 涓版灄鐩稿叧鐩稿叧鎺ュ彛___________________________ + /// <summary> + /// 妫�鏌ヤ綇瀹呮槸鍚︾粦瀹氫赴鏋楋紝骞惰幏鍙栭棬鍙f満鍒楄〃 + /// </summary> + public const string API_POST_FL_Check = "/home-wisdom/app/fl/vi/check"; + /// <summary> + /// 鎺ュ惉 + /// </summary> + public const string API_POST_FL_Answer = "/home-wisdom/app/fl/vi/answer"; + /// <summary> + /// 鎷掓帴 + /// </summary> + public const string API_POST_FL_Reject = "/home-wisdom/app/fl/vi/reject"; + /// <summary> + /// 寮�閿佹垚鍔� + /// </summary> + public const string API_POST_FL_Unlock = "/home-wisdom/app/fl/vi/unlock"; + /// <summary> + /// 閫氳瘽瑙嗛鎴浘涓婁紶 + /// </summary> + public const string API_POST_FL_Screenshot = "/home-wisdom/app/fl/vi/screenshot"; + /// <summary> + /// 鎸傛柇 + /// </summary> + public const string API_POST_FL_HangUp = "/home-wisdom/app/fl/vi/hang-up"; + /// <summary> + /// 鍒犻櫎閫氳瘽璁板綍 + /// </summary> + public const string API_POST_FL_DeleteCallInfo = "/home-wisdom/app/fl/vi/delete"; + /// <summary> + /// 鑾峰彇闂ㄥ彛鏈哄垪琛� + /// </summary> + public const string API_POST_FL_List = "http://112.74.164.111:180/api.php/Device/getmonitorUUID"; + /// <summary> + /// 鍔ㄦ�佸瘑鐮�/浜岀淮鐮佸紑閿� + /// </summary> + public const string API_POST_FL_QRcode = "http://112.74.164.111:180/api.php/Device/setdynamicpwd"; + #endregion + + + #region 鍙瀵硅鏍囧噯閫氱敤鎺ュ彛 + /// <summary> + /// 鑾峰彇鍙瀵硅璁惧鍒楄〃锛堟墍鏈夊鎺ュ彲瑙嗗璁查兘鍖呭惈涓�璧凤級 + /// </summary> + public const string API_POST_VideoDeviceList = "/home-wisdom/platform/imou/listVisualSpeaks"; + /// <summary> + /// 杩滅▼寮�闂� + /// </summary> + public const string API_POST_VideoDevice_OpenDoorbell = "/home-wisdom/platform/imou/openDoorbell"; + /// <summary> + /// 鏇存敼閫氳瘽鐘舵�� + /// </summary> + public const string API_POST_VideoDevice_UpdateCallStatus = "/home-wisdom/platform/imou/updateCallStatus"; + /// <summary> + /// 鑾峰彇閫氳瘽璁板綍 + /// </summary> + public const string API_POST_FL_GetCallList = "/home-wisdom/platform/imou/listCallRecords"; + + /// <summary> + /// 浜鸿劯褰曞叆 + /// </summary> + public const string Api_Post_InputUserFace = "/community-wisdom/app/doorDevice/inputUserFaceHouse"; + /// <summary> + /// 寮�鍏充汉鑴稿姛鑳� + /// </summary> + public const string Api_Post_SwitchFaceFunction = "/community-wisdom/app/doorDevice/updateCustomerFaceClose"; + /// <summary> + /// 鑾峰彇浣忔埛璇︽儏 + /// </summary> + public const string Api_Post_GetCustomerInfo = "/basis-footstone/app/customer/detail"; + /// 浣忓畢sip璐﹀彿鑾峰彇 + /// </summary> + public const string API_POST_VideoDevice_GetSipAccount = "/home-wisdom/app/home/getSipAccount"; + #endregion + + + #region 鈻� -- 闂ㄩ攣鐩稿叧鎺ュ彛_______________________________ + + /// <summary> + /// 鍒ゆ柇闂ㄩ攣鏄惁绗竴浣跨敤 + /// </summary> + public const string API_POST_DoorisFirstUse = "/home-wisdom/app/device/door/isUserBind"; + /// <summary> + /// 闂ㄩ攣绗竴娆′娇鐢ㄦ椂,缁戝畾鐨勫瘑鐮� + /// </summary> + public const string API_POST_DoorBindFirstUsePsw = "/home-wisdom/app/device/door/userBind"; + /// <summary> + /// 鑾峰彇闂ㄩ攣鎵�鏈夌殑瀵嗙爜 + /// </summary> + public const string API_POST_GetDoorAllPsw = "/home-wisdom/app/device/door/getPwds"; + /// <summary> + /// 闂ㄩ攣鍒嗛厤瀵嗙爜缁欑敤鎴� + /// </summary> + public const string API_POST_DoorAssignPswToUser = "/home-wisdom/app/device/door/pwdAllot"; + /// <summary> + /// 闂ㄩ攣鐨勫巻鍙茶褰� + /// </summary> + public const string API_POST_DoorHistory = "/home-wisdom/app/device/door/logs"; + + #endregion + + #region 鈻� -- SIP鐩稿叧鎺ュ彛_______________________________ + #endregion + /// <summary> + /// 缁戝畾source闈㈡澘 + /// </summary> + public const string Api_Post_BindSourcePanel = "/home-wisdom/source/screen/home/bind"; + + + } + + ///// <summary> + ///// BaseRequestObj + ///// </summary> + //[System.Serializable] + //public class BaseRequestObj + //{ + // public string RequestVersion = MainPage.CodeIDString; + + // public string RequestSource = MainPage.ClientType; + + // public string LoginAccessToken; + //} + + + +} diff --git a/SiriIntents/Server/NewApiRes.cs b/SiriIntents/Server/NewApiRes.cs new file mode 100644 index 0000000..50ff324 --- /dev/null +++ b/SiriIntents/Server/NewApiRes.cs @@ -0,0 +1,1510 @@ +锘縰sing System; +using System.Collections.Generic; + +namespace SiriIntents.Server +{ + + #region **************************************鏂版湇鍔″櫒************************************** + [System.Serializable] + public class BaseNoTokenObj + { + //public string RequestVersion = MainPage.CodeIDString; + ////璇锋眰鏉ユ簮 + //public string clientType = MainPage.ClientType; + + } + + [System.Serializable] + public class NullObj + { + + } + + #region 鈻� 鍏ㄧ悆鍖哄煙鍒楄〃 ____________________________ + [System.Serializable] + public class GetRegionListObj + { + /// <summary> + /// 鍖哄煙鏍囪瘑 + /// </summary> + public string regionMark; + + } + + [System.Serializable] + public class RegionByAccountObj + { + /// <summary> + /// 璐﹀彿 + /// </summary> + public string account; + + } + + [System.Serializable] + public class GlobalRegionListRes + { + public string regionId; + public string regionName; + public string regionUrl; + } + + /// <summary> + /// 鍒嗛〉 + /// </summary> + public class BasePagingObj + { + public int totalCount = 0; + public int totalPage = 0; + public int pageNo = 0; + public int pageSize = 0; + } + + #endregion + + #region 鈻� 鐧诲綍 ____________________________ + [System.Serializable] + public class LoginObj + { + /// <summary> + /// 璐﹀彿 + /// </summary> + public string account; + /// <summary> + /// 瀵嗙爜 + /// </summary> + public string loginPwd; + /// <summary> + /// 鎺堟潈绫诲瀷,鍙敤鍊�:captcha,refresh_token,password,verify + /// </summary> + public string grantType = "password"; + /// <summary> + /// 骞冲彴 WEB銆丄PP銆乄X銆丄LIPAY + /// </summary> + public string platform = "APP"; + /// <summary> + /// 楠岃瘉鐮侊紝鐭俊鐧诲綍鏃跺�欑敤 + /// </summary> + public string verifyCode; + + + } + + /// <summary> + /// 鍒锋柊token + /// </summary> + [System.Serializable] + public class RefreshTokenObj + { + /// <summary> + /// refreshToken + /// </summary> + public string refreshToken; + /// <summary> + /// 鎺堟潈绫诲瀷,鍙敤鍊�:captcha,refresh_token,password,verify + /// </summary> + public string grantType = "refresh_token"; + /// <summary> + /// 骞冲彴 WEB銆丄PP銆乄X銆丄LIPAY + /// </summary> + public string platform = "APP"; + + } + + /// <summary> + /// + /// </summary> + [Serializable] + public class UserLoginRes + { + /// <summary> + /// + /// </summary> + public string expiresIn; + /// <summary> + /// + /// </summary> + public string refreshToken; + /// <summary> + /// + /// </summary> + public string accessToken; + /// <summary> + /// 璐﹀彿绫诲瀷 "C"锛欳绔处鍙� + /// </summary> + public string userType; + /// <summary> + /// Token "Bearer " + /// </summary> + public string headerPrefix; + /// <summary> + /// 鐢ㄦ埛ID + /// </summary> + public string userId; + /// <summary> + /// 鐢ㄦ埛鍚嶅瓧 + /// </summary> + public string name; + + } + + /// <summary> + /// 鐧诲綍閿佸畾鍚庣殑寮傚父鎵╁睍鍙傛暟 + /// </summary> + [Serializable] + public class AccountLoginLockExtraRes + { + /// <summary> + /// 鏈�澶у厑璁哥殑瀵嗙爜閿欒娆℃暟 + /// </summary> + public int maxPwdErrorNum; + /// <summary> + /// 褰撳墠閿欒娆℃暟 + /// </summary> + public int currentPwdErrorNum; + /// <summary> + /// 瑙i攣浜嬩欢 + /// </summary> + public long unlockTime; + + } + #endregion + + #region 鈻� 娉ㄥ唽 ____________________________ + + //鐢ㄦ埛杈撳叆鎵嬫満楠岃瘉鐮佽繘琛岄獙璇佹敞鍐� + [System.Serializable] + public class RegisterObj + { + /// <summary> + /// 鐢ㄦ埛璐﹀彿[鎵嬫満鍙穄 + /// </summary> + public string memberPhone; + /// <summary> + /// 鐢ㄦ埛璐﹀彿[閭] + /// </summary> + public string memberEmail; + /// <summary> + /// 楠岃瘉鐮� + /// </summary> + public string verifyCode; + ///// <summary> + ///// 鎵嬫満娉ㄥ唽鐨勮鍔犺繖涓紝鐭俊鍖哄煙浠g爜锛屽+86 + ///// </summary> + //public string phoneAreaCode; + /// <summary> + /// 鐧婚檰瀵嗙爜锛岄渶瑕丮D5澶勭悊 + /// </summary> + public string loginPwd; + /// <summary> + /// 浼氬憳鏄电О + /// </summary> + public string memberName; + } + + /// <summary> + /// 鍙戦�侀獙璇佺爜 + /// </summary> + [System.Serializable] + public class VerifyCodeSendObj + { + /// <summary> + /// 鎵嬫満鍙� + /// </summary> + public string phone; + /// <summary> + /// 鎵嬫満鍙峰墠缂� + /// </summary> + public string phonePrefix; + /// <summary> + /// 璇█ + /// </summary> + public string languageType; + /// <summary> + /// 閭 + /// </summary> + public string mail; + /// <summary> + /// 1:娉ㄥ唽 2锛氭壘鍥炲瘑鐮� 3锛氱粦瀹�4:楠岃瘉鐮佺櫥闄� 5:鏁忔劅鏁版嵁 + /// 榛樿浼�1 + /// </summary> + public int verifyType = 1; + /// <summary> + /// 楠岃瘉鐮佽繃鏈熸椂闂达紙绉掞級,榛樿5鍒嗛挓 + /// </summary> + public int expireSecond = 300; + + } + + /// <summary> + /// 楠岃瘉楠岃瘉鐮� + /// </summary> + [System.Serializable] + public class VerifyCodeCheckObj + { + /// <summary> + /// 鎵嬫満鍙� + /// </summary> + public string phone; + /// <summary> + /// 閭 + /// </summary> + public string mail; + /// <summary> + /// 1锛氭敞鍐� 2锛氭壘鍥炲瘑鐮� 3锛氱粦瀹� 4锛氶獙璇佺爜鐧婚檰 5锛氭晱鎰熸暟鎹� + /// 榛樿浼�1 + /// </summary> + public int verifyType = 1; + /// <summary> + /// 楠岃瘉鐮佽繃鏈熸椂闂达紙绉掞級,榛樿5鍒嗛挓 + /// </summary> + public string verifyCode; + /// <summary> + /// 楠岃瘉鎴愬姛鍚庨獙璇佺爜鏄惁澶辨晥 涓嶄紶鍊兼垨鑰卼rue澶辨晥锛屽彧鏈変紶false鐨勬椂鍊欙紝鏍¢獙閫氳繃鍚庨獙璇佺爜涔熶笉澶辨晥 + /// </summary> + public bool verifySuccessFail = true; + + } + + //[System.Serializable] + //public class SignPhoneObj + //{ + // public string phone; + // public int Company;// 鐭俊妯℃澘缂栧彿 int 鏄� + //} + + #endregion + + #region 鈻� 蹇樿瀵嗙爜 ____________________________ + //ForgetPwd 蹇樿瀵嗙爜,鎵嬫満鎴栭偖绠辨柟寮� + [System.Serializable] + public class ForgetPwdObj + { + /// <summary> + /// 鎵嬫満璐﹀彿 + /// </summary> + public string memberPhone; + /// <summary> + /// 閭璐﹀彿 + /// </summary> + public string memberEmail; + /// <summary> + /// 楠岃瘉鐮� + /// </summary> + public string verifyCode; + /// <summary> + /// 鏂板瘑鐮� + /// </summary> + public string loginPwd; + } + + /// <summary> + /// 鏇存敼涓汉瀵嗙爜 + /// </summary> + [System.Serializable] + public class UpdatePwdObj + { + /// <summary> + /// 鏃у瘑鐮� + /// </summary> + public string loginPwd; + /// <summary> + /// 鏂板瘑鐮� + /// </summary> + public string loginNewPwd; + } + + + #endregion + + #region 鈻� 甯愬彿淇℃伅 ____________________________ + /// <summary> + /// 鑾峰彇涓汉淇℃伅 + /// </summary> + [System.Serializable] + public class MemberInfoRes + { + /// <summary> + /// 鐢ㄦ埛ID + /// </summary> + public string memberId; + /// <summary> + /// 鐢ㄦ埛鏄电О + /// </summary> + public string memberName; + /// <summary> + /// 鐢ㄦ埛閭 + /// </summary> + public string memberEmail; + /// <summary> + /// 鐢ㄦ埛鎵嬫満鍙� + /// </summary> + public string memberPhone; + /// <summary> + /// 鍥藉鍖哄彿 + /// </summary> + public string memberPhonePrefix; + /// <summary> + /// 鐧诲綍鍚� + /// </summary> + public string loginName; + /// <summary> + /// 鐢ㄦ埛澶村儚 + /// </summary> + public string memberHeadIcon; + + } + + /// <summary> + /// 鏇存柊涓汉淇℃伅 + /// </summary> + [System.Serializable] + public class UpdateMemberNameRes + { + /// <summary> + /// 鐢ㄦ埛鏄电О + /// </summary> + public string memberName; + + } + + /// <summary> + /// 鏇存柊涓汉澶村儚 + /// </summary> + [System.Serializable] + public class UpdateMemberHeadIconRes + { + /// <summary> + /// 鐢ㄦ埛澶村儚 + /// </summary> + public string memberHeadIcon; + + } + + /// <summary> + /// 缁戝畾璁よ瘉(鎵嬫満/閭) + /// </summary> + [System.Serializable] + public class BindWithAccountObj + { + /// <summary> + /// 鐢ㄦ埛鎵嬫満 + /// </summary> + public string memberPhone; + /// <summary> + /// 鐢ㄦ埛鎵嬫満 + /// </summary> + public string memberEmail; + /// <summary> + /// 楠岃瘉鍚� + /// </summary> + public string verifyCode; + + + } + + /// <summary> + /// 瑙g粦缁戝畾璁よ瘉(鎵嬫満/閭) + /// </summary> + [System.Serializable] + public class UnBindAccountObj + { + /// <summary> + /// 瑙g粦鏍囩ず锛孭HONE锛孍MAIL + /// </summary> + public string unBindLabel; + } + + + #endregion + + #region 鈻� 浣忓畢鐩稿叧 ____________________________ + #region 鑾峰彇浣忓畢鍒嗛〉 + [System.Serializable] + public class GetHomeListObj + { + /// <summary> + /// 浣忓畢绫诲瀷 + /// </summary> + public string homeType; + /// <summary> + /// 涓嶈嚜鍔ㄧ敓鎴愰粯璁や綇瀹� + /// </summary> + public bool autoGenerate = false; + } + + + [Serializable] + public class AddOrUpdateHomeObj + { + /// <summary> + /// + /// </summary> + public string homeId; + /// <summary> + /// + /// </summary> + public string homeType; + /// <summary> + /// + /// </summary> + public double latitude; + /// <summary> + /// + /// </summary> + public double longitude; + /// <summary> + /// 浣忓畢鍚嶇О + /// </summary> + public string homeName; + /// <summary> + /// 浣忓畢鍦板潃 + /// </summary> + public string homeAddress; + } + + + //[Serializable] + //public class GethomepagerRes + //{ + + // /// <summary> + // /// + // /// </summary> + // public int totalPages; + // public int totalElements; + // public bool last; + // public bool first; + // public int numberOfElements; + // public int size; + // public int number; + // public bool empty; + + // public List<RegionInfoRes> content = new List<RegionInfoRes> (); + //} + + + //[Serializable] + //public class HomeInfoRes + //{ + + // /// <summary> + // /// + // /// </summary> + // public int totalPages; + // public int totalElements; + // public bool last; + // public bool first; + // public int numberOfElements; + // public int size; + // public int number; + // public bool empty; + + // public List<RegionInfoRes> content = new List<RegionInfoRes> (); + //} + + #endregion + + #region 缁戝畾缃戝叧 + [System.Serializable] + public class BindGatewayObj + { + /// <summary> + /// 浣忓畢ID + /// </summary> + public string homeId; + /// <summary> + /// 缃戝叧MAC + /// </summary> + public string mac; + /// <summary> + /// 浣忓畢绫诲瀷 + /// </summary> + public string gatewayType; + /// <summary> + /// 瀛愮綉鍙� + /// </summary> + public int subnetId; + /// <summary> + /// 璁惧鍙� + /// </summary> + public int deviceId; + + } + + #endregion + + #region 鑾峰彇浣忓畢缃戝叧鍒楄〃 + //[Serializable] + //public class HomeGatewayRes + //{ + // public int totalPages; + // public int totalElements; + // public bool last; + // public bool first; + // public int numberOfElements; + // public int size; + // public int number; + // public bool empty; + // public List<HomeGatewayInfo> content = new List<HomeGatewayInfo>(); + //} + + [Serializable] + public class HomeGatewayInfo + { + /// <summary> + /// 缃戝叧ID + /// </summary> + public string gatewayId =""; + /// <summary> + /// 缃戝叧snID + /// </summary> + public string sn = ""; + /// <summary> + /// + /// </summary> + public string aesKey = ""; + /// <summary> + /// BUSUDPGATEWAY, + /// AGATEWAY, + /// ZIGBEEGATEWAY, + /// KNXGATEWAY + /// </summary> + public string gatewayType = ""; + /// <summary> + /// 浣忓畢ID + /// </summary> + public string homeId = ""; + /// <summary> + /// + /// </summary> + public string mac = ""; + /// <summary> + /// + /// </summary> + public string primaryKey = ""; + /// <summary> + /// + /// </summary> + public string encryptionType = ""; + + /// <summary> + /// 瀛愮綉鍙� + /// </summary> + public int subnetId; + /// <summary> + /// 璁惧鍙� + /// </summary> + public int deviceId; + /// <summary> + /// 缃戝叧鐘舵�� + /// ON_LINE(0,"鍦ㄧ嚎"), + /// OFF_LINE(1,"涓嬬嚎"),; + /// </summary> + public bool gatewayStatus; + + ///// <summary> + ///// + ///// </summary> + //public string gwFirmwareVersion; + + ///// <summary> + ///// + ///// </summary> + //public string projectName; + ///// <summary> + ///// + ///// </summary> + //public string userName; + ///// <summary> + ///// + ///// </summary> + //public string groupName; + ///// <summary> + ///// + ///// </summary> + //public string gatewayName; + } + + + + + #endregion + + #region 瑙g粦缃戝叧 + /// <summary> + /// 瑙g粦缃戝叧 + /// </summary> + [System.Serializable] + public class UntieGatewayObj + { + /// <summary> + /// 浣忓畢ID + /// </summary> + public string homeId; + /// <summary> + /// 缃戝叧MAC + /// </summary> + public string mac; + } + #endregion + + #endregion + + #region 鈻� 澶囦唤鐩稿叧 ____________________________ + /// <summary> + /// 鏇存柊鏂囦欢澶瑰悕瀛� + /// </summary> + /// + [System.Serializable] + public class BackupFolderCreateObj + { + /// <summary> + /// 澶囦唤鍒嗙被 0:浜や簰宸ョ▼澶囦唤 1:鑷畾涔夊伐绋嬪浠� 2:鐢ㄦ埛鑷姩澶囦唤 3:鐢ㄦ埛鑷畾涔夊浠� [濉啓 0~3] + /// </summary> + public string backupClassify = string.Empty; + /// <summary> + /// 澶囦唤鏁版嵁鍒嗙被 + /// </summary> + public string backupDataType = string.Empty; + /// <summary> + /// 浣忓畢 ID + /// </summary> + public string homeId; + /// <summary> + /// APP澶囦唤鏂囦欢澶瑰悕瀛� + /// </summary> + public string folderName; + } + + [System.Serializable] + public class BackupFolderCreateRes + { + /// <summary> + /// 鏂囦欢澶筰d + /// </summary> + public string id; + ///// <summary> + ///// + ///// </summary> + //public string homeId; + ///// <summary> + ///// + ///// </summary> + //public string backupDataType; + ///// <summary> + ///// + ///// </summary> + //public string backupClassify; + /// <summary> + /// 鏂囦欢澶瑰悕瀛� + /// </summary> + public string folderName; + ///// <summary> + ///// + ///// </summary> + //public int backupUtcTime; + ///// <summary> + ///// + ///// </summary> + //public int createonutc; + } + + /// <summary> + /// 澶囦唤鍒楄〃鍚嶇殑淇℃伅 + /// </summary> + /// + [System.Serializable] + public class BackupListNameInfoRes + { + /// <summary> + /// 鏂囦欢澶� ID + /// </summary> + public string id; + /// <summary> + /// 浣忓畢 ID + /// </summary> + public string homeId; + /// <summary> + /// backupDataType + /// </summary> + public string backupDataType = string.Empty; + /// <summary> + /// backupClassify + /// </summary> + public string backupClassify; + /// <summary> + /// backupClassify + /// </summary> + public string folderName = string.Empty; + /// <summary> + /// backupUtcTime + /// </summary> + public string backupUtcTime; + ///// <summary> + ///// createonutc + ///// </summary> + //public string createUtcTime; + + + } + + /// <summary> + /// 鏇存柊鏂囦欢澶瑰悕瀛� + /// </summary> + /// + [System.Serializable] + public class UpdateBackupObj + { + ///// <summary> + ///// 澶囦唤鍒嗙被 0:浜や簰宸ョ▼澶囦唤 1:鑷畾涔夊伐绋嬪浠� 2:鐢ㄦ埛鑷姩澶囦唤 3:鐢ㄦ埛鑷畾涔夊浠� [濉啓 0~3] + ///// </summary> + //public string backupClassify = string.Empty; + ///// <summary> + ///// 澶囦唤鏁版嵁鍒嗙被 + ///// </summary> + //public string backupDataType = string.Empty; + /// <summary> + /// 浣忓畢 ID + /// </summary> + public string homeId; + /// <summary> + /// APP澶囦唤鏂囦欢澶瑰悕瀛� + /// </summary> + public string folderName; + /// <summary> + /// 鏂囦欢澶� id + /// </summary> + public string folderId; + + } + + /// <summary> + /// 鍗曚釜澶囦唤鏂囦欢淇℃伅 + /// </summary> + [System.Serializable] + public class BackupFileInfoRes + { + /// <summary> + /// 鏂囦欢涓婚敭 id + /// </summary> + public string id; + /// <summary> + /// 鏂囦欢澶逛富閿� id + /// </summary> + public string backupFolderId; + /// <summary> + /// 鎵嬫満鍙蜂綇瀹呯殑鏂囦欢鍚嶇О + /// </summary> + public string fileName; + ///// <summary> + ///// + ///// </summary> + //public long createUtcTime; + } + + /// <summary> + /// 鏌ユ壘鎵�鏈夋枃浠� 鎴栬�� 鍒犻櫎澶囦唤鏂囦欢澶� + /// </summary> + [System.Serializable] + public class BackupFolderIdObj + { + /// <summary> + /// 鏂囦欢澶逛富閿� id + /// </summary> + public string folderId; + /// <summary> + /// 浣忓畢ID + /// </summary> + public string homeId; + + } + + /// <summary> + /// 涓嬭浇澶囦唤 + /// </summary> + [System.Serializable] + public class BackupFileDownObj + { + /// <summary> + /// 鏂囦欢澶逛富閿� id + /// </summary> + public string folderId; + /// <summary> + /// 鏂囦欢id + /// </summary> + public string fileId; + /// <summary> + /// 浣忓畢ID + /// </summary> + public string homeId; + + } + + #endregion + + #region 鈻� 瀛愯处鍙风浉鍏� ____________________________ + + #region 娣诲姞銆佹煡璇€�佸垹闄ゅ瓙璐﹀彿 + /// <summary> + /// ChildBaseObj + /// </summary> + [System.Serializable] + public class ChildBaseObj + { + /// <summary> + /// 瀛愯处鍙稩D childAccountId + /// </summary> + public string childAccountId; + /// <summary> + /// 浣忓畢 + /// </summary> + public string homeId; + } + /// <summary> + /// 娣诲姞瀛愯处鍙� + /// </summary> + [System.Serializable] + public class ChildAddObj + { + /// <summary> + /// + /// </summary> + public string homeId; + /// <summary> + /// 瀛愮敤鎴风殑鐢佃瘽鎴栬�呴偖绠� + /// </summary> + public string account; + /// <summary> + /// 瀛愯处鎴风被鍨� ORDINARY銆丏EBUG銆丄DMIN + /// </summary> + public string childAccountType; + ///// <summary> + ///// 鏄惁鍏佽杩滅▼鎺у埗 0:鍏佽 1:涓嶅厑璁� + ///// </summary> + //public bool isRemoteControl = true; + /// <summary> + /// 瀛愯处鍙锋樀绉� + /// </summary> + public string nickName; + } + + /// <summary> + /// 鍒犻櫎瀛愯处鍙� + /// </summary> + [System.Serializable] + public class ChildDeleteObj : ChildBaseObj + { + + } + + /// <summary> + /// HomeIdObj + /// </summary> + [System.Serializable] + public class HomeIdObj + { + /// <summary> + /// 浣忓畢ID + /// </summary> + public string homeId; + } + + /// <summary> + /// 鏇存柊瀛愯处鍙峰娉ㄥ悕瀛� + /// </summary> + [System.Serializable] + public class UpdateChildNickNameObj : ChildBaseObj + { + /// <summary> + /// nickName + /// </summary> + public string nickName; + } + + /// <summary> + /// 鏇存柊杩滅▼鎺у埗 + /// </summary> + [System.Serializable] + public class UpdateRemoteObj : ChildBaseObj + { + /// <summary> + /// 鏄惁鍏佽杩滅▼鎺у埗 + /// </summary> + public bool isRemoteControl; + /// <summary> + /// 瀛愯处鎴风被鍨� ORDINARY銆丏EBUG銆丄DMIN + /// </summary> + public string childAccountType; + } + + /// <summary> + /// 淇敼鏄惁鍏佽鍒涘缓鍦烘櫙 + /// </summary> + [System.Serializable] + public class UpdateChildAllowCreateSceneObj : ChildBaseObj + { + /// <summary> + /// 鏄惁鍏佽鍒涘缓鍦烘櫙 + /// </summary> + public bool isAllowCreateScene; + + } + + /// <summary> + /// + /// </summary> + [System.Serializable] + public class AccountObj + { + /// <summary> + /// 璐﹀彿 + /// </summary> + public string account; + + } + + + #endregion + + #region 鏁版嵁鍒嗕韩 + /// <summary> + /// 鏌ヨ鏌愪綇瀹呮煇瀛愯处鍙风殑鍒嗕韩鏂囦欢淇℃伅 + /// </summary> + [System.Serializable] + public class HomeShareFindAll : ChildBaseObj + { + + } + + + /// <summary> + /// 鏌ヨ鏌愪綇瀹呮煇瀛愯处鍙风殑鍒嗕韩鏂囦欢淇℃伅 + /// </summary> + [System.Serializable] + public class ChildShareFileInfoRes + { + /// <summary> + /// 涓婚敭ID + /// </summary> + public string id; + /// <summary> + /// 浣忓畢ID + /// </summary> + public string homeId; + /// <summary> + /// 瀛愯处鍙稩D + /// </summary> + public string childAccountId; + /// <summary> + /// 鏂囦欢鍚� + /// </summary> + public string fileName; + /// <summary> + /// 鍒涘缓鏃堕棿 + /// </summary> + public string createTime; + + } + + /// <summary> + /// 涓嬭浇鍒嗕韩 + /// </summary> + [System.Serializable] + public class ShareFileDownObj + { + /// <summary> + /// 浣忓畢ID + /// </summary> + public string homeId; + /// <summary> + /// 鍒嗕韩鏂囦欢id + /// </summary> + public string homeShareId; + + } + + #endregion + + #endregion + + #region 鈻� GetMqttRemoteInfo ____________________________ + [Serializable] + public class GetMqttRemoteInfoObj + { + /// <summary> + /// 骞冲彴鏍囩ず ClientId璐﹀彿鎷兼帴鐢� + /// </summary> + public string attachClientId; + /// <summary> + /// 浣忓畢绫诲瀷 1.ZIGBEE 2.BUSPRO 3.A 4.ALL + /// </summary> + public string homeType; + + } + #endregion + + /// <summary> + /// 鎵嬫満鍖哄彿 + /// </summary> + [System.Serializable] + public class AreaCodeRes + { + /// <summary> + /// + /// </summary> + public string Name; + /// <summary> + /// + /// </summary> + public string Code; + /// <summary> + /// + /// </summary> + public string Id; + } + + + #region 鏁版嵁鍒嗕韩 + ///// <summary> + ///// 娣诲姞鍒嗕韩 + ///// </summary> + //[System.Serializable] + //public class ShareData + //{ + // /// <summary> + // /// 浣忓畢ID + // /// </summary> + // public int homeId; + // /// <summary> + // /// + // /// </summary> + // public List<ShareDatasItem> shareDatas; + // /// <summary> + // /// 瀛愯处鍙稩D + // /// </summary> + // public List<string> childAccountIds; + //} + + /// <summary> + /// 娣诲姞鍒嗕韩 + /// </summary> + [System.Serializable] + public class AddShareObj + { + /// <summary> + /// 浣忓畢ID + /// </summary> + public string homeId; + /// <summary> + /// + /// </summary> + public List<ShareData> shareDatas; + /// <summary> + /// 瀛愯处鍙稩D + /// </summary> + public List<string> childAccountIds; + } + + /// <summary> + /// + /// </summary> + public class ShareData + { + /// <summary> + /// 鍒嗕韩绫诲瀷琛╥d + /// </summary> + public string shareTypeId; + /// <summary> + /// 瀛愬笎鍙稩D + /// </summary> + public string childAccountId; + /// <summary> + /// 鍒嗕韩绫诲瀷 1.ROOM 2.DEVICE 3.SCENE + /// </summary> + public string shareType = "DEVICE"; + } + + + /// <summary> + /// 鍒犻櫎鍒嗕韩 + /// </summary> + [System.Serializable] + public class DeleteShareObj + { + /// <summary> + /// 浣忓畢ID + /// </summary> + public string homeId; + /// <summary> + /// + /// </summary> + public List<ShareData> shareDatas; + } + + /// <summary> + /// 鑾峰彇鍒嗕韩 + /// </summary> + [System.Serializable] + public class GetShareObj + { + /// <summary> + /// 浣忓畢ID + /// </summary> + public string homeId; + /// <summary> + /// 瀛愯处鍙稩D + /// </summary> + public string childAccountId; + ///// <summary> + ///// 鍒嗕韩绫诲瀷 1.ROOM 2.DEVICE 3.SCENE + ///// 涓嶄紶榛樿鏌ュ叏閮� + ///// </summary> + //public string shareType = "DEVICE"; + } + + #endregion + + + #region 鍥剧墖涓婁紶涓嬭浇 + /// <summary> + /// 涓婁紶鍥剧墖 + /// </summary> + [System.Serializable] + public class UploadImageObj + { + /// <summary> + /// 鍓嶇紑鏍囪瘑 + /// </summary> + public string prefix; + /// <summary> + /// 鍏宠仈ID + /// </summary> + public string uid; + /// <summary> + /// 鏂囦欢鍚嶇О + /// </summary> + public string fileName; + /// <summary> + /// 鍥剧墖浜岃繘鍒舵祦 + /// </summary> + public byte[] content; + } + + /// <summary> + /// 鏌ヨ鍥剧墖璺緞 + /// </summary> + [System.Serializable] + public class GetImageUrlObj + { + /// <summary> + /// 鍥剧墖涓嬭浇璺緞鏍囪瘑 + /// </summary> + public string imageKey; + } + #endregion + + + #endregion + + + /// <summary> + /// 鏋佸厜鎺ㄩ�佹秷鎭� + /// </summary> + [System.Serializable] + public class JPushMessageInfo + { + /// <summary> + /// 浣忓畢ID + /// </summary> + public string HomeId; + /// <summary> + /// 鎺ㄩ�佹爣棰� + /// </summary> + public string Title; + /// <summary> + /// 鎺ㄩ�佸唴瀹� + /// </summary> + public string Content; + /// <summary> + /// 鎺ㄩ�侀檮鍔犳暟鎹� + /// </summary> + public string Extras; + /// <summary> + /// 淇℃伅绫诲瀷 + /// </summary> + public string messageType = ""; + /// <summary> + /// 鎵╁睍鏁版嵁鍐呭 + /// </summary> + public string expantContent = ""; + + + } + + /// <summary> + /// 鏋佸厜鎺ㄩ�佹秷鎭� + /// </summary> + [System.Serializable] + public class JPushExpandData + { + /// <summary> + /// 闄勫姞鍐呭 + /// </summary> + public string expandData; + + } + + /// <summary> + /// 鏋佸厜鎺ㄩ�佹秷鎭� + /// </summary> + [System.Serializable] + public class ExpandData + { + /// <summary> + /// 浣忓畢ID + /// </summary> + public string homeId; + /// <summary> + /// 闄勫姞鍐呭 + /// </summary> + public string expantContent; + /// <summary> + /// 淇℃伅绫诲瀷 + /// </summary> + public string messageType; + } + + /// <summary> + /// 钀ょ煶浜戝瓙璐﹀彿token + /// </summary> + [System.Serializable] + public class EZChildAccessToken + { + /// <summary> + /// token + /// </summary> + public string accessToken; + /// <summary> + /// 杩囨湡鏃堕棿 + /// </summary> + public string expireTime; + } + + + #region 闊崇 + /// <summary> + /// 鑾峰彇闊崇鍒楄〃 + /// </summary> + [System.Serializable] + public class GetSpeakerObj : HomeIdObj + { + /// <summary> + /// 骞冲彴鍚嶇О + /// </summary> + public string platformName; + /// <summary> + /// 椤甸潰澶у皬 + /// </summary> + public int pageSize = 100; + /// <summary> + /// 椤甸潰搴忓彿 + /// </summary> + public int pageNo = 1; + } + + + [System.Serializable] + public class SpeakerObj : HomeIdObj + { + /// <summary> + /// 璁板綍鐨勪富閿甶d + /// </summary> + public string tokenId; + } + + /// <summary> + /// 鏇存柊闊崇澶囨敞 + /// </summary> + [System.Serializable] + public class UpdateSpeakerRemarkObj : SpeakerObj + { + /// <summary> + /// 澶囨敞 + /// </summary> + public string remark; + } + + + /// <summary> + /// 鑾峰彇闊崇鍒嗛厤鐨勮澶囧拰鍦烘櫙鍒楄〃 + /// </summary> + [System.Serializable] + public class GetSpeakerDeviceListObj : HomeIdObj + { + /// <summary> + /// 璁板綍鐨勪富閿甶d + /// </summary> + public string tokenId; + + } + + /// <summary> + /// 閰嶇疆鐨勮闊宠澶囧拰鍦烘櫙鏁版嵁 + /// </summary> + [System.Serializable] + public class SpeakerTargetInfo + { + /// <summary> + /// 鎺у埗鐨勭洰鏍嘔d锛屼簯绔殑璁惧Id鎴栬�呭満鏅疘d + /// </summary> + public string targetId; + /// <summary> + /// 鏄惁鏄澶囷紝鍦烘櫙涓篺alse + /// </summary> + public bool isDevice; + /// <summary> + /// 鐩爣鍚嶇О + /// </summary> + public string targetName; + /// <summary> + /// 鎵╁睍鍙傛暟褰撳墠rowview鏄惁閫変腑 + /// </summary> + public bool IsSelect; + } + + //[System.Serializable] + //public class SpeakerTargetInfoRow: SpeakerTargetInfo + //{ + // /// <summary> + // /// 褰撳墠rowview鏄惁閫変腑 + // /// </summary> + // public bool isSelect; + //} + + + /// <summary> + /// 鏇存柊闊崇鎺у埗鐨勮澶囧拰鍦烘櫙鐩爣 + /// </summary> + [System.Serializable] + public class UpdateSpeakerDeviceListObj : SpeakerObj + { + /// <summary> + /// 澶囨敞 + /// </summary> + public List<SpeakerTargetInfo> targetInfos; + } + + /// <summary> + /// 鏇存柊闊崇鎺у埗鐨勮澶囧拰鍦烘櫙鐩爣 + /// </summary> + [System.Serializable] + public class SpeakerListRes + { + /// <summary> + /// 闊崇鍒楄〃 + /// </summary> + public List<SpeakerInfo> list; + } + + /// <summary> + /// 闊崇淇℃伅 + /// </summary> + [System.Serializable] + public class SpeakerInfo + { + /// <summary> + /// + /// </summary> + public string platformName { get; set; } + /// <summary> + /// + /// </summary> + public string remark { get; set; } + /// <summary> + /// + /// </summary> + public string tokenId { get; set; } + /// <summary> + /// + /// </summary> + public string userId { get; set; } + /// <summary> + /// + /// </summary> + public string userRegion { get; set; } + /// <summary> + /// + /// </summary> + public string homeId { get; set; } + /// <summary> + /// + /// </summary> + public string homeRegion { get; set; } + } + #endregion + + //#region 鏃ф帴鍙� + ///// <summary> + ///// + ///// </summary> + //public class FindCityObj + //{ + // /// <summary> + // /// 鍩庡競ID + // /// </summary> + // public string Cid; + + // /// <summary> + // /// + // /// </summary> + // public string Location; + + // /// <summary> + // /// 鍩庡競 + // /// </summary> + // public string City; + + // /// <summary> + // /// + // /// </summary> + // public string Province; + + // /// <summary> + // /// + // /// </summary> + // public string Country; + + + // /// <summary> + // /// + // /// </summary> + // public string TimeZone; + //} + ///// <summary> + ///// + ///// </summary> + //public class GetWeatherObj + //{ + + + // public string Temperature; + + // /// <summary> + // /// + // /// </summary> + // public string Humidity; + + // /// <summary> + // /// + // /// </summary> + // public string PM25; + // /// <summary> + // /// + // /// </summary> + // public string Weather; + + //} + //#endregion + +} \ No newline at end of file diff --git a/SiriIntents/SiriIntents.csproj b/SiriIntents/SiriIntents.csproj index 5aa8b1a..8a350a3 100644 --- a/SiriIntents/SiriIntents.csproj +++ b/SiriIntents/SiriIntents.csproj @@ -79,23 +79,40 @@ <MtouchArch>ARM64</MtouchArch> <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> <MtouchVerbosity></MtouchVerbosity> - <CodesignProvision>OnproSiri211116-1</CodesignProvision> + <CodesignProvision>OnProSiri211125-1-Dev</CodesignProvision> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="System.Xml" /> <Reference Include="System.Core" /> <Reference Include="Xamarin.iOS" /> + <Reference Include="Shared.IOS.HDLSceneSiri"> + <HintPath>..\DLL\IOS\Shared.IOS.HDLSceneSiri.dll</HintPath> + </Reference> + <Reference Include="Newtonsoft.Json"> + <HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath> + </Reference> + <Reference Include="RestSharp"> + <HintPath>..\packages\RestSharp.106.13.0\lib\netstandard2.0\RestSharp.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <Folder Include="Resources\" /> + <Folder Include="Server\" /> </ItemGroup> <ItemGroup> <None Include="Info.plist" /> <None Include="Entitlements.plist" /> + <None Include="packages.config" /> </ItemGroup> <ItemGroup> <Compile Include="IntentHandler.cs" /> + <Compile Include="Server\HttpServerRequest.cs" /> + <Compile Include="Server\HttpUtil.cs" /> + <Compile Include="Server\IMessageCommon.cs" /> + <Compile Include="Server\NewAPI.cs" /> + <Compile Include="Server\NewApiRes.cs" /> + <Compile Include="HDLRunSceneIntentHandlder.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\SiriKit\SiriKit.csproj"> diff --git a/SiriIntents/packages.config b/SiriIntents/packages.config new file mode 100644 index 0000000..e28d1da --- /dev/null +++ b/SiriIntents/packages.config @@ -0,0 +1,5 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Newtonsoft.Json" version="13.0.1" targetFramework="xamarinios10" /> + <package id="RestSharp" version="106.13.0" targetFramework="xamarinios10" /> +</packages> \ No newline at end of file diff --git a/SiriIntentsUI/Entitlements.plist b/SiriIntentsUI/Entitlements.plist index 92ed64b..0dde1e0 100644 --- a/SiriIntentsUI/Entitlements.plist +++ b/SiriIntentsUI/Entitlements.plist @@ -8,7 +8,5 @@ </array> <key>com.apple.developer.siri</key> <true/> - <key>com.apple.developer.associated-domains</key> - <array/> </dict> </plist> diff --git a/SiriIntentsUI/IntentViewController.cs b/SiriIntentsUI/IntentViewController.cs index a613809..8cf1560 100644 --- a/SiriIntentsUI/IntentViewController.cs +++ b/SiriIntentsUI/IntentViewController.cs @@ -2,6 +2,7 @@ using CoreGraphics; using Foundation; +using HDLSceneSiri; //using HDLSceneSiri; using Intents; using IntentsUI; @@ -55,26 +56,14 @@ - //if (@available(iOS 12.0, *)) - { - //HDLRunSceneIntentResponse rsp = interaction.IntentResponse as HDLRunSceneIntentResponse; - //if (rsp.Code == HDLRunSceneIntentResponseCode.Success) - //{ - // this.messageLabel.Text = rsp.SuccessMessage; - //} - //else if (rsp.Code == HDLRunSceneIntentResponseCode.Failure || rsp.Code == HDLRunSceneIntentResponseCode.Error) - //{ - // this.messageLabel.Text = rsp.ErrorMessage; - //} - //else - { - //messageLabel.Text = "鎵ц鎴愬姛";// rsp.SuccessMessage; - } - } - CGSize size = new CGSize(DesiredSize().Width, 80); + HDLRunSceneIntentResponse rsp = interaction.IntentResponse as HDLRunSceneIntentResponse; + this.lblMsg.Text = rsp.SuccessMessage; + this.lblMsg.TextColor = UIColor.Black; + this.lblMsg.Frame = new CGRect(0, 0, DesiredSize().Width, 180); + CGSize size = new CGSize(DesiredSize().Width, 180); - //if (completion != null) + if (completion != null) completion(true, parameters, size); diff --git a/SiriIntentsUI/IntentViewController.designer.cs b/SiriIntentsUI/IntentViewController.designer.cs index 31d49c2..de743aa 100644 --- a/SiriIntentsUI/IntentViewController.designer.cs +++ b/SiriIntentsUI/IntentViewController.designer.cs @@ -13,13 +13,14 @@ partial class IntentViewController { [Outlet] - UIKit.UILabel messageLabel { get; set; } + [GeneratedCode("iOS Designer", "1.0")] + UIKit.UILabel lblMsg { get; set; } void ReleaseDesignerOutlets () { - if (messageLabel != null) { - messageLabel.Dispose (); - messageLabel = null; + if (lblMsg != null) { + lblMsg.Dispose (); + lblMsg = null; } } } diff --git a/SiriIntentsUI/MainInterface.storyboard b/SiriIntentsUI/MainInterface.storyboard index 463b4cb..5fc4be2 100644 --- a/SiriIntentsUI/MainInterface.storyboard +++ b/SiriIntentsUI/MainInterface.storyboard @@ -19,11 +19,8 @@ <rect key="frame" x="0.0" y="0.0" width="320" height="81"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NjV-Uo-AhC"> - <rect key="frame" x="16" y="44" width="288" height="37"/> - <constraints> - <constraint firstAttribute="height" constant="80" id="nTr-aC-LKs"/> - </constraints> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IGu-QP-NsY"> + <rect key="frame" x="0.0" y="0.0" width="320" height="81"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> <nil key="highlightedColor"/> @@ -31,16 +28,16 @@ </subviews> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> - <constraint firstItem="NjV-Uo-AhC" firstAttribute="top" secondItem="qkL-Od-lgU" secondAttribute="bottom" id="FYi-qJ-8bD"/> - <constraint firstAttribute="trailingMargin" secondItem="NjV-Uo-AhC" secondAttribute="trailing" id="Gl4-Hb-09m"/> - <constraint firstItem="n38-gi-rB5" firstAttribute="top" secondItem="NjV-Uo-AhC" secondAttribute="bottom" id="IeL-md-xmX"/> - <constraint firstItem="NjV-Uo-AhC" firstAttribute="leading" secondItem="zMn-AG-sqS" secondAttribute="leadingMargin" id="QQ2-K1-0tQ"/> + <constraint firstItem="n38-gi-rB5" firstAttribute="top" secondItem="IGu-QP-NsY" secondAttribute="bottom" id="SeT-jr-PQR"/> + <constraint firstItem="IGu-QP-NsY" firstAttribute="top" secondItem="zMn-AG-sqS" secondAttribute="top" id="XNh-gA-gK1"/> + <constraint firstAttribute="trailing" secondItem="IGu-QP-NsY" secondAttribute="trailing" id="a0D-RT-Dwt"/> + <constraint firstItem="IGu-QP-NsY" firstAttribute="leading" secondItem="zMn-AG-sqS" secondAttribute="leading" id="dPA-2W-Z8X"/> </constraints> </view> <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> <size key="freeformSize" width="320" height="81"/> <connections> - <outlet property="messageLabel" destination="NjV-Uo-AhC" id="Jnc-sC-lVC"/> + <outlet property="lblMsg" destination="IGu-QP-NsY" id="gfv-7M-crM"/> </connections> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/> diff --git a/SiriIntentsUI/SiriIntentsUI.csproj b/SiriIntentsUI/SiriIntentsUI.csproj index abe02b0..cbbf67a 100644 --- a/SiriIntentsUI/SiriIntentsUI.csproj +++ b/SiriIntentsUI/SiriIntentsUI.csproj @@ -82,7 +82,7 @@ <MtouchArch>ARM64</MtouchArch> <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> <MtouchVerbosity></MtouchVerbosity> - <CodesignProvision>OnproSiriUI211116-1</CodesignProvision> + <CodesignProvision>OnProSiriUI211125-1-Dev</CodesignProvision> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> @@ -90,6 +90,9 @@ <Reference Include="System.Xml" /> <Reference Include="System.Core" /> <Reference Include="Xamarin.iOS" /> + <Reference Include="Shared.IOS.HDLSceneSiri"> + <HintPath>..\DLL\IOS\Shared.IOS.HDLSceneSiri.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <Folder Include="Resources\" /> @@ -107,5 +110,11 @@ <DependentUpon>IntentViewController.cs</DependentUpon> </Compile> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\SiriKit\SiriKit.csproj"> + <Project>{8B1652FA-5158-4D57-B90D-07BB91766625}</Project> + <Name>SiriKit</Name> + </ProjectReference> + </ItemGroup> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.AppExtension.CSharp.targets" /> </Project> \ No newline at end of file diff --git a/SiriKit/Data/DataManager.cs b/SiriKit/Data/DataManager.cs index f4ad85e..0687121 100644 --- a/SiriKit/Data/DataManager.cs +++ b/SiriKit/Data/DataManager.cs @@ -1,188 +1,188 @@ -锘�/* -See LICENSE folder for this sample鈥檚 licensing information. +锘�///* +//See LICENSE folder for this sample鈥檚 licensing information. -Abstract: -A data manager that manages data conforming to `Codable` and stores it in `UserDefaults`. -*/ +//Abstract: +//A data manager that manages data conforming to `Codable` and stores it in `UserDefaults`. +//*/ -using System; -using Foundation; -using CoreFoundation; +//using System; +//using Foundation; +//using CoreFoundation; -namespace Other.Siri -{ - public struct UserDefaultsStorageDescriptor - { - public string Key { get; set; } - public UserDefaultsStorageDescriptor(string key) - { - Key = key; - } - } +//namespace SiriKit +//{ +// public struct UserDefaultsStorageDescriptor +// { +// public string Key { get; set; } +// public UserDefaultsStorageDescriptor(string key) +// { +// Key = key; +// } +// } - public static class NotificationKeys - { - // Clients of `DataManager` that want to know when the data changes can - // listen for this notification. - public const string DataChanged = "DataChangedNotification"; - } +// public static class NotificationKeys +// { +// // Clients of `DataManager` that want to know when the data changes can +// // listen for this notification. +// public const string DataChanged = "DataChangedNotification"; +// } - public class DataManager<ManagedDataType> : NSObject - where ManagedDataType : NSObject, INSCoding - { - // This sample uses App Groups to share a suite of data between the - // main app and the different extensions. - protected NSUserDefaults UserDefaults = NSUserDefaultsHelper.DataSuite; +// public class DataManager<ManagedDataType> : NSObject +// where ManagedDataType : NSObject, INSCoding +// { +// // This sample uses App Groups to share a suite of data between the +// // main app and the different extensions. +// protected NSUserDefaults UserDefaults = NSUserDefaultsHelper.DataSuite; - // To prevent data races, all access to `UserDefaults` uses this queue. - protected DispatchQueue UserDefaultsAccessQueue = new DispatchQueue("User Defaults Access Queue"); +// // To prevent data races, all access to `UserDefaults` uses this queue. +// protected DispatchQueue UserDefaultsAccessQueue = new DispatchQueue("User Defaults Access Queue"); - // Storage and observation information. - protected UserDefaultsStorageDescriptor StorageDescriptor; +// // Storage and observation information. +// protected UserDefaultsStorageDescriptor StorageDescriptor; - // A flag to avoid receiving notifications about data this instance just - // wrote to `UserDefaults`. - protected bool IgnoreLocalUserDefaultsChanges = false; +// // A flag to avoid receiving notifications about data this instance just +// // wrote to `UserDefaults`. +// protected bool IgnoreLocalUserDefaultsChanges = false; - // The observer object handed back after registering to observe a - // property. - IDisposable UserDefaultsObserver; +// // The observer object handed back after registering to observe a +// // property. +// IDisposable UserDefaultsObserver; - // The data managed by this `DataManager`. - //姝も�淒ataManager鈥濈鐞嗙殑鏁版嵁銆� - protected ManagedDataType ManagedDataBackingInstance; +// // The data managed by this `DataManager`. +// //姝も�淒ataManager鈥濈鐞嗙殑鏁版嵁銆� +// protected ManagedDataType ManagedDataBackingInstance; - // Access to `managedDataBackingInstance` needs to occur on a dedicated - // queue to avoid data races. - protected DispatchQueue DataAccessQueue = new DispatchQueue("Data Access Queue"); +// // Access to `managedDataBackingInstance` needs to occur on a dedicated +// // queue to avoid data races. +// protected DispatchQueue DataAccessQueue = new DispatchQueue("Data Access Queue"); - // Public access to the managed data for clients of `DataManager` - public ManagedDataType ManagedData - { - get - { - ManagedDataType data = null; - DataAccessQueue.DispatchSync(() => data = ManagedDataBackingInstance); - return data; - } - } +// // Public access to the managed data for clients of `DataManager` +// public ManagedDataType ManagedData +// { +// get +// { +// ManagedDataType data = null; +// DataAccessQueue.DispatchSync(() => data = ManagedDataBackingInstance); +// return data; +// } +// } - // See note below about createInitialData and initialData - public DataManager(UserDefaultsStorageDescriptor storageDescriptor, ManagedDataType initialData) - { - StorageDescriptor = storageDescriptor; - LoadData(); - if (ManagedDataBackingInstance is null) - { - ManagedDataBackingInstance = initialData; - WriteData(); - } - ObserveChangesInUserDefaults(); - } +// // See note below about createInitialData and initialData +// public DataManager(UserDefaultsStorageDescriptor storageDescriptor, ManagedDataType initialData) +// { +// StorageDescriptor = storageDescriptor; +// LoadData(); +// if (ManagedDataBackingInstance is null) +// { +// ManagedDataBackingInstance = initialData; +// WriteData(); +// } +// ObserveChangesInUserDefaults(); +// } - // createInitialData - // - // The Swift version of this app has a createInitialData method. - // Each child class of the DataManager class overrides this method, and - // then the DataManager base class calls the derived versions to get - // the initial data. C# gives a compiler warning for this ("Virtual - // member call in constructor"). Since in C# the base class constructor - // is run before the child class constructor, having the base clas - // constructor call out to a method on the derived class is calling - // a method on an object that has not yet been fully constructed. - // The C# version of this sample works around this problem by passing - // in the initial data to the constructor. +// // createInitialData +// // +// // The Swift version of this app has a createInitialData method. +// // Each child class of the DataManager class overrides this method, and +// // then the DataManager base class calls the derived versions to get +// // the initial data. C# gives a compiler warning for this ("Virtual +// // member call in constructor"). Since in C# the base class constructor +// // is run before the child class constructor, having the base clas +// // constructor call out to a method on the derived class is calling +// // a method on an object that has not yet been fully constructed. +// // The C# version of this sample works around this problem by passing +// // in the initial data to the constructor. - void ObserveChangesInUserDefaults() - { - var weakThis = new WeakReference<DataManager<ManagedDataType>>(this); - Action<NSObservedChange> changeHandler = (change) => - { - if (weakThis.TryGetTarget(out var dataManager)) - { - // Ignore any change notifications coming from data this - // instance just saved to `NSUserDefaults`. - if (dataManager is null || dataManager.IgnoreLocalUserDefaultsChanges) - { - return; - } +// void ObserveChangesInUserDefaults() +// { +// var weakThis = new WeakReference<DataManager<ManagedDataType>>(this); +// Action<NSObservedChange> changeHandler = (change) => +// { +// if (weakThis.TryGetTarget(out var dataManager)) +// { +// // Ignore any change notifications coming from data this +// // instance just saved to `NSUserDefaults`. +// if (dataManager is null || dataManager.IgnoreLocalUserDefaultsChanges) +// { +// return; +// } - // The underlying data changed in `NSUserDefaults`, so - // update this instance with the change and notify clients - // of the change. - dataManager.LoadData(); - dataManager.NotifyClientsDataChanged(); - } - }; - UserDefaultsObserver = UserDefaults.AddObserver( - StorageDescriptor.Key, - NSKeyValueObservingOptions.Initial | NSKeyValueObservingOptions.New, - changeHandler - ); - } +// // The underlying data changed in `NSUserDefaults`, so +// // update this instance with the change and notify clients +// // of the change. +// dataManager.LoadData(); +// dataManager.NotifyClientsDataChanged(); +// } +// }; +// UserDefaultsObserver = UserDefaults.AddObserver( +// StorageDescriptor.Key, +// NSKeyValueObservingOptions.Initial | NSKeyValueObservingOptions.New, +// changeHandler +// ); +// } - // Notifies clients the data changed by posting an `NSNotification` with - // the key `NotificationKeys.DataChanged` - void NotifyClientsDataChanged() - { - var notification = NSNotification.FromName(NotificationKeys.DataChanged, this); - NSNotificationCenter.DefaultCenter.PostNotification(notification); - } +// // Notifies clients the data changed by posting an `NSNotification` with +// // the key `NotificationKeys.DataChanged` +// void NotifyClientsDataChanged() +// { +// var notification = NSNotification.FromName(NotificationKeys.DataChanged, this); +// NSNotificationCenter.DefaultCenter.PostNotification(notification); +// } - protected virtual void FinishUnarchiving(NSObject unarchivedData) - { - throw new NotImplementedException(); - } +// protected virtual void FinishUnarchiving(NSObject unarchivedData) +// { +// throw new NotImplementedException(); +// } - // Loads the data from `NSUserDefaults`. - void LoadData() - { - UserDefaultsAccessQueue.DispatchSync(() => - { - NSData archivedData = UserDefaults.DataForKey(StorageDescriptor.Key); - try - { - // Let the derived classes handle the specifics of - // putting the unarchived data in the correct format. - // This is necessary because the derived classes - // (SoupMenuManager, SoupOrderMenuManager) are using - // generic data formats (NSMutableSet<T> or NSMutableArray<T>) - // and these types cannot be casted directly from the - // deserialized data. - NSObject unarchivedData = NSKeyedUnarchiver.UnarchiveObject(archivedData); - FinishUnarchiving(unarchivedData); - } - catch (Exception e) - { - if (!(e is null)) - { - Console.WriteLine($"Error: {e.Message}"); - } - } - }); - } +// // Loads the data from `NSUserDefaults`. +// void LoadData() +// { +// UserDefaultsAccessQueue.DispatchSync(() => +// { +// NSData archivedData = UserDefaults.DataForKey(StorageDescriptor.Key); +// try +// { +// // Let the derived classes handle the specifics of +// // putting the unarchived data in the correct format. +// // This is necessary because the derived classes +// // (SoupMenuManager, SoupOrderMenuManager) are using +// // generic data formats (NSMutableSet<T> or NSMutableArray<T>) +// // and these types cannot be casted directly from the +// // deserialized data. +// NSObject unarchivedData = NSKeyedUnarchiver.UnarchiveObject(archivedData); +// FinishUnarchiving(unarchivedData); +// } +// catch (Exception e) +// { +// if (!(e is null)) +// { +// Console.WriteLine($"Error: {e.Message}"); +// } +// } +// }); +// } - // Writes the data to `NSUserDefaults` - protected void WriteData() - { - UserDefaultsAccessQueue.DispatchAsync(() => - { - try - { - NSData encodedData = NSKeyedArchiver.ArchivedDataWithRootObject(ManagedDataBackingInstance); - IgnoreLocalUserDefaultsChanges = true; - UserDefaults.SetValueForKey(encodedData, (NSString)StorageDescriptor.Key); - IgnoreLocalUserDefaultsChanges = false; - NotifyClientsDataChanged(); - } - catch (Exception e) - { - throw new Exception($"Could not save data. Reason: {e.Message}"); - } - }); - } +// // Writes the data to `NSUserDefaults` +// protected void WriteData() +// { +// UserDefaultsAccessQueue.DispatchAsync(() => +// { +// try +// { +// NSData encodedData = NSKeyedArchiver.ArchivedDataWithRootObject(ManagedDataBackingInstance); +// IgnoreLocalUserDefaultsChanges = true; +// UserDefaults.SetValueForKey(encodedData, (NSString)StorageDescriptor.Key); +// IgnoreLocalUserDefaultsChanges = false; +// NotifyClientsDataChanged(); +// } +// catch (Exception e) +// { +// throw new Exception($"Could not save data. Reason: {e.Message}"); +// } +// }); +// } - } -} +// } +//} diff --git a/SiriKit/Data/NSUserDefaultsHelper.cs b/SiriKit/Data/NSUserDefaultsHelper.cs index e792d53..4526cf8 100644 --- a/SiriKit/Data/NSUserDefaultsHelper.cs +++ b/SiriKit/Data/NSUserDefaultsHelper.cs @@ -1,7 +1,6 @@ 锘縰sing System; using Foundation; -using System.Resources; -namespace Other.Siri +namespace SiriKit { public static class NSUserDefaultsHelper { @@ -11,9 +10,6 @@ public static class StorageKeys { - public const string SoupMenu = "soupMenu"; - public const string OrderHistory = "orderHistory"; - public const string VoiceShortcutHistory = "voiceShortcutHistory"; public const string APP_KEY = "HDL-HOME-APP-TEST"; public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; @@ -26,6 +22,8 @@ public const string GLOBAL_GRefreshToken = "RefreshToken"; public const string GLOBAL_GRegionUrl = "RegionUrl"; + + public const string GLOBAL_GHomeId = "HomeId"; } public static NSUserDefaults DataSuite { diff --git a/SiriKit/Data/SceneDateManager.cs b/SiriKit/Data/SceneDateManager.cs index b06cb30..9ff58b3 100644 --- a/SiriKit/Data/SceneDateManager.cs +++ b/SiriKit/Data/SceneDateManager.cs @@ -3,41 +3,35 @@ using System; using System.Linq; -namespace Other.Siri +namespace SiriKit { - public class SceneDateManager : DataManager<NSMutableArray<SiriScene>> + public class SceneDateManager //: DataManager<NSMutableArray<HDLSceneSiri.HDLSiriSceneModel>> { - public SceneDateManager() : base(new UserDefaultsStorageDescriptor(NSUserDefaultsHelper.StorageKeys.OrderHistory), new NSMutableArray<SiriScene>()) { } + public SceneDateManager() { }//: base(new UserDefaultsStorageDescriptor(NSUserDefaultsHelper.StorageKeys.OrderHistory), new NSMutableArray<HDLSceneSiri.HDLSiriSceneModel>()) { } + protected NSUserDefaults UserDefaults = NSUserDefaultsHelper.DataSuite; - #region Public API for clients of `SoupOrderDataManager` - // Convenience method to access the data with a property name that makes - // sense in the caller's context. - public NSMutableArray<SiriScene> OrderHistory - { - get - { - return ManagedData as NSMutableArray<SiriScene>; - } - } + //#region Public API for clients of `SoupOrderDataManager` + //// Convenience method to access the data with a property name that makes + //// sense in the caller's context. + //public NSMutableArray<HDLSceneSiri.HDLSiriSceneModel> OrderHistory + //{ + // get + // { + // return ManagedData as NSMutableArray<HDLSceneSiri.HDLSiriSceneModel>; + // } + //} - #endregion + //#endregion - #region Support methods for unarchiving saved data - override protected void FinishUnarchiving(NSObject unarchivedData) - { - var array = (NSArray)unarchivedData; - SiriScene[] orders = NSArray.FromArray<SiriScene>(array); - ManagedDataBackingInstance = new NSMutableArray<SiriScene>(orders); - } - #endregion - - public NSData GetData(string key) - { - var data = UserDefaults.DataForKey(key); - var d = UserDefaults.BoolForKey(key); - return data; - } + //#region Support methods for unarchiving saved data + //override protected void FinishUnarchiving(NSObject unarchivedData) + //{ + // var array = (NSArray)unarchivedData; + // HDLSceneSiri.HDLSiriSceneModel[] orders = NSArray.FromArray<HDLSceneSiri.HDLSiriSceneModel>(array); + // ManagedDataBackingInstance = new NSMutableArray<HDLSceneSiri.HDLSiriSceneModel>(orders); + //} + //#endregion public bool IsLgoin { @@ -46,12 +40,12 @@ var d = UserDefaults.BoolForKey(NSUserDefaultsHelper.StorageKeys.GLOBAL_GIsLogin); return d; } + set + { + UserDefaults.SetBool(value, NSUserDefaultsHelper.StorageKeys.GLOBAL_GIsLogin); + } } - public void SetIsLoginValue(bool value) - { - UserDefaults.SetBool(value, NSUserDefaultsHelper.StorageKeys.GLOBAL_GIsLogin); - } public string AccessToken { @@ -60,10 +54,11 @@ var d = UserDefaults.StringForKey(NSUserDefaultsHelper.StorageKeys.GLOBAL_GAccessToken); return d; } - } - public void SetAccessTokenValue(string accessToken) - { - UserDefaults.SetString(accessToken, NSUserDefaultsHelper.StorageKeys.GLOBAL_GAccessToken); + set + { + UserDefaults.SetString(value, NSUserDefaultsHelper.StorageKeys.GLOBAL_GAccessToken); + + } } public string RefreshToken @@ -73,10 +68,10 @@ var d = UserDefaults.StringForKey(NSUserDefaultsHelper.StorageKeys.GLOBAL_GRefreshToken); return d; } - } - public void SetRefreshTokenValue(string refreshToken) - { - UserDefaults.SetString(refreshToken, NSUserDefaultsHelper.StorageKeys.GLOBAL_GRefreshToken); + set + { + UserDefaults.SetString(value, NSUserDefaultsHelper.StorageKeys.GLOBAL_GRefreshToken); + } } @@ -87,10 +82,23 @@ var d = UserDefaults.StringForKey(NSUserDefaultsHelper.StorageKeys.GLOBAL_GRegionUrl); return d; } + set + { + UserDefaults.SetString(value, NSUserDefaultsHelper.StorageKeys.GLOBAL_GRegionUrl); + } } - public void SetRegionUrlValue(string regionUrl) + + public string HomeId { - UserDefaults.SetString(regionUrl, NSUserDefaultsHelper.StorageKeys.GLOBAL_GRegionUrl); + get + { + var d = UserDefaults.StringForKey(NSUserDefaultsHelper.StorageKeys.GLOBAL_GHomeId); + return d; + } + set + { + UserDefaults.SetString(value, NSUserDefaultsHelper.StorageKeys.GLOBAL_GHomeId); + } } } } diff --git a/SiriKit/HDLRunSceneIntentHandlder.cs b/SiriKit/HDLRunSceneIntentHandlder.cs deleted file mode 100644 index 6ab16bd..0000000 --- a/SiriKit/HDLRunSceneIntentHandlder.cs +++ /dev/null @@ -1,22 +0,0 @@ -锘縰sing System; -using HDLSceneSiri; -using ObjCRuntime; -//using HdlSiri; - -namespace SiriKit -{ - public class HDLRunSceneIntentHandlder : HDLRunSceneIntentHandling - { - public override void HandleHDLRunScene(HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion) - { - var rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.InProgress, null); - completion(rsp); - } - - public override void ConfirmHDLRunScene(HDLRunSceneIntent intent,Action<HDLRunSceneIntentResponse> completion) - { - completion(new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Success, null)); - - } - } -} diff --git a/SiriKit/SiriKit.csproj b/SiriKit/SiriKit.csproj index 942acf3..553c44e 100644 --- a/SiriKit/SiriKit.csproj +++ b/SiriKit/SiriKit.csproj @@ -49,12 +49,8 @@ </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="SiriScene.cs" /> - <Compile Include="VoiceShortcutDataManager.cs" /> <Compile Include="Data\DataManager.cs" /> <Compile Include="Data\SceneDateManager.cs" /> - <Compile Include="Support\NSUserActivityHelper.cs" /> - <Compile Include="HDLRunSceneIntentHandlder.cs" /> <Compile Include="Data\NSUserDefaultsHelper.cs" /> </ItemGroup> <ItemGroup> diff --git a/SiriKit/SiriScene.cs b/SiriKit/SiriScene.cs deleted file mode 100644 index 52d3d31..0000000 --- a/SiriKit/SiriScene.cs +++ /dev/null @@ -1,20 +0,0 @@ -锘縰sing System; -using Foundation; -using Intents; -using UIKit; - -namespace Other.Siri -{ - public class SiriScene : NSObject - { - public SiriScene() - { - } - - public string Id; - - public string Name; - - - } -} diff --git a/SiriKit/Support/NSUserActivityHelper.cs b/SiriKit/Support/NSUserActivityHelper.cs deleted file mode 100644 index e5bdc79..0000000 --- a/SiriKit/Support/NSUserActivityHelper.cs +++ /dev/null @@ -1,56 +0,0 @@ -锘縰sing System; -using Foundation; - -#if __IOS__ -using CoreSpotlight; -using UIKit; -using System.Linq.Expressions; -using System.Xml; -#endif - -namespace Other.Siri -{ - public static class NSUserActivityHelper - { - public static class ActivityKeys - { - public const string MenuItems = "menuItems"; - public const string SegueId = "segueID"; - } - - static string SearchableItemContentType = "Soup Menu"; - - public static string ViewMenuActivityType = "com.xamarin.SoupChef.viewMenu"; - - public static NSUserActivity ViewMenuActivity { - get - { - var userActivity = new NSUserActivity(ViewMenuActivityType) - { - Title = "娴嬭瘯title", //NSBundleHelper.SoupKitBundle.GetLocalizedString("ORDER_LUNCH_TITLE", "View menu activity title"), - EligibleForSearch = true, - EligibleForPrediction = true - }; - - var attributes = new CSSearchableItemAttributeSet(NSUserActivityHelper.SearchableItemContentType) - { - //ThumbnailData = UIImage.FromBundle("tomato").AsPNG(), - Keywords = ViewMenuSearchableKeywords, - DisplayName = "娴嬭瘯DisplayName",// NSBundleHelper.SoupKitBundle.GetLocalizedString("ORDER_LUNCH_TITLE", "View menu activity title"), - ContentDescription = "娴嬭瘯ContentDescription",//NSBundleHelper.SoupKitBundle.GetLocalizedString("VIEW_MENU_CONTENT_DESCRIPTION", "View menu content description") - }; - userActivity.ContentAttributeSet = attributes; - - //var phrase = NSBundleHelper.SoupKitBundle.GetLocalizedString("ORDER_LUNCH_SUGGESTED_PHRASE", "Voice shortcut suggested phrase"); - userActivity.SuggestedInvocationPhrase = "娴嬭瘯phrase"; - return userActivity; - } - } - - static string[] ViewMenuSearchableKeywords = new string[] { - "Searchable Keyword", - "Searchable Keyword", - "Searchable Keyword" - }; - } -} diff --git a/SiriKit/VoiceShortcutDataManager.cs b/SiriKit/VoiceShortcutDataManager.cs deleted file mode 100644 index 8a3a84e..0000000 --- a/SiriKit/VoiceShortcutDataManager.cs +++ /dev/null @@ -1,93 +0,0 @@ -锘�///* -//See LICENSE folder for this sample鈥檚 licensing information. - -//Abstract: -//A data manager that surfaces INVoiceShortcuts managed by INVoiceShortcutCenter. -//*/ - -//using System; -//using Intents; -//using System.Linq; -//using HDLSceneSiri; - -//namespace Other.Siri -//{ -// public class VoiceShortcutDataManager -// { -// INVoiceShortcut[] VoiceShortcuts; - -// public VoiceShortcutDataManager() -// { -// UpdateVoiceShortcuts(null); -// } - -// public VoiceShortcutDataManager(Action action) -// { -// UpdateVoiceShortcuts(action); -// } - -// public INVoiceShortcut VoiceShortcutForOrder(SiriScene ss) -// { -// var voiceShortcut = VoiceShortcuts.FirstOrDefault((shortcut) => -// { -// var intent = shortcut.Shortcut.Intent as HDLRunSceneIntent; -// if (intent is null) { return false; } -// var orderFromIntent = SiriScene.FromOrderSoupIntent(intent); -// if (orderFromIntent is null) { return false; } -// return ss.IsEqual(orderFromIntent); -// }); -// return voiceShortcut; -// } - - -// public INVoiceShortcut VoiceShortcutForOrder2(SiriScene ss) -// { -// var voiceShortcut = VoiceShortcuts.FirstOrDefault((shortcut) => -// { -// var intent = shortcut.Shortcut.Intent as HDLRunSceneIntent; -// if (intent is null) { return false; } -// var orderFromIntent = SiriScene.FromOrderSoupIntent(intent); -// if (orderFromIntent is null) { return false; } -// return ss.IsEqual(orderFromIntent); -// }); -// return voiceShortcut; -// } - -// public INVoiceShortcut FirstTemp () -// { -// try -// { -// if(VoiceShortcuts == null) -// { -// UpdateVoiceShortcuts(null); -// } -// return VoiceShortcuts[0]; -// } -// catch -// { -// return null; -// } -// } - -// public void UpdateVoiceShortcuts(Action completion) -// { -// INVoiceShortcutCenter.SharedCenter.GetAllVoiceShortcuts((voiceShortcutsFromCenter, error) => -// { -// if (voiceShortcutsFromCenter is null) -// { -// if (!(error is null)) -// { -// Console.WriteLine($"Failed to fetch voice shortcuts with error {error}"); -// } -// return; -// } -// VoiceShortcuts = voiceShortcutsFromCenter; -// if (!(completion is null)) -// { -// completion(); -// } -// }); -// } - -// } -//} -- Gitblit v1.8.0