UnityMol  0.9.6-875
UnityMol viewer / In developement
VRPNWrapper.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using System.Collections;
3 using System.Runtime.InteropServices;
4 using System;
5 
6 namespace VRPN
7 {
8  public class Wrapper {
9  const int MAX_ANALOG_CHANNELS = 128;
10 
11  [ StructLayout( LayoutKind.Sequential)]
12  public struct VRPNAnalogReport
13  {
14  public UInt64 tv_sec;
15  public UInt64 tv_usec;
16  public int num_channel;
17  [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_ANALOG_CHANNELS)]
18  public double[] channel;
19  }
20 
21  public delegate void TrackerCallbackDelegate(uint sensor, System.IntPtr pos, System.IntPtr quat);
22 
23  public delegate void ButtonCallbackDelegate(Int32 button, Int32 state);
24 
25  public delegate void AnalogCallbackDelegate(VRPN.Wrapper.VRPNAnalogReport report);
26 
27  [DllImport ("vrpn-c-wrapper")]
28  public static extern System.IntPtr vrpn_c_open_tracker(string name, TrackerCallbackDelegate trackerCallbackF);
29 
30  [DllImport ("vrpn-c-wrapper")]
31  public static extern bool vrpn_c_poll_tracker(System.IntPtr device);
32 
33  [DllImport ("vrpn-c-wrapper")]
34  public static extern bool vrpn_c_tracker_is_connected(System.IntPtr device);
35 
36  [DllImport ("vrpn-c-wrapper")]
37  public static extern bool vrpn_c_tracker_doing_okay(System.IntPtr device);
38 
39  [DllImport ("vrpn-c-wrapper")]
40  public static extern bool vrpn_c_close_tracker(System.IntPtr device);
41 
42  [DllImport ("vrpn-c-wrapper")]
43  public static extern System.IntPtr vrpn_c_open_button(string name, ButtonCallbackDelegate buttonCallbackF);
44 
45  [DllImport ("vrpn-c-wrapper")]
46  public static extern bool vrpn_c_poll_button(System.IntPtr device);
47 
48  [DllImport ("vrpn-c-wrapper")]
49  public static extern bool vrpn_c_button_is_connected(System.IntPtr device);
50 
51  [DllImport ("vrpn-c-wrapper")]
52  public static extern bool vrpn_c_button_doing_okay(System.IntPtr device);
53 
54  [DllImport ("vrpn-c-wrapper")]
55  public static extern bool vrpn_c_close_button(System.IntPtr device);
56 
57  [DllImport ("vrpn-c-wrapper")]
58  public static extern System.IntPtr vrpn_c_open_force_feedback(string name);
59 
60  [DllImport ("vrpn-c-wrapper")]
61  public static extern bool vrpn_c_force_feedback_set_force(System.IntPtr device, float force_x, float force_y, float force_z);
62 
63  [DllImport ("vrpn-c-wrapper")]
64  public static extern void vrpn_c_force_feedback_stop(System.IntPtr device);
65 
66  [DllImport ("vrpn-c-wrapper")]
67  public static extern bool vrpn_c_force_feedback_is_connected(System.IntPtr device);
68 
69  [DllImport ("vrpn-c-wrapper")]
70  public static extern bool vrpn_c_force_feedback_doing_okay(System.IntPtr device);
71 
72  [DllImport ("vrpn-c-wrapper")]
73  public static extern bool vrpn_c_close_force_feedback(System.IntPtr device);
74 
75  [DllImport ("vrpn-c-wrapper")]
76  public static extern System.IntPtr vrpn_c_open_analog(string name, AnalogCallbackDelegate analogCallbackF);
77 
78  [DllImport ("vrpn-c-wrapper")]
79  public static extern bool vrpn_c_poll_analog(System.IntPtr device);
80 
81  [DllImport ("vrpn-c-wrapper")]
82  public static extern bool vrpn_c_analog_is_connected(System.IntPtr device);
83 
84  [DllImport ("vrpn-c-wrapper")]
85  public static extern bool vrpn_c_analog_doing_okay(System.IntPtr device);
86 
87  [DllImport ("vrpn-c-wrapper")]
88  public static extern bool vrpn_c_close_analog(System.IntPtr device);
89  }
90 
91 }
static bool vrpn_c_button_is_connected(System.IntPtr device)
static System.IntPtr vrpn_c_open_analog(string name, AnalogCallbackDelegate analogCallbackF)
static bool vrpn_c_analog_doing_okay(System.IntPtr device)
static bool vrpn_c_close_analog(System.IntPtr device)
static bool vrpn_c_force_feedback_is_connected(System.IntPtr device)
static bool vrpn_c_poll_analog(System.IntPtr device)
static bool vrpn_c_force_feedback_doing_okay(System.IntPtr device)
static bool vrpn_c_close_button(System.IntPtr device)
static bool vrpn_c_tracker_is_connected(System.IntPtr device)
delegate void ButtonCallbackDelegate(Int32 button, Int32 state)
static bool vrpn_c_close_force_feedback(System.IntPtr device)
delegate void AnalogCallbackDelegate(VRPN.Wrapper.VRPNAnalogReport report)
static bool vrpn_c_tracker_doing_okay(System.IntPtr device)
static bool vrpn_c_analog_is_connected(System.IntPtr device)
static System.IntPtr vrpn_c_open_button(string name, ButtonCallbackDelegate buttonCallbackF)
static System.IntPtr vrpn_c_open_force_feedback(string name)
delegate void TrackerCallbackDelegate(uint sensor, System.IntPtr pos, System.IntPtr quat)
const int MAX_ANALOG_CHANNELS
Definition: VRPNWrapper.cs:9
static System.IntPtr vrpn_c_open_tracker(string name, TrackerCallbackDelegate trackerCallbackF)
static bool vrpn_c_force_feedback_set_force(System.IntPtr device, float force_x, float force_y, float force_z)
static bool vrpn_c_button_doing_okay(System.IntPtr device)
static bool vrpn_c_poll_tracker(System.IntPtr device)
static bool vrpn_c_poll_button(System.IntPtr device)
static void vrpn_c_force_feedback_stop(System.IntPtr device)
static bool vrpn_c_close_tracker(System.IntPtr device)