vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Event.h
Go to the documentation of this file.
1 /**************************************************************************************************/
2 /* */
3 /* Copyright (C) 2004 Bauhaus University Weimar */
4 /* Released into the public domain on 6/23/2007 as part of the VRPN project */
5 /* by Jan P. Springer. */
6 /* */
7 /*************************************************************************************************/
8 /* */
9 /* module : vrpn_Event.h */
10 /* project : */
11 /* description: provide functionality for event interface */
12 /* */
13 /**************************************************************************************************/
14 
15 #ifndef _VRPN_EVENT_H_
16 #define _VRPN_EVENT_H_
17 
18 #include "vrpn_Shared.h" // For struct timeval
19 
20 namespace vrpn_Event {
21 
22  // the struct read by the system when reading
23  struct input_event {
24 
25  struct timeval time;
26  unsigned short type;
27  unsigned short code;
28  unsigned int value;
29  };
30 
31  // open the specified event interface
32  // return a valid handle to the event interface or -1 if the open fails
33  // file - full path of the event interface file
34  int vrpn_open_event( const char* file);
35 
36  // close the event interface
37  // fd - handle to the event interface
38  void vrpn_close_event( const int fd);
39 
40  // read from the interface
41  // returns the number of bytes read successfully
42  // fd - handle for the event interface
43  // data - handle to the read data
44  // max_elements - maximum number of elements to read
45  int vrpn_read_event( int fd,
46  input_event * data,
47  int max_elements);
48 }
49 
50 #endif // _VRPN_EVENT_H_
int vrpn_open_event(const char *file)
Definition: vrpn_Event.C:33
struct timeval time
Definition: vrpn_Event.h:25
unsigned short code
Definition: vrpn_Event.h:27
unsigned int value
Definition: vrpn_Event.h:28
void vrpn_close_event(const int fd)
Definition: vrpn_Event.C:51
unsigned short type
Definition: vrpn_Event.h:26
int vrpn_read_event(int fd, input_event *data, int max_elements)
Definition: vrpn_Event.C:68