vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Freespace.h
Go to the documentation of this file.
1 
19 #ifndef VRPN_FREESPACE_H
20 #define VRPN_FREESPACE_H
21 
22 #include "vrpn_Configure.h" // IWYU pragma: keep
23 
24 #ifdef VRPN_USE_FREESPACE
25 
26 #include <freespace/freespace.h>
27 
28 #include "vrpn_Button.h"
29 #include "vrpn_Dial.h"
30 #include "vrpn_Tracker.h"
31 
32 
34  public vrpn_Tracker_Server, // for the positional data
35  public vrpn_Button_Filter, // for the actual buttons
36  public vrpn_Dial // for the scroll wheel
37 {
38 public:
47  // Freespace devices may report User frames (position and orientation in a quaternion),
48  // Body frames (angular velocity and linear acceleration), Mouse reports (delta X, delta Y)
49  // or some combination of them. You will probably want at least body or user frame
50  // messages.
51  // Another thing to note is that for some devices, enabling multiple reports diminishes
52  // the effective rate of data since the device can only send so many bits per second.
53  // This could fairly easily get added as a configuration setting.
54 
55  static vrpn_Freespace* create(const char *name,
56  vrpn_Connection *conn,
57  int device_index = 0,
58  bool send_body_frames = false,
59  bool send_user_frames = true);
60  virtual ~vrpn_Freespace(void);
66  virtual void mainloop(void);
67 
68 private:
69  static bool _freespace_initialized;
70  static void freespaceInit();
74  vrpn_Freespace(FreespaceDeviceId freespaceId,
75  struct FreespaceDeviceInfo* deviceInfo,
76  const char *name,
77  vrpn_Connection *c);
78 
79  void handleUserFrame(const struct freespace_UserFrame&);
80  void handleBodyFrame(const struct freespace_BodyFrame&);
81  void handleLinkStatus(const struct freespace_LinkStatus&);
82 
83  void deviceSetConfiguration(bool send_body_frames, bool send_user_frames);
84  void deviceConfigure();
85  void deviceUnconfigure();
86 
87  bool _sendBodyFrames;
88  bool _sendUserFrames;
89  struct timeval _timestamp;
90 
91 protected:
92  FreespaceDeviceId _freespaceDevice;
93  FreespaceDeviceInfo _deviceInfo;
94  vrpn_float64 _lastBodyFrameTime;
95 };
96 #endif //VRPN_USE_FREESPACE
97 
98 #endif // VRPN_FREESPACE_H
vrpn_Tracker.h
vrpn_Dial.h
vrpn_Freespace::_lastBodyFrameTime
vrpn_float64 _lastBodyFrameTime
Definition: vrpn_Freespace.h:94
vrpn_Tracker_Server
Definition: vrpn_Tracker.h:251
vrpn_Dial
Definition: vrpn_Dial.h:21
vrpn_Button.h
vrpn_BaseClass::mainloop
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition: vrpn_Connection.h:510
vrpn_Freespace::_freespaceDevice
FreespaceDeviceId _freespaceDevice
Definition: vrpn_Freespace.h:92
vrpn_Configure.h
VRPN_API
#define VRPN_API
Definition: vrpn_Configure.h:646
vrpn_Freespace::_deviceInfo
FreespaceDeviceInfo _deviceInfo
Definition: vrpn_Freespace.h:93
vrpn_Freespace
This provides an interface to devices powered by Hillcrest Lab's Freespace.
Definition: vrpn_Freespace.h:37
vrpn_Button_Filter
All button servers should derive from this class, which provides the ability to turn any of the butto...
Definition: vrpn_Button.h:65