vrpn 07.35
Virtual Reality Peripheral Network
Loading...
Searching...
No Matches
vrpn_Tng3.h
Go to the documentation of this file.
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
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
28
29 // Called once through each main loop iteration to handle
30 // updates.
31 virtual void mainloop (void);
32
33 protected:
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)
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.
unsigned _num_read
Definition vrpn_Tng3.h:38
int _status
Definition vrpn_Tng3.h:34
unsigned _expected_chars
Definition vrpn_Tng3.h:39
int _numbuttons
Definition vrpn_Tng3.h:35
unsigned _bufcount
Definition vrpn_Tng3.h:41
int _numchannels
Definition vrpn_Tng3.h:36
#define VRPN_API
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY