]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change descriptors extra file
authorBastian Dehn <hhaalo@arcor.de>
Sun, 28 Jan 2024 08:44:05 +0000 (09:44 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 28 Jan 2024 08:44:05 +0000 (09:44 +0100)
src/kds_s2000w_net.c
src/kds_s2000w_option_descriptors.c
src/kds_s2000w_option_descriptors.h

index b36007929d8ed565fe7e5e9296559608e8516ac1..b9d728cf779c7ae7615f895ce0f3f9116b627d08 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <sane/sane.h>
-#include <sane/saneopts.h>
 #include "kds_s2000w_option_descriptors.h"
 #include "kds_s2000w_handler.h"
 
-#define MAX_OPTION_COUNT 24
-
 SANE_Option_Descriptor* option_descriptors = NULL;
-
-SANE_Word* constraint_dpi = NULL;
-SANE_String_Const* constraint_scanside = NULL;
-SANE_String_Const* constraint_colormode = NULL;
-SANE_String_Const* constraint_colordrop = NULL;
-SANE_Range* constraint_color_drop_out_aggressiveness_range = NULL;
-SANE_String_Const* constraint_output_type = NULL;
-SANE_String_Const* constraint_color_auto_brightnessmode = NULL;
-SANE_String_Const* constraint_color_balance_mode = NULL;
-SANE_Range* constraint_color_balance_aggressiveness = NULL;
-SANE_Range* constraint_color_balance_red = NULL;
-SANE_Range* constraint_color_balance_green = NULL;
-SANE_Range* constraint_color_balance_blue = NULL;
-SANE_String_Const* constraint_foreground_boldness_mode = NULL;
-SANE_Range* constraint_foreground_boldness_aggressiveness = NULL;
-SANE_String_Const* constraint_background_smoothing_mode = NULL;
-SANE_Range* constraint_background_smoothing_aggressivness = NULL;
-SANE_String_Const* constraint_binarization_mode = NULL;
-SANE_Range* constraint_binarization_contrast = NULL;
-SANE_String_Const* constraint_max_document_length = NULL;
-SANE_String_Const* constraint_scan_source = NULL;
-
 SANE_Device* device_info = NULL;
 SANE_Parameters* parameter = NULL;
 
-void _init_option_descriptor_array()
-{
-       constraint_dpi = malloc(sizeof(SANE_Int) * 3);
-       constraint_scanside = malloc(sizeof(char*) * 3);
-       constraint_colormode = malloc(sizeof(char*) * 5);
-       constraint_colordrop = malloc(sizeof(char*) * 9);
-       constraint_color_drop_out_aggressiveness_range = malloc(sizeof(SANE_Range));
-       constraint_output_type = malloc(sizeof(char*) * 3);
-       constraint_color_auto_brightnessmode = malloc(sizeof(char*) * 3);
-       constraint_color_balance_mode = malloc(sizeof(char*) * 5);
-       constraint_color_balance_aggressiveness = malloc(sizeof(SANE_Range));
-       constraint_color_balance_red = malloc(sizeof(SANE_Range));
-       constraint_color_balance_green = malloc(sizeof(SANE_Range));
-       constraint_color_balance_blue = malloc(sizeof(SANE_Range));
-       constraint_foreground_boldness_mode = malloc(sizeof(char*) * 4);
-       constraint_foreground_boldness_aggressiveness = malloc(sizeof(SANE_Range));
-       constraint_background_smoothing_mode = malloc(sizeof(char*) * 4);
-       constraint_background_smoothing_aggressivness = malloc(sizeof(SANE_Range));
-       constraint_binarization_mode = malloc(sizeof(char*) * 2);
-       constraint_binarization_contrast = malloc(sizeof(SANE_Range));
-       constraint_max_document_length = malloc(sizeof(char*) * 2);
-       constraint_scan_source = malloc(sizeof(char*) * 4);
-
-       option_descriptors = malloc(sizeof(SANE_Option_Descriptor) * MAX_OPTION_COUNT);
-}
-
-void _free_option_descriptor_array()
-{
-       free(constraint_dpi);
-       constraint_dpi = NULL;
-       free(constraint_scanside);
-       constraint_scanside = NULL;
-       free(constraint_colormode);
-       constraint_colormode = NULL;
-       free(constraint_colordrop);
-       constraint_colordrop = NULL;
-       free(constraint_color_drop_out_aggressiveness_range);
-       constraint_color_drop_out_aggressiveness_range = NULL;
-       free(constraint_output_type);
-       constraint_output_type = NULL;
-       free(constraint_color_auto_brightnessmode);
-       constraint_color_auto_brightnessmode = NULL;
-       free(constraint_color_balance_mode);
-       constraint_color_balance_mode = NULL;
-       free(constraint_color_balance_aggressiveness);
-       constraint_color_balance_aggressiveness = NULL;
-       free(constraint_color_balance_red);
-       constraint_color_balance_red = NULL;
-       free(constraint_color_balance_green);
-       constraint_color_balance_green = NULL;
-       free(constraint_color_balance_blue);
-       constraint_color_balance_blue = NULL;
-       free(constraint_foreground_boldness_mode);
-       constraint_foreground_boldness_mode = NULL;
-       free(constraint_foreground_boldness_aggressiveness);
-       constraint_foreground_boldness_aggressiveness = NULL;
-       free(constraint_background_smoothing_mode);
-       constraint_background_smoothing_mode = NULL;
-       free(constraint_background_smoothing_aggressivness);
-       constraint_background_smoothing_aggressivness = NULL;
-       free(constraint_binarization_mode);
-       constraint_binarization_mode = NULL;
-       free(constraint_binarization_contrast);
-       constraint_binarization_contrast = NULL;
-       free(constraint_max_document_length);
-       constraint_max_document_length = NULL;
-       free(constraint_scan_source);
-       constraint_scan_source = NULL;
-
-       free(option_descriptors);
-       option_descriptors = NULL;
-}
-
 SANE_Status _sane_kds_s2000w_net_init(SANE_Int* version_code, SANE_Auth_Callback authorize)
 {
        *version_code = SANE_VERSION_CODE(1, 0, 0);
-       _init_option_descriptor_array();
+       option_descriptors = kds_s2000w_option_descriptor_init_option_descriptors();
        device_info = malloc(sizeof(SANE_Device));
        parameter = malloc(sizeof(SANE_Parameters));
        return SANE_STATUS_GOOD;
@@ -125,7 +27,7 @@ void _sane_kds_s2000w_net_exit(void)
        device_info = NULL;
        free(parameter);
        parameter = NULL;
-       _free_option_descriptor_array();
+       kds_s2000w_option_descriptor_free_option_descriptors(option_descriptors);
 }
 
 SANE_Status _sane_kds_s2000w_net_get_devices(SANE_Device*** device_list,
@@ -175,304 +77,73 @@ const SANE_Option_Descriptor* _sane_kds_s2000w_net_get_option_descriptor(
                        kds_s2000w_option_descriptor_num_options(&option_descriptors[option]);
                        break;
                case 1:
-                       option_descriptors[option].name = SANE_NAME_STANDARD;
-                       option_descriptors[option].title = SANE_TITLE_STANDARD;
-                       option_descriptors[option].desc = SANE_DESC_STANDARD;
-                       option_descriptors[option].unit = SANE_UNIT_NONE;
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_NONE;
-                       option_descriptors[option].constraint.string_list = NULL;
+                       kds_s2000w_option_descriptor_standard_group(&option_descriptors[option]);
                        break;
                case 2:
-                       option_descriptors[option].name = SANE_NAME_SCAN_RESOLUTION;
-                       option_descriptors[option].title = SANE_TITLE_SCAN_RESOLUTION;
-                       option_descriptors[option].desc = SANE_DESC_SCAN_RESOLUTION;
-                       option_descriptors[option].unit = SANE_UNIT_DPI;
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_WORD_LIST;
-                       constraint_dpi[0] = 2;
-                       constraint_dpi[1] = 200;
-                       constraint_dpi[2] = 300;
-                       option_descriptors[option].constraint.word_list = constraint_dpi;
+                       kds_s2000w_option_descriptor_dpi(&option_descriptors[option]);
                        break;
                case 3:
-                       option_descriptors[option].name = "scanside";
-                       option_descriptors[option].title = "Duplex Mode";
-                       option_descriptors[option].desc = "Duplex Mode";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_STRING_LIST;
-                       constraint_scanside[0] = "Simplex";
-                       constraint_scanside[1] = "Duplex";
-                       constraint_scanside[2] = NULL;
-                       option_descriptors[option].constraint.string_list = constraint_scanside;
+                       kds_s2000w_option_descriptor_scanside(&option_descriptors[option]);
                        break;
                case 4:
-                       option_descriptors[option].name = SANE_NAME_SCAN_MODE;
-                       option_descriptors[option].title = SANE_TITLE_SCAN_MODE;
-                       option_descriptors[option].desc = SANE_DESC_SCAN_MODE;
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_STRING_LIST;
-                       constraint_colormode[0] = "Color";
-                       constraint_colormode[1] = "Gray";
-                       constraint_colormode[2] = "BW";
-                       constraint_colormode[3] = "Color_BW";
-                       constraint_colormode[4] = NULL;
-                       option_descriptors[option].constraint.string_list = constraint_colormode;
+                       kds_s2000w_option_descriptor_color_mode(&option_descriptors[option]);
                        break;
                case 5:
-                       option_descriptors[option].name = "skip-blank-pages";
-                       option_descriptors[option].title = "Blank Image Deletion Mode";
-                       option_descriptors[option].desc = "Blank Image Deletion Mode";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_NONE;
-                       option_descriptors[option].constraint.string_list = NULL;
+                       kds_s2000w_option_descriptor_skip_blank_pages(&option_descriptors[option]);
                        break;
                case 6:
-                       option_descriptors[option].name = "autostart";
-                       option_descriptors[option].title = "autostart";
-                       option_descriptors[option].desc = "autostart";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_NONE;
-                       option_descriptors[option].constraint.string_list = NULL;
+                       kds_s2000w_option_descriptor_auto_start(&option_descriptors[option]);
                        break;
                case 7:
-                       option_descriptors[option].name = "colordrop";
-                       option_descriptors[option].title = "colordrop";
-                       option_descriptors[option].desc = "colordrop";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_STRING_LIST;
-                       constraint_colordrop[0] = "None";
-                       constraint_colordrop[1] = "Red";
-                       constraint_colordrop[2] = "Green";
-                       constraint_colordrop[3] = "Blue";
-                       constraint_colordrop[4] = "Orange";
-                       constraint_colordrop[5] = "OrangeAndRed";
-                       constraint_colordrop[6] = "Predominant";
-                       constraint_colordrop[7] = "Multiple";
-                       constraint_colordrop[8] = NULL;
-                       option_descriptors[option].constraint.string_list = constraint_colordrop;
+                       kds_s2000w_option_descriptor_color_drop(&option_descriptors[option]);
                        break;
                case 8:
-                       option_descriptors[option].name = "colordropoutaggressiveness";
-                       option_descriptors[option].title = "colordropoutaggressiveness";
-                       option_descriptors[option].desc = "colordropoutaggressiveness";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_RANGE;
-                       constraint_color_drop_out_aggressiveness_range->min = -10;
-                       constraint_color_drop_out_aggressiveness_range->max = 10;
-                       constraint_color_drop_out_aggressiveness_range->quant = 1;
-                       option_descriptors[option].constraint.range = constraint_color_drop_out_aggressiveness_range;
+                       kds_s2000w_option_descriptor_color_drop_out_aggressiveness(&option_descriptors[option]);
                        break;
                case 9:
-                       option_descriptors[option].name = "outputtype";
-                       option_descriptors[option].title = "outputtype";
-                       option_descriptors[option].desc = "outputtype";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_STRING_LIST;
-                       constraint_output_type[0] = "Images";
-                       constraint_output_type[1] = "SinglePageColorPDFPlus2TIFs";
-                       constraint_output_type[2] = NULL;
-                       option_descriptors[option].constraint.string_list = constraint_output_type;
+                       kds_s2000w_option_descriptor_output_type(&option_descriptors[option]);
                        break;
                case 10:
-                       option_descriptors[option].name = "colorautobrightnessmode";
-                       option_descriptors[option].title = "colorautobrightnessmode";
-                       option_descriptors[option].desc = "colorautobrightnessmode";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_STRING_LIST;
-                       constraint_color_auto_brightnessmode[0] = "None";
-                       constraint_color_auto_brightnessmode[1] = "Automatic";
-                       constraint_color_auto_brightnessmode[2] = NULL;
-                       option_descriptors[option].constraint.string_list = constraint_color_auto_brightnessmode;
+                       kds_s2000w_option_descriptor_color_auto_brightness_mode(&option_descriptors[option]);
                        break;
                case 11:
-                       option_descriptors[option].name = "colorbalancemode";
-                       option_descriptors[option].title = "colorbalancemode";
-                       option_descriptors[option].desc = "colorbalancemode";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_STRING_LIST;
-                       constraint_color_balance_mode[0] = "None";
-                       constraint_color_balance_mode[1] = "Manual";
-                       constraint_color_balance_mode[2] = "Automatic";
-                       constraint_color_balance_mode[3] = "AutomaticAdvanced";
-                       constraint_color_balance_mode[4] = NULL;
-                       option_descriptors[option].constraint.string_list = constraint_color_balance_mode;
+                       kds_s2000w_option_descriptor_color_balance_mode(&option_descriptors[option]);
                        break;
                case 12:
-                       option_descriptors[option].name = "colorbalanceaggressiveness";
-                       option_descriptors[option].title = "colorbalanceaggressiveness";
-                       option_descriptors[option].desc = "colorbalanceaggressiveness";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_RANGE;
-                       constraint_color_balance_aggressiveness->min = -2;
-                       constraint_color_balance_aggressiveness->max = 2;
-                       constraint_color_balance_aggressiveness->quant = 1;
-                       option_descriptors[option].constraint.range = constraint_color_balance_aggressiveness;
+                       kds_s2000w_option_descriptor_color_balancea_ggressiveness(&option_descriptors[option]);
                        break;
                case 13:
-                       option_descriptors[option].name = "colorbalancered";
-                       option_descriptors[option].title = "colorbalancered";
-                       option_descriptors[option].desc = "colorbalancered";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_RANGE;
-                       constraint_color_balance_red->min = -50;
-                       constraint_color_balance_red->max = 50;
-                       constraint_color_balance_red->quant = 1;
-                       option_descriptors[option].constraint.range = constraint_color_balance_red;
+                       kds_s2000w_option_descriptor_color_balance_red(&option_descriptors[option]);
                        break;
                case 14:
-                       option_descriptors[option].name = "colorbalancegreen";
-                       option_descriptors[option].title = "colorbalancegreen";
-                       option_descriptors[option].desc = "colorbalancegreen";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_RANGE;
-                       constraint_color_balance_green->min = -50;
-                       constraint_color_balance_green->max = 50;
-                       constraint_color_balance_green->quant = 1;
-                       option_descriptors[option].constraint.range = constraint_color_balance_green;
+                       kds_s2000w_option_descriptor_color_balance_green(&option_descriptors[option]);
                        break;
                case 15:
-                       option_descriptors[option].name = "color-balance-blue";
-                       option_descriptors[option].title = "colorbalanceblue";
-                       option_descriptors[option].desc = "colorbalanceblue";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_RANGE;
-                       constraint_color_balance_blue->min = -50;
-                       constraint_color_balance_blue->max = 50;
-                       constraint_color_balance_blue->quant = 1;
-                       option_descriptors[option].constraint.range = constraint_color_balance_blue;
+                       kds_s2000w_option_descriptor_color_balance_blue(&option_descriptors[option]);
                        break;
                case 16:
-                       option_descriptors[option].name = "foreground-boldness-mode";
-                       option_descriptors[option].title = "Foreground Boldness Mode";
-                       option_descriptors[option].desc = "Foreground Boldness Mode";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_STRING_LIST;
-                       constraint_foreground_boldness_mode[0] = "None";
-                       constraint_foreground_boldness_mode[1] = "AutomaticAdvanced";
-                       constraint_foreground_boldness_mode[2] = "Automatic";
-                       constraint_foreground_boldness_mode[3] = NULL;
-                       option_descriptors[option].constraint.string_list = constraint_foreground_boldness_mode;
+                       kds_s2000w_option_descriptor_foreground_boldness_mode(&option_descriptors[option]);
                        break;
                case 17:
-                       option_descriptors[option].name = "foreground-boldness-aggressiveness";
-                       option_descriptors[option].title = "Foreground Boldness Mode";
-                       option_descriptors[option].desc = "Foreground Boldness Mode";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_RANGE;
-                       constraint_foreground_boldness_aggressiveness->min = -10;
-                       constraint_foreground_boldness_aggressiveness->max = 10;
-                       constraint_foreground_boldness_aggressiveness->quant = 1;
-                       option_descriptors[option].constraint.range = constraint_foreground_boldness_aggressiveness;
+                       kds_s2000w_option_descriptor_foreground_boldness_aggressiveness(&option_descriptors[option]);
                        break;
                case 18:
-                       option_descriptors[option].name = "background-smoothing-mode";
-                       option_descriptors[option].title = "Background Smoothing Mode";
-                       option_descriptors[option].desc = "Background Smoothing Mode";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_STRING_LIST;
-                       constraint_background_smoothing_mode[0] = "None";
-                       constraint_background_smoothing_mode[1] = "AutomaticAdvanced";
-                       constraint_background_smoothing_mode[2] = "Automatic";
-                       constraint_background_smoothing_mode[3] = NULL;
-                       option_descriptors[option].constraint.string_list = constraint_background_smoothing_mode;
+                       kds_s2000w_option_descriptor_background_smoothing_mode(&option_descriptors[option]);
                        break;
                case 19:
-                       option_descriptors[option].name = "background-smoothing-aggressiveness";
-                       option_descriptors[option].title = "Background Smoothing Aggressivenes";
-                       option_descriptors[option].desc = "Background Smoothing Aggressivenes";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_RANGE;
-                       constraint_background_smoothing_aggressivness->min = -10;
-                       constraint_background_smoothing_aggressivness->max = 10;
-                       constraint_background_smoothing_aggressivness->quant = 1;
-                       option_descriptors[option].constraint.range = constraint_background_smoothing_aggressivness;
+                       kds_s2000w_option_descriptor_background_smoothing_aggressiveness(&option_descriptors[option]);
                        break;
                case 20:
-                       option_descriptors[option].name = "binarization-mode";
-                       option_descriptors[option].title = "binarizationmode";
-                       option_descriptors[option].desc = "binarizationmode";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_STRING_LIST;
-                       constraint_binarization_mode[0] = "iThresholding";
-                       constraint_binarization_mode[1] = NULL;
-                       option_descriptors[option].constraint.string_list = constraint_binarization_mode;
+                       kds_s2000w_option_descriptor_binarization_mode(&option_descriptors[option]);
                        break;
                case 21:
-                       option_descriptors[option].name = SANE_NAME_CONTRAST;
-                       option_descriptors[option].title = SANE_TITLE_CONTRAST;
-                       option_descriptors[option].desc = SANE_DESC_CONTRAST;
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_RANGE;
-                       constraint_binarization_contrast->min = -50;
-                       constraint_binarization_contrast->max = 50;
-                       constraint_binarization_contrast->quant = 1;
-                       option_descriptors[option].constraint.range = constraint_binarization_contrast;
+                       kds_s2000w_option_descriptor_binarization_contrast(&option_descriptors[option]);
                        break;
                case 22:
-                       option_descriptors[option].name = "maxdocumentlength";
-                       option_descriptors[option].title = "maxdocumentlength";
-                       option_descriptors[option].desc = "maxdocumentlength";
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_STRING_LIST;
-                       constraint_max_document_length[0] = "#NoPrimaryControl#";
-                       constraint_max_document_length[1] = NULL;
-                       option_descriptors[option].constraint.string_list = constraint_max_document_length;
+                       kds_s2000w_option_descriptor_max_document_length(&option_descriptors[option]);
                        break;
                case 23:
-                       option_descriptors[option].name = SANE_NAME_SCAN_SOURCE;
-                       option_descriptors[option].title = SANE_TITLE_SCAN_SOURCE;
-                       option_descriptors[option].desc = SANE_DESC_SCAN_SOURCE;
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_STRING_LIST;
-                       constraint_scan_source[0] = "DocumentFeeder";
-                       constraint_scan_source[1] = "Automatic";
-                       constraint_scan_source[2] = "Flatbed";
-                       constraint_scan_source[3] = NULL;
-                       option_descriptors[option].constraint.string_list = constraint_scan_source;
-                       break;
-               default:
-                       return NULL;
-                       break;
-       }
-
-
-       switch (option) {
-               case 2:
-               case 8:
-               case 12:
-               case 13:
-               case 14:
-               case 15:
-               case 17:
-               case 19:
-               case 21:
-               case 22:
-                       option_descriptors[option].type = SANE_TYPE_INT;
-                       option_descriptors[option].size = sizeof(SANE_Int);
-                       break;
-               case 1:
-                       option_descriptors[option].type = SANE_TYPE_GROUP;
-                       option_descriptors[option].size = 0;
-                       break;
-               case 3:
-               case 4:
-               case 7:
-               case 9:
-               case 10:
-               case 11:
-               case 16:
-               case 18:
-               case 20:
-               case 23:
-                       option_descriptors[option].type = SANE_TYPE_STRING;
-                       option_descriptors[option].unit = SANE_UNIT_NONE;
-                       option_descriptors[option].size = sizeof(SANE_String) * 50;
-                       break;
-               case 5:
-               case 6:
-                       option_descriptors[option].type = SANE_TYPE_BOOL;
-                       option_descriptors[option].size = sizeof(SANE_Bool);
+                       kds_s2000w_option_descriptor_scan_source(&option_descriptors[option]);
                        break;
                default:
                        return NULL;
index fa42589b63dc05861b164db4934d75781c2ee0b6..fc2fe3761a4f7242277396711f197a746f1fc100 100644 (file)
-#include <stddef.h>
+#include <stdlib.h>
 #include <sane/saneopts.h>
 #include "kds_s2000w_option_descriptors.h"
 
+#define MAX_OPTION_COUNT 24
+
+SANE_Word* constraint_dpi = NULL;
+SANE_String_Const* constraint_scanside = NULL;
+SANE_String_Const* constraint_colormode = NULL;
+SANE_String_Const* constraint_colordrop = NULL;
+SANE_Range* constraint_color_drop_out_aggressiveness_range = NULL;
+SANE_String_Const* constraint_output_type = NULL;
+SANE_String_Const* constraint_color_auto_brightnessmode = NULL;
+SANE_String_Const* constraint_color_balance_mode = NULL;
+SANE_Range* constraint_color_balance_aggressiveness = NULL;
+SANE_Range* constraint_color_balance_red = NULL;
+SANE_Range* constraint_color_balance_green = NULL;
+SANE_Range* constraint_color_balance_blue = NULL;
+SANE_String_Const* constraint_foreground_boldness_mode = NULL;
+SANE_Range* constraint_foreground_boldness_aggressiveness = NULL;
+SANE_String_Const* constraint_background_smoothing_mode = NULL;
+SANE_Range* constraint_background_smoothing_aggressivness = NULL;
+SANE_String_Const* constraint_binarization_mode = NULL;
+SANE_Range* constraint_binarization_contrast = NULL;
+SANE_String_Const* constraint_max_document_length = NULL;
+SANE_String_Const* constraint_scan_source = NULL;
+
+SANE_Option_Descriptor* kds_s2000w_option_descriptor_init_option_descriptors()
+{
+       constraint_dpi = malloc(sizeof(SANE_Int) * 3);
+       constraint_scanside = malloc(sizeof(char*) * 3);
+       constraint_colormode = malloc(sizeof(char*) * 5);
+       constraint_colordrop = malloc(sizeof(char*) * 9);
+       constraint_color_drop_out_aggressiveness_range = malloc(sizeof(SANE_Range));
+       constraint_output_type = malloc(sizeof(char*) * 3);
+       constraint_color_auto_brightnessmode = malloc(sizeof(char*) * 3);
+       constraint_color_balance_mode = malloc(sizeof(char*) * 5);
+       constraint_color_balance_aggressiveness = malloc(sizeof(SANE_Range));
+       constraint_color_balance_red = malloc(sizeof(SANE_Range));
+       constraint_color_balance_green = malloc(sizeof(SANE_Range));
+       constraint_color_balance_blue = malloc(sizeof(SANE_Range));
+       constraint_foreground_boldness_mode = malloc(sizeof(char*) * 4);
+       constraint_foreground_boldness_aggressiveness = malloc(sizeof(SANE_Range));
+       constraint_background_smoothing_mode = malloc(sizeof(char*) * 4);
+       constraint_background_smoothing_aggressivness = malloc(sizeof(SANE_Range));
+       constraint_binarization_mode = malloc(sizeof(char*) * 2);
+       constraint_binarization_contrast = malloc(sizeof(SANE_Range));
+       constraint_max_document_length = malloc(sizeof(char*) * 2);
+       constraint_scan_source = malloc(sizeof(char*) * 4);
+
+       SANE_Option_Descriptor* descriptor_array = malloc(sizeof(SANE_Option_Descriptor) * MAX_OPTION_COUNT);
+       return descriptor_array;
+}
+
+void kds_s2000w_option_descriptor_free_option_descriptors(SANE_Option_Descriptor* descriptor_array)
+{
+       free(constraint_dpi);
+       constraint_dpi = NULL;
+       free(constraint_scanside);
+       constraint_scanside = NULL;
+       free(constraint_colormode);
+       constraint_colormode = NULL;
+       free(constraint_colordrop);
+       constraint_colordrop = NULL;
+       free(constraint_color_drop_out_aggressiveness_range);
+       constraint_color_drop_out_aggressiveness_range = NULL;
+       free(constraint_output_type);
+       constraint_output_type = NULL;
+       free(constraint_color_auto_brightnessmode);
+       constraint_color_auto_brightnessmode = NULL;
+       free(constraint_color_balance_mode);
+       constraint_color_balance_mode = NULL;
+       free(constraint_color_balance_aggressiveness);
+       constraint_color_balance_aggressiveness = NULL;
+       free(constraint_color_balance_red);
+       constraint_color_balance_red = NULL;
+       free(constraint_color_balance_green);
+       constraint_color_balance_green = NULL;
+       free(constraint_color_balance_blue);
+       constraint_color_balance_blue = NULL;
+       free(constraint_foreground_boldness_mode);
+       constraint_foreground_boldness_mode = NULL;
+       free(constraint_foreground_boldness_aggressiveness);
+       constraint_foreground_boldness_aggressiveness = NULL;
+       free(constraint_background_smoothing_mode);
+       constraint_background_smoothing_mode = NULL;
+       free(constraint_background_smoothing_aggressivness);
+       constraint_background_smoothing_aggressivness = NULL;
+       free(constraint_binarization_mode);
+       constraint_binarization_mode = NULL;
+       free(constraint_binarization_contrast);
+       constraint_binarization_contrast = NULL;
+       free(constraint_max_document_length);
+       constraint_max_document_length = NULL;
+       free(constraint_scan_source);
+       constraint_scan_source = NULL;
+
+       free(descriptor_array);
+       descriptor_array = NULL;
+}
+
 void kds_s2000w_option_descriptor_num_options(SANE_Option_Descriptor* descriptor)
 {
-               descriptor->name = SANE_NAME_NUM_OPTIONS;
-               descriptor->title = SANE_TITLE_NUM_OPTIONS;
-               descriptor->desc = SANE_DESC_NUM_OPTIONS;
-               descriptor->unit = SANE_UNIT_NONE;
-               descriptor->cap = SANE_CAP_SOFT_DETECT;
-               descriptor->constraint_type = SANE_CONSTRAINT_NONE;
-               descriptor->constraint.string_list = NULL;
-               descriptor->type = SANE_TYPE_INT;
-               descriptor->size = sizeof(SANE_Int);
+       descriptor->name = SANE_NAME_NUM_OPTIONS;
+       descriptor->title = SANE_TITLE_NUM_OPTIONS;
+       descriptor->desc = SANE_DESC_NUM_OPTIONS;
+       descriptor->unit = SANE_UNIT_NONE;
+       descriptor->cap = SANE_CAP_SOFT_DETECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_NONE;
+       descriptor->constraint.string_list = NULL;
+       descriptor->type = SANE_TYPE_INT;
+       descriptor->size = sizeof(SANE_Int);
+}
+
+void kds_s2000w_option_descriptor_standard_group(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = SANE_NAME_STANDARD;
+       descriptor->title = SANE_TITLE_STANDARD;
+       descriptor->desc = SANE_DESC_STANDARD;
+       descriptor->unit = SANE_UNIT_NONE;
+       descriptor->cap = SANE_CAP_SOFT_DETECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_NONE;
+       descriptor->constraint.string_list = NULL;
+       descriptor->type = SANE_TYPE_GROUP;
+       descriptor->size = 0;
+}
+
+void kds_s2000w_option_descriptor_dpi(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = SANE_NAME_SCAN_RESOLUTION;
+       descriptor->title = SANE_TITLE_SCAN_RESOLUTION;
+       descriptor->desc = SANE_DESC_SCAN_RESOLUTION;
+       descriptor->unit = SANE_UNIT_DPI;
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_WORD_LIST;
+       constraint_dpi[0] = 2;
+       constraint_dpi[1] = 200;
+       constraint_dpi[2] = 300;
+       descriptor->constraint.word_list = constraint_dpi;
+       descriptor->type = SANE_TYPE_INT;
+       descriptor->size = sizeof(SANE_Int);
+}
+
+void kds_s2000w_option_descriptor_scanside(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "scanside";
+       descriptor->title = "Duplex Mode";
+       descriptor->desc = "Duplex Mode";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST;
+       constraint_scanside[0] = "Simplex";
+       constraint_scanside[1] = "Duplex";
+       constraint_scanside[2] = NULL;
+       descriptor->constraint.string_list = constraint_scanside;
+       descriptor->type = SANE_TYPE_STRING;
+       descriptor->unit = SANE_UNIT_NONE;
+       descriptor->size = sizeof(SANE_String) * 50;
+}
+
+void kds_s2000w_option_descriptor_color_mode(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = SANE_NAME_SCAN_MODE;
+       descriptor->title = SANE_TITLE_SCAN_MODE;
+       descriptor->desc = SANE_DESC_SCAN_MODE;
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST;
+       constraint_colormode[0] = "Color";
+       constraint_colormode[1] = "Gray";
+       constraint_colormode[2] = "BW";
+       constraint_colormode[3] = "Color_BW";
+       constraint_colormode[4] = NULL;
+       descriptor->constraint.string_list = constraint_colormode;
+       descriptor->type = SANE_TYPE_STRING;
+       descriptor->unit = SANE_UNIT_NONE;
+       descriptor->size = sizeof(SANE_String) * 50;
+}
+
+void kds_s2000w_option_descriptor_skip_blank_pages(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "skip-blank-pages";
+       descriptor->title = "Blank Image Deletion Mode";
+       descriptor->desc = "Blank Image Deletion Mode";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_NONE;
+       descriptor->constraint.string_list = NULL;
+       descriptor->type = SANE_TYPE_BOOL;
+       descriptor->size = sizeof(SANE_Bool);
+}
+
+void kds_s2000w_option_descriptor_auto_start(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "autostart";
+       descriptor->title = "autostart";
+       descriptor->desc = "autostart";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_NONE;
+       descriptor->constraint.string_list = NULL;
+       descriptor->type = SANE_TYPE_BOOL;
+       descriptor->size = sizeof(SANE_Bool);
+}
+
+void kds_s2000w_option_descriptor_color_drop(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "colordrop";
+       descriptor->title = "colordrop";
+       descriptor->desc = "colordrop";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST;
+       constraint_colordrop[0] = "None";
+       constraint_colordrop[1] = "Red";
+       constraint_colordrop[2] = "Green";
+       constraint_colordrop[3] = "Blue";
+       constraint_colordrop[4] = "Orange";
+       constraint_colordrop[5] = "OrangeAndRed";
+       constraint_colordrop[6] = "Predominant";
+       constraint_colordrop[7] = "Multiple";
+       constraint_colordrop[8] = NULL;
+       descriptor->constraint.string_list = constraint_colordrop;
+       descriptor->type = SANE_TYPE_STRING;
+       descriptor->unit = SANE_UNIT_NONE;
+       descriptor->size = sizeof(SANE_String) * 50;
+}
+
+void kds_s2000w_option_descriptor_color_drop_out_aggressiveness(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "colordropoutaggressiveness";
+       descriptor->title = "colordropoutaggressiveness";
+       descriptor->desc = "colordropoutaggressiveness";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
+       constraint_color_drop_out_aggressiveness_range->min = -10;
+       constraint_color_drop_out_aggressiveness_range->max = 10;
+       constraint_color_drop_out_aggressiveness_range->quant = 1;
+       descriptor->constraint.range = constraint_color_drop_out_aggressiveness_range;
+       descriptor->type = SANE_TYPE_INT;
+       descriptor->size = sizeof(SANE_Int);
+}
+
+void kds_s2000w_option_descriptor_output_type(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "outputtype";
+       descriptor->title = "outputtype";
+       descriptor->desc = "outputtype";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST;
+       constraint_output_type[0] = "Images";
+       constraint_output_type[1] = "SinglePageColorPDFPlus2TIFs";
+       constraint_output_type[2] = NULL;
+       descriptor->constraint.string_list = constraint_output_type;
+       descriptor->type = SANE_TYPE_STRING;
+       descriptor->unit = SANE_UNIT_NONE;
+       descriptor->size = sizeof(SANE_String) * 50;
+}
+
+void kds_s2000w_option_descriptor_color_auto_brightness_mode(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "colorautobrightnessmode";
+       descriptor->title = "colorautobrightnessmode";
+       descriptor->desc = "colorautobrightnessmode";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST;
+       constraint_color_auto_brightnessmode[0] = "None";
+       constraint_color_auto_brightnessmode[1] = "Automatic";
+       constraint_color_auto_brightnessmode[2] = NULL;
+       descriptor->constraint.string_list = constraint_color_auto_brightnessmode;
+       descriptor->type = SANE_TYPE_STRING;
+       descriptor->unit = SANE_UNIT_NONE;
+       descriptor->size = sizeof(SANE_String) * 50;
+}
+
+void kds_s2000w_option_descriptor_color_balance_mode(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "colorbalancemode";
+       descriptor->title = "colorbalancemode";
+       descriptor->desc = "colorbalancemode";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST;
+       constraint_color_balance_mode[0] = "None";
+       constraint_color_balance_mode[1] = "Manual";
+       constraint_color_balance_mode[2] = "Automatic";
+       constraint_color_balance_mode[3] = "AutomaticAdvanced";
+       constraint_color_balance_mode[4] = NULL;
+       descriptor->constraint.string_list = constraint_color_balance_mode;
+       descriptor->type = SANE_TYPE_STRING;
+       descriptor->unit = SANE_UNIT_NONE;
+       descriptor->size = sizeof(SANE_String) * 50;
+}
+
+void kds_s2000w_option_descriptor_color_balancea_ggressiveness(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "colorbalanceaggressiveness";
+       descriptor->title = "colorbalanceaggressiveness";
+       descriptor->desc = "colorbalanceaggressiveness";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
+       constraint_color_balance_aggressiveness->min = -2;
+       constraint_color_balance_aggressiveness->max = 2;
+       constraint_color_balance_aggressiveness->quant = 1;
+       descriptor->constraint.range = constraint_color_balance_aggressiveness;
+       descriptor->type = SANE_TYPE_INT;
+       descriptor->size = sizeof(SANE_Int);
+}
+
+void kds_s2000w_option_descriptor_color_balance_red(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "colorbalancered";
+       descriptor->title = "colorbalancered";
+       descriptor->desc = "colorbalancered";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
+       constraint_color_balance_red->min = -50;
+       constraint_color_balance_red->max = 50;
+       constraint_color_balance_red->quant = 1;
+       descriptor->constraint.range = constraint_color_balance_red;
+       descriptor->type = SANE_TYPE_INT;
+       descriptor->size = sizeof(SANE_Int);
+}
+
+void kds_s2000w_option_descriptor_color_balance_green(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "colorbalancegreen";
+       descriptor->title = "colorbalancegreen";
+       descriptor->desc = "colorbalancegreen";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
+       constraint_color_balance_green->min = -50;
+       constraint_color_balance_green->max = 50;
+       constraint_color_balance_green->quant = 1;
+       descriptor->constraint.range = constraint_color_balance_green;
+       descriptor->type = SANE_TYPE_INT;
+       descriptor->size = sizeof(SANE_Int);
+}
+
+void kds_s2000w_option_descriptor_color_balance_blue(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "color-balance-blue";
+       descriptor->title = "colorbalanceblue";
+       descriptor->desc = "colorbalanceblue";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
+       constraint_color_balance_blue->min = -50;
+       constraint_color_balance_blue->max = 50;
+       constraint_color_balance_blue->quant = 1;
+       descriptor->constraint.range = constraint_color_balance_blue;
+       descriptor->type = SANE_TYPE_INT;
+       descriptor->size = sizeof(SANE_Int);
+}
+
+void kds_s2000w_option_descriptor_foreground_boldness_mode(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "foreground-boldness-mode";
+       descriptor->title = "Foreground Boldness Mode";
+       descriptor->desc = "Foreground Boldness Mode";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST;
+       constraint_foreground_boldness_mode[0] = "None";
+       constraint_foreground_boldness_mode[1] = "AutomaticAdvanced";
+       constraint_foreground_boldness_mode[2] = "Automatic";
+       constraint_foreground_boldness_mode[3] = NULL;
+       descriptor->constraint.string_list = constraint_foreground_boldness_mode;
+       descriptor->type = SANE_TYPE_STRING;
+       descriptor->unit = SANE_UNIT_NONE;
+       descriptor->size = sizeof(SANE_String) * 50;
+}
+
+void kds_s2000w_option_descriptor_foreground_boldness_aggressiveness(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "foreground-boldness-aggressiveness";
+       descriptor->title = "Foreground Boldness Mode";
+       descriptor->desc = "Foreground Boldness Mode";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
+       constraint_foreground_boldness_aggressiveness->min = -10;
+       constraint_foreground_boldness_aggressiveness->max = 10;
+       constraint_foreground_boldness_aggressiveness->quant = 1;
+       descriptor->constraint.range = constraint_foreground_boldness_aggressiveness;
+       descriptor->type = SANE_TYPE_INT;
+       descriptor->size = sizeof(SANE_Int);
+}
+
+void kds_s2000w_option_descriptor_background_smoothing_mode(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "background-smoothing-mode";
+       descriptor->title = "Background Smoothing Mode";
+       descriptor->desc = "Background Smoothing Mode";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST;
+       constraint_background_smoothing_mode[0] = "None";
+       constraint_background_smoothing_mode[1] = "AutomaticAdvanced";
+       constraint_background_smoothing_mode[2] = "Automatic";
+       constraint_background_smoothing_mode[3] = NULL;
+       descriptor->constraint.string_list = constraint_background_smoothing_mode;
+       descriptor->type = SANE_TYPE_STRING;
+       descriptor->unit = SANE_UNIT_NONE;
+       descriptor->size = sizeof(SANE_String) * 50;
+}
+
+void kds_s2000w_option_descriptor_background_smoothing_aggressiveness(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "background-smoothing-aggressiveness";
+       descriptor->title = "Background Smoothing Aggressivenes";
+       descriptor->desc = "Background Smoothing Aggressivenes";
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
+       constraint_background_smoothing_aggressivness->min = -10;
+       constraint_background_smoothing_aggressivness->max = 10;
+       constraint_background_smoothing_aggressivness->quant = 1;
+       descriptor->constraint.range = constraint_background_smoothing_aggressivness;
+       descriptor->type = SANE_TYPE_INT;
+       descriptor->size = sizeof(SANE_Int);
+}
+
+void kds_s2000w_option_descriptor_binarization_mode(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "binarization-mode";
+       descriptor->title = "binarizationmode";
+       descriptor->desc = "binarizationmode";
+       descriptor->cap = SANE_CAP_SOFT_DETECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST;
+       constraint_binarization_mode[0] = "iThresholding";
+       constraint_binarization_mode[1] = NULL;
+       descriptor->constraint.string_list = constraint_binarization_mode;
+       descriptor->type = SANE_TYPE_STRING;
+       descriptor->unit = SANE_UNIT_NONE;
+       descriptor->size = sizeof(SANE_String) * 50;
+}
+
+void kds_s2000w_option_descriptor_binarization_contrast(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = SANE_NAME_CONTRAST;
+       descriptor->title = SANE_TITLE_CONTRAST;
+       descriptor->desc = SANE_DESC_CONTRAST;
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_RANGE;
+       constraint_binarization_contrast->min = -50;
+       constraint_binarization_contrast->max = 50;
+       constraint_binarization_contrast->quant = 1;
+       descriptor->constraint.range = constraint_binarization_contrast;
+       descriptor->type = SANE_TYPE_INT;
+       descriptor->size = sizeof(SANE_Int);
+}
+
+void kds_s2000w_option_descriptor_max_document_length(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = "maxdocumentlength";
+       descriptor->title = "maxdocumentlength";
+       descriptor->desc = "maxdocumentlength";
+       descriptor->cap = SANE_CAP_SOFT_DETECT;
+       descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST;
+       constraint_max_document_length[0] = "#NoPrimaryControl#";
+       constraint_max_document_length[1] = NULL;
+       descriptor->constraint.string_list = constraint_max_document_length;
+       descriptor->type = SANE_TYPE_INT;
+       descriptor->size = sizeof(SANE_Int);
+}
+
+void kds_s2000w_option_descriptor_scan_source(SANE_Option_Descriptor* descriptor)
+{
+       descriptor->name = SANE_NAME_SCAN_SOURCE;
+       descriptor->title = SANE_TITLE_SCAN_SOURCE;
+       descriptor->desc = SANE_DESC_SCAN_SOURCE;
+       descriptor->cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT;;
+       descriptor->constraint_type = SANE_CONSTRAINT_STRING_LIST;
+       constraint_scan_source[0] = "DocumentFeeder";
+       constraint_scan_source[1] = "Automatic";
+       constraint_scan_source[2] = "Flatbed";
+       constraint_scan_source[3] = NULL;
+       descriptor->constraint.string_list = constraint_scan_source;
+       descriptor->type = SANE_TYPE_STRING;
+       descriptor->unit = SANE_UNIT_NONE;
+       descriptor->size = sizeof(SANE_String) * 50;
 }
\ No newline at end of file
index aefa49f95db56df29534dd45b3ceb10fde9fd90e..091786e0861bcc8da26d336e5477f5a43ae23b2c 100644 (file)
@@ -1,5 +1,31 @@
 #ifndef KDS_S2000W_OPTION_DESCRIPTORS_H
 #include <sane/sane.h>
 
+SANE_Option_Descriptor* kds_s2000w_option_descriptor_init_option_descriptors();
+void kds_s2000w_option_descriptor_free_option_descriptors(SANE_Option_Descriptor* descriptor_array);
+
 void kds_s2000w_option_descriptor_num_options(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_standard_group(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_dpi(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_scanside(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_color_mode(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_skip_blank_pages(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_auto_start(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_color_drop(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_color_drop_out_aggressiveness(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_output_type(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_color_auto_brightness_mode(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_color_balance_mode(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_color_balancea_ggressiveness(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_color_balance_red(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_color_balance_green(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_color_balance_blue(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_foreground_boldness_mode(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_foreground_boldness_aggressiveness(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_background_smoothing_mode(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_background_smoothing_aggressiveness(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_binarization_mode(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_binarization_contrast(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_max_document_length(SANE_Option_Descriptor* descriptor);
+void kds_s2000w_option_descriptor_scan_source(SANE_Option_Descriptor* descriptor);
 #endif
\ No newline at end of file