beautypg.com

Mr_wait – Rockwell Automation 6008-SI IBM PC I/O SCNNR 6008-SI User Manual

Page 72

background image

Chapter 7

Scanner Management

7-5

mr_wait

mr_wait returns a status code, which it also places in the qmr_stat field of
the packet. For a complete list of status codes, please see Confirmation
Status Codes later in this chapter. For now it’s enough to know that
SC_OK (0) means successful completion, SC_PENDING means the
scanner didn’t come back with a confirmation before timeout, and any
other value is an error code returned by the scanner or the library routines.

You can code if tests based on the assumption that a zero status means
success.

Example:

if ( mr_wait(. . .) )

/* request failed */

or

if ( !mr_wait(. . .) )

/* request succeeded */

If you prefer, you can call mr_wait without using its return value, since
the qmr_stat field of the packet contains the same code:

mr_wait(. . ., &pkt);
if ( pkt.qmr_stat )

/* request failed */