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

Android pairing pop-up appears twice

I would like to establish bonding between my device and an android phone.

My device is acting as both a central and peripheral.  It functions in peripheral role in relation to the phone.  The mobile app is developed only for Android for now.

Application firmware is developed against SDK 16.

I am using peer_manager.  I call pm_init and pm_sec_params_set with

memset( &sec_param, 0, sizeof( ble_gap_sec_params_t ) );

// Security parameters to be used for all security procedures.
sec_param.bond = 1;
sec_param.mitm = 0;
sec_param.lesc = 1;
sec_param.keypress = 0;
sec_param.io_caps = BLE_GAP_IO_CAPS_NONE;
sec_param.oob = 0;
sec_param.min_key_size = 7;
sec_param.max_key_size = 16;
sec_param.kdist_own.enc = 1;
sec_param.kdist_own.id = 1;
sec_param.kdist_peer.enc = 1;
sec_param.kdist_peer.id = 1;

In the ble event handler for BLE_GAP_EVT_CONNECTED, I call

ble_gap_evt_t const *p_gap_evt = &pEvt->evt.gap_evt;

 pm_conn_secure( p_gap_evt->conn_handle, false );

( I have also tested using pm_handler_secure_on_connection with PM_HANDLER_SEC_DELAY_MS set to 75 and 500 mS )

I am NOTcalling pm_conn_sec_prams_reply at all.

I am calling pm_conn_sec_config_reply with allow_repairing = false

The problem I'm encountering is that the pairing pop-up is appearing twice to the user.  Is there a way to change the connection sequence so this pop-up only occurs 1 time?

Parents
  • Here are logs while using pm_handler_secure_on_connection with a delay of 75 ms

    [00:00:03.515,000] <info> app: phone connected. conn_handle: 0x1
    [00:00:03.572,000] <info> app: ATT mtu_central=247 mtu_peripheral=247
    [00:00:03.590,000] <info> app: PM security params requested
    [00:00:03.752,000] <info> app: ATT mtu_central=247 mtu_peripheral=247
    [00:00:03.752,000] <info> app: phone Data len: tx_octets=251 rx_octets=27 tx_uS=2120 rx_uS=328
    [00:00:04.158,000] <info> app: phone Conn intvl: min=6 max=6
    [00:00:04.964,000] <info> app: phone Conn intvl: min=36 max=36
    [00:00:06.992,000] <info> app: PM security params requested
    [00:00:06.993,000] <info> app: phone security param request
    [00:00:07.284,000] <info> nrf_ble_lesc: Calling sd_ble_gap_lesc_dhkey_reply on conn_handle: 1
    [00:00:09.423,000] <info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 1, procedure: Bonding
    [00:00:09.423,000] <info> app: PM secured connection
    [00:00:09.426,000] <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Bonding data, action: Update
    [00:00:09.429,000] <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Peer rank, action: Update
    [00:00:09.432,000] <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Local database, action: Update

Reply
  • Here are logs while using pm_handler_secure_on_connection with a delay of 75 ms

    [00:00:03.515,000] <info> app: phone connected. conn_handle: 0x1
    [00:00:03.572,000] <info> app: ATT mtu_central=247 mtu_peripheral=247
    [00:00:03.590,000] <info> app: PM security params requested
    [00:00:03.752,000] <info> app: ATT mtu_central=247 mtu_peripheral=247
    [00:00:03.752,000] <info> app: phone Data len: tx_octets=251 rx_octets=27 tx_uS=2120 rx_uS=328
    [00:00:04.158,000] <info> app: phone Conn intvl: min=6 max=6
    [00:00:04.964,000] <info> app: phone Conn intvl: min=36 max=36
    [00:00:06.992,000] <info> app: PM security params requested
    [00:00:06.993,000] <info> app: phone security param request
    [00:00:07.284,000] <info> nrf_ble_lesc: Calling sd_ble_gap_lesc_dhkey_reply on conn_handle: 1
    [00:00:09.423,000] <info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 1, procedure: Bonding
    [00:00:09.423,000] <info> app: PM secured connection
    [00:00:09.426,000] <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Bonding data, action: Update
    [00:00:09.429,000] <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Peer rank, action: Update
    [00:00:09.432,000] <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Local database, action: Update

Children
No Data
Related