LibInsane  1.0.10
Cross-platform Cross-API Cross-driver Cross-image-scanner Image Scan Library
Data Fields
lis_api Struct Reference

LibInsane C API. More...

#include <capi.h>

Data Fields

const char * base_name
 
void(* cleanup )(struct lis_api *impl)
 cleanup the implementation. More...
 
enum lis_error(* list_devices )(struct lis_api *impl, enum lis_device_locations locs, struct lis_device_descriptor ***dev_infos)
 Look for paper eaters. More...
 
enum lis_error(* get_device )(struct lis_api *impl, const char *dev_id, struct lis_item **item)
 Open the access to a device. More...
 

Detailed Description

LibInsane C API.

Initialized as soon as you get it.

Definition at line 423 of file capi.h.

Field Documentation

◆ base_name

const char* lis_api::base_name

"Sane", "WIA", "TWAIN", etc

Definition at line 424 of file capi.h.

◆ cleanup

void(* lis_api::cleanup) (struct lis_api *impl)

cleanup the implementation.

Must be called once you're done with the implementation instance. Otherwise you will leak file descriptors and memory.

Exact meaning depends on the implementation (call to sane_cleanup(), stopping a thread, etc).

Warning
Do not use the impl pointer anymore after calling this function. It will probably be freed.

Definition at line 437 of file capi.h.

◆ get_device

enum lis_error(* lis_api::get_device) (struct lis_api *impl, const char *dev_id, struct lis_item **item)

Open the access to a device.

Open the device.

  • Sane: if the device is not connected, it won't try to display anything.
  • WIA2: if the device is not connected, it won't try to display anything.
  • Twain: if the device is not connected, a popup will be displayed and this function will be stuck until the user clicks "ok" (cannot be avoided).
Parameters
[in]dev_idDevice identifier. See list_devices().
[out]itemItem representing the scanner.
Warning
This operation may take many seconds.
May trigger the display of a popup if the device is not actually available.
Return values
LIS_OKitem has been set to ta valid list of items. List is NULL terminated. You must use lis_item::close() on it later. See LIS_IS_OK.
LIS_ERR_DEVICE_BUSYAnother process is already using this scanner. item may or may not be modified. See LIS_IS_ERROR.
LIS_ERR_IO_ERRORDidn't work but don't know why ... Item may or may not be modified. See LIS_IS_ERROR.
LIS_ERR_ACCESS_DENIEDPermission denied. See LIS_IS_ERROR.

Definition at line 437 of file capi.h.

◆ list_devices

enum lis_error(* lis_api::list_devices) (struct lis_api *impl, enum lis_device_locations locs, struct lis_device_descriptor ***dev_infos)

Look for paper eaters.

If you already know the device identifier of the scanner you want to use, you do not need to call this function. You can call directly get_device.

  • Sane: reports only scanners that are online.
  • WIA2: reports only scanners that are online.
  • Twain: report all scanners, even offline scanners (cannot be avoided).
Warning
This operation may take many seconds.
Parameters
[in]local_only1 if only local devices must be reported, 0 if remote devices must also be reported
[out]dev_infoswill point to a list of device descriptions, NULL terminated. Will be invalidated/freed at the next call of list_devices() or cleanup.
Return values
LIS_OKdev_infos has been set to a list of devices. See LIS_IS_OK.

Definition at line 437 of file capi.h.


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