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


C++ QDBusArgument::atEnd方法代码示例

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


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

示例1: error

UdisksManager::UdisksManager(QObject *parent)
    : QObject(parent)
{
    QDBusConnection system = QDBusConnection::systemBus();

    if (!system.isConnected())
    {
        emit error(tr("Cannot connect to Udisks daemon"));
    }

    system.connect("org.freedesktop.UDisks",
                    "/org/freedesktop/UDisks",
                    "org.freedesktop.UDisks",
                    "DeviceAdded",
                    this,
                    SLOT(onDeviceAdded(QDBusObjectPath)));
    system.connect("org.freedesktop.UDisks",
                    "/org/freedesktop/UDisks",
                    "org.freedesktop.UDisks",
                    "DeviceRemoved",
                    this,
                    SLOT(onDeviceRemoved(QDBusObjectPath)));
    system.connect("org.freedesktop.UDisks",
                    "/org/freedesktop/UDisks",
                    "org.freedesktop.UDisks",
                    "DeviceChanged",
                    this,
                    SLOT(onDeviceChanged(QDBusObjectPath)));

    QDBusInterface devEnum("org.freedesktop.UDisks",
                           "/org/freedesktop/UDisks",
                           "org.freedesktop.UDisks",
                           QDBusConnection::systemBus());

    QDBusMessage enumRes = devEnum.call("EnumerateDevices");
    // TODO/FIXME: error checking
//    if (enumRes.type() == QDBusMessage::ErrorMessage)
//    {
//        fprintf(stderr, "ERROR: Can't call EnumerateDevices\n");
//        fprintf(stderr, "       %s : %s\n", qPrintable(enumRes.errorName()), qPrintable(enumRes.errorMessage()));
//    }
//
//    if (enumRes.type() != QDBusMessage::ReplyMessage || !enumRes.arguments().at(0).canConvert<QDBusArgument>())
//    {
//        fprintf(stderr, "ERROR: Unexpected result type of EnumerateDevices call\n");
//    }
//
    const QDBusArgument enumArg = enumRes.arguments().at(0).value<QDBusArgument>();
//    if (enumArg.currentType() != QDBusArgument::ArrayType)
//    {
//        fprintf(stderr, "ERROR: Unexpected argument type of EnumerateDevices call\n");
//    }

    enumArg.beginArray();
    while (!enumArg.atEnd())
    {
        addDevice(qdbus_cast<QDBusObjectPath>(enumArg));
    }
    enumArg.endArray();
}
开发者ID:bwalter,项目名称:razor-qt,代码行数:60,代码来源:udisksmanager.cpp

示例2: extractMapData

//
//  Function to extract the data from a QDBusArgument that contains a map.
//  Some of the arrayElements can contain a QDBusArgument as the object
//  instead of a primitive (string, bool, int, etc.). This function
//  will extract the data from the QDBusArgument and write it into a map.
//
//  Return value a bool, true on success, false otherwise.
//  The map is sent by reference (called r_map here) and is modified by this function.
//  r_var is a constant reference to the QDBusArgument.
//
bool shared::extractMapData(QMap<QString,QVariant>& r_map, const QVariant& r_var)
{
  //  make sure we can convert the QVariant into a QDBusArgument
  if (! r_var.canConvert<QDBusArgument>() ) return false;
  const QDBusArgument qdba =  r_var.value<QDBusArgument>();

  // make sure the QDBusArgument holds a map
  if (qdba.currentType() != QDBusArgument::MapType ) return false;

  // iterate over the QDBusArgument pulling map keys and values out
    r_map.clear();
    qdba.beginMap();

    while ( ! qdba.atEnd() ) {
      QString key;
      QVariant value;
      qdba.beginMapEntry();
      qdba >> key >> value;
      qdba.endMapEntry();
      r_map.insert(key, value);
    } // while

    qdba.endMap();
    return true;
}
开发者ID:andrew-bibb,项目名称:cmst,代码行数:35,代码来源:shared.cpp

示例3: dBusArgConvertAAY

QStringList Partition::dBusArgConvertAAY(const QDBusArgument &byteArrayArray) const
{
	QStringList stringList;
	byteArrayArray.beginArray();
	while (!byteArrayArray.atEnd())
		stringList << qdbus_cast<QByteArray>(byteArrayArray);

	byteArrayArray.endArray();

	return stringList;
}
开发者ID:vic-prog,项目名称:libqdrive,代码行数:11,代码来源:Partition.cpp

示例4: probeDevices

void UPower::probeDevices() {
    if (!m_interface)
        return;

    QDBusArgument argument = m_interface->call( "EnumerateDevices" ).arguments().at(0).value<QDBusArgument>();

    if( m_interface->lastError().type() == QDBusError::NoError ) {
        argument.beginArray();
        while( !argument.atEnd() ) {
            QDBusObjectPath dbusPath;
            argument >> dbusPath;
            deviceAdded(dbusPath.path());
        }
    }
开发者ID:grimtraveller,项目名称:netbas,代码行数:14,代码来源:upower.cpp

示例5: while

QList<QDBusObjectPath> Udisks2Lister::GetMountedPartitionsFromDBusArgument(
    const QDBusArgument& input) {
  QList<QDBusObjectPath> result;

  input.beginArray();
  while (!input.atEnd()) {
    QDBusObjectPath extractedPath;
    input >> extractedPath;
    result.push_back(extractedPath);
  }
  input.endArray();

  return result;
}
开发者ID:Atrament666,项目名称:Clementine,代码行数:14,代码来源:udisks2lister.cpp

示例6: while

bool
Serializable::deserialize (const QDBusArgument &argument)
{
    argument.beginMap ();
    while (!argument.atEnd()) {
        QString key;
        SerializablePointer p;
        argument.beginMapEntry ();
        argument >> key;
        argument >> p;
        argument.endMapEntry ();
        m_attachments[key] = p;
    }
    argument.endMap ();
    return true;
}
开发者ID:ascetic85,项目名称:ibus-qt,代码行数:16,代码来源:qibusserializable.cpp

示例7: call

std::vector<Device> KinesixdProxy::GetValidDeviceList()
{
    QDBusMessage reply = call(QDBus::BlockWithGui, KINESIXD_GET_VALID_DEVICE_LIST);
    QDBusArgument arg = reply.arguments().at(0).value<QDBusArgument>();

    std::vector<Device> deviceList;
    arg.beginArray();
    while (!arg.atEnd())
    {
        Device d;
        arg >> d;
        deviceList.push_back(d);
    }
    arg.endArray();

    return deviceList;
}
开发者ID:kicsyromy,项目名称:kinesix_client,代码行数:17,代码来源:kinesixd_proxy.cpp

示例8: while

QMap<QString, QString> DbusAdapter::unpackMessage(const QDBusArgument &arg) {
    QMap<QString, QString> argMap;

    arg.beginMap();
    while (! arg.atEnd()) {
        QString key;
        QVariant value;

        arg.beginMapEntry();
        arg >> key >> value;
        if (value.canConvert(QVariant::String)) {
            argMap.insert(key, value.toString());
        }
        arg.endMapEntry();
    }
    arg.endMap();

    return argMap;
}
开发者ID:MrJoe,项目名称:SkippingStones,代码行数:19,代码来源:dbusadapter.cpp

示例9: update

void UDiskProvider::update()
{

    QDBusInterface devEnum("org.freedesktop.UDisks",
                           "/org/freedesktop/UDisks",
                           "org.freedesktop.UDisks",
                           QDBusConnection::systemBus());

    QDBusMessage enumRes = devEnum.call("EnumerateDevices");
    if (enumRes.type() != QDBusMessage::ReplyMessage || !enumRes.arguments().at(0).canConvert<QDBusArgument>())
    {
        if (enumRes.type() == QDBusMessage::ErrorMessage)
            qWarning() << "ERROR: Can't call EnumerateDevices"
                       <<  qPrintable(enumRes.errorName()) << qPrintable(enumRes.errorMessage());
        else
            qWarning() << "ERROR: Unexpected result type of EnumerateDevices call";
        return;
    }

    const QDBusArgument enumArg = enumRes.arguments().at(0).value<QDBusArgument>();
    if (enumArg.currentType() != QDBusArgument::ArrayType)
    {
        qWarning() << "ERROR: Unexpected argument type of EnumerateDevices call";
        return;
    }

    enumArg.beginArray();
    while (!enumArg.atEnd())
    {
        QDBusObjectPath path = qdbus_cast<QDBusObjectPath>(enumArg);

        if (mDevicesByPath.contains(path.path()))
            dbusDeviceChanged(path);
        else
            dbusDeviceAdded(path);
    }
    enumArg.endArray();

}
开发者ID:PeterJespersen,项目名称:razor-qt,代码行数:39,代码来源:rzmountproviders.cpp

示例10: loadNetworks

void SavedNetworksList::loadNetworks() {
    savedNetworks.clear();
    QDBusMessage m = savedInterface->call(QDBus::Block, "ListConnections");
    QDBusArgument knownNetworks = m.arguments().first().value<QDBusArgument>();
    knownNetworks.beginArray();
    while (!knownNetworks.atEnd()) {
        QDBusObjectPath o;
        knownNetworks >> o;

        QDBusMessage settingsMessage = QDBusMessage::createMethodCall("org.freedesktop.NetworkManager", o.path(), "org.freedesktop.NetworkManager.Settings.Connection", "GetSettings");
        QDBusArgument settingsArg = QDBusConnection::systemBus().call(settingsMessage).arguments().first().value<QDBusArgument>();
        QMap<QString, QVariantMap> settings;
        settingsArg >> settings;

        Setting s;
        QVariantMap connectionSettings = settings.value("connection");
        s.path = o;
        s.name = connectionSettings.value("id").toString();

        if (connectionSettings.value("type") == "802-3-ethernet") {
            s.NetworkType = Setting::Wired;
        } else if (connectionSettings.value("type") == "802-11-wireless") {
            s.NetworkType = Setting::Wireless;
        } else if (connectionSettings.value("type") == "bluetooth") {
            s.NetworkType = Setting::Bluetooth;
        } else if (connectionSettings.value("type") == "vpn") {
            s.NetworkType = Setting::VPN;
        } else if (connectionSettings.value("type") == "gsm" || connectionSettings.value("type") == "cdma") {
            s.NetworkType = Setting::Mobile;
        } else {
            s.NetworkType = Setting::Unknown;
        }

        savedNetworks.append(s);
    }
    knownNetworks.endArray();

    this->dataChanged(this->index(0), this->index(this->rowCount()));
}
开发者ID:bao-boyle,项目名称:theshell,代码行数:39,代码来源:savednetworkslist.cpp

示例11: propertyChanged

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();
            }
        }
    }
}
开发者ID:NoUsername,项目名称:McmMosLinuxPhone,代码行数:36,代码来源:ofono.cpp

示例12: createInputMap

/////////////////////////////////////// PUBLIC FUNCTIONS ////////////////////////////////
//
//	Function to put all of input fields received via DBus:RequestInput into a 
//	QMap<QString,QString> where key is the input field received and value is
//	generally blank but can be used for informational text.
//
//	If we asked to log the input request create the log file in /tmp/cmst/input_request.log
void ConnmanAgent::createInputMap(const QMap<QString,QVariant>& r_map)
{
	// Initialize our data map
	input_map.clear();
	
	// QFile object for logging
	QTextStream log;
	QFile logfile("/tmp/cmst/input_request.log");
	if (b_loginputrequest) {
		QDir d;
		d.mkpath("/tmp/cmst");
		if (logfile.exists()) logfile.remove();
		if (!logfile.open(QIODevice::WriteOnly | QIODevice::Text)) b_loginputrequest = false;
		else log.setDevice(&logfile);
	}
 
  
	// Run through the r_map getting the keys and the few values we are interested in.
	QMap<QString, QVariant>::const_iterator i = r_map.constBegin();
	while (i != r_map.constEnd()) {
		    
    // Lets see what the values contain, but first make sure we can get to them.
    if (b_loginputrequest) log << "\nMap Key: " << i.key() << "\n";
     
    if (! i.value().canConvert<QDBusArgument>() ) return;
    const QDBusArgument qdba =  i.value().value<QDBusArgument>();
		if (qdba.currentType() != QDBusArgument::MapType ) {
			if (b_loginputrequest) log << "Error - QDBusArgument as the value is not a MapType\n"; 
			return;
		}	
    
    // The r_map.value() is a QDBusArgument::MapType so extract this map into a new QMap called m.
    qdba.beginMap();
    QMap<QString,QString> m;
		m.clear();
		if (b_loginputrequest) log << "Extracting the DBusArgument Map...\n"; 
		while ( ! qdba.atEnd() ) {
			QString k;
			QVariant v;
			qdba.beginMapEntry();
			qdba >> k >> v;
			qdba.endMapEntry();
			m.insert(k, v.toString());
			if (b_loginputrequest) log << "{ " << k << " , " << v.toString() << "}\n"; 
		}	// while
		qdba.endMap();
		
		// Browse through QMap m and get things we need to look at
		// Types we don' really care about.  We ignore "optional" and "alternate" requirements
    // and only extract the "mandatory" and "informational" requirements with values
		if (m.contains("Requirement") ) {
			QString val = QString();
			if ( m.value("Requirement").contains("mandatory", Qt::CaseInsensitive) || m.value("Requirement").contains("informational", Qt::CaseInsensitive) ) {
				if (m.contains("Value") ) val = m.value("Value"); 
			}	// if mandatory or informational
			//	create our input_map entry
			input_map[i.key()] = val;
		}	// if requirement

    ++i;
	}	// while
	
	logfile.close();
	return;	
}
开发者ID:rabbor,项目名称:cmst,代码行数:72,代码来源:agent.cpp

示例13: if

static QVariantList
qml_from_dbus(QVariant v)
{
	QVariantList r;
	const char *type=v.typeName();
	switch (v.type()) {
    case QVariant::ULongLong:
        r.append("uint64");
        r.append(v.toULongLong());
        break;
    case QVariant::UInt:
		r.append("uint32");
		r.append(v.toUInt());
		break;
	case QVariant::Int:
		r.append("int32");
		r.append(v.toInt());
		break;
	case QMetaType::UShort:
		r.append("uint16");
		r.append(v.toUInt());
		break;
	case QMetaType::UChar:
		r.append("uint8");
		r.append(v.toUInt());
		break;
	case QVariant::String:
		r.append("string");
		r.append(v.toString());
		break;
	case QVariant::Bool:
		r.append("bool");
		r.append(v.toBool());
		break;
	case QVariant::Double:
		r.append("double");
		r.append(v.toDouble());
		break;
	case QVariant::UserType:
		if (!strcmp(type,"QDBusArgument")) {
			const QDBusArgument arg=v.value < QDBusArgument>();
			QVariantList rl;
			switch(arg.currentType()) {
			case QDBusArgument::ArrayType:
				r.append("array");
				arg.beginArray();
				while (!arg.atEnd()) {
					rl.append(qml_from_dbus(arg.asVariant()));
				}
				r.append(QVariant(rl));
				break;
			case QDBusArgument::StructureType:
				r.append("structure");
				arg.beginStructure();
				while (!arg.atEnd()) {
					rl.append(qml_from_dbus(arg.asVariant()));
				}
				arg.endStructure();
				r.append(QVariant(rl));
				break;
			case QDBusArgument::MapType:
				r.append("map");
				arg.beginMap();
				while (!arg.atEnd()) {
					arg.beginMapEntry();
					rl.append(qml_from_dbus(arg.asVariant()));
					rl.append(qml_from_dbus(arg.asVariant()));
					arg.endMapEntry();
				}
				arg.endMap();
				r.append(QVariant(rl));
				break;
			case QDBusArgument::UnknownType:
				break;
			default:
				printf("Unknown type %d\n",arg.currentType());
				break;
			}
		} else if (!strcmp(type,"QDBusVariant")) {
			const QDBusVariant arg=v.value < QDBusVariant>();
			QVariantList rl;
			r.append("variant");
			rl.append(qml_from_dbus(arg.variant()));
			r.append(QVariant(rl));
		} else {
			printf("User type %s\n",v.typeName());
		}
		break;
	default:
		fprintf(stderr,"Unsupported Arg %s(%d)\n",type,v.type());
	}
	return r;
}
开发者ID:GENIVI,项目名称:navigation-application,代码行数:93,代码来源:dbusif.cpp


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