No acknowledgement for Indication
See original GitHub issue- bleak version: 0.6.4
- Python version: 3.83
- Operating System: Windows 10
- BlueZ version (
bluetoothctl -v
) in case of Linux:
Description
I am trying to send indications from a BLE device (NRF52 Soc) to my python application. My initial solution used BLE Notifications, but a lot of packets were being dropped so I resorted to using indications. The BLeak Library doesn’t seem to be sending acknowledgments for received indications.
Is this acknowledgment of indications handled internally by the Bleak Library or do we need to implement this at the user application level? If so which function do we need to acknowlege notifications?
What I Did
This is a simple application that I am using to test this. The “test_read_data” function has a 15-second delay loop that waits for multiple packets from the BLE device. When I use notifications, I am able to receive multiple packets but some of them are dropped. But when I use indications, I am stuck at the first packet because the BLE Microcontroller never receives an acknowledgment for the indication.
def notify_callback(handle, value):
global result
global target_length
global recv_value
print(len(value))
print("Received data %s " % hexlify(value))
async def run(address, loop, debug=False):
global client
async with BleakClient(address, loop=loop) as client:
x = await client.is_connected()
print("Connected: {0}".format(x))
await client.start_notify(CHARACTERISTIC_UUID, notify_callback)
await test_read_data(0)
await asyncio.sleep(1.0, loop=loop)
await client.stop_notify(CHARACTERISTIC_UUID)
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Yea, I test with nrf_connect and the indications work as expected.
The problems described in the discussion should be resolved in version 0.8.0. The
bleak.exc.BleakDotNetTaskError: Could not get GATT services.
might still happen due to communication issues with device though.Will close this.