Bluetooth: Make max supported connection count configurable

Add a kernel config option to specify how many simultaneous
connections can be supported.

Change-Id: I963aacb7cece3436ecd5049683a19a350224a156
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2015-05-21 13:21:08 +03:00 committed by Anas Nashif
commit 5190c37967
2 changed files with 13 additions and 4 deletions

View file

@ -41,6 +41,16 @@ config BLUETOOTH
help
This option enables Bluetooth Low Energy support.
config BLUETOOTH_MAX_CONN
int
prompt "Maximum number of simultaneous connections"
depends on BLUETOOTH
default 1
range 1 16
help
Maximum number of simultaneous Bluetooth connections
supported. The minimum (and default) number is 1.
config BLUETOOTH_DEBUG
bool
prompt "Bluetooth LE debug support"

View file

@ -49,8 +49,7 @@
#define BT_DBG(fmt, ...)
#endif
#define MAX_CONN_COUNT 1
static struct bt_conn conns[MAX_CONN_COUNT];
static struct bt_conn conns[CONFIG_BLUETOOTH_MAX_CONN];
static void bt_conn_reset_rx_state(struct bt_conn *conn)
{
@ -279,7 +278,7 @@ struct bt_conn *bt_conn_add(struct bt_dev *dev, uint16_t handle)
struct bt_conn *conn = NULL;
int i;
for (i = 0; i < MAX_CONN_COUNT; i++) {
for (i = 0; i < ARRAY_SIZE(conns); i++) {
if (!conns[i].handle) {
conn = &conns[i];
break;
@ -332,7 +331,7 @@ struct bt_conn *bt_conn_lookup(uint16_t handle)
{
int i;
for (i = 0; i < MAX_CONN_COUNT; i++) {
for (i = 0; i < ARRAY_SIZE(conns); i++) {
if (conns[i].state != BT_CONN_CONNECTED) {
continue;
}