41#ifdef VRPN_USE_NATIONAL_INSTRUMENTS_MX
46typedef vrpn_int32 int32;
56 vrpn_int32 numChannels) :
61 this->setNumChannels( numChannels );
65 fprintf(stderr,
"vrpn_Button_NI_DIO24: Can't get connection!\n");
69#ifdef VRPN_USE_NATIONAL_INSTRUMENTS_MX
72 fprintf(stderr,
"vrpn_Button_NI_DIO24::vrpn_Button_NI_DIO24(): Not compiled into VRPN, edit vrpn_Configure.h and define VRPN_USE_NATIONAL_INSTRUMENTS_MX and then recompile VRPN.\n");
82#ifdef VRPN_USE_NATIONAL_INSTRUMENTS_MX
87 error = DAQmxCreateDIChan(_taskHandle,portName,
"",DAQmx_Val_ChanForAllLines);
102#ifdef VRPN_USE_NATIONAL_INSTRUMENTS_MX
104 error = DAQmxStartTask(_taskHandle);
108 reportError(error, vrpn_true) ;
116#ifdef VRPN_USE_NATIONAL_INSTRUMENTS_MX
122 DAQmxStopTask(_taskHandle);
123 DAQmxClearTask(_taskHandle);
145#ifdef VRPN_USE_NATIONAL_INSTRUMENTS_MX
147 int32 bytesRead,bytesPerSamp;
148 error = DAQmxReadDigitalLines(_taskHandle,1,5.0,DAQmx_Val_GroupByChannel,
150 &bytesPerSamp,&bytesRead,NULL);
155 "vrpn_Button_NI_DIO24: Warning, number of bytes read was %d, not %d as expected.\n",
159 reportError(error, vrpn_false) ;
167vrpn_int32 vrpn_Button_NI_DIO24::setNumChannels (vrpn_int32 sizeRequested)
183#ifdef VRPN_USE_NATIONAL_INSTRUMENTS_MX
184void vrpn_Button_NI_DIO24::reportError(int32 errnumber, vrpn_bool exitProgram)
186 char errBuff[2048]={
'\0'};
188 if( DAQmxFailed(errnumber) )
190 DAQmxGetExtendedErrorInfo(errBuff,2048);
191 printf(
"DAQmx Error: %s\n",errBuff);
192 if (exitProgram==vrpn_true)
194 printf(
"Exiting...\n") ;
199 printf(
"Sleeping...\n") ;
vrpn_Connection * d_connection
Connection that this object talks to.
void server_mainloop(void)
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should...
char * d_servicename
Name of this device, not including the connection part.
Generic connection class not specific to the transport mechanism.
void vrpn_SleepMsecs(double dMilliSecs)