- Core Specification 4.2 (GAP, L2CAP, RFCOMM, SDP, GATT)
- Classic Bluetooth (BR/EDR)
- Bluetooth Smart (Low Energy)
- Audio and media (A2DP, AVRCP)
- Telephony (HFP, HSP)
- Networking (PAN, 6LoWPAN)
- Input device (HID, HoG)
- OBEX (FTP, OPP, MAP, PBAP)
Bluetooth is a short-range cable-replacement technology that carries both data and voice. It supports speeds of up to 723Kbps (asymmetric) and 432Kbps (symmetric). Class 3Bluetooth devices have a range of 10 meters, and Class 1 transmitters can communicate up to 100 meters.
Bluetooth is designed to do away with wires that constrict and clutter your environment. It can, for example, turn your wristwatch into a front-end for a bulky Global Positioning System(GPS) hidden inside your backpack. Or it can, for instance, let you navigate a presentation via your handheld. Again, Bluetooth can be the answer if you want your laptop to be a hub that can Internet-enable your Bluetooth-aware MP3 player. If your wristwatch, handheld, laptop, or MP3 player is running Linux, knowledge of the innards of the Linux Bluetooth stack will help you extract maximum mileage out of your device.
As per the Bluetooth specification, the protocol stack consists of the layers shown in Figure 16.1 . The radio, link controller, and link manager roughly correspond to the physical, data link, and network layers in the Open Systems Interconnect (OSI) standard reference model. The Host Control Interface (HCI) is the protocol that
carries data to/from the hardware and, hence, maps to the transport layer. The BluetoothLogical Link Control and Adaptation Protocol (L2CAP) falls in the session layer. Serial port emulation using Radio Frequency Communication (RFCOMM), Ethernet emulation usingBluetooth Network Encapsulation Protocol (BNEP), and the
Service Discovery Protocol (SDP) are part of the feature-rich presentation layer. At the top of the stack reside various application environments called profiles. The radio, link controller, and link manager are usually part of Bluetooth hardware, so operating system support starts at the HCI layer.
Figure 16.1. The Bluetooth stack.
A common method of interfacing Bluetooth hardware with a microcontroller is by connecting the chipset's data lines to the controller's UART pins. Figure 13.4 of Chapter 13 , "Audio Drivers," shows a Bluetooth chip on an MP3 player communicating with the processor via a UART. USB is another oft-used vehicle for communicating with Bluetooth chipsets. Figure 11.2 of Chapter 11 , "Universal Serial Bus," shows a Bluetooth chip on an embedded device interfacing with the processor over USB. Irrespective of whether you use UART or USB (we will look at both kinds of devices later), the packet format used to transport Bluetooth data is HCI.