10.Classic Bluetooth serial port SPP
The sample code mainly demonstrates the mutual forwarding of information between the Bluetooth serial port and the serial port, which is derived from the official demo of ESP32, which is simple and easy to understand. So the description mainly explains the concepts that appear in the code.
1. Bluetooth protocol
At present, the main Bluetooth protocols are divided into two categories, traditional Bluetooth (HS/BR/EDR) based on RFCOMM and Bluetooth low energy (BLE) based on GATT.
Traditional Bluetooth is faster and has many specific application protocols, such as audio-oriented A2DP, Bluetooth serial port SPP, etc. However, the power consumption is high, and access to Apple devices requires MFi (Made For iOS) chips and certification.
Bluetooth Low Energy (BLE) can define various GATT profiles by itself, and it is also equipped with commonly used profiles (such as device information, battery, etc.). It has low power consumption and is widely used. It can be used on Apple devices. The disadvantages is that it is slower than traditional Bluetooth. Bluetooth low energy is mostly used on devices with low data volume but sensitive to power consumption, such as bracelets/smart watches/beacons.
2. Classic Bluetooth serial port (SPP)
This demo uses the SPP protocol based on traditional Bluetooth, which comes with all serial port protocols. When the computer or Android phone is connected and paired, a serial port number will be automatically generated in the system for communication, and the experience is not much different from that of a normal wired serial port.
The bluetooth low energy serial port will be demonstrated in the next chapter. In essence, it is a profile configured with a serial port and requires host software support.
Last updated