arduino nano ble sense with mbed has bug in bluetooth disconnection

hi

i have recently started experimenting with the nano ble sense board using mbed os. I could flash the temperature measurement example and could read from my ios phone. When i leave the phone alone and it sleeps, it will get disconnected from the phone side, and when the phone get back on, it can not receive push data anymore, let try to disconnect from the phone and try to reconnect again from the phone application, it will not be able to reconnect again.

The bug is in on the Arduino side, it does not detect if the phone is still alive or slept for automatic disconnecting the connection on the Arduino side. Unfortunately, i don’t have a debugger to debug it.

Anybody faced this issue?
how did you solve it?

thank you

can you provide the GitHub link to “the temperature measurement example” you are referring to?

I don't have a direct link to the example project on GitHub, but please install platformio in visual studio and start it by choosing projects for the nano ble sense Arduino board, there are examples available among which the temperature measurement project. Pay attention if you download platformio with Qt Creator, this example is not available.

Also note that the Arduino project has 2 Arduino header files, one without using mbedos and the other with using mbedos. I can not attach a screenshot (no attachment button here), please use the mbed-rtos-ble-thermometer project.

I added the screenshot here Bug in the bluetooth example mbed-rtos-thermometer - Bugs - Arm Mbed OS support forum

I think this is the link of the project, plese define the board and include the Arduino header and compile it.
https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-ble-Thermometer/

but please install platformio in visual studio and start it by choosing projects for the nano ble sense

err no, you are asking too much.

Please read this:-
How to get the best out of this forum It will tell you how to ask a question here.

sherrif:
please install platformio in visual studio

I’m on a Mac and don’t use visual studio…

please download the example from github published above or download vs and the plugin to have it prepared automatically. I am also on mac and i use qt creator for development.

Well this is not Arduino code is it, and what does it say this forum is called? Your request leaves a lot to be desired, did you read the link I sent you?

Anyway:-
It is not a bug, it is just how the program is written.
If you want this to stop happening then you have to look and see if the connection is up before each reading.

If it is not up then you need to fall back into the advertising and matching mode before trying to take the next reading.

Note as well that iOS has a pretty (privacy friendly) strong stance on maintaining BT connexion once screen is locked of application falls in the background. It is possible that the BTLE client you are using on iOS does not implement all the strategies described in Core Bluetooth Background Processing for iOS Apps. (see the part on “State Preservation and Restoration”)

Performing Long-Term Actions in the Background

Some apps may need to use the Core Bluetooth framework to perform long-term actions in the background. As an example, imagine you are developing a home security app for an iOS device that communicates with a door lock (equipped with Bluetooth low energy technology). The app and the lock interact to automatically lock the door when the user leaves home and unlock the door when the user returns—all while the app is in the background. When the user leaves home, the iOS device may eventually become out of range of the lock, causing the connection to the lock to be lost. At this point, the app can simply call the connectPeripheral:options: method of the CBCentralManager class, and because connection requests do not time out, the iOS device will reconnect when the user returns home.

Now imagine that the user is away from home for a few days. If the app is terminated by the system while the user is away, the app will not be able to reconnect to the lock when the user returns home, and the user may not be able to unlock the door. For apps like these, it is critical to be able to continue using Core Bluetooth to perform long-term actions, such as monitoring active and pending connections.

State Preservation and Restoration
Because state preservation and restoration is built in to Core Bluetooth, your app can opt in to this feature to ask the system to preserve the state of your app’s central and peripheral managers and to continue performing certain Bluetooth-related tasks on their behalf, even when your app is no longer running. When one of these tasks completes, the system relaunches your app into the background and gives your app the opportunity to restore its state and to handle the event appropriately. In the case of the home security app described above, the system would monitor the connection request, and re-relaunch the app to handle the centralManager:didConnectPeripheral: delegate callback when the user returned home and the connection request completed.