FlightGear next
flightgear::swift::CDBusObject Class Referenceabstract

DBus base object. More...

#include <dbusobject.h>

Inherited by flightgear::swift::CService, and flightgear::swift::CTraffic.

Public Member Functions

 CDBusObject ()=default
 Constructor.
 
virtual ~CDBusObject ()
 Destructor.
 
void setDBusConnection (const std::shared_ptr< CDBusConnection > &dbusConnection)
 Set the assigned DBus connection.
 
void registerDBusObjectPath (const std::string &interfaceName, const std::string &objectPath)
 Register itself with interfaceName and objectPath.
 

Protected Member Functions

virtual void dbusConnectedHandler ()
 Handler which is called when DBusCconnection is established.
 
virtual DBusHandlerResult dbusMessageHandler (const CDBusMessage &message)=0
 DBus message handler.
 
virtual void dbusDisconnectedHandler ()
 Handler which is called when DBusConnection disconnected.
 
void sendDBusSignal (const std::string &name)
 Send DBus signal.
 
void sendDBusMessage (const CDBusMessage &message)
 Send DBus message.
 
void maybeSendEmptyDBusReply (bool wantsReply, const std::string &destination, dbus_uint32_t serial)
 Maybe sends an empty DBus reply (acknowledgement)
 
template<typename T>
void sendDBusReply (const std::string &destination, dbus_uint32_t serial, const T &argument)
 Send DBus reply.
 
template<typename T>
void sendDBusReply (const std::string &destination, dbus_uint32_t serial, const std::vector< T > &array)
 Send DBus reply.
 
void queueDBusCall (const std::function< void()> &func)
 Queue a DBus call to be executed in a different thread.
 
void invokeQueuedDBusCalls ()
 Invoke all pending DBus calls. They will be executed in the calling thread.
 

Detailed Description

DBus base object.

Definition at line 15 of file dbusobject.h.

Constructor & Destructor Documentation

◆ CDBusObject()

flightgear::swift::CDBusObject::CDBusObject ( )
default

Constructor.

◆ ~CDBusObject()

flightgear::swift::CDBusObject::~CDBusObject ( )
virtual

Destructor.

Definition at line 14 of file dbusobject.cpp.

Member Function Documentation

◆ dbusConnectedHandler()

virtual void flightgear::swift::CDBusObject::dbusConnectedHandler ( )
inlineprotectedvirtual

Handler which is called when DBusCconnection is established.

Definition at line 34 of file dbusobject.h.

◆ dbusDisconnectedHandler()

virtual void flightgear::swift::CDBusObject::dbusDisconnectedHandler ( )
inlineprotectedvirtual

Handler which is called when DBusConnection disconnected.

Reimplemented in flightgear::swift::CTraffic.

Definition at line 40 of file dbusobject.h.

◆ dbusMessageHandler()

virtual DBusHandlerResult flightgear::swift::CDBusObject::dbusMessageHandler ( const CDBusMessage & message)
protectedpure virtual

DBus message handler.

Implemented in flightgear::swift::CService, and flightgear::swift::CTraffic.

◆ invokeQueuedDBusCalls()

void flightgear::swift::CDBusObject::invokeQueuedDBusCalls ( )
protected

Invoke all pending DBus calls. They will be executed in the calling thread.

Definition at line 62 of file dbusobject.cpp.

◆ maybeSendEmptyDBusReply()

void flightgear::swift::CDBusObject::maybeSendEmptyDBusReply ( bool wantsReply,
const std::string & destination,
dbus_uint32_t serial )
protected

Maybe sends an empty DBus reply (acknowledgement)

Definition at line 48 of file dbusobject.cpp.

◆ queueDBusCall()

void flightgear::swift::CDBusObject::queueDBusCall ( const std::function< void()> & func)
protected

Queue a DBus call to be executed in a different thread.

Definition at line 56 of file dbusobject.cpp.

◆ registerDBusObjectPath()

void flightgear::swift::CDBusObject::registerDBusObjectPath ( const std::string & interfaceName,
const std::string & objectPath )

Register itself with interfaceName and objectPath.

Warning
Before calling this method, make sure that a valid DBus connection was set.

Definition at line 27 of file dbusobject.cpp.

◆ sendDBusMessage()

void flightgear::swift::CDBusObject::sendDBusMessage ( const CDBusMessage & message)
protected

Send DBus message.

Definition at line 42 of file dbusobject.cpp.

◆ sendDBusReply() [1/2]

template<typename T>
void flightgear::swift::CDBusObject::sendDBusReply ( const std::string & destination,
dbus_uint32_t serial,
const std::vector< T > & array )
inlineprotected

Send DBus reply.

Definition at line 63 of file dbusobject.h.

◆ sendDBusReply() [2/2]

template<typename T>
void flightgear::swift::CDBusObject::sendDBusReply ( const std::string & destination,
dbus_uint32_t serial,
const T & argument )
inlineprotected

Send DBus reply.

Definition at line 53 of file dbusobject.h.

◆ sendDBusSignal()

void flightgear::swift::CDBusObject::sendDBusSignal ( const std::string & name)
protected

Send DBus signal.

Definition at line 35 of file dbusobject.cpp.

◆ setDBusConnection()

void flightgear::swift::CDBusObject::setDBusConnection ( const std::shared_ptr< CDBusConnection > & dbusConnection)

Set the assigned DBus connection.

Remarks
Currently one object can only manage one connection at a time

Definition at line 19 of file dbusobject.cpp.


The documentation for this class was generated from the following files: