internal void Init(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); if (ctx == IntPtr.Zero) { throw new Exception("There was a problem initializing the lib!"); } 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); }
public static extern void Survive_install_lighthouse_pose_fn(SurviveContextPtr ctx, lighthouse_pose_func fbp);
internal void CreateContext() { LogInfo("Start Init"); SetupConfigs configs = new SetupConfigs { configFile = "survive_conf.json" }; string[] args = CreateStartParameters(configs); //string[] vs = new[] { "--playback", "P:/c/libsurvive-data/lightcap-reformat/lightcap-reformat.log", "--disambiguator", "StateBased", "--calibrate" }; context = Cfunctions.Survive_init_internal(args.Length, args); if (context == IntPtr.Zero) { throw new Exception("There was a problem initializing the lib!"); } 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(context, raw_Pose_Func); Cfunctions.Survive_install_light_fn(context, light_Process_Func); Cfunctions.Survive_install_lighthouse_pose_fn(context, lighthouse_Pose_Func); Cfunctions.Survive_install_angle_fn(context, angle_Process_Func); Cfunctions.Survive_install_button_fn(context, button_Process_Func); Cfunctions.Survive_install_htc_config_fn(context, htc_Config_Func); Cfunctions.Survive_install_imu_fn(context, imu_Process_Func); Cfunctions.Survive_install_error_fn(context, error_func); Cfunctions.Survive_install_info_fn(context, info_func); LogInfo("Finished Init"); LogInfo("Start Startup"); int a = 0; try { a = Cfunctions.Survive_startup(context); } catch (Exception) { throw; } if (a != 0) { throw new Exception("Error in startup"); } LogInfo("Finished Startup"); }