RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_3DConnexion.h
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)
28class VRPN_API vrpn_3DConnexion: public vrpn_Button_Filter, public vrpn_Analog, protected vrpn_HidInterface {
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;
43 vrpn_HidAcceptor *_filter;
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
53class VRPN_API vrpn_3DConnexion: public vrpn_Button_Filter, public vrpn_Analog {
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);
85 virtual ~vrpn_3DConnexion_Navigator() {};
86
87protected:
88};
89
91public:
94
95protected:
96};
97
99public:
100 vrpn_3DConnexion_Traveler(const char *name, vrpn_Connection *c = 0);
101 virtual ~vrpn_3DConnexion_Traveler() {};
102
103protected:
104};
105
107public:
108 vrpn_3DConnexion_SpaceMouse(const char *name, vrpn_Connection *c = 0);
109 virtual ~vrpn_3DConnexion_SpaceMouse() {};
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:
161
162protected:
163};
164
166public:
167 vrpn_3DConnexion_SpaceExplorer(const char *name, vrpn_Connection *c = 0);
169
170protected:
171};
172
174public:
175 vrpn_3DConnexion_SpaceBall5000(const char *name, vrpn_Connection *c = 0);
177
178protected:
179};
180
182public:
183 vrpn_3DConnexion_SpacePilot(const char *name, vrpn_Connection *c = 0);
184 virtual ~vrpn_3DConnexion_SpacePilot() {};
185
186protected:
187};
188
190public:
191 vrpn_3DConnexion_SpacePilotPro(const char *name, vrpn_Connection *c = 0);
193
194protected:
195};
196
198public:
201
202protected:
203 void decodePacket(size_t bytes, vrpn_uint8 *buffer);
204};
205
206// end of VRPN_3DCONNEXION_H
207#endif
定义 vrpn_3DConnexion.h:90
定义 vrpn_3DConnexion.h:82
定义 vrpn_3DConnexion.h:173
定义 vrpn_3DConnexion.h:165
定义 vrpn_3DConnexion.h:141
定义 vrpn_3DConnexion.h:197
定义 vrpn_3DConnexion.h:133
定义 vrpn_3DConnexion.h:157
定义 vrpn_3DConnexion.h:149
定义 vrpn_3DConnexion.h:106
定义 vrpn_3DConnexion.h:189
定义 vrpn_3DConnexion.h:181
定义 vrpn_3DConnexion.h:98
定义 vrpn_3DConnexion.h:28
void on_data_received(size_t bytes, vrpn_uint8 *buffer)
Derived class reimplements this callback. It is called whenever a read returns some data.
virtual void mainloop()
定义 vrpn_Analog.h:28
virtual void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
virtual void mainloop()=0
定义 vrpn_Button.h:66
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562
定义 vrpn_HumanInterface.h:56
定义 vrpn_HumanInterface.h:70