1 /************************************************************************************\
3 ledmi.h - HP SANE backend support for LEDM based multi-function peripherals
5 (c) 2010 Copyright Hewlett-Packard Development Company, LP
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11 of the Software, and to permit persons to whom the Software is furnished to do
12 so, subject to the following conditions:
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 Primary Author: Naga Samrat Chowdary, Narla
25 Contributing Authors: Yashwant Kumar Sahu
27 \************************************************************************************/
36 # define LEDM_CONTRAST_MIN -127
37 # define LEDM_CONTRAST_MAX 127
38 # define LEDM_CONTRAST_DEFAULT 0
40 # define MM_PER_INCH 25.4
42 enum LEDM_OPTION_NUMBER
44 LEDM_OPTION_COUNT = 0,
45 LEDM_OPTION_GROUP_SCAN_MODE,
46 LEDM_OPTION_SCAN_MODE,
47 LEDM_OPTION_SCAN_RESOLUTION,
48 LEDM_OPTION_INPUT_SOURCE, /* platen, ADF, ADFDuplex */
49 LEDM_OPTION_GROUP_ADVANCED,
51 LEDM_OPTION_COMPRESSION,
52 LEDM_OPTION_JPEG_QUALITY,
53 LEDM_OPTION_GROUP_GEOMETRY,
61 # define MAX_LIST_SIZE 32
62 # define MAX_STRING_SIZE 32
87 enum SCAN_PARAM_OPTION
89 SPO_BEST_GUESS = 0, /* scan not started, return "best guess" scan parameters */
90 SPO_STARTED = 1, /* scan started, return "job resonse" or "image processor" scan parameters */
91 SPO_STARTED_JR = 2, /* scan started, but return "job response" scan parameters only */
96 char *tag; /* handle identifier */
97 HPMUD_DEVICE dd; /* hpiod device descriptor */
98 HPMUD_CHANNEL cd; /* hpiod LEDM channel descriptor */
99 char uri[HPMUD_LINE_SIZE];
100 char model[HPMUD_LINE_SIZE];
105 IP_IMAGE_TRAITS image_traits; /* specified by image header */
107 SANE_Option_Descriptor option[LEDM_OPTION_MAX];
109 SANE_String_Const inputSourceList[IS_MAX];
110 enum INPUT_SOURCE inputSourceMap[IS_MAX];
111 enum INPUT_SOURCE currentInputSource;
113 SANE_Int resolutionList[MAX_LIST_SIZE];
114 SANE_Int currentResolution;
116 SANE_Range contrastRange;
117 SANE_Int currentContrast;
119 SANE_String_Const scanModeList[CE_MAX];
120 enum COLOR_ENTRY scanModeMap[CE_MAX];
121 enum COLOR_ENTRY currentScanMode;
123 SANE_String_Const compressionList[SF_MAX];
124 enum SCAN_FORMAT compressionMap[SF_MAX];
125 enum SCAN_FORMAT currentCompression;
127 SANE_Range jpegQualityRange;
128 SANE_Int currentJpegQuality;
130 SANE_Range tlxRange, tlyRange, brxRange, bryRange;
131 SANE_Fixed currentTlx, currentTly, currentBrx, currentBry;
132 SANE_Fixed effectiveTlx, effectiveTly, effectiveBrx, effectiveBry;
133 SANE_Fixed min_width, min_height;
134 SANE_Int platen_resolutionList[MAX_LIST_SIZE];
136 SANE_Fixed platen_min_width, platen_min_height;
137 SANE_Range platen_tlxRange, platen_tlyRange, platen_brxRange, platen_bryRange;
138 SANE_Fixed adf_min_width, adf_min_height;
139 SANE_Range adf_tlxRange, adf_tlyRange, adf_brxRange, adf_bryRange;
140 SANE_Int adf_resolutionList[MAX_LIST_SIZE];
144 int index; /* image buffer index */
145 int cnt; /* image buffer count */
146 unsigned char buf[32768]; /* image chunk buffer */
149 /* Add new elements here. */
154 int bb_open(struct ledm_session*);
155 int bb_close(struct ledm_session*);
156 int bb_get_parameters(struct ledm_session*, SANE_Parameters*, int);
157 int bb_is_paper_in_adf(); /* 0 = no paper in adf, 1 = paper in adf, -1 = error */
158 SANE_Status bb_start_scan(struct ledm_session*);
159 int bb_get_image_data(struct ledm_session*, int);
160 int bb_end_page(struct ledm_session*, int);
161 int bb_end_scan(struct ledm_session* , int);