Merge branch 'bugfix/btdm_error_type_in_config_eir_evt_v4.0' into 'release/v4.0'

components/bt: Fix error EIR type in config eir event

See merge request espressif/esp-idf!7407
This commit is contained in:
Jiang Jiang Jian 2020-02-14 16:41:58 +08:00
commit f92534f95d
2 changed files with 19 additions and 17 deletions

View file

@ -79,21 +79,23 @@ typedef struct {
} esp_bt_gap_dev_prop_t;
/// Extended Inquiry Response data type
typedef enum {
ESP_BT_EIR_TYPE_FLAGS = 0x01, /*!< Flag with information such as BR/EDR and LE support */
ESP_BT_EIR_TYPE_INCMPL_16BITS_UUID = 0x02, /*!< Incomplete list of 16-bit service UUIDs */
ESP_BT_EIR_TYPE_CMPL_16BITS_UUID = 0x03, /*!< Complete list of 16-bit service UUIDs */
ESP_BT_EIR_TYPE_INCMPL_32BITS_UUID = 0x04, /*!< Incomplete list of 32-bit service UUIDs */
ESP_BT_EIR_TYPE_CMPL_32BITS_UUID = 0x05, /*!< Complete list of 32-bit service UUIDs */
ESP_BT_EIR_TYPE_INCMPL_128BITS_UUID = 0x06, /*!< Incomplete list of 128-bit service UUIDs */
ESP_BT_EIR_TYPE_CMPL_128BITS_UUID = 0x07, /*!< Complete list of 128-bit service UUIDs */
ESP_BT_EIR_TYPE_SHORT_LOCAL_NAME = 0x08, /*!< Shortened Local Name */
ESP_BT_EIR_TYPE_CMPL_LOCAL_NAME = 0x09, /*!< Complete Local Name */
ESP_BT_EIR_TYPE_TX_POWER_LEVEL = 0x0a, /*!< Tx power level, value is 1 octet ranging from -127 to 127, unit is dBm*/
ESP_BT_EIR_TYPE_URL = 0x24, /*!< Uniform resource identifier */
ESP_BT_EIR_TYPE_MANU_SPECIFIC = 0xff, /*!< Manufacturer specific data */
} esp_bt_eir_type_t;
#define ESP_BT_EIR_TYPE_MAX_NUM 12 /*!< MAX number of EIR type */
#define ESP_BT_EIR_TYPE_FLAGS 0x01 /*!< Flag with information such as BR/EDR and LE support */
#define ESP_BT_EIR_TYPE_INCMPL_16BITS_UUID 0x02 /*!< Incomplete list of 16-bit service UUIDs */
#define ESP_BT_EIR_TYPE_CMPL_16BITS_UUID 0x03 /*!< Complete list of 16-bit service UUIDs */
#define ESP_BT_EIR_TYPE_INCMPL_32BITS_UUID 0x04 /*!< Incomplete list of 32-bit service UUIDs */
#define ESP_BT_EIR_TYPE_CMPL_32BITS_UUID 0x05 /*!< Complete list of 32-bit service UUIDs */
#define ESP_BT_EIR_TYPE_INCMPL_128BITS_UUID 0x06 /*!< Incomplete list of 128-bit service UUIDs */
#define ESP_BT_EIR_TYPE_CMPL_128BITS_UUID 0x07 /*!< Complete list of 128-bit service UUIDs */
#define ESP_BT_EIR_TYPE_SHORT_LOCAL_NAME 0x08 /*!< Shortened Local Name */
#define ESP_BT_EIR_TYPE_CMPL_LOCAL_NAME 0x09 /*!< Complete Local Name */
#define ESP_BT_EIR_TYPE_TX_POWER_LEVEL 0x0a /*!< Tx power level, value is 1 octet ranging from -127 to 127, unit is dBm*/
#define ESP_BT_EIR_TYPE_URL 0x24 /*!< Uniform resource identifier */
#define ESP_BT_EIR_TYPE_MANU_SPECIFIC 0xff /*!< Manufacturer specific data */
#define ESP_BT_EIR_TYPE_MAX_NUM 12 /*!< MAX number of EIR type */
typedef uint8_t esp_bt_eir_type_t;
/* ESP_BT_EIR_FLAG bit definition */
#define ESP_BT_EIR_FLAG_LIMIT_DISC (0x01 << 0)

View file

@ -678,7 +678,7 @@ void bta_dm_config_eir (tBTA_DM_MSG *p_data)
osi_free(p_bta_dm_eir_cfg->bta_dm_eir_manufac_spec);
p_bta_dm_eir_cfg->bta_dm_eir_manufac_spec = NULL;
}
if (config_eir->eir_manufac_spec) {
if (config_eir->eir_manufac_spec_len > 0) {
p_bta_dm_eir_cfg->bta_dm_eir_manufac_spec = osi_malloc(config_eir->eir_manufac_spec_len);
if (p_bta_dm_eir_cfg->bta_dm_eir_manufac_spec) {
memcpy(p_bta_dm_eir_cfg->bta_dm_eir_manufac_spec, config_eir->eir_manufac_spec, config_eir->eir_manufac_spec_len);
@ -692,7 +692,7 @@ void bta_dm_config_eir (tBTA_DM_MSG *p_data)
osi_free(p_bta_dm_eir_cfg->bta_dm_eir_url);
p_bta_dm_eir_cfg->bta_dm_eir_url = NULL;
}
if (config_eir->eir_url) {
if (config_eir->eir_url_len > 0) {
p_bta_dm_eir_cfg->bta_dm_eir_url = osi_malloc(config_eir->eir_url_len);
if (p_bta_dm_eir_cfg->bta_dm_eir_url) {
memcpy(p_bta_dm_eir_cfg->bta_dm_eir_url, config_eir->eir_url, config_eir->eir_url_len);