LowEnergyScanner can't find any ble devices.
-
Hello.
I am trying to use Qt 5.15.2 LowEnergyScanner Example, but it can't find any devices.
Function startDeviceDiscovery() is running, but there is no call of Device::addDevice(const QBluetoothDeviceInfo &info) function.Also, my OS is windows 10, and it can find my ble devices (I am not pair it in time of running Qt example).
Also, I get some errors, but there are dont terminate application:
qrc:/assets/main.qml:147: TypeError: Cannot read property 'update' of null
qrc:/assets/main.qml:129: TypeError: Cannot read property 'devicesList' of null
qrc:/assets/main.qml:83: TypeError: Cannot read property 'devicesList' of null
qrc:/assets/main.qml:58: TypeError: Cannot read property 'state' of null
QML debugging is enabled. Only use this in a safe environment.TinyB was able to find my ble devices (on same laptop, but Linux OS).
Is there any advices?
-
In case if you need code:
void Device::startDeviceDiscovery()
{
qDeleteAll(devices);
devices.clear();
emit devicesUpdated();
std::cout << "11111" << std::endl;setUpdate("Scanning for devices ..."); //! [les-devicediscovery-2] discoveryAgent->start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod); //! [les-devicediscovery-2] if (discoveryAgent->isActive()) { std::cout << "2222" << std::endl; m_deviceScanState = true; Q_EMIT stateChanged(); }
}
//! [les-devicediscovery-3]
void Device::addDevice(const QBluetoothDeviceInfo &info)
{
std::cout << "3333" << std::endl;
if (info.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration)
setUpdate("Last device added: " + info.name());
} -
Hello.
I am trying to use Qt 5.15.2 LowEnergyScanner Example, but it can't find any devices.
Function startDeviceDiscovery() is running, but there is no call of Device::addDevice(const QBluetoothDeviceInfo &info) function.Also, my OS is windows 10, and it can find my ble devices (I am not pair it in time of running Qt example).
Also, I get some errors, but there are dont terminate application:
qrc:/assets/main.qml:147: TypeError: Cannot read property 'update' of null
qrc:/assets/main.qml:129: TypeError: Cannot read property 'devicesList' of null
qrc:/assets/main.qml:83: TypeError: Cannot read property 'devicesList' of null
qrc:/assets/main.qml:58: TypeError: Cannot read property 'state' of null
QML debugging is enabled. Only use this in a safe environment.TinyB was able to find my ble devices (on same laptop, but Linux OS).
Is there any advices?
@user7699 said in LowEnergyScanner can't find any ble devices.:
(I am not pair it in time of running Qt example).
IIRC, on Windows Qt is only able to discover paired devices.
An improved detection system is in the works, I'm not sure if it is available in Qt 5.15 yet, I think only through custom compilation of QtBluetooth with some special flags enabled.