DBus GLib low level

DBus GLib low level — DBus lower level functions

Stability Level

Unstable, unless otherwise indicated

Functions

Types and Values

Includes

#include <dbus/dbus-glib-lowlevel.h>

Description

These functions can be used to access lower level of DBus.

Functions

dbus_set_g_error ()

void
dbus_set_g_error (GError **gerror,
                  DBusError *derror);

dbus_set_g_error is deprecated and should not be used in newly-written code.

New code should use GDBus instead. GDBus' error encoding is much simpler and more reliable, and the closest equivalent is g_dbus_error_new_for_dbus_error().

Store the information from a DBus method error return into a GError. For the normal case of an arbitrary remote process, the error code will be DBUS_GERROR_REMOTE_EXCEPTION. Now, DBus errors have two components; a message and a "name". The former is an arbitrary (normally American English) string. The second is a string like com.example.FooFailure which programs can use as a conditional source. Because a GError only has one string, we use a hack to encode both values:

<human readable string><null><error name><null>

You can use the following code to retrieve both values:

1
2
size_t len = strlen(msg);
const char *error_name = msg+len+1;]|

Parameters

gerror

an error

 

derror

a DBusError

 

dbus_connection_setup_with_g_main ()

void
dbus_connection_setup_with_g_main (DBusConnection *connection,
                                   GMainContext *context);

dbus_connection_setup_with_g_main is deprecated and should not be used in newly-written code.

New code should use GDBus instead. Modules that need to connect libdbus to a GLib main loop should use the dbus-gmain submodule via git subtree or git submodule.

Sets the watch and timeout functions of a DBusConnection to integrate the connection with the GLib main loop. Pass in NULL for the GMainContext unless you're doing something specialized.

If called twice for the same context, does nothing the second time. If called once with context A and once with context B, context B replaces context A as the context monitoring the connection.

Parameters

connection

the connection

 

context

the GMainContext or NULL for default context

 

dbus_connection_get_g_connection ()

DBusGConnection *
dbus_connection_get_g_connection (DBusConnection *connection);

dbus_connection_get_g_connection is deprecated and should not be used in newly-written code.

New code should use GDBus instead.

Get the DBusGConnection corresponding to this DBusConnection. This only makes sense if the DBusConnection was originally a DBusGConnection that was registered with the GLib main loop. The return value does not have its refcount incremented.

Parameters

connection

a DBusConnection

 

Returns

DBusGConnection


dbus_server_setup_with_g_main ()

void
dbus_server_setup_with_g_main (DBusServer *server,
                               GMainContext *context);

dbus_server_setup_with_g_main is deprecated and should not be used in newly-written code.

New code should use GDBus instead. Modules that need to connect libdbus to a GLib main loop should use the dbus-gmain submodule via git subtree or git submodule.

Sets the watch and timeout functions of a DBusServer to integrate the server with the GLib main loop. In most cases the context argument should be NULL.

If called twice for the same context, does nothing the second time. If called once with context A and once with context B, context B replaces context A as the context monitoring the connection.

Parameters

server

the server

 

context

the GMainContext or NULL for default

 

Types and Values

DBUS_TYPE_CONNECTION

#define DBUS_TYPE_CONNECTION      (dbus_connection_get_g_type ())

DBUS_TYPE_CONNECTION is deprecated and should not be used in newly-written code.

New code should use GDBus instead.

Expands to a function call returning a boxed GType representing a DBusConnection pointer from libdbus. Not to be confused with DBUS_TYPE_G_CONNECTION, which you should usually use instead.

Returns

the GLib type


DBUS_TYPE_MESSAGE

#define DBUS_TYPE_MESSAGE         (dbus_message_get_g_type ())

DBUS_TYPE_MESSAGE is deprecated and should not be used in newly-written code.

New code should use GDBus instead.

Expands to a function call returning a boxed GType representing a DBusMessage pointer from libdbus. Not to be confused with DBUS_TYPE_G_MESSAGE, which you should usually use instead.

Returns

the GLib type