vrpn 07.35
Virtual Reality Peripheral Network
Loading...
Searching...
No Matches
vrpn_DevInput.h
Go to the documentation of this file.
1#ifndef VRPN_DEV_INPUT_H
2#define VRPN_DEV_INPUT_H
3
5// This file contains a distillation of the various DevInput classes that had
6// been spread throughout VRPN. The interfaces have been rationalized, so
7// that they are the same between operating systems and are factored into
8// independent interfaces.
10
11/* file: vrpn_DevInput.h
12 * author: Damien Touraine vrpn-python@limsi.fr 2012-06-20
13 * copyright: (C) 2012 Damien TOUraine
14 * license: Released to the Public Domain.
15 * depends: VRPN 07_30
16 * tested on: Linux w/ gcc 4.6.1
17 * references:
18*/
19
21// vrpn_DevInput is a VRPN server class to publish events from the PC's input.
22// It provides a many channels or buttons provided by mice, keyboards and whatever HID device that can be connected found in the /dev/input/event*.
23//
24// vrpn_DevInput makes it easy to use the diverse array of commodity input
25// devices that are managed by Linux through /proc/bus/input/devices
26//
27// vrpn_DevInput can be run from X-window term or console.
28//
29// Beware that keyboards are not mapped in locale setting (ie. regional keyboards)
31
32#include "vrpn_Analog.h" // for vrpn_Analog
33#include "vrpn_Button.h" // for vrpn_Button_Filter
34#include "vrpn_Configure.h" // for VRPN_API, etc
35#include "vrpn_Connection.h" // for vrpn_CONNECTION_LOW_LATENCY, etc
36#include "vrpn_Shared.h" // for timeval
37#include "vrpn_Types.h" // for vrpn_float64, vrpn_uint32
38
39#ifdef VRPN_USE_DEV_INPUT
40
41class VRPN_API vrpn_DevInput :
42 public vrpn_Analog,
44{
45 enum DEVICE_TYPE { DEVICE_KEYBOARD, DEVICE_MOUSE_RELATIVE, DEVICE_MOUSE_ABSOLUTE } d_type;
46
47public:
48 vrpn_DevInput( const char* name, vrpn_Connection* cxn, const char *device, const char *type, int mouse_length );
49 virtual ~vrpn_DevInput();
50
51 virtual void mainloop();
52
53protected: // methods
56 virtual int get_report();
57
59 virtual void report_changes( vrpn_uint32 class_of_service
61
63 virtual void report( vrpn_uint32 class_of_service
65
66protected: // data
67 struct timeval timestamp;
68
69private: // disable unwanted default methods
70 vrpn_DevInput();
71 vrpn_DevInput(const vrpn_DevInput&);
72 const vrpn_DevInput& operator=(const vrpn_DevInput&);
73
74 private:
75 int d_fileDescriptor;
76 vrpn_float64 d_absolute_min;
77 vrpn_float64 d_absolute_range;
78};
79
80#endif
81
82#endif
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 ...
All button servers should derive from this class, which provides the ability to turn any of the butto...
Definition: vrpn_Button.h:66
Generic connection class not specific to the transport mechanism.
#define VRPN_API
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY