]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add option document feeder timeout
authorBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 17:29:45 +0000 (18:29 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 17:29:45 +0000 (18:29 +0100)
src/kds_s2000w_handler_opts.c
tests/kds_s2000w_net_get_opt_tests.c
tests/kds_s2000w_net_get_opt_tests.h
tests/kds_s2000w_net_get_opt_tests_run.c

index 7af8c737fced58f3629932dce123fe151c5106b2..beeb8d2854908d04a97fc67238cdd2bbc1f28315 100644 (file)
@@ -6,7 +6,7 @@
 #include "kds_s2000w_debug.h"
 
 #define AUTOSTART_ON 1
-#define OPTION_COUNT 37
+#define OPTION_COUNT 38
 
 void _kds_s2000w_handler_opts_write_string_value(json_object* value_object, void* value)
 {
@@ -274,6 +274,10 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value
                        value_object = json_object_object_get(config, "MaxDocumentLength");
                        _kds_s2000w_handler_opts_write_int_value(value_object, value);
                        break;
+               case 36:
+                       value_object = json_object_object_get(config, "DocumentFeederTimeout");
+                       _kds_s2000w_handler_opts_write_int_value(value_object, value);
+                       break;
                default:
                        break;
        }
@@ -445,6 +449,10 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value
                        _kds_s2000w_handler_opts_write_int_value_to_json(value_object, value);
                        break;
                case 36:
+                       value_object = json_object_object_get(config, "DocumentFeederTimeout");
+                       _kds_s2000w_handler_opts_write_int_value_to_json(value_object, value);
+                       break;
+               case 37:
                        _kds_s2000w_handler_opts_set_option_to_default(h);
                        _kds_s2000w_handler_opts_set_autostart_on(h);
 
index 15462a992045de9e8dc360b746c04d7be1ec1021..c97544e81c83f37d35bd3b68cc664fb7cc233ce5 100644 (file)
@@ -21,7 +21,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, 37);
+       assert_int_equal(value, 38);
 
        kds_s2000w_handler_free(h);
        h = NULL;
@@ -519,6 +519,21 @@ void sane_kds_s2000w_net_control_get_option_thirdyfive_test(void** state)
 
        assert_int_equal(value, 140);
 
+       kds_s2000w_handler_free(h);
+       h = NULL;
+}
+
+void sane_kds_s2000w_net_control_get_option_thirdysix_test(void** state)
+{
+       handler* h = kds_s2000w_handler_init();
+       response* resp = (response*) *state;
+       h->current_scanner_config = json_tokener_parse(resp->data);
+       uint32_t value = -1;
+
+       sane_kds_s2000w_net_control_option(h, 36, SANE_ACTION_GET_VALUE, &value, NULL);
+
+       assert_int_equal(value, 2);
+
        kds_s2000w_handler_free(h);
        h = NULL;
 }
\ No newline at end of file
index 7bdf053cf583e4b6cae06795a47a0e5bf72bff7d..9fb4ee45994569c042a91a5d2d5019bfd9f59600 100644 (file)
@@ -40,5 +40,6 @@ void sane_kds_s2000w_net_control_get_option_thirdytwo_test(void** state);
 void sane_kds_s2000w_net_control_get_option_thirdythree_test(void** state);
 void sane_kds_s2000w_net_control_get_option_thirdyfour_test(void** state);
 void sane_kds_s2000w_net_control_get_option_thirdyfive_test(void** state);
+void sane_kds_s2000w_net_control_get_option_thirdysix_test(void** state);
 
 #endif
\ No newline at end of file
index 44e3c23711f7085e0a2ecc3e94e79e878c68f317..59d0599d020d39b9db5716143318639e74d5674d 100644 (file)
@@ -109,7 +109,8 @@ int main()
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdytwo_test, setup_default_get_option, teardown_default_get_option),
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdythree_test, setup_default_get_option, teardown_default_get_option),
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdyfour_test, setup_default_get_option, teardown_default_get_option),
-               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdyfive_test, setup_default_get_option, teardown_default_get_option)
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdyfive_test, setup_default_get_option, teardown_default_get_option),
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdysix_test, setup_default_get_option, teardown_default_get_option)
        };
 
        return cmocka_run_group_tests(net_tests, NULL, NULL);