]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
change refactor set scan source
authorBastian Dehn <hhaalo@arcor.de>
Wed, 8 Oct 2025 17:00:02 +0000 (19:00 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Wed, 8 Oct 2025 17:00:02 +0000 (19:00 +0200)
src/kds_s2000w_handler_opts.c

index de45a418030781d0c3ba1e0849ad2600c5705349..3e12847f7176925f96ad8c1bcd7a7a962b926b5c 100644 (file)
@@ -59,6 +59,19 @@ void _kds_s2000w_handler_opts_load_options(handler* h)
        resp = NULL;
 }
 
+void _kds_s2000w_handler_opts_set_scan_source(option_descriptor* descriptor, handler* h, char* value)
+{
+       if (strcmp(descriptor->config_name, SCAN_SOURCE) != 0)
+               return;
+
+       if (strcmp(value, "Flatbed") == 0)
+               h->current_scan_status->feeder = Flatbed;
+       if (strcmp(value, "DocumentFeeder") == 0)
+               h->current_scan_status->feeder = DocumentFeeder;
+       if (strcmp(value, "Automatic") == 0)
+               h->current_scan_status->feeder = Automatic;
+}
+
 void _kds_s2000w_handler_opts_set_autostart_on(json_object* config)
 {
        uint32_t auto_start_value = AUTOSTART_ON;
@@ -517,16 +530,7 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value
                && strcmp(descriptor->config_name, IMAGE_HEIGHT) != 0)
                _kds_s2000w_handler_opts_write_value_to_json(value_object, descriptor->descriptor->type, value);
 
-       if (strcmp(descriptor->config_name, SCAN_SOURCE) == 0) {
-               if (strcmp(value, "Flatbed") == 0)
-                       h->current_scan_status->feeder = Flatbed;
-
-               if (strcmp(value, "DocumentFeeder") == 0)
-                       h->current_scan_status->feeder = DocumentFeeder;
-
-               if (strcmp(value, "Automatic") == 0)
-                       h->current_scan_status->feeder = Automatic;
-       }
+       _kds_s2000w_handler_opts_set_scan_source(descriptor, h, value);
 
        if (strcmp(descriptor->config_name, RESET) == 0) {
                _kds_s2000w_handler_opts_set_option_to_default(h);