Multi-threaded linux connection to multiple Bluetooth devices at the same time

Source: Internet
Author: User
Tags socket connect
Multi-thread implementation in linux connects multiple Bluetooth devices at the same time-Linux general technology-Linux programming and kernel information. The following is a detailed description. Author: Rainy0415

In linux, Bluetooth transmission is implemented based on the bluez and openobex libraries. The basic process is as follows:

Inquiry ---> obtain the target channel through SDP ---> Create thread

The thread sends a file to the queried bluetooth device. The main operations include creating an obex instance handle, socket processing, establishing a connection, and sending a file;

During the actual test, the connection fails frequently due to unstable conditions. The number of Bluetooth devices that can be connected at the same time is not fixed, the error message "Device or resource busy" appears when the connection fails. The error message is "Device or resource busy", which is depressing. It is found that there is no problem in the creation and binding of sockt, but there is a problem when implementing socket connect, you can't go in and check it out.

Today, I talked to a friend on msn about this problem, but it was broken by a phrase (of course I still don't fully understand it, but I know what's going on, he said that, due to the influence of the Bluetooth frequency hopping technique, the frequency hopping sequence between the two bluetooth devices is uncertain before the two bluetooth devices establish a connection, and the connection will interfere with each other, therefore, the establishment of Bluetooth connections should be implemented in sequence, but after the connection is established, the frequency hopping sequence between the two bluetooth devices is determined, but data transmission at the same time is no problem.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.