gattlib icon indicating copy to clipboard operation
gattlib copied to clipboard

Connecting taking long time...

Open nsnnsn opened this issue 3 years ago • 2 comments

When i use connection = gattlib_connect(NULL, address, GATTLIB_CONNECTION_OPTIONS_LEGACY_DEFAULT); it takes about 4 seconds to connect. When i use the bluetoothctl utility it takes less than 2 seconds.

time bluetoothctl connect XX:XX:XX:XX:XX:XX Attempting to connect to XX:XX:XX:XX:XX:XX [CHG] Device DA:DC:22:B3:94:93 Connected: yes Connection successful real 0m 1.56s user 0m 0.07s sys 0m 0.02s

How can i speed it up ? Rest is working ok...

nsnnsn avatar Aug 29 '21 12:08 nsnnsn

I also am having this problem. Have you found a solution?

felwiz avatar Nov 05 '21 04:11 felwiz

Try changing the gattlib_connect options.

i.e. GATTLIB_CONNECTION_OPTIONS_LEGACY_DEFAULT expands to

#define GATTLIB_CONNECTION_OPTIONS_LEGACY_DEFAULT \
		GATTLIB_CONNECTION_OPTIONS_LEGACY_BDADDR_LE_PUBLIC | \
		GATTLIB_CONNECTION_OPTIONS_LEGACY_BDADDR_LE_RANDOM | \
		GATTLIB_CONNECTION_OPTIONS_LEGACY_BT_SEC_LOW

Try combinations like :

gattlib_connect(NULL, address,
				GATTLIB_CONNECTION_OPTIONS_LEGACY_BDADDR_LE_RANDOM |
				GATTLIB_CONNECTION_OPTIONS_LEGACY_BT_SEC_LOW);

Let me know if it has improved.

SunilKS-nd avatar Nov 01 '23 09:11 SunilKS-nd