Actual combat Linux Bluetooth programming (ii) BlueZ introduction __arduino

Source: Internet
Author: User

Implementation of Bluetooth protocol stack under Linux. Linux open Bluetooth protocol stack mainly includes IBM's Bluedrekar,nokia company's affix, axis company OPENBT and the official protocol stack BlueZ. We mainly face the BlueZ to discuss.

The BlueZ base code is completed by Maxim Krasnyansky. Includes: Hci,l2cap,rfcomm and implementation of basic socket. He works for Qualcomm (Qualcomm). Marcel Holtmann Development layer protocols and applications, including: BNEP, CMTP, etc. Of course, there are also Maxim Krasnyansky in these. Some of the code is provided by Nokia.

BlueZ is how to implement the Bluetooth protocol stack. It is divided into 2 parts to achieve:

1.Kernel Layer Implementation:

As mentioned in the previous article, the Bluetooth protocol stack has a multi-layer structure, the bottom of the hardware protocol has been implemented in the hardware. (for example, in Broadcom chips, the underlying hardware protocol is already included in the chip). Software-level protocol implementations, from the HCI layer. BlueZ the implementation of each layer protocol is based on the socket. BlueZ first created a protocol in a new socket--Pf_bluetooth (af_bluetooth=31). (That is, the first parameter of the Socket (): Domain must be:pf_bluetooth ). This also means that the address type needs to be defined using Bluetooth.

In fact, it is simple to add Pf_bluetooth to the Net_families (Network protocol list). If you have any knowledge of Linux kernel, you know that this registration action must be done in the Bluetooth init section.

Similarly, each protocol layer (e.g., hci,l2cap,hid, etc.) adds its own code of conduct to the Pf_bluetooth protocol.

2. Application Layer Implementation:

Although the kernel layer has fully implemented the Bluetooth protocol stack, it is extremely inconvenient if it is to be used. After all, the most convenient communication channel for applications and kernel is IOCTL (). This is very not intuitive. BlueZ also provides a set of APIs that help developers deal with the kernel layer easily. Of course, the implementation of these APIs at the bottom is ioctl.

BlueZ time, basically is this. Let's look at how to use this set of APIs provided by BlueZ.

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.