From: Bastian Dehn Date: Mon, 29 Jan 2024 15:02:35 +0000 (+0100) Subject: add reset config button X-Git-Tag: v1.0.0^2~391 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=43dcdd7bd869d6f0853cb4908fc04618f85fe75e;p=sane-kds-s2000w-net.git add reset config button --- diff --git a/src/kds_s2000w_handler.c b/src/kds_s2000w_handler.c index c59962b..a3e0bab 100644 --- a/src/kds_s2000w_handler.c +++ b/src/kds_s2000w_handler.c @@ -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;