From 20ed74dbdc91e536e30d91ef3d14ca0d11bbaa82 Mon Sep 17 00:00:00 2001 From: zhanghaipeng Date: Mon, 26 Feb 2024 16:39:13 +0800 Subject: [PATCH] fix(ble/bluedroid): Optimize the BLE documentation --- examples/bluetooth/bluedroid/ble/gatt_server/README.md | 2 +- .../tutorial/Gatt_Server_Example_Walkthrough.md | 8 +++++--- .../tutorial/ble50_security_server_Example_Walkthrough.md | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/bluetooth/bluedroid/ble/gatt_server/README.md b/examples/bluetooth/bluedroid/ble/gatt_server/README.md index e75dbbe843..d9e931b7a2 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_server/README.md +++ b/examples/bluetooth/bluedroid/ble/gatt_server/README.md @@ -40,7 +40,7 @@ See the [Getting Started Guide](https://idf.espressif.com/) for full steps to co This example works with UUID16 as default. To change to UUID128, follow this steps: -1. Change the UIID16 to UUID128. You can change the UUID according to your needs. +1. Change the UUID16 to UUID128. You can change the UUID according to your needs. ```c // Create a new UUID128 (using random values for this example) diff --git a/examples/bluetooth/bluedroid/ble/gatt_server/tutorial/Gatt_Server_Example_Walkthrough.md b/examples/bluetooth/bluedroid/ble/gatt_server/tutorial/Gatt_Server_Example_Walkthrough.md index 1f69db0fbb..21876ed121 100644 --- a/examples/bluetooth/bluedroid/ble/gatt_server/tutorial/Gatt_Server_Example_Walkthrough.md +++ b/examples/bluetooth/bluedroid/ble/gatt_server/tutorial/Gatt_Server_Example_Walkthrough.md @@ -187,13 +187,15 @@ struct gatts_profile_inst { The Application Profiles are stored in an array and corresponding callback functions `gatts_profile_a_event_handler()` and `gatts_profile_b_event_handler()` are assigned. Different applications on the GATT client use different interfaces, represented by the gatts_if parameter. For initialization, this parameter is set to `ESP_GATT_IF_NONE`, which means that the Application Profile is not linked to any client yet. ```c +/* One gatt-based profile one app_id and one gatts_if, this array will store the gatts_if returned by ESP_GATTS_REG_EVT */ static struct gatts_profile_inst gl_profile_tab[PROFILE_NUM] = { [PROFILE_A_APP_ID] = { .gatts_cb = gatts_profile_a_event_handler, - .gatts_if = ESP_GATT_IF_NONE, + .gatts_if = ESP_GATT_IF_NONE, /* Not get the gatt_if, so initial is ESP_GATT_IF_NONE */ + }, [PROFILE_B_APP_ID] = { - .gatts_cb = gatts_profile_b_event_handler, - .gatts_if = ESP_GATT_IF_NONE, + .gatts_cb = gatts_profile_b_event_handler, /* This demo does not implement, similar as profile A */ + .gatts_if = ESP_GATT_IF_NONE, /* Not get the gatt_if, so initial is ESP_GATT_IF_NONE */ }, }; ``` diff --git a/examples/bluetooth/bluedroid/ble_50/ble50_security_server/tutorial/ble50_security_server_Example_Walkthrough.md b/examples/bluetooth/bluedroid/ble_50/ble50_security_server/tutorial/ble50_security_server_Example_Walkthrough.md index 656960bcba..787c068b0f 100644 --- a/examples/bluetooth/bluedroid/ble_50/ble50_security_server/tutorial/ble50_security_server_Example_Walkthrough.md +++ b/examples/bluetooth/bluedroid/ble_50/ble50_security_server/tutorial/ble50_security_server_Example_Walkthrough.md @@ -4,7 +4,7 @@ In this document, a description of the security GATT security Server BLE example for the ESP32C3 is presented. The security configuration enables a GATT Server acting as a peripheral device to bond with a central and establish an encrypted link between them. This functionality is defined by the [Bluetooth Specification version 4.2](https://www.bluetooth.com/specifications/bluetooth-core-specification) and implemented on the ESP-IDF BLE stack, specifically on the Security Manager Protocol (SMP) API. -BLE security involves three interrelated concepts: pairing, bonding and encryption. Pairing concerns with the exchange of security features and types of keys needed. In addition, the pairing procedure takes care of the generation and exchange of shared keys. The core specification defines the legacy pairing and Secure Connections pairing (introduced in Bluetooth 5.0), which are both supported by ESP32C3. Once the exchange of shared keys is completed, a temporary encrypted link is established to exchange short term and long term keys. Bonding refers to storing the exchanged keys for subsequent connections so that they do not have to be transmitted again. Finally, encryption pertains to the ciphering of plain text data using the AES-128 engine and the shared keys. Server attributes may also be defined to allow only encrypted write and read messages. At any point of the communication, a peripheral device can always ask to start encryption by issuing a security request to the other peer device, which returns a security response by calling an API. +BLE security involves three interrelated concepts: pairing, bonding and encryption. Pairing concerns with the exchange of security features and types of keys needed. In addition, the pairing procedure takes care of the generation and exchange of shared keys. The core specification defines the legacy pairing and Secure Connections pairing (introduced in Bluetooth 4.2), which are both supported by ESP32C3. Once the exchange of shared keys is completed, a temporary encrypted link is established to exchange short term and long term keys. Bonding refers to storing the exchanged keys for subsequent connections so that they do not have to be transmitted again. Finally, encryption pertains to the ciphering of plain text data using the AES-128 engine and the shared keys. Server attributes may also be defined to allow only encrypted write and read messages. At any point of the communication, a peripheral device can always ask to start encryption by issuing a security request to the other peer device, which returns a security response by calling an API. This document only describes the security configuration. The rest of the GATT server functionalities, such as defining the service table, are explained in the GATT Server example walkthrough documentation. For a better understanding of this example workflow, it is recommended that the reader is familiar with the pairing feature exchange and key generation defined in the section 3.5 of the [Bluetooth Specification Version 4.2](https://www.bluetooth.com/specifications/bluetooth-core-specification) [Vol 3, Part H].