Android: BLE how to read multiple Characteristics?
Pseudocode:
Use a FIFO Queue or Priority Queue depends upon your business logic
insert all the characteristics you want to read
call your requestCharacteristics method so that it can start consuming your Queue
from your
onCharacteristicsRead
call see if the size of the queue is greater than Zero requests one more.. be sure topeek()
from herenow on your requestCharacteristics method do the
poll()
and request BLE GATT for characteristics.
You might have discovered it yourself already, but it might be useful for others.
I didn't understand if that so why they made methods Async.
They probably did it because sending a read-request to another device in synchronous execution would mean you cannot do anything with your app until an answer is received. By making it Async you can do other stuff, but no other bluetooth requests.
Possible Solution #6: try the Task feature provided by https://github.com/BoltsFramework/Bolts-Android :-)