rpc-dbus

rpc-dbus — Helpers for sending dbus messages and for wathching for services.

Synopsis




void        (*DBusNameNotifyCb)             (gpointer user_data);
void        dbus_do_call                    (DBusConnection *bus,
                                             DBusMessage **reply,
                                             gboolean activation,
                                             const gchar *service,
                                             const gchar *path,
                                             const gchar *interface,
                                             const gchar *name,
                                             int first_arg_type,
                                             ...);
void        dbus_do_call_gvalue             (DBusConnection *bus,
                                             DBusMessage **reply,
                                             gboolean activation,
                                             const gchar *service,
                                             const gchar *path,
                                             const gchar *interface,
                                             const gchar *name,
                                             const GValueArray *args);
void        dbus_watch_name                 (const gchar *name,
                                             DBusNameNotifyCb cb,
                                             gpointer user_data);
void        dbus_unwatch_name               (const gchar *name,
                                             DBusNameNotifyCb cb,
                                             gpointer user_data);
void        dbus_set_osso                   (osso_context_t *osso);
DBusConnection* get_dbus_connection         (DBusBusType type);
void        dbus_message_iter_append_gvalue (DBusMessageIter *iter,
                                             GValue *gvalue,
                                             gboolean as_variator);

Description

These functions are helpers for dbus communication.

Details

DBusNameNotifyCb ()

void        (*DBusNameNotifyCb)             (gpointer user_data);

Callback to be called when a watched name changes owner.

user_data : user data set when the signal handler was connected.

dbus_do_call ()

void        dbus_do_call                    (DBusConnection *bus,
                                             DBusMessage **reply,
                                             gboolean activation,
                                             const gchar *service,
                                             const gchar *path,
                                             const gchar *interface,
                                             const gchar *name,
                                             int first_arg_type,
                                             ...);

Does a method call over dbus. End the list of argument type / value pairs with a DBUS_TYPE_INVALID. The argument values must be passed by pointer.

bus : DBusConnection to make the method call on.
reply : Location to store reply or NULL for no replies.
activation : Should the receiver be started if necessary.
service : Service to be called.
path : Path to be called.
interface : Interface to be called.
name : Name of the method call.
first_arg_type : Type of the first argument.
... : Value of first argument, type of second argument...

dbus_do_call_gvalue ()

void        dbus_do_call_gvalue             (DBusConnection *bus,
                                             DBusMessage **reply,
                                             gboolean activation,
                                             const gchar *service,
                                             const gchar *path,
                                             const gchar *interface,
                                             const gchar *name,
                                             const GValueArray *args);

Does a method call over dbus.

bus : DBusConnection to make the method call on.
reply : Location to store reply or NULL for no replies.
activation : Should the receiver be started if necessary.
service : Service to be called.
path : Path to be called.
interface : Interface to be called.
name : Name of the method call.
args : Arguments for the method call.

dbus_watch_name ()

void        dbus_watch_name                 (const gchar *name,
                                             DBusNameNotifyCb cb,
                                             gpointer user_data);

Watches the name, when it changes owner, cb will be called.

name : Name to watch.
cb : Callback to call when name changes owner.
user_data : user data to pass to the cb.

dbus_unwatch_name ()

void        dbus_unwatch_name               (const gchar *name,
                                             DBusNameNotifyCb cb,
                                             gpointer user_data);

Stops watching for owner changes of name.

name : Name to stop watching.
cb : Callback that should no longer be called.
user_data : user data to pass to the cb.

dbus_set_osso ()

void        dbus_set_osso                   (osso_context_t *osso);

Sets a singleton osso context that is used to get dbus connections wherever they are needed, See get_dbus_connection.

osso : osso context to get connections from.

get_dbus_connection ()

DBusConnection* get_dbus_connection         (DBusBusType type);

Gets system or session bus from the osso context registered with dbus_set_osso. dbus_set_osso _must_ be called before this can be called.

type : DBUS_BUS_SESSION for session bus or DBUS_TYPE_SYSTEM for system bus.
Returns : A dbus connection to the bus specified by type. Callers owns a reference, unref with dbus_connection_unref.

dbus_message_iter_append_gvalue ()

void        dbus_message_iter_append_gvalue (DBusMessageIter *iter,
                                             GValue *gvalue,
                                             gboolean as_variator);

Adds a gvalue to a dbus message.

iter : Iter into which the gvalue is written to.
gvalue : The value which will be written.
as_variator : If true, the value will be written inside a variator container.