I began to answer so that I had more space ...
I use a combination of Python and C to make my code work, so my "code" may look funny because it can come from anyone. In addition, I used Bluez 4, since 5 did not support the kernel that I used. Let me know if there is a problem and I can clarify.
It seems that there are several ways to do something, but in the end I opened separate sockets for different tasks. You can open one socket and then set the socket options to filter them, and you should get all the packets in one place. However, this was my initial way of doing this, and I found that my connections would die within seconds.
, socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI), bind 0. ( , hci_get_route, ). hci_le_set_scan_parameters setsockopt(SOL_HCI, HCI_FILTER, filter), LE-, hci_le_set_scan_enable, .
socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP), , connect struct sockaddr_l2, . . ( ... , . , . BUSY errno )
... , Bluez 5, DBUS. , , . , , , - 5 ( configure). lib , DBUS .