DBus-1-TQt  1.0
TQT_DBusObjectBase Class Referenceabstract

#include <tqdbusobject.h>

+ Collaboration diagram for TQT_DBusObjectBase:

Public Member Functions

virtual ~TQT_DBusObjectBase ()
 

Protected Member Functions

virtual bool handleMethodCall (const TQT_DBusMessage &message)=0
 
bool delegateMethodCall (const TQT_DBusMessage &message, TQT_DBusObjectBase *delegate)
 

Friends

class TQT_DBusConnectionPrivate
 

Detailed Description

Base interface for D-Bus service objects.

In order to register a service object with the TQT_DBusConnection it needs to implement the interface specified by this class.

The connection will forward all method calls that have a path equivalent to the path the service object was registered with to the object's handleMethodCall() method. See TQT_DBusConnection::registerObject()

If for some reason, e.g. the call is not meant for this interface, or the method is unknown, the implementation can just return false and the connection will handle the rest.

See section Providing services over D-Bus for documentation on how to use TQT_DBusObjectBase

Definition at line 302 of file tqdbusobject.h.

Constructor & Destructor Documentation

◆ ~TQT_DBusObjectBase()

virtual TQT_DBusObjectBase::~TQT_DBusObjectBase ( )
inlinevirtual

Destroys the object.

Definition at line 309 of file tqdbusobject.h.

309 {}

Member Function Documentation

◆ delegateMethodCall()

bool TQT_DBusObjectBase::delegateMethodCall ( const TQT_DBusMessage message,
TQT_DBusObjectBase delegate 
)
inlineprotected

Delegate a method call to another object.

When a service object is built as a collection of separated interface class instances, i.e. each interface of the object is implemented in its own TQT_DBusObjectBase subclass and the main object just wanst to pass on the method calls to the respective interface implementations, it can do so by calling this base class method.

Since it is a method of the base class, it can call the otherwise protected handleMethodCall() of the interface implementor.

See Service interfaces for an example.

Parameters
messagethe method call to delegate
delegatethe object which should handle the call instead
Returns
true if the message can be handled independent if handling resulted in an error. In this case implementations should an error reply. Returns false only if interface or method are unknown

Definition at line 365 of file tqdbusobject.h.

References handleMethodCall().

366  {
367  return delegate->handleMethodCall(message);
368  }
virtual bool handleMethodCall(const TQT_DBusMessage &message)=0
Method call entry point.
+ Here is the call graph for this function:

◆ handleMethodCall()

virtual bool TQT_DBusObjectBase::handleMethodCall ( const TQT_DBusMessage message)
protectedpure virtual

Method call entry point.

This method has to be implemented to handle method calls sent to the service object. An object implementation can handle all its interfaces in one class or again forward the method call to interface implementators.

If for some reason, e.g. the call is not meant for this interface, or the method is unknown, the implementation can just return false and the connection will handle the rest.

If an error occurs during the method call, e.g. the number of parameters or their types are not what would be expected, the service object should reply with a TQT_DBusMessage of type TQT_DBusMessage::ErrorMessage which in turn should include the D-Bus error describing the problem. See TQT_DBusConnection::send() for sending reply messages.

See TQT_DBusMessage::methodError() and TQT_DBusMessage::methodReply() on how to create suitable reply messages for the given method call.

Parameters
messagethe method call to handle
Returns
true if the message can be handled independent if handling resulted in an error. In this case implementations should an error reply. Returns false only if interface or method are unknown
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ TQT_DBusConnectionPrivate

friend class TQT_DBusConnectionPrivate
friend

Definition at line 304 of file tqdbusobject.h.


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