当前位置: 首页>>代码示例>>C++>>正文


C++ QDBusMessage类代码示例

本文整理汇总了C++中QDBusMessage的典型用法代码示例。如果您正苦于以下问题:C++ QDBusMessage类的具体用法?C++ QDBusMessage怎么用?C++ QDBusMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QDBusMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: return

long long
PlatformUdisks::getSize(const QString &devicePath)
{
    long long ret;
    QDBusConnection connection = QDBusConnection::systemBus();
    QDBusMessage message;
    QList<QVariant> args;
    args << "org.freedesktop.UDisks";
    args << "DeviceSize";

    message = QDBusMessage::createMethodCall("org.freedesktop.UDisks", devicePath, "org.freedesktop.DBus.Properties", "Get");
    message.setArguments(args);

    QDBusReply<QDBusVariant> reply = connection.call(message);
    if (!reply.isValid())
        return(0);

    ret = reply.value().variant().toLongLong();
    return(ret);
}
开发者ID:BackupTheBerlios,项目名称:kiwi,代码行数:20,代码来源:PlatformUdisks.cpp

示例2: sendDBusRegister

bool DBusComm::sendDBusRegister()
{
    QDBusMessage reply = positioningdProxy->call("registerListener",
                                                 myService.toLatin1().constData(),
                                                 myPath.toLatin1().constData());
    if (reply.type() == QDBusMessage::ReplyMessage) {
        QList<QVariant> values = reply.arguments();
        clientId = values.takeFirst().toInt();
        quint32 m = values.takeFirst().toUInt();
        availablePositioningMethods = (QGeoPositionInfoSource::PositioningMethod) m;
        minimumUpdateInterval = values.takeFirst().toUInt();
    } else {
        cerr << endl << "DBus error:\n";
        cerr << reply.errorName().toLatin1().constData() << endl;
        cerr << reply.errorMessage().toLatin1().constData() << endl;
        return false;
    }

    return true;
}
开发者ID:amccarthy,项目名称:qtlocation,代码行数:20,代码来源:dbuscomm_maemo.cpp

示例3: slotDBusSignal

void ServiceListener::slotDBusSignal( const QDBusMessage& message )
{
    odebug << "ConnMan: " << message.member() << oendl;
    if( message.member() == "PropertyChanged" ) {
        QString prop = message[0].toString();
        if( prop == "State" ) {
            QString oldState = m_state;
            QString newState = message[1].toVariant().value.toString();
            if( oldState != newState ) {
                emit serviceStateChanged( QDBusObjectPath( QCString( m_proxy->path() )), oldState, newState );
                m_state = newState;
                sendSignalStrength();
            }
        }
        else if( prop == "Strength" ) {
            m_strength = message[1].toVariant().value.toByte();
            sendSignalStrength();
        }
    }
}
开发者ID:opieproject,项目名称:opie,代码行数:20,代码来源:service.cpp

示例4: tDebug

void
FdoNotifyPlugin::dbusCapabiltiesReplyReceived( const QDBusMessage& reply )
{
    if ( reply.type() != QDBusMessage::ReplyMessage )
    {
        tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Did not receive a ReplyMessage";
    }

    const QStringList &list = reply.arguments().at( 0 ).toStringList();
    QListIterator<QString> iter( list );
    while ( iter.hasNext() )
    {
        QString capabilty = iter.next();
        if ( capabilty.compare( "body-markup" ) == 0 )
        {
            m_wmSupportsBodyMarkup = true;
            break;
        }
    }
}
开发者ID:AndyCoder,项目名称:tomahawk,代码行数:20,代码来源:FdoNotifyPlugin.cpp

示例5: dispatchEvent

	//Callback (slot) used to retrieve subscribed event information
	void DBusInterface::dispatchEvent(const QDBusMessage& message)
	{
		// unpack event
		QString eventReceivedName= message.arguments().at(1).value<QString>();
		Values eventReceivedValues = dBusMessagetoValues(message,2);
		// find and trigger matching callback
		if( callbacks.count(eventReceivedName) > 0)
		{
			callbacks[eventReceivedName](eventReceivedValues);
		}
	}
开发者ID:antoinealb,项目名称:aseba,代码行数:12,代码来源:dbusinterface.cpp

示例6: addr

void QBluetoothPasskeyAgent_Private::Confirm(const QString &path,
                                             const QString &address,
                                             const QString &value,
                                             const QDBusMessage &msg)
{
    QString devname = path.mid(11);
    QBluetoothAddress addr(address);

    msg.setDelayedReply(true);

    QDBusMessage reply;
    if (m_parent->confirmPasskey(devname, addr, value)) {
        reply = msg.createReply();
    }
    else {
        reply = msg.createErrorReply("org.bluez.Error.Rejected", "Rejected");
    }

    QDBusConnection::systemBus().send(reply);
}
开发者ID:Fale,项目名称:qtmoko,代码行数:20,代码来源:qbluetoothpasskeyagent.cpp

示例7: RequestInput

void AgentAdaptor::RequestInput(const QDBusObjectPath &service_path,
                                       const QVariantMap &fields,
                                       const QDBusMessage &message)
{
    QVariantMap json;
    Q_FOREACH (const QString &key, fields.keys()){
        QVariantMap payload = qdbus_cast<QVariantMap>(fields[key]);
        json.insert(key, payload);
    }

    message.setDelayedReply(true);

    ServiceRequestData *reqdata = new ServiceRequestData;
    reqdata->objectPath = service_path.path();
    reqdata->fields = json;
    reqdata->reply = message.createReply();
    reqdata->msg = message;

    m_userAgent->requestUserInput(reqdata);
}
开发者ID:TurpoUrpo,项目名称:libconnman-qt,代码行数:20,代码来源:useragent.cpp

示例8: qDebug

QList<Job::Ptr> SystemdPrivate::listJobs()
{
    QList<Job::Ptr> jobs;

    qDBusRegisterMetaType<ManagerDBusJob>();
    qDBusRegisterMetaType<ManagerDBusJobList>();
    QDBusPendingReply<ManagerDBusJobList> reply = isdface.ListJobs();
    reply.waitForFinished();

    if (reply.isError()) {
        qDebug() << reply.error().message();
    } else {
        const QDBusMessage message = reply.reply();
        if (message.type() == QDBusMessage::ReplyMessage) {
            const ManagerDBusJobList queued = qdbus_cast<ManagerDBusJobList>(message.arguments().first());
            Q_FOREACH(const ManagerDBusJob job, queued) {
                jobs.append(Job::Ptr(new Job(job.path.path()), &QObject::deleteLater));
            }
        }
    }
开发者ID:vanmit,项目名称:libsystemd-qt,代码行数:20,代码来源:sdmanager.cpp

示例9: getDaemonVersionCall

QString SettingsUi::readDaemonVersion()
{
    QDBusInterface getDaemonVersionCall("com.kimmoli.tohkbd2", "/", "com.kimmoli.tohkbd2", QDBusConnection::systemBus());
    getDaemonVersionCall.setTimeout(2000);

    QDBusMessage getDaemonVersionReply = getDaemonVersionCall.call(QDBus::AutoDetect, "getVersion");

    if (getDaemonVersionReply.type() == QDBusMessage::ErrorMessage)
    {
        qDebug() << "Error reading daemon version:" << getDaemonVersionReply.errorMessage();
        return QString("N/A");
    }

    QString daemonVersion = getDaemonVersionReply.arguments().at(0).toString();

    qDebug() << "Daemon version is" << daemonVersion;

    return daemonVersion;

}
开发者ID:atomim,项目名称:tohkbd2,代码行数:20,代码来源:settingsui.cpp

示例10: qDebug

QList<Systemd::Job*> Systemd::SystemdPrivate::listJobs()
{
    qDBusRegisterMetaType<ManagerDBusJob>();
    qDBusRegisterMetaType<ManagerDBusJobList>();
    QDBusPendingReply<ManagerDBusJobList> reply = isdface.ListJobs();
    reply.waitForFinished();

    if (reply.isError()) {
        qDebug() << reply.error().message();
        return QList<Systemd::Job*>();
    }

    QList<Systemd::Job*> queued;
    const QDBusMessage message = reply.reply();
    if (message.type() == QDBusMessage::ReplyMessage) {
        const ManagerDBusJobList jobs = qdbus_cast<ManagerDBusJobList>(message.arguments().first());
        Q_FOREACH(const ManagerDBusJob job, jobs) {
            queued.append(new Systemd::Job(job.path.path()));
        }
    }
开发者ID:AlexMercerJ,项目名称:libsystemd-qt,代码行数:20,代码来源:sdmanager.cpp

示例11: qWarning

QVariant DBusResponseWaiter::waitForReply(QVariant variant) const
{
    if (QDBusPendingCall* call = const_cast<QDBusPendingCall*>(extractPendingCall(variant)))
    {
        call->waitForFinished();
        
        if (call->isError())
        {
            qWarning() << "error:" << call->error();
            return QVariant("error");
        }
        
        QDBusMessage reply = call->reply();

        if (reply.arguments().count() > 0)
        {
            return reply.arguments().at(0);
        }
    }
    return QVariant();
}
开发者ID:KDE,项目名称:kdeconnect-kde,代码行数:21,代码来源:responsewaiter.cpp

示例12:

bool
PlatformUdisks::isUSB(const QString &udiskPath)
{
    QDBusConnection connection = QDBusConnection::systemBus();
    QDBusMessage message;
    QList<QVariant> args;
    args << "org.freedesktop.UDisks";
    args << "DriveConnectionInterface";

    message = QDBusMessage::createMethodCall("org.freedesktop.UDisks", udiskPath, "org.freedesktop.DBus.Properties", "Get");
    message.setArguments(args);

    QDBusReply<QDBusVariant> reply = connection.call(message);
    if (!reply.isValid())
        return false;

    if (reply.value().variant().toString() == "usb")
        return true;
    else
        return false;
}
开发者ID:BackupTheBerlios,项目名称:kiwi,代码行数:21,代码来源:PlatformUdisks.cpp

示例13: _mitakuuluuMessageReceived

void DbusAdapter::_mitakuuluuMessageReceived(QDBusMessage msg) {
    qDebug() << "Mitakuuluu messageReceived:" << msg;

    QDBusArgument *arg = (QDBusArgument *) msg.arguments().at(0).data();

    if (arg->currentType() == QDBusArgument::MapType) {
        QMap<QString, QString> argMap = unpackMessage(*arg);

        qDebug() << "Extracted argument map:" << argMap;
        emit commhistoryd(argMap.value("author"), argMap.value("message"));
    }
}
开发者ID:MrJoe,项目名称:SkippingStones,代码行数:12,代码来源:dbusadapter.cpp

示例14: if

void DeviceHandler::slotAsyncReply( int callId, const QDBusMessage& reply )
{
    QString method = m_calls[callId];

    if (reply.type() == QDBusMessage::ReplyMessage) {
        odebug << "********* " << m_devProxy->interface() << " " << method << " success" << oendl;
        if( m_pool ) {
            if( reply.count() > 0 )
                m_pool->handlerSuccess( this, method, reply[0].toString() );
            else
                m_pool->handlerSuccess( this, method, QString::null );
        }
    }
    else if (reply.type() == QDBusMessage::ErrorMessage) {
        odebug << "********* " << m_devProxy->interface() << " " << method << " fail: " << reply.error().name() << ": " << reply.error().message() << oendl;
        if( m_pool )
            m_pool->handlerError( this, method, reply.error().name(), reply.error().message() );
    }

    m_calls.remove(callId);
}
开发者ID:opieproject,项目名称:opie,代码行数:21,代码来源:obluetoothdevicehandler.cpp

示例15: bus

	// Create DBus connection with the interface ch.epfl.mobots.AsebaNetwork
	DBusInterface::DBusInterface() :
		bus(QDBusConnection::sessionBus()),
		callbacks({}),
		dbusMainInterface("ch.epfl.mobots.Aseba", "/", "ch.epfl.mobots.AsebaNetwork",bus)
	{
		checkConnection();

		// setup event filter
		QDBusMessage eventfilterMessage = dbusMainInterface.call("CreateEventFilter");
		QDBusObjectPath eventfilterPath = eventfilterMessage.arguments().at(0).value<QDBusObjectPath>();
		eventfilterInterface = new QDBusInterface("ch.epfl.mobots.Aseba", eventfilterPath.path(), "ch.epfl.mobots.EventFilter",bus);
		if(!bus.connect("ch.epfl.mobots.Aseba",
						eventfilterPath.path(),
						"ch.epfl.mobots.EventFilter",
						"Event",
						this,
						SLOT(dispatchEvent(const QDBusMessage&))))
		{
			qDebug() << "failed to connect eventfilter signal to dispatchEvent slot!";
		}
	}
开发者ID:antoinealb,项目名称:aseba,代码行数:22,代码来源:dbusinterface.cpp


注:本文中的QDBusMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。