]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add option for color brightness
authorBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 14:40:24 +0000 (15:40 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 14:40:24 +0000 (15:40 +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 5f356d9898a78833a696f0fa2b4bb63691083e9c..63d5cefb7bc68dc276a9e4df19abf07f056192e6 100644 (file)
@@ -6,7 +6,7 @@
 #include "kds_s2000w_debug.h"
 
 #define AUTOSTART_ON 1
-#define OPTION_COUNT 35
+#define OPTION_COUNT 36
 
 void _kds_s2000w_handler_opts_write_string_value(json_object* value_object, void* value)
 {
@@ -266,6 +266,10 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value
                        value_object = json_object_object_get(config, "SkipBlankPagesContent");
                        _kds_s2000w_handler_opts_write_int_value(value_object, value);
                        break;
+               case 34:
+                       value_object = json_object_object_get(config, "ColorBrightness");
+                       _kds_s2000w_handler_opts_write_int_value(value_object, value);
+                       break;
                default:
                        break;
        }
@@ -429,6 +433,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 34:
+                       value_object = json_object_object_get(config, "ColorBrightness");
+                       _kds_s2000w_handler_opts_write_int_value_to_json(value_object, value);
+                       break;
+               case 35:
                        _kds_s2000w_handler_opts_set_option_to_default(h);
                        _kds_s2000w_handler_opts_set_autostart_on(h);
 
index 957cfa66e9c3afdd5ea258c1c088b89d4c544c97..93b17b4870d890e0ebbc7a1aaa6ef978223f6d10 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, 35);
+       assert_int_equal(value, 36);
 
        kds_s2000w_handler_free(h);
        h = NULL;
@@ -489,6 +489,21 @@ void sane_kds_s2000w_net_control_get_option_thirdythree_test(void** state)
 
        assert_int_equal(value, 5);
 
+       kds_s2000w_handler_free(h);
+       h = NULL;
+}
+
+void sane_kds_s2000w_net_control_get_option_thirdyfour_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, 34, 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 29540dea59718c2134da517b07bb920a606531ae..227aebf21fcc70346f5557a25db3e5dbe4bc8780 100644 (file)
@@ -38,5 +38,6 @@ void sane_kds_s2000w_net_control_get_option_thirdy_test(void** state);
 void sane_kds_s2000w_net_control_get_option_thirdyone_test(void** state);
 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);
 
 #endif
\ No newline at end of file
index 8dbb28ba37e893300d7c36003ec81bdc17f914e7..879e73dc41171772275d4b921810abda71aef0a4 100644 (file)
@@ -107,7 +107,8 @@ int main()
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdy_test, setup_default_get_option, teardown_default_get_option),
                cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdyone_test, setup_default_get_option, teardown_default_get_option),
                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_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)
        };
 
        return cmocka_run_group_tests(net_tests, NULL, NULL);