esp-idf/components/bt/host/bluedroid/api/esp_gattc_api.c

647 lines
24 KiB
C
Raw Normal View History

// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <string.h>
#include "esp_gattc_api.h"
#include "esp_bt_main.h"
#include "btc/btc_manage.h"
#include "btc_gattc.h"
#include "btc_gatt_util.h"
#include "stack/l2cdefs.h"
#include "stack/l2c_api.h"
#if (GATTC_INCLUDED == TRUE)
esp_err_t esp_ble_gattc_register_callback(esp_gattc_cb_t callback)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
if (callback == NULL) {
return ESP_FAIL;
}
btc_profile_cb_set(BTC_PID_GATTC, callback);
return ESP_OK;
}
esp_err_t esp_ble_gattc_app_register(uint16_t app_id)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
2016-11-29 06:45:10 -05:00
if (app_id > ESP_APP_ID_MAX) {
2016-11-29 01:38:58 -05:00
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_APP_REGISTER;
arg.app_reg.app_id = app_id;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_app_unregister(esp_gatt_if_t gattc_if)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_APP_UNREGISTER;
arg.app_unreg.gattc_if = gattc_if;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, esp_ble_addr_type_t remote_addr_type, bool is_direct)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_OPEN;
arg.open.gattc_if = gattc_if;
memcpy(arg.open.remote_bda, remote_bda, ESP_BD_ADDR_LEN);
arg.open.remote_addr_type = remote_addr_type;
arg.open.is_direct = is_direct;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_close (esp_gatt_if_t gattc_if, uint16_t conn_id)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_CLOSE;
arg.close.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_send_mtu_req (esp_gatt_if_t gattc_if, uint16_t conn_id)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_CFG_MTU;
arg.cfg_mtu.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_search_service(esp_gatt_if_t gattc_if, uint16_t conn_id, esp_bt_uuid_t *filter_uuid)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_SEARCH_SERVICE;
arg.search_srvc.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
if (filter_uuid) {
arg.search_srvc.filter_uuid_enable = true;
memcpy(&arg.search_srvc.filter_uuid, filter_uuid, sizeof(esp_bt_uuid_t));
} else {
arg.search_srvc.filter_uuid_enable = false;
}
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
esp_gatt_status_t esp_ble_gattc_get_service(esp_gatt_if_t gattc_if, uint16_t conn_id, esp_bt_uuid_t *svc_uuid,
esp_gattc_service_elem_t *result, uint16_t *count, uint16_t offset)
{
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
if (result == NULL || count == NULL || *count == 0) {
return ESP_GATT_INVALID_PDU;
}
uint16_t conn_hdl = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
return btc_ble_gattc_get_service(conn_hdl, svc_uuid, result, count, offset);
}
esp_gatt_status_t esp_ble_gattc_get_all_char(esp_gatt_if_t gattc_if,
uint16_t conn_id,
uint16_t start_handle,
uint16_t end_handle,
esp_gattc_char_elem_t *result,
uint16_t *count, uint16_t offset)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
if ((start_handle == 0) && (end_handle == 0)) {
*count = 0;
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
return ESP_GATT_INVALID_HANDLE;
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
if (result == NULL || count == NULL || *count == 0) {
return ESP_GATT_INVALID_PDU;
}
uint16_t conn_hdl = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
return btc_ble_gattc_get_all_char(conn_hdl, start_handle, end_handle, result, count, offset);
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
esp_gatt_status_t esp_ble_gattc_get_all_descr(esp_gatt_if_t gattc_if,
uint16_t conn_id,
uint16_t char_handle,
esp_gattc_descr_elem_t *result,
uint16_t *count, uint16_t offset)
{
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (char_handle == 0) {
return ESP_GATT_INVALID_HANDLE;
}
if (result == NULL || count == NULL || *count == 0) {
return ESP_GATT_INVALID_PDU;
}
uint16_t conn_hdl = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
return btc_ble_gattc_get_all_descr(conn_hdl, char_handle, result, count, offset);
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
esp_gatt_status_t esp_ble_gattc_get_char_by_uuid(esp_gatt_if_t gattc_if,
uint16_t conn_id,
uint16_t start_handle,
uint16_t end_handle,
esp_bt_uuid_t char_uuid,
esp_gattc_char_elem_t *result,
uint16_t *count)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
if (start_handle == 0 && end_handle == 0) {
*count = 0;
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
return ESP_GATT_INVALID_HANDLE;
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
if (result == NULL || count == NULL || *count == 0) {
return ESP_GATT_INVALID_PDU;
}
uint16_t conn_hdl = BTC_GATT_CREATE_CONN_ID(gattc_if,conn_id);
return btc_ble_gattc_get_char_by_uuid(conn_hdl, start_handle, end_handle, char_uuid, result, count);
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
esp_gatt_status_t esp_ble_gattc_get_descr_by_uuid(esp_gatt_if_t gattc_if,
uint16_t conn_id,
uint16_t start_handle,
uint16_t end_handle,
esp_bt_uuid_t char_uuid,
esp_bt_uuid_t descr_uuid,
esp_gattc_descr_elem_t *result,
uint16_t *count)
{
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (result == NULL || count == NULL || *count == 0) {
return ESP_GATT_INVALID_PDU;
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
uint16_t conn_hdl = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
return btc_ble_gattc_get_descr_by_uuid(conn_hdl, start_handle, end_handle, char_uuid, descr_uuid, result, count);
}
esp_gatt_status_t esp_ble_gattc_get_descr_by_char_handle(esp_gatt_if_t gattc_if,
uint16_t conn_id,
uint16_t char_handle,
esp_bt_uuid_t descr_uuid,
esp_gattc_descr_elem_t *result,
uint16_t *count)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
if (char_handle == 0) {
*count = 0;
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
return ESP_GATT_INVALID_HANDLE;
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
if (result == NULL || count == NULL || *count == 0) {
return ESP_GATT_INVALID_PDU;
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
uint16_t conn_hdl = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
return btc_ble_gattc_get_descr_by_char_handle(conn_hdl, char_handle, descr_uuid, result, count);
}
esp_gatt_status_t esp_ble_gattc_get_include_service(esp_gatt_if_t gattc_if,
uint16_t conn_id,
uint16_t start_handle,
uint16_t end_handle,
esp_bt_uuid_t *incl_uuid,
esp_gattc_incl_svc_elem_t *result,
uint16_t *count)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (start_handle == 0 && end_handle == 0) {
*count = 0;
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
return ESP_GATT_INVALID_HANDLE;
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
if (result == NULL || count == NULL || *count == 0) {
return ESP_GATT_INVALID_PDU;
}
uint16_t conn_hdl = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
return btc_ble_gattc_get_include_service(conn_hdl, start_handle, end_handle, incl_uuid, result, count);
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
esp_gatt_status_t esp_ble_gattc_get_attr_count(esp_gatt_if_t gattc_if,
uint16_t conn_id,
esp_gatt_db_attr_type_t type,
uint16_t start_handle,
uint16_t end_handle,
uint16_t char_handle,
uint16_t *count)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if ((start_handle == 0 && end_handle == 0) && (type != ESP_GATT_DB_DESCRIPTOR)) {
*count = 0;
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
return ESP_GATT_INVALID_HANDLE;
}
if (count == NULL) {
return ESP_GATT_INVALID_PDU;
}
uint16_t conn_hdl = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
return btc_ble_gattc_get_attr_count(conn_hdl, type, start_handle, end_handle, char_handle, count);
}
esp_gatt_status_t esp_ble_gattc_get_db(esp_gatt_if_t gattc_if, uint16_t conn_id, uint16_t start_handle, uint16_t end_handle,
esp_gattc_db_elem_t *db, uint16_t *count)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (start_handle == 0 && end_handle == 0) {
*count = 0;
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
return ESP_GATT_INVALID_HANDLE;
}
if (db == NULL || count == NULL || *count == 0) {
return ESP_GATT_INVALID_PDU;
}
uint16_t conn_hdl = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
return btc_ble_gattc_get_db(conn_hdl, start_handle, end_handle, db, count);
}
esp_err_t esp_ble_gattc_read_char (esp_gatt_if_t gattc_if,
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
uint16_t conn_id, uint16_t handle,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, conn_id)) {
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
return ESP_FAIL;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_READ_CHAR;
arg.read_char.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
arg.read_char.handle = handle;
arg.read_char.auth_req = auth_req;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
esp_err_t esp_ble_gattc_read_multiple(esp_gatt_if_t gattc_if,
uint16_t conn_id, esp_gattc_multi_t *read_multi,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, conn_id)) {
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
return ESP_FAIL;
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_READ_MULTIPLE_CHAR;
arg.read_multiple.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
arg.read_multiple.num_attr = read_multi->num_attr;
arg.read_multiple.auth_req = auth_req;
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
if (read_multi->num_attr > 0) {
memcpy(arg.read_multiple.handles, read_multi->handles, sizeof(uint16_t)*read_multi->num_attr);
} else {
LOG_ERROR("%s(), the num_attr should not be 0.", __func__);
return ESP_FAIL;
}
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_read_char_descr (esp_gatt_if_t gattc_if,
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
uint16_t conn_id, uint16_t handle,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, conn_id)) {
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
return ESP_FAIL;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_READ_CHAR_DESCR;
arg.read_descr.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
arg.read_descr.handle = handle;
arg.read_descr.auth_req = auth_req;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
esp_err_t esp_ble_gattc_write_char(esp_gatt_if_t gattc_if,
uint16_t conn_id, uint16_t handle,
uint16_t value_len,
uint8_t *value,
esp_gatt_write_type_t write_type,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, conn_id)) {
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
return ESP_FAIL;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_WRITE_CHAR;
arg.write_char.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
arg.write_char.handle = handle;
arg.write_char.value_len = value_len > ESP_GATT_MAX_ATTR_LEN ? ESP_GATT_MAX_ATTR_LEN : value_len;
arg.write_char.value = value;
2016-11-29 04:27:12 -05:00
arg.write_char.write_type = write_type;
arg.write_char.auth_req = auth_req;
if(write_type == ESP_GATT_WRITE_TYPE_NO_RSP){
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTC_NUM, NULL);
}
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_write_char_descr (esp_gatt_if_t gattc_if,
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
uint16_t conn_id, uint16_t handle,
uint16_t value_len,
uint8_t *value,
esp_gatt_write_type_t write_type,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, conn_id)) {
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
return ESP_FAIL;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_WRITE_CHAR_DESCR;
arg.write_descr.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
arg.write_descr.handle = handle;
arg.write_descr.value_len = value_len > ESP_GATT_MAX_ATTR_LEN ? ESP_GATT_MAX_ATTR_LEN : value_len;
arg.write_descr.value = value;
2016-11-29 04:27:12 -05:00
arg.write_descr.write_type = write_type;
arg.write_descr.auth_req = auth_req;
if(write_type == ESP_GATT_WRITE_TYPE_NO_RSP){
l2ble_update_att_acl_pkt_num(L2CA_ADD_BTC_NUM, NULL);
}
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_prepare_write(esp_gatt_if_t gattc_if,
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
uint16_t conn_id, uint16_t handle,
uint16_t offset,
uint16_t value_len,
uint8_t *value,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, conn_id)) {
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
return ESP_FAIL;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_PREPARE_WRITE;
arg.prep_write.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
arg.prep_write.handle = handle;
arg.prep_write.offset = offset;
arg.prep_write.value_len = value_len > ESP_GATT_MAX_ATTR_LEN ? ESP_GATT_MAX_ATTR_LEN : value_len; // length check ?
arg.prep_write.value = value;
arg.prep_write.auth_req = auth_req;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_prepare_write_char_descr(esp_gatt_if_t gattc_if,
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
uint16_t conn_id, uint16_t handle,
uint16_t offset,
uint16_t value_len,
uint8_t *value,
esp_gatt_auth_req_t auth_req)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (L2CA_CheckIsCongest(L2CAP_ATT_CID, conn_id)) {
LOG_DEBUG("%s, the l2cap chanel is congest.", __func__);
return ESP_FAIL;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_PREPARE_WRITE_CHAR_DESCR;
arg.prep_write_descr.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
arg.prep_write_descr.handle = handle;
arg.prep_write_descr.offset = offset;
arg.prep_write_descr.value_len = value_len > ESP_GATT_MAX_ATTR_LEN ? ESP_GATT_MAX_ATTR_LEN : value_len; // length check ?
arg.prep_write_descr.value = value;
arg.prep_write_descr.auth_req = auth_req;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), btc_gattc_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_execute_write (esp_gatt_if_t gattc_if, uint16_t conn_id, bool is_execute)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_EXECUTE_WRITE;
arg.exec_write.conn_id = BTC_GATT_CREATE_CONN_ID(gattc_if, conn_id);
arg.exec_write.is_execute = is_execute;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if,
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
esp_bd_addr_t server_bda, uint16_t handle)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_REG_FOR_NOTIFY;
arg.reg_for_notify.gattc_if = gattc_if;
memcpy(arg.reg_for_notify.remote_bda, server_bda, sizeof(esp_bd_addr_t));
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
arg.reg_for_notify.handle = handle;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gattc_if,
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
esp_bd_addr_t server_bda, uint16_t handle)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_UNREG_FOR_NOTIFY;
arg.unreg_for_notify.gattc_if = gattc_if;
This is a combination of 4 commits. squash again all the commit. component/bt: Change all the gattc API && bta gattc layer. component/bt: Debug the code and change the btc_ble_gattc_get_db method. component/bt: Change the gatt read API interface. component/bt: Reconstruction the BTA_gattc_cache code. component/bt: Change back the bluedroid_get_status to marco. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Change the gattc docs format. component/bt: Change the docs format. component/bt: fix the read char value bug. component/bt: change the gattc_get_attr_count method. component/bt: Change back the bta_gattc write ccc code. component/bt: Change the gattc api docs format component/bt: Change the gattc API docs. component/bt: Change the prepare write descriptor method to avoid the exection. Component/bt: modify gatt clinet demo with new API component/bt: Change the p_src_data->read.p_value to avoid exection. compoent/bt: Change the bugfix of gattc unreg for the notify. Modify gattc security demo component/bt: Change the log error. Component/bt: modify gattc_multi_connect demo componnet/bt: Change the bta_gattc_cache sdp include. component/bt: Change the start_handle & end_handle not from the service. component/bt: Change the gattc API docs. component/bt: Change the return issues. component/bt: Fixed the include service bug. component/bt: Modify gattc_multi_connect demo , add scan log component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug. component/bt: Fix the invalid handle of the get all char issues. component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue. component/bt: Fixed the get secondly service num not correct issue. component/bt: Fixed the last service handle not correted issue.
2017-08-24 02:24:04 -04:00
arg.unreg_for_notify.handle = handle;
memcpy(arg.unreg_for_notify.remote_bda, server_bda, sizeof(esp_bd_addr_t));
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_cache_refresh(esp_bd_addr_t remote_bda)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_CACHE_REFRESH;
memcpy(arg.cache_refresh.remote_bda, remote_bda, sizeof(esp_bd_addr_t));
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_cache_clean(esp_bd_addr_t remote_bda)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_CACHE_CLEAN;
memcpy(arg.cache_clean.remote_bda, remote_bda, sizeof(esp_bd_addr_t));
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_cache_assoc(esp_gatt_if_t gattc_if, esp_bd_addr_t src_addr, esp_bd_addr_t assoc_addr, bool is_assoc)
component/bt: Change the btc gattc callback function with the compile error. 1. Change all the gattc API && bta gattc layer. 2. Debug the code and change the btc_ble_gattc_get_db method. 3. Change the gatt read API interface. 4. Reconstruction the BTA_gattc_cache code. 5. Change back the bluedroid_get_status to marco. 6. Change the gattc docs format. 7. Change the docs format. 8. fix the read char value bug. 9. change the gattc_get_attr_count method. 10. Change back the bta_gattc write ccc code. 11. Change the gattc api docs format 12. Change the gattc API docs. 13. Change the prepare write descriptor method to avoid the exection. 14. modify gatt clinet demo with new API 15. Change the p_src_data->read.p_value to avoid exection. 16. Change the bugfix of gattc unreg for the notify. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Added the bta_gattc_cache_write when gatt discovery complete. component/bt: Added the bta_gattc_cache_write declaration. component/bt: Added the comments for esp_ble_gattc_cache_refresh API. component/bt: Change the spelling errors & some comment error. component/bt: fix bug of get gattc cache address list error. 1. Change the esp_bluedroid_get_status to macro; 2. added the malloc & free for the get_addr_list component/bt: Added the addr_info->ass_addr == NULL Judgment to prevent crashes in the bta_gattc_co_cache_find_src_addr function. component/bt: Fixed following gattc cache bugs 1. gattc can't refresh the gattc cache in the gatt discover state; 2. remove the nvs_get_blob in the cache address init function; 3. added the nvs_set_blob return value judgment in the cache address save function; 4. added the list_new when ass_address is NULL; 5. Change the ass_address list remove method to fix the ass address can't remove bug.
2018-03-11 23:34:20 -04:00
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_CACHE_ASSOC;
arg.cache_assoc.is_assoc = is_assoc;
arg.cache_assoc.gattc_if = gattc_if;
memcpy(arg.cache_assoc.src_addr, src_addr, sizeof(esp_bd_addr_t));
memcpy(arg.cache_assoc.assoc_addr, assoc_addr, sizeof(esp_bd_addr_t));
component/bt: Change the btc gattc callback function with the compile error. 1. Change all the gattc API && bta gattc layer. 2. Debug the code and change the btc_ble_gattc_get_db method. 3. Change the gatt read API interface. 4. Reconstruction the BTA_gattc_cache code. 5. Change back the bluedroid_get_status to marco. 6. Change the gattc docs format. 7. Change the docs format. 8. fix the read char value bug. 9. change the gattc_get_attr_count method. 10. Change back the bta_gattc write ccc code. 11. Change the gattc api docs format 12. Change the gattc API docs. 13. Change the prepare write descriptor method to avoid the exection. 14. modify gatt clinet demo with new API 15. Change the p_src_data->read.p_value to avoid exection. 16. Change the bugfix of gattc unreg for the notify. component/bt: Added the serch service res start_handle & end_handle to the result. component/bt: Added the bta_gattc_cache_write when gatt discovery complete. component/bt: Added the bta_gattc_cache_write declaration. component/bt: Added the comments for esp_ble_gattc_cache_refresh API. component/bt: Change the spelling errors & some comment error. component/bt: fix bug of get gattc cache address list error. 1. Change the esp_bluedroid_get_status to macro; 2. added the malloc & free for the get_addr_list component/bt: Added the addr_info->ass_addr == NULL Judgment to prevent crashes in the bta_gattc_co_cache_find_src_addr function. component/bt: Fixed following gattc cache bugs 1. gattc can't refresh the gattc cache in the gatt discover state; 2. remove the nvs_get_blob in the cache address init function; 3. added the nvs_set_blob return value judgment in the cache address save function; 4. added the list_new when ass_address is NULL; 5. Change the ass_address list remove method to fix the ass address can't remove bug.
2018-03-11 23:34:20 -04:00
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gattc_cache_get_addr_list(esp_gatt_if_t gattc_if)
{
btc_msg_t msg;
btc_ble_gattc_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ATC_CACHE_GET_ADDR_LIST;
arg.get_addr_list.gattc_if = gattc_if;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif ///GATTC_INCLUDED == TRUE