vrpn 07.35
Virtual Reality Peripheral Network
 
Loading...
Searching...
No Matches
vrpn_Freespace.h
Go to the documentation of this file.
1
18
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
33class VRPN_API vrpn_Freespace :
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{
38public:
46
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
68private:
69 static bool _freespace_initialized;
70 static void freespaceInit();
74 vrpn_Freespace(FreespaceDeviceId freespaceId,
75 struct FreespaceDeviceInfo* deviceInfo,
76 const char *name,
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
91protected:
92 FreespaceDeviceId _freespaceDevice;
93 FreespaceDeviceInfo _deviceInfo;
94 vrpn_float64 _lastBodyFrameTime;
95};
96#endif //VRPN_USE_FREESPACE
97
98#endif // VRPN_FREESPACE_H
vrpn_Button_Filter(const char *, vrpn_Connection *c=NULL)
Generic connection class not specific to the transport mechanism.
vrpn_Dial(const char *name, vrpn_Connection *c=NULL)
Definition vrpn_Dial.C:8
static vrpn_Freespace * create(const char *name, vrpn_Connection *conn, int device_index=0, bool send_body_frames=false, bool send_user_frames=true)
Create a freespace server using the given FreespaceDeviceId.
FreespaceDeviceId _freespaceDevice
FreespaceDeviceInfo _deviceInfo
vrpn_float64 _lastBodyFrameTime
virtual void mainloop()
This function should be called each time through app mainloop.
vrpn_Tracker_Server(const char *name, vrpn_Connection *c, vrpn_int32 sensors=1)
#define VRPN_API