Aditya
Aditya

Reputation: 11

Concurrent L2CAP and/or GATT Connections between 2 Devices

I was wondering if anybody here knows whether or not it is possible to have two active connections simultaneously between two devices.

Device A would be the central role in one connection and that same device would take on the role of peripheral in the other active connection. The other device, Device B, would then take on the peripheral and central roles, respectively. Device B would be an iOS phone and Device A would be a Raspberry Pi. Both connections use L2CAP Channels or One connection would use GATT/ATT and the other would be an L2CAP channel. 

If that isn't possible, would it be possible to have in Device A there are 2 apps each advertising their own unique services using btstack and then have Device B act as the central and connect/subscribe to the services advertised by two apps from Device A at the same time? 

Below post on Stack Overflow seems to conclude that it might be possible but not technically within the bluetooth spec. Can a single BLE central connect with multiple BLE peripherals via bluetooth low energy? Another post on this group ( https://groups.google.com/g/btstack-dev/c/FjEhludeL6U ) seems to ask a similar question but with SPP. 

Upvotes: 1

Views: 1020

Answers (1)

Emil
Emil

Reputation: 18452

If we talk about BLE, you can only have one link layer connection between two devices. Each device also only has one single GATT database.

However, both GATT roles can be active at the same time, which means you can independently run one GATT server software and one GATT client software at the same time on every device. All operating systems I know of can also "multiplex" multiple apps that want to act as a GATT client onto the single GATT link. When acting as a GATT server, each application can register their own services in the common GATT db.

For L2CAP connection oriented channels with credit based flow control, you can have multiple such connections running on the same BLE connection.

So yeah what you try to achieve seems definitely possible.

Upvotes: 1

Related Questions