diff --git a/dbus/controller_iface_configure.c b/dbus/controller_iface_configure.c index 669ad0d3..7927c497 100644 --- a/dbus/controller_iface_configure.c +++ b/dbus/controller_iface_configure.c @@ -426,6 +426,8 @@ jack_controller_get_parameter_constraint( message_arg_t value; bool is_range; + type = jackctl_parameter_get_type(parameter); + call->reply = dbus_message_new_method_return(call->message); if (!call->reply) { @@ -453,30 +455,43 @@ jack_controller_get_parameter_constraint( goto fail_unref; } + /* Open the array. */ + if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(vs)", &array_iter)) + { + goto fail_unref; + } + if (is_range) { jack_info("parameter with range constraint"); jackctl_parameter_get_range_constraint(parameter, &min, &max); - return; - } - count = jackctl_parameter_get_enum_constraints_count(parameter); + /* Open the struct. */ + if (!dbus_message_iter_open_container(&array_iter, DBUS_TYPE_STRUCT, NULL, &struct_iter)) + { + goto fail_close_unref; + } - /* Open the array. */ - if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(vs)", &array_iter)) - { - goto fail_unref; - } + jack_controller_jack_to_dbus_variant(type, &min, &value); - /* Append enum values to the array. */ - for (index = 0 ; index < count ; index++) - { - jackctl_value = jackctl_parameter_get_enum_constraint_value(parameter, index); - descr = jackctl_parameter_get_enum_constraint_description(parameter, index); + if (!jack_dbus_message_append_variant(&struct_iter, PARAM_TYPE_JACK_TO_DBUS(type), PARAM_TYPE_JACK_TO_DBUS_SIGNATURE(type), &value)) + { + goto fail_close2_unref; + } - type = jackctl_parameter_get_type(parameter); - jack_controller_jack_to_dbus_variant(type, &jackctl_value, &value); + descr = "min"; + + if (!dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_STRING, &descr)) + { + goto fail_close2_unref; + } + + /* Close the struct. */ + if (!dbus_message_iter_close_container(&array_iter, &struct_iter)) + { + goto fail_close_unref; + } /* Open the struct. */ if (!dbus_message_iter_open_container(&array_iter, DBUS_TYPE_STRUCT, NULL, &struct_iter)) @@ -484,11 +499,15 @@ jack_controller_get_parameter_constraint( goto fail_close_unref; } + jack_controller_jack_to_dbus_variant(type, &max, &value); + if (!jack_dbus_message_append_variant(&struct_iter, PARAM_TYPE_JACK_TO_DBUS(type), PARAM_TYPE_JACK_TO_DBUS_SIGNATURE(type), &value)) { goto fail_close2_unref; } + descr = "max"; + if (!dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_STRING, &descr)) { goto fail_close2_unref; @@ -500,6 +519,41 @@ jack_controller_get_parameter_constraint( goto fail_close_unref; } } + else + { + count = jackctl_parameter_get_enum_constraints_count(parameter); + + /* Append enum values to the array. */ + for (index = 0 ; index < count ; index++) + { + jackctl_value = jackctl_parameter_get_enum_constraint_value(parameter, index); + descr = jackctl_parameter_get_enum_constraint_description(parameter, index); + + jack_controller_jack_to_dbus_variant(type, &jackctl_value, &value); + + /* Open the struct. */ + if (!dbus_message_iter_open_container(&array_iter, DBUS_TYPE_STRUCT, NULL, &struct_iter)) + { + goto fail_close_unref; + } + + if (!jack_dbus_message_append_variant(&struct_iter, PARAM_TYPE_JACK_TO_DBUS(type), PARAM_TYPE_JACK_TO_DBUS_SIGNATURE(type), &value)) + { + goto fail_close2_unref; + } + + if (!dbus_message_iter_append_basic(&struct_iter, DBUS_TYPE_STRING, &descr)) + { + goto fail_close2_unref; + } + + /* Close the struct. */ + if (!dbus_message_iter_close_container(&array_iter, &struct_iter)) + { + goto fail_close_unref; + } + } + } /* Close the array. */ if (!dbus_message_iter_close_container(&iter, &array_iter))