本文整理汇总了C++中QBluetoothDeviceInfo::serviceClasses方法的典型用法代码示例。如果您正苦于以下问题:C++ QBluetoothDeviceInfo::serviceClasses方法的具体用法?C++ QBluetoothDeviceInfo::serviceClasses怎么用?C++ QBluetoothDeviceInfo::serviceClasses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QBluetoothDeviceInfo
的用法示例。
在下文中一共展示了QBluetoothDeviceInfo::serviceClasses方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deviceDiscovered
void BtLocalDevice::deviceDiscovered(const QBluetoothDeviceInfo &info)
{
QString services;
if (info.serviceClasses() & QBluetoothDeviceInfo::PositioningService)
services += "Position|";
if (info.serviceClasses() & QBluetoothDeviceInfo::NetworkingService)
services += "Network|";
if (info.serviceClasses() & QBluetoothDeviceInfo::RenderingService)
services += "Rendering|";
if (info.serviceClasses() & QBluetoothDeviceInfo::CapturingService)
services += "Capturing|";
if (info.serviceClasses() & QBluetoothDeviceInfo::ObjectTransferService)
services += "ObjectTra|";
if (info.serviceClasses() & QBluetoothDeviceInfo::AudioService)
services += "Audio|";
if (info.serviceClasses() & QBluetoothDeviceInfo::TelephonyService)
services += "Telephony|";
if (info.serviceClasses() & QBluetoothDeviceInfo::InformationService)
services += "Information|";
services.truncate(services.length()-1); //cut last '/'
qDebug() << "Found new device: " << info.name() << info.isValid() << info.address().toString()
<< info.rssi() << info.majorDeviceClass()
<< info.minorDeviceClass() << services;
}
示例2: tst_assignment
void tst_QBluetoothDeviceInfo::tst_assignment()
{
QFETCH(QBluetoothAddress, address);
QFETCH(QString, name);
QFETCH(quint32, classOfDevice);
QFETCH(QBluetoothDeviceInfo::ServiceClasses, serviceClasses);
QFETCH(QBluetoothDeviceInfo::MajorDeviceClass, majorDeviceClass);
QFETCH(quint8, minorDeviceClass);
QBluetoothDeviceInfo deviceInfo(address, name, classOfDevice);
QVERIFY(deviceInfo.isValid());
{
QBluetoothDeviceInfo copyInfo = deviceInfo;
QVERIFY(copyInfo.isValid());
QCOMPARE(copyInfo.address(), address);
QCOMPARE(copyInfo.name(), name);
QCOMPARE(copyInfo.serviceClasses(), serviceClasses);
QCOMPARE(copyInfo.majorDeviceClass(), majorDeviceClass);
QCOMPARE(copyInfo.minorDeviceClass(), minorDeviceClass);
}
{
QBluetoothDeviceInfo copyInfo;
QVERIFY(!copyInfo.isValid());
copyInfo = deviceInfo;
QVERIFY(copyInfo.isValid());
QCOMPARE(copyInfo.address(), address);
QCOMPARE(copyInfo.name(), name);
QCOMPARE(copyInfo.serviceClasses(), serviceClasses);
QCOMPARE(copyInfo.majorDeviceClass(), majorDeviceClass);
QCOMPARE(copyInfo.minorDeviceClass(), minorDeviceClass);
}
{
QBluetoothDeviceInfo copyInfo1;
QBluetoothDeviceInfo copyInfo2;
QVERIFY(!copyInfo1.isValid());
QVERIFY(!copyInfo2.isValid());
copyInfo1 = copyInfo2 = deviceInfo;
QVERIFY(copyInfo1.isValid());
QVERIFY(copyInfo2.isValid());
QVERIFY(!(QBluetoothDeviceInfo() == copyInfo1));
QCOMPARE(copyInfo1.address(), address);
QCOMPARE(copyInfo2.address(), address);
QCOMPARE(copyInfo1.name(), name);
QCOMPARE(copyInfo2.name(), name);
QCOMPARE(copyInfo1.serviceClasses(), serviceClasses);
QCOMPARE(copyInfo2.serviceClasses(), serviceClasses);
QCOMPARE(copyInfo1.majorDeviceClass(), majorDeviceClass);
QCOMPARE(copyInfo2.majorDeviceClass(), majorDeviceClass);
QCOMPARE(copyInfo1.minorDeviceClass(), minorDeviceClass);
QCOMPARE(copyInfo2.minorDeviceClass(), minorDeviceClass);
}
{
QBluetoothDeviceInfo testDeviceInfo;
QVERIFY(testDeviceInfo == QBluetoothDeviceInfo());
}
}
示例3: tst_assignment
void tst_QBluetoothDeviceInfo::tst_assignment()
{
QFETCH(QBluetoothAddress, address);
QFETCH(QString, name);
QFETCH(quint32, classOfDevice);
QFETCH(QBluetoothDeviceInfo::ServiceClasses, serviceClasses);
QFETCH(QBluetoothDeviceInfo::MajorDeviceClass, majorDeviceClass);
QFETCH(quint8, minorDeviceClass);
QFETCH(QBluetoothDeviceInfo::CoreConfiguration, coreConfiguration);
QFETCH(QBluetoothUuid, deviceUuid);
QBluetoothDeviceInfo deviceInfo(address, name, classOfDevice);
deviceInfo.setDeviceUuid(deviceUuid);
deviceInfo.setCoreConfigurations(coreConfiguration);
QVERIFY(deviceInfo.isValid());
{
QBluetoothDeviceInfo copyInfo = deviceInfo;
QVERIFY(copyInfo.isValid());
QCOMPARE(copyInfo.address(), address);
QCOMPARE(copyInfo.name(), name);
QCOMPARE(copyInfo.serviceClasses(), serviceClasses);
QCOMPARE(copyInfo.majorDeviceClass(), majorDeviceClass);
QCOMPARE(copyInfo.minorDeviceClass(), minorDeviceClass);
QCOMPARE(copyInfo.coreConfigurations(), coreConfiguration);
QCOMPARE(copyInfo.deviceUuid(), deviceUuid);
}
{
QBluetoothDeviceInfo copyInfo;
QVERIFY(!copyInfo.isValid());
copyInfo = deviceInfo;
QVERIFY(copyInfo.isValid());
QCOMPARE(copyInfo.address(), address);
QCOMPARE(copyInfo.name(), name);
QCOMPARE(copyInfo.serviceClasses(), serviceClasses);
QCOMPARE(copyInfo.majorDeviceClass(), majorDeviceClass);
QCOMPARE(copyInfo.minorDeviceClass(), minorDeviceClass);
QCOMPARE(copyInfo.coreConfigurations(), coreConfiguration);
QCOMPARE(copyInfo.deviceUuid(), deviceUuid);
}
{
QBluetoothDeviceInfo copyInfo1;
QBluetoothDeviceInfo copyInfo2;
QVERIFY(!copyInfo1.isValid());
QVERIFY(!copyInfo2.isValid());
copyInfo1 = copyInfo2 = deviceInfo;
QVERIFY(copyInfo1.isValid());
QVERIFY(copyInfo2.isValid());
QVERIFY(QBluetoothDeviceInfo() != copyInfo1);
QCOMPARE(copyInfo1.address(), address);
QCOMPARE(copyInfo2.address(), address);
QCOMPARE(copyInfo1.name(), name);
QCOMPARE(copyInfo2.name(), name);
QCOMPARE(copyInfo1.serviceClasses(), serviceClasses);
QCOMPARE(copyInfo2.serviceClasses(), serviceClasses);
QCOMPARE(copyInfo1.majorDeviceClass(), majorDeviceClass);
QCOMPARE(copyInfo2.majorDeviceClass(), majorDeviceClass);
QCOMPARE(copyInfo1.minorDeviceClass(), minorDeviceClass);
QCOMPARE(copyInfo2.minorDeviceClass(), minorDeviceClass);
QCOMPARE(copyInfo1.coreConfigurations(), coreConfiguration);
QCOMPARE(copyInfo2.coreConfigurations(), coreConfiguration);
QCOMPARE(copyInfo1.deviceUuid(), deviceUuid);
QCOMPARE(copyInfo2.deviceUuid(), deviceUuid);
}
{
QBluetoothDeviceInfo testDeviceInfo;
QVERIFY(testDeviceInfo == QBluetoothDeviceInfo());
}
}