vrpn 07.35
Virtual Reality Peripheral Network
Loading...
Searching...
No Matches
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, SpaceMouseCompact, Spaceball5000,
16// SpacePilot 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)
29public:
30 vrpn_3DConnexion(vrpn_HidAcceptor *filter, unsigned num_buttons,
31 const char *name, vrpn_Connection *c = 0,
32 vrpn_uint16 vendor = 0, vrpn_uint16 product = 0);
33 virtual ~vrpn_3DConnexion();
34
35 virtual void mainloop();
36
37protected:
38 // Set up message handlers, etc.
39 void on_data_received(size_t bytes, vrpn_uint8 *buffer);
40
41 virtual void decodePacket(size_t bytes, vrpn_uint8 *buffer);
42 struct timeval _timestamp;
44
45 // Send report iff changed
46 void report_changes (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
47 // Send report whether or not changed
48 void report (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
49 // NOTE: class_of_service is only applied to vrpn_Analog
50 // values, not vrpn_Button or vrpn_Dial
51};
52#else // not VRPN_USE_HID
54public:
55 vrpn_3DConnexion(vrpn_HidAcceptor *filter, unsigned num_buttons,
56 const char *name, vrpn_Connection *c = 0,
57 vrpn_uint16 vendor = 0, vrpn_uint16 product = 0);
58 virtual ~vrpn_3DConnexion();
59
60 virtual void mainloop();
61
62protected:
63 struct timeval _timestamp;
64 vrpn_HidAcceptor *_filter;
65 int fd;
66
67 // Send report iff changed
68 void report_changes(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
69 // Send report whether or not changed
70 void report(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
71 // NOTE: class_of_service is only applied to vrpn_Analog
72 // values, not vrpn_Button or vrpn_Dial
73
74// There is a non-HID Linux-based driver for this device that has a capability
75// not implemented in the HID interface.
76#if defined(linux) && !defined(VRPN_USE_HID)
77 int set_led(int led_state);
78#endif
79};
80#endif // not VRPN_USE_HID
81
83public:
84 vrpn_3DConnexion_Navigator(const char *name, vrpn_Connection *c = 0);
86
87protected:
88};
89
91public:
94
95protected:
96};
97
99public:
100 vrpn_3DConnexion_Traveler(const char *name, vrpn_Connection *c = 0);
102
103protected:
104};
105
107public:
108 vrpn_3DConnexion_SpaceMouse(const char *name, vrpn_Connection *c = 0);
110
111protected:
112};
113
114/*
115The 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):
1160=Menu
1171=Fit
1182=<T>
1194=<R>
1205=<F>
1218=<Roll+>
12212=1
12313=2
12414=3
12515=4
12622=Esc
12723=Alt
12824=Shift
12925=Ctrl
13026=<Rot>
131*/
132
134public:
135 vrpn_3DConnexion_SpaceMousePro(const char *name, vrpn_Connection *c = 0);
137
138protected:
139};
140
142public:
143 vrpn_3DConnexion_SpaceMouseCompact(const char *name, vrpn_Connection *c = 0);
145
146protected:
147};
148
150public:
153
154protected:
155};
156
158public:
159 vrpn_3DConnexion_SpaceExplorer(const char *name, vrpn_Connection *c = 0);
161
162protected:
163};
164
166public:
167 vrpn_3DConnexion_SpaceBall5000(const char *name, vrpn_Connection *c = 0);
169
170protected:
171};
172
174public:
175 vrpn_3DConnexion_SpacePilot(const char *name, vrpn_Connection *c = 0);
177
178protected:
179};
180
182public:
183 vrpn_3DConnexion_SpacePilotPro(const char *name, vrpn_Connection *c = 0);
185
186protected:
187};
188
190public:
193
194protected:
195 void decodePacket(size_t bytes, vrpn_uint8 *buffer);
196};
197
198// end of VRPN_3DCONNEXION_H
199#endif
vrpn_HidAcceptor * _filter
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
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:66
virtual void report_changes(void)
Generic connection class not specific to the transport mechanism.
virtual void on_data_received(size_t bytes, vrpn_uint8 *buffer)=0
Derived class reimplements this callback.
#define VRPN_API
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY