From: Bastian Dehn Date: Wed, 8 Oct 2025 17:00:02 +0000 (+0200) Subject: change refactor set scan source X-Git-Tag: v1.1.9^2~1^2~1 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=7412bff02c9b1d14068fe0b7b8d05e5a2f5c7c1b;p=sane-kds-s2000w-net.git change refactor set scan source --- diff --git a/src/kds_s2000w_handler_opts.c b/src/kds_s2000w_handler_opts.c index de45a41..3e12847 100644 --- a/src/kds_s2000w_handler_opts.c +++ b/src/kds_s2000w_handler_opts.c @@ -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);