]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add min profile
authorBastian Dehn <hhaalo@arcor.de>
Tue, 23 Sep 2025 11:19:59 +0000 (13:19 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 23 Sep 2025 11:19:59 +0000 (13:19 +0200)
src/kds_s2000w_handler_opts.c
src/kds_s2000w_option_descriptors.c
src/kds_s2000w_option_descriptors.h

index b2518e5bfa6e6769680c39075db5a118bd0c88a0..01990b6a4844c131914b95f739aaad5e1ed14173 100644 (file)
@@ -267,16 +267,47 @@ void _kds_s2000w_handler_opts_set_info_option(option_descriptor* descriptor, int
                *info = RELOAD_OPTIONS | RELOAD_PARAMS;
 }
 
-void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value, int32_t* info)
+void _kds_s2000w_handler_opts_set_depends_opts(const char* config_name, json_object* config)
 {
-       if (option == STANDARD_GROUP_NUMBER
-               || option == GEOMETRY_GROUP_NUMBER
-               || option == BOLDNESS_SMOOTHING_NUMBER
-               || option == BOLDNESS_COLOR_NUMBER
-               || option == IMAGE_PROCESSING_NUMBER
-               || option == FEEDER_GROUP_NUMBER)
-               return;
+       if (strcmp(config_name, CROPPING_MODE) == 0) {
+               _kds_s2000w_handler_opts_set_enable_cropping_image(config);
+               _kds_s2000w_handler_opts_set_enable_suboptions_cropping_image(config);
+       }
+
+       if (strcmp(config_name, CROPPING_IMAGE) == 0)
+               _kds_s2000w_handler_opts_set_enable_suboptions_cropping_image(config);
+
+       if (strcmp(config_name, FOREGROUND_BOLDNESS_MODE) == 0)
+               _kds_s2000w_handler_opts_set_enable_boldness_aggressiveness(config);
+
+       if (strcmp(config_name, BACKGROUND_SMOOTHING_MODE) == 0)
+               _kds_s2000w_handler_opts_set_enable_smoothing_aggressiveness(config);
+
+       if (strcmp(config_name, COLOR_DROP_OUT) == 0)
+               _kds_s2000w_handler_opts_set_enable_color_drop_out_aggressiveness(config);
+
+       if (strcmp(config_name, COLOR_AUTO_BRIGHTNESS_MODE) == 0)
+               _kds_s2000w_handler_opts_set_enable_color_brightness_and_contrast(config);
 
+       if (strcmp(config_name, COLOR_BALANCE_MODE) == 0) {
+               _kds_s2000w_handler_opts_set_enable_color_balance(config);
+               _kds_s2000w_handler_opts_set_enable_color_aggressiveness(config);
+       }
+
+       if (strcmp(config_name, RESET) == 0) {
+               _kds_s2000w_handler_opts_set_enable_cropping_image(config);
+               _kds_s2000w_handler_opts_set_enable_suboptions_cropping_image(config);
+               _kds_s2000w_handler_opts_set_enable_boldness_aggressiveness(config);
+               _kds_s2000w_handler_opts_set_enable_smoothing_aggressiveness(config);
+               _kds_s2000w_handler_opts_set_enable_color_drop_out_aggressiveness(config);
+               _kds_s2000w_handler_opts_set_enable_color_brightness_and_contrast(config);
+               _kds_s2000w_handler_opts_set_enable_color_aggressiveness(config);
+               _kds_s2000w_handler_opts_set_enable_color_balance(config);
+       }
+}
+
+void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value, int32_t* info)
+{
        json_object* config = NULL;
        if (h->current_scanner_config == NULL) {
                _kds_s2000w_handler_opts_load_options(h);
@@ -322,14 +353,6 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value
        if (h->read_info->scan_started)
                return;
 
-       if (option == STANDARD_GROUP_NUMBER
-               || option == GEOMETRY_GROUP_NUMBER
-               || option == BOLDNESS_SMOOTHING_NUMBER
-               || option == BOLDNESS_COLOR_NUMBER
-               || option == IMAGE_PROCESSING_NUMBER
-               || option == FEEDER_GROUP_NUMBER)
-               return;
-
        json_object* config = NULL;
        if (h->current_scanner_config == NULL) {
                _kds_s2000w_handler_opts_load_options(h);
@@ -357,46 +380,16 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value
                        h->current_scan_status->feeder = Automatic;
        }
 
-       if (strcmp(descriptor->config_name, CROPPING_MODE) == 0) {
-               _kds_s2000w_handler_opts_set_enable_cropping_image(config);
-               _kds_s2000w_handler_opts_set_enable_suboptions_cropping_image(config);
-       }
-
-       if (strcmp(descriptor->config_name, CROPPING_IMAGE) == 0)
-               _kds_s2000w_handler_opts_set_enable_suboptions_cropping_image(config);
-
-       if (strcmp(descriptor->config_name, FOREGROUND_BOLDNESS_MODE) == 0)
-               _kds_s2000w_handler_opts_set_enable_boldness_aggressiveness(config);
-
-       if (strcmp(descriptor->config_name, BACKGROUND_SMOOTHING_MODE) == 0)
-               _kds_s2000w_handler_opts_set_enable_smoothing_aggressiveness(config);
-
-       if (strcmp(descriptor->config_name, COLOR_DROP_OUT) == 0)
-               _kds_s2000w_handler_opts_set_enable_color_drop_out_aggressiveness(config);
-
-       if (strcmp(descriptor->config_name, COLOR_AUTO_BRIGHTNESS_MODE) == 0)
-               _kds_s2000w_handler_opts_set_enable_color_brightness_and_contrast(config);
-
-       if (strcmp(descriptor->config_name, COLOR_BALANCE_MODE) == 0) {
-               _kds_s2000w_handler_opts_set_enable_color_balance(config);
-               _kds_s2000w_handler_opts_set_enable_color_aggressiveness(config);
-       }
-
        if (strcmp(descriptor->config_name, RESET) == 0) {
                _kds_s2000w_handler_opts_set_option_to_default(h);
                config = json_object_object_get(h->current_scanner_config, "Configuration");
 
                _kds_s2000w_handler_opts_set_autostart_on(config);
-               _kds_s2000w_handler_opts_set_enable_cropping_image(config);
-               _kds_s2000w_handler_opts_set_enable_suboptions_cropping_image(config);
-               _kds_s2000w_handler_opts_set_enable_boldness_aggressiveness(config);
-               _kds_s2000w_handler_opts_set_enable_smoothing_aggressiveness(config);
-               _kds_s2000w_handler_opts_set_enable_color_drop_out_aggressiveness(config);
-               _kds_s2000w_handler_opts_set_enable_color_brightness_and_contrast(config);
-               _kds_s2000w_handler_opts_set_enable_color_aggressiveness(config);
-               _kds_s2000w_handler_opts_set_enable_color_balance(config);
        }
 
+       if (h->profile == PROFILE_FULL)
+               _kds_s2000w_handler_opts_set_depends_opts(descriptor->config_name, config);
+
        _kds_s2000w_handler_opts_set_info_option(descriptor, info);
        _kds_s2000w_handler_opts_set_options(h);
 }
\ No newline at end of file
index 3f910ac92b416b48ef182e502e4c02936885a52d..f9d258fd6f2fe432c1f4a451041abd78c7dbf6f0 100644 (file)
@@ -5,6 +5,7 @@
 #include "kds_s2000w_debug.h"
 
 #define FULL_PROFILE_MAX_OPTION_COUNT 47
+#define MIN_PROFILE_MAX_OPTION_COUNT 10
 
 option_descriptor** descriptors = NULL;
 uint8_t max_option_count = 0;
@@ -1110,6 +1111,35 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_feeder_group()
        return descriptor;
 }
 
+void _kds_s2000w_option_descriptors_init_min_profile()
+{
+       max_option_count = MIN_PROFILE_MAX_OPTION_COUNT;
+
+       descriptors = malloc(sizeof(option_descriptor*) * max_option_count);
+       for (int i = 0; i < max_option_count; i++) {
+               descriptors[i] = malloc(sizeof(option_descriptor));
+       }
+
+       descriptors[0]->config_name = OPTION_COUNT;
+       descriptors[0]->descriptor = _kds_s2000w_option_descriptor_num_options();
+       descriptors[1]->config_name = STANDARD_GROUP;
+       descriptors[1]->descriptor = _kds_s2000w_option_descriptor_standard_group();
+       descriptors[3]->config_name = COLOR_MODE;
+       descriptors[3]->descriptor = _kds_s2000w_option_descriptor_color_mode();
+       descriptors[4]->config_name = DPI;
+       descriptors[4]->descriptor = _kds_s2000w_option_descriptor_dpi();
+       descriptors[5]->config_name = SCAN_SIDE;
+       descriptors[5]->descriptor = _kds_s2000w_option_descriptor_scanside();
+       descriptors[6]->config_name = BOLDNESS_COLOR_GROUP;
+       descriptors[6]->descriptor = _kds_s2000w_option_descriptor_boldness_color_group();
+       descriptors[7]->config_name = COLOR_DROP_OUT;
+       descriptors[7]->descriptor = _kds_s2000w_option_descriptor_color_drop();
+       descriptors[8]->config_name = RESET;
+       descriptors[8]->descriptor = _kds_s2000w_option_descriptor_config_reset();
+       descriptors[9]->config_name = SKIP_BLANK_PAGES;
+       descriptors[9]->descriptor = _kds_s2000w_option_descriptor_skip_blank_pages();
+}
+
 void _kds_s2000w_option_descriptors_init_full_profile()
 {
        max_option_count = FULL_PROFILE_MAX_OPTION_COUNT;
@@ -1221,6 +1251,9 @@ void kds_s2000w_option_descriptors_init(uint8_t profile)
 
        if (profile == PROFILE_FULL)
                _kds_s2000w_option_descriptors_init_full_profile();
+
+       if (profile == PROFILE_MIN)
+               _kds_s2000w_option_descriptors_init_min_profile();
 }
 
 void kds_s2000w_option_descriptors_free()
index 0d8f2590e89b0b74a6c61083835e7fe41d40aae6..7ff0e03a3689c1b26a31ee7ae57fbc9a622d345c 100644 (file)
@@ -5,14 +5,12 @@
 
 #define OPTION_COUNT "OptionCount"
 
-#define STANDARD_GROUP_NUMBER 1
 #define STANDARD_GROUP "STANDARD_GROUP"
 #define SCAN_SOURCE "ScanSource"
 #define COLOR_MODE "ColorMode"
 #define DPI "DPI"
 #define SCAN_SIDE "ScanSide"
 
-#define GEOMETRY_GROUP_NUMBER 6
 #define GEOMETRY_GROUP "GeometryGroup"
 #define CROPPING_MODE "CroppingMode"
 #define CROPPING_IMAGE "CroppingImage"
 #define IMAGE_WIDTH "ImageWidth"
 #define IMAGE_HEIGHT "ImageHeight"
 
-#define BOLDNESS_SMOOTHING_NUMBER 13
 #define BOLDNESS_SMOOTHING_GROUP "BoldnessSmothingGroup"
 #define FOREGROUND_BOLDNESS_MODE "ForegroundBoldnessMode"
 #define FOREGROUND_BOLDNESS_AGGRESSIVENESS "ForegroundBoldnessAggressiveness"
 #define BACKGROUND_SMOOTHING_MODE "BackgroundSmoothingMode"
 #define BACKGROUND_SMOOTHING_AGGRESSIVENESS "BackgroundSmoothingAggressiveness"
 
-#define BOLDNESS_COLOR_NUMBER 18
 #define BOLDNESS_COLOR_GROUP "BoldnessColorGroup"
 #define COLOR_DROP_OUT "ColorDropOut"
 #define COLOR_DROP_OUT_AGGRESSIVENESS "ColorDropOutAggressiveness"
@@ -44,7 +40,6 @@
 #define BINARIZATION_CONTRAST "BinarizationContrast"
 #define RESET "Reset"
 
-#define IMAGE_PROCESSING_NUMBER 32
 #define IMAGE_PROCESSING_GROUP "ImageProcessingGroup"
 #define SKIP_BLANK_PAGES "SkipBlankPages"
 #define SKIP_BLANK_PAGES_CONTENT "SkipBlankPagesContent"
@@ -54,7 +49,6 @@
 #define IMAGE_BORDER "ImageBorder"
 #define JPEG_QUALITY "JpegQuality"
 
-#define FEEDER_GROUP_NUMBER 40
 #define FEEDER_GROUP "FeederGroup"
 #define MAX_DOCUMENT_LENGTH "MaxDocumentLength"
 #define TRANSPORT_HANDLING "TransportHandling"
@@ -64,7 +58,8 @@
 #define DOCUMENT_FEEDER_TIMEOUT_RESPONSE "DocumentFeederTimeoutResponse"
 
 enum {
-       PROFILE_FULL
+       PROFILE_FULL,
+       PROFILE_MIN
 };
 
 typedef struct {