This is a way to make Bluetooth connection much faster.

Purpose: Trying a quick Bluetooth connection.

Storyline: I tried the Bluecove library in Java, and if you already know the device address, the pairing process in the windows is blindly fast. On Linux, it lacks 15 seconds or so, and it's pretty annoying. So I tried to use the BlueZ library to create my own driver in C. Let's assume that the destination address is already known (so the problem is not in finding the device itself).

I open the socket

scoket s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);

By installing everything in the sockaddr_rc object, then try connecting to the device.

int status = connect(s, (struct sockaddr *) &addr, sizeof(addr));

Even if the status is zero (this is normal, it means that the connection is completed) the connection call itself takes from 6 to 10 seconds.

Can this connection time be reduced?

Thank!

+4

Source: https://habr.com/ru/post/1685351/


All Articles