diff options
author | Justin Berger <j.david.berger@gmail.com> | 2018-03-28 16:34:33 -0600 |
---|---|---|
committer | Justin Berger <j.david.berger@gmail.com> | 2018-03-28 16:37:49 -0600 |
commit | 70596acbbe766045c95f64a65b411d4cd7584918 (patch) | |
tree | 307358305c58c9c6f12ef46ec773bd85e2301da6 | |
parent | 595ba8b255f6f4fd9ebc1c9dbff33577c13115f9 (diff) | |
download | libsurvive-70596acbbe766045c95f64a65b411d4cd7584918.tar.gz libsurvive-70596acbbe766045c95f64a65b411d4cd7584918.tar.bz2 |
Slight refactoring
25 files changed, 27 insertions, 99 deletions
diff --git a/bindings/cs/.gitignore b/bindings/cs/.gitignore new file mode 100644 index 0000000..6d14531 --- /dev/null +++ b/bindings/cs/.gitignore @@ -0,0 +1,3 @@ +*.dll +obj/ +bin/
\ No newline at end of file diff --git a/csharp-binding/LibSurviveBinding.sln b/bindings/cs/LibSurviveBinding.sln index 539470c..539470c 100644 --- a/csharp-binding/LibSurviveBinding.sln +++ b/bindings/cs/LibSurviveBinding.sln diff --git a/csharp-binding/LibSurviveBinding/Binding.cs b/bindings/cs/LibSurviveBinding/Binding.cs index f4f0652..f4f0652 100644 --- a/csharp-binding/LibSurviveBinding/Binding.cs +++ b/bindings/cs/LibSurviveBinding/Binding.cs diff --git a/csharp-binding/LibSurviveBinding/Config_entry.cs b/bindings/cs/LibSurviveBinding/Config_entry.cs index 85a6701..85a6701 100644 --- a/csharp-binding/LibSurviveBinding/Config_entry.cs +++ b/bindings/cs/LibSurviveBinding/Config_entry.cs diff --git a/csharp-binding/LibSurviveBinding/LibSurviveBinding.csproj b/bindings/cs/LibSurviveBinding/LibSurviveBinding.csproj index e3be07c..646c16d 100644 --- a/csharp-binding/LibSurviveBinding/LibSurviveBinding.csproj +++ b/bindings/cs/LibSurviveBinding/LibSurviveBinding.csproj @@ -11,4 +11,8 @@ </None> </ItemGroup> + + <ItemGroup> + <PackageReference Include="Microsoft.NETCore.App" Version="2.0.1" /> + </ItemGroup> </Project> diff --git a/csharp-binding/LibSurviveBinding/LightcapElement.cs b/bindings/cs/LibSurviveBinding/LightcapElement.cs index ca51fb9..ca51fb9 100644 --- a/csharp-binding/LibSurviveBinding/LightcapElement.cs +++ b/bindings/cs/LibSurviveBinding/LightcapElement.cs diff --git a/csharp-binding/LibSurviveBinding/Program.cs b/bindings/cs/LibSurviveBinding/Program.cs index 7ae8e76..b6d0d8f 100644 --- a/csharp-binding/LibSurviveBinding/Program.cs +++ b/bindings/cs/LibSurviveBinding/Program.cs @@ -6,61 +6,52 @@ namespace LibSurVive class Program { [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] - static extern IntPtr survive_init_internal(int argc, char[] args); + static extern IntPtr survive_init_internal(int argc, string[] args); public delegate void raw_pose_func(IntPtr so, byte lighthouse, IntPtr pose); public delegate void lighthouse_pose_func(IntPtr ctx, byte lighthouse, IntPtr lighthouse_pose, IntPtr object_pose); + public delegate void light_process_func( IntPtr so, int sensor_id, int acode, int timeinsweep, + UInt32 timecode, UInt32 length, UInt32 lighthouse); [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] static extern void survive_install_raw_pose_fn(IntPtr ctx, raw_pose_func fbp); [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] static extern void survive_install_lighthouse_pose_fn(IntPtr ctx, lighthouse_pose_func fbp); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + static extern void survive_install_light_fn(IntPtr ctx, light_process_func fbp); [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] static extern int survive_startup(IntPtr ctx); [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] static extern void survive_cal_install(IntPtr ctx); - public static lighthouse_pose_func lighthouse_Pose_Func { get; private set; } - public static raw_pose_func raw_Pose_Func { get; private set; } + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + static extern int survive_poll(IntPtr ctx); static void Main(string[] args) { - IntPtr context = survive_init_internal(0, null); - - lighthouse_Pose_Func = LighthousPos; - survive_install_lighthouse_pose_fn(context, lighthouse_Pose_Func); - raw_Pose_Func = PositionUpdate; - survive_install_raw_pose_fn(context, raw_Pose_Func); - - try - { - int a = survive_startup(context); - //survive_cal_install(context); - } - catch (Exception) - { - - throw; - } - - bool running = true; - + IntPtr context = survive_init_internal(args.Length, args); + survive_install_lighthouse_pose_fn(context, LighthousPos); + survive_install_raw_pose_fn(context, PositionUpdate); + survive_install_light_fn(context, LightUpdate); - Console.WriteLine("Hello World!"); + survive_startup(context); + survive_cal_install(context); - while (running) - { - Console.ReadLine(); - } + while(survive_poll(context) == 0) {} } + + public static void LightUpdate( IntPtr so, int sensor_id, int acode, int timeinsweep, + UInt32 timecode, UInt32 length, UInt32 lighthouse) { + Console.WriteLine(timeinsweep); + } public static void PositionUpdate(IntPtr so, byte lighthouse, IntPtr pose) { - //Console.WriteLine(pose); + Console.WriteLine(pose); } public static void LighthousPos(IntPtr ctx, byte lighthouse, IntPtr lighthouse_pose, IntPtr object_pose) diff --git a/csharp-binding/LibSurviveBinding/SurviveContext.cs b/bindings/cs/LibSurviveBinding/SurviveContext.cs index 2ba9b7c..2ba9b7c 100644 --- a/csharp-binding/LibSurviveBinding/SurviveContext.cs +++ b/bindings/cs/LibSurviveBinding/SurviveContext.cs diff --git a/csharp-binding/LibSurviveBinding/SurviveObject.cs b/bindings/cs/LibSurviveBinding/SurviveObject.cs index bb9e3cd..bb9e3cd 100644 --- a/csharp-binding/LibSurviveBinding/SurviveObject.cs +++ b/bindings/cs/LibSurviveBinding/SurviveObject.cs diff --git a/csharp-binding/LibSurviveBinding/SurvivePose.cs b/bindings/cs/LibSurviveBinding/SurvivePose.cs index 9808d89..9808d89 100644 --- a/csharp-binding/LibSurviveBinding/SurvivePose.cs +++ b/bindings/cs/LibSurviveBinding/SurvivePose.cs diff --git a/csharp-binding/LibSurviveBinding/config_group.cs b/bindings/cs/LibSurviveBinding/config_group.cs index 8a2f00e..8a2f00e 100644 --- a/csharp-binding/LibSurviveBinding/config_group.cs +++ b/bindings/cs/LibSurviveBinding/config_group.cs diff --git a/csharp-binding/LibSurviveBinding/bin/Debug/netcoreapp2.0/LibSurviveBinding.dll b/csharp-binding/LibSurviveBinding/bin/Debug/netcoreapp2.0/LibSurviveBinding.dll Binary files differdeleted file mode 100644 index 08f1a10..0000000 --- a/csharp-binding/LibSurviveBinding/bin/Debug/netcoreapp2.0/LibSurviveBinding.dll +++ /dev/null diff --git a/csharp-binding/LibSurviveBinding/bin/Debug/netcoreapp2.0/LibSurviveBinding.pdb b/csharp-binding/LibSurviveBinding/bin/Debug/netcoreapp2.0/LibSurviveBinding.pdb Binary files differdeleted file mode 100644 index c8442a1..0000000 --- a/csharp-binding/LibSurviveBinding/bin/Debug/netcoreapp2.0/LibSurviveBinding.pdb +++ /dev/null diff --git a/csharp-binding/LibSurviveBinding/bin/Debug/netcoreapp2.0/libsurvive.dll b/csharp-binding/LibSurviveBinding/bin/Debug/netcoreapp2.0/libsurvive.dll Binary files differdeleted file mode 100644 index 09738c8..0000000 --- a/csharp-binding/LibSurviveBinding/bin/Debug/netcoreapp2.0/libsurvive.dll +++ /dev/null diff --git a/csharp-binding/LibSurviveBinding/libsurvive.dll b/csharp-binding/LibSurviveBinding/libsurvive.dll Binary files differdeleted file mode 100644 index 09738c8..0000000 --- a/csharp-binding/LibSurviveBinding/libsurvive.dll +++ /dev/null diff --git a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.AssemblyInfo.cs b/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.AssemblyInfo.cs deleted file mode 100644 index 0c76a75..0000000 --- a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// </auto-generated> -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("LibSurviveBinding")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] -[assembly: System.Reflection.AssemblyProductAttribute("LibSurviveBinding")] -[assembly: System.Reflection.AssemblyTitleAttribute("LibSurviveBinding")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] - -// Generated by the MSBuild WriteCodeFragment class. - diff --git a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.AssemblyInfoInputs.cache b/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.AssemblyInfoInputs.cache deleted file mode 100644 index 27570f7..0000000 --- a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.AssemblyInfoInputs.cache +++ /dev/null @@ -1 +0,0 @@ -b297cfadb5fc15fdc85ac80d1db8dc47ecc7fa1f diff --git a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.csproj.CoreCompileInputs.cache b/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.csproj.CoreCompileInputs.cache deleted file mode 100644 index d7b7e81..0000000 --- a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.csproj.CoreCompileInputs.cache +++ /dev/null @@ -1 +0,0 @@ -e5ec51aa179849bdaf5ff16a14a375413f2f7a0b diff --git a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.csproj.FileListAbsolute.txt b/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.csproj.FileListAbsolute.txt deleted file mode 100644 index a699d0e..0000000 --- a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.csproj.FileListAbsolute.txt +++ /dev/null @@ -1,12 +0,0 @@ -P:\csharp\LibSurviveBinding\bin\Debug\netcoreapp2.0\LibSurviveBinding.deps.json -P:\csharp\LibSurviveBinding\bin\Debug\netcoreapp2.0\LibSurviveBinding.runtimeconfig.json -P:\csharp\LibSurviveBinding\bin\Debug\netcoreapp2.0\LibSurviveBinding.runtimeconfig.dev.json -P:\csharp\LibSurviveBinding\bin\Debug\netcoreapp2.0\LibSurviveBinding.dll -P:\csharp\LibSurviveBinding\bin\Debug\netcoreapp2.0\LibSurviveBinding.pdb -P:\csharp\LibSurviveBinding\obj\Debug\netcoreapp2.0\LibSurviveBinding.csprojResolveAssemblyReference.cache -P:\csharp\LibSurviveBinding\obj\Debug\netcoreapp2.0\LibSurviveBinding.csproj.CoreCompileInputs.cache -P:\csharp\LibSurviveBinding\obj\Debug\netcoreapp2.0\LibSurviveBinding.AssemblyInfoInputs.cache -P:\csharp\LibSurviveBinding\obj\Debug\netcoreapp2.0\LibSurviveBinding.AssemblyInfo.cs -P:\csharp\LibSurviveBinding\obj\Debug\netcoreapp2.0\LibSurviveBinding.dll -P:\csharp\LibSurviveBinding\obj\Debug\netcoreapp2.0\LibSurviveBinding.pdb -P:\csharp\LibSurviveBinding\bin\Debug\netcoreapp2.0\libsurvive.dll diff --git a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.csprojResolveAssemblyReference.cache b/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.csprojResolveAssemblyReference.cache Binary files differdeleted file mode 100644 index 94b7814..0000000 --- a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.csprojResolveAssemblyReference.cache +++ /dev/null diff --git a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.dll b/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.dll Binary files differdeleted file mode 100644 index 08f1a10..0000000 --- a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.dll +++ /dev/null diff --git a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.pdb b/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.pdb Binary files differdeleted file mode 100644 index c8442a1..0000000 --- a/csharp-binding/LibSurviveBinding/obj/Debug/netcoreapp2.0/LibSurviveBinding.pdb +++ /dev/null diff --git a/csharp-binding/LibSurviveBinding/obj/LibSurviveBinding.csproj.nuget.cache b/csharp-binding/LibSurviveBinding/obj/LibSurviveBinding.csproj.nuget.cache deleted file mode 100644 index 55c49f2..0000000 --- a/csharp-binding/LibSurviveBinding/obj/LibSurviveBinding.csproj.nuget.cache +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": 1, - "dgSpecHash": "WfCkKm3U/vtoEsgbYzrhLfrfUejWLQZtOI4PCmuZ/c/RM+JDSQotxYTHxQQ6Blgu3cg1aVoZ15gcgmVkgjRwSg==", - "success": true -}
\ No newline at end of file diff --git a/csharp-binding/LibSurviveBinding/obj/LibSurviveBinding.csproj.nuget.g.props b/csharp-binding/LibSurviveBinding/obj/LibSurviveBinding.csproj.nuget.g.props deleted file mode 100644 index f4fbbaa..0000000 --- a/csharp-binding/LibSurviveBinding/obj/LibSurviveBinding.csproj.nuget.g.props +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="no"?> -<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> - <RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess> - <RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool> - <ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">P:\csharp\LibSurviveBinding\obj\project.assets.json</ProjectAssetsFile> - <NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot> - <NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Peter\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder</NuGetPackageFolders> - <NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle> - <NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">4.6.1</NuGetToolVersion> - </PropertyGroup> - <PropertyGroup> - <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> - </PropertyGroup> - <ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> - <Import Project="C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.0.0\build\netcoreapp2.0\Microsoft.NETCore.App.props" Condition="Exists('C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.0.0\build\netcoreapp2.0\Microsoft.NETCore.App.props')" /> - </ImportGroup> -</Project>
\ No newline at end of file diff --git a/csharp-binding/LibSurviveBinding/obj/LibSurviveBinding.csproj.nuget.g.targets b/csharp-binding/LibSurviveBinding/obj/LibSurviveBinding.csproj.nuget.g.targets deleted file mode 100644 index 91fd1c9..0000000 --- a/csharp-binding/LibSurviveBinding/obj/LibSurviveBinding.csproj.nuget.g.targets +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="no"?> -<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> - </PropertyGroup> - <ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> - <Import Project="C:\Program Files\dotnet\sdk\NuGetFallbackFolder\netstandard.library\2.0.0\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('C:\Program Files\dotnet\sdk\NuGetFallbackFolder\netstandard.library\2.0.0\build\netstandard2.0\NETStandard.Library.targets')" /> - <Import Project="C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.0.0\build\netcoreapp2.0\Microsoft.NETCore.App.targets" Condition="Exists('C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.0.0\build\netcoreapp2.0\Microsoft.NETCore.App.targets')" /> - </ImportGroup> -</Project>
\ No newline at end of file |