"qt.bluetooth.darwin: Manually interrupting IOBluetoothDeviceInquiry"
Пишу приложение для работы с Bluetooth с использованием Qt и С++. Приложение собирается и запускается, но постоянно выдаёт сообщение:
"qt.bluetooth.darwin: Manually interrupting IOBluetoothDeviceInquiry"
Устройства тоже находит, но по какой-то причине не видит их адреса.
Код:
#include <QBluetoothDeviceDiscoveryAgent>
#include <QBluetoothLocalDevice>
#include <QBluetoothDeviceInfo>
#include <QBluetoothUuid>
#include <QDebug>
#include <QCoreApplication>
class BluetoothScanner : public QObject
{
public:
BluetoothScanner()
{
_discoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
connect(_discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered,
this, &BluetoothScanner::deviceDiscovered);
connect(_discoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished,
this, &BluetoothScanner::deviceScanFinished);
}
void StartScan()
{
_discoveryAgent->start();
}
private slots:
void deviceDiscovered(const QBluetoothDeviceInfo& device)
{
qDebug() << "New device:" << device.name()
<< "Device address: " << device.address();
}
void deviceScanFinished()
{
qDebug() << "Scan finished";
}
private:
QBluetoothDeviceDiscoveryAgent *_discoveryAgent;
};
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QBluetoothLocalDevice device;
if (!device.isValid())
{
qWarning() << "Whoops";
return -1;
}
device.powerOn();
BluetoothScanner scanner;
scanner.StartScan();
return a.exec();
}
Файл pro
:
QT += core bluetooth
CONFIG += c++17 cmdline
SOURCES += \
main.cpp
macos: QMAKE_INFO_PLIST = ../Info.qmake.macos.plist
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
Вывод приложения:
2024-10-21 10:48:50.587 Tbl4[1508:20200] -[IOBluetoothDeviceInquiry initWithDelegate:] - 0x600001ba4c30
qt.bluetooth.darwin: Manually interrupting IOBluetoothDeviceInquiry
New device: "" Device address: "00:00:00:00:00:00"
New device: "Apple watch" Device address: "00:00:00:00:00:00"
New device: "RK-G210S" Device address: "00:00:00:00:00:00"
New device: "RK-G210S" Device address: "00:00:00:00:00:00"
New device: "[TV] Samsung 7 Series (40)" Device address: "00:00:00:00:00:00"
Версия Qt: 6.8.0
Версия MacOs: 15.0.1