Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions

Gio::DBusConnection Class Reference
[D-Bus Access Functionality]

DBusConnection - D-Bus Connections. More...

#include <giomm/dbusconnection.h>

Inheritance diagram for Gio::DBusConnection:
Inheritance graph
[legend]

List of all members.

Public Types

typedef sigc::slot< void,
const Glib::RefPtr
< DBusConnection >&, const
Glib::ustring&, const
Glib::ustring&, const
Glib::ustring&, const
Glib::ustring&, const
Glib::VariantBase& > 
SlotSignal
 Signature for slot used in signal_subscribe().
typedef sigc::slot
< Glib::RefPtr< DBusMessage >
, const Glib::RefPtr
< DBusConnection >&, const
Glib::RefPtr< DBusMessage >
&, bool > 
SlotMessageFilter
 Signature for slot used in add_filter().

Public Member Functions

virtual ~DBusConnection ()
GDBusConnection* gobj ()
 Provides access to the underlying C GObject.
const GDBusConnection* gobj () const
 Provides access to the underlying C GObject.
GDBusConnection* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void close ()
 Closes the connection.
void close (const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable)
 Closes the connection.
void close (const SlotAsyncReady& slot)
 Closes the connection.
bool close_finish (const Glib::RefPtr< AsyncResult >& result)
 Finishes an operation started with g_dbus_connection_close().
void close_sync ()
 Synchronously closees the connection.
void close_sync (const Glib::RefPtr< Cancellable >& cancellable)
 Synchronously closees connection.
void flush ()
 Asynchronously flushes the connection, that is, writes all queued outgoing message to the transport and then flushes the transport (using Gio::OutputStream::flush_async()).
void flush (const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable)
 Asynchronously flushes the connection, that is, writes all queued outgoing message to the transport and then flushes the transport (using Gio::OutputStream::flush_async()).
void flush (const SlotAsyncReady& slot)
 Asynchronously flushes the connection, that is, writes all queued outgoing message to the transport and then flushes the transport (using Gio::OutputStream::flush_async()).
bool flush_finish (const Glib::RefPtr< AsyncResult >& result)
 Finishes an operation started with g_dbus_connection_flush().
void flush_sync ()
 Synchronously flushes the connection.
void flush_sync (const Glib::RefPtr< Cancellable >& cancellable)
 Synchronously flushes connection.
bool get_exit_on_close () const
 Gets whether the process is terminated when connection is closed by the remote peer.
void set_exit_on_close (bool exit_on_close=true)
 Sets whether the process should be terminated when connection is closed by the remote peer.
bool send_message (const Glib::RefPtr< DBusMessage >& message, DBusSendMessageFlags flags, guint32* out_serial)
 Asynchronously sends message to the peer represented by connection.
void send_message_with_reply (const Glib::RefPtr< DBusMessage >& message, int timeout_msec, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable)
 Asynchronously sends message to the peer represented by the connection.
void send_message_with_reply (const Glib::RefPtr< DBusMessage >& message, int timeout_msec, const SlotAsyncReady& slot)
 Non-cancellable version of send_message_with_reply().
Glib::RefPtr< DBusMessagesend_message_with_reply_finish (const Glib::RefPtr< AsyncResult >& result)
 Finishes an operation started with g_dbus_connection_send_message_with_reply().
Glib::RefPtr< DBusMessagesend_message_with_reply_sync (const Glib::RefPtr< DBusMessage >& message, const Glib::RefPtr< Cancellable >& cancellable, gint timeout_msec)
 Synchronously sends message to the peer represented by the connection and blocks the calling thread until a reply is received or the timeout is reached.
Glib::RefPtr< DBusMessagesend_message_with_reply_sync (const Glib::RefPtr< DBusMessage >& message, gint timeout_msec)
 A non-cancellable version of send_message_with_reply_sync().
void start_message_processing ()
 If connection was created with DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING, this method starts processing messages.
bool is_closed () const
 Gets whether connection is closed.
Glib::RefPtr< IOStreamget_stream ()
 Gets the underlying stream used for IO.
Glib::RefPtr< const IOStreamget_stream () const
 Gets the underlying stream used for IO.
Glib::ustring get_guid () const
 The GUID of the peer performing the role of server when authenticating.
Glib::ustring get_unique_name () const
 Gets the unique name of connection as assigned by the message bus.
DBusCapabilityFlags get_capabilities () const
 Gets the capabilities negotiated with the remote peer.
Glib::RefPtr< Credentialsget_peer_credentials ()
 Gets the credentials of the authenticated peer.
Glib::RefPtr< const Credentialsget_peer_credentials () const
 Gets the credentials of the authenticated peer.
void call (const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::ustring& method_name, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, int timeout_msec=-1, const Glib::ustring& bus_name=Glib::ustring(), DBusCallFlags flags=Gio::DBUS_CALL_FLAGS_NONE, const Glib::VariantBase& parameters=Glib::VariantBase(), const Glib::VariantType& reply_type=Glib::VariantType())
 Asynchronously invokes the method_name method on the interface_name D-Bus interface on the remote object at object_path owned by bus_name.
void call (const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::ustring& method_name, const SlotAsyncReady& slot, int timeout_msec=-1, const Glib::ustring& bus_name=Glib::ustring(), DBusCallFlags flags=Gio::DBUS_CALL_FLAGS_NONE, const Glib::VariantBase& parameters=Glib::VariantBase(), const Glib::VariantType& reply_type=Glib::VariantType())
 A non-cancellable version of call().
void call_finish (Glib::VariantBase& output, const Glib::RefPtr< AsyncResult >& res)
 Finishes an operation started with call().
void call_sync (Glib::VariantBase& output, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::ustring& method_name, const Glib::RefPtr< Cancellable >& cancellable, int timeout_msec=-1, const Glib::ustring& bus_name=Glib::ustring(), DBusCallFlags flags=Gio::DBUS_CALL_FLAGS_NONE, const Glib::VariantBase& parameters=Glib::VariantBase(), const Glib::VariantType& reply_type=Glib::VariantType())
 Synchronously invokes the method_name method on the interface_name D-Bus interface on the remote object at object_path owned by bus_name.
void call_sync (Glib::VariantBase& output, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::ustring& method_name, int timeout_msec=-1, const Glib::ustring& bus_name=Glib::ustring(), DBusCallFlags flags=Gio::DBUS_CALL_FLAGS_NONE, const Glib::VariantBase& parameters=Glib::VariantBase(), const Glib::VariantType& reply_type=Glib::VariantType())
 A non-cancellable version of call_sync().
void emit_signal (const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::ustring& signal_name, const Glib::ustring& destination_bus_name=Glib::ustring(), const Glib::VariantBase& parameters=Glib::VariantBase())
 Emits a signal.
guint signal_subscribe (const SlotSignal& slot, const Glib::ustring& sender=Glib::ustring(), const Glib::ustring& interface_name=Glib::ustring(), const Glib::ustring& member=Glib::ustring(), const Glib::ustring& object_path=Glib::ustring(), const Glib::ustring& arg0=Glib::ustring(), DBusSignalFlags flags=Gio::DBUS_SIGNAL_FLAGS_NONE)
 Subscribes to signals on the connection and invokes slot with a whenever the signal is received.
void signal_unsubscribe (guint subscription_id)
 Unsubscribes from signals.
guint add_filter (const SlotMessageFilter& slot)
 Adds a message filter.
void remove_filter (guint filter_id)
 Removes a filter.

Static Public Member Functions

static void get (BusType bus_type, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable)
 Asynchronously connects to the message bus specified by bus_type.
static void get (BusType bus_type, const SlotAsyncReady& slot)
 Non-cancellable version of get().
static Glib::RefPtr
< DBusConnection
get_finish (const Glib::RefPtr< AsyncResult >& res)
 Finishes an operation started with g_bus_get().
static Glib::RefPtr
< DBusConnection
get_sync (BusType bus_type, const Glib::RefPtr< Cancellable >& cancellable)
 Synchronously connects to the message bus specified by bus_type.
static Glib::RefPtr
< DBusConnection
get_sync (BusType bus_type)
 A Non-cancellable version of get_sync().
static void create (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const Glib::RefPtr< DBusAuthObserver >& observer, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Asynchronously sets up a D-Bus connection for exchanging D-Bus messages with the end represented by stream.
static void create (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Asynchronously sets up a D-Bus connection for exchanging D-Bus messages with the end represented by stream.
static void create (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const Glib::RefPtr< DBusAuthObserver >& observer, const SlotAsyncReady& slot, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Non-cancellable version of create().
static void create (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const SlotAsyncReady& slot, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Non-cancellable version of create().
static Glib::RefPtr
< DBusConnection
create_finish (const Glib::RefPtr< AsyncResult >& res)
 Finishes an operation started with g_dbus_connection_new().
static void create_for_address (const Glib::ustring& address, const Glib::RefPtr< DBusAuthObserver >& observer, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Asynchronously connects and sets up a D-Bus client connection for exchanging D-Bus messages with an endpoint specified by address which must be in the D-Bus address format.
static void create_for_address (const Glib::ustring& address, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Asynchronously connects and sets up a D-Bus client connection for exchanging D-Bus messages with an endpoint specified by address which must be in the D-Bus address format.
static void create_for_address (const Glib::ustring& address, const Glib::RefPtr< DBusAuthObserver >& observer, const SlotAsyncReady& slot, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Non-cancellable version of create_for_address().
static void create_for_address (const Glib::ustring& address, const SlotAsyncReady& slot, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Non-cancellable version of create_for_address().
static Glib::RefPtr
< DBusConnection
create_for_address_finish (const Glib::RefPtr< AsyncResult >& res)
 Finishes an operation started with g_dbus_connection_new_for_address().
static Glib::RefPtr
< DBusConnection
create_sync (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const Glib::RefPtr< DBusAuthObserver >& observer, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Synchronously sets up a D-Bus connection for exchanging D-Bus messages with the end represented by stream.
static Glib::RefPtr
< DBusConnection
create_sync (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Synchronously sets up a D-Bus connection for exchanging D-Bus messages with the end represented by stream.
static Glib::RefPtr
< DBusConnection
create_sync (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const Glib::RefPtr< DBusAuthObserver >& observer, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Non-cancellable version of create_sync().
static Glib::RefPtr
< DBusConnection
create_sync (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Non-cancellable version of create_sync().
static Glib::RefPtr
< DBusConnection
create_for_address_sync (const Glib::ustring& address, const Glib::RefPtr< DBusAuthObserver >& observer, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Synchronously connects and sets up a D-Bus client connection for exchanging D-Bus messages with an endpoint specified by address which must be in the D-Bus address format.
static Glib::RefPtr
< DBusConnection
create_for_address_sync (const Glib::ustring& address, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Synchronously connects and sets up a D-Bus client connection for exchanging D-Bus messages with an endpoint specified by address which must be in the D-Bus address format.
static Glib::RefPtr
< DBusConnection
create_for_address_sync (const Glib::ustring& address, const Glib::RefPtr< DBusAuthObserver >& observer, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Non-cancellable version of create_for_address_sync().
static Glib::RefPtr
< DBusConnection
create_for_address_sync (const Glib::ustring& address, DBusConnectionFlags flags=Gio::DBUS_CONNECTION_FLAGS_NONE)
 Non-cancellable version of create_for_address_sync().

Protected Member Functions

 DBusConnection (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const Glib::RefPtr< DBusAuthObserver >& observer, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags)
 DBusConnection (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags)
 DBusConnection (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const Glib::RefPtr< DBusAuthObserver >& observer, const SlotAsyncReady& slot, DBusConnectionFlags flags)
 DBusConnection (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const SlotAsyncReady& slot, DBusConnectionFlags flags)
 DBusConnection (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const Glib::RefPtr< DBusAuthObserver >& observer, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags)
 DBusConnection (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags)
 DBusConnection (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, const Glib::RefPtr< DBusAuthObserver >& observer, DBusConnectionFlags flags)
 DBusConnection (const Glib::RefPtr< IOStream >& stream, const Glib::ustring& guid, DBusConnectionFlags flags)
 DBusConnection (const Glib::ustring& address, const Glib::RefPtr< DBusAuthObserver >& observer, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags)
 DBusConnection (const Glib::ustring& address, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags)
 DBusConnection (const Glib::ustring& address, const Glib::RefPtr< DBusAuthObserver >& observer, const SlotAsyncReady& slot, DBusConnectionFlags flags)
 DBusConnection (const Glib::ustring& address, const SlotAsyncReady& slot, DBusConnectionFlags flags)
 DBusConnection (const Glib::ustring& address, const Glib::RefPtr< DBusAuthObserver >& observer, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags)
 DBusConnection (const Glib::ustring& address, const Glib::RefPtr< Cancellable >& cancellable, DBusConnectionFlags flags)
 DBusConnection (const Glib::ustring& address, const Glib::RefPtr< DBusAuthObserver >& observer, DBusConnectionFlags flags)
 DBusConnection (const Glib::ustring& address, DBusConnectionFlags flags)

Related Functions

(Note that these are not member functions.)


Glib::RefPtr< Gio::DBusConnectionwrap (GDBusConnection* object, bool take_copy=false)
 A Glib::wrap() method for this object.

Detailed Description

DBusConnection - D-Bus Connections.

The DBusConnection type is used for D-Bus connections to remote peers such as a message buses. It is a low-level API that offers a lot of flexibility. For instance, it lets you establish a connection over any transport that can by represented as an IOStream.

This class is rarely used directly in D-Bus clients. If you are writing an D-Bus client, it is often easier to use the Gio::DBus::own_name(), Gio::DBus::watch_name() or DBusProxy::create_for_bus() APIs.

Since glibmm 2.28:

Member Typedef Documentation

Signature for slot used in add_filter().

For example,

 Glib::RefPtr<DBusMessage> on_message_filter(const
 Glib::RefPtr<DBusConnection>, const Glib::RefPtr<DBusMessage>& bool
 incoming);.

A filter function is passed a DBusMessage and expected to return a DBusMessage too. Passive filter functions that don't modify the message can simply return the message object. Filter functions that wants to drop a message can simply return 0. And filter function may modify a message by copying it and return the copy.

Signature for slot used in signal_subscribe().

For example,

 void on_signal(const Glib::RefPtr<DBusConnection>&, const
 Glib::ustring& sender_name, const Glib::ustring& object_path, const
 Glib::ustring& object_path, const Glib::ustring& interface_name, const
 Glib::ustring& signal_name, const Glib::VariantBase& parameters);.

Constructor & Destructor Documentation

virtual Gio::DBusConnection::~DBusConnection (  ) [virtual]
Gio::DBusConnection::DBusConnection ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const Glib::RefPtr< DBusAuthObserver >&  observer,
const SlotAsyncReady slot,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const SlotAsyncReady slot,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const Glib::RefPtr< DBusAuthObserver >&  observer,
const SlotAsyncReady slot,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const SlotAsyncReady slot,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const Glib::RefPtr< DBusAuthObserver >&  observer,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const Glib::RefPtr< DBusAuthObserver >&  observer,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::ustring address,
const Glib::RefPtr< DBusAuthObserver >&  observer,
const SlotAsyncReady slot,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::ustring address,
const SlotAsyncReady slot,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::ustring address,
const Glib::RefPtr< DBusAuthObserver >&  observer,
const SlotAsyncReady slot,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::ustring address,
const SlotAsyncReady slot,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::ustring address,
const Glib::RefPtr< DBusAuthObserver >&  observer,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::ustring address,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::ustring address,
const Glib::RefPtr< DBusAuthObserver >&  observer,
DBusConnectionFlags  flags 
) [protected]
Gio::DBusConnection::DBusConnection ( const Glib::ustring address,
DBusConnectionFlags  flags 
) [protected]

Member Function Documentation

guint Gio::DBusConnection::add_filter ( const SlotMessageFilter slot )

Adds a message filter.

Filters are handlers that are run on all incoming and outgoing messages, prior to standard dispatch. Filters are run in the order that they were added. The same handler can be added as a filter more than once, in which case it will be run more than once. Filters added during a filter slot won't be run on the message being processed. Filter slots are allowed to modify and even drop messages.

Note that filters are run in a dedicated message handling thread so they can't block and, generally, can't do anything but signal a worker thread. Also note that filters are rarely needed - use API such as send_message_with_reply(), signal_subscribe() or call() instead.

If a filter consumes an incoming message the message is not dispatched anywhere else - not even the standard dispatch machinery (that API such as signal_subscribe() and send_message_with_reply() relies on) will see the message. Similary, if a filter consumes an outgoing message, the message will not be sent to the other peer.

Parameters:
slotA filter slot.
Returns:
A filter identifier that can be used with remove_filter().
Since glibmm 2.28:
void Gio::DBusConnection::call ( const Glib::ustring object_path,
const Glib::ustring interface_name,
const Glib::ustring method_name,
const SlotAsyncReady slot,
const Glib::RefPtr< Cancellable >&  cancellable,
int  timeout_msec = -1,
const Glib::ustring bus_name = Glib::ustring(),
DBusCallFlags  flags = Gio::DBUS_CALL_FLAGS_NONE,
const Glib::VariantBase parameters = Glib::VariantBase(),
const Glib::VariantType reply_type = Glib::VariantType() 
)

Asynchronously invokes the method_name method on the interface_name D-Bus interface on the remote object at object_path owned by bus_name.

If the connection is closed then the operation will fail with Gio::IO_ERROR_CLOSED. If cancellable is cancelled, the operation will fail with Gio::IO_ERROR_CANCELLED. If parameters contains a value not compatible with the D-Bus protocol, the operation fails with Gio::IO_ERROR_INVALID_ARGUMENT.

If reply_type is non-0 then the reply will be checked for having this type and an error will be raised if it does not match. Said another way, if you give a reply_type then any non-0 return value will be of this type.

This is an asynchronous method. When the operation is finished, callback will be invoked in the thread-default main loop of the thread you are calling this method from. You can then call call_finish() to get the result of the operation. See call_sync() for the synchronous version of this function.

Parameters:
object_pathPath of remote object.
interface_nameD-Bus interface to invoke method on.
method_nameThe name of the method to invoke.
slotA SlotAsyncReady to call when the request is satisfied.
cancellableA Cancellable.
bus_nameA unique or well-known bus name or 0 if the connection is not a message bus connection.
timeout_msecThe timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout.
flagsFlags from the Gio::DBusCallFlags enumeration.
parametersA Glib::VariantBase tuple with parameters for the method or 0 if not passing parameters.
reply_typeThe expected type of the reply, or 0.
Since glibmm 2.28:
void Gio::DBusConnection::call ( const Glib::ustring object_path,
const Glib::ustring interface_name,
const Glib::ustring method_name,
const SlotAsyncReady slot,
int  timeout_msec = -1,
const Glib::ustring bus_name = Glib::ustring(),
DBusCallFlags  flags = Gio::DBUS_CALL_FLAGS_NONE,
const Glib::VariantBase parameters = Glib::VariantBase(),
const Glib::VariantType reply_type = Glib::VariantType() 
)

A non-cancellable version of call().

void Gio::DBusConnection::call_finish ( Glib::VariantBase output,
const Glib::RefPtr< AsyncResult >&  res 
)

Finishes an operation started with call().

Parameters:
outputA location in which to return a tuple with return values.
resA AsyncResult obtained from the SlotAsyncReady passed to call().
Exceptions:
Glib::Error.
Since glibmm 2.28:
void Gio::DBusConnection::call_sync ( Glib::VariantBase output,
const Glib::ustring object_path,
const Glib::ustring interface_name,
const Glib::ustring method_name,
const Glib::RefPtr< Cancellable >&  cancellable,
int  timeout_msec = -1,
const Glib::ustring bus_name = Glib::ustring(),
DBusCallFlags  flags = Gio::DBUS_CALL_FLAGS_NONE,
const Glib::VariantBase parameters = Glib::VariantBase(),
const Glib::VariantType reply_type = Glib::VariantType() 
)

Synchronously invokes the method_name method on the interface_name D-Bus interface on the remote object at object_path owned by bus_name.

If the connection is closed then the operation will fail with Gio::IO_ERROR_CLOSED. If cancellable is cancelled, the operation will fail with Gio::IO_ERROR_CANCELLED. If parameters contains a value not compatible with the D-Bus protocol, the operation fails with Gio::IO_ERROR_INVALID_ARGUMENT.

If reply_type is non-0 then the reply will be checked for having this type and an error will be raised if it does not match. Said another way, if you give a reply_type then any non-0 return value will be of this type.

The calling thread is blocked until a reply is received. See call() for the asynchronous version of this method.

Parameters:
outputA location in which to return a tuple with return values.
object_pathPath of remote object.
interface_nameD-Bus interface to invoke method on.
method_nameThe name of the method to invoke.
cancellableA Cancellable.
bus_nameA unique or well-known bus name or 0 if the connection is not a message bus connection.
timeout_msecThe timeout in milliseconds, -1 to use the default timeout or G_MAXINT for no timeout.
flagsFlags from the Gio::DBusCallFlags enumeration.
parametersA Glib::VariantBase tuple with parameters for the method or 0 if not passing parameters.
reply_typeThe expected type of the reply, or 0.
Exceptions:
Glib::Error.
Since glibmm 2.28:
void Gio::DBusConnection::call_sync ( Glib::VariantBase output,
const Glib::ustring object_path,
const Glib::ustring interface_name,
const Glib::ustring method_name,
int  timeout_msec = -1,
const Glib::ustring bus_name = Glib::ustring(),
DBusCallFlags  flags = Gio::DBUS_CALL_FLAGS_NONE,
const Glib::VariantBase parameters = Glib::VariantBase(),
const Glib::VariantType reply_type = Glib::VariantType() 
)

A non-cancellable version of call_sync().

void Gio::DBusConnection::close ( const SlotAsyncReady slot )

Closes the connection.

Note that this never causes the process to exit (this might only happen if the other end of a shared message bus connection disconnects, see property_exit_on_close()).

Once the connection is closed, operations such as sending a message will return with the error Gio::IO_ERROR_CLOSED. Closing a connection will not automatically flush the connection so queued messages may be lost. Use flush() if you need such guarantees.

If the connection is already closed, this method fails with Gio::IO_ERROR_CLOSED.

When the connection has been closed, the "closed" signal is emitted in the thread-default main loop of the thread that connection was constructed in.

This is an asynchronous method. When the operation is finished, slot will be invoked in the thread-default main loop of the thread you are calling this method from. You can then call close_finish() to get the result of the operation. See close_sync() for the synchronous version.

Parameters:
slotA SlotAsyncReady to call when the request is satisfied.
Since glibmm 2.28:
void Gio::DBusConnection::close (  )

Closes the connection.

Note that this never causes the process to exit (this might only happen if the other end of a shared message bus connection disconnects, see property_exit_on_close()).

Once the connection is closed, operations such as sending a message will return with the error Gio::IO_ERROR_CLOSED. Closing a connection will not automatically flush the connection so queued messages may be lost. Use flush() if you need such guarantees.

If the connection is already closed, this method fails with Gio::IO_ERROR_CLOSED.

When the connection has been closed, the "closed" signal is emitted in the thread-default main loop of the thread that connection was constructed in.

This is an asynchronous method. See close_sync() for the synchronous version.

Since glibmm 2.28:
void Gio::DBusConnection::close ( const SlotAsyncReady slot,
const Glib::RefPtr< Cancellable >&  cancellable 
)

Closes the connection.

Note that this never causes the process to exit (this might only happen if the other end of a shared message bus connection disconnects, see property_exit_on_close()).

Once the connection is closed, operations such as sending a message will return with the error Gio::IO_ERROR_CLOSED. Closing a connection will not automatically flush the connection so queued messages may be lost. Use flush() if you need such guarantees.

If the connection is already closed, this method fails with Gio::IO_ERROR_CLOSED.

When the connection has been closed, the "closed" signal is emitted in the thread-default main loop of the thread that connection was constructed in.

This is an asynchronous method. When the operation is finished, slot will be invoked in the thread-default main loop of the thread you are calling this method from. You can then call close_finish() to get the result of the operation. See close_sync() for the synchronous version.

Parameters:
slotA SlotAsyncReady to call when the request is satisfied.
cancellableA Cancellable.
Since glibmm 2.28:
bool Gio::DBusConnection::close_finish ( const Glib::RefPtr< AsyncResult >&  result )

Finishes an operation started with g_dbus_connection_close().

Since glibmm 2.26:
Parameters:
resA AsyncResult obtained from the AsyncReadyCallback passed to g_dbus_connection_close().
Returns:
true if the operation succeeded, false if error is set.
void Gio::DBusConnection::close_sync ( const Glib::RefPtr< Cancellable >&  cancellable )

Synchronously closees connection.

The calling thread is blocked until this is done. See g_dbus_connection_close() for the asynchronous version of this method and more details about what it does.

Since glibmm 2.26:
Parameters:
cancellableA Cancellable or 0.
Returns:
true if the operation succeeded, false if error is set.
void Gio::DBusConnection::close_sync (  )

Synchronously closees the connection.

The calling thread is blocked until this is done. See close() for the asynchronous version of this method and more details about what it does.

Since glibmm 2.28:
Exceptions:
Glib::Error.
static void Gio::DBusConnection::create ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const SlotAsyncReady slot,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Asynchronously sets up a D-Bus connection for exchanging D-Bus messages with the end represented by stream.

If observer is not 0 it may be used to control the authentication process.

When the operation is finished, callback will be invoked. You can then call g_dbus_connection_new_finish() to get the result of the operation.

This is a asynchronous failable constructor. See g_dbus_connection_new_sync() for the synchronous version.

Since glibmm 2.26:
Parameters:
streamA IOStream.
guidThe GUID to use if a authenticating as a server or 0.
flagsFlags describing how to make the connection.
observerA DBusAuthObserver or 0.
cancellableA Cancellable or 0.
callbackA AsyncReadyCallback to call when the request is satisfied.
user_dataThe data to pass to callback.
static void Gio::DBusConnection::create ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const Glib::RefPtr< DBusAuthObserver >&  observer,
const SlotAsyncReady slot,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Non-cancellable version of create().

static void Gio::DBusConnection::create ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const SlotAsyncReady slot,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Non-cancellable version of create().

static void Gio::DBusConnection::create ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const Glib::RefPtr< DBusAuthObserver >&  observer,
const SlotAsyncReady slot,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Asynchronously sets up a D-Bus connection for exchanging D-Bus messages with the end represented by stream.

If observer is not 0 it may be used to control the authentication process.

When the operation is finished, callback will be invoked. You can then call g_dbus_connection_new_finish() to get the result of the operation.

This is a asynchronous failable constructor. See g_dbus_connection_new_sync() for the synchronous version.

Since glibmm 2.26:
Parameters:
streamA IOStream.
guidThe GUID to use if a authenticating as a server or 0.
flagsFlags describing how to make the connection.
observerA DBusAuthObserver or 0.
cancellableA Cancellable or 0.
callbackA AsyncReadyCallback to call when the request is satisfied.
user_dataThe data to pass to callback.
static Glib::RefPtr<DBusConnection> Gio::DBusConnection::create_finish ( const Glib::RefPtr< AsyncResult >&  res ) [static]

Finishes an operation started with g_dbus_connection_new().

Since glibmm 2.26:
Parameters:
resA AsyncResult obtained from the AsyncReadyCallback passed to g_dbus_connection_new().
Returns:
A DBusConnection or 0 if error is set. Free with Glib::object_unref().
Exceptions:
Glib::Error.

Reimplemented from Gio::AsyncInitable.

static void Gio::DBusConnection::create_for_address ( const Glib::ustring address,
const Glib::RefPtr< DBusAuthObserver >&  observer,
const SlotAsyncReady slot,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Non-cancellable version of create_for_address().

static void Gio::DBusConnection::create_for_address ( const Glib::ustring address,
const SlotAsyncReady slot,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Non-cancellable version of create_for_address().

static void Gio::DBusConnection::create_for_address ( const Glib::ustring address,
const Glib::RefPtr< DBusAuthObserver >&  observer,
const SlotAsyncReady slot,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Asynchronously connects and sets up a D-Bus client connection for exchanging D-Bus messages with an endpoint specified by address which must be in the D-Bus address format.

This constructor can only be used to initiate client-side connections - use g_dbus_connection_new() if you need to act as the server. In particular, flags cannot contain the DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags.

When the operation is finished, callback will be invoked. You can then call g_dbus_connection_new_finish() to get the result of the operation.

If observer is not 0 it may be used to control the authentication process.

This is a asynchronous failable constructor. See g_dbus_connection_new_for_address_sync() for the synchronous version.

Since glibmm 2.26:
Parameters:
addressA D-Bus address.
flagsFlags describing how to make the connection.
observerA DBusAuthObserver or 0.
cancellableA Cancellable or 0.
callbackA AsyncReadyCallback to call when the request is satisfied.
user_dataThe data to pass to callback.
static void Gio::DBusConnection::create_for_address ( const Glib::ustring address,
const SlotAsyncReady slot,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Asynchronously connects and sets up a D-Bus client connection for exchanging D-Bus messages with an endpoint specified by address which must be in the D-Bus address format.

This constructor can only be used to initiate client-side connections - use g_dbus_connection_new() if you need to act as the server. In particular, flags cannot contain the DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags.

When the operation is finished, callback will be invoked. You can then call g_dbus_connection_new_finish() to get the result of the operation.

If observer is not 0 it may be used to control the authentication process.

This is a asynchronous failable constructor. See g_dbus_connection_new_for_address_sync() for the synchronous version.

Since glibmm 2.26:
Parameters:
addressA D-Bus address.
flagsFlags describing how to make the connection.
observerA DBusAuthObserver or 0.
cancellableA Cancellable or 0.
callbackA AsyncReadyCallback to call when the request is satisfied.
user_dataThe data to pass to callback.
static Glib::RefPtr<DBusConnection> Gio::DBusConnection::create_for_address_finish ( const Glib::RefPtr< AsyncResult >&  res ) [static]

Finishes an operation started with g_dbus_connection_new_for_address().

Since glibmm 2.26:
Parameters:
resA AsyncResult obtained from the AsyncReadyCallback passed to g_dbus_connection_new().
Returns:
A DBusConnection or 0 if error is set. Free with Glib::object_unref().
Exceptions:
Glib::Error.
static Glib::RefPtr<DBusConnection> Gio::DBusConnection::create_for_address_sync ( const Glib::ustring address,
const Glib::RefPtr< DBusAuthObserver >&  observer,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Synchronously connects and sets up a D-Bus client connection for exchanging D-Bus messages with an endpoint specified by address which must be in the D-Bus address format.

This constructor can only be used to initiate client-side connections - use g_dbus_connection_new_sync() if you need to act as the server. In particular, flags cannot contain the DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags.

This is a synchronous failable constructor. See g_dbus_connection_new_for_address() for the asynchronous version.

If observer is not 0 it may be used to control the authentication process.

Since glibmm 2.26:
Parameters:
addressA D-Bus address.
flagsFlags describing how to make the connection.
observerA DBusAuthObserver or 0.
cancellableA Cancellable or 0.
Returns:
A DBusConnection or 0 if error is set. Free with Glib::object_unref().
Exceptions:
Glib::Error.
static Glib::RefPtr<DBusConnection> Gio::DBusConnection::create_for_address_sync ( const Glib::ustring address,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Synchronously connects and sets up a D-Bus client connection for exchanging D-Bus messages with an endpoint specified by address which must be in the D-Bus address format.

This constructor can only be used to initiate client-side connections - use g_dbus_connection_new_sync() if you need to act as the server. In particular, flags cannot contain the DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER or DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS flags.

This is a synchronous failable constructor. See g_dbus_connection_new_for_address() for the asynchronous version.

If observer is not 0 it may be used to control the authentication process.

Since glibmm 2.26:
Parameters:
addressA D-Bus address.
flagsFlags describing how to make the connection.
observerA DBusAuthObserver or 0.
cancellableA Cancellable or 0.
Returns:
A DBusConnection or 0 if error is set. Free with Glib::object_unref().
Exceptions:
Glib::Error.
static Glib::RefPtr<DBusConnection> Gio::DBusConnection::create_for_address_sync ( const Glib::ustring address,
const Glib::RefPtr< DBusAuthObserver >&  observer,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Non-cancellable version of create_for_address_sync().

static Glib::RefPtr<DBusConnection> Gio::DBusConnection::create_for_address_sync ( const Glib::ustring address,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Non-cancellable version of create_for_address_sync().

static Glib::RefPtr<DBusConnection> Gio::DBusConnection::create_sync ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const Glib::RefPtr< DBusAuthObserver >&  observer,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Synchronously sets up a D-Bus connection for exchanging D-Bus messages with the end represented by stream.

If observer is not 0 it may be used to control the authentication process.

This is a synchronous failable constructor. See g_dbus_connection_new() for the asynchronous version.

Since glibmm 2.26:
Parameters:
streamA IOStream.
guidThe GUID to use if a authenticating as a server or 0.
flagsFlags describing how to make the connection.
observerA DBusAuthObserver or 0.
cancellableA Cancellable or 0.
Returns:
A DBusConnection or 0 if error is set. Free with Glib::object_unref().
Exceptions:
Glib::Error.
static Glib::RefPtr<DBusConnection> Gio::DBusConnection::create_sync ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const Glib::RefPtr< Cancellable >&  cancellable,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Synchronously sets up a D-Bus connection for exchanging D-Bus messages with the end represented by stream.

If observer is not 0 it may be used to control the authentication process.

This is a synchronous failable constructor. See g_dbus_connection_new() for the asynchronous version.

Since glibmm 2.26:
Parameters:
streamA IOStream.
guidThe GUID to use if a authenticating as a server or 0.
flagsFlags describing how to make the connection.
observerA DBusAuthObserver or 0.
cancellableA Cancellable or 0.
Returns:
A DBusConnection or 0 if error is set. Free with Glib::object_unref().
Exceptions:
Glib::Error.
static Glib::RefPtr<DBusConnection> Gio::DBusConnection::create_sync ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
const Glib::RefPtr< DBusAuthObserver >&  observer,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Non-cancellable version of create_sync().

static Glib::RefPtr<DBusConnection> Gio::DBusConnection::create_sync ( const Glib::RefPtr< IOStream >&  stream,
const Glib::ustring guid,
DBusConnectionFlags  flags = Gio::DBUS_CONNECTION_FLAGS_NONE 
) [static]

Non-cancellable version of create_sync().

void Gio::DBusConnection::emit_signal ( const Glib::ustring object_path,
const Glib::ustring interface_name,
const Glib::ustring signal_name,
const Glib::ustring destination_bus_name = Glib::ustring(),
const Glib::VariantBase parameters = Glib::VariantBase() 
)

Emits a signal.

This can only fail if parameters is not compatible with the D-Bus protocol.

Parameters:
object_pathPath of remote object.
interface_nameD-Bus interface to emit a signal on.
signal_nameThe name of the signal to emit.
destination_bus_nameThe unique bus name for the destination for the signal or 0 to emit to all listeners.
parametersA Glib::VariantBase tuple with parameters for the signal or 0 if not passing parameters.
Exceptions:
Glib::Error.
Since glibmm 2.28:
void Gio::DBusConnection::flush (  )

Asynchronously flushes the connection, that is, writes all queued outgoing message to the transport and then flushes the transport (using Gio::OutputStream::flush_async()).

This is useful in programs that wants to emit a D-Bus signal and then exit immediately. Without flushing the connection, there is no guarantee that the message has been sent to the networking buffers in the OS kernel.

This is an asynchronous method. See flush_sync() for the synchronous version.

Since glibmm 2.28:
void Gio::DBusConnection::flush ( const SlotAsyncReady slot,
const Glib::RefPtr< Cancellable >&  cancellable 
)

Asynchronously flushes the connection, that is, writes all queued outgoing message to the transport and then flushes the transport (using Gio::OutputStream::flush_async()).

This is useful in programs that wants to emit a D-Bus signal and then exit immediately. Without flushing the connection, there is no guarantee that the message has been sent to the networking buffers in the OS kernel.

This is an asynchronous method. When the operation is finished, slot will be invoked in the thread-default main loop of the thread you are calling this method from. You can then call flush_finish() to get the result of the operation. See flush_sync() for the synchronous version.

Parameters:
slotA SlotAsyncReady to call when the request is satisfied.
cancellableA Cancellable.
Since glibmm 2.28:
void Gio::DBusConnection::flush ( const SlotAsyncReady slot )

Asynchronously flushes the connection, that is, writes all queued outgoing message to the transport and then flushes the transport (using Gio::OutputStream::flush_async()).

This is useful in programs that wants to emit a D-Bus signal and then exit immediately. Without flushing the connection, there is no guarantee that the message has been sent to the networking buffers in the OS kernel.

This is an asynchronous method. When the operation is finished, slot will be invoked in the thread-default main loop of the thread you are calling this method from. You can then call flush_finish() to get the result of the operation. See flush_sync() for the synchronous version.

Parameters:
slotA SlotAsyncReady to call when the request is satisfied.
Since glibmm 2.28:
bool Gio::DBusConnection::flush_finish ( const Glib::RefPtr< AsyncResult >&  result )

Finishes an operation started with g_dbus_connection_flush().

Since glibmm 2.26:
Parameters:
resA AsyncResult obtained from the AsyncReadyCallback passed to g_dbus_connection_flush().
Returns:
true if the operation succeeded, false if error is set.
void Gio::DBusConnection::flush_sync (  )

Synchronously flushes the connection.

The calling thread is blocked until this is done. See flush() for the asynchronous version of this method and more details about what it does.

Since glibmm 2.28:
Exceptions:
Glib::Error.
void Gio::DBusConnection::flush_sync ( const Glib::RefPtr< Cancellable >&  cancellable )

Synchronously flushes connection.

The calling thread is blocked until this is done. See g_dbus_connection_flush() for the asynchronous version of this method and more details about what it does.

Since glibmm 2.26:
Parameters:
cancellableA Cancellable or 0.
Returns:
true if the operation succeeded, false if error is set.
static void Gio::DBusConnection::get ( BusType  bus_type,
const SlotAsyncReady slot 
) [static]

Non-cancellable version of get().

static void Gio::DBusConnection::get ( BusType  bus_type,
const SlotAsyncReady slot,
const Glib::RefPtr< Cancellable >&  cancellable 
) [static]

Asynchronously connects to the message bus specified by bus_type.

When the operation is finished, slot will be invoked. You can then call get_finish() to get the result of the operation.

This is a asynchronous failable function. See get_sync() for the synchronous version.

Parameters:
bus_typeA BusType.
slotA SlotAsyncReady to call when the request is satisfied.
cancellableA Cancellable.
Since glibmm 2.28:
DBusCapabilityFlags Gio::DBusConnection::get_capabilities (  ) const

Gets the capabilities negotiated with the remote peer.

Since glibmm 2.26:
Returns:
Zero or more flags from the DBusCapabilityFlags enumeration.
bool Gio::DBusConnection::get_exit_on_close (  ) const

Gets whether the process is terminated when connection is closed by the remote peer.

See DBusConnection:exit-on-close for more details.

Since glibmm 2.26:
Returns:
Whether the process is terminated when connection is closed by the remote peer.
static Glib::RefPtr<DBusConnection> Gio::DBusConnection::get_finish ( const Glib::RefPtr< AsyncResult >&  res ) [static]

Finishes an operation started with g_bus_get().

The returned object is a singleton, that is, shared with other callers of g_bus_get() and g_bus_get_sync() for bus_type. In the event that you need a private message bus connection, use Glib::dbus_address_get_for_bus() and g_dbus_connection_new_for_address().

Note that the returned DBusConnection object will (usually) have the DBusConnection:exit-on-close property set to true.

Since glibmm 2.26:
Parameters:
resA AsyncResult obtained from the AsyncReadyCallback passed to g_bus_get().
Returns:
A DBusConnection or 0 if error is set. Free with Glib::object_unref().
Exceptions:
Glib::Error.
Glib::ustring Gio::DBusConnection::get_guid (  ) const

The GUID of the peer performing the role of server when authenticating.

See DBusConnection:guid for more details.

Since glibmm 2.26:
Returns:
The GUID. Do not free this string, it is owned by connection.
Glib::RefPtr<Credentials> Gio::DBusConnection::get_peer_credentials (  )

Gets the credentials of the authenticated peer.

This will always return 0 unless connection acted as a server (e.g. DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER was passed) when set up and the client passed credentials as part of the authentication process.

In a message bus setup, the message bus is always the server and each application is a client. So this method will always return 0 for message bus clients.

Since glibmm 2.26:
Returns:
A Credentials or 0 if not available. Do not free this object, it is owned by connection.
Glib::RefPtr<const Credentials> Gio::DBusConnection::get_peer_credentials (  ) const

Gets the credentials of the authenticated peer.

This will always return 0 unless connection acted as a server (e.g. DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER was passed) when set up and the client passed credentials as part of the authentication process.

In a message bus setup, the message bus is always the server and each application is a client. So this method will always return 0 for message bus clients.

Since glibmm 2.26:
Returns:
A Credentials or 0 if not available. Do not free this object, it is owned by connection.
Glib::RefPtr<IOStream> Gio::DBusConnection::get_stream (  )

Gets the underlying stream used for IO.

Since glibmm 2.26:
Returns:
The stream used for IO.
Glib::RefPtr<const IOStream> Gio::DBusConnection::get_stream (  ) const

Gets the underlying stream used for IO.

Since glibmm 2.26:
Returns:
The stream used for IO.
static Glib::RefPtr<DBusConnection> Gio::DBusConnection::get_sync ( BusType  bus_type ) [static]

A Non-cancellable version of get_sync().

static Glib::RefPtr<DBusConnection> Gio::DBusConnection::get_sync ( BusType  bus_type,
const Glib::RefPtr< Cancellable >&  cancellable 
) [static]

Synchronously connects to the message bus specified by bus_type.

Note that the returned object may shared with other callers, e.g. if two separate parts of a process calls this function with the same bus_type, they will share the same object.

This is a synchronous failable function. See g_bus_get() and g_bus_get_finish() for the asynchronous version.

The returned object is a singleton, that is, shared with other callers of g_bus_get() and g_bus_get_sync() for bus_type. In the event that you need a private message bus connection, use g_dbus_address_get_for_bus_sync() and g_dbus_connection_new_for_address().

Note that the returned DBusConnection object will (usually) have the DBusConnection:exit-on-close property set to true.

Since glibmm 2.26:
Parameters:
bus_typeA BusType.
cancellableA Cancellable or 0.
Returns:
A DBusConnection or 0 if error is set. Free with Glib::object_unref().
Glib::ustring Gio::DBusConnection::get_unique_name (  ) const

Gets the unique name of connection as assigned by the message bus.

This can also be used to figure out if connection is a message bus connection.

Since glibmm 2.26:
Returns:
The unique name or 0 if connection is not a message bus connection. Do not free this string, it is owned by connection.
const GDBusConnection* Gio::DBusConnection::gobj (  ) const [inline]

Provides access to the underlying C GObject.

Reimplemented from Gio::AsyncInitable.

GDBusConnection* Gio::DBusConnection::gobj (  ) [inline]

Provides access to the underlying C GObject.

Reimplemented from Gio::AsyncInitable.

GDBusConnection* Gio::DBusConnection::gobj_copy (  )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

bool Gio::DBusConnection::is_closed (  ) const

Gets whether connection is closed.

Since glibmm 2.26:
Returns:
true if the connection is closed, false otherwise.
void Gio::DBusConnection::remove_filter ( guint  filter_id )

Removes a filter.

Since glibmm 2.26:
Parameters:
filter_idAn identifier obtained from g_dbus_connection_add_filter().
bool Gio::DBusConnection::send_message ( const Glib::RefPtr< DBusMessage >&  message,
DBusSendMessageFlags  flags,
guint32 *  out_serial 
)

Asynchronously sends message to the peer represented by connection.

Unless flags contain the DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number will be assigned by connection and set on message via g_dbus_message_set_serial(). If out_serial is not 0, then the serial number used will be written to this location prior to submitting the message to the underlying transport.

If connection is closed then the operation will fail with IO_ERROR_CLOSED. If message is not well-formed, the operation fails with IO_ERROR_INVALID_ARGUMENT.

See <xref linkend="gdbus-server"> and <xref linkend="gdbus-unix-fd-client"> for an example of how to use this low-level API to send and receive UNIX file descriptors.

Since glibmm 2.26:
Parameters:
messageA DBusMessage.
flagsFlags affecting how the message is sent.
out_serialReturn location for serial number assigned to message when sending it or 0.
Returns:
true if the message was well-formed and queued for transmission, false if error is set.
void Gio::DBusConnection::send_message_with_reply ( const Glib::RefPtr< DBusMessage >&  message,
int  timeout_msec,
const SlotAsyncReady slot 
)

Non-cancellable version of send_message_with_reply().

void Gio::DBusConnection::send_message_with_reply ( const Glib::RefPtr< DBusMessage >&  message,
int  timeout_msec,
const SlotAsyncReady slot,
const Glib::RefPtr< Cancellable >&  cancellable 
)

Asynchronously sends message to the peer represented by the connection.

Unless flags contain the Gio::DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number will be assigned by the connection and set on message via Gio::DBusMessage::set_serial().

If the connection is closed then the operation will fail with Gio::IO_ERROR_CLOSED. If cancellable is canceled, the operation will fail with Gio::IO_ERROR_CANCELLED. If message is not well-formed, the operation fails with Gio::IO_ERROR_INVALID_ARGUMENT.

This is an asynchronous method. When the operation is finished, slot will be invoked in the thread-default main loop of the thread you are calling this method from. You can then call send_message_with_reply_finish() to get the result of the operation. See send_message_with_reply_sync() for the synchronous version.

Note that message must be unlocked, unless flags contain the Gio::DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.

See the C API docs for examples.

Parameters:
messageA DBusMessage.
timeout_msecThe timeout in milliseconds or -1 to use the default timeout.
slotA SlotAsyncReady to call when the request is satisfied.
cancellableA Cancellable.
Since glibmm 2.28:
Glib::RefPtr<DBusMessage> Gio::DBusConnection::send_message_with_reply_finish ( const Glib::RefPtr< AsyncResult >&  result )

Finishes an operation started with g_dbus_connection_send_message_with_reply().

Note that error is only set if a local in-process error occured. That is to say that the returned DBusMessage object may be of type DBUS_MESSAGE_TYPE_ERROR. Use g_dbus_message_to_gerror() to transcode this to a Error.

See <xref linkend="gdbus-server"> and <xref linkend="gdbus-unix-fd-client"> for an example of how to use this low-level API to send and receive UNIX file descriptors.

Since glibmm 2.26:
Parameters:
resA AsyncResult obtained from the AsyncReadyCallback passed to g_dbus_connection_send_message_with_reply().
Returns:
A DBusMessage or 0 if error is set.
Exceptions:
Glib::Error.
Glib::RefPtr<DBusMessage> Gio::DBusConnection::send_message_with_reply_sync ( const Glib::RefPtr< DBusMessage >&  message,
gint  timeout_msec 
)

A non-cancellable version of send_message_with_reply_sync().

Glib::RefPtr<DBusMessage> Gio::DBusConnection::send_message_with_reply_sync ( const Glib::RefPtr< DBusMessage >&  message,
const Glib::RefPtr< Cancellable >&  cancellable,
gint  timeout_msec 
)

Synchronously sends message to the peer represented by the connection and blocks the calling thread until a reply is received or the timeout is reached.

See send_message_with_reply() for the asynchronous version of this method.

Unless flags contain the Gio::DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, the serial number will be assigned by the connection and set on message via Gio::DBusMessage::set_serial().

If the connection is closed then the operation will fail with Gio::IO_ERROR_CLOSED. If cancellable is canceled, the operation will fail with Gio::IO_ERROR_CANCELLED. If message is not well-formed, the operation fails with Gio::IO_ERROR_INVALID_ARGUMENT.

Note that a Glib::Error is thrown if a local in-process error occured. That is to say that the returned DBusMessage object may be of type G_DBUS_MESSAGE_TYPE_ERROR. Use Gio::DBusMessage::to_exception() to transcode this to a Glib::Error.

See the C API docs for examples.

Note that message must be unlocked, unless flags contain the Gio::DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag.

Parameters:
messageA DBusMessage.
cancellableA Cancellable.
timeout_msecThe timeout in milliseconds or -1 to use the default timeout.
Returns:
A locked DBusMessage that is the reply to message or 0 if a Glib::Error is thrown.
Exceptions:
Glib::Error.
Since glibmm 2.28:
void Gio::DBusConnection::set_exit_on_close ( bool  exit_on_close = true )

Sets whether the process should be terminated when connection is closed by the remote peer.

See DBusConnection:exit-on-close for more details.

Since glibmm 2.26:
Parameters:
exit_on_closeWhether the process should be terminated when connection is closed by the remote peer.
guint Gio::DBusConnection::signal_subscribe ( const SlotSignal slot,
const Glib::ustring sender = Glib::ustring(),
const Glib::ustring interface_name = Glib::ustring(),
const Glib::ustring member = Glib::ustring(),
const Glib::ustring object_path = Glib::ustring(),
const Glib::ustring arg0 = Glib::ustring(),
DBusSignalFlags  flags = Gio::DBUS_SIGNAL_FLAGS_NONE 
)

Subscribes to signals on the connection and invokes slot with a whenever the signal is received.

Note that slot will be invoked in the thread-default main loop of the thread you are calling this method from.

If the connection is not a message bus connection, sender must be 0.

If sender is a well-known name note that slot is invoked with the unique name for the owner of sender, not the well-known name as one would expect. This is because the message bus rewrites the name. As such, to avoid certain race conditions, users should be tracking the name owner of the well-known name and use that when processing the received signal.

Parameters:
slotSlot to invoke when there is a signal matching the requested data.
senderSender name to match on (unique or well-known name) or 0 to listen from all senders.
interface_nameD-Bus interface name to match on or 0 to match on all interfaces.
memberD-Bus signal name to match on or 0 to match on all signals.
object_pathObject path to match on or 0 to match on all object paths.
arg0Contents of first string argument to match on or 0 to match on all kinds of arguments.
flagsFlags describing how to subscribe to the signal (currently unused).
Returns:
A subscription identifier that can be used with signal_unsubscribe().
Since glibmm 2.28:
void Gio::DBusConnection::signal_unsubscribe ( guint  subscription_id )

Unsubscribes from signals.

Since glibmm 2.26:
Parameters:
subscription_idA subscription id obtained from g_dbus_connection_signal_subscribe().
void Gio::DBusConnection::start_message_processing (  )

If connection was created with DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING, this method starts processing messages.

Does nothing on if connection wasn't created with this flag or if the method has already been called.

Since glibmm 2.26:

Friends And Related Function Documentation

Glib::RefPtr< Gio::DBusConnection > wrap ( GDBusConnection *  object,
bool  take_copy = false 
) [related]

A Glib::wrap() method for this object.

Parameters:
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns:
A C++ instance that wraps this C instance.