mirror of
https://github.com/espressif/esp-idf
synced 2025-03-10 01:29:21 -04:00
fix(ble/bluedroid): Fixed BLE handle check for GATT API
(cherry picked from commit 514155de3b0c44bf9c3b00c31f64b3b40bc36c83) Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
This commit is contained in:
parent
632e0c2a9f
commit
bb5a8e4b4e
@ -363,10 +363,14 @@ esp_err_t esp_ble_gattc_read_char (esp_gatt_if_t gattc_if,
|
||||
}
|
||||
|
||||
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, p_tcb->peer_bda)) {
|
||||
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
|
||||
LOG_DEBUG("%s, the l2cap channel is congest.", __func__);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (handle == 0) {
|
||||
return ESP_GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GATTC;
|
||||
msg.act = BTC_GATTC_ACT_READ_CHAR;
|
||||
@ -400,10 +404,14 @@ esp_err_t esp_ble_gattc_read_by_type (esp_gatt_if_t gattc_if,
|
||||
}
|
||||
|
||||
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, p_tcb->peer_bda)) {
|
||||
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
|
||||
LOG_DEBUG("%s, the l2cap channel is congest.", __func__);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (start_handle == 0 || end_handle == 0) {
|
||||
return ESP_GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GATTC;
|
||||
msg.act = BTC_GATTC_ACT_READ_BY_TYPE;
|
||||
@ -432,7 +440,7 @@ esp_err_t esp_ble_gattc_read_multiple(esp_gatt_if_t gattc_if,
|
||||
}
|
||||
|
||||
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, p_tcb->peer_bda)) {
|
||||
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
|
||||
LOG_DEBUG("%s, the l2cap channel is congest.", __func__);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
@ -468,7 +476,7 @@ esp_err_t esp_ble_gattc_read_multiple_variable(esp_gatt_if_t gattc_if,
|
||||
}
|
||||
|
||||
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, p_tcb->peer_bda)) {
|
||||
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
|
||||
LOG_DEBUG("%s, the l2cap channel is congest.", __func__);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
@ -504,10 +512,14 @@ esp_err_t esp_ble_gattc_read_char_descr (esp_gatt_if_t gattc_if,
|
||||
}
|
||||
|
||||
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, p_tcb->peer_bda)) {
|
||||
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
|
||||
LOG_DEBUG("%s, the l2cap channel is congest.", __func__);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (handle == 0) {
|
||||
return ESP_GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GATTC;
|
||||
msg.act = BTC_GATTC_ACT_READ_CHAR_DESCR;
|
||||
@ -537,10 +549,14 @@ esp_err_t esp_ble_gattc_write_char(esp_gatt_if_t gattc_if,
|
||||
}
|
||||
|
||||
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, p_tcb->peer_bda)) {
|
||||
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
|
||||
LOG_DEBUG("%s, the l2cap channel is congest.", __func__);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (handle == 0) {
|
||||
return ESP_GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GATTC;
|
||||
msg.act = BTC_GATTC_ACT_WRITE_CHAR;
|
||||
@ -576,10 +592,14 @@ esp_err_t esp_ble_gattc_write_char_descr (esp_gatt_if_t gattc_if,
|
||||
}
|
||||
|
||||
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, p_tcb->peer_bda)) {
|
||||
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
|
||||
LOG_DEBUG("%s, the l2cap channel is congest.", __func__);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (handle == 0) {
|
||||
return ESP_GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GATTC;
|
||||
msg.act = BTC_GATTC_ACT_WRITE_CHAR_DESCR;
|
||||
@ -615,10 +635,14 @@ esp_err_t esp_ble_gattc_prepare_write(esp_gatt_if_t gattc_if,
|
||||
}
|
||||
|
||||
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, p_tcb->peer_bda)) {
|
||||
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
|
||||
LOG_DEBUG("%s, the l2cap channel is congest.", __func__);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (handle == 0) {
|
||||
return ESP_GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GATTC;
|
||||
msg.act = BTC_GATTC_ACT_PREPARE_WRITE;
|
||||
@ -652,10 +676,14 @@ esp_err_t esp_ble_gattc_prepare_write_char_descr(esp_gatt_if_t gattc_if,
|
||||
}
|
||||
|
||||
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, p_tcb->peer_bda)) {
|
||||
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
|
||||
LOG_DEBUG("%s, the l2cap channel is congest.", __func__);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (handle == 0) {
|
||||
return ESP_GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GATTC;
|
||||
msg.act = BTC_GATTC_ACT_PREPARE_WRITE_CHAR_DESCR;
|
||||
@ -694,6 +722,10 @@ esp_err_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if,
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (handle == 0) {
|
||||
return ESP_GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GATTC;
|
||||
msg.act = BTC_GATTC_ACT_REG_FOR_NOTIFY;
|
||||
@ -712,6 +744,10 @@ esp_err_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gattc_if,
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (handle == 0) {
|
||||
return ESP_GATT_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GATTC;
|
||||
msg.act = BTC_GATTC_ACT_UNREG_FOR_NOTIFY;
|
||||
|
Loading…
x
Reference in New Issue
Block a user