From e75ccccb370b47305c6eadb321efb27c86cdd28b Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 30 十一月 2021 09:57:24 +0800 Subject: [PATCH] 合并 --- SiriIntents/Server/IMessageCommon.cs | 151 + SiriIntents/SiriIntents.csproj | 124 + SiriKit/SiriKit.csproj | 60 HDL-ON_Android/Assets/Language.ini | 3 HDL-ON_iOS/HDL-ON_iOS.csproj | 38 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs | 72 SiriKit/Properties/AssemblyInfo.cs | 36 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddOutputPage.cs | 194 + SiriBinding/Properties/AssemblyInfo.cs | 34 HDL_ON/HDL_ON.projitems | 1 HDL-ON_iOS/Info.plist | 6 SiriIntents/HDLRunSceneIntentHandlder.cs | 146 + HDL_ON/Common/HDLCommon.cs | 19 SiriIntents/Server/HttpServerRequest.cs | 101 SiriBinding/ApiDefinition.cs | 86 SiriIntents/packages.config | 5 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/Transfer/TransferingResidencePage.cs | 10 HDL_ON/UI/UI1-Login/LoginPage.cs | 13 SiriIntents/Server/NewApiRes.cs | 1510 +++++++++++++ HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddInputPage.cs | 127 SiriIntents/Server/HttpUtil.cs | 412 +++ SiriKit/Data/SceneDateManager.cs | 104 SiriIntentsUI/Info.plist | 46 HDL-ON_iOS/Resources/Phone/PersonalCenter/SiriIcon.png | 0 HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs | 229 + HDL-ON_iOS/Entitlements.plist | 4 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 | 6 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/PushConfigPage.cs | 196 + HDL-ON_iOS/Other/SkipControl.cs | 140 + SiriIntents/Info.plist | 44 HDL_ON/DAL/Server/HttpUtil.cs | 5 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs | 82 SiriKit/Data/DataManager.cs | 188 + SiriIntents/Entitlements.plist | 12 SiriKit/Base.lproj/Intents.intentdefinition | 265 ++ HDL_ON/Entity/Function/SecurityAlarm.cs | 63 SiriIntentsUI/IntentViewController.cs | 105 DLL/IOS/Shared.IOS.HDLSceneSiri.dll | 0 HDL-ON_iOS/AppDelegate.cs | 31 SiriBinding/SiriBinding.csproj | 56 SiriIntentsUI/MainInterface.storyboard | 48 HDL-ON_iOS/Resources/Language.ini | 3 SiriIntentsUI/Entitlements.plist | 12 HDL-ON_iOS/Base.lproj/Intents.intentdefinition | 181 + SiriIntents/IntentHandler.cs | 134 + .vs/HDL_APP_Project/xs/UserPrefs.xml | 38 SiriIntentsUI/SiriIntentsUI.csproj | 120 + SiriBinding/Structs.cs | 18 HDL_APP_Project.sln | 42 SiriIntents/Server/NewAPI.cs | 756 ++++++ SiriKit/Data/NSUserDefaultsHelper.cs | 40 HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs | 11 ThirdPartyIntegration/siri/libOnProSiriIntents.a | 0 SiriIntentsUI/IntentViewController.designer.cs | 27 HDL_ON/Common/R.cs | 4 HDL_ON/DAL/Server/HttpServerRequest.cs | 128 HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs | 342 ++ 59 files changed, 6,220 insertions(+), 420 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index 3847b41..78e92ec 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -2,24 +2,29 @@ <MonoDevelop.Ide.ItemProperties.SiriIntentUI> <MonoDevelop.MacDev.AppleDevelopmentTeam /> </MonoDevelop.Ide.ItemProperties.SiriIntentUI> - <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget" /> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/Server/HttpUtil.cs"> + <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.6242be7109c740c6cb8999a8904b6e0ea8d45192" /> + <MonoDevelop.Ide.Workbench ActiveDocument="SiriIntentsUI/IntentViewController.cs"> <Files> - <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs" Line="203" Column="17" IsPinned="True" /> - <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="21" Column="79" /> + <File FileName="HDL-ON_iOS/Other/SkipControl.cs" Line="68" Column="45" /> + <File FileName="HDL-ON_iOS/Info.plist" /> + <File FileName="SiriIntentsUI/IntentViewController.cs" Line="1" Column="1" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> - <Node name="HDL-ON_iOS" expanded="True" selected="True" /> + <Node name="HDL-ON_iOS" expanded="True"> + <Node name="Other" expanded="True" /> + </Node> + <Node name="SiriIntents" expanded="True" /> + <Node name="SiriIntentsUI" expanded="True"> + <Node name="IntentViewController.cs" selected="True" /> + </Node> + <Node name="SiriKit" expanded="True"> + <Node name="References" expanded="True" /> + <Node name="Base.lproj" expanded="True" /> + </Node> </Node> - </State> - </Pad> - <Pad Id="MonoDevelop.Debugger.WatchPad"> - <State> - <Value>tempFunction.deviceId</Value> - <Value>updata2.ToString()</Value> </State> </Pad> </Pads> @@ -31,14 +36,21 @@ <String>Shared.IOS/Shared.IOS.csproj</String> <String>SiriIntent/SiriIntent.csproj</String> <String>SceneKit/SceneKit.csproj</String> + <String>HdlOnProSiriIntents/HdlOnProSiriIntents.csproj</String> + <String>HdlOnProSiriIntentsUI/HdlOnProSiriIntentsUI.csproj</String> + <String>HdlOnProSiriKit/HdlOnProSiriKit.csproj</String> + <String>HDLSiriIntents/HDLSiriIntents.csproj</String> + <String>HDLSiriIntentsUI/HDLSiriIntentsUI.csproj</String> + <String>HDLSiriKit/HDLSiriKit.csproj</String> + <String>SiriBinding/SiriBinding.csproj</String> </DisabledProjects> - <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" /> + <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <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/HDL-ON_iOS/Other/SkipControl.cs" relfile="HDL-ON_iOS/Other/SkipControl.cs" line="25" 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/DLL/IOS/Shared.IOS.HDLSceneSiri.dll b/DLL/IOS/Shared.IOS.HDLSceneSiri.dll new file mode 100644 index 0000000..17986a1 --- /dev/null +++ b/DLL/IOS/Shared.IOS.HDLSceneSiri.dll Binary files differ diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index 79bfdd8..6b663da 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 @@ -1623,7 +1624,7 @@ 512=娑堟伅鎺ㄩ�佹湭寮�鍚紝璇峰墠寰�璁剧疆銆� 513=璇疯緭鍏ラ厤瀵圭爜 514=鏈厤缃綉鍏充綅缃俊鎭� - +515=娣诲姞瀹夐槻 1000=瀹ゅ唴婀垮害 1001=绔ラ攣 diff --git a/HDL-ON_iOS/AppDelegate.cs b/HDL-ON_iOS/AppDelegate.cs index 2d22046..4dba627 100644 --- a/HDL-ON_iOS/AppDelegate.cs +++ b/HDL-ON_iOS/AppDelegate.cs @@ -60,7 +60,7 @@ // // If not required for your application you can safely delete this method // return true; //} - internal static UINavigationController rootViewController; + public static UINavigationController rootViewController; public static void CleanApplicationIconBadgeNumber() { @@ -277,32 +277,8 @@ // //RemoteInfo.Current.ReadMsgList(true); //} - #region Siri - // Request access to Siri - INPreferences.RequestSiriAuthorization((INSiriAuthorizationStatus status) => { - // Respond to returned status - switch (status) - { - case INSiriAuthorizationStatus.Authorized: - break; - case INSiriAuthorizationStatus.Denied: - break; - case INSiriAuthorizationStatus.NotDetermined: - break; - case INSiriAuthorizationStatus.Restricted: - break; - } - }); - - var language = INPreferences.SiriLanguageCode; - - // Take action based on language - if (language == "en-US") - { - // Do something... - } - - #endregion + //楂樺痉key + GDMapKit.setGDApiKey("f0635ea15c5d579c6e93d9f07a06da69"); //楂樺痉key GDMapKit.setGDApiKey("f0635ea15c5d579c6e93d9f07a06da69"); @@ -475,6 +451,7 @@ HDL_ON.DriverLayer.Control.Ins.SearchLoaclGateway(); } + } } diff --git a/HDL-ON_iOS/Base.lproj/Intents.intentdefinition b/HDL-ON_iOS/Base.lproj/Intents.intentdefinition new file mode 100644 index 0000000..f49bdce --- /dev/null +++ b/HDL-ON_iOS/Base.lproj/Intents.intentdefinition @@ -0,0 +1,181 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>INEnums</key> + <array/> + <key>INIntentDefinitionModelVersion</key> + <string>1.2</string> + <key>INIntentDefinitionNamespace</key> + <string>8yVV3C</string> + <key>INIntentDefinitionSystemVersion</key> + <string>20G165</string> + <key>INIntentDefinitionToolsBuildVersion</key> + <string>13A233</string> + <key>INIntentDefinitionToolsVersion</key> + <string>13.0</string> + <key>INIntents</key> + <array> + <dict> + <key>INIntentCategory</key> + <string>generic</string> + <key>INIntentDescription</key> + <string>Run Scene</string> + <key>INIntentDescriptionID</key> + <string>Pe02nj</string> + <key>INIntentLastParameterTag</key> + <integer>2</integer> + <key>INIntentName</key> + <string>HDLRunScene</string> + <key>INIntentParameterCombinations</key> + <dict> + <key>sceneName,sceneId</key> + <dict> + <key>INIntentParameterCombinationIsPrimary</key> + <true/> + <key>INIntentParameterCombinationSupportsBackgroundExecution</key> + <true/> + <key>INIntentParameterCombinationTitle</key> + <string>鎵ц鍦烘櫙鈥�${sceneName}鈥�</string> + <key>INIntentParameterCombinationTitleID</key> + <string>oCGdw4</string> + </dict> + </dict> + <key>INIntentParameters</key> + <array> + <dict> + <key>INIntentParameterDisplayName</key> + <string>Scene Name</string> + <key>INIntentParameterDisplayNameID</key> + <string>wC0SgK</string> + <key>INIntentParameterDisplayPriority</key> + <integer>1</integer> + <key>INIntentParameterMetadata</key> + <dict> + <key>INIntentParameterMetadataCapitalization</key> + <string>Sentences</string> + <key>INIntentParameterMetadataDefaultValueID</key> + <string>xz2KkJ</string> + </dict> + <key>INIntentParameterName</key> + <string>sceneName</string> + <key>INIntentParameterTag</key> + <integer>1</integer> + <key>INIntentParameterType</key> + <string>String</string> + </dict> + <dict> + <key>INIntentParameterDisplayName</key> + <string>Scene Id</string> + <key>INIntentParameterDisplayNameID</key> + <string>MtgGtd</string> + <key>INIntentParameterDisplayPriority</key> + <integer>2</integer> + <key>INIntentParameterMetadata</key> + <dict> + <key>INIntentParameterMetadataCapitalization</key> + <string>Sentences</string> + <key>INIntentParameterMetadataDefaultValueID</key> + <string>hQHCm1</string> + </dict> + <key>INIntentParameterName</key> + <string>sceneId</string> + <key>INIntentParameterTag</key> + <integer>2</integer> + <key>INIntentParameterType</key> + <string>String</string> + </dict> + </array> + <key>INIntentResponse</key> + <dict> + <key>INIntentResponseCodes</key> + <array> + <dict> + <key>INIntentResponseCodeFormatString</key> + <string>${sceneName}</string> + <key>INIntentResponseCodeFormatStringID</key> + <string>Pq8YBC</string> + <key>INIntentResponseCodeName</key> + <string>success</string> + <key>INIntentResponseCodeSuccess</key> + <true/> + </dict> + <dict> + <key>INIntentResponseCodeFormatString</key> + <string>${errorMessage}</string> + <key>INIntentResponseCodeFormatStringID</key> + <string>CX5DVI</string> + <key>INIntentResponseCodeName</key> + <string>failure</string> + </dict> + <dict> + <key>INIntentResponseCodeName</key> + <string>error</string> + <key>INIntentResponseCodeSuccess</key> + <true/> + </dict> + </array> + <key>INIntentResponseLastParameterTag</key> + <integer>3</integer> + <key>INIntentResponseParameters</key> + <array> + <dict> + <key>INIntentResponseParameterDisplayName</key> + <string>Error Message</string> + <key>INIntentResponseParameterDisplayNameID</key> + <string>HxQb2M</string> + <key>INIntentResponseParameterDisplayPriority</key> + <integer>1</integer> + <key>INIntentResponseParameterName</key> + <string>errorMessage</string> + <key>INIntentResponseParameterTag</key> + <integer>1</integer> + <key>INIntentResponseParameterType</key> + <string>String</string> + </dict> + <dict> + <key>INIntentResponseParameterDisplayName</key> + <string>Success Message</string> + <key>INIntentResponseParameterDisplayNameID</key> + <string>BaAbSP</string> + <key>INIntentResponseParameterDisplayPriority</key> + <integer>2</integer> + <key>INIntentResponseParameterName</key> + <string>successMessage</string> + <key>INIntentResponseParameterTag</key> + <integer>2</integer> + <key>INIntentResponseParameterType</key> + <string>String</string> + </dict> + <dict> + <key>INIntentResponseParameterDisplayName</key> + <string>Scene Name</string> + <key>INIntentResponseParameterDisplayNameID</key> + <string>pqg7cb</string> + <key>INIntentResponseParameterDisplayPriority</key> + <integer>3</integer> + <key>INIntentResponseParameterName</key> + <string>sceneName</string> + <key>INIntentResponseParameterTag</key> + <integer>3</integer> + <key>INIntentResponseParameterType</key> + <string>String</string> + </dict> + </array> + </dict> + <key>INIntentRestrictions</key> + <integer>1</integer> + <key>INIntentTitle</key> + <string>Run Scene</string> + <key>INIntentTitleID</key> + <string>j3jRXP</string> + <key>INIntentType</key> + <string>Custom</string> + <key>INIntentVerb</key> + <string>Do</string> + </dict> + </array> + <key>INTypes</key> + <array/> +</dict> +</plist> diff --git a/HDL-ON_iOS/Entitlements.plist b/HDL-ON_iOS/Entitlements.plist index cb782f8..c3acdcc 100644 --- a/HDL-ON_iOS/Entitlements.plist +++ b/HDL-ON_iOS/Entitlements.plist @@ -10,5 +10,9 @@ </array> <key>com.apple.developer.siri</key> <true/> + <key>com.apple.security.application-groups</key> + <array> + <string>group.com.hdl.onpro</string> + </array> </dict> </plist> diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index 5704978..941ee2a 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -28,6 +28,7 @@ <CodesignKey>iPhone Developer</CodesignKey> <MtouchExtraArgs>-gcc_flags="-dead_strip -ObjC";-w</MtouchExtraArgs> <CodesignProvision>On+Dev-20210616-1</CodesignProvision> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' "> <DebugType>none</DebugType> @@ -38,6 +39,7 @@ <MtouchLink>SdkOnly</MtouchLink> <MtouchArch>x86_64</MtouchArch> <CodesignKey>iPhone Developer</CodesignKey> +<AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' "> <DebugSymbols>true</DebugSymbols> @@ -54,8 +56,9 @@ <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> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' "> <DebugType>none</DebugType> @@ -70,6 +73,7 @@ <MtouchExtraArgs>-gcc_flags="-dead_strip -ObjC"</MtouchExtraArgs> <MtouchI18n>cjk</MtouchI18n> <CodesignProvision>OnPro-Hoc20211117-1</CodesignProvision> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> <Reference Include="System" /> @@ -104,25 +108,28 @@ <Reference Include="Shared.IOS.HDLLinphoneSDK"> <HintPath>..\DLL\Linphone\iOS\Shared.IOS.HDLLinphoneSDK.dll</HintPath> </Reference> + <Reference Include="Shared.IOS.HDLSceneSiri"> + <HintPath>..\..\HDLXamarinSceneSiri\Shared.IOS.HDLSceneSiri\Shared.IOS.HDLSceneSiri\bin\Release\Shared.IOS.HDLSceneSiri.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <PackageReference Include="Newtonsoft.Json"> <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> @@ -463,6 +470,7 @@ <Folder Include="Resources\Phone\FunctionIcon\Light\LightScene\" /> <Folder Include="Resources\Phone\PersonalCenter\FacePassage\" /> <Folder Include="Resources\Phone\FunctionIcon\Electrical\AirSwitch\" /> + <Folder Include="Base.lproj\" /> </ItemGroup> <ItemGroup> <InterfaceDefinition Include="LaunchScreen.storyboard" /> @@ -490,6 +498,7 @@ <Compile Include="ZXingOverlayView.cs" /> <Compile Include="Other\JLCountrycode.cs" /> <Compile Include="BlueWifi.cs" /> + <Compile Include="Other\SkipControl.cs" /> </ItemGroup> <ItemGroup> <BundleResource Include="Resources\Phone\LoginIcon\ShowPasswordIcon.png" /> @@ -1357,6 +1366,7 @@ <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\btnCloseIcon.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\btnInfoIcon.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\HumiOnIcon.png" /> + <BundleResource Include="Resources\Phone\PersonalCenter\SiriIcon.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> @@ -1401,11 +1411,23 @@ <Project>{2DDF4C3C-6998-432E-9F43-6786D82F0630}</Project> <Name>Blufi</Name> </ProjectReference> - <ProjectReference Include="..\SiriIntentUI\SiriIntentUI.csproj"> + <ProjectReference Include="..\SiriIntents\SiriIntents.csproj"> <IsAppExtension>true</IsAppExtension> - <Project>{B594D3F5-4B93-4988-B45E-150BBFDC8A43}</Project> - <Name>SiriIntentUI</Name> + <Project>{760980F5-1CD3-4F4F-9134-34D87BECD790}</Project> + <Name>SiriIntents</Name> </ProjectReference> + <ProjectReference Include="..\SiriIntentsUI\SiriIntentsUI.csproj"> + <IsAppExtension>true</IsAppExtension> + <Project>{ACC48A7F-250B-4915-A250-9BC399DBD6B3}</Project> + <Name>SiriIntentsUI</Name> + </ProjectReference> + <ProjectReference Include="..\SiriKit\SiriKit.csproj"> + <Project>{8B1652FA-5158-4D57-B90D-07BB91766625}</Project> + <Name>SiriKit</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Content Include="Base.lproj\Intents.intentdefinition" /> </ItemGroup> <Import Project="..\HDL_ON\HDL_ON.projitems" Label="Shared" Condition="Exists('..\HDL_ON\HDL_ON.projitems')" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist index edd4751..be3cd85 100644 --- a/HDL-ON_iOS/Info.plist +++ b/HDL-ON_iOS/Info.plist @@ -42,7 +42,7 @@ <key>LSRequiresIPhoneOS</key> <true/> <key>MinimumOSVersion</key> - <string>11.0</string> + <string>12.0</string> <key>UIDeviceFamily</key> <array> <integer>1</integer> @@ -135,5 +135,9 @@ <string>Make audio/video calls</string> <key>NSSiriUsageDescription</key> <string>On Pro data will be send to Siri.</string> + <key>NSUserActivityTypes</key> + <array> + <string>HDLRunSceneIntent</string> + </array> </dict> </plist> diff --git a/HDL-ON_iOS/Other/SkipControl.cs b/HDL-ON_iOS/Other/SkipControl.cs new file mode 100644 index 0000000..9a8439d --- /dev/null +++ b/HDL-ON_iOS/Other/SkipControl.cs @@ -0,0 +1,140 @@ +锘縰sing System; +using CoreGraphics; +using Foundation; +using HDL_ON.Entity; +using HDLSceneSiri; +using Intents; +using IntentsUI; +using Shared; +using UIKit; + +namespace Other +{ + public class SkipControl + { + public SkipControl() + { + } + + public void SkipSiriView() + { + //var user = new SiriBaseView(); + //user.View.BackgroundColor = new UIColor(242, 243, 247, 1); + + //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) + //{ + // list.Add(new HDLSceneSiri.HDLSiriControlModel() + // { + // UserSceneId = localScene.userSceneId, + // Name = localScene.name, + // }); + //} + //var vc = new HDLSceneSiri.HDLSiriSceneListViewController(); + //vc.DataSource = list; + ////vc.TitleName + ////PresentViewController(vc, true, null); + //HDL_ON_iOS.AppDelegate.rootViewController.PushViewController(vc, true); + + + //1.鍒濆鍖杁ataList + NSMutableArray dataSourceList = new NSMutableArray(); + //2.鍒濆鍖栧満鏅垪琛ㄦ暟鎹� + HDLSiriShortcutModel sceneModel = new HDLSiriShortcutModel(); + if (Language.CurrentLanguage == "Chinese") + { + sceneModel.Title = "鍦烘櫙"; + sceneModel.Content = "灏嗗満鏅坊鍔犲埌蹇嵎鎸囦护锛屽嵆鍙�氳繃Siri鎵ц"; + } + else + { + sceneModel.Title = "Scenes"; + sceneModel.Content = "Add the scene to the shortcut, which can be executed through Siri"; + } + + NSMutableArray list = new NSMutableArray(); + foreach (var localScene in HDL_ON.Entity.FunctionList.List.scenes) + { + list.Add(new HDLSiriControlModel() + { + ControlId = localScene.userSceneId,//涓嶈兘涓虹┖ + ControlName = localScene.name,//涓嶈兘涓虹┖ + ControlType = "1",//涓嶈兘涓虹┖ + ControlJSONStr = "1",//涓嶈兘涓虹┖ + ActionName = Language.CurrentLanguage == "Chinese"? "鍦烘櫙": "Scene"//涓嶈兘涓虹┖ + }); + } + sceneModel.List = NSArray.FromArray<HDLSiriControlModel>(list); + dataSourceList.Add(sceneModel); + + //3.鍒濆鍖栧畨闃插垪琛ㄦ暟鎹� + HDLSiriShortcutModel securityModel = new HDLSiriShortcutModel(); + if (Language.CurrentLanguage == "Chinese") + { + securityModel.Title = "瀹夐槻"; + securityModel.Content = "灏嗗畨闃叉坊鍔犲埌蹇嵎鎸囦护锛屽嵆鍙�氳繃Siri鎵ц"; + }else + { + securityModel.Title = "Security"; + securityModel.Content = "Add security to the shortcut, which can be executed through Siri"; + } + NSMutableArray list2 = new NSMutableArray(); + foreach (var temp in HDL_ON.Entity.FunctionList.List.securities) + { + SecurityState securityState = new SecurityState() + { + gatewayId = DB_ResidenceData.Instance.HomeGateway.gatewayId, + sid = temp.sid, + status = "enable", + userSecurityId = temp.userSecurityId + }; + + var ControlJSONStr = Newtonsoft.Json.JsonConvert.SerializeObject(securityState); + + list2.Add(new HDLSiriControlModel() + { + ControlId = temp.userSecurityId,//涓嶈兘涓虹┖ + ControlName = temp.name,//涓嶈兘涓虹┖ + ControlType = "2",//涓嶈兘涓虹┖ + ControlJSONStr = ControlJSONStr,//涓嶈兘涓虹┖ + ActionName = Language.CurrentLanguage == "Chinese" ? "瀹夐槻" : "Security"//涓嶈兘涓虹┖ + + }); + } + securityModel.List = NSArray.FromArray<HDLSiriControlModel>(list2); + dataSourceList.Add(securityModel); + //4.璺宠浆Siri娣诲姞鎴栬�呯紪杈戠鐞嗛〉闈� + HDLSceneSiri.HDLSiriSceneListViewController vc = new HDLSceneSiri.HDLSiriSceneListViewController(); + vc.DataSource = dataSourceList; + vc.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;//涓嶈兘涓虹┖ + if (Language.CurrentLanguage == "Chinese") + { + vc.TitleName = "蹇嵎鎸囦护"; + } + else + { + vc.TitleName = "Shortcut instruction"; + } + + HDL_ON_iOS.AppDelegate.rootViewController.PushViewController(vc, true); + + + } + + public void SetData(bool isLogin, string accessToken, string refreshToken, string regionUrl, string homeId) + { + 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 ad70402..39ce621 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 @@ -1623,7 +1624,7 @@ 512=娑堟伅鎺ㄩ�佹湭寮�鍚紝璇峰墠寰�璁剧疆銆� 513=璇疯緭鍏ラ厤瀵圭爜 514=鏈厤缃綉鍏充綅缃俊鎭� - +515=娣诲姞瀹夐槻 1000=瀹ゅ唴婀垮害 1001=绔ラ攣 diff --git a/HDL-ON_iOS/Resources/Phone/PersonalCenter/SiriIcon.png b/HDL-ON_iOS/Resources/Phone/PersonalCenter/SiriIcon.png new file mode 100644 index 0000000..30d4f8c --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/PersonalCenter/SiriIcon.png Binary files differ diff --git a/HDL_APP_Project.sln b/HDL_APP_Project.sln index c30175b..aa7e006 100644 --- a/HDL_APP_Project.sln +++ b/HDL_APP_Project.sln @@ -10,6 +10,12 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blufi", "HdlBluWi\Blufi.csproj", "{2DDF4C3C-6998-432E-9F43-6786D82F0630}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiriIntentsUI", "SiriIntentsUI\SiriIntentsUI.csproj", "{ACC48A7F-250B-4915-A250-9BC399DBD6B3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiriKit", "SiriKit\SiriKit.csproj", "{8B1652FA-5158-4D57-B90D-07BB91766625}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiriIntents", "SiriIntents\SiriIntents.csproj", "{760980F5-1CD3-4F4F-9134-34D87BECD790}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution HDL_ON\HDL_ON.projitems*{09712674-2a38-407b-b1e2-560b2c352f9a}*SharedItemsImports = 4 @@ -63,6 +69,42 @@ {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Debug|Any CPU.ActiveCfg = Debug|iPhone + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Debug|Any CPU.Build.0 = Debug|iPhone + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Debug|iPhone.ActiveCfg = Debug|iPhone + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Debug|iPhone.Build.0 = Debug|iPhone + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Release|Any CPU.Build.0 = Release|iPhoneSimulator + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Release|iPhone.ActiveCfg = Release|iPhone + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Release|iPhone.Build.0 = Release|iPhone + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {8B1652FA-5158-4D57-B90D-07BB91766625}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Debug|iPhone.Build.0 = Debug|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Release|Any CPU.Build.0 = Release|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Release|iPhone.ActiveCfg = Release|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Release|iPhone.Build.0 = Release|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Debug|Any CPU.ActiveCfg = Debug|iPhone + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Debug|Any CPU.Build.0 = Debug|iPhone + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Debug|iPhone.ActiveCfg = Debug|iPhone + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Debug|iPhone.Build.0 = Debug|iPhone + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Release|Any CPU.Build.0 = Release|iPhoneSimulator + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Release|iPhone.ActiveCfg = Release|iPhone + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Release|iPhone.Build.0 = Release|iPhone + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs index 5cf2a74..0d45ee0 100644 --- a/HDL_ON/Common/HDLCommon.cs +++ b/HDL_ON/Common/HDLCommon.cs @@ -426,6 +426,10 @@ DB_ResidenceData.Instance.EixtAccount(); //4.娉ㄩ攢HDLSIP璐﹀彿鐧诲綍 2021-08-20 HDLLinphone.Current.LogoutAllAccount(); +#if __IOS__ + //5.娓呯┖Siri鍏变韩鏁版嵁淇℃伅 + new Other.SkipControl().SetData(false, "", "", "",""); +#endif } catch (Exception ex) { @@ -483,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 @@ -522,9 +531,9 @@ } - #endregion +#endregion - #region 鈻� 甯哥敤鏂规硶_______________________ +#region 鈻� 甯哥敤鏂规硶_______________________ /// <summary> /// 璁剧疆涓嬪垝绾挎寜閽姸鎬� /// 缁熶竴灏佽璁剧疆鏂规硶 @@ -597,9 +606,9 @@ Control.Ins.SearchLoaclGateway(); } } - #endregion +#endregion - #region 璺宠浆鎵撳紑钀ょ煶浜戞柟娉� +#region 璺宠浆鎵撳紑钀ょ煶浜戞柟娉� /// <summary> /// 鑾峰彇瀛愯处鍙穞oken骞惰烦杞澶囧垪琛ㄩ〉闈� @@ -701,6 +710,6 @@ { IsBackground = true }.Start(); } - #endregion +#endregion } } diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 8827fcf..bff908c 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 8f2d089..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 } } @@ -785,7 +821,7 @@ return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Share_GetList, requestJson); } - + #endregion ///// <summary> @@ -934,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; } @@ -993,7 +1029,8 @@ isProduce = false; #endif - if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) { + if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) + { Utlis.WriteLine("PushDeviceToken 涓虹┖"); return false; } @@ -1004,7 +1041,7 @@ deviceName = OnAppConfig.Instance.PhoneName, deviceType = deviceType, produce = isProduce, - + }; mAddpushinfoObj.languageType = Utlis.GetPostLanguageType(); @@ -1027,11 +1064,11 @@ OnAppConfig.Instance.PushId = pushId; OnAppConfig.Instance.SaveConfig(); Utlis.WriteLine("PushId: " + pushId); - + return true; } } - + } else { @@ -1115,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) { @@ -1303,9 +1341,9 @@ -#endregion + #endregion -#region 鑾峰彇澶╂皵閮ㄥ垎 + #region 鑾峰彇澶╂皵閮ㄥ垎 /// <summary> /// 鑾峰彇鎸囧畾缁忕含搴︾殑鍩庡競淇℃伅澶╂皵淇℃伅 /// </summary> @@ -1426,10 +1464,10 @@ //} -#endregion + #endregion -#region 澶囦唤閮ㄥ垎 + #region 澶囦唤閮ㄥ垎 ///// <summary> ///// 鑾峰彇浣忓畢澶囦唤鍒楄〃 ///// </summary> @@ -1900,10 +1938,10 @@ } */ -#endregion + #endregion -#region Kaede --璁惧鍔熻兘鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�� + #region Kaede --璁惧鍔熻兘鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�� /// <summary> /// 鑾峰彇璁惧鍒楄〃 /// </summary> @@ -1947,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); } @@ -1964,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); @@ -2074,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); @@ -2117,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); @@ -2135,9 +2173,9 @@ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectDevice, requestJson); } -#endregion + #endregion -#region Kaede --鍦烘櫙鍔熻兘-------------------------- + #region Kaede --鍦烘櫙鍔熻兘-------------------------- /// <summary> /// 鑾峰彇鍦烘櫙鍒楄〃 /// 鎴块棿ID鍙┖锛岄粯璁ゆ煡璇綇瀹呬笅鎵�鏈夋埧闂� @@ -2164,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); @@ -2269,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> @@ -2288,7 +2326,7 @@ d.Add("pageSize", "1000"); var requestJson = HttpUtil.GetSignRequestJson(d); var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetRoomList, requestJson); - + return pack; } /// <summary> @@ -2346,10 +2384,10 @@ return pack; } -#endregion + #endregion -#region Kaede -- 瀹夐槻鎺ュ彛____________________________ + #region Kaede -- 瀹夐槻鎺ュ彛____________________________ /// <summary> /// 鑾峰彇瀹夐槻鍒楄〃 /// </summary> @@ -2489,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); @@ -2513,10 +2551,10 @@ return pack; } -#endregion + #endregion -#region Kaede --绗笁鏂瑰搧鐗屽姛鑳�-------------------------- + #region Kaede --绗笁鏂瑰搧鐗屽姛鑳�-------------------------- /// <summary> /// 鑾峰彇绗笁鏂瑰搧鐗屽垪琛� /// </summary> @@ -2541,9 +2579,9 @@ return pack; } -#endregion + #endregion -#region 鈻� 钀ょ煶浜慡DK鐩稿叧鎺ュ彛_________________________ + #region 鈻� 钀ょ煶浜慡DK鐩稿叧鎺ュ彛_________________________ /// <summary> /// 娌充笢鑾峰彇钀ょ煶浜戝瓙璐﹀彿token鐨勬帴鍙� /// 2021-07-07 鏂版柟妗堟帴鍙h皟鏁村鎺� @@ -2569,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 @@ -2731,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 8208893..c4771f5 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -487,6 +487,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\A_EnvironmentalDataCenter.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\2-Classification\SceneControlZone.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\CalculatedDistance.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 bdb35c9..d1720bf 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -198,6 +198,7 @@ bool b = false; btnIcon.MouseUpEventHandler += (sender, e) => { + //ESOnVideo.Current.Test(false); //return; @@ -211,7 +212,7 @@ etAccount.Text = "13226233133";//璞嗚眴 etAccount.Text = "18316672920"; //etAccount.Text = "18316120654";//tujie - //etAccount.Text = "15626203746"; + etAccount.Text = "15626203746"; //etAccount.Text = "13450425807";//榛勭婧� knx椤圭洰 } else @@ -230,15 +231,15 @@ //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"; //etAccount.Text = "13375012441"; - etAccount.Text = "info@smartlife-ks.com"; - etAccount.Text = "551775569@qq.com";//wcf + //etAccount.Text = "info@smartlife-ks.com"; + //etAccount.Text = "551775569@qq.com";//wcf } b = !b; etPassword.Text = "123456"; diff --git a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs index 201b868..7b9c9c7 100644 --- a/HDL_ON/UI/UI1-Login/LoginPageBLL.cs +++ b/HDL_ON/UI/UI1-Login/LoginPageBLL.cs @@ -726,6 +726,12 @@ //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; //鑾峰彇鐢ㄦ埛淇℃伅 new Thread(() => 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 b333fe4..95475ac 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs @@ -152,6 +152,10 @@ /// 鏅鸿兘闊崇鏂囨湰 /// </summary> Button btnSmartSpeakerText; + /// <summary> + /// Siri鏂囨湰 + /// </summary> + Button btnSiriText; public PersonalCenterPage() @@ -791,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() { @@ -850,6 +855,79 @@ #endregion + #region Siri + #if __IOS__ + //if (Application.PhoneType >= 12) + { + supportViewCellCount++; + //supportView 鍔犻珮 鏄剧ず3琛� 3*44 + supportView.Height = Application.GetRealWidth(supportViewCellCount * 44); + + FrameLayout siriView = new FrameLayout() + { + Height = Application.GetRealWidth(44), + }; + supportView.AddChidren(siriView); + + //浣忓畢涓哄綋鍓嶈处鍙锋墠鏄剧ず鏅鸿兘闊崇鍏ュ彛 + Button btnSiriIcon = new Button() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealWidth(10), + Width = Application.GetMinRealAverage(24), + Height = Application.GetMinRealAverage(24), + UnSelectedImagePath = "PersonalCenter/SiriIcon.png", + }; + siriView.AddChidren(btnSiriIcon); + + btnSiriText = new Button() + { + X = Application.GetRealWidth(48), + Width = Application.GetRealWidth(270), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.TextFontSize + }; + if(Language.CurrentLanguage == "Chinese") + { + btnSiriText.Text = "Siri蹇嵎鏂瑰紡"; + }else + { + btnSiriText.Text = "Siri Shortcut"; + } + + siriView.AddChidren(btnSiriText); + + + btnSiriText.MouseUpEventHandler = (sender, e) => { + var ddd =new Other.SkipControl(); + ddd.SkipSiriView(); + }; + + Button btnSiriRight = new Button() + { + X = Application.GetRealWidth(315), + Y = Application.GetRealWidth(14), + Width = Application.GetMinRealAverage(16), + Height = Application.GetMinRealAverage(16), + UnSelectedImagePath = "Public/Right.png", + }; + siriView.AddChidren(btnSiriRight); + + var btnSmartSpeakerViewLine = new Button() + { + X = Application.GetRealWidth(48), + Y = Application.GetRealWidth(43), + Height = Application.GetRealHeight(1), + Width = Application.GetRealWidth(279), + BackgroundColor = CSS_Color.DividingLineColor + }; + siriView.AddChidren(btnSmartSpeakerViewLine); + } + #endif + #endregion + #region 鑾峰彇鏀寔 //FrameLayout supView = 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/SiriBinding/ApiDefinition.cs b/SiriBinding/ApiDefinition.cs new file mode 100644 index 0000000..b615dca --- /dev/null +++ b/SiriBinding/ApiDefinition.cs @@ -0,0 +1,86 @@ +锘縰sing System; + +using ObjCRuntime; +using Foundation; +using UIKit; +using Intents; + +namespace HdlSiri +{ + // @interface HDLRunSceneIntent : INIntent + [Watch(5, 0), NoTV, Mac(11, 0), iOS(12, 0)] + [BaseType(typeof(INIntent))] + interface HDLRunSceneIntent + { + // @property (readwrite, copy, nonatomic) NSString * _Nullable sceneName; + [NullAllowed, Export("sceneName")] + string SceneName { get; set; } + + // @property (readwrite, copy, nonatomic) NSString * _Nullable sceneId; + [NullAllowed, Export("sceneId")] + string SceneId { get; set; } + } + + // @protocol HDLRunSceneIntentHandling <NSObject> + /* + Check whether adding [Model] to this declaration is appropriate. + [Model] is used to generate a C# class that implements this protocol, + and might be useful for protocols that consumers are supposed to implement, + since consumers can subclass the generated class instead of implementing + the generated interface. If consumers are not supposed to implement this + protocol, then [Model] is redundant and will generate code that will never + be used. + */ + [Watch(5, 0), NoTV, Mac(11, 0), iOS(12, 0)] + [Protocol] + [BaseType(typeof(NSObject))] + interface HDLRunSceneIntentHandling + { + // @required -(void)handleRunScene:(HDLRunSceneIntent * _Nonnull)intent completion:(void (^ _Nonnull)(HDLRunSceneIntentResponse * _Nonnull))completion __attribute__((swift_name("handle(intent:completion:)"))); + [Abstract] + [Export("handleRunScene:completion:")] + void HandleRunScene(HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion); + + // @optional -(void)confirmRunScene:(HDLRunSceneIntent * _Nonnull)intent completion:(void (^ _Nonnull)(HDLRunSceneIntentResponse * _Nonnull))completion __attribute__((swift_name("confirm(intent:completion:)"))); + [Export("confirmRunScene:completion:")] + void ConfirmRunScene(HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion); + } + + // @interface HDLRunSceneIntentResponse : INIntentResponse + [Watch(5, 0), NoTV, Mac(11, 0), iOS(12, 0)] + [BaseType(typeof(INIntentResponse))] + [DisableDefaultCtor] + interface HDLRunSceneIntentResponse + { + // -(instancetype _Nonnull)initWithCode:(HDLRunSceneIntentResponseCode)code userActivity:(NSUserActivity * _Nullable)userActivity __attribute__((objc_designated_initializer)); + [Export("initWithCode:userActivity:")] + [DesignatedInitializer] + IntPtr Constructor(HDLRunSceneIntentResponseCode code, [NullAllowed] NSUserActivity userActivity); + + // +(instancetype _Nonnull)successIntentResponseWithSceneName:(NSString * _Nonnull)sceneName __attribute__((swift_name("success(sceneName:)"))); + [Static] + [Export("successIntentResponseWithSceneName:")] + HDLRunSceneIntentResponse SuccessIntentResponseWithSceneName(string sceneName); + + // +(instancetype _Nonnull)failureIntentResponseWithErrorMessage:(NSString * _Nonnull)errorMessage __attribute__((swift_name("failure(errorMessage:)"))); + [Static] + [Export("failureIntentResponseWithErrorMessage:")] + HDLRunSceneIntentResponse FailureIntentResponseWithErrorMessage(string errorMessage); + + // @property (readwrite, copy, nonatomic) NSString * _Nullable errorMessage; + [NullAllowed, Export("errorMessage")] + string ErrorMessage { get; set; } + + // @property (readwrite, copy, nonatomic) NSString * _Nullable successMessage; + [NullAllowed, Export("successMessage")] + string SuccessMessage { get; set; } + + // @property (readwrite, copy, nonatomic) NSString * _Nullable sceneName; + [NullAllowed, Export("sceneName")] + string SceneName { get; set; } + + // @property (readonly, nonatomic) HDLRunSceneIntentResponseCode code; + [Export("code")] + HDLRunSceneIntentResponseCode Code { get; } + } +} \ No newline at end of file diff --git a/SiriBinding/Properties/AssemblyInfo.cs b/SiriBinding/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..cb6dc2e --- /dev/null +++ b/SiriBinding/Properties/AssemblyInfo.cs @@ -0,0 +1,34 @@ +锘縰sing System.Reflection; +using System.Runtime.CompilerServices; + +using Foundation; + +// This attribute allows you to mark your assemblies as 鈥渟afe to link鈥�. +// When the attribute is present, the linker鈥攊f enabled鈥攚ill process the assembly +// even if you鈥檙e using the 鈥淟ink SDK assemblies only鈥� option, which is the default for device builds. + +[assembly: LinkerSafe] + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("NativeLibrary")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("NativeLibrary")] +[assembly: AssemblyCopyright("Copyright 漏 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/SiriBinding/SiriBinding.csproj b/SiriBinding/SiriBinding.csproj new file mode 100644 index 0000000..4e8e70a --- /dev/null +++ b/SiriBinding/SiriBinding.csproj @@ -0,0 +1,56 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectTypeGuids>{8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ProjectGuid>{77FFAB61-395D-4AD3-863E-C4E32B5038E7}</ProjectGuid> + <TemplateGuid>{b6f3ff35-79b2-4f25-a2fc-60a7cf61013b}</TemplateGuid> + <OutputType>Library</OutputType> + <RootNamespace>NativeLibrary</RootNamespace> + <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> + <AssemblyName>NativeLibrary</AssemblyName> + <RestoreProjectStyle>PackageReference</RestoreProjectStyle> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>portable</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>portable</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="Xamarin.iOS" /> + </ItemGroup> + <ItemGroup> + <Folder Include="Resources\" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ObjcBindingApiDefinition Include="ApiDefinition.cs" /> + </ItemGroup> + <ItemGroup> + <ObjcBindingCoreSource Include="Structs.cs" /> + </ItemGroup> + <ItemGroup> + <NativeReference Include="..\ThirdPartyIntegration\siri\libOnProSiriIntents.a"> + <Kind>Static</Kind> + <SmartLink>False</SmartLink> + </NativeReference> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.ObjCBinding.CSharp.targets" /> +</Project> \ No newline at end of file diff --git a/SiriBinding/Structs.cs b/SiriBinding/Structs.cs new file mode 100644 index 0000000..e76f100 --- /dev/null +++ b/SiriBinding/Structs.cs @@ -0,0 +1,18 @@ +锘縰sing ObjCRuntime; + +namespace HdlSiri +{ + [Watch(5, 0), NoTV, Mac(11, 0), iOS(12, 0)] + [Native] + public enum HDLRunSceneIntentResponseCode : long + { + Unspecified = 0, + Ready, + ContinueInApp, + InProgress, + Success, + Failure, + FailureRequiringAppLaunch, + Error = 100 + } +} diff --git a/SiriIntents/Entitlements.plist b/SiriIntents/Entitlements.plist new file mode 100644 index 0000000..0dde1e0 --- /dev/null +++ b/SiriIntents/Entitlements.plist @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>com.apple.security.application-groups</key> + <array> + <string>group.com.hdl.onpro</string> + </array> + <key>com.apple.developer.siri</key> + <true/> +</dict> +</plist> diff --git a/SiriIntents/HDLRunSceneIntentHandlder.cs b/SiriIntents/HDLRunSceneIntentHandlder.cs new file mode 100644 index 0000000..b053f56 --- /dev/null +++ b/SiriIntents/HDLRunSceneIntentHandlder.cs @@ -0,0 +1,146 @@ +锘縰sing System; +using System.Collections.Generic; +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 = "-1"; + if (intent.ControlType == "1") + { + result = Server.HttpServerRequest.Ins.ExecuteScene(intent.ControlId); + } + else + { + + var security = Newtonsoft.Json.JsonConvert.DeserializeObject<SecurityState>(intent.ControlJSONStr); + var sendObj = new List<SecurityState>() { new SecurityState() { + gatewayId =security.gatewayId,sid = security.sid, status = security.status, userSecurityId = security.userSecurityId + } }; + result = Server.HttpServerRequest.Ins.SetSecurityStatus(sendObj); + } + 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); + } + } + } + + + /// <summary> + /// 瀹夐槻鐘舵�侀厤缃� + /// </summary> + public class SecurityState + { + /// <summary> + /// 瀹夐槻浜戠id + /// </summary> + public string userSecurityId; + /// <summary> + /// 缃戝叧id 缃戝叧id 濡傛灉浼犵殑鏄痵id璇ュ瓧娈甸渶瑕佷紶 + /// </summary> + public string gatewayId; + /// <summary> + /// 瀹夐槻sid + /// </summary> + public string sid; + /// <summary> + /// 鐘舵�� enable甯冮槻銆乨isable鎾掗槻 + /// </summary> + public string status; + } + +} diff --git a/SiriIntents/Info.plist b/SiriIntents/Info.plist new file mode 100644 index 0000000..4e0984e --- /dev/null +++ b/SiriIntents/Info.plist @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleIdentifier</key> + <string>com.hdl.onpro.siri</string> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>XPC!</string> + <key>CFBundleShortVersionString</key> + <string>1.3.202111171</string> + <key>CFBundleVersion</key> + <string>1.3.11171</string> + <key>MinimumOSVersion</key> + <string>12.0</string> + <key>NSExtension</key> + <dict> + <key>NSExtensionAttributes</key> + <dict> + <key>IntentsRestrictedWhileLocked</key> + <array> + <string>HDLRunSceneIntent</string> + </array> + <key>IntentsSupported</key> + <array> + <string>HDLRunSceneIntent</string> + </array> + <key>IntentsRestrictedWhileProtectedDataUnavailable</key> + <array> + <string>HDLRunSceneIntent</string> + </array> + </dict> + <key>NSExtensionPointIdentifier</key> + <string>com.apple.intents-service</string> + <key>NSExtensionPrincipalClass</key> + <string>IntentHandler</string> + </dict> + <key>CFBundleDisplayName</key> + <string>SiriIntents</string> +</dict> +</plist> diff --git a/SiriIntents/IntentHandler.cs b/SiriIntents/IntentHandler.cs new file mode 100644 index 0000000..89cbeed --- /dev/null +++ b/SiriIntents/IntentHandler.cs @@ -0,0 +1,134 @@ +锘縰sing System; +using System.Collections.Generic; + +using Foundation; +using HDLSceneSiri; +using Intents; + +namespace SiriIntents +{ + // As an example, this class is set up to handle Message intents. + // You will want to replace this or add other intents as appropriate. + // The intents you wish to handle must be declared in the extension's Info.plist. + + // You can test your example integration by saying things to Siri like: + // "Send a message using <myApp>" + // "<myApp> John saying hello" + // "Search for messages in <myApp>" + [Register("IntentHandler")] + public class IntentHandler : INExtension//, IINSendMessageIntentHandling, IINSearchForMessagesIntentHandling, IINSetMessageAttributeIntentHandling + { + protected IntentHandler(IntPtr handle) : base(handle) + { + // Note: this .ctor should not contain any initialization logic. + } + + public override NSObject GetHandler(INIntent intent) + { + // 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 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; + // } + + // 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); + // } + // } + + // 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); + //} + + //// 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); + //} + + //// 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); + //} + + //// 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. + + // 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); + //} + + //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); + //} + } +} diff --git a/SiriIntents/Server/HttpServerRequest.cs b/SiriIntents/Server/HttpServerRequest.cs new file mode 100644 index 0000000..6fe2f52 --- /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 string SetSecurityStatus(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.Code; + } + + + } +} \ 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 new file mode 100644 index 0000000..8a350a3 --- /dev/null +++ b/SiriIntents/SiriIntents.csproj @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform> + <ProjectGuid>{760980F5-1CD3-4F4F-9134-34D87BECD790}</ProjectGuid> + <ProjectTypeGuids>{EE2C853D-36AF-4FDB-B1AD-8E90477E2198};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <OutputType>Library</OutputType> + <RootNamespace>SiriIntents</RootNamespace> + <AssemblyName>SiriIntents</AssemblyName> + <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\iPhoneSimulator\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <MtouchDebug>true</MtouchDebug> + <MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> + <MtouchFastDev>true</MtouchFastDev> + <IOSDebuggerPort>28717</IOSDebuggerPort> + <MtouchLink>None</MtouchLink> + <MtouchArch>x86_64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <DeviceSpecificBuild>false</DeviceSpecificBuild> + <MtouchVerbosity></MtouchVerbosity> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\iPhone\Release</OutputPath> + <DefineConstants></DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <MtouchUseLlvm>true</MtouchUseLlvm> + <MtouchFloat32>true</MtouchFloat32> + <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> + <MtouchLink>SdkOnly</MtouchLink> + <MtouchArch>ARM64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <MtouchVerbosity></MtouchVerbosity> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\iPhoneSimulator\Release</OutputPath> + <DefineConstants></DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> + <MtouchLink>None</MtouchLink> + <MtouchArch>x86_64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <MtouchVerbosity></MtouchVerbosity> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\iPhone\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <DeviceSpecificBuild>true</DeviceSpecificBuild> + <MtouchDebug>true</MtouchDebug> + <MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> + <MtouchFastDev>true</MtouchFastDev> + <MtouchFloat32>true</MtouchFloat32> + <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> + <IOSDebuggerPort>52238</IOSDebuggerPort> + <MtouchLink>SdkOnly</MtouchLink> + <MtouchArch>ARM64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <MtouchVerbosity></MtouchVerbosity> + <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"> + <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/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 new file mode 100644 index 0000000..0dde1e0 --- /dev/null +++ b/SiriIntentsUI/Entitlements.plist @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>com.apple.security.application-groups</key> + <array> + <string>group.com.hdl.onpro</string> + </array> + <key>com.apple.developer.siri</key> + <true/> +</dict> +</plist> diff --git a/SiriIntentsUI/Info.plist b/SiriIntentsUI/Info.plist new file mode 100644 index 0000000..c85f32c --- /dev/null +++ b/SiriIntentsUI/Info.plist @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDisplayName</key> + <string>SiriIntentsUI</string> + <key>CFBundleName</key> + <string>SiriIntentsUI</string> + <key>CFBundleIdentifier</key> + <string>com.hdl.onpro.siriui</string> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>XPC!</string> + <key>CFBundleShortVersionString</key> + <string>1.3.202111171</string> + <key>CFBundleVersion</key> + <string>1.3.11171</string> + <key>MinimumOSVersion</key> + <string>12.0</string> + <key>NSExtension</key> + <dict> + <key>NSExtensionAttributes</key> + <dict> + <key>IntentsSupported</key> + <array> + <string>HDLRunSceneIntent</string> + </array> + <key>IntentsRestrictedWhileLocked</key> + <array> + <string>HDLRunSceneIntent</string> + </array> + <key>IntentsRestrictedWhileProtectedDataUnavailable</key> + <array> + <string>HDLRunSceneIntent</string> + </array> + </dict> + <key>NSExtensionMainStoryboard</key> + <string>MainInterface</string> + <key>NSExtensionPointIdentifier</key> + <string>com.apple.intents-ui-service</string> + </dict> +</dict> +</plist> diff --git a/SiriIntentsUI/IntentViewController.cs b/SiriIntentsUI/IntentViewController.cs new file mode 100644 index 0000000..18864b6 --- /dev/null +++ b/SiriIntentsUI/IntentViewController.cs @@ -0,0 +1,105 @@ +锘縰sing System; + +using CoreGraphics; +using Foundation; +using HDLSceneSiri; +//using HDLSceneSiri; +using Intents; +using IntentsUI; +using UIKit; + +namespace SiriIntentsUI +{ + public partial class IntentViewController : UIViewController, IINUIHostedViewControlling + { + protected IntentViewController(IntPtr handle) : base(handle) + { + } + + //public override void ViewDidLoad() + //{ + // base.ViewDidLoad(); + + // // Do any required interface here. + //} + + //public override void DidReceiveMemoryWarning() + //{ + // // Releases the view if it doesn't have a superview. + // base.DidReceiveMemoryWarning(); + + // // Release any cached data, images, etc that aren't in use. + //} + [Export("configureWithInteraction:context:completion:")] + public void Configure(INInteraction interaction, INUIHostedViewContext context, Action<CGSize> completion) + { + throw new NotImplementedException(); + } + + CGSize DesiredSize() + { + return ExtensionContext.GetHostedViewMaximumAllowedSize(); + } + + + + + [Export("configureViewForParameters:ofInteraction:interactiveBehavior:context:completion:")] + public void ConfigureView( + NSSet<INParameter> parameters, + INInteraction interaction, + INUIInteractiveBehavior interactiveBehavior, + INUIHostedViewContext context, + INUIHostedViewControllingConfigureViewHandler completion) + { + + + + + 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, 100); + CGSize size = new CGSize(DesiredSize().Width, 100); + + + if (completion != null) + completion(true, parameters, size); + + + //var intent = interaction.Intent as OrderSoupIntent; + //if (intent is null) + //{ + // completion(false, new NSSet<INParameter>(), CGSize.Empty); + //} + + //var order = Order.FromOrderSoupIntent(intent); + + //foreach (var view in View.Subviews) + //{ + // view.RemoveFromSuperview(); + //} + + //// Different UIs can be displayed depending if the intent is in the + //// confirmation phase or the handle phase. + //var desiredSize = CGSize.Empty; + + //if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Ready) + //{ + // desiredSize = DisplayInvoice(order, intent); + //} + //else if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) + //{ + // var response = interaction.IntentResponse as OrderSoupIntentResponse; + // if (!(response is null)) + // { + // desiredSize = DisplayOrderConfirmation(order, intent, response); + // } + //} + + //completion(true, parameters, desiredSize); + } + + + } +} diff --git a/SiriIntentsUI/IntentViewController.designer.cs b/SiriIntentsUI/IntentViewController.designer.cs new file mode 100644 index 0000000..de743aa --- /dev/null +++ b/SiriIntentsUI/IntentViewController.designer.cs @@ -0,0 +1,27 @@ +// WARNING +// +// This file has been generated automatically by Visual Studio to store outlets and +// actions made in the UI designer. If it is removed, they will be lost. +// Manual changes to this file may not be handled correctly. +// +using Foundation; +using System.CodeDom.Compiler; + +namespace SiriIntentsUI +{ + [Register ("IntentViewController")] + partial class IntentViewController + { + [Outlet] + [GeneratedCode("iOS Designer", "1.0")] + UIKit.UILabel lblMsg { get; set; } + + void ReleaseDesignerOutlets () + { + if (lblMsg != null) { + lblMsg.Dispose (); + lblMsg = null; + } + } + } +} diff --git a/SiriIntentsUI/MainInterface.storyboard b/SiriIntentsUI/MainInterface.storyboard new file mode 100644 index 0000000..5fc4be2 --- /dev/null +++ b/SiriIntentsUI/MainInterface.storyboard @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="ObA-dk-sSI"> + <device id="retina6_1" orientation="portrait" appearance="light"/> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--Intent View Controller--> + <scene sceneID="7MM-of-jgj"> + <objects> + <viewController id="ObA-dk-sSI" customClass="IntentViewController" sceneMemberID="viewController"> + <layoutGuides> + <viewControllerLayoutGuide type="top" id="qkL-Od-lgU"/> + <viewControllerLayoutGuide type="bottom" id="n38-gi-rB5"/> + </layoutGuides> + <view key="view" contentMode="scaleToFill" id="zMn-AG-sqS"> + <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="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"/> + </label> + </subviews> + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <constraints> + <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="lblMsg" destination="IGu-QP-NsY" id="gfv-7M-crM"/> + </connections> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="20" y="80"/> + </scene> + </scenes> +</document> diff --git a/SiriIntentsUI/SiriIntentsUI.csproj b/SiriIntentsUI/SiriIntentsUI.csproj new file mode 100644 index 0000000..cbbf67a --- /dev/null +++ b/SiriIntentsUI/SiriIntentsUI.csproj @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform> + <ProjectGuid>{ACC48A7F-250B-4915-A250-9BC399DBD6B3}</ProjectGuid> + <ProjectTypeGuids>{EE2C853D-36AF-4FDB-B1AD-8E90477E2198};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <OutputType>Library</OutputType> + <RootNamespace>SiriIntentsUI</RootNamespace> + <AssemblyName>SiriIntentsUI</AssemblyName> + <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\iPhoneSimulator\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <MtouchDebug>true</MtouchDebug> + <MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> + <MtouchFastDev>true</MtouchFastDev> + <IOSDebuggerPort>51713</IOSDebuggerPort> + <MtouchLink>None</MtouchLink> + <MtouchArch>x86_64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <DeviceSpecificBuild>false</DeviceSpecificBuild> + <MtouchVerbosity></MtouchVerbosity> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\iPhone\Release</OutputPath> + <DefineConstants></DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <MtouchUseLlvm>true</MtouchUseLlvm> + <MtouchFloat32>true</MtouchFloat32> + <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> + <MtouchLink>SdkOnly</MtouchLink> + <MtouchArch>ARM64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <MtouchVerbosity></MtouchVerbosity> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\iPhoneSimulator\Release</OutputPath> + <DefineConstants></DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> + <MtouchLink>None</MtouchLink> + <MtouchArch>x86_64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <MtouchVerbosity></MtouchVerbosity> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\iPhone\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <DeviceSpecificBuild>true</DeviceSpecificBuild> + <MtouchDebug>true</MtouchDebug> + <MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> + <MtouchFastDev>true</MtouchFastDev> + <MtouchFloat32>true</MtouchFloat32> + <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> + <IOSDebuggerPort>50971</IOSDebuggerPort> + <MtouchLink>SdkOnly</MtouchLink> + <MtouchArch>ARM64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <MtouchVerbosity></MtouchVerbosity> + <CodesignProvision>OnProSiriUI211125-1-Dev</CodesignProvision> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </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> + </ItemGroup> + <ItemGroup> + <Folder Include="Resources\" /> + </ItemGroup> + <ItemGroup> + <None Include="Info.plist" /> + <None Include="Entitlements.plist" /> + </ItemGroup> + <ItemGroup> + <InterfaceDefinition Include="MainInterface.storyboard" /> + </ItemGroup> + <ItemGroup> + <Compile Include="IntentViewController.cs" /> + <Compile Include="IntentViewController.designer.cs"> + <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/Base.lproj/Intents.intentdefinition b/SiriKit/Base.lproj/Intents.intentdefinition new file mode 100644 index 0000000..fbbcd16 --- /dev/null +++ b/SiriKit/Base.lproj/Intents.intentdefinition @@ -0,0 +1,265 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>INEnums</key> + <array/> + <key>INIntentDefinitionModelVersion</key> + <string>1.2</string> + <key>INIntentDefinitionNamespace</key> + <string>8yVV3C</string> + <key>INIntentDefinitionSystemVersion</key> + <string>20G165</string> + <key>INIntentDefinitionToolsBuildVersion</key> + <string>13A233</string> + <key>INIntentDefinitionToolsVersion</key> + <string>13.0</string> + <key>INIntents</key> + <array> + <dict> + <key>INIntentCategory</key> + <string>generic</string> + <key>INIntentDescription</key> + <string>Run Scene</string> + <key>INIntentDescriptionID</key> + <string>Pe02nj</string> + <key>INIntentLastParameterTag</key> + <integer>22</integer> + <key>INIntentName</key> + <string>HDLRunScene</string> + <key>INIntentParameterCombinations</key> + <dict> + <key>controlName,controlId,controlType,controlJSONStr,actionName,homeId</key> + <dict> + <key>INIntentParameterCombinationIsPrimary</key> + <true/> + <key>INIntentParameterCombinationSupportsBackgroundExecution</key> + <true/> + <key>INIntentParameterCombinationTitle</key> + <string>${actionName}鈥�${controlName}鈥�</string> + <key>INIntentParameterCombinationTitleID</key> + <string>3GPMaH</string> + </dict> + </dict> + <key>INIntentParameters</key> + <array> + <dict> + <key>INIntentParameterDisplayName</key> + <string>Control Name</string> + <key>INIntentParameterDisplayNameID</key> + <string>wC0SgK</string> + <key>INIntentParameterDisplayPriority</key> + <integer>1</integer> + <key>INIntentParameterMetadata</key> + <dict> + <key>INIntentParameterMetadataCapitalization</key> + <string>Sentences</string> + <key>INIntentParameterMetadataDefaultValueID</key> + <string>xz2KkJ</string> + </dict> + <key>INIntentParameterName</key> + <string>controlName</string> + <key>INIntentParameterTag</key> + <integer>1</integer> + <key>INIntentParameterType</key> + <string>String</string> + </dict> + <dict> + <key>INIntentParameterDisplayName</key> + <string>Control Id</string> + <key>INIntentParameterDisplayNameID</key> + <string>MtgGtd</string> + <key>INIntentParameterDisplayPriority</key> + <integer>2</integer> + <key>INIntentParameterMetadata</key> + <dict> + <key>INIntentParameterMetadataCapitalization</key> + <string>Sentences</string> + <key>INIntentParameterMetadataDefaultValueID</key> + <string>hQHCm1</string> + </dict> + <key>INIntentParameterName</key> + <string>controlId</string> + <key>INIntentParameterTag</key> + <integer>2</integer> + <key>INIntentParameterType</key> + <string>String</string> + </dict> + <dict> + <key>INIntentParameterDisplayName</key> + <string>Home Id</string> + <key>INIntentParameterDisplayNameID</key> + <string>Re9KKp</string> + <key>INIntentParameterDisplayPriority</key> + <integer>3</integer> + <key>INIntentParameterMetadata</key> + <dict> + <key>INIntentParameterMetadataCapitalization</key> + <string>Sentences</string> + <key>INIntentParameterMetadataDefaultValueID</key> + <string>mQMSns</string> + </dict> + <key>INIntentParameterName</key> + <string>homeId</string> + <key>INIntentParameterTag</key> + <integer>12</integer> + <key>INIntentParameterType</key> + <string>String</string> + </dict> + <dict> + <key>INIntentParameterDisplayName</key> + <string>Control Type</string> + <key>INIntentParameterDisplayNameID</key> + <string>TBoK4E</string> + <key>INIntentParameterDisplayPriority</key> + <integer>4</integer> + <key>INIntentParameterMetadata</key> + <dict> + <key>INIntentParameterMetadataCapitalization</key> + <string>Sentences</string> + <key>INIntentParameterMetadataDefaultValueID</key> + <string>Yg2EJK</string> + </dict> + <key>INIntentParameterName</key> + <string>controlType</string> + <key>INIntentParameterTag</key> + <integer>14</integer> + <key>INIntentParameterType</key> + <string>String</string> + </dict> + <dict> + <key>INIntentParameterDisplayName</key> + <string>Control JSON Str</string> + <key>INIntentParameterDisplayNameID</key> + <string>WYEDs9</string> + <key>INIntentParameterDisplayPriority</key> + <integer>5</integer> + <key>INIntentParameterMetadata</key> + <dict> + <key>INIntentParameterMetadataCapitalization</key> + <string>Sentences</string> + <key>INIntentParameterMetadataDefaultValueID</key> + <string>WXdhpn</string> + </dict> + <key>INIntentParameterName</key> + <string>controlJSONStr</string> + <key>INIntentParameterTag</key> + <integer>21</integer> + <key>INIntentParameterType</key> + <string>String</string> + </dict> + <dict> + <key>INIntentParameterDisplayName</key> + <string>Action Name</string> + <key>INIntentParameterDisplayNameID</key> + <string>sB0JdL</string> + <key>INIntentParameterDisplayPriority</key> + <integer>6</integer> + <key>INIntentParameterMetadata</key> + <dict> + <key>INIntentParameterMetadataCapitalization</key> + <string>Sentences</string> + <key>INIntentParameterMetadataDefaultValueID</key> + <string>nGpmbm</string> + </dict> + <key>INIntentParameterName</key> + <string>actionName</string> + <key>INIntentParameterTag</key> + <integer>22</integer> + <key>INIntentParameterType</key> + <string>String</string> + </dict> + </array> + <key>INIntentResponse</key> + <dict> + <key>INIntentResponseCodes</key> + <array> + <dict> + <key>INIntentResponseCodeFormatString</key> + <string>${controlName}</string> + <key>INIntentResponseCodeFormatStringID</key> + <string>Pq8YBC</string> + <key>INIntentResponseCodeName</key> + <string>success</string> + <key>INIntentResponseCodeSuccess</key> + <true/> + </dict> + <dict> + <key>INIntentResponseCodeFormatString</key> + <string>${errorMessage}</string> + <key>INIntentResponseCodeFormatStringID</key> + <string>CX5DVI</string> + <key>INIntentResponseCodeName</key> + <string>failure</string> + </dict> + <dict> + <key>INIntentResponseCodeName</key> + <string>error</string> + <key>INIntentResponseCodeSuccess</key> + <true/> + </dict> + </array> + <key>INIntentResponseLastParameterTag</key> + <integer>3</integer> + <key>INIntentResponseParameters</key> + <array> + <dict> + <key>INIntentResponseParameterDisplayName</key> + <string>Error Message</string> + <key>INIntentResponseParameterDisplayNameID</key> + <string>HxQb2M</string> + <key>INIntentResponseParameterDisplayPriority</key> + <integer>1</integer> + <key>INIntentResponseParameterName</key> + <string>errorMessage</string> + <key>INIntentResponseParameterTag</key> + <integer>1</integer> + <key>INIntentResponseParameterType</key> + <string>String</string> + </dict> + <dict> + <key>INIntentResponseParameterDisplayName</key> + <string>Success Message</string> + <key>INIntentResponseParameterDisplayNameID</key> + <string>BaAbSP</string> + <key>INIntentResponseParameterDisplayPriority</key> + <integer>2</integer> + <key>INIntentResponseParameterName</key> + <string>successMessage</string> + <key>INIntentResponseParameterTag</key> + <integer>2</integer> + <key>INIntentResponseParameterType</key> + <string>String</string> + </dict> + <dict> + <key>INIntentResponseParameterDisplayName</key> + <string>Control Name</string> + <key>INIntentResponseParameterDisplayNameID</key> + <string>pqg7cb</string> + <key>INIntentResponseParameterDisplayPriority</key> + <integer>3</integer> + <key>INIntentResponseParameterName</key> + <string>controlName</string> + <key>INIntentResponseParameterTag</key> + <integer>3</integer> + <key>INIntentResponseParameterType</key> + <string>String</string> + </dict> + </array> + </dict> + <key>INIntentRestrictions</key> + <integer>1</integer> + <key>INIntentTitle</key> + <string>Run Scene</string> + <key>INIntentTitleID</key> + <string>j3jRXP</string> + <key>INIntentType</key> + <string>Custom</string> + <key>INIntentVerb</key> + <string>Do</string> + </dict> + </array> + <key>INTypes</key> + <array/> +</dict> +</plist> diff --git a/SiriKit/Data/DataManager.cs b/SiriKit/Data/DataManager.cs new file mode 100644 index 0000000..0687121 --- /dev/null +++ b/SiriKit/Data/DataManager.cs @@ -0,0 +1,188 @@ +锘�///* +//See LICENSE folder for this sample鈥檚 licensing information. + +//Abstract: +//A data manager that manages data conforming to `Codable` and stores it in `UserDefaults`. +//*/ + +//using System; +//using Foundation; +//using CoreFoundation; + +//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 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"); + +// // 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; + +// // The observer object handed back after registering to observe a +// // property. +// IDisposable UserDefaultsObserver; + +// // 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"); + +// // 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(); +// } + +// // 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; +// } + +// // 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); +// } + +// 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}"); +// } +// } +// }); +// } + +// // 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 new file mode 100644 index 0000000..4526cf8 --- /dev/null +++ b/SiriKit/Data/NSUserDefaultsHelper.cs @@ -0,0 +1,40 @@ +锘縰sing System; +using Foundation; +namespace SiriKit +{ + public static class NSUserDefaultsHelper + { + private const string AppGroup = "group.com.hdl.onpro"; + + + + public static class StorageKeys + { + + public const string APP_KEY = "HDL-HOME-APP-TEST"; + public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; + + + public const string GLOBAL_GIsLogin = "IsLogin"; + + public const string GLOBAL_GAccessToken = "AccessToken"; + + public const string GLOBAL_GRefreshToken = "RefreshToken"; + + public const string GLOBAL_GRegionUrl = "RegionUrl"; + + public const string GLOBAL_GHomeId = "HomeId"; + } + + public static NSUserDefaults DataSuite { + get { + var dataSuite = new NSUserDefaults(AppGroup, NSUserDefaultsType.SuiteName); + if( dataSuite is null ) + { + throw new Exception($"Could not load UserDefaults for app group {AppGroup}"); + } + return dataSuite; + } + } + } +} diff --git a/SiriKit/Data/SceneDateManager.cs b/SiriKit/Data/SceneDateManager.cs new file mode 100644 index 0000000..9ff58b3 --- /dev/null +++ b/SiriKit/Data/SceneDateManager.cs @@ -0,0 +1,104 @@ +锘縰sing Foundation; +using Intents; +using System; +using System.Linq; + +namespace SiriKit +{ + public class SceneDateManager //: DataManager<NSMutableArray<HDLSceneSiri.HDLSiriSceneModel>> + { + 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<HDLSceneSiri.HDLSiriSceneModel> OrderHistory + //{ + // get + // { + // return ManagedData as NSMutableArray<HDLSceneSiri.HDLSiriSceneModel>; + // } + //} + + //#endregion + + //#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 + { + get + { + var d = UserDefaults.BoolForKey(NSUserDefaultsHelper.StorageKeys.GLOBAL_GIsLogin); + return d; + } + set + { + UserDefaults.SetBool(value, NSUserDefaultsHelper.StorageKeys.GLOBAL_GIsLogin); + } + } + + + public string AccessToken + { + get + { + var d = UserDefaults.StringForKey(NSUserDefaultsHelper.StorageKeys.GLOBAL_GAccessToken); + return d; + } + set + { + UserDefaults.SetString(value, NSUserDefaultsHelper.StorageKeys.GLOBAL_GAccessToken); + + } + } + + public string RefreshToken + { + get + { + var d = UserDefaults.StringForKey(NSUserDefaultsHelper.StorageKeys.GLOBAL_GRefreshToken); + return d; + } + set + { + UserDefaults.SetString(value, NSUserDefaultsHelper.StorageKeys.GLOBAL_GRefreshToken); + } + } + + + public string RegionUrl + { + get + { + var d = UserDefaults.StringForKey(NSUserDefaultsHelper.StorageKeys.GLOBAL_GRegionUrl); + return d; + } + set + { + UserDefaults.SetString(value, NSUserDefaultsHelper.StorageKeys.GLOBAL_GRegionUrl); + } + } + + public string HomeId + { + get + { + var d = UserDefaults.StringForKey(NSUserDefaultsHelper.StorageKeys.GLOBAL_GHomeId); + return d; + } + set + { + UserDefaults.SetString(value, NSUserDefaultsHelper.StorageKeys.GLOBAL_GHomeId); + } + } + } +} diff --git a/SiriKit/Properties/AssemblyInfo.cs b/SiriKit/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a273fa2 --- /dev/null +++ b/SiriKit/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +锘縰sing System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SiriKit")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SiriKit")] +[assembly: AssemblyCopyright("Copyright 漏 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("50c7b8c9-e664-45af-b88e-0c9b8b9c1be1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SiriKit/SiriKit.csproj b/SiriKit/SiriKit.csproj new file mode 100644 index 0000000..553c44e --- /dev/null +++ b/SiriKit/SiriKit.csproj @@ -0,0 +1,60 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{8B1652FA-5158-4D57-B90D-07BB91766625}</ProjectGuid> + <ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <TemplateGuid>{a52b8a63-bc84-4b47-910d-692533484892}</TemplateGuid> + <OutputType>Library</OutputType> + <RootNamespace>SiriKit</RootNamespace> + <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> + <AssemblyName>SiriKit</AssemblyName> + <RestoreProjectStyle>PackageReference</RestoreProjectStyle> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>portable</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>portable</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </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> + </ItemGroup> + <ItemGroup> + <Folder Include="Resources\" /> + <Folder Include="Data\" /> + <Folder Include="Support\" /> + <Folder Include="Base.lproj\" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Data\DataManager.cs" /> + <Compile Include="Data\SceneDateManager.cs" /> + <Compile Include="Data\NSUserDefaultsHelper.cs" /> + </ItemGroup> + <ItemGroup> + <Content Include="Base.lproj\Intents.intentdefinition" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> +</Project> \ No newline at end of file diff --git a/ThirdPartyIntegration/siri/libOnProSiriIntents.a b/ThirdPartyIntegration/siri/libOnProSiriIntents.a new file mode 100644 index 0000000..ac2add9 --- /dev/null +++ b/ThirdPartyIntegration/siri/libOnProSiriIntents.a Binary files differ -- Gitblit v1.8.0