8 years, 2 months ago.

Newbie, GATT communication question

Hi,

This is the first BLE app I'm writing (Android), so I would be happy to get some feedback. Basically, I have a peripheral device that accumulates data over some time, during which the central client may not be around to receive it. Then, at some point, I want to transfer all the data from the peripheral server to the client. What is the optimal way to do this? Here is what I had thought about so far:

Option A: The client writes to a second characteristic, indicating it wants to read. Upon onDataWritten, I update the first characteristic with one of the values. I repeat this until there is no more data, and upon that, send an "empty" data packet message so the client knows to stop requesting more data.

Option B: Assuming that my data can fit within a single BLE packet, I can try to catch onDataRead (https://developer.mbed.org/questions/4224/onDataRead-callback-like-onDataWritten/), and for every attempt, send back a new piece of data. However ,this looks slightly more complicated.

Any other recommendations? I don't need to transfer huge amounts of data. Probably a few Kb. Speed is not a big concern.

Thanks,

Shay

Be the first to answer this question.