本文整理汇总了C++中QBluetoothAddress::toUInt64方法的典型用法代码示例。如果您正苦于以下问题:C++ QBluetoothAddress::toUInt64方法的具体用法?C++ QBluetoothAddress::toUInt64怎么用?C++ QBluetoothAddress::toUInt64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QBluetoothAddress
的用法示例。
在下文中一共展示了QBluetoothAddress::toUInt64方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tst_assignment
void tst_QBluetoothAddress::tst_assignment()
{
QBluetoothAddress address(Q_UINT64_C(0x112233445566));
{
QBluetoothAddress copy = address;
QCOMPARE(address.toUInt64(), copy.toUInt64());
}
{
QBluetoothAddress copy1;
QBluetoothAddress copy2;
QVERIFY(copy1.isNull());
QVERIFY(copy2.isNull());
copy1 = copy2 = address;
QVERIFY(!copy1.isNull());
QVERIFY(!copy2.isNull());
QVERIFY(address.toUInt64() == copy1.toUInt64());
QVERIFY(address.toUInt64() == copy2.toUInt64());
copy1.clear();
QVERIFY(copy1.isNull());
QVERIFY2(copy1 != address, "Verify that copy1 is a copy of address, the d_ptr are being copied");
}
}
示例2: initL
void QBluetoothServiceDiscoveryAgentPrivate::initL(const QBluetoothAddress &address)
{
TBTDevAddr btAddress(address.toUInt64());
stop();
//Trapped in Start
m_sdpAgent = q_check_ptr(CSdpAgent::NewL(*this, btAddress));
m_filter = q_check_ptr(CSdpSearchPattern::NewL());
m_attributes = q_check_ptr(CSdpAttrIdMatchList::NewL());
m_attributes->AddL(KAttrRangeAll);
}
示例3: hciForAddress
int HciManager::hciForAddress(const QBluetoothAddress &deviceAdapter)
{
if (hciSocket < 0)
return -1;
bdaddr_t adapter;
convertAddress(deviceAdapter.toUInt64(), adapter.b);
struct hci_dev_req *devRequest = 0;
struct hci_dev_list_req *devRequestList = 0;
struct hci_dev_info devInfo;
const int devListSize = sizeof(struct hci_dev_list_req)
+ HCI_MAX_DEV * sizeof(struct hci_dev_req);
devRequestList = (hci_dev_list_req *) malloc(devListSize);
if (!devRequestList)
return -1;
QScopedPointer<hci_dev_list_req, QScopedPointerPodDeleter> p(devRequestList);
memset(p.data(), 0, devListSize);
p->dev_num = HCI_MAX_DEV;
devRequest = p->dev_req;
if (ioctl(hciSocket, HCIGETDEVLIST, devRequestList) < 0)
return -1;
for (int i = 0; i < devRequestList->dev_num; i++) {
devInfo.dev_id = (devRequest+i)->dev_id;
if (ioctl(hciSocket, HCIGETDEVINFO, &devInfo) < 0) {
continue;
}
int result = memcmp(&adapter, &devInfo.bdaddr, sizeof(bdaddr_t));
if (result == 0 || deviceAdapter.isNull()) // addresses match
return devInfo.dev_id;
}
return -1;
}
示例4: connectToService
void QBluetoothSocketPrivate::connectToService(const QBluetoothAddress &address, quint16 port, QIODevice::OpenMode openMode)
{
Q_Q(QBluetoothSocket);
int result = -1;
if (socket == -1 && !ensureNativeSocket(socketType)) {
errorString = QBluetoothSocket::tr("Unknown socket error");
q->setSocketError(QBluetoothSocket::UnknownSocketError);
return;
}
if (socketType == QBluetoothServiceInfo::RfcommProtocol) {
sockaddr_rc addr;
memset(&addr, 0, sizeof(addr));
addr.rc_family = AF_BLUETOOTH;
addr.rc_channel = port;
convertAddress(address.toUInt64(), addr.rc_bdaddr.b);
connectWriteNotifier->setEnabled(true);
readNotifier->setEnabled(true);QString();
result = ::connect(socket, (sockaddr *)&addr, sizeof(addr));
} else if (socketType == QBluetoothServiceInfo::L2capProtocol) {
sockaddr_l2 addr;
memset(&addr, 0, sizeof(addr));
addr.l2_family = AF_BLUETOOTH;
// This is an ugly hack but the socket class does what's needed already.
// For L2CP GATT we need a channel rather than a socket and the LE address type
// We don't want to make this public API offering for now especially since
// only Linux (of all platforms supported by this library) supports this type
// of socket.
#if defined(QT_BLUEZ_BLUETOOTH) && !defined(QT_BLUEZ_NO_BTLE)
if (lowEnergySocketType) {
addr.l2_cid = htobs(port);
addr.l2_bdaddr_type = lowEnergySocketType;
} else {
addr.l2_psm = htobs(port);
}
#else
addr.l2_psm = htobs(port);
#endif
convertAddress(address.toUInt64(), addr.l2_bdaddr.b);
connectWriteNotifier->setEnabled(true);
readNotifier->setEnabled(true);
result = ::connect(socket, (sockaddr *)&addr, sizeof(addr));
}
if (result >= 0 || (result == -1 && errno == EINPROGRESS)) {
connecting = true;
q->setSocketState(QBluetoothSocket::ConnectingState);
q->setOpenMode(openMode);
} else {
errorString = qt_error_string(errno);
q->setSocketError(QBluetoothSocket::UnknownSocketError);
}
}