vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Analog_USDigital_A2.h
Go to the documentation of this file.
1 // vrpn_Analog_USDigital_A2.C
2 //
3 // This is a driver for USDigital A2 Absolute Encoders.
4 // They can be daisy changed together, and utlimately, one or
5 // more plug into a serial port and communicate using RS-232.
6 // You can find out more at www.usdigital.com.
7 //
8 // To use this class, install the US Digital software, specifying
9 // the "SEI Explorer Demo Software" to install.
10 //
11 // Then uncomment the following line in vrpn_configure.h:
12 // #define VRPN_USE_USDIGITAL
13 //
14 // Note that because the 3rd party library is used, this class
15 // will only work under Windows.
16 //
17 // You must also include the following in your compilers include
18 // path for the 'vrpn' project:
19 // $(SYSTEMDRIVE)\Program Files\SEI Explorer
20 //
21 // Finally, the following must be included in vrpn.cfg to use
22 // the generic server:
23 //
24 // ################################################################################
25 // # US Digital A2 Absolute Encoder Analog Input server. This will open the COM
26 // # port specified, configure the number of channels specified, and report
27 // # Absolute Encoder values in tenths of a degree from 0 to 3599.
28 // #
29 // # Arguments:
30 // # char name_of_this_device[]
31 // # int COM_port. If 0, search for correct COM port.
32 // # int number_of_channels
33 // # int 0 to report always, 1 to report on change only (optional, default=0)
34 //
35 // vrpn_Analog_USDigital_A2 Analog0 0 2
36 //
37 // This code was written in October 2006 by Bill West, who
38 // used the vrpn_Analog_Server sample code written by
39 // Tom Hudson in March 1999 as a starting point. Bill also
40 // used some ideas from vrpn_Radamec_SPI.[Ch] written by
41 // Russ Taylor in August 2000.
42 #ifndef VRPN_ANALOG_USDIGITAL_A2_H
43 #define VRPN_ANALOG_USDIGITAL_A2_H
44 
45 #include "vrpn_Analog.h" // for vrpn_Analog
46 #include "vrpn_Configure.h" // for VRPN_API
47 #include "vrpn_Types.h" // for vrpn_uint32, vrpn_int32, etc
48 
50 
52 
53  public:
54 
55  // Constants used by this class
56  static const vrpn_uint32 vrpn_Analog_USDigital_A2_CHANNEL_MAX ;
57  static const vrpn_uint32 vrpn_Analog_USDigital_A2_FIND_PORT ;
58 
59  // Constructor
60  vrpn_Analog_USDigital_A2 (const char * name, vrpn_Connection * c,
61  vrpn_uint32 portNum=vrpn_Analog_USDigital_A2_FIND_PORT,
62  vrpn_uint32 numChannels=vrpn_Analog_USDigital_A2_CHANNEL_MAX,
63  vrpn_int32 reportOnChangeOnly=0) ;
64 
65  // Destructor
66  virtual ~vrpn_Analog_USDigital_A2() ;
67 
68  // Here's where the encoders are actually read
69  virtual void mainloop () ;
70 
71  private:
72  // Maintains whether the SEI bus has been opened or not
73  vrpn_bool _SEIopened ;
74 
75  // Addresses of the devices
76  long *_devAddr ;
77 
78  // Whether to report() or report_change() ;
79  vrpn_bool _reportChange ;
80 
81  // Actual number of devices (as opposed to channels)
82  vrpn_uint32 _numDevices ;
83 
85  vrpn_float64* channels (void) { return channel; }
86 
90  vrpn_int32 setNumChannels (vrpn_int32 sizeRequested);
91 };
92 
93 #endif // VRPN_ANALOG_USDIGITAL_A2_H
vrpn_Analog::channel
vrpn_float64 channel[vrpn_CHANNEL_MAX]
Definition: vrpn_Analog.h:38
vrpn_Types.h
vrpn_Analog
Definition: vrpn_Analog.h:28
vrpn_BaseClass::mainloop
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition: vrpn_Connection.h:510
vrpn_Analog_USDigital_A2::vrpn_Analog_USDigital_A2_CHANNEL_MAX
static const vrpn_uint32 vrpn_Analog_USDigital_A2_CHANNEL_MAX
Definition: vrpn_Analog_USDigital_A2.h:56
vrpn_Analog.h
vrpn_Configure.h
vrpn_Analog_USDigital_A2
Definition: vrpn_Analog_USDigital_A2.h:51
VRPN_API
#define VRPN_API
Definition: vrpn_Configure.h:646
vrpn_Analog_USDigital_A2::vrpn_Analog_USDigital_A2_FIND_PORT
static const vrpn_uint32 vrpn_Analog_USDigital_A2_FIND_PORT
Definition: vrpn_Analog_USDigital_A2.h:57