Hello, we are using the ble_app_uart example code, and are trying to modify it so that if a certain UART sequence is received from the connected microcontroller, it will disconnect the connected BLE peripheral.
What I've done is scan incoming UART data for the "[DISCONNECT]" sequence, and when this occurs I call the sd_ble_disconnect command as below.
Should this work? And should it generate a BLE_GAP_EVT_DISCONNECTED event in my ble_evt_handler? (Asking this last part because I need to do some cleanup on disconnect.)
Thanks!
sd_ble_gap_disconnect(m_conn_handle, 0); (where the m_conn_handle is set on connection with) m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;