Bluetooth: Mark bt_<type>_err_to_str() APIs experimental

It was pointed out in a future PR that they should have
a corresponding experimental Kconfig entry.

See PR #73795.

This updates the APIs added in PR #73826 and PR #74295.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
This commit is contained in:
Rubin Gerritsen 2024-07-05 09:46:57 +02:00 committed by Anas Nashif
commit 85eadcfddc
14 changed files with 89 additions and 2 deletions

View file

@ -112,8 +112,19 @@ extern "C" {
* See also the defined BT_ATT_ERR_* macros.
*
* @return The string representation of the ATT error code.
* If @kconfig{CONFIG_BT_ATT_ERR_TO_STR} is not enabled,
* this just returns the empty string
*/
#if defined(CONFIG_BT_ATT_ERR_TO_STR)
const char *bt_att_err_to_str(uint8_t att_err);
#else
static inline const char *bt_att_err_to_str(uint8_t att_err)
{
ARG_UNUSED(att_err);
return "";
}
#endif
#if defined(CONFIG_BT_EATT)
#if defined(CONFIG_BT_TESTING)

View file

@ -1285,8 +1285,19 @@ int bt_conn_cb_unregister(struct bt_conn_cb *cb);
/** Converts a security error to string.
*
* @return The string representation of the security error code.
* If @kconfig{CONFIG_BT_SECURITY_ERR_TO_STR} is not enabled,
* this just returns the empty string
*/
#if defined(CONFIG_BT_SECURITY_ERR_TO_STR)
const char *bt_security_err_to_str(enum bt_security_err err);
#else
static inline const char *bt_security_err_to_str(enum bt_security_err err)
{
ARG_UNUSED(err);
return "";
}
#endif
/** @brief Enable/disable bonding.
*

View file

@ -413,6 +413,8 @@ struct bt_gatt_cpf {
* See also the defined BT_ATT_ERR_* macros.
*
* @return The string representation of the GATT error code.
* If @kconfig{CONFIG_BT_ATT_ERR_TO_STR} is not enabled,
* this just returns the empty string.
*/
static inline const char *bt_gatt_err_to_str(int gatt_err)
{

View file

@ -31,8 +31,19 @@ extern "C" {
* See also the defined BT_HCI_ERR_* macros.
*
* @return The string representation of the HCI error code.
* If @kconfig{CONFIG_BT_HCI_ERR_TO_STR} is not enabled,
* this just returns the empty string
*/
#if defined(CONFIG_BT_HCI_ERR_TO_STR)
const char *bt_hci_err_to_str(uint8_t hci_err);
#else
static inline const char *bt_hci_err_to_str(uint8_t hci_err)
{
ARG_UNUSED(hci_err);
return "";
}
#endif
/** Allocate a HCI command buffer.
*

View file

@ -257,6 +257,14 @@ config BT_ASSERT_PANIC
endif # BT_ASSERT
config BT_HCI_ERR_TO_STR
bool "Print HCI error codes as strings [EXPERIMENTAL]"
select EXPERIMENTAL
help
This configuration enables printing of HCI error
codes represented as strings.
See bt_hci_err_to_str() for more details.
config BT_MONITOR
bool
select LOG_OUTPUT

View file

@ -62,6 +62,7 @@ const char *bt_uuid_str(const struct bt_uuid *uuid)
return str;
}
#if defined(CONFIG_BT_HCI_ERR_TO_STR)
const char *bt_hci_err_to_str(uint8_t hci_err)
{
#define HCI_ERR(err) [err] = #err
@ -146,3 +147,4 @@ const char *bt_hci_err_to_str(uint8_t hci_err)
#undef HCI_ERR
}
#endif /* CONFIG_BT_HCI_ERR_TO_STR */

View file

@ -363,6 +363,23 @@ config BT_SMP
(SMP), making it possible to pair devices over LE.
if BT_SMP
config BT_SECURITY_ERR_TO_STR
bool "Print security error codes as strings [EXPERIMENTAL]"
select EXPERIMENTAL
help
This configuration enables printing of security error
codes represented as strings.
See bt_security_err_to_str() for more details.
config BT_SMP_ERR_TO_STR
bool "Print SMP error codes as strings [EXPERIMENTAL]"
select EXPERIMENTAL
help
This configuration enables printing of SMP error
codes represented as strings.
See bt_smp_err_to_str() for more details.
config BT_PASSKEY_KEYPRESS
bool "Passkey Keypress Notification support [EXPERIMENTAL]"
select EXPERIMENTAL

View file

@ -5,6 +5,14 @@
menu "ATT and GATT Options"
config BT_ATT_ERR_TO_STR
bool "Print ATT error codes as strings [EXPERIMENTAL]"
select EXPERIMENTAL
help
This configuration enables printing of ATT error
codes represented as strings.
See bt_att_err_to_str() for more details.
config BT_ATT_TX_COUNT
int "Number of ATT buffers"
default BT_BUF_ACL_TX_COUNT

View file

@ -185,7 +185,7 @@ static struct bt_att_tx_meta_data tx_meta_data_storage[CONFIG_BT_ATT_TX_COUNT];
struct bt_att_tx_meta_data *bt_att_get_tx_meta_data(const struct net_buf *buf);
static void att_on_sent_cb(struct bt_att_tx_meta_data *meta);
#if defined(CONFIG_BT_ATT_ERR_TO_STR)
const char *bt_att_err_to_str(uint8_t att_err)
{
/* To mapping tables are used to avoid a big gap with NULL-entries. */
@ -239,6 +239,7 @@ const char *bt_att_err_to_str(uint8_t att_err)
#undef ATT_ERR
#undef ATT_ERR_SECOND
}
#endif /* CONFIG_BT_ATT_ERR_TO_STR */
static void att_tx_destroy(struct net_buf *buf)
{

View file

@ -475,6 +475,7 @@ static enum bt_security_err security_err_get(uint8_t smp_err)
}
}
#if defined(CONFIG_BT_SECURITY_ERR_TO_STR)
const char *bt_security_err_to_str(enum bt_security_err err)
{
#define SEC_ERR(err) [err] = #err
@ -500,7 +501,7 @@ const char *bt_security_err_to_str(enum bt_security_err err)
#undef SEC_ERR
}
#endif /* CONFIG_BT_SECURITY_ERR_TO_STR */
static uint8_t smp_err_get(enum bt_security_err auth_err)
{
@ -527,6 +528,7 @@ static uint8_t smp_err_get(enum bt_security_err auth_err)
}
}
#if defined(CONFIG_BT_SMP_ERR_TO_STR)
const char *bt_smp_err_to_str(uint8_t smp_err)
{
#define SMP_ERR(err) [err] = #err
@ -558,6 +560,7 @@ const char *bt_smp_err_to_str(uint8_t smp_err)
#undef SMP_ERR
}
#endif /* CONFIG_BT_SMP_ERR_TO_STR */
static struct net_buf *smp_create_pdu(struct bt_smp *smp, uint8_t op, size_t len)
{

View file

@ -192,4 +192,13 @@ int bt_smp_irk_get(uint8_t *ir, uint8_t *irk);
*
* @return The string representation of the SMP error code.
*/
#if defined(CONFIG_BT_SMP_ERR_TO_STR)
const char *bt_smp_err_to_str(uint8_t smp_err);
#else
static inline const char *bt_smp_err_to_str(uint8_t smp_err)
{
ARG_UNUSED(smp_err);
return "";
}
#endif

View file

@ -8,3 +8,4 @@ CONFIG_BT_H4=n
CONFIG_LOG=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_GATT_DYNAMIC_DB=y
CONFIG_BT_ATT_ERR_TO_STR=y

View file

@ -4,3 +4,4 @@ CONFIG_ZTEST=y
CONFIG_BT=y
CONFIG_BT_CTLR=n
CONFIG_BT_H4=n
CONFIG_BT_HCI_ERR_TO_STR=y

View file

@ -8,3 +8,5 @@ CONFIG_BT_H4=n
CONFIG_LOG=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_SMP_ERR_TO_STR=y
CONFIG_BT_SECURITY_ERR_TO_STR=y