Method

GUPnPServiceProxyActionget_result_list

Declaration [src]

gboolean
gupnp_service_proxy_action_get_result_list (
  GUPnPServiceProxyAction* action,
  GList* out_names,
  GList* out_types,
  GList** out_values,
  GError** error
)

Description [src]

A variant of gupnp_service_proxy_action_get_result() that takes lists of out-parameter names, types and place-holders for values.

The returned list in out_values must be freed using g_list_free and each element in it using g_value_unset and g_free.

void on_action_finished(GObject *object, GAsyncResult *res, gpointer user_data)
{
    GUPnPServiceProxyAction *action;
    GError *error;

    action = gupnp_service_proxy_call_action_finish (GUPNP_SERVICE_PROXY (object),
                                                     res,
                                                     &error);

    if (error != NULL) {
             g_print ("Call failed: %s", error->message);
             g_clear_error (&error);
             return;
    }

    GList *out_args = NULL;
    out_args = g_list_append (out_args, "PlayMode");
    out_args = g_list_append (out_args, "RecQualityMode");
    GList *out_types = NULL;
    out_types = g_list_append (out_types, GSIZE_TO_POINTER (G_TYPE_STRING));
    out_types = g_list_append (out_types, GSIZE_TO_POINTER (G_TYPE_STRING));
    GList *out_values = NULL;

    if (!gupnp_service_proxy_action_get_result_list (action,
                                                     out_args,
                                                     out_types,
                                                     &out_values,
                                                     &error)) {
             g_print ("Getting results failed: %s", error->message);
             g_clear_error (&error);
             return;
    }

    GList *iter = out_values;
    while (iter != NULL) {
        GValue *value = iter->data;
        g_print ("Result: %s\n", g_value_get_string (value));
        g_value_unset (value);
        g_free (value);
        iter = g_list_remove_link (iter, iter);
    }
    g_list_free (out_values);
}
Available since:1.2.0

Parameters

out_names A list of utf8
 

GList of ‘out’ parameter names (as strings)

 The data is owned by the caller of the function.
 Each element is a NUL terminated UTF-8 string.
out_types A list of GType
 

GList of types (as GType) that line up with out_names.

 The data is owned by the caller of the function.
out_values A list of const GValue*
 

GList of values (as GValue) that line up with out_names and out_types.

 The argument will be set by the function.
 The instance takes ownership of the data, and is responsible for freeing it.
error GError **
  The return location for a GError*, or NULL.

Return value

Returns: gboolean
 

TRUE on success.