RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_5DT16.h
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
14class VRPN_API vrpn_5dt16: public vrpn_Serial_Analog
15{
16public:
17 vrpn_5dt16 (const char * name,
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.
58{
59public:
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]);
65
66 virtual void mainloop();
67
68protected:
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.h:15
virtual void mainloop()
Called once through each main loop iteration to handle updates.
virtual void report(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
send report whether or not changed
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
send report iff changed
定义 vrpn_Analog.h:181
定义 vrpn_5DT16.h:58
virtual void mainloop()
定义 vrpn_Button.h:66
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562
定义 vrpn_Analog.h:63
定义 vrpn_Analog.h:168