This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Disconnected peripheral reconnects direct in iOS.

Hi, Got stuck on an issue that has come and gone and then working fine, and are now back again.

I use a nrf51 module with the led-button-service example (sdk 5.2). It's not using bondmgr, just scan for known or recently connected peripherals. I modified the example to have 4 characteristics and to wakeup each 60 seconds to sample ADC values. In the timer event I call start advertise, which is set to 6 seconds. After update-notify two of the characteristics value I disconnect from iOS (stop notifyValue on chars and cancel connection). I am using the iOS connect functions to restore state and connectPeripheral so it get started even i background mode.

Is there anything obvious I am missing?, I can see that the peripheral reconnects direct after I cancelConnection in iOS, and the only clue I got is that it does that for the same amount of time I have set the Advertising inteval to, in this case 6s.

Does the softdevice still advertise for connection attempt after it has passed the connected state? I have tried to stop advertise sd_ble_gap_stop(), but then it will not connect next time.

Thanks in advance!

Parents
  • Just a follow up, Thinik it's odd, but resonable that iOS does what it does, not sure if disconnect and connect in a quick manner is possible only from cancelPeripheral. Reconnect to same peripheral object might just work properly when lost (peripheral disconn) connection since then iOS then is "aware" before fire didDisconnect, CoreBluetooth guide state that you should disconnect as soon as all advertise is disabled and connection not needed etc.

    Anyway I found a some minor bugs and learn some, now using a writeWithResonse where I set a single-shot timer and there do the exit after 200mS, seems to work fine for now, not using notify, only read characteristics direct after connecting.

    Run the sniffer, but that is really a detailed analysis tool, thanks to Nordic devkit usbdongle, thought I never gona use that..

Reply
  • Just a follow up, Thinik it's odd, but resonable that iOS does what it does, not sure if disconnect and connect in a quick manner is possible only from cancelPeripheral. Reconnect to same peripheral object might just work properly when lost (peripheral disconn) connection since then iOS then is "aware" before fire didDisconnect, CoreBluetooth guide state that you should disconnect as soon as all advertise is disabled and connection not needed etc.

    Anyway I found a some minor bugs and learn some, now using a writeWithResonse where I set a single-shot timer and there do the exit after 200mS, seems to work fine for now, not using notify, only read characteristics direct after connecting.

    Run the sniffer, but that is really a detailed analysis tool, thanks to Nordic devkit usbdongle, thought I never gona use that..

Children
No Data
Related