Append name to the list of arguments used by action
The name of the argument
The value of the argument
action for convenience.
See gupnp_service_proxy_action_get_result(); this version takes a GLib.HashTable 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 GObject.Value 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);
}
A GLib.HashTable of out parameter name and initialised GObject.Value pairs
true on success.
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);
}
GLib.List of 'out' parameter names (as strings)
GLib.List of types (as GObject.GType) that line up with out_names
true on success.
Iterate over the out arguments of a finished action
A newly created GUPnPServiceProxyActionIterator, or null on error
Increases reference count of action
action with an increased reference count
Update the value of key to value.
key needs to already exist in action.
the name of the value to modify
the new value of key
true if successfully modified, false otherwise
Decreases reference count of action. If reference count drops to 0,
the action and its contents will be freed.
Staticnew_Staticnew_
Opaque structure for holding in-progress action data.