Tektronix WFM 601M Wheelchair User Manual


 
Remote Command Processing Code
WFM 601A, WFM 601E & WFM 601M User Manual
C–57
if ( errCode == A_OK )
{
/* Set remote XON/XOFF flow control */
(void) setop_a1(comPort, 6, 1);
return A_OK;
}
break;
}
/*
* Open and close port to reset it, and try to initialize
* it again.
*/
(void)open_a1(comPort, sizeof(ioBuf)/2, sizeof(ioBuf)/2, 0, 0, ioBuf);
close_a1 (comPort);
}
/*
* If we can't at least get an OK, the port is either
* missing or busy.
*/
if ( tryCounter == NUMBER_OF_RETIRES )
comPort = NO_PORT_FOUND;
/* On error, unset the comPort and return */
comPort = 0;
return errCode;
}
/*
* sendToWfm601 - Send data to an instrument from the WFM601x family
*
* This is the central procedure in this module. It sends "portMsg"Ċa
* newline terminated stringĊto the instrument. If the message is a query,
* this procudure waits for the instrument to respond and places that response
* in "expectedResp". If the instrument returns any data while the message is
* being sent, this procedure stores that data in "unexpectedResp" and returns
* W_UNEXPEC_RESP. Finally, a cancel callback is accepted to allow the user
* to decide when to stop waiting; cancelFunc is periodically called, and if
* it returns a non-zero value, the procedure immediately terminates (pass
* NULL if you don't want to use this feature).
*
* The response buffers should be at least 1024 chars in length, which is
* the maximum length of an instrument response.
*/
int
sendToWfm601
(
char *portMsg, /* The newline terminated send message */
char *expectedResp, /* Buffer for expected responses */
char *unexpectedResp, /* Buffer for unexpected responses */
int (*cancelFunc)(void) /* User cancel routine to stop waiting */
)
{