2

After connecting with CBPeripheral, it displays services & characteristics of peripheral, after few minutes it disconnects the peripheral without any user interaction. I want the continuous connection with device until user disconnects it.

I have used the demo: Fullband

Any help will be appreciated regarding the continuous connectivity with CBPeripheral.

piet.t
  • 11,718
  • 21
  • 43
  • 52
Dimple
  • 788
  • 1
  • 11
  • 27
  • Hi and welcome. You will need to edit your question to show relevant code and any relevant errors; for example, is `didDisconnect` being called? Do you get an error? Is the disconnect happening while your app is in the foreground or the background? Have you tried the Light Blue app from the store? Does it stay connected? – Paulw11 Aug 30 '18 at 11:44
  • Pleasure! Yes for code, demo link is added. No errors are found & yes didDisconnect is being called & in that err: The specified hostname disconnected from us. As said earlier after fetching service & characteristics , the device gets disconnected so itself in foreground. – Dimple Aug 30 '18 at 12:00
  • It heavily depends on Exterale Device. I used to work with models that disconnects after some time if something like password wasn't provided. Are you sure that your model isn't doing somethng similar? Of course check also battery, distance between devices and so on. – franiis Aug 30 '18 at 12:07
  • Noob question from my side: Isn't BLE intended to not be connected all the time as this would increase power drain significantly? – Geru Aug 30 '18 at 17:28
  • 1
    On SO we need the relevant code to be included in the question itself as external links can break. It also makes it easier to copy code into an answer. In this case, however, it seems that the device itself is causing the disconnect, probably to save battery power. Your code can simply call `connect` again when the peripheral disconnects – Paulw11 Aug 30 '18 at 18:15
  • @Paulw11 I have checked on LightBlue app, It is also disconnecting here with same time interval – Dimple Sep 04 '18 at 08:31

0 Answers0