Function

GUPnPServiceProxyActionnew

Declaration [src]

GUPnPServiceProxyAction*
gupnp_service_proxy_action_new (
  const char* action,
  ...
)

Description [src]

Prepares action action with parameters Varargs to be sent off to a remote service later with gupnp_service_proxy_call_action() or gupnp_service_proxy_call_action_async().

After the action call has finished, the results of the call may be retrived from the GUPnPServiceProxyAction by using gupnp_service_proxy_action_get_result(), gupnp_service_proxy_action_get_result_list() or gupnp_service_proxy_action_get_result_hash()

GUPnPServiceProxyAction *action =
        gupnp_service_proxy_action_new ("GetVolume",
                                        // Parameters
                                        "InstanceID", G_TYPE_INT, 0,
                                        "Channel", G_TYPE_STRING, "Master",
                                        NULL);

GError *error = NULL;
gupnp_service_proxy_call_action (proxy, action, NULL, &error);
if (error != NULL) {
        g_warning ("Failed to call GetVolume: %s", error->message);
        g_clear_error (&error);

        return;
}

guint16 volume = 0;
if (!gupnp_service_proxy_action_get_result (action,
                                            &error,
                                            "CurrentVolume", G_TYPE_UINT, &volume,
                                            NULL)) {
        g_message ("Current Volume: %u", volume);
}

gupnp_service_proxy_action_unref (action);

Parameters

action const char*
 

The name of a remote action to call.

 The data is owned by the caller of the function.
 The value is a NUL terminated UTF-8 string.
...
 

Tuples of in parameter name, in parameter type, and in parameter value, terminated with NULL.

Return value

Returns: GUPnPServiceProxyAction
 

A newly created GUPnPServiceProxyAction.

 The caller of the function takes ownership of the data, and is responsible for freeing it.