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

how to connected a new devices when i have bonded one

my steps:

  1. power on mouse
  2. connected to a smartTV android (A)
  3. pressed pairing button
  4. can't find mouse in smartTV B

the project based on desktop2/mouse sdk desktop2 v2.1.1 softdevice s110 6.0.0

i think it's direct mode so i change my code like this

uint32_t m_coms_ble_adv_bond_adv_start(uint16_t p_conn_handle) { uint32_t err_code;

// New bonds are accepted when advertising is started again
s_state.params.bond_initiate      = true;
s_state.params.directed_adv_count = 0;

if (p_conn_handle != BLE_CONN_HANDLE_INVALID)
{
    // Disconnect. Disconnected event will trigger advertising
    err_code = sd_ble_gap_disconnect(p_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
    if (err_code == NRF_ERROR_INVALID_STATE)
    {
        // Not connected, or have already started disconnection procedure
        err_code = NRF_SUCCESS;
    }
}
else
{
    // Not connected; can start advertising right away
    err_code                               = sd_ble_gap_adv_stop();
    // Ignoring potential NRF_ERROR_INVALID_STATE error.
    
   s_state.params.advertising_running = false;
   s_state.type                       = ADV_STATE_UNDIRECTED_BONDABLE;
   
    if (!m_coms_ble_adv_determine(0))
    {
        // advertising_determine() should always return true in this case
        return NRF_ERROR_INTERNAL;
    }
    err_code = m_coms_ble_adv_start();
}

return err_code;

}

but is't not work.

what can i do?

Parents Reply Children
No Data
Related