Method

GUPnPServiceProxyActionget_result_hash

Declaration [src]

gboolean
gupnp_service_proxy_action_get_result_hash (
  GUPnPServiceProxyAction* action,
  GHashTable* out_hash,
  GError** error
)

Description [src]

See gupnp_service_proxy_action_get_result(); this version takes a GHashTable for runtime generated parameter lists.

The out_hash needs to be pre-initialized with key value pairs denoting the argument to retrieve and an empty GValue initialized to hold the wanted type with g_value_init().

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;
    }

    GValue play_mode = G_VALUE_INIT;
    g_value_init(&play_mode, G_TYPE_STRING);
    GValue rec_quality_mode = G_VALUE_INIT;
    g_value_init(&rec_quality_mode, G_TYPE_STRING);

    GHashTable *out_args = g_hash_table_new (g_str_hash, g_str_equal);
    g_hash_table_insert(out_args, "PlayMode", &play_mode);
    g_hash_table_insert(out_args, "RecQualityMode", &rec_quality_mode);

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

    g_value_unset (&play_mode);
    g_value_unset (&rec_quality_mode);

    g_hash_table_unref (out_args);
}
Available since:1.2.0

Parameters

out_hash GHashTable
 

A GHashTable of out parameter name and initialised GValue pairs.

 The argument will be modified by the function.
 The data is owned by the caller of the function.
error GError **
  The return location for a GError*, or NULL.

Return value

Returns: gboolean
 

TRUE on success.