Esempio n. 1
0
bool BaseChannel::registerObject(DBusError *error)
{
    if (isRegistered()) {
        return true;
    }

    QString name = uniqueName();
    QString busName = mPriv->connection->busName();
    //QString busName = QString(QLatin1String("%1.%2"))
    //        .arg(mPriv->connection->busName(),name);
    QString objectPath = QString(QLatin1String("%1/%2"))
                         .arg(mPriv->connection->objectPath(), name);
    debug() << "Registering channel: busName: " << busName << " objectName: " << objectPath;
    DBusError _error;

    debug() << "Channel: registering interfaces  at " << dbusObject();
    foreach(const AbstractChannelInterfacePtr & iface, mPriv->interfaces) {
        if (!iface->registerInterface(dbusObject())) {
            // lets not fail if an optional interface fails registering, lets warn only
            warning() << "Unable to register interface" << iface->interfaceName();
        }
    }

    bool ret = registerObject(busName, objectPath, &_error);
    if (!ret && error) {
        error->set(_error.name(), _error.message());
    }
    return ret;
}
Esempio n. 2
0
/**
 * Emit PropertiesChanged signal on object org.freedesktop.DBus.Properties interface
 * with the property \a propertyName.
 *
 * \param propertyName The name of the changed property.
 * \param propertyValue The actual value of the changed property.
 * \return \c false if the signal can not be emmited or \a true otherwise.
 */
bool AbstractDBusServiceInterface::notifyPropertyChanged(const QString &propertyName, const QVariant &propertyValue)
{
    if (!isRegistered()) {
        return false;
    }

    QDBusMessage signal = QDBusMessage::createSignal(dbusObject()->objectPath(),
                                                     TP_QT_IFACE_PROPERTIES,
                                                     QLatin1String("PropertiesChanged"));
    QVariantMap changedProperties;
    changedProperties.insert(propertyName, propertyValue);

    signal << interfaceName();
    signal << changedProperties;
    signal << QStringList();

    return dbusObject()->dbusConnection().send(signal);
}
void ConnectionContactGroupsInterface::createAdaptor()
{
    (void) new Tp::Service::ConnectionInterfaceContactGroupsAdaptor(dbusObject()->dbusConnection(),
            mAdaptee, dbusObject());
}