Cannot receive data from ble 5.2 using QLowEnergyService ?
-
Hi,
I am developing an android app using Qt 5.12.3, android-26, jdk1.8.0_211, and NDK Version: 19.2.5345600.
The app works as follow :- First, it sends data using QLowEnergyService and the function writeCharacteristic.
- Then, it receives character 'O' from the peripheral ble, using a SLOT that is connected to the signal characteristicChanged(QLowEnergyCharacteristic,QByteArray).
The app works fine when it is used with the ble module HM-11 which uses ble version 4.0.
When I use the new ble module BC805M which uses ble version 5.2, the app sends data successfully. However, It cannot be notified when the BC805M sends 'O' character (an MCU sends 'O' for BC805M through its UART) . After debugging my code, I noticed that the slot that is connected to signal characteristicChanged(QLowEnergyCharacteristic,QByteArray) is never called in my app, although I enabled notification using the code:
if(c.properties() & QLowEnergyCharacteristic::Notify)
{
m_notificationDesc = c.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration);
if (m_notificationDesc.isValid())
{
BLE_service->writeDescriptor(m_notificationDesc, QByteArray::fromHex("0100"));
}
}Why my app cannot be notified when the ble 5.2 module sends data to my app?
Below is the custom service of ble module BC805M that I used.
-
I don't have an answer, but I do have a small hint: try it out on several different Android phones. In my experience, BLE support varies wildly between different phones. There are always weird edge-cases, often even with "official" devices like Pixel phones.