diff --git a/include/bluetooth/conn.h b/include/bluetooth/conn.h index e60b0f44b68..b24c825115e 100644 --- a/include/bluetooth/conn.h +++ b/include/bluetooth/conn.h @@ -198,7 +198,18 @@ typedef enum { * @return 0 on success or negative error */ int bt_conn_security(struct bt_conn *conn, bt_security_t sec); -#endif + +/** @brief Get encryption key size. + * + * This function gets encryption key size. + * If there is no security (encryption) enabled 0 will be returned. + * + * @param conn Existing connection object. + * + * @return Encryption key size. + */ +uint8_t bt_conn_enc_key_size(struct bt_conn *conn); +#endif /* CONFIG_BLUETOOTH_SMP */ /** Connection callback structure */ struct bt_conn_cb { @@ -221,16 +232,5 @@ struct bt_conn_cb { */ void bt_conn_cb_register(struct bt_conn_cb *cb); -/** @brief Get encryption key size. - * - * This function gets encryption key size. - * If there is no security (encryption) enabled 0 will be returned. - * - * @param conn Existing connection object. - * - * @return Encryption key size. - */ -uint8_t bt_conn_enc_key_size(struct bt_conn *conn); - #endif /* CONFIG_BLUETOOTH_CENTRAL || CONFIG_BLUETOOTH_PERIPHERAL */ #endif /* __BT_CONN_H */ diff --git a/net/bluetooth/conn.c b/net/bluetooth/conn.c index ffd7147617f..b124ab65f52 100644 --- a/net/bluetooth/conn.c +++ b/net/bluetooth/conn.c @@ -100,6 +100,11 @@ static void notify_disconnected(struct bt_conn *conn) } #if defined(CONFIG_BLUETOOTH_SMP) +uint8_t bt_conn_enc_key_size(struct bt_conn *conn) +{ + return conn->keys ? conn->keys->enc_size : 0; +} + void bt_conn_identity_resolved(struct bt_conn *conn) { const bt_addr_le_t *rpa; @@ -921,11 +926,6 @@ int bt_conn_le_conn_update(struct bt_conn *conn, uint16_t min, uint16_t max, return bt_hci_cmd_send(BT_HCI_OP_LE_CONN_UPDATE, buf); } -uint8_t bt_conn_enc_key_size(struct bt_conn *conn) -{ - return conn->keys ? conn->keys->enc_size : 0; -} - struct net_buf *bt_conn_create_pdu(struct nano_fifo *fifo, size_t reserve) { size_t head_reserve = reserve + sizeof(struct bt_hci_acl_hdr) + diff --git a/net/bluetooth/conn_internal.h b/net/bluetooth/conn_internal.h index cac642f71d1..472c8f209ef 100644 --- a/net/bluetooth/conn_internal.h +++ b/net/bluetooth/conn_internal.h @@ -145,6 +145,7 @@ void bt_conn_identity_resolved(struct bt_conn *conn); /* Notify higher layers that connection security changed */ void bt_conn_security_changed(struct bt_conn *conn); +#endif /* CONFIG_BLUETOOTH_SMP */ /* Prepare a PDU to be sent over a connection */ struct net_buf *bt_conn_create_pdu(struct nano_fifo *fifo, size_t reserve); @@ -152,8 +153,6 @@ struct net_buf *bt_conn_create_pdu(struct nano_fifo *fifo, size_t reserve); /* Initialize connection management */ int bt_conn_init(void); -#endif /* CONFIG_BLUETOOTH_SMP */ - /* Selects based on connecton type right semaphore for ACL packets */ static inline struct nano_sem *bt_conn_get_pkts(struct bt_conn *conn) {