vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Button_NI_DIO24.h
Go to the documentation of this file.
1 // vrpn_Button_NI_DIO24.h
2 //
3 // This is a driver for National Instruments DAQCard
4 // DIO-24, a PCMCIA card, which provides 24-bit digital I/O.
5 // The I/O is accessed in 3 "ports" with 8 bits per port,
6 // though the user is protected from that detail. The
7 // user of this class need only request inputs 1 through 24.
8 //
9 // Unlike the other National Instrument devices currently
10 // in vrpn, this uses their new "mx" library. To access
11 // that library, install their software from the NI-DAQmx
12 // CD. Then uncomment the following line in vrpn_configure.h:
13 // #define VRPN_USE_NATIONAL_INSTRUMENTS_MX
14 //
15 // Note that because the 3rd party library is used, this class
16 // will only work under Windows.
17 //
18 // You must also include the following in your compilers include
19 // path for the 'vrpn' and 'vrpn_server' projects:
20 // $(SYSTEMDRIVE)\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C DEV\include
21 //
22 // Finally, the following must be included in vrpn.cfg to use
23 // the generic server:
24 //
25 // ################################################################################
26 // # This is a driver for National Instruments DAQCard-
27 // # DIO-24, a PCMCIA card, which provides 24-bit digital I/O.
28 // #
29 // # Arguments:
30 // # char name_of_this_device[]
31 // # int number_of_channls to read: 1-24 (optional. default=24)
32 //
33 // vrpn_Button_NI_DIO24 Button0 1
34 //
35 // This code was written in October 2006 by Bill West, based on some example
36 // code provided by National Instruments.
37 
38 #ifndef VRPN_BUTTON_NI_DIO24_H
39 #define VRPN_BUTTON_NI_DIO24_H
40 
41 #include "vrpn_Button.h" // for vrpn_Button_Filter
42 #include "vrpn_Configure.h" // for VRPN_API
43 #include "vrpn_Types.h" // for vrpn_int32
44 
46 #ifdef VRPN_USE_NATIONAL_INSTRUMENTS_MX
47 #include <NIDAQmx.h>
48 #endif
49 
51 
52  public:
53 
54  // Public constant used by this class
55  static const vrpn_int32 vrpn_Button_NI_DIO24_CHANNEL_MAX ;
56 
57  // Constructor
58  vrpn_Button_NI_DIO24 (const char * name, vrpn_Connection * c,
59  vrpn_int32 numChannels=vrpn_Button_NI_DIO24_CHANNEL_MAX) ;
60 
61  // Destructor
62  virtual ~vrpn_Button_NI_DIO24() ;
63 
64  // Here's where the buttons are actually read
65  virtual void mainloop () ;
66 
67  private:
68  // Addresses of the devices
69 #ifdef VRPN_USE_NATIONAL_INSTRUMENTS_MX
70  TaskHandle _taskHandle ;
71 #endif
72 
75  vrpn_int32 setNumChannels (vrpn_int32 sizeRequested);
76 
77  // THis handles error reporting, and halts the
78  // program if the error is irrecoverable
79 #ifdef VRPN_USE_NATIONAL_INSTRUMENTS_MX
80  void reportError(int32 errnumber, vrpn_bool exitProgram) ;
81 #endif // def(_WIN32) || def(WIN32)
82 };
83 
84 #endif // VRPN_BUTTON_NI_DIO24_H
vrpn_Button_NI_DIO24
Definition: vrpn_Button_NI_DIO24.h:50
vrpn_Types.h
vrpn_Button_NI_DIO24::vrpn_Button_NI_DIO24_CHANNEL_MAX
static const vrpn_int32 vrpn_Button_NI_DIO24_CHANNEL_MAX
Definition: vrpn_Button_NI_DIO24.h:55
vrpn_Button.h
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_Configure.h
VRPN_API
#define VRPN_API
Definition: vrpn_Configure.h:646
vrpn_Button_Filter
All button servers should derive from this class, which provides the ability to turn any of the butto...
Definition: vrpn_Button.h:65