Yes, I see this fairly frequently. I’m also using a Nordic chip, but it’s an nRF51822. I’ve added code that sees this disconnect and retries, but its’a real pain, and I assume that it’s caused by some timing issue between Core Bluetooth and the device. Don On 2/7/15, 3:00 PM, "bluetooth-dev-request@lists.apple.com" <bluetooth-dev-request@lists.apple.com> wrote:
Date: Fri, 06 Feb 2015 16:35:16 -0600 From: Justin Cooper <jcooper@vendwatchtelematics.com> To: "bluetooth-dev@lists.apple.com" <bluetooth-dev@lists.apple.com> Subject: peripheral disconnects when discovering services Message-ID: <CAOkf_k-D5hsGYY1t1VdLb7ADZNwU0=6LvBJyATcM-EqOodj=6Q@mail.gmail.com> Content-Type: text/plain; charset="utf-8"
Hello!
I am having an intermittent issue, where I get an unexpected disconnect from our hardware peripheral (which uses the Nordic nrf8001 chip) about 1 out of 20 times.
The disconnect always happens at exactly the same place. Here is my connection sequence:
-
central.scanForPeripheralsWithServices([serviceUUIDUART], options: nil) -
didDiscoverPeripheral -> look for matching name in advertisementData, if found continue with: -
store a reference to peripheral as myPeripheral -
central.connectPeripheral(peripheral, options: nil) -
central.stopScan() -
wait for didConnectPeripheral then call myPeripheral?.discoverServices([ serviceUUIDUART])
Right here is where it fails, again about 1 out of 20 times.
I've posted my debug output log and the error code I receive in didDisconnectPeripheral.
This test is running in a loop, by the way, where we connect, discover services, send and receive data, then disconnect. Then we wait for, say, 6 second and start the loop over.
Has anyone else seen errors like this when connecting?
*Found Peripheral 50000 <__NSConcreteUUID 0x1742250a0> 36DC3DDA-9384-D02F-BF95-12527501BB86*
*connected to peripheral <CBPeripheral: 0x1700f0d00, identifier = 36DC3DDA-9384-D02F-BF95-12527501BB86, name = 50000, state = connected>*
*my peripheral is <CBPeripheral: 0x1700f0d00, identifier = 36DC3DDA-9384-D02F-BF95-12527501BB86, name = 50000, state = connected>*
*going to discover services for Snail and VIU*
*disconnected from peripheral <CBPeripheral: 0x1700f0d00, identifier = 36DC3DDA-9384-D02F-BF95-12527501BB86, name = 50000, state = disconnected> for reasons Error Domain=CBErrorDomain Code=10 "The connection has failed unexpectedly." UserInfo=0x17426f980 {NSLocalizedDescription=The connection has failed unexpectedly.}*
Thanks!
*Justin*
_______________________________________________ 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