LibInsane: lis_scan_session Struct Reference

| LibInsane 1.0.10 Cross-platform Cross-API Cross-driver Cross-image-scanner Image Scan Library

Loading...
Searching...
No Matches
Data Fields
lis_scan_session Struct Reference

`#include <capi.h>`

## Data Fields
enum lis_error(* | get_scan_parameters )(struct lis_scan_session *self, struct lis_scan_parameters *parameters)
| Returns a description of what will be returned when scanning.
int(* | end_of_feed )(struct lis_scan_session *session)
| Indicates if we have reached the end of the feed. Should be called at least each time end_of_page returns 1.
int(* | end_of_page )(struct lis_scan_session *session)
| Indicates if we have reached the end of the page being currently scanned. Should be called before each call to scan_read(). If an error must occur, it will occur on scan_read().
enum lis_error(* | scan_read )(struct lis_scan_session *session, void *out_buffer, size_t *buffer_size)
| Read a chunk of the scanned image.
void(* | cancel )(struct lis_scan_session *session)
| Cancel the current scan session.

## Detailed Description

Definition at line 261 of file capi.h.

## Field Documentation

## ◆ cancel

void(* lis_scan_session::cancel) (struct lis_scan_session *session)

Cancel the current scan session.

This function stops the current scan session and releases any resource related to the scan session.

This function can safely be called at the end of a scan session to release resources. However, beware: Not all drivers handle gracefully scan cancellation while still scanning. Instead, you are advised to wait for the end of scan session and discard the images.

Definition at line 337 of file capi.h.

## ◆ end_of_feed

int(* lis_scan_session::end_of_feed) (struct lis_scan_session *session)

Indicates if we have reached the end of the feed. Should be called at least each time end_of_page returns 1.

Definition at line 289 of file capi.h.

## ◆ end_of_page

int(* lis_scan_session::end_of_page) (struct lis_scan_session *session)

Indicates if we have reached the end of the page being currently scanned. Should be called before each call to scan_read(). If an error must occur, it will occur on scan_read().

Definition at line 296 of file capi.h.

## ◆ get_scan_parameters

enum lis_error(* lis_scan_session::get_scan_parameters) (struct lis_scan_session *self, struct lis_scan_parameters *parameters)

Returns a description of what will be returned when scanning.

This is only an estimation.

Format is guaranteed to be right.

Width is always guaranteed

Beware: Height is never guaranteed (usually the scan will be shorted, but it may also be longer !).

Beware: Image size is never guaranteed.

Parameters

  [in] | self | Item from which the scan will be done.
  [out] | parameters | Estimation of what will be scanned.

Return values

  LIS_OK | parameters has been set.

Definition at line 257 of file capi.h.

## ◆ scan_read

enum lis_error(* lis_scan_session::scan_read) (struct lis_scan_session *session, void *out_buffer, size_t *buffer_size)

Read a chunk of the scanned image.

Parameters

  [in] | session | Scan session.
  [out] | out_buffer | Image chunk.
  [in,out] | out_buffer_size | In: maximum number of bytes that can be put in out_buffer. Out: number of bytes read. If the value is 0, it does not mean end of page or end of file. It just means there was no data to ready yet.

Warning
  You're advised to NOT use LIS_IS_OK(). You can however use safely LIS_IS_ERROR().
  You should manage every non-error return value carefully.
  It may return 0 bytes. It does not mean end-of-page/end-of-page. It just means no data at the moment.

Return values

  LIS_OK | A chunk of the current page/image has been read.
  LIS_CANCELLED | Scan has been cancelled by lis_scan_session::cancel() or by hardware. You can throw the image chunks you got away. Do not call again scan_read(). Do not call lis_scan_session::scan_read() or lis_scan_session::cancel() again.
  LIS_END_OF_PAGE | A whole page has been read. Call again lis_scan_session::scan_read() to read the next page.
  LIS_END_OF_FEED | A whole page feed has been read. Do not call lis_scan_session::cancel().
  LIS_WARMING_UP | Scanner is warming up. No data available yet. Keep calling lis_scan_session::scan_read() until there is.

Warning
  This operation may take many seconds.

Definition at line 296 of file capi.h.

The documentation for this struct was generated from the following file:

- /build/libinsane/src/libinsane/subprojects/libinsane/include/libinsane/capi.h