Is there any B4A example code of how to scan for BLE devices and manually select one of several candidates?
I have problems with this. Each time a new device is found I ask the user in a dialog if the current name is the desired. (Using "Wait for" user reply ...)
If "yes" then I stop scanning and connect to the candidate, but if "no" I simply continue waiting for a new desired candidate to show up.
The problem is that scanning either seem to stop or the desired candidate never shows up.
I feel, from observing the log, that delaying the thread by "Wait for user..." will corrupt the timing.
My conclusion is that the right way would be to buffer the discoveries in a queue and let the scanning go on until the right candidate can be seen in that queue. Preferably from a different thread?
I suppose this is a rather common task in all BLE apps, so the answer should have some interest...
I belive that it would be better to get a code snippet for this rather than help solving my shortcomings
I am quite new to B4x so I need some help here.
Thanks
I have problems with this. Each time a new device is found I ask the user in a dialog if the current name is the desired. (Using "Wait for" user reply ...)
If "yes" then I stop scanning and connect to the candidate, but if "no" I simply continue waiting for a new desired candidate to show up.
The problem is that scanning either seem to stop or the desired candidate never shows up.
I feel, from observing the log, that delaying the thread by "Wait for user..." will corrupt the timing.
My conclusion is that the right way would be to buffer the discoveries in a queue and let the scanning go on until the right candidate can be seen in that queue. Preferably from a different thread?
I suppose this is a rather common task in all BLE apps, so the answer should have some interest...
I belive that it would be better to get a code snippet for this rather than help solving my shortcomings
I am quite new to B4x so I need some help here.
Thanks