From a8b0a38754bf0e2da1e635af78f243bd63351f9f Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sun, 16 Feb 2025 07:30:12 +0100 Subject: [PATCH] add option multifeed response --- src/kds_s2000w_handler_opts.c | 8 ++++++-- tests/kds_s2000w_net_get_opt_tests.c | 17 ++++++++++++++++- tests/kds_s2000w_net_get_opt_tests.h | 1 + tests/kds_s2000w_net_get_opt_tests_run.c | 3 ++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/kds_s2000w_handler_opts.c b/src/kds_s2000w_handler_opts.c index 125b8fa..1eb5291 100644 --- a/src/kds_s2000w_handler_opts.c +++ b/src/kds_s2000w_handler_opts.c @@ -5,7 +5,7 @@ #include "kds_s2000w_debug.h" #define AUTOSTART_ON 1 -#define OPTION_COUNT 24 +#define OPTION_COUNT 25 void _kds_s2000w_handler_opts_write_string_value(json_object* value_object, void* value) { @@ -205,6 +205,10 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value value_object = json_object_object_get(config, "MultifeedSensitivity"); _kds_s2000w_handler_opts_write_string_value(value_object, value); break; + case 23: + value_object = json_object_object_get(config, "MultifeedResponse"); + _kds_s2000w_handler_opts_write_string_value(value_object, value); + break; default: break; } @@ -316,7 +320,7 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value value_object = json_object_object_get(config, "BinarizationContrast"); _kds_s2000w_handler_opts_write_int_value_to_json(value_object, value); break; - case 23: + case 24: _kds_s2000w_handler_opts_set_option_to_default(h); _kds_s2000w_handler_opts_set_autostart_on(h); diff --git a/tests/kds_s2000w_net_get_opt_tests.c b/tests/kds_s2000w_net_get_opt_tests.c index 6139e48..5d91d6b 100644 --- a/tests/kds_s2000w_net_get_opt_tests.c +++ b/tests/kds_s2000w_net_get_opt_tests.c @@ -22,7 +22,7 @@ void sane_kds_s2000w_net_control_get_option_zero_test(void** state) sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &value, NULL); - assert_int_equal(value, 24); + assert_int_equal(value, 25); kds_s2000w_handler_free(h); h = NULL; @@ -328,3 +328,18 @@ void sane_kds_s2000w_net_control_get_option_twentytwo_test(void** state) kds_s2000w_handler_free(h); h = NULL; } + +void sane_kds_s2000w_net_control_get_option_twentythree_test(void** state) +{ + handler* h = kds_s2000w_handler_init(); + response* resp = (response*) *state; + h->current_scanner_config = json_tokener_parse(resp->data); + char* value[50] = {0}; + + sane_kds_s2000w_net_control_option(h, 23, SANE_ACTION_GET_VALUE, &value, NULL); + + assert_string_equal(value, "Stop"); + + kds_s2000w_handler_free(h); + h = NULL; +} diff --git a/tests/kds_s2000w_net_get_opt_tests.h b/tests/kds_s2000w_net_get_opt_tests.h index 034b5aa..9fb01ca 100644 --- a/tests/kds_s2000w_net_get_opt_tests.h +++ b/tests/kds_s2000w_net_get_opt_tests.h @@ -27,5 +27,6 @@ void sane_kds_s2000w_net_control_get_option_nineteen_test(void** state); void sane_kds_s2000w_net_control_get_option_twenty_test(void** state); void sane_kds_s2000w_net_control_get_option_twentyone_test(void** state); void sane_kds_s2000w_net_control_get_option_twentytwo_test(void** state); +void sane_kds_s2000w_net_control_get_option_twentythree_test(void** state); #endif \ No newline at end of file diff --git a/tests/kds_s2000w_net_get_opt_tests_run.c b/tests/kds_s2000w_net_get_opt_tests_run.c index 75d89ac..7b63573 100644 --- a/tests/kds_s2000w_net_get_opt_tests_run.c +++ b/tests/kds_s2000w_net_get_opt_tests_run.c @@ -96,7 +96,8 @@ int main() cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_nineteen_test, setup_default_get_option, teardown_default_get_option), cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twenty_test, setup_default_get_option, teardown_default_get_option), cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentyone_test, setup_default_get_option, teardown_default_get_option), - cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentytwo_test, setup_default_get_option, teardown_default_get_option) + cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentytwo_test, setup_default_get_option, teardown_default_get_option), + cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentythree_test, setup_default_get_option, teardown_default_get_option) }; return cmocka_run_group_tests(net_tests, NULL, NULL); -- 2.39.5