vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Logitech_Controller_Raw.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stddef.h> // for size_t
4 
5 #include "vrpn_Analog.h" // for vrpn_Analog
6 #include "vrpn_BaseClass.h" // for vrpn_BaseClass
7 #include "vrpn_Button.h" // for vrpn_Button_Filter
8 #include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_USE_HID
9 #include "vrpn_Connection.h" // for vrpn_CONNECTION_LOW_LATENCY, etc
10 #include "vrpn_Dial.h" // for vrpn_Dial
11 #include "vrpn_HumanInterface.h" // for vrpn_HidAcceptor (ptr only), etc
12 #include "vrpn_Shared.h" // for timeval
13 #include "vrpn_Types.h" // for vrpn_uint8, vrpn_uint32
14 
15 #if defined(VRPN_USE_HID)
16 
17 // Device drivers for the Logitech Controller Raw USB line of products
18 // Currently supported: Extreme 3D Pro
19 //
20 // Exposes three major VRPN device classes: Button, Analog, Dial (as appropriate).
21 // All models expose Buttons for the keys on the device.
22 // Button 0 is the programming switch; it is set if the switch is in the "red" position.
23 //
24 
26 public:
27  vrpn_Logitech_Controller_Raw(vrpn_HidAcceptor *filter, const char *name, vrpn_Connection *c = 0);
28  virtual ~vrpn_Logitech_Controller_Raw(void);
29 
30  virtual void mainloop(void) = 0;
31 protected:
32  // Set up message handlers, etc.
33  void init_hid(void);
34  void on_data_received(size_t bytes, vrpn_uint8 *buffer);
35 
36  static int VRPN_CALLBACK on_connect(void *thisPtr, vrpn_HANDLERPARAM p);
37  static int VRPN_CALLBACK on_last_disconnect(void *thisPtr, vrpn_HANDLERPARAM p);
38 
39  virtual void decodePacket(size_t bytes, vrpn_uint8 *buffer) = 0;
40  struct timeval _timestamp;
42 
43  // No actual types to register, derived classes will be buttons, analogs, and/or dials
44  int register_types(void) { return (0); }
45 };
46 
48 {
49 public:
50  vrpn_Logitech_Extreme_3D_Pro(const char *name, vrpn_Connection *c = 0);
52 
53  virtual void mainloop(void);
54 protected:
55  // Send report iff changed
56  void report_changes (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
57  // Send report whether or not changed
58  void report (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
59 
60  void decodePacket(size_t bytes, vrpn_uint8 *buffer);
61 };
62 
63 // end of VRPN_USE_HID
64 #else
66 #endif
vrpn_Dial::report
virtual void report(void)
Definition: vrpn_Dial.C:82
vrpn_BaseClass.h
vrpn_Logitech_Controller_Raw::register_types
int register_types(void)
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.
Definition: vrpn_Logitech_Controller_Raw.h:44
vrpn_Button_Filter::report_changes
virtual void report_changes(void)
Definition: vrpn_Button.C:382
vrpn_Dial.h
vrpn_Types.h
vrpn_HidInterface
Definition: vrpn_HumanInterface.h:68
vrpn_Logitech_Controller_Raw::on_last_disconnect
static int VRPN_CALLBACK on_last_disconnect(void *thisPtr, vrpn_HANDLERPARAM p)
Definition: vrpn_Logitech_Controller_Raw.C:104
vrpn_Logitech_Controller_Raw::on_connect
static int VRPN_CALLBACK on_connect(void *thisPtr, vrpn_HANDLERPARAM p)
Definition: vrpn_Logitech_Controller_Raw.C:110
vrpn_Logitech_Controller_Raw::~vrpn_Logitech_Controller_Raw
virtual ~vrpn_Logitech_Controller_Raw(void)
Definition: vrpn_Logitech_Controller_Raw.C:87
vrpn_Analog
Definition: vrpn_Analog.h:28
vrpn_Logitech_Controller_Raw
Definition: vrpn_Logitech_Controller_Raw.h:25
vrpn_HidAcceptor
Definition: vrpn_HumanInterface.h:54
vrpn_Logitech_Controller_Raw::mainloop
virtual void mainloop(void)=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_Logitech_Controller_Raw::_filter
vrpn_HidAcceptor * _filter
Definition: vrpn_Logitech_Controller_Raw.h:41
vrpn_Logitech_Extreme_3D_Pro::~vrpn_Logitech_Extreme_3D_Pro
virtual ~vrpn_Logitech_Extreme_3D_Pro(void)
Definition: vrpn_Logitech_Controller_Raw.h:51
vrpn_CONNECTION_LOW_LATENCY
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
Definition: vrpn_Connection.h:122
vrpn_Logitech_Controller_Raw::vrpn_Logitech_Controller_Raw
vrpn_Logitech_Controller_Raw(vrpn_HidAcceptor *filter, const char *name, vrpn_Connection *c=0)
Definition: vrpn_Logitech_Controller_Raw.C:81
vrpn_Dial
Definition: vrpn_Dial.h:21
vrpn_HANDLERPARAM
This structure is what is passed to a vrpn_Connection message callback.
Definition: vrpn_Connection.h:44
vrpn_Shared.h
vrpn_Logitech_Controller_Raw::init_hid
void init_hid(void)
Definition: vrpn_Logitech_Controller_Raw.C:92
vrpn_Button.h
vrpn_HumanInterface.h
vrpn_Logitech_Controller_Raw::on_data_received
void on_data_received(size_t bytes, vrpn_uint8 *buffer)
Derived class reimplements this callback.
Definition: vrpn_Logitech_Controller_Raw.C:99
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition: vrpn_Connection.h:510
vrpn_Connection.h
vrpn_Logitech_Extreme_3D_Pro::decodePacket
void decodePacket(size_t bytes, vrpn_uint8 *buffer)
Definition: vrpn_Logitech_Controller_Raw.C:188
vrpn_Logitech_Extreme_3D_Pro::mainloop
virtual void mainloop(void)
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
Definition: vrpn_Logitech_Controller_Raw.C:134
vrpn_Logitech_Controller_Raw::decodePacket
virtual void decodePacket(size_t bytes, vrpn_uint8 *buffer)=0
vrpn_Analog.h
VRPN_CALLBACK
#define VRPN_CALLBACK
Definition: vrpn_Configure.h:647
vrpn_Logitech_Extreme_3D_Pro
Definition: vrpn_Logitech_Controller_Raw.h:47
vrpn_Configure.h
vrpn_Logitech_Extreme_3D_Pro::vrpn_Logitech_Extreme_3D_Pro
vrpn_Logitech_Extreme_3D_Pro(const char *name, vrpn_Connection *c=0)
Definition: vrpn_Logitech_Controller_Raw.C:119
VRPN_API
#define VRPN_API
Definition: vrpn_Configure.h:646
vrpn_BaseClass
Class from which all user-level (and other) classes that communicate with vrpn_Connections should der...
Definition: vrpn_BaseClass.h:313
vrpn_Button_Filter
All button servers should derive from this class, which provides the ability to turn any of the butto...
Definition: vrpn_Button.h:65
vrpn_Logitech_Controller_Raw::_timestamp
struct timeval _timestamp
Definition: vrpn_Logitech_Controller_Raw.h:40