RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_Tng3.h
1#ifndef VRPN_TNG3B_H
2#define VRPN_TNG3B_H
3#include "vrpn_Analog.h" // for vrpn_Serial_Analog
4#include "vrpn_Button.h" // for vrpn_Button_Filter
5#include "vrpn_Configure.h" // for VRPN_API
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// TNG stands for "Totally Neat Gadget."
11// The TNG3 is an interface device from Mindtel <www.mindtel.com>.
12// It is powered by the serial control lines and offers 8 digital
13// and 8 analog inputs. It costs about $150.
14// Written by Rob King at Navy Research Labs.
15
16class VRPN_API vrpn_Tng3: public vrpn_Serial_Analog,
18{
19 public:
20 vrpn_Tng3 (const char * name,
22 const char * port,
23 int baud = 19200, // only speed
24 const int numbuttons = 8,
25 const int numchannels = 8);
26
27 ~vrpn_Tng3 () {};
28
29 // Called once through each main loop iteration to handle
30 // updates.
31 virtual void mainloop (void);
32
33 protected:
34 int _status;
35 int _numbuttons; // How many buttons to open
36 int _numchannels; // How many analog channels to open
37
38 unsigned _num_read; // How many characters have been read on this report?
39 unsigned _expected_chars; // How many characters to expect in the report
40 unsigned char _buffer[512]; // Buffer of characters in report
41 unsigned _bufcount; // How many characters we have so far
42
43 struct timeval _timestamp; // Time of the last report from the device
44
45 virtual void clear_values(void); // Set all buttons, analogs back to 0
46 virtual int reset(void); // Set device back to starting config
47 virtual int get_report(void); // Try to read a report from the device
48
49 // send report iff changed
50 virtual void report_changes (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
51 // send report whether or not changed
52 virtual void report (vrpn_uint32 class_of_service = vrpn_CONNECTION_LOW_LATENCY);
53
54 // NOTE: class_of_service is only applied to vrpn_Analog
55 // values, not vrpn_Button or vrpn_Dial
56
57 private:
58
59// utility routine to sync up the data stream
60 int syncDatastream (double seconds);
61
62 unsigned char bDataPacketStart;
63};
64
65#endif
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)
定义 vrpn_Button.h:66
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562
定义 vrpn_Analog.h:63
定义 vrpn_Tng3.h:18
virtual void mainloop(void)