From d93bff2699285f2986c4e417becd00363f0e48f6 Mon Sep 17 00:00:00 2001 From: baohongde Date: Wed, 25 Dec 2019 20:03:16 +0800 Subject: [PATCH] components/bt: Revert changes of security mask --- components/bt/host/bluedroid/api/esp_spp_api.c | 10 ++++------ .../bt/host/bluedroid/api/include/api/esp_spp_api.h | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/components/bt/host/bluedroid/api/esp_spp_api.c b/components/bt/host/bluedroid/api/esp_spp_api.c index c833e7648..c645a8a9d 100644 --- a/components/bt/host/bluedroid/api/esp_spp_api.c +++ b/components/bt/host/bluedroid/api/esp_spp_api.c @@ -95,9 +95,8 @@ esp_err_t esp_spp_connect(esp_spp_sec_t sec_mask, btc_spp_args_t arg; ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED); - if (sec_mask != ESP_SPP_SEC_AUTHORIZE) { - LOG_ERROR("Only ESP_SPP_SEC_AUTHORIZE is supported!\n"); - return ESP_ERR_INVALID_ARG; + if (sec_mask != ESP_SPP_SEC_NONE && sec_mask != ESP_SPP_SEC_AUTHORIZE && sec_mask != ESP_SPP_SEC_AUTHENTICATE) { + LOG_WARN("Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only\n"); } msg.sig = BTC_SIG_API_CALL; @@ -138,9 +137,8 @@ esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask, return ESP_ERR_INVALID_ARG; } - if (sec_mask != ESP_SPP_SEC_AUTHORIZE) { - LOG_ERROR("Only ESP_SPP_SEC_AUTHORIZE is supported!\n"); - return ESP_ERR_INVALID_ARG; + if (sec_mask != ESP_SPP_SEC_NONE && sec_mask != ESP_SPP_SEC_AUTHORIZE && sec_mask != ESP_SPP_SEC_AUTHENTICATE) { + LOG_WARN("Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only\n"); } msg.sig = BTC_SIG_API_CALL; diff --git a/components/bt/host/bluedroid/api/include/api/esp_spp_api.h b/components/bt/host/bluedroid/api/include/api/esp_spp_api.h index 945b63362..a73bd9337 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_spp_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_spp_api.h @@ -30,7 +30,7 @@ typedef enum { ESP_SPP_NO_RESOURCE /*!< No more set pm control block */ } esp_spp_status_t; -/* Security Setting Mask, Only support ESP_SPP_SEC_AUTHORIZE.*/ +/* Security Setting Mask, Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only.*/ #define ESP_SPP_SEC_NONE 0x0000 /*!< No security. relate to BTA_SEC_NONE in bta/bta_api.h */ #define ESP_SPP_SEC_AUTHORIZE 0x0001 /*!< Authorization required (only needed for out going connection ) relate to BTA_SEC_AUTHORIZE in bta/bta_api.h*/ #define ESP_SPP_SEC_AUTHENTICATE 0x0012 /*!< Authentication required. relate to BTA_SEC_AUTHENTICATE in bta/bta_api.h*/ @@ -229,7 +229,7 @@ esp_err_t esp_spp_start_discovery(esp_bd_addr_t bd_addr); * When the connection is established or failed, * the callback is called with ESP_SPP_OPEN_EVT. * - * @param[in] sec_mask: Security Setting Mask. Only support ESP_SPP_SEC_AUTHORIZE. + * @param[in] sec_mask: Security Setting Mask. Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only. * @param[in] role: Master or slave. * @param[in] remote_scn: Remote device bluetooth device SCN. * @param[in] peer_bd_addr: Remote device bluetooth device address. @@ -260,7 +260,7 @@ esp_err_t esp_spp_disconnect(uint32_t handle); * When the connection is established, the callback is called * with ESP_SPP_SRV_OPEN_EVT. * - * @param[in] sec_mask: Security Setting Mask. Only support ESP_SPP_SEC_AUTHORIZE. + * @param[in] sec_mask: Security Setting Mask. Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only. * @param[in] role: Master or slave. * @param[in] local_scn: The specific channel you want to get. * If channel is 0, means get any channel.