vrpn
07.35
Virtual Reality Peripheral Network
Toggle main menu visibility
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
14
class
VRPN_API
vrpn_5dt16
:
public
vrpn_Serial_Analog
15
{
16
public
:
17
vrpn_5dt16
(
const
char
* name,
18
vrpn_Connection
* c,
19
const
char
* port,
20
int
baud = 19200);
21
22
~vrpn_5dt16
() {};
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.
57
class
VRPN_API
vrpn_Button_5DT_Server
:
public
vrpn_Button_Filter
58
{
59
public
:
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]);
64
~vrpn_Button_5DT_Server
();
65
66
virtual
void
mainloop
();
67
68
protected
:
69
static
void
VRPN_CALLBACK
handle_analog_update
(
void
*
userdata
,
const
vrpn_ANALOGCB
info);
70
vrpn_Analog_Remote
*
d_5dt_button
;
71
double
m_threshold
[16];
72
};
73
74
#endif
75
vrpn_5dt16::vrpn_5dt16
vrpn_5dt16(const char *name, vrpn_Connection *c, const char *port, int baud=19200)
Definition
vrpn_5DT16.C:36
vrpn_5dt16::get_report
virtual void get_report(void)
Definition
vrpn_5DT16.C:136
vrpn_5dt16::reset
virtual int reset(void)
Definition
vrpn_5DT16.C:75
vrpn_5dt16::_expected_chars
unsigned _expected_chars
Definition
vrpn_5DT16.h:31
vrpn_5dt16::_status
int _status
Definition
vrpn_5DT16.h:28
vrpn_5dt16::_bufcount
unsigned _bufcount
Definition
vrpn_5DT16.h:33
vrpn_5dt16::_mode
int _mode
Definition
vrpn_5DT16.h:30
vrpn_5dt16::_buffer
unsigned char _buffer[512]
Definition
vrpn_5DT16.h:32
vrpn_5dt16::~vrpn_5dt16
~vrpn_5dt16()
Definition
vrpn_5DT16.h:22
vrpn_5dt16::timestamp
struct timeval timestamp
Definition
vrpn_5DT16.h:35
vrpn_5dt16::_numchannels
int _numchannels
Definition
vrpn_5DT16.h:29
vrpn_5dt16::clear_values
virtual void clear_values(void)
Definition
vrpn_5DT16.C:59
vrpn_Analog_Remote
Definition
vrpn_Analog.h:181
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::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_BaseClassUnique::userdata
void * userdata
Definition
vrpn_BaseClass.h:290
vrpn_BaseClass::mainloop
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_Button_5DT_Server::vrpn_Button_5DT_Server
vrpn_Button_5DT_Server(const char *name, const char *deviceName, vrpn_Connection *c, double threshold[16])
Definition
vrpn_5DT16.C:307
vrpn_Button_5DT_Server::d_5dt_button
vrpn_Analog_Remote * d_5dt_button
Definition
vrpn_5DT16.h:70
vrpn_Button_5DT_Server::handle_analog_update
static void VRPN_CALLBACK handle_analog_update(void *userdata, const vrpn_ANALOGCB info)
Definition
vrpn_5DT16.C:331
vrpn_Button_5DT_Server::m_threshold
double m_threshold[16]
Definition
vrpn_5DT16.h:71
vrpn_Button_Filter::vrpn_Button_Filter
vrpn_Button_Filter(const char *, vrpn_Connection *c=NULL)
Definition
vrpn_Button.C:129
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition
vrpn_Connection.h:561
vrpn_Serial_Analog::vrpn_Serial_Analog
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)
Definition
vrpn_Analog.C:124
vrpn_ANALOGCB
Definition
vrpn_Analog.h:168
vrpn_Analog.h
vrpn_Button.h
vrpn_Configure.h
VRPN_API
#define VRPN_API
Definition
vrpn_Configure.h:648
VRPN_CALLBACK
#define VRPN_CALLBACK
Definition
vrpn_Configure.h:649
vrpn_Connection.h
vrpn_CONNECTION_LOW_LATENCY
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
Definition
vrpn_Connection.h:120
vrpn_Shared.h
vrpn_Types.h
vrpn_5DT16.h
Generated by
1.17.0