1

My goal is this: I have a bunch of sensors out in a field connected in a sort of P2P network. On one side of the field I have a device that provides a BLE server to bridge data between a controller (phone or laptop) and all the devices out in the field.

One of the requirements is a sort of network visualization and management service. The gotcha with this is that there are a variable number of devices out in the field.

I have a plan to have the bridge device send a broadcast out to the network to get all the devices connected. My only problem is that I'm relatively new to BLE and GATT in general and I'm not certain what the standard is for showing a list of data with a dynamic length.

Is there such a standard? Do any of you have any tips to help me wrap my head around how to organize this into a GATT?

Thanks for your help

grandpa_sam
  • 119
  • 6

1 Answers1

1

To the best of my knowledge, BLE and GATT don't have any best practice or pattern that would fit your requirement. So you have to roll your own.

An option would be to implement a request–response protocol: The controller sends a request to the BLE server (e.g. requesting the data for sensor 17) and the server responds with the data.

In GATT terms, the server provides a service with two characteristics:

  1. The request characteristic (writable)

  2. The response characteristic (readable with notifications)

For communication with the server, the controller connects to the server and activates notifications for the response characteristics. Then it writes the request to the request characteristic and waits for an update on the response characteristic.

As BLE has a low bandwidth, you should use a compact, binary protocol (and not JSON or XML).

Codo
  • 75,595
  • 17
  • 168
  • 206
  • I've searched a lot before finding your answer that helps me a lot. GATT is not API-oriented. Lot of developer would like to have a method with parameter(s) and a result but this kind of "method" is not obvious witj GATT BLE out-of-the-box. I read a lot of documentation talking about handles, characteristics, descriptors but I didn't find any official documentation, good practices or guidelines explaining how to create this kind of method from read characteristic + notification from another characteristic. Can anyone point me out any web documentation talking about this? Thanks, – Romain DEQUIDT Jan 05 '21 at 21:53