mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
component/bt: Fix the issue with pointer type conversion in gattc. Unified att(db_sizedb_size) count pointer type in bta and btc, change pointer type in bta from int to uint16_t.
This commit is contained in:
parent
1aee0a0357
commit
295f0cc546
@ -76,7 +76,7 @@ void BTA_GATTC_Disable(void)
|
||||
** Description This function is called to register application callbacks
|
||||
** with BTA GATTC module.
|
||||
**
|
||||
** Parameters p_app_uuid - applicaiton UUID
|
||||
** Parameters p_app_uuid - application UUID
|
||||
** p_client_cb - pointer to the application callback function.
|
||||
**
|
||||
** Returns None
|
||||
@ -333,13 +333,13 @@ const tBTA_GATTC_DESCRIPTOR* BTA_GATTC_GetDescriptor(UINT16 conn_id, UINT16 hand
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetServiceWithUUID(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_service_with_uuid(conn_id, svc_uuid, db, count);
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetAllChar(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_ALL_CHAR,
|
||||
@ -354,7 +354,7 @@ void BTA_GATTC_GetAllChar(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetAllDescriptor(UINT16 conn_id, UINT16 char_handle,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_ALL_DESCRI,
|
||||
@ -369,7 +369,7 @@ void BTA_GATTC_GetAllDescriptor(UINT16 conn_id, UINT16 char_handle,
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetCharByUUID(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, tBT_UUID char_uuid,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_CHAR_BY_UUID,
|
||||
@ -385,7 +385,7 @@ void BTA_GATTC_GetCharByUUID(UINT16 conn_id, UINT16 start_handle, UINT16 end_han
|
||||
|
||||
void BTA_GATTC_GetDescrByUUID(UINT16 conn_id, uint16_t start_handle, uint16_t end_handle,
|
||||
tBT_UUID char_uuid, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_DESCRI_BY_UUID,
|
||||
@ -400,7 +400,7 @@ void BTA_GATTC_GetDescrByUUID(UINT16 conn_id, uint16_t start_handle, uint16_t en
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetDescrByCharHandle(UINT16 conn_id, UINT16 char_handle, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_DESCRI_BY_HANDLE,
|
||||
@ -415,7 +415,7 @@ void BTA_GATTC_GetDescrByCharHandle(UINT16 conn_id, UINT16 char_handle, tBT_UUID
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetIncludeService(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
tBT_UUID *incl_uuid, btgatt_db_element_t **db, int *count)
|
||||
tBT_UUID *incl_uuid, btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_INCLUDE_SVC,
|
||||
@ -429,13 +429,13 @@ void BTA_GATTC_GetIncludeService(UINT16 conn_id, UINT16 start_handle, UINT16 end
|
||||
count);
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count)
|
||||
void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_size_handle(conn_id, start_handle, end_handle, count);
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count)
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_size_with_type_handle(conn_id, type, start_handle, end_handle, char_handle, count);
|
||||
}
|
||||
@ -454,7 +454,7 @@ void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_GATTC_GetGattDb(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_gatt_db(conn_id, start_handle, end_handle, db, count);
|
||||
}
|
||||
|
@ -1227,7 +1227,7 @@ tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle)
|
||||
|
||||
void bta_gattc_get_service_with_uuid(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **svc_db,
|
||||
int *count)
|
||||
UINT16 *count)
|
||||
{
|
||||
const list_t* svc = bta_gattc_get_services(conn_id);
|
||||
if(!svc) {
|
||||
@ -1301,7 +1301,7 @@ void bta_gattc_get_db_with_opration(UINT16 conn_id,
|
||||
tBT_UUID *descr_uuid,
|
||||
UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **char_db,
|
||||
int *count)
|
||||
UINT16 *count)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
@ -1664,7 +1664,7 @@ static size_t bta_gattc_get_db_size(list_t *services,
|
||||
return db_size;
|
||||
}
|
||||
|
||||
void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count)
|
||||
void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
@ -1683,7 +1683,7 @@ void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 en
|
||||
}
|
||||
|
||||
void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count)
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
@ -1729,7 +1729,7 @@ void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute
|
||||
static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
|
||||
UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db,
|
||||
int *count)
|
||||
UINT16 *count)
|
||||
{
|
||||
APPL_TRACE_DEBUG("%s: start_handle 0x%04x, end_handle 0x%04x",
|
||||
__func__, start_handle, end_handle);
|
||||
@ -1877,7 +1877,7 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
|
||||
** Returns None.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, int *count)
|
||||
void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
|
@ -505,12 +505,12 @@ extern const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(UINT16 conn_id
|
||||
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle);
|
||||
extern tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16 handle);
|
||||
extern tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle);
|
||||
extern void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count);
|
||||
extern void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count);
|
||||
extern void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count);
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count);
|
||||
extern void bta_gattc_get_service_with_uuid(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **svc_db,
|
||||
int *count);
|
||||
UINT16 *count);
|
||||
|
||||
extern void bta_gattc_get_db_with_opration(UINT16 conn_id,
|
||||
bt_gatt_get_db_op_t op,
|
||||
@ -520,9 +520,9 @@ extern void bta_gattc_get_db_with_opration(UINT16 conn_id,
|
||||
tBT_UUID *descr_uuid,
|
||||
UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **char_db,
|
||||
int *count);
|
||||
UINT16 *count);
|
||||
|
||||
extern void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, int *count);
|
||||
extern void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern tBTA_GATT_STATUS bta_gattc_init_cache(tBTA_GATTC_SERV *p_srvc_cb);
|
||||
extern void bta_gattc_rebuild_cache(tBTA_GATTC_SERV *p_srcv, UINT16 num_attr, tBTA_GATTC_NV_ATTR *attr);
|
||||
|
@ -152,7 +152,7 @@ typedef UINT8 tBTA_GATT_STATUS;
|
||||
#define BTA_GATTC_CLOSE_EVT 5 /* GATTC close request status event */
|
||||
#define BTA_GATTC_SEARCH_CMPL_EVT 6 /* GATT discovery complete event */
|
||||
#define BTA_GATTC_SEARCH_RES_EVT 7 /* GATT discovery result event */
|
||||
#define BTA_GATTC_READ_DESCR_EVT 8 /* GATT read characterisitc descriptor event */
|
||||
#define BTA_GATTC_READ_DESCR_EVT 8 /* GATT read characteristic descriptor event */
|
||||
#define BTA_GATTC_WRITE_DESCR_EVT 9 /* GATT write characteristic descriptor event */
|
||||
#define BTA_GATTC_NOTIF_EVT 10 /* GATT attribute notification event */
|
||||
#define BTA_GATTC_PREP_WRITE_EVT 11 /* GATT prepare write event */
|
||||
@ -730,7 +730,7 @@ extern void BTA_GATTC_Disable(void);
|
||||
** Description This function is called to register application callbacks
|
||||
** with BTA GATTC module.
|
||||
**
|
||||
** Parameters p_app_uuid - applicaiton UUID
|
||||
** Parameters p_app_uuid - application UUID
|
||||
** p_client_cb - pointer to the application callback function.
|
||||
**
|
||||
** Returns None
|
||||
@ -858,32 +858,32 @@ extern const tBTA_GATTC_CHARACTERISTIC* BTA_GATTC_GetCharacteristic(UINT16 conn_
|
||||
*******************************************************************************/
|
||||
extern const tBTA_GATTC_DESCRIPTOR* BTA_GATTC_GetDescriptor(UINT16 conn_id, UINT16 handle);
|
||||
|
||||
extern void BTA_GATTC_GetServiceWithUUID(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
extern void BTA_GATTC_GetServiceWithUUID(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetAllChar(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetAllDescriptor(UINT16 conn_id, UINT16 char_handle,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetCharByUUID(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, tBT_UUID char_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetDescrByUUID(UINT16 conn_id, uint16_t start_handle, uint16_t end_handle,
|
||||
tBT_UUID char_uuid, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetDescrByCharHandle(UINT16 conn_id, UINT16 char_handle, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetIncludeService(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
tBT_UUID *incl_uuid, btgatt_db_element_t **db, int *count);
|
||||
tBT_UUID *incl_uuid, btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count);
|
||||
extern void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count);
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -898,7 +898,7 @@ extern void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_GetGattDb(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -1193,7 +1193,7 @@ extern void BTA_GATTS_Disable(void);
|
||||
** Description This function is called to register application callbacks
|
||||
** with BTA GATTS module.
|
||||
**
|
||||
** Parameters p_app_uuid - applicaiton UUID
|
||||
** Parameters p_app_uuid - application UUID
|
||||
** p_cback - pointer to the application callback function.
|
||||
**
|
||||
** Returns None
|
||||
@ -1316,7 +1316,7 @@ extern void BTA_GATTS_DeleteService(UINT16 service_id);
|
||||
** Description This function is called to start a service.
|
||||
**
|
||||
** Parameters service_id: the service ID to be started.
|
||||
** sup_transport: supported trasnport.
|
||||
** sup_transport: supported transport.
|
||||
**
|
||||
** Returns None.
|
||||
**
|
||||
|
@ -315,7 +315,7 @@ esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int svc_num = 0;
|
||||
uint16_t svc_num = 0;
|
||||
tBT_UUID *bta_uuid = NULL;
|
||||
if (svc_uuid) {
|
||||
bta_uuid = osi_malloc(sizeof(tBT_UUID));
|
||||
@ -324,7 +324,7 @@ esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc
|
||||
|
||||
BTA_GATTC_GetServiceWithUUID(conn_id, bta_uuid, &db, &svc_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(svc_num, offset)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)svc_num, offset)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
@ -334,7 +334,7 @@ esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)svc_num, ESP_GATT_DB_PRIMARY_SERVICE, offset, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, svc_num, ESP_GATT_DB_PRIMARY_SERVICE, offset, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = svc_num;
|
||||
@ -356,17 +356,17 @@ esp_gatt_status_t btc_ble_gattc_get_all_char(uint16_t conn_id,
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int char_num = 0;
|
||||
uint16_t char_num = 0;
|
||||
BTA_GATTC_GetAllChar(conn_id, start_handle, end_handle, &db, &char_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(char_num, offset)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)char_num, offset)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)char_num, ESP_GATT_DB_CHARACTERISTIC, offset, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, char_num, ESP_GATT_DB_CHARACTERISTIC, offset, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = char_num;
|
||||
@ -384,17 +384,17 @@ esp_gatt_status_t btc_ble_gattc_get_all_descr(uint16_t conn_id,
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int descr_num = 0;
|
||||
uint16_t descr_num = 0;
|
||||
BTA_GATTC_GetAllDescriptor(conn_id, char_handle, &db, &descr_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(descr_num, offset)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)descr_num, offset)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, offset, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, descr_num, ESP_GATT_DB_DESCRIPTOR, offset, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = descr_num;
|
||||
@ -414,19 +414,19 @@ esp_gatt_status_t btc_ble_gattc_get_char_by_uuid(uint16_t conn_id,
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int char_num = 0;
|
||||
uint16_t char_num = 0;
|
||||
tBT_UUID bta_uuid = {0};
|
||||
btc_to_bta_uuid(&bta_uuid, &char_uuid);
|
||||
BTA_GATTC_GetCharByUUID(conn_id, start_handle, end_handle, bta_uuid, &db, &char_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(char_num, 0)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)char_num, 0)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)char_num, ESP_GATT_DB_CHARACTERISTIC, 0, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, char_num, ESP_GATT_DB_CHARACTERISTIC, 0, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = char_num;
|
||||
@ -447,7 +447,7 @@ esp_gatt_status_t btc_ble_gattc_get_descr_by_uuid(uint16_t conn_id,
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int descr_num = 0;
|
||||
uint16_t descr_num = 0;
|
||||
tBT_UUID bta_char_uuid = {0};
|
||||
tBT_UUID bta_descr_uuid = {0};
|
||||
btc_to_bta_uuid(&bta_char_uuid, &char_uuid);
|
||||
@ -456,14 +456,14 @@ esp_gatt_status_t btc_ble_gattc_get_descr_by_uuid(uint16_t conn_id,
|
||||
BTA_GATTC_GetDescrByUUID(conn_id, start_handle, end_handle,
|
||||
bta_char_uuid, bta_descr_uuid, &db, &descr_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(descr_num, 0)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)descr_num, 0)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = descr_num;
|
||||
@ -482,20 +482,20 @@ esp_gatt_status_t btc_ble_gattc_get_descr_by_char_handle(uint16_t conn_id,
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int descr_num = 0;
|
||||
uint16_t descr_num = 0;
|
||||
tBT_UUID bta_descr_uuid = {0};
|
||||
btc_to_bta_uuid(&bta_descr_uuid, &descr_uuid);
|
||||
|
||||
BTA_GATTC_GetDescrByCharHandle(conn_id, char_handle, bta_descr_uuid, &db, &descr_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(descr_num, 0)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)descr_num, 0)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = descr_num;
|
||||
@ -516,7 +516,7 @@ esp_gatt_status_t btc_ble_gattc_get_include_service(uint16_t conn_id,
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int incl_num = 0;
|
||||
uint16_t incl_num = 0;
|
||||
tBT_UUID bta_uuid = {0};
|
||||
|
||||
if (incl_uuid != NULL) {
|
||||
@ -526,14 +526,14 @@ esp_gatt_status_t btc_ble_gattc_get_include_service(uint16_t conn_id,
|
||||
BTA_GATTC_GetIncludeService(conn_id, start_handle, end_handle, NULL, &db, &incl_num);
|
||||
}
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(incl_num, 0)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)incl_num, 0)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
}else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)incl_num, ESP_GATT_DB_INCLUDED_SERVICE, 0, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, incl_num, ESP_GATT_DB_INCLUDED_SERVICE, 0, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = incl_num;
|
||||
@ -552,9 +552,9 @@ esp_gatt_status_t btc_ble_gattc_get_attr_count(uint16_t conn_id,
|
||||
uint16_t *count)
|
||||
{
|
||||
if (type == ESP_GATT_DB_ALL) {
|
||||
BTA_GATTC_GetDBSize(conn_id, start_handle, end_handle, (int *)count);
|
||||
BTA_GATTC_GetDBSize(conn_id, start_handle, end_handle, count);
|
||||
} else {
|
||||
BTA_GATTC_GetDBSizeByType(conn_id, type, start_handle, end_handle, char_handle, (int *)count);
|
||||
BTA_GATTC_GetDBSizeByType(conn_id, type, start_handle, end_handle, char_handle, count);
|
||||
}
|
||||
|
||||
return ESP_GATT_OK;
|
||||
@ -564,7 +564,7 @@ esp_gatt_status_t btc_ble_gattc_get_db(uint16_t conn_id, uint16_t start_handle,
|
||||
esp_gattc_db_elem_t *db, uint16_t *count)
|
||||
{
|
||||
btgatt_db_element_t *get_db = NULL;
|
||||
int num = 0;
|
||||
uint16_t num = 0;
|
||||
tBT_UUID bta_uuid;
|
||||
uint16_t db_size = 0;
|
||||
BTA_GATTC_GetGattDb(conn_id, start_handle, end_handle, &get_db, &num);
|
||||
|
Loading…
Reference in New Issue
Block a user