next up previous contents index
次へ: sane_cancel 上へ: Operations 戻る: sane_start   目次   索引

sane_read

This function is used to read image data from the device represented by handle h. Argument buf is a pointer to a memory area that is at least maxlen bytes long. The number of bytes returned is stored in *len. A backend must set this to zero when a status other than SANE_STATUS_GOOD is returned. When the call succeeds, the number of bytes returned can be anywhere in the range from 0 to maxlen bytes.

SANE_Status sane_read (SANE_Handle h, SANE_Byte * buf,
                       SANE_Int maxlen, SANE_Int * len);
If this function is called when no data is available, one of two things may happen, depending on the I/O mode that is in effect for handle h.
  1. If the device is in blocking I/O mode (the default mode), the call blocks until at least one data byte is available (or until some error occurs).

  2. If the device is in non-blocking I/O mode, the call returns immediately with status SANE_STATUS_GOOD and with *len set to zero.
The I/O mode of handle h can be set via a call to sane_set_io_mode().

This function may fail with one of the following status codes.

SANE_STATUS_CANCELLED:
The operation was cancelled through a call to sane_cancel.
SANE_STATUS_EOF:
No more data is available for the current frame.
SANE_STATUS_JAMMED:
The document feeder is jammed.
SANE_STATUS_NO_DOCS:
The document feeder is out of documents.
SANE_STATUS_COVER_OPEN:
The scanner cover is open.
SANE_STATUS_IO_ERROR:
An error occurred while communicating with the device.
SANE_STATUS_NO_MEM:
An insufficent amount of memory is available.
SANE_STATUS_ACCESS_DENIED:
Access to the device has been denied due to insufficient or invalid authentication.


next up previous contents index
次へ: sane_cancel 上へ: Operations 戻る: sane_start   目次   索引
MATSUBAYASHI 'Shaolin' Kohji 平成14年10月29日