Bluetooth: SMP: Add pairing failed reason

Forward the pairing failed SMP status code to the application

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2019-07-03 13:46:03 +02:00 committed by Carles Cufí
commit 1fb68828ef
5 changed files with 72 additions and 9 deletions

View file

@ -323,6 +323,35 @@ int bt_conn_security(struct bt_conn *conn, bt_security_t sec);
*/
u8_t bt_conn_enc_key_size(struct bt_conn *conn);
enum bt_security_err {
/** Security procedure successful. */
BT_SECURITY_ERR_SUCCESS,
/** Authentication failed. */
BT_SECURITY_ERR_AUTHENTICATION_FAIL,
/** PIN or encryption key is missing. */
BT_SECURITY_ERR_PIN_OR_KEY_MISSING,
/** OOB data is not available. */
BT_SECURITY_ERR_OOB_NOT_AVAILABLE,
/** The requested security level could not be reached. */
BT_SECURITY_ERR_AUTHENTICATION_REQUIREMENT,
/** Pairing is not supported */
BT_SECURITY_ERR_PAIR_NOT_SUPPORTED,
/** Pairing is not allowed. */
BT_SECURITY_ERR_PAIR_NOT_ALLOWED,
/** Invalid parameters. */
BT_SECURITY_ERR_INVALID_PARAM,
/** Pairing failed but the exact reason could not be specified. */
BT_SECURITY_ERR_UNSPECIFIED,
};
/** @brief Connection callback structure.
*
* This structure is used for tracking the state of a connection.
@ -698,8 +727,10 @@ struct bt_conn_auth_cb {
/** @brief notify that pairing process has failed.
*
* @param conn Connection object.
* @param reason Pairing failed reason
*/
void (*pairing_failed)(struct bt_conn *conn);
void (*pairing_failed)(struct bt_conn *conn,
enum bt_security_err reason);
};
/** @brief Register authentication callbacks.