summaryrefslogtreecommitdiff
path: root/src/gatt-client.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2020-01-07 11:47:49 -0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2020-03-02 14:42:35 -0800
commitcc441474e77d098c84a9b4140d5e213ccef5d12e (patch)
treeb63b1212a82e55ec128c1efc64a80322af6d56d4 /src/gatt-client.c
parentb8b59af4e88069cb2f67b0168113aa489f6e1fe9 (diff)
downloadbluez-cc441474e77d098c84a9b4140d5e213ccef5d12e.tar.gz
core: Add support for setting the number of GATT bearers
This adds option to set the numbers of GATT Channels/Bearers to be connected in main.conf.
Diffstat (limited to 'src/gatt-client.c')
-rw-r--r--src/gatt-client.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gatt-client.c b/src/gatt-client.c
index fae6f43e6..20efb7ae9 100644
--- a/src/gatt-client.c
+++ b/src/gatt-client.c
@@ -59,8 +59,6 @@
#define GATT_CHARACTERISTIC_IFACE "org.bluez.GattCharacteristic1"
#define GATT_DESCRIPTOR_IFACE "org.bluez.GattDescriptor1"
-#define EATT_MAX_BEARERS 2
-
struct btd_gatt_client {
struct btd_device *device;
uint8_t features;
@@ -2171,6 +2169,7 @@ static void eatt_connect_cb(GIOChannel *io, GError *gerr, gpointer user_data)
static void eatt_connect(struct btd_gatt_client *client)
{
+ struct bt_att *att = bt_gatt_client_get_att(client->gatt);
struct btd_device *dev = client->device;
struct btd_adapter *adapter = device_get_adapter(dev);
GIOChannel *io;
@@ -2178,12 +2177,14 @@ static void eatt_connect(struct btd_gatt_client *client)
char addr[18];
int i;
+ if (bt_att_get_channels(att) == main_opts.gatt_channels)
+ return;
+
ba2str(device_get_address(dev), addr);
DBG("Connection attempt to: %s", addr);
- for (i = 0; i < EATT_MAX_BEARERS; i++) {
- /* Fallback to regular LE mode */
+ for (i = bt_att_get_channels(att); i < main_opts.gatt_channels; i++) {
io = bt_io_connect(eatt_connect_cb, client, NULL, &gerr,
BT_IO_OPT_SOURCE_BDADDR,
btd_adapter_get_address(adapter),