QtBase
v6.3.1
|
The QDBusConnectionInterface class provides access to the D-Bus bus daemon service. More...
#include <qdbusconnectioninterface.h>
Public Types | |
enum | ServiceQueueOptions { DontQueueService , QueueService , ReplaceExistingService } |
enum | ServiceReplacementOptions { DontAllowReplacement , AllowReplacement } |
enum | RegisterServiceReply { ServiceNotRegistered = 0 , ServiceRegistered , ServiceQueued } |
Public Slots | |
QDBusReply< QStringList > | registeredServiceNames () const |
QDBusReply< QStringList > | activatableServiceNames () const |
QDBusReply< bool > | isServiceRegistered (const QString &serviceName) const |
QDBusReply< QString > | serviceOwner (const QString &name) const |
QDBusReply< bool > | unregisterService (const QString &serviceName) |
QDBusReply< QDBusConnectionInterface::RegisterServiceReply > | registerService (const QString &serviceName, ServiceQueueOptions qoption=DontQueueService, ServiceReplacementOptions roption=DontAllowReplacement) |
QDBusReply< uint > | servicePid (const QString &serviceName) const |
QDBusReply< uint > | serviceUid (const QString &serviceName) const |
QDBusReply< void > | startService (const QString &name) |
Public Slots inherited from QObject | |
void | deleteLater () |
Signals | |
void | serviceRegistered (const QString &service) |
void | serviceUnregistered (const QString &service) |
void | serviceOwnerChanged (const QString &name, const QString &oldOwner, const QString &newOwner) |
void | callWithCallbackFailed (const QDBusError &error, const QDBusMessage &call) |
void | NameAcquired (const QString &) |
void | NameLost (const QString &) |
void | NameOwnerChanged (const QString &, const QString &, const QString &) |
Signals inherited from QObject | |
void | destroyed (QObject *=nullptr) |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
Properties | |
QDBusReply< QStringList > | registeredServiceNames |
holds the registered service names More... | |
QDBusReply< QStringList > | activatableServiceNames |
holds the activatable service names More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
Friends | |
class | QDBusConnectionPrivate |
The QDBusConnectionInterface class provides access to the D-Bus bus daemon service.
\inmodule QtDBus
The D-Bus bus server daemon provides one special interface org.freedesktop.DBus
that allows clients to access certain properties of the bus, such as the current list of clients connected. The QDBusConnectionInterface class provides access to that interface.
The most common uses of this class are to register and unregister service names on the bus using the registerService() and unregisterService() functions, query about existing names using the isServiceRegistered(), registeredServiceNames() and serviceOwner() functions, and to receive notification that a client has registered or de-registered through the serviceRegistered(), serviceUnregistered() and serviceOwnerChanged() signals.
Definition at line 61 of file qdbusconnectioninterface.h.
The possible return values from registerService():
\value ServiceNotRegistered The call failed and the service name was not registered. \value ServiceRegistered The caller is now the owner of the service name. \value ServiceQueued The caller specified the QueueService flag and the service was already registered, so we are in queue.
The serviceRegistered() signal will be emitted when the service is acquired by this application.
Enumerator | |
---|---|
ServiceNotRegistered | |
ServiceRegistered | |
ServiceQueued |
Definition at line 85 of file qdbusconnectioninterface.h.
Flags for determining how a service registration should behave, in case the service name is already registered.
\value DontQueueService If an application requests a name that is already owned, no queueing will be performed. The registeredService() call will simply fail. This is the default.
\value QueueService Attempts to register the requested service, but do not try to replace it if another application already has it registered. Instead, simply put this application in queue, until it is given up. The serviceRegistered() signal will be emitted when that happens.
\value ReplaceExistingService If another application already has the service name registered, attempt to replace it.
Enumerator | |
---|---|
DontQueueService | |
QueueService | |
ReplaceExistingService |
Definition at line 74 of file qdbusconnectioninterface.h.
Flags for determining if the D-Bus server should allow another application to replace a name that this application has registered with the ReplaceExistingService option.
The possible values are:
\value DontAllowReplacement Do not allow another application to replace us. The service must be explicitly unregistered with unregisterService() for another application to acquire it. This is the default.
\value AllowReplacement Allow other applications to replace us with the ReplaceExistingService option to registerService() without intervention. If that happens, the serviceUnregistered() signal will be emitted.
Enumerator | |
---|---|
DontAllowReplacement | |
AllowReplacement |
Definition at line 80 of file qdbusconnectioninterface.h.
|
slot |
Definition at line 208 of file qdbusconnectioninterface.cpp.
|
signal |
This signal is emitted when there is an error during a QDBusConnection::callWithCallback(). error specifies the error. call is the message that couldn't be delivered.
|
overrideprotectedvirtual |
This virtual function is called when something has been connected to signal in this object.
If you want to compare signal with a specific signal, you can use QMetaMethod::fromSignal() as follows:
Reimplemented from QDBusAbstractInterface.
Definition at line 342 of file qdbusconnectioninterface.cpp.
|
overrideprotectedvirtual |
This virtual function is called when something has been disconnected from signal in this object.
See connectNotify() for an example of how to compare signal with a specific signal.
If all signals were disconnected from this object (e.g., the signal argument to disconnect() was \nullptr), disconnectNotify() is only called once, and the signal will be an invalid QMetaMethod (QMetaMethod::isValid() returns false
).
Reimplemented from QDBusAbstractInterface.
Definition at line 371 of file qdbusconnectioninterface.cpp.
|
slot |
Returns true
if the service name serviceName has is currently registered.
Definition at line 217 of file qdbusconnectioninterface.cpp.
|
signal |
|
slot |
Definition at line 196 of file qdbusconnectioninterface.cpp.
|
slot |
Requests to register the service name serviceName on the bus. The qoption flag specifies how the D-Bus server should behave if serviceName is already registered. The roption flag specifies if the server should allow another application to replace our registered name.
If the service registration succeeds, the serviceRegistered() signal will be emitted. If we are placed in queue, the signal will be emitted when we obtain the name. If roption is AllowReplacement, the serviceUnregistered() signal will be emitted if another application replaces this one.
Definition at line 267 of file qdbusconnectioninterface.cpp.
|
slot |
Returns the unique connection name of the primary owner of the name name. If the requested name doesn't have an owner, returns a org.freedesktop.DBus.Error.NameHasNoOwner
error.
Definition at line 185 of file qdbusconnectioninterface.cpp.
|
signal |
Use QDBusServiceWatcher instead.
This signal is emitted by the D-Bus server whenever a service ownership change happens in the bus, including apparition and disparition of names.
This signal means the application oldOwner lost ownership of bus name name to application newOwner. If oldOwner is an empty string, it means the name name has just been created; if newOwner is empty, the name name has no current owner and is no longer available.
|
slot |
Returns the Unix Process ID (PID) for the process currently holding the bus service serviceName.
Definition at line 227 of file qdbusconnectioninterface.cpp.
This signal is emitted by the D-Bus server when the bus service name (unique connection name or well-known service name) given by service is acquired by this application.
Acquisition happens after this application has requested a name using registerService().
|
slot |
Returns the Unix User ID (UID) for the process currently holding the bus service serviceName.
Definition at line 237 of file qdbusconnectioninterface.cpp.
This signal is emitted by the D-Bus server when this application loses ownership of the bus service name given by service.
|
slot |
Requests that the bus start the service given by the name name.
Definition at line 246 of file qdbusconnectioninterface.cpp.
|
slot |
Releases the claim on the bus service name serviceName, that had been previously registered with registerService(). If this application had ownership of the name, it will be released for other applications to claim. If it only had the name queued, it gives up its position in the queue.
Definition at line 329 of file qdbusconnectioninterface.cpp.
|
friend |
Definition at line 64 of file qdbusconnectioninterface.h.
|
read |
holds the activatable service names
Lists all names that can be activated on the bus.
Definition at line 68 of file qdbusconnectioninterface.h.
|
read |
holds the registered service names
Lists all names currently registered on the bus.
Definition at line 68 of file qdbusconnectioninterface.h.