From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期二, 30 八月 2022 09:37:38 +0800 Subject: [PATCH] 合并了IOS的代码 --- ZigbeeApp/AndroidBluetooth/AndroidBluetooth.csproj | 67 +++++++++++++ ZigbeeApp/AndroidBluetooth/Transforms/Metadata.xml | 9 + ZigbeeApp/AndroidBluetooth/Jars/BluetoothLibrary.aar | 0 ZigbeeApp/AndroidBluetooth/Transforms/EnumMethods.xml | 13 ++ ZigbeeApp/AndroidBluetooth/Transforms/EnumFields.xml | 14 ++ ZigbeeApp/GateWay.sln | 14 ++ ZigbeeApp/AndroidBluetooth/Jars/AboutJars.txt | 24 ++++ ZigbeeApp/AndroidBluetooth/Properties/AssemblyInfo.cs | 26 +++++ ZigbeeApp/GateWay.Droid/packages.config | 2 ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj | 27 ++--- ZigbeeApp/AndroidBluetooth/Additions/AboutAdditions.txt | 48 +++++++++ 11 files changed, 227 insertions(+), 17 deletions(-) diff --git a/ZigbeeApp/AndroidBluetooth/Additions/AboutAdditions.txt b/ZigbeeApp/AndroidBluetooth/Additions/AboutAdditions.txt new file mode 100644 index 0000000..89cbfbb --- /dev/null +++ b/ZigbeeApp/AndroidBluetooth/Additions/AboutAdditions.txt @@ -0,0 +1,48 @@ +锘緼dditions allow you to add arbitrary C# to the generated classes +before they are compiled. This can be helpful for providing convenience +methods or adding pure C# classes. + +== Adding Methods to Generated Classes == + +Let's say the library being bound has a Rectangle class with a constructor +that takes an x and y position, and a width and length size. It will look like +this: + +public partial class Rectangle +{ + public Rectangle (int x, int y, int width, int height) + { + // JNI bindings + } +} + +Imagine we want to add a constructor to this class that takes a Point and +Size structure instead of 4 ints. We can add a new file called Rectangle.cs +with a partial class containing our new method: + +public partial class Rectangle +{ + public Rectangle (Point location, Size size) : + this (location.X, location.Y, size.Width, size.Height) + { + } +} + +At compile time, the additions class will be added to the generated class +and the final assembly will a Rectangle class with both constructors. + + +== Adding C# Classes == + +Another thing that can be done is adding fully C# managed classes to the +generated library. In the above example, let's assume that there isn't a +Point class available in Java or our library. The one we create doesn't need +to interact with Java, so we'll create it like a normal class in C#. + +By adding a Point.cs file with this class, it will end up in the binding library: + +public class Point +{ + public int X { get; set; } + public int Y { get; set; } +} diff --git a/ZigbeeApp/AndroidBluetooth/AndroidBluetooth.csproj b/ZigbeeApp/AndroidBluetooth/AndroidBluetooth.csproj new file mode 100644 index 0000000..3a65ea7 --- /dev/null +++ b/ZigbeeApp/AndroidBluetooth/AndroidBluetooth.csproj @@ -0,0 +1,67 @@ +锘�<?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>{ECD67F44-FA96-415A-8BC0-27B14A88C68A}</ProjectGuid> + <ProjectTypeGuids>{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <TemplateGuid>{77efb91c-a7e9-4b0e-a7c5-31eeec3c6d46}</TemplateGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>AndroidBluetooth</RootNamespace> + <AssemblyName>AndroidBluetooth</AssemblyName> + <FileAlignment>512</FileAlignment> + <Deterministic>True</Deterministic> + <TargetFrameworkVersion>v8.0</TargetFrameworkVersion> + <AndroidClassParser>class-parse</AndroidClassParser> + <AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget> + <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;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>portable</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Mono.Android" /> + <Reference Include="System" /> + <Reference Include="System.Core" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="Jars\AboutJars.txt" /> + <None Include="Additions\AboutAdditions.txt" /> + </ItemGroup> + <ItemGroup> + <TransformFile Include="Transforms\Metadata.xml" /> + <TransformFile Include="Transforms\EnumFields.xml" /> + <TransformFile Include="Transforms\EnumMethods.xml" /> + </ItemGroup> + <ItemGroup> + <LibraryProjectZip Include="Jars\BluetoothLibrary.aar" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/ZigbeeApp/AndroidBluetooth/Jars/AboutJars.txt b/ZigbeeApp/AndroidBluetooth/Jars/AboutJars.txt new file mode 100644 index 0000000..404cfd9 --- /dev/null +++ b/ZigbeeApp/AndroidBluetooth/Jars/AboutJars.txt @@ -0,0 +1,24 @@ +锘縏his directory is for Android .jars. + +There are 2 types of jars that are supported: + +== Input Jar == + +This is the jar that bindings should be generated for. + +For example, if you were binding the Google Maps library, this would +be Google's "maps.jar". + +Set the build action for these jars in the properties page to "InputJar". + + +== Reference Jars == + +These are jars that are referenced by the input jar. C# bindings will +not be created for these jars. These jars will be used to resolve +types used by the input jar. + +NOTE: Do not add "android.jar" as a reference jar. It will be added automatically +based on the Target Framework selected. + +Set the build action for these jars in the properties page to "ReferenceJar". diff --git a/ZigbeeApp/AndroidBluetooth/Jars/BluetoothLibrary.aar b/ZigbeeApp/AndroidBluetooth/Jars/BluetoothLibrary.aar new file mode 100644 index 0000000..3176604 --- /dev/null +++ b/ZigbeeApp/AndroidBluetooth/Jars/BluetoothLibrary.aar Binary files differ diff --git a/ZigbeeApp/AndroidBluetooth/Properties/AssemblyInfo.cs b/ZigbeeApp/AndroidBluetooth/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d544fd5 --- /dev/null +++ b/ZigbeeApp/AndroidBluetooth/Properties/AssemblyInfo.cs @@ -0,0 +1,26 @@ +锘縰sing System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Android.App; + +// 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("AndroidBluetooth")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AndroidBluetooth")] +[assembly: AssemblyCopyright("Copyright 漏 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ZigbeeApp/AndroidBluetooth/Transforms/EnumFields.xml b/ZigbeeApp/AndroidBluetooth/Transforms/EnumFields.xml new file mode 100644 index 0000000..f31a96e --- /dev/null +++ b/ZigbeeApp/AndroidBluetooth/Transforms/EnumFields.xml @@ -0,0 +1,14 @@ +锘�<enum-field-mappings> + <!-- + This example converts the constants Fragment_id, Fragment_name, + and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag + to an enum called Android.Support.V4.App.FragmentTagType with values + Id, Name, and Tag. + + <mapping jni-class="android/support/v4/app/FragmentActivity$FragmentTag" clr-enum-type="Android.Support.V4.App.FragmentTagType"> + <field jni-name="Fragment_name" clr-name="Name" value="0" /> + <field jni-name="Fragment_id" clr-name="Id" value="1" /> + <field jni-name="Fragment_tag" clr-name="Tag" value="2" /> + </mapping> + --> +</enum-field-mappings> diff --git a/ZigbeeApp/AndroidBluetooth/Transforms/EnumMethods.xml b/ZigbeeApp/AndroidBluetooth/Transforms/EnumMethods.xml new file mode 100644 index 0000000..f2bca37 --- /dev/null +++ b/ZigbeeApp/AndroidBluetooth/Transforms/EnumMethods.xml @@ -0,0 +1,13 @@ +锘�<enum-method-mappings> + <!-- + This example changes the Java method: + android.support.v4.app.Fragment.SavedState.writeToParcel (int flags) + to be: + android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags) + when bound in C#. + + <mapping jni-class="android/support/v4/app/Fragment.SavedState"> + <method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" /> + </mapping> + --> +</enum-method-mappings> diff --git a/ZigbeeApp/AndroidBluetooth/Transforms/Metadata.xml b/ZigbeeApp/AndroidBluetooth/Transforms/Metadata.xml new file mode 100644 index 0000000..91493a2 --- /dev/null +++ b/ZigbeeApp/AndroidBluetooth/Transforms/Metadata.xml @@ -0,0 +1,9 @@ +锘�<metadata> + <!-- + This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask: + <remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" /> + + This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground: + <remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" /> + --> +</metadata> diff --git a/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj b/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj index 76bbdda..cb88ecb 100644 --- a/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj +++ b/ZigbeeApp/GateWay.Droid/GateWay.Droid.csproj @@ -68,15 +68,6 @@ <AndroidSigningKeyStore>/Users/liaoshaosheng/Desktop/璇佷功/Evoyo Home.keystore</AndroidSigningKeyStore> </PropertyGroup> <ItemGroup> - <Reference Include="LeakCanary, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> - <HintPath>..\packages\LeakCanaryBinding.1.5.1.1\lib\MonoAndroid10\LeakCanary.dll</HintPath> - </Reference> - <Reference Include="LeakCanary.Analyzer, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> - <HintPath>..\packages\LeakCanaryBinding.1.5.1.1\lib\MonoAndroid10\LeakCanary.Analyzer.dll</HintPath> - </Reference> - <Reference Include="LeakCanary.Watcher, Version=1.5.1.0, Culture=neutral, processorArchitecture=MSIL"> - <HintPath>..\packages\LeakCanaryBinding.1.5.1.1\lib\MonoAndroid10\LeakCanary.Watcher.dll</HintPath> - </Reference> <Reference Include="Shared.Droid"> <HintPath>..\Shared\DLL\Android\Shared.Droid.dll</HintPath> </Reference> @@ -150,10 +141,7 @@ <HintPath>..\Shared\DLL\Android\Xamarin.Android.Support.Vector.Drawable.dll</HintPath> </Reference> <Reference Include="BouncyCastle.Crypto"> - <HintPath>..\packages\BouncyCastle.1.8.9\lib\BouncyCastle.Crypto.dll</HintPath> - </Reference> - <Reference Include="FastAndroidCamera"> - <HintPath>..\packages\FastAndroidCamera.2.0.0\lib\MonoAndroid403\FastAndroidCamera.dll</HintPath> + <HintPath>..\packages\BouncyCastle.1.8.1\lib\BouncyCastle.Crypto.dll</HintPath> </Reference> <Reference Include="Microsoft.AppCenter.Android.Bindings"> <HintPath>..\packages\Microsoft.AppCenter.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.Android.Bindings.dll</HintPath> @@ -173,6 +161,12 @@ <Reference Include="Microsoft.AppCenter.Analytics"> <HintPath>..\packages\Microsoft.AppCenter.Analytics.1.14.0\lib\MonoAndroid403\Microsoft.AppCenter.Analytics.dll</HintPath> </Reference> + <Reference Include="MQTTnet"> + <HintPath>..\packages\MQTTnet.3.0.8\lib\netstandard2.0\MQTTnet.dll</HintPath> + </Reference> + <Reference Include="FastAndroidCamera"> + <HintPath>..\packages\FastAndroidCamera.2.0.0\lib\MonoAndroid403\FastAndroidCamera.dll</HintPath> + </Reference> <Reference Include="ZXing.Net.Mobile.Core"> <HintPath>..\packages\ZXing.Net.Mobile.2.4.1\lib\MonoAndroid71\ZXing.Net.Mobile.Core.dll</HintPath> </Reference> @@ -181,9 +175,6 @@ </Reference> <Reference Include="ZXingNetMobile"> <HintPath>..\packages\ZXing.Net.Mobile.2.4.1\lib\MonoAndroid71\ZXingNetMobile.dll</HintPath> - </Reference> - <Reference Include="MQTTnet"> - <HintPath>..\packages\MQTTnet.3.0.8\lib\netstandard2.0\MQTTnet.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> @@ -2708,6 +2699,10 @@ <Project>{06B9C874-B9B2-4417-8280-B321F966E46B}</Project> <Name>Shared.Droid.JPush</Name> </ProjectReference> + <ProjectReference Include="..\AndroidBluetooth\AndroidBluetooth.csproj"> + <Project>{ECD67F44-FA96-415A-8BC0-27B14A88C68A}</Project> + <Name>AndroidBluetooth</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <Folder Include="JPush\" /> diff --git a/ZigbeeApp/GateWay.Droid/packages.config b/ZigbeeApp/GateWay.Droid/packages.config index 3c1da58..5b8d039 100644 --- a/ZigbeeApp/GateWay.Droid/packages.config +++ b/ZigbeeApp/GateWay.Droid/packages.config @@ -1,6 +1,6 @@ 锘�<?xml version="1.0" encoding="utf-8"?> <packages> - <package id="BouncyCastle" version="1.8.9" targetFramework="monoandroid80" /> + <package id="BouncyCastle" version="1.8.1" targetFramework="monoandroid80" /> <package id="FastAndroidCamera" version="2.0.0" targetFramework="monoandroid80" /> <package id="LeakCanaryBinding" version="1.5.1.1" targetFramework="monoandroid80" /> <package id="Microsoft.AppCenter" version="1.14.0" targetFramework="monoandroid80" /> diff --git a/ZigbeeApp/GateWay.sln b/ZigbeeApp/GateWay.sln index 153b144..a32f7d6 100644 --- a/ZigbeeApp/GateWay.sln +++ b/ZigbeeApp/GateWay.sln @@ -18,6 +18,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Home.IOS", "Home.Ios\Home.IOS.csproj", "{F1296E2C-3777-4385-85B2-DA77617E3178}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AndroidBluetooth", "AndroidBluetooth\AndroidBluetooth.csproj", "{ECD67F44-FA96-415A-8BC0-27B14A88C68A}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution Shared\Shared.projitems*{28ede1ff-20ef-476b-8af8-24a3eeb69f45}*SharedItemsImports = 4 @@ -116,6 +118,18 @@ {F1296E2C-3777-4385-85B2-DA77617E3178}.Release|iPhone.Build.0 = Release|iPhone {F1296E2C-3777-4385-85B2-DA77617E3178}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {F1296E2C-3777-4385-85B2-DA77617E3178}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {ECD67F44-FA96-415A-8BC0-27B14A88C68A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECD67F44-FA96-415A-8BC0-27B14A88C68A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECD67F44-FA96-415A-8BC0-27B14A88C68A}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {ECD67F44-FA96-415A-8BC0-27B14A88C68A}.Debug|iPhone.Build.0 = Debug|Any CPU + {ECD67F44-FA96-415A-8BC0-27B14A88C68A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {ECD67F44-FA96-415A-8BC0-27B14A88C68A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {ECD67F44-FA96-415A-8BC0-27B14A88C68A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECD67F44-FA96-415A-8BC0-27B14A88C68A}.Release|Any CPU.Build.0 = Release|Any CPU + {ECD67F44-FA96-415A-8BC0-27B14A88C68A}.Release|iPhone.ActiveCfg = Release|Any CPU + {ECD67F44-FA96-415A-8BC0-27B14A88C68A}.Release|iPhone.Build.0 = Release|Any CPU + {ECD67F44-FA96-415A-8BC0-27B14A88C68A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {ECD67F44-FA96-415A-8BC0-27B14A88C68A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE -- Gitblit v1.8.0