advertisements seen while trying to connect
advertisements seen while trying to connect
- Subject: advertisements seen while trying to connect
- From: Rogers George <email@hidden>
- Date: Fri, 17 May 2019 15:07:54 -0500
I want to make sure this is normal, expected behavior, and I'm mitigating it
properly.
Our app connects to a Cypress PSoC-4 based peripheral.
Normally, when our device advertises, we see:
our CBCentralManager calls our delegate's centralManager(_ central:,
didDiscover peripheral:, advertisementData, rssi RSSI:);
we call connect(peripheral) if appropriate;
and eventually our delegate gets a call to centralManager(_ central:,didConnect
peripheral:).
All as expected, well and good.
But.
From time to time, our peripheral would be powered on, in range, the
corresponding CBPeripheral would be in the .connecting state, app in
foreground... and no connection would happen. Sometimes after waiting several
minutes it would connect, sometimes not.
Turning bluetooth off and on (using airplane mode, so bluetooth really did get
turned all the way off) always resulted in immediate connection success.
Adding the CBCentralManagerScanOptionAllowDuplicatesKey to our scanning
confirmed that the delegate was still getting repeated calls to the didDiscover
method.
Thus, our mitigation: when we see advertisements for a peripheral that we're
trying to connect to, if we see more than six in 1 minute with the peripheral
still in .connecting state, we cancel and retry the connection attempt. This
seems to mostly work.
We also log an event to Crashlytics, where we see that this is happening to 20%
of our customers!
Is this right? Is this how Core Bluetooth is expected to behave? Is there
something I could be doing differently, or a better mitigation strategy?
We've seen this on all iOS since 9.
(I've asked about this before, am trying for less verbosity this time)
-- R.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden