警告

This document is not updated for ESP32C6 yet, so some of the content may not be correct.

This warning was automatically inserted due to the source file being in the add_warnings_pages list.

蓝牙 API

[English]

ESP-IDF 目前支持两个主机堆栈。基于 Bluedroid 的堆栈(默认)支持传统蓝牙和 BLE,而基于 Apache NimBLE 的堆栈仅支持 BLE。用户可参考如下信息进行选择:

  • 对于同时涉及传统蓝牙和 BLE 的用例,应该选用 Bluedroid。

  • 对于仅涉及 BLE 的用例,建议选用 NimBLE。在代码占用和运行时,NimBLE 对内存的要求较低,因此适用于此类场景。

蓝牙 API 的示例代码存放于 ESP-IDF 示例项目的 bluetooth/bluedroid 目录下。

下面的示例给出了详细介绍: