sane.h (cdf0e10c) | sane.h (25381912) |
---|---|
1/* sane - Scanner Access Now Easy. | 1/* sane - Scanner Access Now Easy. |
2 Copyright (C) 1997 David Mosberger-Tang and Andreas Beck | 2 Copyright (C) 1997-1999 David Mosberger-Tang and Andreas Beck |
3 This file is part of the SANE package. 4 5 This file is in the public domain. You may use and modify it as 6 you see fit, as long as this copyright message is included and 7 that there is an indication as to what modifications have been 8 made (if any). 9 10 SANE is distributed in the hope that it will be useful, but WITHOUT 11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 FITNESS FOR A PARTICULAR PURPOSE. 13 14 This file declares SANE application interface. See the SANE 15 standard for a detailed explanation of the interface. */ 16#ifndef sane_h 17#define sane_h 18 | 3 This file is part of the SANE package. 4 5 This file is in the public domain. You may use and modify it as 6 you see fit, as long as this copyright message is included and 7 that there is an indication as to what modifications have been 8 made (if any). 9 10 SANE is distributed in the hope that it will be useful, but WITHOUT 11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 FITNESS FOR A PARTICULAR PURPOSE. 13 14 This file declares SANE application interface. See the SANE 15 standard for a detailed explanation of the interface. */ 16#ifndef sane_h 17#define sane_h 18 |
19#define SANE_CURRENT_MAJOR 0 | 19#ifdef __cplusplus 20extern "C" { 21#endif |
20 | 22 |
23/* 24 * SANE types and defines 25 */ 26 27#define SANE_CURRENT_MAJOR 1 28#define SANE_CURRENT_MINOR 0 29 |
|
21#define SANE_VERSION_CODE(major, minor, build) \ 22 ( (((SANE_Word) (major) & 0xff) << 24) \ 23 | (((SANE_Word) (minor) & 0xff) << 16) \ 24 | (((SANE_Word) (build) & 0xffff) << 0)) 25 26#define SANE_VERSION_MAJOR(code) ((((SANE_Word)(code)) >> 24) & 0xff) 27#define SANE_VERSION_MINOR(code) ((((SANE_Word)(code)) >> 16) & 0xff) 28#define SANE_VERSION_BUILD(code) ((((SANE_Word)(code)) >> 0) & 0xffff) 29 30#define SANE_FALSE 0 31#define SANE_TRUE 1 32 | 30#define SANE_VERSION_CODE(major, minor, build) \ 31 ( (((SANE_Word) (major) & 0xff) << 24) \ 32 | (((SANE_Word) (minor) & 0xff) << 16) \ 33 | (((SANE_Word) (build) & 0xffff) << 0)) 34 35#define SANE_VERSION_MAJOR(code) ((((SANE_Word)(code)) >> 24) & 0xff) 36#define SANE_VERSION_MINOR(code) ((((SANE_Word)(code)) >> 16) & 0xff) 37#define SANE_VERSION_BUILD(code) ((((SANE_Word)(code)) >> 0) & 0xffff) 38 39#define SANE_FALSE 0 40#define SANE_TRUE 1 41 |
33typedef unsigned char SANE_Byte; 34typedef int SANE_Word; 35typedef SANE_Word SANE_Bool; 36typedef SANE_Word SANE_Int; | 42typedef unsigned char SANE_Byte; 43typedef int SANE_Word; 44typedef SANE_Word SANE_Bool; 45typedef SANE_Word SANE_Int; |
37typedef char SANE_Char; 38typedef SANE_Char *SANE_String; 39typedef const SANE_Char *SANE_String_Const; 40typedef void *SANE_Handle; 41typedef SANE_Word SANE_Fixed; 42 43#define SANE_FIXED_SCALE_SHIFT 16 44#define SANE_FIX(v) ((SANE_Word) ((v) * (1 << SANE_FIXED_SCALE_SHIFT))) --- 11 unchanged lines hidden (view full) --- 56 SANE_STATUS_NO_DOCS, /* document feeder out of documents */ 57 SANE_STATUS_COVER_OPEN, /* scanner cover is open */ 58 SANE_STATUS_IO_ERROR, /* error during device I/O */ 59 SANE_STATUS_NO_MEM, /* out of memory */ 60 SANE_STATUS_ACCESS_DENIED /* access to resource has been denied */ 61 } 62SANE_Status; 63 | 46typedef char SANE_Char; 47typedef SANE_Char *SANE_String; 48typedef const SANE_Char *SANE_String_Const; 49typedef void *SANE_Handle; 50typedef SANE_Word SANE_Fixed; 51 52#define SANE_FIXED_SCALE_SHIFT 16 53#define SANE_FIX(v) ((SANE_Word) ((v) * (1 << SANE_FIXED_SCALE_SHIFT))) --- 11 unchanged lines hidden (view full) --- 65 SANE_STATUS_NO_DOCS, /* document feeder out of documents */ 66 SANE_STATUS_COVER_OPEN, /* scanner cover is open */ 67 SANE_STATUS_IO_ERROR, /* error during device I/O */ 68 SANE_STATUS_NO_MEM, /* out of memory */ 69 SANE_STATUS_ACCESS_DENIED /* access to resource has been denied */ 70 } 71SANE_Status; 72 |
73/* following are for later sane version, older frontends wont support */ 74#if 0 75#define SANE_STATUS_WARMING_UP 12 /* lamp not ready, please retry */ 76#define SANE_STATUS_HW_LOCKED 13 /* scanner mechanism locked for transport */ 77#endif 78 |
|
64typedef enum 65 { 66 SANE_TYPE_BOOL = 0, 67 SANE_TYPE_INT, 68 SANE_TYPE_FIXED, 69 SANE_TYPE_STRING, 70 SANE_TYPE_BUTTON, 71 SANE_TYPE_GROUP --- 23 unchanged lines hidden (view full) --- 95 96#define SANE_CAP_SOFT_SELECT (1 << 0) 97#define SANE_CAP_HARD_SELECT (1 << 1) 98#define SANE_CAP_SOFT_DETECT (1 << 2) 99#define SANE_CAP_EMULATED (1 << 3) 100#define SANE_CAP_AUTOMATIC (1 << 4) 101#define SANE_CAP_INACTIVE (1 << 5) 102#define SANE_CAP_ADVANCED (1 << 6) | 79typedef enum 80 { 81 SANE_TYPE_BOOL = 0, 82 SANE_TYPE_INT, 83 SANE_TYPE_FIXED, 84 SANE_TYPE_STRING, 85 SANE_TYPE_BUTTON, 86 SANE_TYPE_GROUP --- 23 unchanged lines hidden (view full) --- 110 111#define SANE_CAP_SOFT_SELECT (1 << 0) 112#define SANE_CAP_HARD_SELECT (1 << 1) 113#define SANE_CAP_SOFT_DETECT (1 << 2) 114#define SANE_CAP_EMULATED (1 << 3) 115#define SANE_CAP_AUTOMATIC (1 << 4) 116#define SANE_CAP_INACTIVE (1 << 5) 117#define SANE_CAP_ADVANCED (1 << 6) |
103#define SANE_CAP_ALWAYS_SETTABLE (1 << 7) | |
104 105#define SANE_OPTION_IS_ACTIVE(cap) (((cap) & SANE_CAP_INACTIVE) == 0) 106#define SANE_OPTION_IS_SETTABLE(cap) (((cap) & SANE_CAP_SOFT_SELECT) != 0) 107 108#define SANE_INFO_INEXACT (1 << 0) 109#define SANE_INFO_RELOAD_OPTIONS (1 << 1) 110#define SANE_INFO_RELOAD_PARAMS (1 << 2) 111 --- 40 unchanged lines hidden (view full) --- 152 SANE_ACTION_GET_VALUE = 0, 153 SANE_ACTION_SET_VALUE, 154 SANE_ACTION_SET_AUTO 155 } 156SANE_Action; 157 158typedef enum 159 { | 118 119#define SANE_OPTION_IS_ACTIVE(cap) (((cap) & SANE_CAP_INACTIVE) == 0) 120#define SANE_OPTION_IS_SETTABLE(cap) (((cap) & SANE_CAP_SOFT_SELECT) != 0) 121 122#define SANE_INFO_INEXACT (1 << 0) 123#define SANE_INFO_RELOAD_OPTIONS (1 << 1) 124#define SANE_INFO_RELOAD_PARAMS (1 << 2) 125 --- 40 unchanged lines hidden (view full) --- 166 SANE_ACTION_GET_VALUE = 0, 167 SANE_ACTION_SET_VALUE, 168 SANE_ACTION_SET_AUTO 169 } 170SANE_Action; 171 172typedef enum 173 { |
160 SANE_FRAME_GRAY, /* band covering human visual range */ 161 SANE_FRAME_RGB, /* pixel-interleaved red/green/blue bands */ 162 SANE_FRAME_RED, /* red band only */ 163 SANE_FRAME_GREEN, /* green band only */ 164 SANE_FRAME_BLUE /* blue band only */ | 174 SANE_FRAME_GRAY, /* band covering human visual range */ 175 SANE_FRAME_RGB, /* pixel-interleaved red/green/blue bands */ 176 SANE_FRAME_RED, /* red band only */ 177 SANE_FRAME_GREEN, /* green band only */ 178 SANE_FRAME_BLUE /* blue band only */ |
165 } 166SANE_Frame; 167 | 179 } 180SANE_Frame; 181 |
182/* push remaining types down to match existing backends */ 183/* these are to be exposed in a later version of SANE */ 184/* most front-ends will require updates to understand them */ 185#if 0 186#define SANE_FRAME_TEXT 0x0A /* backend specific textual data */ 187#define SANE_FRAME_JPEG 0x0B /* complete baseline JPEG file */ 188#define SANE_FRAME_G31D 0x0C /* CCITT Group 3 1-D Compressed (MH) */ 189#define SANE_FRAME_G32D 0x0D /* CCITT Group 3 2-D Compressed (MR) */ 190#define SANE_FRAME_G42D 0x0E /* CCITT Group 4 2-D Compressed (MMR) */ 191 192#define SANE_FRAME_IR 0x0F /* bare infrared channel */ 193#define SANE_FRAME_RGBI 0x10 /* red+green+blue+infrared */ 194#define SANE_FRAME_GRAYI 0x11 /* gray+infrared */ 195#define SANE_FRAME_XML 0x12 /* undefined schema */ 196#endif 197 |
|
168typedef struct 169 { 170 SANE_Frame format; 171 SANE_Bool last_frame; 172 SANE_Int bytes_per_line; 173 SANE_Int pixels_per_line; 174 SANE_Int lines; 175 SANE_Int depth; 176 } 177SANE_Parameters; 178 179struct SANE_Auth_Data; 180 | 198typedef struct 199 { 200 SANE_Frame format; 201 SANE_Bool last_frame; 202 SANE_Int bytes_per_line; 203 SANE_Int pixels_per_line; 204 SANE_Int lines; 205 SANE_Int depth; 206 } 207SANE_Parameters; 208 209struct SANE_Auth_Data; 210 |
181#define SANE_MAX_USERNAME_LEN 256 182#define SANE_MAX_PASSWORD_LEN 256 | 211#define SANE_MAX_USERNAME_LEN 128 212#define SANE_MAX_PASSWORD_LEN 128 |
183 184typedef void (*SANE_Auth_Callback) (SANE_String_Const resource, | 213 214typedef void (*SANE_Auth_Callback) (SANE_String_Const resource, |
185 SANE_Char username[SANE_MAX_USERNAME_LEN], 186 SANE_Char password[SANE_MAX_PASSWORD_LEN]); | 215 SANE_Char *username, 216 SANE_Char *password); |
187 188extern SANE_Status sane_init (SANE_Int * version_code, 189 SANE_Auth_Callback authorize); 190extern void sane_exit (void); 191extern SANE_Status sane_get_devices (const SANE_Device *** device_list, 192 SANE_Bool local_only); 193extern SANE_Status sane_open (SANE_String_Const devicename, 194 SANE_Handle * handle); --- 10 unchanged lines hidden (view full) --- 205 SANE_Int max_length, SANE_Int * length); 206extern void sane_cancel (SANE_Handle handle); 207extern SANE_Status sane_set_io_mode (SANE_Handle handle, 208 SANE_Bool non_blocking); 209extern SANE_Status sane_get_select_fd (SANE_Handle handle, 210 SANE_Int * fd); 211extern SANE_String_Const sane_strstatus (SANE_Status status); 212 | 217 218extern SANE_Status sane_init (SANE_Int * version_code, 219 SANE_Auth_Callback authorize); 220extern void sane_exit (void); 221extern SANE_Status sane_get_devices (const SANE_Device *** device_list, 222 SANE_Bool local_only); 223extern SANE_Status sane_open (SANE_String_Const devicename, 224 SANE_Handle * handle); --- 10 unchanged lines hidden (view full) --- 235 SANE_Int max_length, SANE_Int * length); 236extern void sane_cancel (SANE_Handle handle); 237extern SANE_Status sane_set_io_mode (SANE_Handle handle, 238 SANE_Bool non_blocking); 239extern SANE_Status sane_get_select_fd (SANE_Handle handle, 240 SANE_Int * fd); 241extern SANE_String_Const sane_strstatus (SANE_Status status); 242 |
243#ifdef __cplusplus 244} 245#endif 246 247 |
|
213#endif /* sane_h */ | 248#endif /* sane_h */ |