Bluetooth: Host: Automatically create EATT channels on connection
If the Kconfig BT_EATT_AUTO_CONNECT is enabled (on by default), the host will try to connect BT_EATT_MAX EATT channels when a connection to a peer is established. Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
This commit is contained in:
parent
40237f3e99
commit
101a9a7525
5 changed files with 34 additions and 0 deletions
|
@ -43,6 +43,14 @@ config BT_EATT_MAX
|
|||
help
|
||||
Number of Enhanced ATT bearers available.
|
||||
|
||||
|
||||
config BT_EATT_AUTO_CONNECT
|
||||
bool "Automatically connect EATT bearers when a link is established"
|
||||
default y
|
||||
help
|
||||
The device will try to connect BT_EATT_MAX enhanced ATT bearers when a
|
||||
connection to a peer is established.
|
||||
|
||||
config BT_EATT_SEC_LEVEL
|
||||
int "Enhanced ATT bearer security level"
|
||||
default 1
|
||||
|
|
|
@ -3127,6 +3127,29 @@ int bt_eatt_connect(struct bt_conn *conn, size_t num_channels)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_EATT_AUTO_CONNECT)
|
||||
void eatt_auto_connect(struct bt_conn *conn, uint8_t conn_err)
|
||||
{
|
||||
int eatt_err;
|
||||
|
||||
if (conn_err) {
|
||||
return;
|
||||
}
|
||||
|
||||
eatt_err = att_schedule_eatt_connect(conn, CONFIG_BT_EATT_MAX);
|
||||
if (eatt_err < 0) {
|
||||
BT_WARN("Automatic creation of EATT bearers failed on "
|
||||
"connection %s with error %d",
|
||||
bt_addr_le_str_real(bt_conn_get_dst(conn)), eatt_err);
|
||||
}
|
||||
}
|
||||
|
||||
BT_CONN_CB_DEFINE(conn_callbacks) = {
|
||||
.connected = eatt_auto_connect,
|
||||
};
|
||||
|
||||
#endif /* CONFIG_BT_EATT_AUTO_CONNECT */
|
||||
|
||||
int bt_eatt_disconnect(struct bt_conn *conn)
|
||||
{
|
||||
struct bt_att_chan *chan;
|
||||
|
|
|
@ -8,6 +8,7 @@ CONFIG_BT_EATT=y
|
|||
CONFIG_BT_L2CAP_ECRED=y
|
||||
CONFIG_BT_EATT_MAX=5
|
||||
CONFIG_BT_MAX_CONN=1
|
||||
CONFIG_BT_EATT_AUTO_CONNECT=n
|
||||
|
||||
CONFIG_BT_TESTING=y
|
||||
CONFIG_BT_DEBUG_LOG=y
|
||||
|
|
|
@ -9,6 +9,7 @@ CONFIG_BT_L2CAP_ECRED=y
|
|||
CONFIG_BT_EATT_MAX=5
|
||||
CONFIG_BT_MAX_CONN=1
|
||||
CONFIG_BT_EATT_SEC_LEVEL=2
|
||||
CONFIG_BT_EATT_AUTO_CONNECT=n
|
||||
|
||||
CONFIG_BT_TESTING=y
|
||||
CONFIG_BT_DEBUG_LOG=y
|
||||
|
|
|
@ -8,6 +8,7 @@ CONFIG_BT_EATT=y
|
|||
CONFIG_BT_L2CAP_ECRED=y
|
||||
CONFIG_BT_EATT_MAX=5
|
||||
CONFIG_BT_MAX_CONN=2
|
||||
CONFIG_BT_EATT_AUTO_CONNECT=n
|
||||
|
||||
CONFIG_BT_TESTING=y
|
||||
CONFIG_BT_DEBUG_LOG=y
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue