1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
|
/* sane - Scanner Access Now Easy.
Copyright (C) 2019 Povilas Kanapickas <povilas@radix.lt>
This file is part of the SANE package.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef BACKEND_GENESYS_ENUMS_H
#define BACKEND_GENESYS_ENUMS_H
#include <iostream>
#include "serialize.h"
namespace genesys {
enum class ScanMethod : unsigned {
// normal scan method
FLATBED = 0,
// scan using transparency adaptor
TRANSPARENCY = 1,
// scan using transparency adaptor via infrared channel
TRANSPARENCY_INFRARED = 2
};
inline std::ostream& operator<<(std::ostream& out, ScanMethod mode)
{
switch (mode) {
case ScanMethod::FLATBED: out << "FLATBED"; return out;
case ScanMethod::TRANSPARENCY: out << "TRANSPARENCY"; return out;
case ScanMethod::TRANSPARENCY_INFRARED: out << "TRANSPARENCY_INFRARED"; return out;
}
return out;
}
inline void serialize(std::istream& str, ScanMethod& x)
{
unsigned value;
serialize(str, value);
x = static_cast<ScanMethod>(value);
}
inline void serialize(std::ostream& str, ScanMethod& x)
{
unsigned value = static_cast<unsigned>(x);
serialize(str, value);
}
const char* scan_method_to_option_string(ScanMethod method);
ScanMethod option_string_to_scan_method(const std::string& str);
enum class ScanColorMode : unsigned {
LINEART = 0,
HALFTONE,
GRAY,
COLOR_SINGLE_PASS
};
inline std::ostream& operator<<(std::ostream& out, ScanColorMode mode)
{
switch (mode) {
case ScanColorMode::LINEART: out << "LINEART"; return out;
case ScanColorMode::HALFTONE: out << "HALFTONE"; return out;
case ScanColorMode::GRAY: out << "GRAY"; return out;
case ScanColorMode::COLOR_SINGLE_PASS: out << "COLOR_SINGLE_PASS"; return out;
}
return out;
}
inline void serialize(std::istream& str, ScanColorMode& x)
{
unsigned value;
serialize(str, value);
x = static_cast<ScanColorMode>(value);
}
inline void serialize(std::ostream& str, ScanColorMode& x)
{
unsigned value = static_cast<unsigned>(x);
serialize(str, value);
}
const char* scan_color_mode_to_option_string(ScanColorMode mode);
ScanColorMode option_string_to_scan_color_mode(const std::string& str);
enum class ScanHeadId : unsigned {
NONE = 0,
PRIMARY = 1 << 0,
SECONDARY = 1 << 1,
ALL = PRIMARY | SECONDARY,
};
inline ScanHeadId operator|(ScanHeadId left, ScanHeadId right)
{
return static_cast<ScanHeadId>(static_cast<unsigned>(left) | static_cast<unsigned>(right));
}
inline ScanHeadId operator&(ScanHeadId left, ScanHeadId right)
{
return static_cast<ScanHeadId>(static_cast<unsigned>(left) & static_cast<unsigned>(right));
}
enum class ColorFilter : unsigned {
RED = 0,
GREEN,
BLUE,
NONE
};
std::ostream& operator<<(std::ostream& out, ColorFilter mode);
inline void serialize(std::istream& str, ColorFilter& x)
{
unsigned value;
serialize(str, value);
x = static_cast<ColorFilter>(value);
}
inline void serialize(std::ostream& str, ColorFilter& x)
{
unsigned value = static_cast<unsigned>(x);
serialize(str, value);
}
enum class ColorOrder
{
RGB,
GBR,
BGR,
};
/* Enum value naming conventions:
Full name must be included with the following exceptions:
Canon scanners omit "Canoscan" if present
*/
enum class ModelId : unsigned
{
UNKNOWN = 0,
CANON_4400F,
CANON_5600F,
CANON_8400F,
CANON_8600F,
CANON_IMAGE_FORMULA_101,
CANON_LIDE_50,
CANON_LIDE_60,
CANON_LIDE_80,
CANON_LIDE_90,
CANON_LIDE_100,
CANON_LIDE_110,
CANON_LIDE_120,
CANON_LIDE_200,
CANON_LIDE_210,
CANON_LIDE_220,
CANON_LIDE_700F,
DCT_DOCKETPORT_487,
HP_SCANJET_2300C,
HP_SCANJET_2400C,
HP_SCANJET_3670,
HP_SCANJET_4850C,
HP_SCANJET_G4010,
HP_SCANJET_G4050,
HP_SCANJET_N6310,
MEDION_MD5345,
PANASONIC_KV_SS080,
PENTAX_DSMOBILE_600,
PLUSTEK_OPTICBOOK_3800,
PLUSTEK_OPTICFILM_7200,
PLUSTEK_OPTICFILM_7200I,
PLUSTEK_OPTICFILM_7300,
PLUSTEK_OPTICFILM_7400,
PLUSTEK_OPTICFILM_7500I,
PLUSTEK_OPTICFILM_8200I,
PLUSTEK_OPTICPRO_3600,
PLUSTEK_OPTICPRO_ST12,
PLUSTEK_OPTICPRO_ST24,
SYSCAN_DOCKETPORT_465,
SYSCAN_DOCKETPORT_467,
SYSCAN_DOCKETPORT_485,
SYSCAN_DOCKETPORT_665,
SYSCAN_DOCKETPORT_685,
UMAX_ASTRA_4500,
VISIONEER_7100,
VISIONEER_ROADWARRIOR,
VISIONEER_STROBE_XP100_REVISION3,
VISIONEER_STROBE_XP200,
VISIONEER_STROBE_XP300,
XEROX_2400,
XEROX_TRAVELSCANNER_100,
};
inline void serialize(std::istream& str, ModelId& x)
{
unsigned value;
serialize(str, value);
x = static_cast<ModelId>(value);
}
inline void serialize(std::ostream& str, ModelId& x)
{
unsigned value = static_cast<unsigned>(x);
serialize(str, value);
}
std::ostream& operator<<(std::ostream& out, ModelId id);
enum class SensorId : unsigned
{
UNKNOWN = 0,
CCD_5345,
CCD_CANON_4400F,
CCD_CANON_5600F,
CCD_CANON_8400F,
CCD_CANON_8600F,
CCD_DP665,
CCD_DP685,
CCD_DSMOBILE600,
CCD_DOCKETPORT_487,
CCD_G4050,
CCD_HP2300,
CCD_HP2400,
CCD_HP3670,
CCD_HP_N6310,
CCD_HP_4850C,
CCD_IMG101,
CCD_KVSS080,
CCD_PLUSTEK_OPTICBOOK_3800,
CCD_PLUSTEK_OPTICFILM_7200,
CCD_PLUSTEK_OPTICFILM_7200I,
CCD_PLUSTEK_OPTICFILM_7300,
CCD_PLUSTEK_OPTICFILM_7400,
CCD_PLUSTEK_OPTICFILM_7500I,
CCD_PLUSTEK_OPTICFILM_8200I,
CCD_PLUSTEK_OPTICPRO_3600,
CCD_ROADWARRIOR,
CCD_ST12, // SONY ILX548: 5340 Pixel ???
CCD_ST24, // SONY ILX569: 10680 Pixel ???
CCD_UMAX,
CCD_XP300,
CIS_CANON_LIDE_35,
CIS_CANON_LIDE_60,
CIS_CANON_LIDE_80,
CIS_CANON_LIDE_90,
CIS_CANON_LIDE_100,
CIS_CANON_LIDE_110,
CIS_CANON_LIDE_120,
CIS_CANON_LIDE_200,
CIS_CANON_LIDE_210,
CIS_CANON_LIDE_220,
CIS_CANON_LIDE_700F,
CIS_XP200,
};
inline void serialize(std::istream& str, SensorId& x)
{
unsigned value;
serialize(str, value);
x = static_cast<SensorId>(value);
}
inline void serialize(std::ostream& str, SensorId& x)
{
unsigned value = static_cast<unsigned>(x);
serialize(str, value);
}
std::ostream& operator<<(std::ostream& out, SensorId id);
enum class AdcId : unsigned
{
UNKNOWN = 0,
AD_XP200,
CANON_LIDE_35,
CANON_LIDE_80,
CANON_LIDE_90,
CANON_LIDE_110,
CANON_LIDE_120,
CANON_LIDE_200,
CANON_LIDE_700F,
CANON_4400F,
CANON_5600F,
CANON_8400F,
CANON_8600F,
G4050,
IMG101,
KVSS080,
PLUSTEK_OPTICBOOK_3800,
PLUSTEK_OPTICFILM_7200,
PLUSTEK_OPTICFILM_7200I,
PLUSTEK_OPTICFILM_7300,
PLUSTEK_OPTICFILM_7400,
PLUSTEK_OPTICFILM_7500I,
PLUSTEK_OPTICFILM_8200I,
PLUSTEK_OPTICPRO_3600,
WOLFSON_5345,
WOLFSON_DSM600,
WOLFSON_HP2300,
WOLFSON_HP2400,
WOLFSON_HP3670,
WOLFSON_ST12,
WOLFSON_ST24,
WOLFSON_UMAX,
WOLFSON_XP300,
};
inline void serialize(std::istream& str, AdcId& x)
{
unsigned value;
serialize(str, value);
x = static_cast<AdcId>(value);
}
inline void serialize(std::ostream& str, AdcId& x)
{
unsigned value = static_cast<unsigned>(x);
serialize(str, value);
}
std::ostream& operator<<(std::ostream& out, AdcId id);
enum class GpioId : unsigned
{
UNKNOWN = 0,
CANON_LIDE_35,
CANON_LIDE_80,
CANON_LIDE_90,
CANON_LIDE_110,
CANON_LIDE_120,
CANON_LIDE_200,
CANON_LIDE_210,
CANON_LIDE_700F,
CANON_4400F,
CANON_5600F,
CANON_8400F,
CANON_8600F,
DP665,
DP685,
G4050,
G4010,
HP2300,
HP2400,
HP3670,
HP_N6310,
IMG101,
KVSS080,
MD_5345,
PLUSTEK_OPTICBOOK_3800,
PLUSTEK_OPTICFILM_7200,
PLUSTEK_OPTICFILM_7200I,
PLUSTEK_OPTICFILM_7300,
PLUSTEK_OPTICFILM_7400,
PLUSTEK_OPTICFILM_7500I,
PLUSTEK_OPTICFILM_8200I,
PLUSTEK_OPTICPRO_3600,
ST12,
ST24,
UMAX,
XP200,
XP300,
};
std::ostream& operator<<(std::ostream& out, GpioId id);
enum class MotorId : unsigned
{
UNKNOWN = 0,
CANON_LIDE_100,
CANON_LIDE_110,
CANON_LIDE_120,
CANON_LIDE_200,
CANON_LIDE_210,
CANON_LIDE_35,
CANON_LIDE_60,
CANON_LIDE_700,
CANON_LIDE_80,
CANON_LIDE_90,
CANON_4400F,
CANON_5600F,
CANON_8400F,
CANON_8600F,
DP665,
DSMOBILE_600,
G4050,
HP2300,
HP2400,
HP3670,
IMG101,
KVSS080,
MD_5345,
PLUSTEK_OPTICBOOK_3800,
PLUSTEK_OPTICFILM_7200,
PLUSTEK_OPTICFILM_7200I,
PLUSTEK_OPTICFILM_7300,
PLUSTEK_OPTICFILM_7400,
PLUSTEK_OPTICFILM_7500I,
PLUSTEK_OPTICFILM_8200I,
PLUSTEK_OPTICPRO_3600,
ROADWARRIOR,
ST24,
UMAX,
XP200,
XP300,
};
std::ostream& operator<<(std::ostream& out, MotorId id);
enum class StepType : unsigned
{
FULL = 0,
HALF = 1,
QUARTER = 2,
EIGHTH = 3,
};
std::ostream& operator<<(std::ostream& out, StepType type);
inline bool operator<(StepType lhs, StepType rhs)
{
return static_cast<unsigned>(lhs) < static_cast<unsigned>(rhs);
}
inline bool operator<=(StepType lhs, StepType rhs)
{
return static_cast<unsigned>(lhs) <= static_cast<unsigned>(rhs);
}
inline bool operator>(StepType lhs, StepType rhs)
{
return static_cast<unsigned>(lhs) > static_cast<unsigned>(rhs);
}
inline bool operator>=(StepType lhs, StepType rhs)
{
return static_cast<unsigned>(lhs) >= static_cast<unsigned>(rhs);
}
enum class AsicType : unsigned
{
UNKNOWN = 0,
GL646,
GL841,
GL842,
GL843,
GL845,
GL846,
GL847,
GL124,
};
enum class ModelFlag : unsigned
{
// no flags
NONE = 0,
// scanner is not tested, print a warning as it's likely it won't work
UNTESTED = 1 << 0,
// use 14-bit gamma table instead of 12-bit
GAMMA_14BIT = 1 << 1,
// perform lamp warmup
WARMUP = 1 << 4,
// whether to disable offset and gain calibration
DISABLE_ADC_CALIBRATION = 1 << 5,
// whether to disable exposure calibration (this currently is only done on CIS
// scanners)
DISABLE_EXPOSURE_CALIBRATION = 1 << 6,
// whether to disable shading calibration completely
DISABLE_SHADING_CALIBRATION = 1 << 7,
// do dark calibration
DARK_CALIBRATION = 1 << 8,
// host-side calibration uses a complete scan
HOST_SIDE_CALIBRATION_COMPLETE_SCAN = 1 << 9,
// whether scanner must wait for the head while parking
MUST_WAIT = 1 << 10,
// use zeroes for dark calibration
USE_CONSTANT_FOR_DARK_CALIBRATION = 1 << 11,
// do dark and white calibration in one run
DARK_WHITE_CALIBRATION = 1 << 12,
// allow custom gamma tables
CUSTOM_GAMMA = 1 << 13,
// disable fast feeding mode on this scanner
DISABLE_FAST_FEEDING = 1 << 14,
// scan gray scans as color and combine on host side
HOST_SIDE_GRAY = 1 << 15,
// the scanner uses multi-segment sensors that must be handled during calibration
SIS_SENSOR = 1 << 16,
// the head must be reparked between shading scans
SHADING_REPARK = 1 << 18,
// the scanner outputs inverted pixel data
INVERT_PIXEL_DATA = 1 << 19,
// the scanner outputs 16-bit data that is byte-inverted
SWAP_16BIT_DATA = 1 << 20,
// the scanner has transparency, but it's implemented using only one motor
UTA_NO_SECONDARY_MOTOR = 1 << 21,
// the scanner has transparency, but it's implemented using only one lamp
TA_NO_SECONDARY_LAMP = 1 << 22,
};
inline ModelFlag operator|(ModelFlag left, ModelFlag right)
{
return static_cast<ModelFlag>(static_cast<unsigned>(left) | static_cast<unsigned>(right));
}
inline ModelFlag& operator|=(ModelFlag& left, ModelFlag right)
{
left = left | right;
return left;
}
inline ModelFlag operator&(ModelFlag left, ModelFlag right)
{
return static_cast<ModelFlag>(static_cast<unsigned>(left) & static_cast<unsigned>(right));
}
inline bool has_flag(ModelFlag flags, ModelFlag which)
{
return (flags & which) == which;
}
enum class ScanFlag : unsigned
{
NONE = 0,
SINGLE_LINE = 1 << 0,
DISABLE_SHADING = 1 << 1,
DISABLE_GAMMA = 1 << 2,
DISABLE_BUFFER_FULL_MOVE = 1 << 3,
// if this flag is set the sensor will always be handled ignoring staggering of multiple
// sensors to achieve high resolution.
IGNORE_STAGGER_OFFSET = 1 << 4,
// if this flag is set the sensor will always be handled as if the components that scan
// different colors are at the same position.
IGNORE_COLOR_OFFSET = 1 << 5,
DISABLE_LAMP = 1 << 6,
CALIBRATION = 1 << 7,
FEEDING = 1 << 8,
USE_XPA = 1 << 9,
ENABLE_LEDADD = 1 << 10,
REVERSE = 1 << 12,
// the scanner should return head to home position automatically after scan.
AUTO_GO_HOME = 1 << 13,
};
inline ScanFlag operator|(ScanFlag left, ScanFlag right)
{
return static_cast<ScanFlag>(static_cast<unsigned>(left) | static_cast<unsigned>(right));
}
inline ScanFlag& operator|=(ScanFlag& left, ScanFlag right)
{
left = left | right;
return left;
}
inline ScanFlag operator&(ScanFlag left, ScanFlag right)
{
return static_cast<ScanFlag>(static_cast<unsigned>(left) & static_cast<unsigned>(right));
}
inline bool has_flag(ScanFlag flags, ScanFlag which)
{
return (flags & which) == which;
}
inline void serialize(std::istream& str, ScanFlag& x)
{
unsigned value;
serialize(str, value);
x = static_cast<ScanFlag>(value);
}
inline void serialize(std::ostream& str, ScanFlag& x)
{
unsigned value = static_cast<unsigned>(x);
serialize(str, value);
}
std::ostream& operator<<(std::ostream& out, ScanFlag flags);
enum class Direction : unsigned
{
FORWARD = 0,
BACKWARD = 1
};
enum class MotorMode : unsigned
{
PRIMARY = 0,
PRIMARY_AND_SECONDARY,
SECONDARY,
};
} // namespace genesys
#endif // BACKEND_GENESYS_ENUMS_H
|