]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add option hole fill
authorBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 09:53:00 +0000 (10:53 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 09:54:44 +0000 (10:54 +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 6da76096bdf07ffc4d0218b0768a5684c0eb0142..7aef4586b03e6af36f98ca3b1280bc0523b34278 100644 (file)
@@ -5,7 +5,7 @@
 #include "kds_s2000w_debug.h"
 
 #define AUTOSTART_ON 1
-#define OPTION_COUNT 31
+#define OPTION_COUNT 32
 
 void _kds_s2000w_handler_opts_write_string_value(json_object* value_object, void* value)
 {
@@ -233,6 +233,10 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value
                        value_object = json_object_object_get(config, "DocumentFeederTimeoutResponse");
                        _kds_s2000w_handler_opts_write_string_value(value_object, value);
                        break;
+               case 30:
+                       value_object = json_object_object_get(config, "HoleFill");
+                       _kds_s2000w_handler_opts_write_int_value(value_object, value);
+                       break;
                default:
                        break;
        }
@@ -377,6 +381,11 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value
                        _kds_s2000w_handler_opts_write_string_value_to_json(value_object, value);
                        break;
                case 30:
+                       value_object = json_object_object_get(config, "HoleFill");
+                       _kds_s2000w_handler_opts_write_int_value_to_json(value_object, value);
+                       value_object = NULL;
+                       break;
+               case 31:
                        _kds_s2000w_handler_opts_set_option_to_default(h);
                        _kds_s2000w_handler_opts_set_autostart_on(h);
 
index d14d79424e2b5c70583240bd6e030e8a5bab66c6..a23b5e7e6e43f476572f946d2ac9617328cd10f2 100644 (file)
@@ -1,4 +1,3 @@
-
 #include <stdlib.h>
 #include <sane/sane.h>
 #include <string.h>
@@ -22,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, 31);
+       assert_int_equal(value, 32);
 
        kds_s2000w_handler_free(h);
        h = NULL;
@@ -430,6 +429,21 @@ void sane_kds_s2000w_net_control_get_option_twentynine_test(void** state)
 
        assert_string_equal(value, "Stop");
 
+       kds_s2000w_handler_free(h);
+       h = NULL;
+}
+
+void sane_kds_s2000w_net_control_get_option_thirdy_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, 30, SANE_ACTION_GET_VALUE, &value, NULL);
+
+       assert_int_equal(value, 0);
+
        kds_s2000w_handler_free(h);
        h = NULL;
 }
\ No newline at end of file
index 7cec045c39ff5d184389c1a16b118e7525362eee..1510b4e67286401eb242b6bceb3af5da69dd8a86 100644 (file)
@@ -34,5 +34,6 @@ void sane_kds_s2000w_net_control_get_option_twentysix_test(void** state);
 void sane_kds_s2000w_net_control_get_option_twentyseven_test(void** state);
 void sane_kds_s2000w_net_control_get_option_twentyeight_test(void** state);
 void sane_kds_s2000w_net_control_get_option_twentynine_test(void** state);
+void sane_kds_s2000w_net_control_get_option_thirdy_test(void** state);
 
 #endif
\ No newline at end of file
index b0bbad4fbfede57671aa65ed90ebf40f09d3b9a0..36bcbba7594d9529795f2563565086965002fc3c 100644 (file)
@@ -103,7 +103,8 @@ int main()
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentysix_test, setup_default_get_option, teardown_default_get_option),
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentyseven_test, setup_default_get_option, teardown_default_get_option),
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentyeight_test, setup_default_get_option, teardown_default_get_option),
-               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentynine_test, setup_default_get_option, teardown_default_get_option)
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_twentynine_test, setup_default_get_option, teardown_default_get_option),
+               cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdy_test, setup_default_get_option, teardown_default_get_option)
        };
 
        return cmocka_run_group_tests(net_tests, NULL, NULL);