diff options
Diffstat (limited to 'backend/escl/escl.h')
-rw-r--r-- | backend/escl/escl.h | 120 |
1 files changed, 95 insertions, 25 deletions
diff --git a/backend/escl/escl.h b/backend/escl/escl.h index 53ce7c7..67b11c7 100644 --- a/backend/escl/escl.h +++ b/backend/escl/escl.h @@ -16,8 +16,8 @@ for more details. You should have received a copy of the GNU General Public License - along with sane; see the file COPYING. If not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with sane; see the file COPYING. + If not, see <https://www.gnu.org/licenses/>. This file implements a SANE backend for eSCL scanners. */ @@ -27,10 +27,13 @@ #include "../include/sane/config.h" + #if !(HAVE_LIBCURL && defined(WITH_AVAHI) && defined(HAVE_LIBXML2)) #error "The escl backend requires libcurl, libavahi and libxml2" #endif + + #ifndef HAVE_LIBJPEG /* FIXME: Make JPEG support optional. Support for PNG and PDF is to be added later but currently only @@ -45,6 +48,8 @@ #include <stdio.h> #include <math.h> +#include <curl/curl.h> + #ifndef BACKEND_NAME #define BACKEND_NAME escl #endif @@ -87,12 +92,15 @@ typedef struct { typedef struct ESCL_Device { struct ESCL_Device *next; - char *model_name; - int port_nb; - char *ip_address; - char *type; + char *model_name; + int port_nb; + char *ip_address; + char *is; + char *uuid; + char *type; SANE_Bool https; - char *unix_socket; + struct curl_slist *hack; + char *unix_socket; } ESCL_Device; typedef struct capst @@ -127,8 +135,20 @@ typedef struct capst int RiskyTopMargin; int RiskyBottomMargin; int duplex; + int have_jpeg; + int have_png; + int have_tiff; + int have_pdf; } caps_t; +typedef struct support +{ + int min; + int max; + int normal; + int step; +} support_t; + typedef struct capabilities { caps_t caps[3]; @@ -141,6 +161,18 @@ typedef struct capabilities long img_read; size_t real_read; SANE_Bool work; + support_t *brightness; + support_t *contrast; + support_t *sharpen; + support_t *threshold; + int use_brightness; + int val_brightness; + int use_contrast; + int val_contrast; + int use_sharpen; + int val_sharpen; + int use_threshold; + int val_threshold; } capabilities_t; typedef struct { @@ -162,8 +194,7 @@ enum OPT_MODE_GROUP, OPT_MODE, OPT_RESOLUTION, - OPT_PREVIEW, - OPT_GRAY_PREVIEW, + OPT_SCAN_SOURCE, OPT_GEOMETRY_GROUP, OPT_TL_X, @@ -171,7 +202,13 @@ enum OPT_BR_X, OPT_BR_Y, - OPT_SCAN_SOURCE, + OPT_ENHANCEMENT_GROUP, + OPT_PREVIEW, + OPT_GRAY_PREVIEW, + OPT_BRIGHTNESS, + OPT_CONTRAST, + OPT_SHARPEN, + OPT_THRESHOLD, NUM_OPTIONS }; @@ -180,35 +217,68 @@ enum #define MM_TO_PIXEL(millimeters, dpi) (SANE_Word)round(SANE_UNFIX(millimeters) * (dpi) / 25.4) ESCL_Device *escl_devices(SANE_Status *status); -SANE_Status escl_device_add(int port_nb, const char *model_name, - char *ip_address, char *type); +SANE_Status escl_device_add(int port_nb, + const char *model_name, + char *ip_address, + const char *is, + const char *uuid, + char *type); + SANE_Status escl_status(const ESCL_Device *device, int source, const char* jobId, SANE_Status *job); -capabilities_t *escl_capabilities(const ESCL_Device *device, SANE_Status *status); -char *escl_newjob(capabilities_t *scanner, const ESCL_Device *device, - SANE_Status *status); -SANE_Status escl_scan(capabilities_t *scanner, const ESCL_Device *device, - char *result); -void escl_scanner(const ESCL_Device *device, char *result); + +capabilities_t *escl_capabilities(ESCL_Device *device, + SANE_Status *status); + +char *escl_newjob(capabilities_t *scanner, + const ESCL_Device *device, + SANE_Status *status); + +SANE_Status escl_scan(capabilities_t *scanner, + const ESCL_Device *device, + char *result); + +void escl_scanner(const ESCL_Device *device, + char *result); typedef void CURL; -void escl_curl_url(CURL *handle, const ESCL_Device *device, SANE_String_Const path); -unsigned char *escl_crop_surface(capabilities_t *scanner, unsigned char *surface, - int w, int h, int bps, int *width, int *height); +void escl_curl_url(CURL *handle, + const ESCL_Device *device, + SANE_String_Const path); + +unsigned char *escl_crop_surface(capabilities_t *scanner, + unsigned char *surface, + int w, + int h, + int bps, + int *width, + int *height); // JPEG -SANE_Status get_JPEG_data(capabilities_t *scanner, int *width, int *height, int *bps); +SANE_Status get_JPEG_data(capabilities_t *scanner, + int *width, + int *height, + int *bps); // PNG -SANE_Status get_PNG_data(capabilities_t *scanner, int *width, int *height, int *bps); +SANE_Status get_PNG_data(capabilities_t *scanner, + int *width, + int *height, + int *bps); // TIFF -SANE_Status get_TIFF_data(capabilities_t *scanner, int *width, int *height, int *bps); +SANE_Status get_TIFF_data(capabilities_t *scanner, + int *width, + int *height, + int *bps); // PDF -SANE_Status get_PDF_data(capabilities_t *scanner, int *width, int *height, int *bps); +SANE_Status get_PDF_data(capabilities_t *scanner, + int *width, + int *height, + int *bps); #endif |