RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_DevInput.h
1#ifndef VRPN_DEV_INPUT_H
2#define VRPN_DEV_INPUT_H
3
4///////////////////////////////////////////////////////////////////////////
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.
9///////////////////////////////////////////////////////////////////////////
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
20///////////////////////////////////////////////////////////////////////////
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)
30///////////////////////////////////////////////////////////////////////////
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
54 /// Try to read reports from the device.
55 /// Returns 1 if msg received, or 0 if none received.
56 virtual int get_report();
57
58 /// send report iff changed
59 virtual void report_changes( vrpn_uint32 class_of_service
60 = vrpn_CONNECTION_LOW_LATENCY );
61
62 /// send report whether or not changed
63 virtual void report( vrpn_uint32 class_of_service
64 = vrpn_CONNECTION_LOW_LATENCY );
65
66protected: // data
67 struct timeval timestamp; ///< time of last report from device
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
定义 vrpn_Analog.h:28
virtual void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
virtual void mainloop()=0
定义 vrpn_Button.h:66
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562