what's the detail difference between BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION and BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION?
what's the detail difference between BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION and BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION?
When you pass a disconnect reason, you should always use what you want the peer device to see. This means that when you disconnect from your side, you should pass BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION. However, when you then get the disconnect event, you'll see that it has the BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION reason, as seen by the link layer.
The same can be seen if you do a disconnect from MCP. In the disconnected event on the nRF51 side, you'll see BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION as reason, but if you look in MCP's log pane, you'll see BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION.
Edit: Complete rewrite, as my initial answer was plain wrong.
Could the 2nd arg of sd_ble_gap_disconnect() be any value? what is the difference between it and the return value of ble disconnecting event?
Could the 2nd arg of sd_ble_gap_disconnect() be any value? what is the difference between it and the return value of ble disconnecting event?