This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How do I send a long notification with Bluez, example?

I need to send a long (let's say 10Kb) notification from Bluez 5.37 on my Linux device to a mobile phone.

My implementation is based on src/shared/gatt-server.c.

I cannot see a good example of this in Bluez. src/shared/gatt-server.c, bt_gatt_server_send_notification is strictly trimming the packet to MTU-1 and discards the rest.

  1. Is there a way to send a long notification compatible with majority of Bluetooth 4.0 Android phones? It requires a bit of collaboration on the phone side - sending a ATT_READ_BLOB_REQUESTS, AFAIS.
  2. Or is there a good packetization library that will work over 20-byte-sized packets?
  3. Another way I can think of is to create another characteristic, use Notification messages for short messages and, er, notifications that "Hey, there's a long message, read it from that characteristic".

Which way is better? Does an example of any of the three ways exist?

Related