FlightGear next
|
DBus connection. More...
#include <dbusconnection.h>
Inherits flightgear::swift::IDispatchable.
Public Types | |
enum | BusType { SessionBus } |
Bus type. More... | |
using | DisconnectedCallback = std::function<void()> |
Disconnect Callback. | |
Public Member Functions | |
CDBusConnection () | |
Default constructor. | |
CDBusConnection (DBusConnection *connection) | |
Constructor. | |
~CDBusConnection () override | |
Destructor. | |
CDBusConnection (const CDBusConnection &)=delete | |
CDBusConnection & | operator= (const CDBusConnection &)=delete |
bool | connect (BusType type) |
Connect to bus. | |
void | setDispatcher (CDBusDispatcher *dispatcher) |
Set dispatcher. | |
void | requestName (const std::string &name) |
Request name to the bus. | |
bool | isConnected () const |
Is connected? | |
void | registerDisconnectedCallback (CDBusObject *obj, DisconnectedCallback func) |
Register a disconnected callback. | |
void | unregisterDisconnectedCallback (CDBusObject *obj) |
Register a disconnected callback. | |
void | registerObjectPath (CDBusObject *object, const std::string &interfaceName, const std::string &objectPath, const DBusObjectPathVTable &dbusObjectPathVTable) |
Register DBus object with interfaceName and objectPath. | |
void | sendMessage (const CDBusMessage &message) |
Send message to bus. | |
void | close () |
Close connection. | |
CDBusError | lastError () const |
Get the last error. | |
![]() | |
IDispatchable ()=default | |
Default constructor. | |
virtual | ~IDispatchable ()=default |
Default destructor. | |
Protected Member Functions | |
void | dispatch () override |
Dispatch execution method. | |
DBus connection.
Definition at line 25 of file dbusconnection.h.
using flightgear::swift::CDBusConnection::DisconnectedCallback = std::function<void()> |
Disconnect Callback.
Definition at line 32 of file dbusconnection.h.
flightgear::swift::CDBusConnection::CDBusConnection | ( | ) |
Default constructor.
Definition at line 14 of file dbusconnection.cpp.
|
explicit |
Constructor.
Definition at line 19 of file dbusconnection.cpp.
|
override |
Destructor.
Definition at line 28 of file dbusconnection.cpp.
|
delete |
void flightgear::swift::CDBusConnection::close | ( | ) |
Close connection.
Definition at line 119 of file dbusconnection.cpp.
bool flightgear::swift::CDBusConnection::connect | ( | BusType | type | ) |
Connect to bus.
Definition at line 35 of file dbusconnection.cpp.
|
overrideprotectedvirtual |
Dispatch execution method.
Implements flightgear::swift::IDispatchable.
Definition at line 124 of file dbusconnection.cpp.
bool flightgear::swift::CDBusConnection::isConnected | ( | ) | const |
Is connected?
Definition at line 87 of file dbusconnection.cpp.
|
inline |
Get the last error.
Definition at line 80 of file dbusconnection.h.
|
delete |
void flightgear::swift::CDBusConnection::registerDisconnectedCallback | ( | CDBusObject * | obj, |
DisconnectedCallback | func ) |
Register a disconnected callback.
Definition at line 92 of file dbusconnection.cpp.
void flightgear::swift::CDBusConnection::registerObjectPath | ( | CDBusObject * | object, |
const std::string & | interfaceName, | ||
const std::string & | objectPath, | ||
const DBusObjectPathVTable & | dbusObjectPathVTable ) |
Register DBus object with interfaceName and objectPath.
object | |
interfaceName | |
objectPath | |
dbusObjectPathVTable | Virtual table handling DBus messages |
Definition at line 104 of file dbusconnection.cpp.
void flightgear::swift::CDBusConnection::requestName | ( | const std::string & | name | ) |
Request name to the bus.
Definition at line 80 of file dbusconnection.cpp.
void flightgear::swift::CDBusConnection::sendMessage | ( | const CDBusMessage & | message | ) |
Send message to bus.
Definition at line 112 of file dbusconnection.cpp.
void flightgear::swift::CDBusConnection::setDispatcher | ( | CDBusDispatcher * | dispatcher | ) |
Set dispatcher.
Definition at line 57 of file dbusconnection.cpp.
void flightgear::swift::CDBusConnection::unregisterDisconnectedCallback | ( | CDBusObject * | obj | ) |
Register a disconnected callback.
Definition at line 97 of file dbusconnection.cpp.