本文整理汇总了C++中InterfaceList::value方法的典型用法代码示例。如果您正苦于以下问题:C++ InterfaceList::value方法的具体用法?C++ InterfaceList::value怎么用?C++ InterfaceList::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InterfaceList
的用法示例。
在下文中一共展示了InterfaceList::value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: peerName
QString QBluetoothSocketPrivate::peerName() const
{
quint64 bdaddr;
if (socketType == QBluetoothServiceInfo::RfcommProtocol) {
sockaddr_rc addr;
socklen_t addrLength = sizeof(addr);
if (::getpeername(socket, reinterpret_cast<sockaddr *>(&addr), &addrLength) < 0)
return QString();
convertAddress(addr.rc_bdaddr.b, bdaddr);
} else if (socketType == QBluetoothServiceInfo::L2capProtocol) {
sockaddr_l2 addr;
socklen_t addrLength = sizeof(addr);
if (::getpeername(socket, reinterpret_cast<sockaddr *>(&addr), &addrLength) < 0)
return QString();
convertAddress(addr.l2_bdaddr.b, bdaddr);
} else {
qCWarning(QT_BT_BLUEZ) << "peerName() called on socket of unknown type";
return QString();
}
const QString peerAddress = QBluetoothAddress(bdaddr).toString();
const QString localAdapter = localAddress().toString();
if (isBluez5()) {
OrgFreedesktopDBusObjectManagerInterface manager(QStringLiteral("org.bluez"),
QStringLiteral("/"),
QDBusConnection::systemBus());
QDBusPendingReply<ManagedObjectList> reply = manager.GetManagedObjects();
reply.waitForFinished();
if (reply.isError())
return QString();
foreach (const QDBusObjectPath &path, reply.value().keys()) {
const InterfaceList ifaceList = reply.value().value(path);
foreach (const QString &iface, ifaceList.keys()) {
if (iface == QStringLiteral("org.bluez.Device1")) {
if (ifaceList.value(iface).value(QStringLiteral("Address")).toString()
== peerAddress)
return ifaceList.value(iface).value(QStringLiteral("Alias")).toString();
}
}
}
return QString();
} else {