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?
Sorry, I was mistaken in my initial answer, so I've updated it now.
However, we only support two values now; BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION and BLE_HCI_CONN_INTERVAL_UNACCEPTABLE. No other reasons can currently be used by the application, and I'm not sure any other reasons would make sense either.