diff --git a/components/bt/host/bluedroid/api/include/api/esp_sdp_api.h b/components/bt/host/bluedroid/api/include/api/esp_sdp_api.h index 07b6225a33a..e89f63d544c 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_sdp_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_sdp_api.h @@ -25,9 +25,13 @@ extern "C" { #define ESP_SDP_UUID_SAP 0x112D /*!< SIM Access Profile UUID */ #define ESP_SDP_UUID_DIP 0x1200 /*!< Device Identification Profile UUID */ +/// Build a Bluetooth UUID16 #define ESP_SDP_BUILD_BT_UUID16(uuid16_val) \ (esp_bt_uuid_t) { .len = ESP_UUID_LEN_16, .uuid = {.uuid16 = (uint16_t)(uuid16_val),}, } +/** + * @brief SDP status parameters + */ typedef enum { ESP_SDP_SUCCESS = 0, /*!< Successful operation. */ ESP_SDP_FAILURE, /*!< Generic failure. */ @@ -199,8 +203,8 @@ typedef union { /** * @brief SDP callback function type. * - * @param event: Event type - * @param param: Point to callback parameter, currently is union type + * @param[in] event: Event type + * @param[in] param: Point to callback parameter, currently is union type */ typedef void (* esp_sdp_cb_t)(esp_sdp_cb_event_t event, esp_sdp_cb_param_t *param); @@ -241,7 +245,7 @@ esp_err_t esp_sdp_init(void); esp_err_t esp_sdp_deinit(void); /** - * @brief This function is called to performs service discovery for the services provided by the given peer device. + * @brief Perform service discovery for the services provided by the given peer device. * When the operation is completed, the callback function will be called with ESP_SDP_SEARCH_COMP_EVT. * This function must be called after esp_sdp_init() successful and before esp_sdp_deinit(). * @@ -268,7 +272,7 @@ esp_err_t esp_sdp_search_record(esp_bd_addr_t bd_addr, esp_bt_uuid_t uuid); esp_err_t esp_sdp_create_record(esp_bluetooth_sdp_record_t *record); /** - * @brief This function is called to remove a SDP record. + * @brief Remove an SDP record. * When the operation is completed, the callback function will be called with ESP_SDP_REMOVE_RECORD_COMP_EVT. * This function must be called after esp_sdp_init() successful and before esp_sdp_deinit(). * diff --git a/docs/en/api-reference/bluetooth/esp_sdp.rst b/docs/en/api-reference/bluetooth/esp_sdp.rst index 75a893731e2..3bd53c24236 100644 --- a/docs/en/api-reference/bluetooth/esp_sdp.rst +++ b/docs/en/api-reference/bluetooth/esp_sdp.rst @@ -1,10 +1,17 @@ -Bluetooth® SDP APIs -=================== +Bluetooth® SDP API +================== Overview -------- -Bluetooth SDP reference APIs. +SDP (Service Discovery Protocol) API enables devices to discover services and service attributes offered by remote Bluetooth devices. It supports service search, service attribute retrieval, and the establishment of service connections. + +Application Examples +-------------------- + +- :example:`bluetooth/bluedroid/classic_bt/bt_l2cap_client` demonstrates how to use SDP APIs to search for services on remote Bluetooth devices. It shows how to register SDP callbacks, initialize SDP, perform service discovery using ``esp_sdp_search_record()``, and retrieve the L2CAP PSM (Protocol/Service Multiplexer) value from the search results to establish an L2CAP connection. + +- :example:`bluetooth/bluedroid/classic_bt/bt_l2cap_server` demonstrates how to use SDP APIs to create and publish service records. It shows how to register SDP callbacks, initialize SDP, create an SDP record using ``esp_sdp_create_record()`` with L2CAP PSM information, making the service discoverable by remote clients. API Reference -------------