Multiple BLE connections
Posted: Tue Feb 07, 2023 9:10 pm
Is it possible to have multiple concurrent BLE connections on the ESP32? The documentations says it supports up to 9 client devices, but I can't even get two concurrent connections using the GATT security server example code (https://github.com/espressif/esp-idf/tr ... ity_server). Is there something that I should be setting to get multiple connections? BLE 4.2 should support a higher number of connections regardless of its role (central vs peripheral).
Here's what I'm using as the client code (on two separate devices):
Using the script above, I can get one client to connect and hold open its connection. But on the second device, it times out and I cannot connect to the BLE device.
Here's what I'm using as the client code (on two separate devices):
- import asyncio
- from bleak import BleakScanner, BleakClient
- address = 'f4:12:fa:d9:7f:52'
- async def main(address):
- async with BleakClient(address, timeout=30) as client:
- for service in client.services:
- print('-------------------')
- print(service)
- for c in service.characteristics:
- print('+- ', c)
- if 'read' in c.properties:
- print(' ', await client.read_gatt_char(c))
- else:
- print(' no read')
- await asyncio.sleep(100000)
- asyncio.run(main(address))