vrpn 07.35
Virtual Reality Peripheral Network
 
Loading...
Searching...
No Matches
vrpn_5DT16.h
Go to the documentation of this file.
1#ifndef vrpn_5dt16_H
2#define vrpn_5dt16_H
3
4#include "vrpn_Analog.h" // for vrpn_ANALOGCB, etc
5#include "vrpn_Configure.h" // for VRPN_API, VRPN_CALLBACK
6#include "vrpn_Connection.h" // for vrpn_CONNECTION_LOW_LATENCY, etc
7#include "vrpn_Shared.h" // for timeval
8#include "vrpn_Types.h" // for vrpn_uint32
9
10// This class will read the finger-pad values of the 5DT glove as analogs
11// and send them. Use the vrpn_Button_5DT_Server class below if you want
12// to turn them into buttons by thresholding them.
13
15{
16public:
17 vrpn_5dt16 (const char * name,
19 const char * port,
20 int baud = 19200);
21
23
25 virtual void mainloop ();
26
27 protected:
28 int _status; //< Reset, Syncing, or Reading
29 int _numchannels; //< How many analog channels to open
30 int _mode ; //< glove mode for reporting data (see glove manual)
31 unsigned _expected_chars; //< How many characters to expect in the report
32 unsigned char _buffer[512]; //< Buffer of characters in report
33 unsigned _bufcount; //< How many characters we have so far
34
35 struct timeval timestamp; //< Time of the last report from the device
36
37 virtual int reset(void); //< Set device back to starting config
38 virtual void get_report(void); //< Try to read a report from the device
39
40 virtual void clear_values(void); //< Clears all channels to 0
41
43 virtual void report_changes
44 (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
46 virtual void report
47 (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
48};
49
50#include "vrpn_Button.h" // for vrpn_Button_Filter
51
52// 5dt16 button server code. This device will listen to a 5dt16 analog server
53// and report button press and release event when the analog pass a threshold
54// value.
55// This class is derived from the vrpn_Button_Filter class, so that it
56// can be made to toggle its buttons using messages from the client.
58{
59public:
60 // Buttons are considered pressed when their analog value exceeds the
61 // threshold value.
62 vrpn_Button_5DT_Server(const char *name, const char *deviceName, vrpn_Connection *c,
63 double threshold[16]);
65
66 virtual void mainloop();
67
68protected:
69 static void VRPN_CALLBACK handle_analog_update (void * userdata, const vrpn_ANALOGCB info);
71 double m_threshold[16];
72};
73
74#endif
75
vrpn_5dt16(const char *name, vrpn_Connection *c, const char *port, int baud=19200)
Definition vrpn_5DT16.C:36
virtual void get_report(void)
Definition vrpn_5DT16.C:136
virtual int reset(void)
Definition vrpn_5DT16.C:75
unsigned _expected_chars
Definition vrpn_5DT16.h:31
unsigned _bufcount
Definition vrpn_5DT16.h:33
unsigned char _buffer[512]
Definition vrpn_5DT16.h:32
struct timeval timestamp
Definition vrpn_5DT16.h:35
int _numchannels
Definition vrpn_5DT16.h:29
virtual void clear_values(void)
Definition vrpn_5DT16.C:59
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
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
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_Button_5DT_Server(const char *name, const char *deviceName, vrpn_Connection *c, double threshold[16])
Definition vrpn_5DT16.C:307
vrpn_Analog_Remote * d_5dt_button
Definition vrpn_5DT16.h:70
static void VRPN_CALLBACK handle_analog_update(void *userdata, const vrpn_ANALOGCB info)
Definition vrpn_5DT16.C:331
vrpn_Button_Filter(const char *, vrpn_Connection *c=NULL)
Generic connection class not specific to the transport mechanism.
vrpn_Serial_Analog(const char *name, vrpn_Connection *connection, const char *port, int baud=9600, int bits=8, vrpn_SER_PARITY parity=vrpn_SER_PARITY_NONE, bool rts_flow=false)
#define VRPN_API
#define VRPN_CALLBACK
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY