1
#ifndef VRPN_3DCONNEXION_H
2
#define VRPN_3DCONNEXION_H
4
#include "vrpn_HumanInterface.h"
5
#include "vrpn_Button.h"
6
#include "vrpn_Analog.h"
8
// Device drivers for the 3DConnexion SpaceNavigator and SpaceTraveler
9
// SpaceExplorer, SpaceMouse, Spaceball5000
10
// devices, connecting to them as HID devices (USB).
12
// Exposes two VRPN device classes: Button and Analog.
13
// Analogs are mapped to the six channels, each in the range (-1..1).
15
// This is the base driver for the devices. The Navigator has
16
// only two buttons and has product ID 50726, the traveler has 8
17
// buttons and ID 50723. The derived classes just construct with
18
// the appropriate number of buttons and an acceptor for the proper
19
// product ID; the baseclass does all the work.
21
#if defined(VRPN_USE_HID)
22
class VRPN_API vrpn_3DConnexion: public vrpn_Button, public vrpn_Analog, protected vrpn_HidInterface {
24
vrpn_3DConnexion(vrpn_HidAcceptor *filter, unsigned num_buttons,
25
const char *name, vrpn_Connection *c = 0);
26
virtual ~vrpn_3DConnexion();
28
virtual void mainloop();
30
virtual void reconnect();
33
// Set up message handlers, etc.
34
void on_data_received(size_t bytes, vrpn_uint8 *buffer);
36
virtual void decodePacket(size_t bytes, vrpn_uint8 *buffer);
37
struct timeval _timestamp;
38
vrpn_HidAcceptor *_filter;
40
// Send report iff changed
41
void report_changes (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
42
// Send report whether or not changed
43
void report (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
44
// NOTE: class_of_service is only applied to vrpn_Analog
45
// values, not vrpn_Button or vrpn_Dial
48
class VRPN_API vrpn_3DConnexion: public vrpn_Button, public vrpn_Analog {
50
vrpn_3DConnexion(vrpn_HidAcceptor *filter, unsigned num_buttons,
51
const char *name, vrpn_Connection *c = 0);
52
virtual ~vrpn_3DConnexion();
54
virtual void mainloop();
57
struct timeval _timestamp;
58
vrpn_HidAcceptor *_filter;
61
// Send report iff changed
62
void report_changes(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
63
// Send report whether or not changed
64
void report(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
65
// NOTE: class_of_service is only applied to vrpn_Analog
66
// values, not vrpn_Button or vrpn_Dial
68
// There is a non-HID Linux-based driver for this device that has a capability
69
// not implemented in the HID interface.
70
#if defined(linux) && !defined(VRPN_USE_HID)
71
int set_led(int led_state);
76
class VRPN_API vrpn_3DConnexion_Navigator: public vrpn_3DConnexion {
78
vrpn_3DConnexion_Navigator(const char *name, vrpn_Connection *c = 0);
79
virtual ~vrpn_3DConnexion_Navigator() {};
84
class VRPN_API vrpn_3DConnexion_Traveler: public vrpn_3DConnexion {
86
vrpn_3DConnexion_Traveler(const char *name, vrpn_Connection *c = 0);
87
virtual ~vrpn_3DConnexion_Traveler() {};
92
class VRPN_API vrpn_3DConnexion_SpaceMouse: public vrpn_3DConnexion {
94
vrpn_3DConnexion_SpaceMouse(const char *name, vrpn_Connection *c = 0);
95
virtual ~vrpn_3DConnexion_SpaceMouse() {};
100
class VRPN_API vrpn_3DConnexion_SpaceExplorer: public vrpn_3DConnexion {
102
vrpn_3DConnexion_SpaceExplorer(const char *name, vrpn_Connection *c = 0);
103
virtual ~vrpn_3DConnexion_SpaceExplorer() {};
108
class VRPN_API vrpn_3DConnexion_SpaceBall5000: public vrpn_3DConnexion {
110
vrpn_3DConnexion_SpaceBall5000(const char *name, vrpn_Connection *c = 0);
111
virtual ~vrpn_3DConnexion_SpaceBall5000() {};
117
// end of VRPN_3DCONNEXION_H