vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Dyna.h
Go to the documentation of this file.
1 #ifndef INCLUDED_DYNA
2 #define INCLUDED_DYNA
3 
4 #include "vrpn_Configure.h" // for VRPN_API
5 #include "vrpn_Serial.h"
6 #include "vrpn_Tracker.h" // for vrpn_Tracker_Serial
7 
9 
10 // only 13 receivers allowed in normal addressing mode
11 #define VRPN_DYNA_MAX_SENSORS 13
12 
13 // This is a class which provides a server for an ascension
14 // DynaSight. The server will send out messages
15 // The timestamp is the time when the first character was read
16 // from the serial driver with "read". No adjustment is currently
17 // made to this time stamp.
18 
19 // If this is running on a non-linux system, then the serial port driver
20 // is probably adding more latency -- see the vrpn README for more info.
21 
23 private:
24  unsigned reportLength;
25  unsigned totalReportLength;
26 
27  public:
28 
29  vrpn_Tracker_Dyna(char *name, vrpn_Connection *c, int cSensors=1,
30  const char *port = "/dev/ttyd3", long baud = 38400);
31 
32  virtual ~vrpn_Tracker_Dyna();
33 
34 private:
35  void my_flush() {
36  // clear the input data buffer
37  unsigned char foo[128];
38  while (vrpn_read_available_characters(serial_fd, foo, 1) > 0) ;
39  }
40  int valid_report();
41  int decode_record();
42  int get_status();
43  protected:
44 
45  virtual int get_report(void);
46  virtual void reset();
47  void printError(unsigned char uchErrCode, unsigned char uchExpandedErrCode);
48  int checkError();
49  int cResets;
50  int cSensors;
51 };
52 
53 
54 #endif
virtual int get_report(void)=0
Gets a report if one is available, returns 0 if not, 1 if complete report.
virtual void reset(void)=0
Reset the tracker.
vrpn_Serial: Pulls all the serial port routines into one file to make porting to new operating system...
Generic connection class not specific to the transport mechanism.
#define VRPN_API
int vrpn_read_available_characters(int comm, unsigned char *buffer, size_t bytes)
Definition: vrpn_Serial.C:512