This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

HID Keyboard Example reconnect and disconnect issues

Hello,

With regards to the HID Keyboard Example,

1) Is it posible to disconnect from the central side (ios)? I would like to be able to disconnect as follows:

But when I run the HID keyboard example I'm only able to Forget the Device as shown below. Is there a way to do this?

2) I allowed repairing by adding the following to the pm_event_handler: 

case PM_EVT_CONN_SEC_CONFIG_REQ:
    NRF_LOG_INFO("CONN_SEC_REQ is called");
    conn_sec_config.allow_repairing = true;
    pm_conn_sec_config_reply(p_evt->conn_handle, &conn_sec_config);
    break;

However, when I manually disconnect from the peripheral side as follows, 

if (m_conn_handle != BLE_CONN_HANDLE_INVALID) {  
        err_code = sd_ble_gap_disconnect(m_conn_handle,
                                         BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
        APP_ERROR_CHECK(err_code);
}

The device automatically reconnects which is an undesired behavior since the reason I'm manually disconnecting is to be able to advertise and pair to other phones. I still want automatic reconnection on boot up or when the device goes out of range and comes back in range. What is a good way to accomplish this?

Best,

Ricky

Related