Method

GUPnPServiceProxyActionget_result_hash

since: 1.2.0

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

Type: GHashTable

A GHashTable of out parameter name and initialised GValue pairs.

The argument will be modified by the function.
The returned data is owned by the instance.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the method if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

TRUE on success.