sdbus-c++ 1.1.0
High-level C++ D-Bus library based on systemd D-Bus implementation
|
#include <IConnection.h>
Classes | |
struct | PollData |
Public Member Functions | |
virtual void | requestName (const std::string &name)=0 |
Requests D-Bus name on the connection. More... | |
virtual void | releaseName (const std::string &name)=0 |
Releases D-Bus name on the connection. More... | |
virtual std::string | getUniqueName () const =0 |
Retrieve the unique name of a connection. E.g. ":1.xx". More... | |
virtual void | enterEventLoop ()=0 |
Enters I/O event loop on this bus connection. More... | |
virtual void | enterEventLoopAsync ()=0 |
Enters I/O event loop on this bus connection in a separate thread. More... | |
virtual void | leaveEventLoop ()=0 |
Leaves the I/O event loop running on this bus connection. More... | |
virtual void | addObjectManager (const std::string &objectPath)=0 |
Adds an ObjectManager at the specified D-Bus object path. More... | |
virtual PollData | getEventLoopPollData () const =0 |
Returns fd, I/O events and timeout data you can pass to poll. More... | |
virtual bool | processPendingRequest ()=0 |
Process a pending request. More... | |
virtual void | setMethodCallTimeout (uint64_t timeout)=0 |
Sets general method call timeout. More... | |
template<typename _Rep , typename _Period > | |
void | setMethodCallTimeout (const std::chrono::duration< _Rep, _Period > &timeout) |
Sets general method call timeout. More... | |
virtual uint64_t | getMethodCallTimeout () const =0 |
Gets general method call timeout. More... | |
void | enterProcessingLoop () |
Enters I/O event loop on this bus connection. More... | |
void | enterProcessingLoopAsync () |
void | leaveProcessingLoop () |
PollData | getProcessLoopPollData () const |
An interface to D-Bus bus connection. Incorporates implementation of both synchronous and asynchronous D-Bus I/O event loop.
All methods throw sdbus::Error in case of failure. All methods in this class are thread-aware, but not thread-safe.
|
pure virtual |
Adds an ObjectManager at the specified D-Bus object path.
Creates an ObjectManager interface at the specified object path on the connection. This is a convenient way to interrogate a connection to see what objects it has.
sdbus::Error | in case of failure |
|
pure virtual |
Enters I/O event loop on this bus connection.
The incoming D-Bus messages are processed in the loop. The method blocks indefinitely, until unblocked through leaveEventLoop().
sdbus::Error | in case of failure |
|
pure virtual |
Enters I/O event loop on this bus connection in a separate thread.
The same as enterEventLoop, except that it doesn't block because it runs the loop in a separate, internally managed thread.
|
inline |
Enters I/O event loop on this bus connection.
The incoming D-Bus messages are processed in the loop. The method blocks indefinitely, until unblocked through leaveEventLoop().
sdbus::Error | in case of failure |
|
inline |
|
pure virtual |
Returns fd, I/O events and timeout data you can pass to poll.
To integrate sdbus with your app's own custom event handling system (without the requirement of an extra thread), you can use this method to query which file descriptors, poll events and timeouts you should add to your app's poll call in your main event loop. If these file descriptors signal, then you should call processPendingRequest to process the event. This means that all of sdbus's callbacks will arrive on your app's main event thread (opposed to on a thread created by sdbus-c++). If you are unsure what this all means then use enterEventLoop() or enterEventLoopAsync() instead.
To integrate sdbus-c++ into a gtk app, pass the file descriptor returned by this method to g_main_context_add_poll.
sdbus::Error | in case of failure |
|
pure virtual |
Gets general method call timeout.
Supported by libsystemd>=v240.
sdbus::Error | in case of failure |
|
inline |
|
pure virtual |
Retrieve the unique name of a connection. E.g. ":1.xx".
sdbus::Error | in case of failure |
|
pure virtual |
Leaves the I/O event loop running on this bus connection.
This causes the loop to exit and frees the thread serving the loop
sdbus::Error | in case of failure |
|
inline |
|
pure virtual |
Process a pending request.
Processes a single dbus event. All of sdbus-c++'s callbacks will be called from within this method. This method should ONLY be used in conjuction with getEventLoopPollData(). This method returns true if an I/O message was processed. This you can try to call this method again before going to poll on I/O events. The method returns false if no operations were pending, and the caller should then poll for I/O events before calling this method again. enterEventLoop() and enterEventLoopAsync() will call this method for you, so there is no need to call it when using these. If you are unsure what this all means then don't use this method.
sdbus::Error | in case of failure |
|
pure virtual |
Releases D-Bus name on the connection.
[in] | name | Name to release |
sdbus::Error | in case of failure |
|
pure virtual |
Requests D-Bus name on the connection.
[in] | name | Name to request |
sdbus::Error | in case of failure |
|
inline |
Sets general method call timeout.
[in] | timeout | Timeout value in microseconds |
General method call timeout is used for all method calls upon this connection. Method call-specific timeout overrides this general setting.
Supported by libsystemd>=v240.
sdbus::Error | in case of failure |
|
pure virtual |
Sets general method call timeout.
[in] | timeout | Timeout value in microseconds |
General method call timeout is used for all method calls upon this connection. Method call-specific timeout overrides this general setting.
Supported by libsystemd>=v240.
sdbus::Error | in case of failure |