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

PIN Code timeout event

Hi

I'm using the nrf51822 with Softdevice S110. I want to find out why a pairing has not worked, PIN-Code was wrong, PIN-Code timeout.

Which events I can use for that failures?

  • It isn't quite clear to me exactly what you need to know, but you can specify the timeout you want to use for pin entering in the timeout field of the ble_gap_sec_params_t structure. By setting this to for example 30 s, the link will be disconnected if the user doesn't enter the passkey on the peer device within 30 s.

    Edit: On second look, this is actually not correct, the softdevice will require this value to be 30 s, and you can not adjust it. I'm sorry for the confusion.

  • I want to know if there is an event (similar to BLE_GAP_EVT_CONNECTED) for the cases:

    • PIN code timeout
    • PIN code wrong ?
  • Sorry for the delay, but you will get a BLE_EVT_GAP_AUTH_STATUS event, with the auth_status field set to something else than BLE_GAP_SEC_STATUS_SUCCESS:

    • In the case of timeout, it will be set to BLE_GAP_SEC_STATUS_TIMEOUT.
    • In the case of wrong key entered, BLE_GAP_SEC_STATUS_CONFIRM_VALUE.
    • In the case of a cancel or too long or too short passkey, BLE_GAP_SEC_STATUS_PASSKEY_ENTRY_FAILED.

    The above was tested with an iPhone. Beware that there could be slight differences in the exact error codes used between different Centrals. MCP seems to for example use BLE_GAP_SEC_STATUS_PASSKEY_ENTRY_FAILED both for wrong key and wrong key format (i.e. too long or too short).

Related