@@ -661,21 +661,55 @@ typedef struct {
661661 esp_bt_octet16_t oob_r ; /*!< the 128 bits of randomizer value */
662662} esp_ble_local_oob_data_t ;
663663
664+ /**
665+ * @brief Definition of the authentication failed reason
666+ */
667+ typedef enum {
668+ // Failure reason defined in Bluetooth Core Spec 5.0 Vol3, Part H, 3.5.5
669+ ESP_AUTH_SMP_PASSKEY_FAIL = 78 , /*!< The user input of passkey failed */
670+ ESP_AUTH_SMP_OOB_FAIL , /*!< The OOB data is not available */
671+ ESP_AUTH_SMP_PAIR_AUTH_FAIL , /*!< The authentication requirements cannot be met */
672+ ESP_AUTH_SMP_CONFIRM_VALUE_FAIL , /*!< The confirm value does not match the calculated comparison value */
673+ ESP_AUTH_SMP_PAIR_NOT_SUPPORT , /*!< Pairing is not supported by the device */
674+ ESP_AUTH_SMP_ENC_KEY_SIZE , /*!< The resultant encryption key size is not long enough */
675+ ESP_AUTH_SMP_INVALID_CMD , /*!< The SMP command received is not supported by this device */
676+ ESP_AUTH_SMP_UNKNOWN_ERR , /*!< Pairing failed due to an unspecified reason */
677+ ESP_AUTH_SMP_REPEATED_ATTEMPT , /*!< Pairing or authentication procedure is disallowed */
678+ ESP_AUTH_SMP_INVALID_PARAMETERS , /*!< The command length is invalid or that a parameter is outside the specified range */
679+ ESP_AUTH_SMP_DHKEY_CHK_FAIL , /*!< The DHKey Check value received doesn’t match the one calculated by the local device */
680+ ESP_AUTH_SMP_NUM_COMP_FAIL , /*!< The confirm values in the numeric comparison protocol do not match */
681+ ESP_AUTH_SMP_BR_PARING_IN_PROGR , /*!< Pairing Request sent over the BR/EDR transport is in progress */
682+ ESP_AUTH_SMP_XTRANS_DERIVE_NOT_ALLOW , /*!< The BR/EDR Link Key or BLE LTK cannot be used to derive */
683+
684+ // Failure reason defined in Bluedroid Host
685+ ESP_AUTH_SMP_INTERNAL_ERR , /*!< Internal error in pairing procedure */
686+ ESP_AUTH_SMP_UNKNOWN_IO , /*!< Unknown IO capability, unable to decide association model */
687+ ESP_AUTH_SMP_INIT_FAIL , /*!< SMP pairing initiation failed */
688+ ESP_AUTH_SMP_CONFIRM_FAIL , /*!< The confirm value does not match */
689+ ESP_AUTH_SMP_BUSY , /*!< Pending security request on going */
690+ ESP_AUTH_SMP_ENC_FAIL , /*!< The Controller failed to start encryption */
691+ ESP_AUTH_SMP_STARTED , /*!< SMP pairing process started */
692+ ESP_AUTH_SMP_RSP_TIMEOUT , /*!< Security Manager timeout due to no SMP command being received */
693+ ESP_AUTH_SMP_DIV_NOT_AVAIL , /*!< Encrypted Diversifier value not available */
694+ ESP_AUTH_SMP_UNSPEC_ERR , /*!< Unspecified failed reason */
695+ ESP_AUTH_SMP_CONN_TOUT , /*!< Pairing process failed due to connection timeout */
696+ } esp_ble_auth_fail_rsn_t ;
697+
664698/**
665699 * @brief Structure associated with ESP_AUTH_CMPL_EVT
666700 */
667701typedef struct
668702{
669- esp_bd_addr_t bd_addr ; /*!< BD address peer device. */
670- bool key_present ; /*!< Valid link key value in key element */
671- esp_link_key key ; /*!< Link key associated with peer device. */
672- uint8_t key_type ; /*!< The type of Link Key */
673- bool success ; /*!< TRUE of authentication succeeded, FALSE if failed. */
674- uint8_t fail_reason ; /*!< The HCI reason/error code for when success=FALSE */
675- esp_ble_addr_type_t addr_type ; /*!< Peer device address type */
676- esp_bt_dev_type_t dev_type ; /*!< Device type */
677- esp_ble_auth_req_t auth_mode ; /*!< authentication mode */
678- } esp_ble_auth_cmpl_t ; /*!< The ble authentication complete cb type */
703+ esp_bd_addr_t bd_addr ; /*!< BD address of peer device */
704+ bool key_present ; /*!< True if the link key value is valid; false otherwise */
705+ esp_link_key key ; /*!< Link key associated with peer device */
706+ uint8_t key_type ; /*!< The type of link key */
707+ bool success ; /*!< True if authentication succeeded; false otherwise */
708+ esp_ble_auth_fail_rsn_t fail_reason ; /*!< The HCI reason/error code for failure when success is false */
709+ esp_ble_addr_type_t addr_type ; /*!< Peer device address type */
710+ esp_bt_dev_type_t dev_type ; /*!< Device type */
711+ esp_ble_auth_req_t auth_mode ; /*!< Authentication mode */
712+ } esp_ble_auth_cmpl_t ; /*!< The ble authentication complete cb type */
679713
680714/**
681715 * @brief union associated with ble security
0 commit comments