]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add reset config button
authorBastian Dehn <hhaalo@arcor.de>
Mon, 29 Jan 2024 15:02:35 +0000 (16:02 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 29 Jan 2024 15:02:35 +0000 (16:02 +0100)
src/kds_s2000w_handler.c

index c59962bbe87e100d83d069f82287fa0f861758f9..a3e0bab89881341f4c6d41549ca05d2cfdedb03e 100644 (file)
@@ -315,19 +315,16 @@ void kds_s2000w_handler_set_option(int option, void* value, int* info)
                        _write_string_value_to_json(value_object, value);
                        break;
                case 24:
-                       printf("Konfiguration reset\n");
                        resp = kds_s2000w_client_response_init();
                        kds_s2000w_client_get_capabilities(resp);
 
-                       printf("response data: %s\n", resp->data);
-
                        json_object* capabilities = json_tokener_parse(resp->data);
                        json_object* default_values = json_object_object_get(capabilities, "Defaults");
-                       const char* json_string = json_object_to_json_string_ext(default_values, JSON_C_TO_STRING_PLAIN);
-                       printf("default_values: %s\n", json_string);
+                       json_object* default_config = json_object_new_object();
+                       json_object_object_add(default_config, "Configuration", default_values);
+                       const char* json_string = json_object_to_json_string_ext(default_config, JSON_C_TO_STRING_PLAIN);
                        
                        kds_s2000w_client_response_free(resp);
-
                        resp = kds_s2000w_client_response_init();
                        resp->size = sizeof(char) * strlen(json_string);
                        resp->code = 0;