vrpn  07.33
Virtual Reality Peripheral Network
vrpn_3DConnexion.h
Go to the documentation of this file.
1 #ifndef VRPN_3DCONNEXION_H
2 #define VRPN_3DCONNEXION_H
3 
4 #include <stddef.h> // for size_t
5 
6 #include "vrpn_Analog.h" // for vrpn_Analog
7 #include "vrpn_Button.h" // for vrpn_Button_Filter
8 #include "vrpn_Configure.h" // for VRPN_API, VRPN_USE_HID
9 #include "vrpn_Connection.h" // for vrpn_Connection (ptr only), etc
10 #include "vrpn_HumanInterface.h" // for vrpn_HidAcceptor (ptr only), etc
11 #include "vrpn_Shared.h" // for timeval
12 #include "vrpn_Types.h" // for vrpn_uint32, vrpn_uint8
13 
14 // Device drivers for the 3DConnexion SpaceNavigator and SpaceTraveler
15 // SpaceExplorer, SpaceMouse, SpaceMousePro, Spaceball5000, SpacePilot
16 // devices, connecting to them as HID devices (USB).
17 
18 // Exposes two VRPN device classes: Button and Analog.
19 // Analogs are mapped to the six channels, each in the range (-1..1).
20 
21 // This is the base driver for the devices. The Navigator has
22 // only two buttons and has product ID 50726, the traveler has 8
23 // buttons and ID 50723. The derived classes just construct with
24 // the appropriate number of buttons and an acceptor for the proper
25 // product ID; the baseclass does all the work.
26 
27 #if defined(VRPN_USE_HID)
29 public:
30  vrpn_3DConnexion(vrpn_HidAcceptor *filter, unsigned num_buttons,
31  const char *name, vrpn_Connection *c = 0);
32  virtual ~vrpn_3DConnexion();
33 
34  virtual void mainloop();
35 
36 protected:
37  // Set up message handlers, etc.
38  void on_data_received(size_t bytes, vrpn_uint8 *buffer);
39 
40  virtual void decodePacket(size_t bytes, vrpn_uint8 *buffer);
41  struct timeval _timestamp;
43 
44  // Send report iff changed
45  void report_changes (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
46  // Send report whether or not changed
47  void report (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
48  // NOTE: class_of_service is only applied to vrpn_Analog
49  // values, not vrpn_Button or vrpn_Dial
50 };
51 #else // not VRPN_USE_HID
53 public:
54  vrpn_3DConnexion(vrpn_HidAcceptor *filter, unsigned num_buttons,
55  const char *name, vrpn_Connection *c = 0);
56  virtual ~vrpn_3DConnexion();
57 
58  virtual void mainloop();
59 
60 protected:
61  struct timeval _timestamp;
62  vrpn_HidAcceptor *_filter;
63  int fd;
64 
65  // Send report iff changed
66  void report_changes(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
67  // Send report whether or not changed
68  void report(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
69  // NOTE: class_of_service is only applied to vrpn_Analog
70  // values, not vrpn_Button or vrpn_Dial
71 
72 // There is a non-HID Linux-based driver for this device that has a capability
73 // not implemented in the HID interface.
74 #if defined(linux) && !defined(VRPN_USE_HID)
75  int set_led(int led_state);
76 #endif
77 };
78 #endif // not VRPN_USE_HID
79 
81 public:
82  vrpn_3DConnexion_Navigator(const char *name, vrpn_Connection *c = 0);
84 
85 protected:
86 };
87 
89 public:
92 
93 protected:
94 };
95 
97 public:
98  vrpn_3DConnexion_Traveler(const char *name, vrpn_Connection *c = 0);
100 
101 protected:
102 };
103 
105 public:
106  vrpn_3DConnexion_SpaceMouse(const char *name, vrpn_Connection *c = 0);
108 
109 protected:
110 };
111 
112 /*
113 The button numbers are labeled as follows (the ones similar to <x> have a graphic on the button and are referred to the text enclosed text in the help):
114 0=Menu
115 1=Fit
116 2=<T>
117 4=<R>
118 5=<F>
119 8=<Roll+>
120 12=1
121 13=2
122 14=3
123 15=4
124 22=Esc
125 23=Alt
126 24=Shift
127 25=Ctrl
128 26=<Rot>
129 */
130 
132 public:
133  vrpn_3DConnexion_SpaceMousePro(const char *name, vrpn_Connection *c = 0);
135 
136 protected:
137 };
138 
140 public:
141  vrpn_3DConnexion_SpaceMouseWireless(const char *name, vrpn_Connection *c = 0);
143 
144 protected:
145 };
146 
148 public:
149  vrpn_3DConnexion_SpaceExplorer(const char *name, vrpn_Connection *c = 0);
151 
152 protected:
153 };
154 
156 public:
157  vrpn_3DConnexion_SpaceBall5000(const char *name, vrpn_Connection *c = 0);
159 
160 protected:
161 };
162 
164 public:
165  vrpn_3DConnexion_SpacePilot(const char *name, vrpn_Connection *c = 0);
167 
168 protected:
169 };
170 
171 // end of VRPN_3DCONNEXION_H
172 #endif
173 
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
Send a report only if something has changed (for servers) Optionally, tell what time to stamp the val...
Definition: vrpn_Analog.C:71
virtual void on_data_received(size_t bytes, vrpn_uint8 *buffer)=0
Derived class reimplements this callback.
Generic connection class not specific to the transport mechanism.
virtual void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
Send a report whether something has changed or not (for servers) Optionally, tell what time to stamp ...
Definition: vrpn_Analog.C:94
#define VRPN_API
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
All button servers should derive from this class, which provides the ability to turn any of the butto...
Definition: vrpn_Button.h:65
vrpn_HidAcceptor * _filter