swift
|
Custom DBusServer. More...
Public Types | |
enum | ServerMode { SERVERMODE_P2P , SERVERMODE_SESSIONBUS , SERVERMODE_SYSTEMBUS } |
Server mode. | |
Public Member Functions | |
CDBusServer (const QString &address, QObject *parent=nullptr) | |
Construct a server for the core service. | |
CDBusServer (const QString &service, const QString &address, QObject *parent=nullptr) | |
Construct a server for some arbitrary service. | |
virtual | ~CDBusServer () |
Destructor. | |
void | addObject (const QString &name, QObject *object) |
Add a QObject to be exposed via DBus. | |
QDBusError | lastQDBusServerError () const |
Last error. | |
const QDBusServer * | qDBusServer () const |
DBus server (if using P2P) | |
bool | hasQDBusServer () const |
True if using P2P. | |
void | removeAllObjects () |
Remove all objects added with addObject. | |
Static Public Member Functions | |
static const QString & | coreServiceName () |
Default service name. | |
static const QString & | coreServiceName (const QDBusConnection &connection) |
Service name, empty if is P2P connection. | |
static const QStringList & | getLogCategories () |
Log categories. | |
static const QDBusConnection & | defaultConnection () |
Default connection. | |
static const QString & | sessionBusAddress () |
Address denoting a session bus server. | |
static const QString & | systemBusAddress () |
Address denoting a system bus server. | |
static QDBusConnection | connectToDBus (const QString &dbusAddress, const QString &name={}) |
Connect to DBus. | |
static void | disconnectFromDBus (const QDBusConnection &connection, const QString &dBusAddress) |
Disconnect from Bus/Peer to peer. | |
static QString | p2pAddress (const QString &host, const QString &port="") |
Address denoting a P2P server at the given host and port. More... | |
static const QString & | p2pConnectionName () |
P2P connection name. | |
static QString | normalizeAddress (const QString &address) |
Turn something like 127.0.0.1:45000 into "tcp:host=127.0.0.1,port=45000". More... | |
static ServerMode | modeOfAddress (QString address) |
Return the server mode of the given address. | |
static const QString & | modeToString (ServerMode mode) |
Mode to string. | |
static bool | isQtDBusAddress (const QString &address) |
True if a valid Qt DBus address, e.g. "unix:tmpdir=/tmp", "tcp:host=127.0.0.1,port=45000". | |
static bool | isSessionOrSystemAddress (const QString &address) |
True if address is session or system bus address. More... | |
static bool | isP2PAddress (const QString &address) |
False if address is session or system bus address. | |
static bool | isP2PConnection (const QDBusConnection &connection) |
False if address is session or system bus connection. | |
static bool | dBusAddressToHostAndPort (const QString &dbusAddress, QString &o_host, int &o_port) |
Extract host and port from a DBus address. | |
static bool | dBusAddressToHostAndPort (const QString &dbusAddress, QString &o_host, QString &o_port) |
Extract host and port from a DBus address. | |
static bool | isQtDefaultConnection (const QDBusConnection &connection) |
Is the given connection one of the default connections? | |
static bool | isDBusAvailable (const QString &host, int port, int timeoutMs=1500) |
Is there a DBus server running at the given address? More... | |
static bool | isDBusAvailable (const QString &host, int port, QString &message, int timeoutMs=1500) |
Is there a DBus server running at the given address? More... | |
static bool | isDBusAvailable (const QString &dbusAddress, QString &message, int timeoutMs=1500) |
Is there a DBus server running at the given address? More... | |
static bool | isDBusAvailable (const QString &dbusAddress, int timeoutMs=1500) |
Is there a DBus server running at the given address? More... | |
Custom DBusServer.
This class implements a custom DBusServer for DBus peer connections, but can also be used with session or system bus. For session/system bus this class represents no real server, but more a wrapper for QDBusConnection and object registration.
Definition at line 33 of file dbusserver.h.
|
static |
Is there a DBus server running at the given address?
Definition at line 481 of file dbusserver.cpp.
|
static |
Is there a DBus server running at the given address?
Definition at line 456 of file dbusserver.cpp.
|
static |
Is there a DBus server running at the given address?
Definition at line 445 of file dbusserver.cpp.
|
static |
Is there a DBus server running at the given address?
Definition at line 451 of file dbusserver.cpp.
|
static |
True if address is session or system bus address.
Definition at line 178 of file dbusserver.cpp.
|
static |
Turn something like 127.0.0.1:45000 into "tcp:host=127.0.0.1,port=45000".
Definition at line 405 of file dbusserver.cpp.
|
static |
Address denoting a P2P server at the given host and port.
Definition at line 358 of file dbusserver.cpp.