2

An iPhone running iOS7 is playing the manager role and it's connected to an electronic device that plays peripheral role, by [centralManager connectPeripheral:peripheral options:nil]

When I call [centralManager cancelPeripheralConnection:peripheral] didDisconnectPeripheral is always called, but SOMETIMES, not always, I know the electronic device is not really disconnected. The electronic device is not connected to any other apps.

Any idea?

allprog
  • 16,540
  • 9
  • 56
  • 97
Maria
  • 334
  • 3
  • 17

1 Answers1

0

There is a delay between the didDisconnectCallback then real disconnection. In iOS 6 it used to be several seconds, in iOS 7 it's less. The cancelPeripheralConnection is practically a signal to the OS that the app is not using the connection any more. Then it is up to the OS to decide when it really disconnects. You can circumvene this limitation by initiating the disconnection from the peripheral side.

allprog
  • 16,540
  • 9
  • 56
  • 97
  • Yes, I had just discovered myself. I takes around 7 seconds from connection in my case, but I had realized how Bluetooth icon at status bar turns gray when it is really disconnected. So it made sense to me that OS knew about disconnections somehow. – Maria Mar 05 '14 at 14:31