예제 #1
0
void QBluetoothDeviceDiscoveryAgentPrivate::_q_propertyChanged(const QString &name,
                                                               const QDBusVariant &value)
{    
#ifdef QTM_DEVICEDISCOVERY_DEBUG
    qDebug() << Q_FUNC_INFO << name << value.variant();
#endif

    if (name == QLatin1String("Discovering") && !value.variant().toBool()) {
        Q_Q(QBluetoothDeviceDiscoveryAgent);
        adapter->deleteLater();
        adapter = 0;
        if(pendingCancel && !pendingStart){
            emit q->canceled();
            pendingCancel = false;
        }
        else if(pendingStart){
            pendingStart = false;
            pendingCancel = false;
            start();
        }
        else {
            emit q->finished();
        }
    }
}
예제 #2
0
void BluetoothDevice::propertyChanged(QString name,QDBusVariant value)
{
    qDebug()<<"BluetoothDevice::propertyChanged()";

    if(name == "Connected")
    {
	    emit connectedChanged(value.variant().toBool());
    }

    if(name == "UUIDs")
    {
	    emit profilesChanged(value.variant().toStringList());
		setupProfiles();
    }

    if(name == "Trusted")
    {
        emit trustedChanged(value.variant().toBool());
    }

    if(name == "Paired")
    {
        emit pairedChanged();
    }

    emit propertyChanged(name,value.variant());

    ///TODO: create individual signals for each property... maybe
}
예제 #3
0
void NetworkService::propertyChanged(const QString &name, const QDBusVariant &value)
{
    qDebug() << "NetworkService: property " << name << " changed to " << value.variant();
    m_propertiesCache[name] = value.variant();

    if (name == Name) {
        emit nameChanged(m_propertiesCache[name].toString());
    } else if (name == State) {
        emit stateChanged(m_propertiesCache[name].toString());
    } else if (name == Security) {
        emit securityChanged(m_propertiesCache[name].toStringList());
    } else if (name == Strength) {
        emit strengthChanged(m_propertiesCache[name].toUInt());
    } else if (name == Favorite) {
        emit favoriteChanged(m_propertiesCache[name].toBool());
    } else if (name == IPv4) {
        emit ipv4Changed(qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv4)));
    } else if (name == IPv4Config) {
        emit ipv4ConfigChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv4Config)));
    } else if (name == Nameservers) {
        emit nameserversChanged(m_propertiesCache[name].toStringList());
    } else if (name == NameserversConfig) {
        emit nameserversConfigChanged(m_propertiesCache[name].toStringList());
    } else if (name == Domains) {
        emit domainsChanged(m_propertiesCache[name].toStringList());
    } else if (name == DomainsConfig) {
        emit domainsConfigChanged(m_propertiesCache[name].toStringList());
    } else if (name == Proxy) {
        emit proxyChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(Proxy)));
    } else if (name == ProxyConfig) {
        emit proxyConfigChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(ProxyConfig)));
    }
}
예제 #4
0
void BluetoothDevice::inputPropertiesChanged(QString name, QDBusVariant value)
{
    qDebug()<<"Input properties changed: "<<name<<" "<<value.variant();
    if(name == "Connected")
    {
        emit inputConnectedChanged(value.variant().toBool());
    }
}
예제 #5
0
// Convert a QDBusArgument variant type to a Python object.
static PyObject *from_variant_type(const QDBusArgument &arg)
{
    QDBusVariant dbv;

    arg >> dbv;

    return from_qvariant(dbv.variant());
}
예제 #6
0
 void emitSignal(const QString& interface, const QString& name, const QDBusVariant& parameter)
 {
     if (interface.endsWith('2'))
         obj->if2->emitSignal(name, parameter.variant());
     else if (interface.endsWith('3'))
         obj->if3->emitSignal(name, parameter.variant());
     else if (interface.endsWith('4'))
         obj->if4->emitSignal(name, parameter.variant());
     else
         obj->emitSignal(name, parameter.variant());
 }
예제 #7
0
Qt::SortOrder DBusInterface::getPropertySortOrder(
                                            const QString& session_handle,
                                            const QString& propertyName)
{
  QDBusVariant dbusVariant;
  dbusVariant = this->getProperty(session_handle, propertyName).value();
  QString order = dbusVariant.variant().toString();
  if (order.compare("ascending") == 0)
    return Qt::AscendingOrder;

  return Qt::DescendingOrder;
}
예제 #8
0
void NetworkService::serviceChanged(const QString &name, const QDBusVariant &v) {
	if (name == "State") {
		QString value = v.variant().toString();
		if (value == "ready") {
			emit connected();
        	} else if (value == "failure" || value == "idle") {
			emit error();
        	}
	} else if (name == "Strength") {
		int value = v.variant().toInt();
		qDebug() << "Strength changed to " << value << ". Emiting strenthChanged signal";
		emit strengthChanged(value);
	}
}
예제 #9
0
void ProximitySocket::ofonoPropertyChanged(const QString &key, const QDBusVariant &value)
{
    if (key == "State") {
        qDebug() << "call state:" << value.variant().toString();
        _callActive = value.variant().toString() != "disconnected";
        if (!_callActive) {
            setLoudspeaker(false);
        }
        else if (!_proxClose) {
            setLoudspeaker(true);
        }
        Q_EMIT callActive(_callActive);
    }
}
예제 #10
0
QVariant Properties::Get(const QString &name) {
    QVariantList args;
    args.append(mInterface);
    args.append(name);

    QDBusMessage reply = call("Get", args);
    qDebug() << reply;

    if(reply.type() == QDBusMessage::ReplyMessage) {
        QVariant container = reply.arguments().at(0);
        QDBusVariant wrapper = container.value<QDBusVariant>();

        return wrapper.variant();
    }
    return QVariant("Invalid");
}
예제 #11
0
inline bool QDBusMarshaller::append(const QDBusVariant &arg)
{
    if (ba) {
        *ba += DBUS_TYPE_VARIANT_AS_STRING;
        return true;
    }

    const QVariant &value = arg.variant();
    QVariant::Type id = QVariant::Type(value.userType());
    if (id == QVariant::Invalid) {
        qWarning("QDBusMarshaller: cannot add a null QDBusVariant");
        error();
        return false;
    }

    const char *signature = QDBusMetaType::typeToSignature(id);
    if (!signature) {
        qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
                 "Use qDBusRegisterMetaType to register it",
                 QVariant::typeToName( id ), id);
        error();
        return false;
    }

    QDBusMarshaller sub;
    open(sub, DBUS_TYPE_VARIANT, signature);
    bool isOk = sub.appendVariantInternal(value);
    // don't call sub.close(): it auto-closes

    return isOk;
}
예제 #12
0
void BluetoothDevice::audioPropertiesChanged(QString name,QDBusVariant value)
{
    ///don't think i need to be doing this:
    //emit propertyChanged(name, value.variant());

    if(name == "State")
    {
        emit audioConnectedChanged(value.variant().toString() == "connected");
    }
}
예제 #13
0
void TransportTracker::onBtStateChanged(QString aKey, QDBusVariant aValue)
{
    FUNCTION_CALL_TRACE;

    if (aKey == "Powered")
    {
        bool btPowered = aValue.variant().toBool();
        LOG_DEBUG("BT power state " << btPowered);
        updateState(Sync::CONNECTIVITY_BT, btPowered);
    }
}
예제 #14
0
void Service::propertyChanged(const QString &name, const QDBusVariant &value)
{
    qDebug() << "Service PropertyChanged" << name;

    m_properties[name] = value.variant();

    if (name == "State")
        emit stateChanged();

    emit propertiesChanged();
}
예제 #15
0
void QOfonoCallMeter::propertyChanged(const QString& property, const QDBusVariant& dbusvalue)
{
    QVariant value = dbusvalue.variant();
    d_ptr->properties.insert(property,value);

    if (property == QLatin1String("AccumulatedCallMeterMaximum")) {
        Q_EMIT accumulatedCallMeterMaximumChanged(value.value<quint32>());
    } else if (property == QLatin1String("PricePerUnit")) {
        Q_EMIT pricePerUnitChanged(value.value<qreal>());
    }
}
예제 #16
0
int main()
{
    QDBusMessage myDBusMessage;

//! [0]
    QList<QVariant> arguments;
    arguments << QVariant(42) << QVariant::fromValue(QDBusVariant(43)) << QVariant("hello");
    myDBusMessage.setArguments(arguments);
//! [0]

//! [1]
    // call a D-Bus function that returns a D-Bus variant
    QVariant v = callMyDBusFunction();
    // retrieve the D-Bus variant
    QDBusVariant dbusVariant = qvariant_cast<QDBusVariant>(v);
    // retrieve the actual value stored in the D-Bus variant
    QVariant result = dbusVariant.variant();
//! [1]

    return 0;
}
예제 #17
0
void QOfonoMessageManager::propertyChanged(const QString& property, const QDBusVariant& dbusvalue)
{
    QVariant value = dbusvalue.variant();
    d_ptr->properties.insert(property,value);

    if (property == QLatin1String("ServiceCenterAddress")) {
        Q_EMIT serviceCenterAddressChanged(value.value<QString>());
    } else if (property == QLatin1String("UseDeliveryReports")) {
        Q_EMIT useDeliveryReportsChanged(value.value<bool>());
    } else if (property == QLatin1String("Bearer")) {
        Q_EMIT bearerChanged(value.value<QString>());
    } else if (property == QLatin1String("AlphabetChanged")) {
        Q_EMIT alphabetChanged(value.value<QString>());
    }
}
예제 #18
0
void QLlcpSocketPrivate::Socket(const QDBusVariant &lsap, int fd, const QVariantMap &properties)
{
    m_fd = fd;
    m_port = lsap.variant().toUInt();

    m_readNotifier = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
    connect(m_readNotifier, SIGNAL(activated(int)), this, SLOT(_q_readNotify()));
    m_writeNotifier = new QSocketNotifier(m_fd, QSocketNotifier::Write, this);
    connect(m_writeNotifier, SIGNAL(activated(int)), this, SLOT(_q_bytesWritten()));

    m_properties = properties;

    Q_Q(QLlcpSocket);

    m_state = QLlcpSocket::BoundState;
    emit q->stateChanged(m_state);
}
예제 #19
0
void NetworkService::propertyChanged(const QString &name, const QDBusVariant &value)
{
    QVariant tmp = value.variant();

    Q_ASSERT(m_service);

    pr_dbg() << m_service->path() << "property" << name << "changed from"
             << m_propertiesCache[name].toString() << "to" << tmp.toString();

    m_propertiesCache[name] = tmp;

    if (name == Name) {
        emit nameChanged(tmp.toString());
    } else if (name == State) {
        emit stateChanged(tmp.toString());
    } else if (name == Security) {
        emit securityChanged(tmp.toStringList());
    } else if (name == Strength) {
        emit strengthChanged(tmp.toUInt());
    } else if (name == Favorite) {
        emit favoriteChanged(tmp.toBool());
    } else if (name == IPv4) {
        emit ipv4Changed(qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv4)));
    } else if (name == IPv4Config) {
        emit ipv4ConfigChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv4Config)));
    } else if (name == IPv6) {
        emit ipv6Changed(qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv6)));
    } else if (name == IPv6Config) {
        emit ipv6ConfigChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(IPv6Config)));
    } else if (name == Nameservers) {
        emit nameserversChanged(tmp.toStringList());
    } else if (name == NameserversConfig) {
        emit nameserversConfigChanged(tmp.toStringList());
    } else if (name == Domains) {
        emit domainsChanged(tmp.toStringList());
    } else if (name == DomainsConfig) {
        emit domainsConfigChanged(tmp.toStringList());
    } else if (name == Proxy) {
        emit proxyChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(Proxy)));
    } else if (name == ProxyConfig) {
        emit proxyConfigChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(ProxyConfig)));
    } else if (name == Ethernet) {
        emit ethernetChanged(qdbus_cast<QVariantMap>(m_propertiesCache.value(Ethernet)));
    }
}
예제 #20
0
inline bool QDBusMarshaller::append(const QDBusVariant &arg)
{
    if (ba) {
        if (!skipSignature)
            *ba += DBUS_TYPE_VARIANT_AS_STRING;
        return true;
    }

    const QVariant &value = arg.variant();
    int id = value.userType();
    if (id == QVariant::Invalid) {
        qWarning("QDBusMarshaller: cannot add a null QDBusVariant");
        error(QLatin1String("Variant containing QVariant::Invalid passed in arguments"));
        return false;
    }

    QByteArray tmpSignature;
    const char *signature = 0;
    if (id == QDBusMetaTypeId::argument()) {
        // take the signature from the QDBusArgument object we're marshalling
        tmpSignature =
            qvariant_cast<QDBusArgument>(value).currentSignature().toLatin1();
        signature = tmpSignature.constData();
    } else {
        // take the signatuer from the metatype we're marshalling
        signature = QDBusMetaType::typeToSignature(id);
    }
    if (!signature) {
        qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
                 "Use qDBusRegisterMetaType to register it",
                 QMetaType::typeName(id), id);
        error(QString::fromLatin1("Unregistered type %1 passed in arguments")
              .arg(QLatin1String(QMetaType::typeName(id))));
        return false;
    }

    QDBusMarshaller sub(capabilities);
    open(sub, DBUS_TYPE_VARIANT, signature);
    bool isOk = sub.appendVariantInternal(value);
    // don't call sub.close(): it auto-closes

    return isOk;
}
예제 #21
0
void QOfonoNetworkOperator::propertyChanged(const QString &property, const QDBusVariant &dbusvalue)
{
    QVariant value = dbusvalue.variant();
    d_ptr->properties.insert(property,value);

    if (property == QLatin1String("Name")) {
        Q_EMIT nameChanged(value.value<QString>());
    } else if (property == QLatin1String("Status")) {
        Q_EMIT statusChanged(value.value<QString>());
    } else if (property == QLatin1String("MobileCountryCode")) {
        Q_EMIT mccChanged(value.value<QString>());
    } else if (property == QLatin1String("MobileNetworkCode")) {
        Q_EMIT mncChanged(value.value<QString>());
    } else if (property == QLatin1String("Technologies")) {
        Q_EMIT technologiesChanged(value.value<QStringList>());
    } else if (property == QLatin1String("AdditionalInformation")) {
        Q_EMIT additionalInfoChanged(value.value<QString>());
    }
}
예제 #22
0
void QOfonoCallForwarding::propertyChanged(const QString& property, const QDBusVariant& dbusvalue)
{
    QVariant value = dbusvalue.variant();
    d_ptr->properties.insert(property,value);

    if (property == QLatin1String("VoiceUnconditional")) {
        Q_EMIT voiceUnconditionalChanged(value.value<QString>());
    } else if (property == QLatin1String("VoiceBusy")) {
        Q_EMIT voiceBusyChanged(value.value<QString>());
    } else if (property == QLatin1String("VoiceNoReply")) {
        Q_EMIT voiceNoReplyChanged(value.value<QString>());
    } else if (property == QLatin1String("VoiceNoReplyTimeout")) {
        Q_EMIT voiceNoReplyTimeoutChanged(value.value<quint16>());
    } else if (property == QLatin1String("VoiceNotReachable")) {
        Q_EMIT voiceNotReachableChanged(value.value<QString>());
    } else if (property == QLatin1String("ForwardingFlagOnSim")) {
        Q_EMIT forwardingFlagOnSimChanged(value.value<bool>());
    }
}
예제 #23
0
void QOfonoVoiceCall::propertyChanged(const QString& property, const QDBusVariant& dbusvalue)
{
    QVariant value = dbusvalue.variant();
    d_ptr->properties.insert(property,value);

    if (property == QLatin1String("LineIdentification")) {
        Q_EMIT lineIdentificationChanged(value.value<QString>());

    } else if (property == QLatin1String("DisconnectReason")) {
        Q_EMIT disconnectReason(value.value<QString>());


    } else if (property == QLatin1String("Name")) {
        Q_EMIT nameChanged(value.value<QString>());

    } else if (property == QLatin1String("State")) {
        Q_EMIT stateChanged(value.value<QString>());

    } else if (property == QLatin1String("StartTime")) {
        Q_EMIT startTimeChanged(value.value<QString>());

    } else if (property == QLatin1String("Information")) {
        Q_EMIT informationChanged(value.value<QString>());

    } else if (property == QLatin1String("IncomingLine")) {
        Q_EMIT incomingLineChanged(value.value<QString>());

    } else if (property == QLatin1String("Multiparty")) {
        Q_EMIT multipartyChanged(value.value<bool>());

    } else if (property == QLatin1String("Icon")) {
        Q_EMIT iconChanged(value.value<quint8>());

    } else if (property == QLatin1String("Emergency")) {
        Q_EMIT emergencyChanged(value.value<bool>());

    } else if (property == QLatin1String("RemoteHeld")) {
        Q_EMIT remoteHeldChanged(value.value<bool>());

    } else if (property == QLatin1String("RemoteMultiparty")) {
        Q_EMIT remoteMultipartyChanged(value.value<bool>());
    }
}
예제 #24
0
void TemplatesPlugin::createActivity(const QDBusVariant &_values)
{
    using namespace kamd::utils;

    QVariantHash values = _values.variant().toHash();

    auto takeStringValue = [&values] (const QString &key) {
        auto result = values[key].toString();
        values.remove(key);
        return result;
    };

    const QString name        = takeStringValue("activity.name");
    const QString description = takeStringValue("activity.description");
    const QString icon        = takeStringValue("activity.icon");

    // Creating the activity, and getting the id
    const QString id = Plugin::retrieve<QString>(
        m_activities, "AddActivity", "QString",
        Q_ARG(QString, name));

    // Saving the provided data to the configuration file
    KConfigGroup pluginConfig(config());
    KConfigGroup activityConfig(&pluginConfig, id);

    for_each_assoc(values, [&activityConfig] (const QString &key, const QVariant &value) {
        activityConfig.writeEntry(key, value);
    });

    activityConfig.sync();

    // Changing the icon and description of the activity
    Plugin::invoke<Qt::DirectConnection>(
        m_activities, "SetActivityDescription",
        Q_ARG(QString, id),
        Q_ARG(QString, description));
    Plugin::invoke<Qt::DirectConnection>(
        m_activities, "SetActivityIcon",
        Q_ARG(QString, id),
        Q_ARG(QString, icon));

}
예제 #25
0
void TemplatesPlugin::setFeatureValue(const QStringList &property,
        const QDBusVariant &value)
{
    Q_UNUSED(property);
    Q_UNUSED(value);

    // TODO: Remove. For testing purposes only
    if (property.size() == 1 && property[0] == "createActivity") {
        QVariantHash info {
            { "activity.name", value.variant().toString() },
            { "activity.description", "Nothing special" },
            { "activity.wallpaper", "stripes.png" },
            { "activity.icon", "kate" },
            { "activity.cloneFrom", "id" },
            { "activity.linkedResources", QStringList { "a", "b", "c" } }
        };
        createActivity(QDBusVariant(info));

    }
}
예제 #26
0
void NetworkTechnology::propertyChanged(const QString &name, const QDBusVariant &value)
{
    QVariant tmp = value.variant();

    Q_ASSERT(m_technology);

    m_propertiesCache[name] = tmp;
    if (name == Powered) {
        emit poweredChanged(tmp.toBool());
    } else if (name == Connected) {
        emit connectedChanged(tmp.toBool());
    } else if (name == IdleTimeout) {
      emit idleTimeoutChanged(tmp.toUInt());
    } else if (name == Tethering) {
      emit tetheringChanged(tmp.toBool());
    } else if (name == TetheringIdentifier) {
      emit tetheringIdChanged(tmp.toString());
    } else if (name == TetheringPassphrase) {
      emit tetheringPassphraseChanged(tmp.toString());
    }
}
예제 #27
0
void QOfonoCallSettings::propertyChanged(const QString& property, const QDBusVariant& dbusvalue)
{
    QVariant value = dbusvalue.variant();
    d_ptr->properties.insert(property,value);

    if (property == QLatin1String("CallingLinePresentation")) {
        Q_EMIT callingLinePresentationChanged(value.value<QString>());
    } else if (property == QLatin1String("CalledLinePresentation")) {
        Q_EMIT calledLinePresentationChanged(value.value<QString>());
    } else if (property == QLatin1String("CallingNamePresentation")) {
        Q_EMIT callingNamePresentationChanged(value.value<QString>());
    } else if (property == QLatin1String("ConnectedLinePresentation")) {
        Q_EMIT connectedLinePresentationChanged(value.value<QString>());
    } else if (property == QLatin1String("ConnectedLineRestriction")) {
        Q_EMIT connectedLineRestrictionChanged(value.value<QString>());
    } else if (property == QLatin1String("CallingLineRestriction")) {
        Q_EMIT callingLineRestrictionChanged(value.value<QString>());
    } else if (property == QLatin1String("HideCallerId")) {
        Q_EMIT hideCallerIdChanged(value.value<QString>());
    } else if (property == QLatin1String("VoiceCallWaiting")) {
        Q_EMIT voiceCallWaitingChanged(value.value<QString>());
    }
}
예제 #28
0
파일: transaction.cpp 프로젝트: KDE/libqapt
void Transaction::setProperty(int property, QDBusVariant value)
{
    if (isForeignUser()) {
        sendErrorReply(QDBusError::AccessDenied);
        return;
    }

    switch (property)
    {
    case QApt::TransactionIdProperty:
    case QApt::UserIdProperty:
        // Read-only
        sendErrorReply(QDBusError::Failed);
        break;
    case QApt::RoleProperty:
        setRole((QApt::TransactionProperty)value.variant().toInt());
        break;
    case QApt::StatusProperty:
        setStatus((QApt::TransactionStatus)value.variant().toInt());
        break;
    case QApt::LocaleProperty:
        setLocale(value.variant().toString());
        break;
    case QApt::ProxyProperty:
        setProxy(value.variant().toString());
        break;
    case QApt::DebconfPipeProperty:
        setDebconfPipe(value.variant().toString());
        break;
    case QApt::PackagesProperty:
        setPackages(value.variant().toMap());
        break;
    case QApt::FrontendCapsProperty:
        setFrontendCaps(value.variant().toInt());
        break;
    default:
        sendErrorReply(QDBusError::InvalidArgs);
        break;
    }
}
예제 #29
0
void Ofono::propertyChanged(const QString &_name, const QDBusVariant &_value)
{
    qDebug() << "inside propertyChanged()";
    if(_name == "Calls")
    {
        const QVariant var = _value.variant();
        QDBusArgument dbusArgument = var.value<QDBusArgument>();
        //qDebug()<<var;
        dbusArgument.beginArray();
        while(!dbusArgument.atEnd())
        {
            QDBusObjectPath opath;
            dbusArgument >> opath;
            m_path = opath.path();
            OrgOfonoVoiceCallInterface *call = new OrgOfonoVoiceCallInterface ("org.ofono", m_path, QDBusConnection::systemBus());
            QVariantMap properties=call->GetProperties();
            QVariant property=properties.value("State");

            QString value=property.value<QString>();
            if(value=="dialing")
            {
                qDebug()<<"dialing";
            }
            else if(value=="incoming")
            {
                QVariant callIDProperty= properties.value("LineIdentification");
                QString callerID =callIDProperty.value<QString>();
                qDebug() << "incoming";
                emit incomingCall(callerID);
            }else if(value == ""){
                //what to do when phonecall is aborted?
                emit phoneCallAborted();
            }
        }
    }
}
예제 #30
0
파일: BTClient.cpp 프로젝트: kavuri/btusb
void
BTClient::btStateChanged (QString key, QDBusVariant value)
{
    QVariant v = value.variant ();
    qDebug () << "Property:" << key << " changed to " << v.toString ();
}