Asynchronous Object Model

| Home · All Classes · All Namespaces · Modules · Functions · Files

Asynchronous Object Model

# Overview

Telepathy-Qt uses D-Bus to communicate with applications implementing the Telepathy specification.

When dealing with D-Bus, method calls can take some time to return, and in this case is not desirable to make synchronous calls, which could turn into applications hanging waiting for method returns. In order to avoid this issue, all Telepathy-Qt high-level methods requiring D-Bus method calls will return a Tp::PendingOperation which will emit the signal Tp::PendingOperation::finished() when the operation has ended. See individual methods' documentation for more details.

Additionally Telepathy-Qt introduces a concept in which object features need to be enabled before usage. Information corresponding to enabled features can be inspected synchronously with no need for asynchronous D-Bus method calls and the associated programming complexity.

To avoid the complexity of doing asynchronous calls when making object features ready Telepathy-Qt also provides so called factories for the main objects. These object features can be enabled by constructing a corresponding factory and enabling the desired features, and passing these factories to the objects responsible for creating the objects whose features are required. Doing that, applications are guaranteed that the specified features are ready in objects signaled to them by the library.

However, if a particular feature is only ever used in a specific circumstance, such as an user opening some settings dialog separate from the general view of the application, features can be later enabled as needed by calling becomeReady(), or in the Tp::Contact case by calling Tp::ContactManager::upgradeContacts(), with the additional features on the object, and waiting for the resulting PendingOperation to finish.