forked from espressif/esp-idf
Merge branch 'bugfix/btdm_backport_v3.1' into 'release/v3.1'
component/bt: backport some MRs to v3.1 See merge request idf/esp-idf!4312
This commit is contained in:
@@ -321,6 +321,7 @@ esp_gatt_status_t esp_ble_gatts_get_attr_value(uint16_t attr_handle, uint16_t *l
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (attr_handle == ESP_GATT_ILLEGAL_HANDLE) {
|
||||
*length = 0;
|
||||
return ESP_GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
|
@@ -333,7 +333,7 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
|
||||
pkt->layer_specific = 0;
|
||||
memcpy(pkt->data, data, len);
|
||||
fixed_queue_enqueue(hci_hal_env.rx_q, pkt);
|
||||
hci_hal_h4_task_post(100 / portTICK_PERIOD_MS);
|
||||
hci_hal_h4_task_post(0);
|
||||
|
||||
BTTRC_DUMP_BUFFER("Recv Pkt", pkt->data, len);
|
||||
|
||||
|
@@ -1440,7 +1440,7 @@ void BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32
|
||||
if (BTM_BLE_ISVALID_PARAM(scan_interval, BTM_BLE_SCAN_INT_MIN, max_scan_interval) &&
|
||||
BTM_BLE_ISVALID_PARAM(scan_window, BTM_BLE_SCAN_WIN_MIN, max_scan_window) &&
|
||||
(scan_mode == BTM_BLE_SCAN_MODE_ACTI || scan_mode == BTM_BLE_SCAN_MODE_PASS) &&
|
||||
(scan_duplicate_filter < BTM_BLE_SCAN_DUPLICATE_MAX)) {
|
||||
(scan_duplicate_filter < BTM_BLE_SCAN_DUPLICATE_MAX) && (scan_window <= scan_interval)) {
|
||||
p_cb->scan_type = scan_mode;
|
||||
p_cb->scan_interval = scan_interval;
|
||||
p_cb->scan_window = scan_window;
|
||||
|
@@ -762,7 +762,8 @@ tGATT_STATUS GATTS_GetAttributeValue(UINT16 attr_handle, UINT16 *length, UINT8 *
|
||||
attr_handle);
|
||||
|
||||
if ((p_decl = gatt_find_hdl_buffer_by_attr_handle(attr_handle)) == NULL) {
|
||||
GATT_TRACE_ERROR("Service not created\n");
|
||||
GATT_TRACE_ERROR("Service not created\n");
|
||||
*length = 0;
|
||||
return GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
|
@@ -763,10 +763,12 @@ tGATT_STATUS gatts_get_attribute_value(tGATT_SVC_DB *p_db, UINT16 attr_handle,
|
||||
|
||||
if (p_db == NULL) {
|
||||
GATT_TRACE_ERROR("gatts_get_attribute_value Fail:p_db is NULL.\n");
|
||||
*length = 0;
|
||||
return GATT_INVALID_PDU;
|
||||
}
|
||||
if (p_db->p_attr_list == NULL) {
|
||||
GATT_TRACE_ERROR("gatts_get_attribute_value Fail:p_db->p_attr_list is NULL.\n");
|
||||
*length = 0;
|
||||
return GATT_INVALID_PDU;
|
||||
}
|
||||
if (length == NULL){
|
||||
@@ -775,6 +777,7 @@ tGATT_STATUS gatts_get_attribute_value(tGATT_SVC_DB *p_db, UINT16 attr_handle,
|
||||
}
|
||||
if (value == NULL){
|
||||
GATT_TRACE_ERROR("gatts_get_attribute_value Fail:value is NULL.\n");
|
||||
*length = 0;
|
||||
return GATT_INVALID_PDU;
|
||||
}
|
||||
|
||||
@@ -794,19 +797,19 @@ tGATT_STATUS gatts_get_attribute_value(tGATT_SVC_DB *p_db, UINT16 attr_handle,
|
||||
*value = p_cur->p_value->attr_val.attr_val;
|
||||
return GATT_SUCCESS;
|
||||
} else {
|
||||
GATT_TRACE_ERROR("gatts_get_attribute_value failed:the value length is 0");
|
||||
return GATT_INVALID_ATTR_LEN;
|
||||
*length = 0;
|
||||
return GATT_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (p_cur->p_value->attr_val.attr_len != 0) {
|
||||
if (p_cur->p_value && p_cur->p_value->attr_val.attr_len != 0) {
|
||||
*length = p_cur->p_value->attr_val.attr_len;
|
||||
*value = p_cur->p_value->attr_val.attr_val;
|
||||
return GATT_SUCCESS;
|
||||
} else {
|
||||
GATT_TRACE_ERROR("gatts_get_attribute_value failed:the value length is 0");
|
||||
return GATT_INVALID_ATTR_LEN;
|
||||
*length = 0;
|
||||
return GATT_SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user