vrpn
07.35
Virtual Reality Peripheral Network
Toggle main menu visibility
Loading...
Searching...
No Matches
vrpn_CerealBox.h
Go to the documentation of this file.
1
#ifndef VRPN_CEREALBOX_H
2
#define VRPN_CEREALBOX_H
3
4
#include "
vrpn_Analog.h
"
// for vrpn_Serial_Analog
5
#include "
vrpn_Button.h
"
// for vrpn_Button_Filter
6
#include "
vrpn_Configure.h
"
// for VRPN_API
7
#include "
vrpn_Connection.h
"
// for vrpn_CONNECTION_LOW_LATENCY, etc
8
#include "
vrpn_Dial.h
"
// for vrpn_Dial
9
#include "
vrpn_Shared.h
"
// for timeval
10
#include "
vrpn_Types.h
"
// for vrpn_uint32
11
12
class
VRPN_API
vrpn_CerealBox
:
public
vrpn_Serial_Analog
13
,
public
vrpn_Button_Filter
14
,
public
vrpn_Dial
15
{
16
public
:
17
vrpn_CerealBox
(
const
char
* name,
vrpn_Connection
* c,
18
const
char
* port,
int
baud,
19
const
int
numbuttons,
const
int
numchannels,
const
int
numencoders);
20
21
~vrpn_CerealBox
() {};
22
23
// Called once through each main loop iteration to handle
24
// updates.
25
virtual
void
mainloop
();
26
27
protected
:
28
int
_status
;
29
int
_numbuttons
;
// How many buttons to open
30
int
_numchannels
;
// How many analog channels to open
31
int
_numencoders
;
// How many encoders to open
32
33
unsigned
_expected_chars
;
// How many characters to expect in the report
34
unsigned
char
_buffer
[512];
// Buffer of characters in report
35
unsigned
_bufcount
;
// How many characters we have so far
36
37
struct
timeval
timestamp
;
// Time of the last report from the device
38
39
virtual
void
clear_values
(
void
);
// Set all buttons, analogs and encoders back to 0
40
virtual
int
reset
(
void
);
// Set device back to starting config
41
virtual
int
get_report
(
void
);
// Try to read a report from the device
42
43
// send report iff changed
44
virtual
void
report_changes
45
(vrpn_uint32 class_of_service
46
=
vrpn_CONNECTION_LOW_LATENCY
);
47
// send report whether or not changed
48
virtual
void
report
49
(vrpn_uint32 class_of_service
50
=
vrpn_CONNECTION_LOW_LATENCY
);
51
52
// NOTE: class_of_service is only applied to vrpn_Analog
53
// values, not vrpn_Button or vrpn_Dial
54
};
55
56
#endif
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_BaseClass::mainloop
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_Button_Filter::vrpn_Button_Filter
vrpn_Button_Filter(const char *, vrpn_Connection *c=NULL)
Definition
vrpn_Button.C:129
vrpn_CerealBox::vrpn_CerealBox
vrpn_CerealBox(const char *name, vrpn_Connection *c, const char *port, int baud, const int numbuttons, const int numchannels, const int numencoders)
Definition
vrpn_CerealBox.C:39
vrpn_CerealBox::reset
virtual int reset(void)
Definition
vrpn_CerealBox.C:100
vrpn_CerealBox::_buffer
unsigned char _buffer[512]
Definition
vrpn_CerealBox.h:34
vrpn_CerealBox::_numencoders
int _numencoders
Definition
vrpn_CerealBox.h:31
vrpn_CerealBox::_numchannels
int _numchannels
Definition
vrpn_CerealBox.h:30
vrpn_CerealBox::clear_values
virtual void clear_values(void)
Definition
vrpn_CerealBox.C:81
vrpn_CerealBox::_status
int _status
Definition
vrpn_CerealBox.h:28
vrpn_CerealBox::_expected_chars
unsigned _expected_chars
Definition
vrpn_CerealBox.h:33
vrpn_CerealBox::_bufcount
unsigned _bufcount
Definition
vrpn_CerealBox.h:35
vrpn_CerealBox::_numbuttons
int _numbuttons
Definition
vrpn_CerealBox.h:29
vrpn_CerealBox::~vrpn_CerealBox
~vrpn_CerealBox()
Definition
vrpn_CerealBox.h:21
vrpn_CerealBox::get_report
virtual int get_report(void)
Definition
vrpn_CerealBox.C:260
vrpn_CerealBox::timestamp
struct timeval timestamp
Definition
vrpn_CerealBox.h:37
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition
vrpn_Connection.h:561
vrpn_Dial::vrpn_Dial
vrpn_Dial(const char *name, vrpn_Connection *c=NULL)
Definition
vrpn_Dial.C:8
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_Analog.h
vrpn_Button.h
vrpn_Configure.h
VRPN_API
#define VRPN_API
Definition
vrpn_Configure.h:648
vrpn_Connection.h
vrpn_CONNECTION_LOW_LATENCY
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
Definition
vrpn_Connection.h:120
vrpn_Dial.h
vrpn_Shared.h
vrpn_Types.h
vrpn_CerealBox.h
Generated by
1.17.0