LibInsane: lis_api 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_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.
enum lis_error(* | list_devices )(struct lis_api *impl, enum lis_device_locations locs, struct lis_device_descriptor ***dev_infos)
| Look for paper eaters.
enum lis_error(* | get_device )(struct lis_api *impl, const char *dev_id, struct lis_item **item)
| Open the access to a device.

## Detailed Description

LibInsane C API.

Initialized as soon as you get it.

Definition at line 422 of file capi.h.

## Field Documentation

## ◆ base_name

const char* lis_api::base_name

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

Definition at line 423 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 436 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_id | Device identifier. See list_devices().
  [out] | item | Item 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_OK | item 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_BUSY | Another process is already using this scanner. item may or may not be modified. See LIS_IS_ERROR.
  LIS_ERR_IO_ERROR | Didn't work but don't know why ... Item may or may not be modified. See LIS_IS_ERROR.
  LIS_ERR_ACCESS_DENIED | Permission denied. See LIS_IS_ERROR.

Definition at line 436 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_only | 1 if only local devices must be reported, 0 if remote devices must also be reported
  [out] | dev_infos | will 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_OK | dev_infos has been set to a list of devices. See LIS_IS_OK.

Definition at line 436 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