BlueZ
1.Kernel Layer Implementation:
The Bluetooth protocol stack has a multilayer structure, and the lowest hardware protocol is implemented in hardware. Implementation of software-level protocols, starting with the HCI layer. BlueZ to the implementation of each layer of the Protocol is based on the socket. BlueZ first creates the protocol--pf_bluetooth (AF_BLUETOOTH=31) in a new socket. (In other words, 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 a knowledge of Linux kernel, you know that this registration action must be done in the Bluetooth init section. Similarly, each protocol layer (for example, 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 very inconvenient if it is to be used. After all, the most convenient communication channel for applications and kernel is the IOCTL (). This is very not intuitive. As a result, BlueZ provides a set of APIs that help developers easily interact with the kernel layer protocol. Of course, the underlying implementation of these APIs is Ioctl.bluez time, which is basically the case.
bluez--core Layer + application layer