Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to restart iPHone/iPad Bluetooth LE after communication hangs

What is the best way to COMPLETELY restart the iOS Bluetooth BTLE central and peripheral managers, after communication stops between two iOS devices (iPad-mini)?

Sometimes after a few minutes, my BTLE communication stops (central can not get response from peripheral, though debug output of each device shows app still running and central app still is trying to scan peripheral, and peripheral is still advertising), and will not start again: after stopping scanning and stopping advertising, comm still doesn't work; after re-opening the app, comm still doesn't work(!); after POWER CYCLING the iPads comm works again, but then after a few minutes dies.

Therefore, something I'm doing is clobbering maybe the iOS core Bluetooth software.

Sometimes there are error messages from the underlying BTLE layer.

BACKGROUND: Each iPad in this system alternately works as central, to read/write data to others, and then as peripheral, to be read by others. Never at the same time, and with a 1 second delay between transistions.

like image 395
Doug Null Avatar asked Oct 04 '22 03:10

Doug Null


1 Answers

The bluetooth stack is not the most robust part of iOS. This may have improved in iOS7 but issues have always existed. You most probably are stressing the system so that this hang happens more often. You should create a bug report and send it to Apple. Or create a TSI, as a developer you have two of those every year. They are the only ones who can do something about it.

To solve the issue, restarting the app usually helps but sometimes bluetooth needs to be turned on/off or worst case the device needs to be power cycled. Unfortunately, there is not programmatic way to do any of these.

like image 177
allprog Avatar answered Oct 10 '22 02:10

allprog