Hi Ram, I suggest you only scan for the device the first time. After connecting to it the first time, simply just try to connect to it using it's UUID instead of scan-discover-connect. Thanks, Joakim On Aug 29, 2012, at 10:37 PM, Ram Jayaraman <ram@milesense.com> wrote:
Hi Joakim,
Thanks for the reply. Much appreciated. I understand the below pointers about the BT api. The logic I use is scan forever, once a device is discovered stop scanning and connect to the device. Once the device disconnects, scan again. The retries to repeatedly connect is an aberration in my question [ please ignore it ]. The above loop of scan,connect,scan seems to cause a problem of no device being discovered unless I restart BT through the Settings app. Of course this is not a consistent problem, I have had it work for days before this happened but sometimes it will show up in hours during my development .
I am wondering if this is a known bug or are there anything I need to take special care about to avoid messing up the BT stack. I would also like to point out that the BTLE device I am using does follow the Apple Bluetooth guidelines for advertisement intervals and connection parameters.
Ram
On Aug 29, 2012, at 7:40 PM, Joakim Linde <joakim@apple.com> wrote:
Hi Ram,
Let me see if I can help you.
- While in background mode, you will see get notified once if a new device comes within range. - If you got that notification while the app was in the foreground you may not get any notification when the app enters the background. - Connection request "pend" forever and will not timeout (they can be cancelled) - No need to scan for the device every time - You simply can connect to the device without scanning for it if you have previously connected to or paired with the device using it's UUID.
For more info, please see the two WWDC2012 talks about Core Bluetooth.
Thanks, Joakim
On Aug 29, 2012, at 6:40 PM, Ram Jayaraman <ram@milesense.com> wrote:
I repeatedly face connection problems where the only way to discover a BTLE device which is constantly advertising is to turn On/Off Bluetooth in the iPhone through settings or in rare cases restart the phone itself. My app runs in the background and is scanning for devices with a specific list of services and it works most of the time. With one of the BTLE devices were using we had some reliability issues so I have retry logic which will repeatedly attempt to connect to a recently discovered UUID for a short while before giving up, Iam not sure if this behavior is messing up the stack.
Is there a way to debug the discovery issue or any recommended steps to ensure we are not messing with the state of the BTLE stack [ like not doing repeated connection attempts etc ] ?
Any help here would be much appreciated.
Ram
_______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/bluetooth-dev/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com