vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Joywin32.h
Go to the documentation of this file.
1 /*
2 # Joystick VRPN Driver based on Win32.
3 # written by Sebastien MARAUX, ONDIM SA (France)
4 # maraux@ondim.fr
5 */
6 
7 #ifndef VRPN_WIN32JOYSTICK_H
8 #define VRPN_WIN32JOYSTICK_H
9 
10 #if defined(_WIN32)
11 
12 #include "vrpn_Analog.h"
13 #include "vrpn_Button.h"
14 
15 #include <basetsd.h>
16 #include <mmsystem.h>
17 
18 class VRPN_API vrpn_Joywin32: public vrpn_Analog, public vrpn_Button_Filter
19 {
20 public:
21  vrpn_Joywin32 (const char * name, vrpn_Connection * c, vrpn_uint8 joyNumber = 1, vrpn_float64 readRate = 60, vrpn_uint8 mode = 0, vrpn_int32 deadzone = 0);
22 
23  //~vrpn_Joywin32 ();
24 
25  // Called once through each main loop iteration to handle
26  // updates.
27  virtual void mainloop ();
28 
29 protected:
30  int _status;
31  vrpn_uint8 _mode; // raw data , 0;1 or -1;1 normalized data for axes
32 
33  struct timeval _timestamp; // Time of the last report from the device
34  vrpn_float64 _read_rate; // How many times per second to read the device
35  vrpn_float64 _deadzone; // apply a dead zone to analog inputs
36 
37  virtual vrpn_int32 get_report(void); // Try to read a report from the device
38  void clear_values(void); // Clear the Analog and Button values
39  void init_joystick(void); // try to (re-)initialize the joystick
40 
41  // send report iff changed
42  virtual void report_changes (vrpn_uint32 class_of_service
44  // send report whether or not changed
45  virtual void report (vrpn_uint32 class_of_service
47 
48  vrpn_uint32 _numbuttons; // How many buttons
49  vrpn_uint32 _numchannels; // How many analog channels
50 
51  vrpn_uint8 _joyNumber;
52  struct timeval last_error_report; // When the last error report was sent
53 
54  // joystick caps
55  JOYCAPS _jc;
56 };
57 #endif
58 #endif
59 
vrpn_Analog::report
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
vrpn_Analog
Definition: vrpn_Analog.h:28
vrpn_CONNECTION_LOW_LATENCY
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
Definition: vrpn_Connection.h:122
vrpn_Button.h
vrpn_BaseClass::mainloop
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition: vrpn_Connection.h:510
vrpn_Analog.h
vrpn_Analog::report_changes
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
VRPN_API
#define VRPN_API
Definition: vrpn_Configure.h:646
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