Tektronix WFM 601M Wheelchair User Manual


 
Remote Command Processing Code
WFM 601A, WFM 601E & WFM 601M User Manual
C–59
/* If no character is present (i.e., no echo response)
* then resend the dropped character. But if
* number of retires has been exceeded, then bail out
*/
if (libError == IN_Q_EMPTY)
{
if (iSendAttempt++ > NUMBER_OF_RETRIES )
{
strcpy( expectedResp, "NADA");
printf("\nNo Response");
getch();
return libError;
}
break;
}
else
return libError;
}
/* Everything is Fine */
if ( sendChar == recvChar )
{
/* Advance the port message string */
portMsg++;
/* now that we have a successful echo, reset the 'send attempt'
* counter
*/
iSendAttempt = 0;
if ( recvChar == '\n' )
{
/* If this was a '\n', expect a trailing '\r' */
if ((libError = iwait_a1(comPort, 20 * 19L,
&portStatus, cancelFunc)) != A_OK)
return libError;
/* Get the instrument echo character */
if ((libError = rdch_a1(comPort, &recvChar,
&iq_size, &portStatus)) != A_OK)
return libError;
/* Check if we failed to get a trailing return */
if ( recvChar != '\r' )
return W_INVALID_RESP;
}
/* Break to send next character */
break;
}
/*
* Instrument returned an unrelated character. Record it.
* Continue to resend this character.
*/
*unexpectedResp++ = recvChar;