]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add option descriptor for document feeder timeout response
authorBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 09:29:34 +0000 (10:29 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 09:29:34 +0000 (10:29 +0100)
src/kds_s2000w_option_descriptors.c
tests/kds_s2000w_option_descriptor_tests.c
tests/kds_s2000w_option_descriptor_tests.h
tests/kds_s2000w_option_descriptor_tests_run.c

index 0dd405f0910503d0d8b694cc0c0808c8cc166021..df808b663e2ab6dce3df3e78adfdb332482c4abb 100644 (file)
@@ -3,7 +3,7 @@
 #include "kds_s2000w_option_descriptors.h"
 #include "kds_s2000w_debug.h"
 
-#define MAX_OPTION_COUNT 30
+#define MAX_OPTION_COUNT 31
 
 SANE_Option_Descriptor* descriptor_array = NULL;
 
@@ -34,6 +34,7 @@ SANE_String_Const* constraint_edge_fill = NULL;
 SANE_String_Const* constraint_image_border = NULL;
 SANE_String_Const* constraint_transport_handling = NULL;
 SANE_String_Const* constraint_jpeg_quality = NULL;
+SANE_String_Const* constraint_document_feeder_timeout_response = NULL;
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_standard_group()
 {
@@ -707,6 +708,31 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_jpeg_quality()
        return descriptor;
 }
 
+SANE_Option_Descriptor _kds_s2000w_option_descriptor_document_feeder_timeout_response()
+{
+       kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_document_feeder_timeout_response");
+
+       constraint_document_feeder_timeout_response = malloc(sizeof(SANE_String_Const*) * 4);
+       constraint_document_feeder_timeout_response[0] = "Stop";
+       constraint_document_feeder_timeout_response[1] = "Pause";
+       constraint_document_feeder_timeout_response[2] = "PauseAndWait";
+       constraint_document_feeder_timeout_response[3] = NULL;
+
+       SANE_Option_Descriptor descriptor = {
+               "document-feeder-timeout-response",
+               "Document feeder timeout respone",
+               "Document feeder timeout respone",
+               SANE_TYPE_STRING,
+               SANE_UNIT_NONE,
+               sizeof(SANE_String_Const*) * 4,
+               SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT,
+               SANE_CONSTRAINT_STRING_LIST,
+               {.string_list = constraint_document_feeder_timeout_response}
+       };
+
+       return descriptor;
+}
+
 void kds_s2000w_option_descriptors_init()
 {
        kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_init_option_descriptors");
@@ -741,7 +767,8 @@ void kds_s2000w_option_descriptors_init()
        descriptor_array[26] = _kds_s2000w_option_descriptor_image_border();
        descriptor_array[27] = _kds_s2000w_option_descriptor_transport_handling();
        descriptor_array[28] = _kds_s2000w_option_descriptor_jpeg_quality();
-       descriptor_array[29] = _kds_s2000w_option_descriptor_config_reset();
+       descriptor_array[29] = _kds_s2000w_option_descriptor_document_feeder_timeout_response();
+       descriptor_array[30] = _kds_s2000w_option_descriptor_config_reset();
 }
 
 void kds_s2000w_option_descriptors_free()
@@ -782,9 +809,11 @@ void kds_s2000w_option_descriptors_free()
        constraint_image_border = NULL;
        free(constraint_transport_handling);
        constraint_transport_handling = NULL;
-       free(descriptor_array);
        free(constraint_jpeg_quality);
        constraint_jpeg_quality = NULL;
+       free(constraint_document_feeder_timeout_response);
+       constraint_document_feeder_timeout_response = NULL;
+       free(descriptor_array);
        descriptor_array = NULL;
 }
 
index f6a1cf3ded86b8d6180a05a093112f3ee1487607..c8f5b9c5725244c4519c3f87505cbd470bbbdcf2 100644 (file)
@@ -4,7 +4,7 @@
 #include "kds_s2000w_client_mock.h"
 #include "../src/kds_s2000w_option_descriptors.h"
 
-#define MAX_OPTION_COUNT 30
+#define MAX_OPTION_COUNT 31
 
 int setup(void** state)
 {
@@ -534,6 +534,24 @@ void kds_s2000w_option_get_descriptor_twentynine_test()
 {
        SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(29);
 
+       assert_string_equal("document-feeder-timeout-response", option->name);
+       assert_string_equal("Document feeder timeout respone", option->title);
+       assert_string_equal("Document feeder timeout respone", option->desc);
+       assert_int_equal(SANE_TYPE_STRING, option->type);
+       assert_int_equal(SANE_UNIT_NONE, option->unit);
+       assert_int_equal(sizeof(SANE_String_Const*) * 4, option->size);
+       assert_int_equal(SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, option->cap);
+       assert_int_equal(SANE_CONSTRAINT_STRING_LIST, option->constraint_type);
+       assert_string_equal("Stop", option->constraint.string_list[0]);
+       assert_string_equal("Pause", option->constraint.string_list[1]);
+       assert_string_equal("PauseAndWait", option->constraint.string_list[2]);
+       assert_null(option->constraint.string_list[3]);
+}
+
+void kds_s2000w_option_get_descriptor_thirdy_test()
+{
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(30);
+
        assert_string_equal("config-reset", option->name);
        assert_string_equal("reset config", option->title);
        assert_string_equal("load default configuration from scanner", option->desc);
index 0c5760d8b14dd4f81774d73473a1bfdaaa489cae..0c4c72ba8e7a02bc9d876d09436a27127207c3e7 100644 (file)
@@ -38,5 +38,6 @@ void kds_s2000w_option_get_descriptor_twentysix_test();
 void kds_s2000w_option_get_descriptor_twentyseven_test();
 void kds_s2000w_option_get_descriptor_twentyeight_test();
 void kds_s2000w_option_get_descriptor_twentynine_test();
+void kds_s2000w_option_get_descriptor_thirdy_test();
 void kds_s2000w_option_get_descriptor_over_max_options_test();
 #endif
\ No newline at end of file
index c44645c4e6483f5efdba01c7af271eafecb867c3..f6fca739e98810c9ea6ea5fbb6c4f620bb7179fa 100644 (file)
@@ -33,6 +33,7 @@ int main()
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentyseven_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentyeight_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentynine_test, setup, teardown),
+               cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_thirdy_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_over_max_options_test, setup, teardown)
        };