Connect to BLE end get data fo services
-
-
@jsulm said in Connect to BLE end get data fo services:
@Mihaill Start here https://doc.qt.io/qt-6/qtbluetooth-le-overview.html
I can connected to device usin QLowEnergyService m_lowEnergyService, but cant create QLowEnergyService
It is not workm_lowEnergyService = m_lowEnergyController->createServiceObject( QBluetoothUuid("{99999999-9999-c8c8-c8c8-d2d2d22d2d2d}"));
Whot me need do?
-
@Mihaill said in Connect to BLE end get data fo services:
It is not work
What does this mean please? What happens? Did you also use https://doc.qt.io/qt-6/qlowenergycontroller.html#error to see whether any error occurred?
And according to the documentation: "The serviceUuid parameter must have been obtained via services()" (https://doc.qt.io/qt-6/qlowenergycontroller.html#createServiceObject). You seem to be passing uuid directly... -
@jsulm said in Connect to BLE end get data fo services:
Did you also use https://doc.qt.io/qt-6/qlowenergycontroller.html#error to see whether any error occurred?
If I use this
m_lowEnergyService->error();
then my programm falling annd not run this code.
I get uuid serveci from QBluetoothDeviceInfo -
@Mihaill said in Connect to BLE end get data fo services:
then my programm falling annd not run this code.
Well, I guess because m_lowEnergyService is a null pointer.
But I wrote: https://doc.qt.io/qt-6/qlowenergycontroller.html#error (controller != service)... -
@jsulm said in Connect to BLE end get data fo services:
Well, I guess because m_lowEnergyService is a null pointer.
But I wrote: https://doc.qt.io/qt-6/qlowenergycontroller.html#error (controller != service)...Yes, m_lowEnergyService is a null pointer.Controller error: QLowEnergyController::NoError
-
@Mihaill Did you also address this:
And according to the documentation: "The serviceUuid parameter must have been obtained via services()" (https://doc.qt.io/qt-6/qlowenergycontroller.html#createServiceObject). You seem to be passing uuid directly... -
@jsulm said in Connect to BLE end get data fo services:
been obtained via services()
I get uuid form QBluetoothDeviceInfofor(auto serviceUuid : device.serviceUuids()) { if (serviceUuid.toString() == "{99999999-9999-c8c8-c8c8-d2d2d22d2d2d}"){ m_bluetoothUuidService = serviceUuid;
and run this
m_lowEnergyService = m_lowEnergyController->createServiceObject(m_bluetoothUuidService);
but it's too not work
-
@Mihaill
Your latest code showsm_bluetoothUuidService
being set if a certainserviceUuid
is found. But we do not know whether it was found, and therefore whetherm_bluetoothUuidService
is set correspondingly. Why don't you put appropriateqDebug()
statements into your code so you & we know for sure?