question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
uched41commented, Jun 20, 2020

Yea, I test with nrf_connect and the indications work as expected.

0reactions
hbldhcommented, Sep 25, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the difference between an Indication and a Notification?
A Notification is an unacknowledged message or update while an Indication is an acknowledged message or update.
Read more >
Acknowledging BLE Notifications and Indications - TI E2E
The BLE specification says that Indications are acknowledged by the GATT layer, while Notifications are not. It also says, (see e.g. TI and ......
Read more >
Difference between Notification and Indication - Nordic Q&A
Hello, I have a query on Ack for Notification and Indication. ... does not mean there won't be any Acknowledgement from other device....
Read more >
How to know if BLE indicate was acknowledged in Android
Unfortunately on Android, the acknowledgement is sent/received behind the ... Handling indications instead of notifications in Android BLE.
Read more >
Indications and Notifications | IoT Projects with Bluetooth Low ...
Indications: They need to be acknowledged by the client. The server does not send the next indication until it gets the acknowledgement back...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found