Fix JSON Generation
All checks were successful
FeedbackD-Configuration/pipeline/head This commit looks good

This commit is contained in:
TheBrokenRail 2020-09-10 14:37:10 -04:00
parent 1f47a95a6c
commit c553e959d2

View File

@ -48,17 +48,17 @@ static void on_save_event(__attribute__((unused)) GtkButton *button, struct save
json_object_set_string_member(event, "effect", gtk_entry_get_text(data->sound_name));
} else if (visible_widget == data->vibration_rumble) {
json_object_set_string_member(event, "type", "VibraRumble");
json_object_set_double_member(event, "duration", g_strtod(gtk_entry_get_text(data->vibration_rumble_duration), NULL));
json_object_set_int_member(event, "duration", strtol(gtk_entry_get_text(data->vibration_rumble_duration), NULL, 10));
} else if (visible_widget == data->vibration_periodic) {
json_object_set_string_member(event, "type", "VibraPeriodic");
json_object_set_double_member(event, "magnitude", g_strtod(gtk_entry_get_text(data->magnitude), NULL));
json_object_set_double_member(event, "duration", g_strtod(gtk_entry_get_text(data->vibration_periodic_duration), NULL));
json_object_set_double_member(event, "fade-in-time", g_strtod(gtk_entry_get_text(data->fade_in_time), NULL));
json_object_set_double_member(event, "fade-in-level", g_strtod(gtk_entry_get_text(data->fade_in_level), NULL));
json_object_set_int_member(event, "magnitude", strtol(gtk_entry_get_text(data->magnitude), NULL, 10));
json_object_set_int_member(event, "duration", strtol(gtk_entry_get_text(data->vibration_periodic_duration), NULL, 10));
json_object_set_int_member(event, "fade-in-time", strtol(gtk_entry_get_text(data->fade_in_time), NULL, 10));
json_object_set_int_member(event, "fade-in-level", strtol(gtk_entry_get_text(data->fade_in_level), NULL, 10));
} else if (visible_widget == data->led) {
json_object_set_string_member(event, "type", "Led");
json_object_set_string_member(event, "color", gtk_entry_get_text(data->color));
json_object_set_double_member(event, "frequency", g_strtod(gtk_entry_get_text(data->frequency), NULL));
json_object_set_int_member(event, "frequency", strtol(gtk_entry_get_text(data->frequency), NULL, 10));
}
gtk_window_close(GTK_WINDOW(data->window));