本文整理汇总了C++中QBluetoothLocalDevice::address方法的典型用法代码示例。如果您正苦于以下问题:C++ QBluetoothLocalDevice::address方法的具体用法?C++ QBluetoothLocalDevice::address怎么用?C++ QBluetoothLocalDevice::address使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QBluetoothLocalDevice
的用法示例。
在下文中一共展示了QBluetoothLocalDevice::address方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
ServiceDiscoveryDialog::ServiceDiscoveryDialog(const QString &name,
const QBluetoothAddress &address, QWidget *parent)
: QDialog(parent), ui(new Ui_ServiceDiscovery)
{
ui->setupUi(this);
//Using default Bluetooth adapter
QBluetoothLocalDevice localDevice;
QBluetoothAddress adapterAddress = localDevice.address();
/*
* In case of multiple Bluetooth adapters it is possible to
* set which adapter will be used by providing MAC Address.
* Example code:
*
* QBluetoothAddress adapterAddress("XX:XX:XX:XX:XX:XX");
* discoveryAgent = new QBluetoothServiceDiscoveryAgent(adapterAddress);
*/
discoveryAgent = new QBluetoothServiceDiscoveryAgent(adapterAddress);
discoveryAgent->setRemoteAddress(address);
setWindowTitle(name);
connect(discoveryAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)),
this, SLOT(addService(QBluetoothServiceInfo)));
connect(discoveryAgent, SIGNAL(finished()), ui->status, SLOT(hide()));
discoveryAgent->start();
}
示例2: sendBluetoothService
void Handover::sendBluetoothService()
{
QBluetoothLocalDevice localDevice;
const QString data = localDevice.address().toString() + QLatin1Char(' ') +
QString::number(m_localServerPort);
m_remote->write(data.toUtf8());
}
示例3: tst_address
void tst_QBluetoothLocalDevice::tst_address()
{
if (!QBluetoothLocalDevice::allDevices().count())
QSKIP("Skipping test due to missing Bluetooth device");
QBluetoothLocalDevice localDevice;
QVERIFY(!localDevice.address().toString().isEmpty());
}
示例4: tst_construction
void tst_QBluetoothLocalDevice::tst_construction()
{
QBluetoothLocalDevice localDevice;
QVERIFY(localDevice.isValid());
QBluetoothLocalDevice anotherDevice = new QBluetoothLocalDevice(QBluetoothAddress(000000000000));
QVERIFY(anotherDevice.isValid());
QVERIFY(anotherDevice.address().toUInt64() != 0);
}
示例5: readBluetoothService
void Handover::readBluetoothService()
{
QByteArray rawData = m_client->readAll();
QString data = QString::fromUtf8(rawData.constData(), rawData.size());
QStringList split = data.split(QLatin1Char(' '));
QBluetoothAddress address = QBluetoothAddress(split.at(0));
quint16 port = split.at(1).toUInt();
QBluetoothLocalDevice localDevice;
QBluetoothAddress localAddress = localDevice.address();
if (localAddress < address) {
m_address = address;
m_serverPort = port;
emit bluetoothServiceChanged();
}
}
示例6: tst_address
void tst_QBluetoothLocalDevice::tst_address()
{
QBluetoothLocalDevice localDevice;
QVERIFY(!localDevice.address().toString().isEmpty());
}
示例7: localAddress
QBluetoothAddress QBluetoothSocketPrivate::localAddress() const
{
QBluetoothLocalDevice ld;
return ld.address();
}