Bluetooth: Fix compilation with SMP disabled

This fix SMP dependency checks in connection code.

Change-Id: Ic7e515885381bd243c89f2a6e10c356095e79b55
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2015-12-15 10:24:42 +01:00 committed by Anas Nashif
commit bc18a867b4
3 changed files with 18 additions and 19 deletions

View file

@ -198,7 +198,18 @@ typedef enum {
* @return 0 on success or negative error * @return 0 on success or negative error
*/ */
int bt_conn_security(struct bt_conn *conn, bt_security_t sec); 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 */ /** Connection callback structure */
struct bt_conn_cb { struct bt_conn_cb {
@ -221,16 +232,5 @@ struct bt_conn_cb {
*/ */
void bt_conn_cb_register(struct bt_conn_cb *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 /* CONFIG_BLUETOOTH_CENTRAL || CONFIG_BLUETOOTH_PERIPHERAL */
#endif /* __BT_CONN_H */ #endif /* __BT_CONN_H */

View file

@ -100,6 +100,11 @@ static void notify_disconnected(struct bt_conn *conn)
} }
#if defined(CONFIG_BLUETOOTH_SMP) #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) void bt_conn_identity_resolved(struct bt_conn *conn)
{ {
const bt_addr_le_t *rpa; 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); 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) 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) + size_t head_reserve = reserve + sizeof(struct bt_hci_acl_hdr) +

View file

@ -145,6 +145,7 @@ void bt_conn_identity_resolved(struct bt_conn *conn);
/* Notify higher layers that connection security changed */ /* Notify higher layers that connection security changed */
void bt_conn_security_changed(struct bt_conn *conn); void bt_conn_security_changed(struct bt_conn *conn);
#endif /* CONFIG_BLUETOOTH_SMP */
/* Prepare a PDU to be sent over a connection */ /* Prepare a PDU to be sent over a connection */
struct net_buf *bt_conn_create_pdu(struct nano_fifo *fifo, size_t reserve); 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 */ /* Initialize connection management */
int bt_conn_init(void); int bt_conn_init(void);
#endif /* CONFIG_BLUETOOTH_SMP */
/* Selects based on connecton type right semaphore for ACL packets */ /* Selects based on connecton type right semaphore for ACL packets */
static inline struct nano_sem *bt_conn_get_pkts(struct bt_conn *conn) static inline struct nano_sem *bt_conn_get_pkts(struct bt_conn *conn)
{ {