diff options
author | Justin Berger <j.david.berger@gmail.com> | 2018-04-02 10:10:33 -0600 |
---|---|---|
committer | Justin Berger <j.david.berger@gmail.com> | 2018-04-02 10:10:33 -0600 |
commit | 75460f240c9d003e4ca2e6dda9b2146a74df7ffa (patch) | |
tree | 957b26f0539df176b61ad2ec72fbb0658b147919 /bindings | |
parent | 2b63278497130d01b1fbc7e6a94b6ad8e32ab4dd (diff) | |
parent | 1724abef15a4090640bd82ba408681438316de7e (diff) | |
download | libsurvive-75460f240c9d003e4ca2e6dda9b2146a74df7ffa.tar.gz libsurvive-75460f240c9d003e4ca2e6dda9b2146a74df7ffa.tar.bz2 |
Merge remote-tracking branch 'origin/master' into imu
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/cs/Demo/App.config | 6 | ||||
-rw-r--r-- | bindings/cs/Demo/Demo.csproj | 86 | ||||
-rw-r--r-- | bindings/cs/Demo/Program.cs | 58 | ||||
-rw-r--r-- | bindings/cs/Demo/Properties/AssemblyInfo.cs | 36 | ||||
-rw-r--r-- | bindings/cs/LibSurviveBinding.sln | 67 | ||||
-rw-r--r-- | bindings/cs/libsurvive.net/SurviveContext.cs | 115 | ||||
-rw-r--r-- | bindings/cs/libsurvive.net/cfunctions.cs | 91 | ||||
-rw-r--r-- | bindings/cs/libsurvive.net/libsurvive.net.csproj | 7 |
8 files changed, 466 insertions, 0 deletions
diff --git a/bindings/cs/Demo/App.config b/bindings/cs/Demo/App.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/bindings/cs/Demo/App.config @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> + </startup> +</configuration>
\ No newline at end of file diff --git a/bindings/cs/Demo/Demo.csproj b/bindings/cs/Demo/Demo.csproj new file mode 100644 index 0000000..f347a5e --- /dev/null +++ b/bindings/cs/Demo/Demo.csproj @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{D3A43A2F-03B7-4A10-928F-686790036838}</ProjectGuid> + <OutputType>Exe</OutputType> + <RootNamespace>Demo</RootNamespace> + <AssemblyName>Demo</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\x64\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <Prefer32Bit>false</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\libsurvive.net\libsurvive.net.csproj"> + <Project>{da1b12d7-a121-4d40-b363-4893e4f88b8a}</Project> + <Name>libsurvive.net</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include=".NETFramework,Version=v4.6.1"> + <Visible>False</Visible> + <ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>false</Install> + </BootstrapperPackage> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/bindings/cs/Demo/Program.cs b/bindings/cs/Demo/Program.cs new file mode 100644 index 0000000..c03d83c --- /dev/null +++ b/bindings/cs/Demo/Program.cs @@ -0,0 +1,58 @@ +using libsurvive; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Demo +{ + internal class MyHandler : SurviveContext + { + private static void WritePose(string name, SurvivePose pose) + { + Console.Out.WriteLine(name); + Console.Out.Write(" [ "); + for (int i = 0; i < 3; i++) + Console.Out.Write("{0} ", pose.Pos[i]); + Console.Out.Write(" ] [ "); + for (int i = 0; i < 4; i++) + Console.Out.Write("{0} ", pose.Rot[i]); + Console.Out.Write(" ] "); + Console.Out.WriteLine(); + } + + public MyHandler() : base() + { + } + + public MyHandler(string[] args) : base(args) + { + } + + protected void LightHouseEvent1(IntPtr ctx, byte lighthouse, SurvivePose lighthouse_pose, SurvivePose object_pose) + { + base.LightHouseEvent(ctx, lighthouse, lighthouse_pose, object_pose); + WritePose("Lighthouse", lighthouse_pose); + WritePose("Object", object_pose); + } + + protected override void PoseEvent(IntPtr so, byte lighthouse, SurvivePose pose) + { + WritePose("Pose", pose); + base.PoseEvent(so, lighthouse, pose); + } + } + class Program + { + static void Main(string[] args) + { + MyHandler handler = new MyHandler(args); + + while (handler.Poll() == 0) { + } + + } + + } +} diff --git a/bindings/cs/Demo/Properties/AssemblyInfo.cs b/bindings/cs/Demo/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2c6a6c7 --- /dev/null +++ b/bindings/cs/Demo/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using 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("Demo")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Demo")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[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("d3a43a2f-03b7-4a10-928f-686790036838")] + +// 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/bindings/cs/LibSurviveBinding.sln b/bindings/cs/LibSurviveBinding.sln new file mode 100644 index 0000000..b2e2f11 --- /dev/null +++ b/bindings/cs/LibSurviveBinding.sln @@ -0,0 +1,67 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2003 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "Demo\Demo.csproj", "{D3A43A2F-03B7-4A10-928F-686790036838}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "libsurvive.net", "libsurvive.net\libsurvive.net.csproj", "{DA1B12D7-A121-4D40-B363-4893E4F88B8A}" + ProjectSection(ProjectDependencies) = postProject + {435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F} = {435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsurvive", "..\..\winbuild\libsurvive\libsurvive.vcxproj", "{435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D3A43A2F-03B7-4A10-928F-686790036838}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3A43A2F-03B7-4A10-928F-686790036838}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3A43A2F-03B7-4A10-928F-686790036838}.Debug|x64.ActiveCfg = Debug|Any CPU + {D3A43A2F-03B7-4A10-928F-686790036838}.Debug|x64.Build.0 = Debug|Any CPU + {D3A43A2F-03B7-4A10-928F-686790036838}.Debug|x86.ActiveCfg = Debug|Any CPU + {D3A43A2F-03B7-4A10-928F-686790036838}.Debug|x86.Build.0 = Debug|Any CPU + {D3A43A2F-03B7-4A10-928F-686790036838}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3A43A2F-03B7-4A10-928F-686790036838}.Release|Any CPU.Build.0 = Release|Any CPU + {D3A43A2F-03B7-4A10-928F-686790036838}.Release|x64.ActiveCfg = Release|Any CPU + {D3A43A2F-03B7-4A10-928F-686790036838}.Release|x64.Build.0 = Release|Any CPU + {D3A43A2F-03B7-4A10-928F-686790036838}.Release|x86.ActiveCfg = Release|Any CPU + {D3A43A2F-03B7-4A10-928F-686790036838}.Release|x86.Build.0 = Release|Any CPU + {DA1B12D7-A121-4D40-B363-4893E4F88B8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DA1B12D7-A121-4D40-B363-4893E4F88B8A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DA1B12D7-A121-4D40-B363-4893E4F88B8A}.Debug|x64.ActiveCfg = Debug|Any CPU + {DA1B12D7-A121-4D40-B363-4893E4F88B8A}.Debug|x64.Build.0 = Debug|Any CPU + {DA1B12D7-A121-4D40-B363-4893E4F88B8A}.Debug|x86.ActiveCfg = Debug|Any CPU + {DA1B12D7-A121-4D40-B363-4893E4F88B8A}.Debug|x86.Build.0 = Debug|Any CPU + {DA1B12D7-A121-4D40-B363-4893E4F88B8A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DA1B12D7-A121-4D40-B363-4893E4F88B8A}.Release|Any CPU.Build.0 = Release|Any CPU + {DA1B12D7-A121-4D40-B363-4893E4F88B8A}.Release|x64.ActiveCfg = Release|Any CPU + {DA1B12D7-A121-4D40-B363-4893E4F88B8A}.Release|x64.Build.0 = Release|Any CPU + {DA1B12D7-A121-4D40-B363-4893E4F88B8A}.Release|x86.ActiveCfg = Release|Any CPU + {DA1B12D7-A121-4D40-B363-4893E4F88B8A}.Release|x86.Build.0 = Release|Any CPU + {435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F}.Debug|Any CPU.ActiveCfg = Debug|x64 + {435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F}.Debug|Any CPU.Build.0 = Debug|x64 + {435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F}.Debug|x64.ActiveCfg = Debug|x64 + {435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F}.Debug|x64.Build.0 = Debug|x64 + {435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F}.Debug|x86.ActiveCfg = Debug|Win32 + {435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F}.Debug|x86.Build.0 = Debug|Win32 + {435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F}.Release|Any CPU.ActiveCfg = Release|Win32 + {435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F}.Release|x64.ActiveCfg = Release|x64 + {435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F}.Release|x64.Build.0 = Release|x64 + {435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F}.Release|x86.ActiveCfg = Release|Win32 + {435CFD2C-8724-42EE-8FDE-71EF7D2C6B2F}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CA47A8D6-3379-4ABA-927E-86BBDDE1D304} + EndGlobalSection +EndGlobal diff --git a/bindings/cs/libsurvive.net/SurviveContext.cs b/bindings/cs/libsurvive.net/SurviveContext.cs new file mode 100644 index 0000000..bafcf2b --- /dev/null +++ b/bindings/cs/libsurvive.net/SurviveContext.cs @@ -0,0 +1,115 @@ +using System; + +namespace libsurvive +{ + using SurviveContextPtr = IntPtr; + using SurviveObjectPtr = IntPtr; + using SurvivePosePtr = IntPtr; + + public class SurviveContext : IDisposable + { + protected IntPtr ctx; + + public void Dispose() + { + cfunctions.survive_close(ctx); + ctx = IntPtr.Zero; + } + + public SurviveContext() : this(null) { } + + /** + * We need to keep these delegates around for the lifespan of this object. + * if we just pass the functions in, it creates temporary delegates that + * disappear if we don't keep managed ref around + */ + light_process_func light_Process_Func; + raw_pose_func raw_Pose_Func; + lighthouse_pose_func lighthouse_Pose_Func; + angle_process_func angle_Process_Func; + button_process_func button_Process_Func; + htc_config_func htc_Config_Func; + imu_process_func imu_Process_Func; + text_feedback_func error_func; + text_feedback_func info_func; + + public SurviveContext(string[] args) + { + string[] newArgs = new string[args.Length + 1]; + newArgs[0] = System.Reflection.Assembly.GetEntryAssembly().FullName; + Array.Copy(args, 0, newArgs, 1, args.Length); + + ctx = cfunctions.survive_init_internal(newArgs.Length, newArgs); + + light_Process_Func = LightEvent; + raw_Pose_Func = PoseEvent; + lighthouse_Pose_Func = LightHouseEvent; + angle_Process_Func = AngleEvent; + button_Process_Func = ButtonEvent; + htc_Config_Func = HTCConfigEvent; + imu_Process_Func = IMUEvent; + error_func = ErrorEvent; + info_func = InfoEvent; + + cfunctions.survive_install_raw_pose_fn(ctx, raw_Pose_Func); + cfunctions.survive_install_light_fn(ctx, light_Process_Func); + cfunctions.survive_install_lighthouse_pose_fn(ctx, lighthouse_Pose_Func); + cfunctions.survive_install_angle_fn(ctx, angle_Process_Func); + cfunctions.survive_install_button_fn(ctx, button_Process_Func); + cfunctions.survive_install_htc_config_fn(ctx, htc_Config_Func); + cfunctions.survive_install_imu_fn(ctx, imu_Process_Func); + cfunctions.survive_install_error_fn(ctx, error_func); + cfunctions.survive_install_info_fn(ctx, info_func); + } + + virtual protected void InfoEvent(SurviveObjectPtr ctx, string fault) + { + Console.Out.WriteLine(fault); + } + + virtual protected void ErrorEvent(SurviveObjectPtr ctx, string fault) + { + Console.Error.WriteLine(fault); + } + + virtual protected void IMUEvent(SurviveObjectPtr so, int mask, double[] accelgyro, uint timecode, int id) + { + cfunctions.survive_default_imu_process(so, mask, accelgyro, timecode, id); + } + + virtual protected int HTCConfigEvent(SurviveObjectPtr so, string ct0conf, int len) + { + return cfunctions.survive_default_htc_config_process(so, ct0conf, len); + } + + virtual protected void ButtonEvent(SurviveObjectPtr so, byte eventType, byte buttonId, byte axis1Id, ushort axis1Val, byte axis2Id, ushort axis2Val) + { + cfunctions.survive_default_button_process(so, eventType, buttonId, axis1Id, axis1Val, axis2Id, axis2Val); + } + + virtual protected void AngleEvent(SurviveObjectPtr so, int sensor_id, int acode, uint timecode, double length, double angle, uint lh) + { + cfunctions.survive_default_angle_process(so, sensor_id, acode, timecode, length, angle, lh); + } + + protected void LightHouseEvent(SurviveObjectPtr ctx, byte lighthouse, SurvivePose lighthouse_pose, SurvivePose object_pose) + { + cfunctions.survive_default_lighthouse_pose_process(ctx, lighthouse, lighthouse_pose, object_pose); + } + + virtual protected void LightEvent(SurviveObjectPtr so, int sensor_id, int acode, int timeinsweep, UInt32 timecode, UInt32 length, UInt32 lighthouse) + { + cfunctions.survive_default_light_process(so, sensor_id, acode, timeinsweep, timecode, length, lighthouse); + } + + virtual protected void PoseEvent(IntPtr so, byte lighthouse, SurvivePose pose) + { + cfunctions.survive_default_raw_pose_process(so, lighthouse, pose); + } + + public int Poll() + { + return cfunctions.survive_poll(ctx); + } + } +}
\ No newline at end of file diff --git a/bindings/cs/libsurvive.net/cfunctions.cs b/bindings/cs/libsurvive.net/cfunctions.cs new file mode 100644 index 0000000..760681e --- /dev/null +++ b/bindings/cs/libsurvive.net/cfunctions.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; + +namespace libsurvive +{ + using SurviveContextPtr = IntPtr; + using SurviveObjectPtr = IntPtr; + using SurvivePosePtr = IntPtr; + + [StructLayout(LayoutKind.Sequential)] + public class SurvivePose + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public double[] Pos; // Position in the form xyz + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public double[] Rot; // Quaternion in the form wxyz + } + + class cfunctions + { +#pragma warning disable IDE1006 // Naming Styles + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall) ] + public static extern SurviveContextPtr survive_init_internal(int argc, string[] args); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern SurviveContextPtr survive_close(SurviveContextPtr ctx); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern int survive_poll(SurviveContextPtr ctx); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern int survive_startup(SurviveContextPtr ctx); + + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_install_htc_config_fn(SurviveContextPtr ctx, htc_config_func fbp); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_install_info_fn(SurviveContextPtr ctx, text_feedback_func fbp); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_install_error_fn(SurviveContextPtr ctx, text_feedback_func fbp); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_install_imu_fn(SurviveContextPtr ctx, imu_process_func fbp); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_install_angle_fn(SurviveContextPtr ctx, angle_process_func fbp); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_install_button_fn(SurviveContextPtr ctx, button_process_func fbp); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_install_raw_pose_fn(SurviveContextPtr ctx, raw_pose_func fbp); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_install_lighthouse_pose_fn(SurviveContextPtr ctx, lighthouse_pose_func fbp); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_install_light_fn(SurviveContextPtr ctx, light_process_func fbp); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_cal_install(SurviveContextPtr ctx); + + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_default_light_process(SurviveObjectPtr so, int sensor_id, int acode, int timeinsweep, UInt32 timecode, UInt32 length, UInt32 lh); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_default_imu_process(SurviveObjectPtr so, int mode, double[] accelgyro, UInt32 timecode, int id); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_default_angle_process(SurviveObjectPtr so, int sensor_id, int acode, UInt32 timecode, double length, double angle, UInt32 lh); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_default_button_process(SurviveObjectPtr so, byte eventType, byte buttonId, byte axis1Id, UInt16 axis1Val, byte axis2Id, UInt16 axis2Val); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_default_raw_pose_process(SurviveObjectPtr so, byte lighthouse, SurvivePose pose); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern void survive_default_lighthouse_pose_process(SurviveContextPtr ctx, byte lighthouse, SurvivePose lh_pose, + SurvivePose obj_pose); + [DllImport("libsurvive", CallingConvention = CallingConvention.StdCall)] + public static extern int survive_default_htc_config_process(SurviveObjectPtr so, string ct0conf, int len); + +#pragma warning restore IDE1006 // Naming Styles + } + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate int htc_config_func(SurviveObjectPtr so, string ct0conf, int len); + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate void text_feedback_func(SurviveContextPtr ctx, string fault); + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate void light_process_func(SurviveObjectPtr so, int sensor_id, int acode, int timeinsweep, UInt32 timecode, UInt32 length, UInt32 lighthouse); + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate void imu_process_func(SurviveObjectPtr so, int mask, double[] accelgyro, UInt32 timecode, int id); + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate void angle_process_func(SurviveObjectPtr so, int sensor_id, int acode, UInt32 timecode, double length, double angle, UInt32 lh); + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate void button_process_func(SurviveObjectPtr so, byte eventType, byte buttonId, byte axis1Id, UInt16 axis1Val, byte axis2Id, UInt16 axis2Val); + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate void raw_pose_func(SurviveObjectPtr so, byte lighthouse, SurvivePose pose); + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate void lighthouse_pose_func(SurviveContextPtr ctx, byte lighthouse, SurvivePose lighthouse_pose, SurvivePose object_pose); + +} diff --git a/bindings/cs/libsurvive.net/libsurvive.net.csproj b/bindings/cs/libsurvive.net/libsurvive.net.csproj new file mode 100644 index 0000000..eac3503 --- /dev/null +++ b/bindings/cs/libsurvive.net/libsurvive.net.csproj @@ -0,0 +1,7 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <TargetFramework>netstandard1.6</TargetFramework> + </PropertyGroup> + +</Project> |