Hi Dialog,
I am testing bms project code with mobile app, BLE Scanner, and using RTT to monitor the code running. After passing the bonding procedure, I want to disconnect the communication with bonded device by pressing DISCONNECT of mobile app ,but found the code does not reach "case BLE_EVT_GAP_DISCONNECTED: " of bms_task. However, if I turn off bluetooth of cell phone, it takes about 30 seconds, the code will reach "case BLE_EVT_GAP_DISCONNECTED: " , then disconnect the communication finally.
Q1 : Is it possible to response the disconnection of the mobile app, Not until turn off the bluetooth of mobile phone ?
Q2: what the 30s timer is to let the code reach "case BLE_EVT_GAP_DISCONNECTED: " ? It seems not supervision timer, conn_params->sup_timeout ? because BLE_SUPERVISION_TMO_TO_MS(conn_params->sup_timeout) = 20000, not 30000.
Q3 what the purpose of timer, "conn_pause_peripheral", is in handle_evt_gap_connected( ) of bms project code ?
thanks for your help.
Hi nigelyang,
Regarding your first question, this depends on the user interface of the mobile phone application. It is expectable that it takes about 30 seconds since you turn off the Bluetooth of the mobile phone and after that the code reaches the BLE_EVT_GAP_DISCONNECTED. Be aware that the master send only once the disconnection or termination message, and if the slave did not receive it, it will not be sent again. The supervision timeout is 30 seconds and it is according to Bluetooth specifications. Please check the handle_evt_gap_connected() function and you will see that after 5000 ticks, the conn_pause_timer_cb() will be triggered. This function is used for updating connection parameters.
Thanks, PM_Dialog
Hi Dialog,
Following the first question, is there any way to let DA14681(bonded) know the disconnection from the mobile phone application? Because the code would not reach BLE_EVT_GAP_DISCONNECTED. if the mobile phone application is closed by user, no any response mechanism in SDK ? I need to know the point of no communication any more between central and peripheral side, then turn off power to save battery power.
thanks for your help
Hi nigelyang,
Your issue is related to the implementation of the mobile application and not to the SDK mechanism. As I have already mentioned in my previous post, the mobile application will send only once the disconnection or termination message and if the peripheral will not receive it, it will not be sent again. Could you please try to use the sniffer in order to make sure that the mobile applications sends a disconnection/termination message?
Thanks, PM_Dialog