vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Analog_5dtUSB.h
Go to the documentation of this file.
1 
14 #ifndef VRPN_ANALOG_5DTUSB_H
15 #define VRPN_ANALOG_5DTUSB_H
16 
17 #include <stddef.h> // for size_t
18 #include <string> // for string
19 
20 #include "vrpn_Analog.h" // for vrpn_Analog
21 #include "vrpn_Configure.h" // for VRPN_API, VRPN_USE_HID
22 #include "vrpn_Connection.h" // for vrpn_Connection (ptr only), etc
23 #include "vrpn_HumanInterface.h" // for vrpn_HIDDEVINFO, etc
24 #include "vrpn_Shared.h" // for timeval
25 #include "vrpn_Types.h" // for vrpn_uint16, vrpn_uint32, etc
26 
27 #if defined(VRPN_USE_HID)
28 
52  public:
54  virtual ~vrpn_Analog_5dtUSB();
55 
57  virtual void mainloop();
58 
61  std::string get_description() const;
62 
64  bool isLeftHand() const { return _isLeftHand; }
65 
67  bool isRightHand() const { return !_isLeftHand; }
68 
69  protected:
71  vrpn_Analog_5dtUSB(vrpn_HidAcceptor *filter, int num_sensors,
72  bool isLeftHand, const char *name, vrpn_Connection *c = 0);
74  void on_data_received(size_t bytes, vrpn_uint8 *buffer);
75 
77  struct timeval _timestamp;
78 
81  double _rawVals[16];
82 
85 
90 
92  void report_changes(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
94  void report(vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
95 };
96 
99  public:
100  vrpn_Analog_5dtUSB_Glove5Left(const char *name, vrpn_Connection *c = 0);
102 };
103 
106  public:
107  vrpn_Analog_5dtUSB_Glove5Right(const char *name, vrpn_Connection *c = 0);
109 };
110 
114  public:
115  vrpn_Analog_5dtUSB_Glove14Left(const char *name, vrpn_Connection *c = 0);
117 };
118 
122  public:
123  vrpn_Analog_5dtUSB_Glove14Right(const char *name, vrpn_Connection *c = 0);
125 };
126 
130  public:
131  vrpn_HidProductMaskAcceptor(vrpn_uint16 vendorId, vrpn_uint16 productMask = 0x0000, vrpn_uint16 desiredProduct = 0x0000) :
132  vendor(vendorId),
133  product(desiredProduct),
134  mask(productMask) {}
135 
137 
138  bool accept(const vrpn_HIDDEVINFO &device) {
139  return (device.vendor == vendor) && ((device.product & mask) == (product & mask));
140  }
141  private:
142  vrpn_uint16 vendor;
143  vrpn_uint16 product;
144  vrpn_uint16 mask;
145 };
146 
147 #endif // end of ifdef VRPN_USE_HID
148 
149 // end of VRPN_ANALOG_5DTUSB_H
150 #endif
151 
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
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
bool accept(const vrpn_HIDDEVINFO &device)
bool isLeftHand() const
Accessor to know if this is a left hand glove.
Specialization of vrpn_Analog_5dtUSB for a 5-sensor, right-hand glove.
bool _isLeftHand
Flag for left handedness.
virtual void on_data_received(size_t bytes, vrpn_uint8 *buffer)=0
Derived class reimplements this callback.
bool isRightHand() const
Accessor to know if this is a right hand glove.
bool _wasConnected
Flag indicating whether we were connected last time through the mainloop. Used to send a "normal"-sev...
Generic connection class not specific to the transport mechanism.
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
5th Dimension Technologies (5dt) "Ultra" USB data glove driver
Specialization of vrpn_Analog_5dtUSB for a 14-sensor, right-hand glove. Not tested as of 8-Mar-2011 b...
HID acceptor subclass used by vrpn_Analog_5dtUSB since the bits of the product ID for these devices d...
#define VRPN_API
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
Specialization of vrpn_Analog_5dtUSB for a 14-sensor, left-hand glove. Not tested as of 8-Mar-2011 be...
vrpn_HidProductMaskAcceptor(vrpn_uint16 vendorId, vrpn_uint16 productMask=0x0000, vrpn_uint16 desiredProduct=0x0000)
Specialization of vrpn_Analog_5dtUSB for a 5-sensor, left-hand glove.